BlueDevilDan
Contributor
Contributor

Plugin Object Attributes - how are they accessed

How does Orchestrator implement the mapping of script-object attributes? Does it directly access the Java class members? Does it utilize getter/setter methods? I'm kind of seeing that it may be some combination of the two.

This has an impact on how I need to rearchitect aspects of my plugin class with has some List type attributes in java which cannot be set from the Java Script Arrays. I need to know if I need to adjust the member type and visibility ot just provide different setter/getter method signatures.

0 Kudos
2 Replies
BlueDevilDan
Contributor
Contributor

Further experimentation makes me think the following.

For attributes, first it looks for get/set methods, then if none are found it directly accesses the class members.

However, in looking for setter methods in particular, it does not make a completely correct decision which to use based on the type of the parameter. In my case I had multiple array type attributes on a plugin object class. I also had a setter with a List<T> signature and an overload with a T[] signature. Some of my property sets from the JavaScript worked and some failed with a script Array to Java List conversion failure. To work around this reliably I had to eliminate the List<T> setter methods so that only the attribute setter with the correct signature could be found. I suspect this is an issue in the Rhino code where it just takes the first setter returned by the reflective inspection of my class rather than looking to see if one with a compatible parameter type is available.

So, I have been able to resolve my issue, but there is some indeterminism in the selection of overloaded setters with Rhino that should be investigated and resolved.

I'm marking this thread as answered but if any of this is incorrect, it would be good for someone on the VMO team to provide that information.

0 Kudos
admin
Immortal
Immortal

Hi,

Sorry for the long delay.

Yes, you're right, it first uses Getters / Setters.

The mapping of signature only care about name, absolutely not about result or parameters number / type.

0 Kudos