1 package org.simantics.db.layer0.variable;
\r
3 import java.util.Collection;
\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
11 public interface VariableProperties<Key> {
\r
14 * Gets a named property of this variable. A property corresponds to a '#' in URI notation
\r
16 Variable getProperty(ReadGraph graph, Key key) throws DatabaseException;
\r
17 Variable getPossibleProperty(ReadGraph graph, Key key) throws DatabaseException;
\r
19 Collection<Variable> getProperties(ReadGraph graph, Key key) throws DatabaseException;
\r
22 * Convenience method for getting the value of a named property.
\r
24 <T> T getPropertyValue(ReadGraph graph, Key key) throws DatabaseException;
\r
25 <T> T getPossiblePropertyValue(ReadGraph graph, Key key) throws DatabaseException;
\r
27 * Convenience method for getting the value of a named property.
\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
33 * Writes a value to the given property using the given binding.
\r
35 * @throws NonWritableVariableException if the variable is not writable
\r
36 * @throws DatabaseException in any other error conditions
\r
38 void setPropertyValue(WriteGraph graph, Key key, Object value, Binding binding) throws DatabaseException;
\r
40 * Writes a value to the given property using the default binding based on
\r
43 * @throws NonWritableVariableException if the variable is not writable
\r
44 * @throws DatabaseException in any other error conditions
\r
46 void setPropertyValue(WriteGraph graph, Key key, Object value) throws DatabaseException;
\r