1 package org.simantics.modeling;
3 import org.simantics.db.ConverterExternalValue;
4 import org.simantics.db.ReadGraph;
5 import org.simantics.db.Resource;
6 import org.simantics.db.exception.DatabaseException;
7 import org.simantics.scl.reflection.ReflectionUtils;
8 import org.simantics.scl.reflection.ValueNotFoundException;
9 import org.simantics.scl.runtime.function.Function1;
10 import org.simantics.structural2.scl.CompileStructuralValueRequest;
12 public class SCLExternalValue implements ConverterExternalValue {
15 public <T> T getValue(ReadGraph graph, Resource resource) throws DatabaseException {
17 return (T)ReflectionUtils.getValue(ModelingResources.URIs.Functions_sclValue).getValue();
18 } catch (ValueNotFoundException e) {
19 throw new DatabaseException(e);
24 public Function1 getFunction(ReadGraph graph, Resource s, Resource o, Resource p) throws DatabaseException {
25 return CompileStructuralValueRequest.compile(graph, s, o, p);