iterate over all properties of a concept Follow
I've declared some properties for a person object. Now I want to be able to iterate over the properties in textgen.
I know that I can access a property with 'p.propertyName', but I want my XML generation to be generic.
Code
for (node<Person> p : persons) { for (<no type> <no name> : p.concept.getProperties()) { // ...attach all properties to XML tree } }
I know that I can access a property with 'p.propertyName', but I want my XML generation to be generic.
Please sign in to leave a comment.
first, I recommend not to use the textgen aspects for your purpose. It is much easier and maintanable if you use the generator aspect. No matter which variant you choose, you can access the node's properties using the following code:
The slash ('/') after the (p) means "downcast to a lower semantic level". It is important that you choose the correct auto-completion entry. .
I hope that helps.
Regards,
LaAck
Is there a possibility to get write access to property.. kind of reflection
yes, you can write a property using the following syntax:
However, this method is deprecated. So you may also use the following code snippet instead:
The latter is the closest to the reflection mechanism in Java. You also can iterate over all available properties using the "getProperties()" methods of a concept or a "downcasted" node.
I hope this helps.
Regards,
LaAck