1 package org.simantics.db.layer0.adapter;
3 import org.simantics.db.ExternalValue;
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;
10 public class ReflectionExternalValue implements ExternalValue {
13 public <T> T getValue(ReadGraph graph, Resource resource) throws DatabaseException {
16 return (T)ReflectionUtils.getValue(graph.getURI(resource)).getValue();
17 } catch(ValueNotFoundException e) {
18 throw new DatabaseException(e);
19 } catch(ClassCastException e) {
20 throw new DatabaseException(e);