Do you mean you want to set and get the values of an attribute on an Entity using Java?
If you do, the easiest way is to import the proxy class for that entity, and then use the getters and settings that have been auto generated for you. For example, if your entity was called MyEntity and it had an attribute called Name, you could do something like this…
// Create an instance of the entity (or you could do a retrieve to get data from an existing entity)
MyEntity myEntity = new MyEntity(this.getContext());
// Get an attribute from an entity.
String name = myEntity.getName();
// Set a value in an entity.
Hope this helps.
Roberts explanation already has almost everything you need. Be aware of the fact that your xpath is returning IMendixObject objects that can’t be used like this directy. (Just because the system does not know the “real” type of the objects.
But Mendix creates proxies for all the entities in your domain model. You can create such a proxy object from your IMendixObject by using the static initialize method of your proxy.
myEntity.initialize(IContext context, IMendixObject mendixObject)
This will return the proxy object that you need to use the set and get methods as described by Robert
Hi Robert Price , Thanks for reply. I mean , I would like to create java action and pass any Entity parameter that is not specifi and in java code I would like to get and get it. The problem is the entity that pass to java action is a type String.
Hi Andreas Blaesius,
I can not mapping String type that pass to java action to proxy object.
this.entityName = MyFirstModule.Person
I don’t know how to mapping it to proxy object.