Java Implementation
Familiarity with language
Better type checking
Better tools and IDE support
Easier debugging
Existing code
Calculation intensive algorithms
Records and Objects
Records and to a lesser extent Objects are some of the most used data structures in RapidIdentity Connect, but unfortunately, they are designed to primarily be used from ECMAScript and not easily usable from Java. Your best bet is to create and pass instance-specific Java classes after copying the necessary field/property values from the Record/object.
XML
An E4X XML object is not particularly useful in Java, but fortunately, Rhino's default E4X implementation uses Java DOM underneath. This allows you to declare a parameter in Java as org.w3c.dom.Node and when calling from ECMAScript use an underlying method that extracts the DOM node.
Note however that the DOM Node extracted from the E4X XML object should probably be considered strictly read-only.
undefined
Rhino passes the special value
undefined
to Java as an instance of the underlying class the Rhino uses to represent that value. This is not particularly useful in Java, so given that an adapter is supposed to treatnull
andundefined
as if they were the same, the best way to deal withundefined
is to make sure the ECMAScript wrapper checks forundefined
and changes it tonull
before passing to Java.