]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardModelledPropertyVariable.java
Merge "Documented difference of RuntimeEnvironmentRequest and Runti...quest2" into...
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / variable / StandardModelledPropertyVariable.java
1 package org.simantics.db.layer0.variable;
2
3 import org.simantics.db.ReadGraph;
4 import org.simantics.db.Resource;
5 import org.simantics.db.common.adaption.SimpleContextualAdapter;
6 import org.simantics.db.exception.DatabaseException;
7
8 public class StandardModelledPropertyVariable extends SimpleContextualAdapter<Variable, ModelledVariablePropertyDescriptor> {
9
10         @Override
11         public Variable adapt(ReadGraph graph, Resource source, ModelledVariablePropertyDescriptor context) throws DatabaseException {
12                 
13                 // Let the predicate provide an adapter if it wants
14                 
15                 Variable propertyAdapter = graph.getPossibleContextualAdapter(context.getProperty(), context, ModelledVariablePropertyDescriptor.class, Variable.class);
16                 if(propertyAdapter != null) return propertyAdapter; 
17                 
18                 // Fall back to standard
19                 return new StandardGraphPropertyVariable(graph, context.getVariable(), null, context.getSubject(), context.getProperty());
20                 
21         }
22
23 }