X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.objmap2%2Fsrc%2Forg%2Fsimantics%2Fobjmap%2Fgraph%2Fannotations%2Ffactories%2FRelatedGetSetValueRuleFactory.java;h=5c57a75c3c2d3279281209ffa1dfe786d33a59c9;hb=87d3c60a5c520cca584c54e6bc0fd8c9576141a7;hp=994811feef05cc85385ccce8e0d504cad3035b79;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedGetSetValueRuleFactory.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedGetSetValueRuleFactory.java index 994811fee..5c57a75c3 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedGetSetValueRuleFactory.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedGetSetValueRuleFactory.java @@ -14,6 +14,10 @@ package org.simantics.objmap.graph.annotations.factories; import java.lang.annotation.Annotation; import java.lang.reflect.Method; +import org.simantics.databoard.Bindings; +import org.simantics.databoard.binding.Binding; +import org.simantics.databoard.binding.error.BindingConstructionException; +import org.simantics.databoard.binding.reflection.BindingRequest; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; @@ -47,8 +51,14 @@ public class RelatedGetSetValueRuleFactory implements IGetSetRuleFactory< Class adapterClass = getterAnn.adapter(); IRangeAccessor rangeAccessor = new GetSetValueAccessor(getter, setter); Resource valueType; + Binding valueBinding = null; if (adapterClass == IdentityAdapter.class) { - valueType = dataTypeOfClass(g, getter.getReturnType()); + try { + valueBinding = Bindings.getBinding(BindingRequest.create(getter)); + } catch (BindingConstructionException e) { + return null; + } + valueType = DataTypeUtils.dataTypeOfDatatype(g, valueBinding.type()); } else { try{ ValueAdapter adapter = adapterClass.newInstance(); @@ -60,7 +70,7 @@ public class RelatedGetSetValueRuleFactory implements IGetSetRuleFactory< throw new RuntimeException(e); } } - return new ValueRule(new RelatedValueAccessor(g.getResource(getterAnn.value()), valueType), + return new ValueRule(new RelatedValueAccessor(g.getResource(getterAnn.value()), valueType, valueBinding), rangeAccessor); }