Fetch attribute by reflection

What is the proper way to implement reflection in Cuba. Should I just use standard java refection? Or, should I use Cuba’s metadata somehow?

Specifically, I want to access an attribute of an entity using a string value for its name. For example, I have a string with value “affect” and I want to call entityInstance.getAffect().



You can use Java reflection with CUBA entities, but also there is an embedded mechanism for extracting value of properties from entities:

entity.setValue("affect", 10);

All these methods are declared in com.haulmont.chile.core.model.Instance.