Matthis
(Matthis Rouch)
February 6, 2018, 2:39pm
#1
Hi,
I am trying to get the value of an entity attribute through the metadata interface.
For example if I have a Person entity and a “name” attribute, I can navigate to the MetaProperty using
person.getMetaClass().getMetaClass().getPropertyPath(“name”).getMetaProperty();
How then can I get the actual value of the attribute from the MetaProperty?
Thanks
tsarev
(Daniil Tsaryov)
February 9, 2018, 5:42am
#3
Hi, @Matthis
there is no need to use Metadata
or MetaPropertyPath
/ MetaProperty
to get a value of some field.
I suggest that you use the com.haulmont.chile.core.model.Instance#getValueEx
method. Example:
String personName = person.getValueEx("name");
Regards,
Daniil.
Matthis
(Matthis Rouch)
February 9, 2018, 5:54am
#5
Thank you very much Daniil!
That is indeed easy and will do exactly what I want. Great.
tsarev
(Daniil Tsaryov)
February 9, 2018, 6:06am
#6
Glad to here. You are welcome!