LibraryLink ToToggle FramesPrintFeedback

Lists

XML Schema supports a mechanism for defining data types that are a list of space separated simple types. An example of an element, primeList, using a list type is shown in Example 12.7.


XML Schema list types are generally mapped to Java List<T> objects. The only variation to this pattern is when a message part is mapped directly to an instance of an XML Schema list type.

XML Schema list types are simple types and as such are defined using a simpleType element. The most common syntax used to define a list type is shown in Example 12.8.


The value given for atomicType defines the type of the elements in the list. It can only be one of the built in XML Schema atomic types, like xsd:int or xsd:string, or a user-defined simple type that is not a list.

In addition to defining the type of elements listed in the list type, you can also use facets to further constrain the properties of the list type. Table 12.3 shows the facets used by list types.


For example, the definition for the simpleList element shown in Example 12.7, is shown in Example 12.9.


In addition to the syntax shown in Example 12.8 you can also define a list type using the less common syntax shown in Example 12.10.


When an element is defined a list type, the list type is mapped to a collection property. A collection property is a Java List<T> object. The template class used by the List<T> is the wrapper class mapped from the list's base type. For example, the list type defined in Example 12.9 is mapped to a List<Integer>.

For more information on wrapper type mapping see Wrapper classes.

When a message part is defined as a list type, or is mapped to an element of a list type, the resulting method parameter is mapped to an array instead of a List<T> object. The base type of the array is the wrapper class of the list type's base class.

For example, the WSDL fragment in Example 12.11 results in the method signature shown in Example 12.12.