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 StandardModelledResourcePropertyVariable 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
14 Variable propertyAdapter = graph.getPossibleContextualAdapter(context.getProperty(), context, ModelledVariablePropertyDescriptor.class, Variable.class);
15 if(propertyAdapter != null) return propertyAdapter;
17 // Fall back to standard
18 return new StandardGraphResourcePropertyVariable(graph, context.getVariable(), context.getSubject(), context.getProperty());