# Type Support in ECMAScript

When you add an XQuery map that references an ECMAScript function, data is converted between native ECMAScript types and native Java types. For example, consider an XQuery 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 while mapping an incoming XML message to Java.

Note that the other casefrom Java to XMLis much simpler. Because the result is simply XML, there aren't any conversion issues to be aware of.

### Conversions During Mapping from XML to Java

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, which means 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.

Related Topics

None.