Persistent Java objects
I'm trying to use some property types that are not supported by the Base Language as persistent objects that can be associated with specific nodes. These would be collections like the multimap in the Java guava library or custom classes written by me. I want to have these objects instantiated by a root node, and then have them populated and accessed by descendant nodes in the hierarchy. I assume that the classes would need to be setup in a Runtime solution module, but I am not sure how to instantiate the classes into objects that would be attached to the root nodes and then persist in the nodes descendant nodes.
Is there a design pattern or a good example I can follow? Maybe there's a way to use a node's references or children to point directly to java objects?
Thanks in advance for any help.
Please sign in to leave a comment.
You can attach nodes or instances of java classes to any (root) node by using "User Objects"
If you downcast a node<> to SNode you gain access to the node/.getUserObject and node/.putUserObject methods.
Thank you. Just a quick follow up. Does it make a difference if the java classes are part of runtime solution module or a regular solution module?
To be honest I don't use runtime solution modules. I always define these classes in a separate solution or in a simple model directly inside the language. So I don't know if it makes a difference or not. Would be interesting to know though.