package org.simantics.modeling; import org.simantics.db.ConverterExternalValue; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; import org.simantics.scl.reflection.ReflectionUtils; import org.simantics.scl.reflection.ValueNotFoundException; import org.simantics.scl.runtime.function.Function1; import org.simantics.structural2.scl.CompileStructuralValueRequest; public class SCLExternalValue implements ConverterExternalValue { @Override public T getValue(ReadGraph graph, Resource resource) throws DatabaseException { try { return (T)ReflectionUtils.getValue(ModelingResources.URIs.Functions_sclValue).getValue(); } catch (ValueNotFoundException e) { throw new DatabaseException(e); } } @Override public Function1 getFunction(ReadGraph graph, Resource s, Resource o, Resource p) throws DatabaseException { return CompileStructuralValueRequest.compile(graph, s, o, p); } }