1 package org.simantics.db.layer0.variable;
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;
8 public class StandardModelledPropertyVariable extends SimpleContextualAdapter<Variable, ModelledVariablePropertyDescriptor> {
11 public Variable adapt(ReadGraph graph, Resource source, ModelledVariablePropertyDescriptor context) throws DatabaseException {
13 // Let the predicate provide an adapter if it wants
15 Variable propertyAdapter = graph.getPossibleContextualAdapter(context.getProperty(), context, ModelledVariablePropertyDescriptor.class, Variable.class);
16 if(propertyAdapter != null) return propertyAdapter;
18 // Fall back to standard
19 return new StandardGraphPropertyVariable(graph, context.getVariable(), null, context.getSubject(), context.getProperty());