1 package org.simantics.db.layer0.adapter;
3 import org.simantics.db.ComputationalValue;
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 ReflectionComputationalValue implements ComputationalValue {
12 @SuppressWarnings("unchecked")
14 public <T> T getValue(ReadGraph graph, Resource resource) throws DatabaseException {
17 return (T)ReflectionUtils.getValue(graph.getURI(resource)).getValue();
18 } catch(ValueNotFoundException e) {
19 throw new DatabaseException(e);
20 } catch(ClassCastException e) {
21 throw new DatabaseException(e);