Use
the Java Class Adapter to
instantiate a Java™ object and
to invoke a sequence of methods on the object.
Adapter scenarios
The
Java Class Adapter cannot
be invoked from an input card. The adapter requires data to be passed
to it (as defined by a type tree) to enable it to determine what to
do. There are therefore two scenarios for using the adapter:
- If no data is required to be returned from the
adapter: call the adapter in an output card. Typical scenarios include:
- Creating an object (invoking its constructor, and
optionally setting its fields) to be used in a subsequent card.
- Invoking methods on an object that do not return
data. The success of these methods is typically monitored through
the use of exceptions.
- Data is required to be returned from the adapter:
call the adapter in a GET function call. The
approach here is to build the data to be passed to the adapter in
an output card, setting the output adapter to sink. Then, in
an additional output card, map the root object of this card to the
third parameter of the GET using the PACKAGE
call to pass the XML data as a text item.