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