]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/VariableProperties.java
Merge "Fixed ProfileObserver.update race with multiple query threads"
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / variable / VariableProperties.java
1 package org.simantics.db.layer0.variable;
2
3 import java.util.Collection;
4
5 import org.simantics.databoard.binding.Binding;
6 import org.simantics.db.ReadGraph;
7 import org.simantics.db.WriteGraph;
8 import org.simantics.db.exception.DatabaseException;
9 import org.simantics.db.layer0.exception.NonWritableVariableException;
10
11 public interface VariableProperties<Key> {
12
13         /*
14          * Gets a named property of this variable. A property corresponds to a '#' in URI notation
15          */
16         Variable getProperty(ReadGraph graph, Key key) throws DatabaseException;        
17         Variable getPossibleProperty(ReadGraph graph, Key key) throws DatabaseException;        
18         
19         Collection<Variable> getProperties(ReadGraph graph, Key key) throws DatabaseException;
20
21         /*
22          * Convenience method for getting the value of a named property.
23          */
24         <T> T getPropertyValue(ReadGraph graph, Key key) throws DatabaseException;
25         <T> T getPossiblePropertyValue(ReadGraph graph, Key key) throws DatabaseException;
26         /*
27          * Convenience method for getting the value of a named property.
28          */
29         <T> T getPropertyValue(ReadGraph graph, Key key, Binding binding) throws DatabaseException;
30         <T> T getPossiblePropertyValue(ReadGraph graph, Key key, Binding binding) throws DatabaseException;
31         
32         /**
33          * Writes a value to the given property using the given binding.
34          * 
35          * @throws NonWritableVariableException if the variable is not writable
36          * @throws DatabaseException in any other error conditions 
37          */
38         void setPropertyValue(WriteGraph graph, Key key, Object value, Binding binding) throws DatabaseException;
39         /**
40          * Writes a value to the given property using the default binding based on
41          * the value class.
42          * 
43          * @throws NonWritableVariableException if the variable is not writable
44          * @throws DatabaseException in any other error conditions 
45          */
46         void setPropertyValue(WriteGraph graph, Key key, Object value) throws DatabaseException;
47         
48 }