Type Support in ECMAScript
When you add an XML map that references an ECMAScript function, data is converted between native ECMAScript types and native Java types. For example, consider an XML map translating an incoming XML message to your Java types through ECMAScript you've written. In this case WebLogic Server may be converting data from its format in script to the required Java format.
This topic describes some aspects of this conversion you might want to be aware of for conversions made in a function ending "FromXML". Remember that in this case, the data moves from incoming XML to ECMAScript in a JSX file to Java code in a JWS file.
Note that the other case—from Java through a "ToXML" function to XML—is much simpler. Because the result is simply XML, there aren't any conversion issues to be aware of.
The following lists specific kinds of conversion you should be aware of when using ECMAScript for mapping. Each item in the list describes conversion for a particular type or category of types.
The type in Java is the same as the type in ECMAScript—There are no limitations when there is no type conversion—when the type used in script is the same as the type used in the JWS file. (Remember that you can import Java classes for use in script using the import statement. For more information, see Importing Java Classes to ECMAScript with the import Statement.)
Java primitive type—There are no limitations for each of the Java classes corresponding to primitive types, including the following: Integer, String, Float, Double, Boolean, Character, Byte, Long, Short, and Date.
Note: To declare and use any Java types in ECMAScript (including the wrapped primitive types such as Integer and so on), you must import them using the import statement. For more information, see Importing Java Classes to ECMAScript with the import Statement.
Implicit ECMAScript types—ECMAScript types you declare with the var statement (including boolean, number, object, string, and so on) are converted to the corresponding types in the java.lang package before they reach your Java code.
Java arrays—Java arrays based on types in the java.lang package are carried without conversion from the ECMAScript function to the Java code. ECMAScript arrays, on the other hand, are converted to corresponding Java types.