org.jibx.ws.io.handler
Class ContextAttributeUnmarshallingInHandler

java.lang.Object
  extended by org.jibx.ws.io.handler.ContextAttributeUnmarshallingInHandler
All Implemented Interfaces:
InHandler

public final class ContextAttributeUnmarshallingInHandler
extends Object
implements InHandler

An unmarshaller that stores the unmarshalled objects in the current InContext. It stores the unmarshalled object as an attribute using the attribute name passed in the constructor as a key.


Constructor Summary
ContextAttributeUnmarshallingInHandler(Class clazz, String attributeName)
          Create the unmarshaller using the binding factory for the "target class".
ContextAttributeUnmarshallingInHandler(IBindingFactory factory, String attributeName)
          Create the unmarshaller using the specified binding factory.
ContextAttributeUnmarshallingInHandler(String className, String attributeName)
          Create the unmarshaller using the binding factory for the "target class".
ContextAttributeUnmarshallingInHandler(String bindingName, String packageName, String attributeName)
          Create the unmarshaller using the binding factory for the specified binding name and binding package name.
 
Method Summary
 Object invoke(InContext context, IXMLReader xmlReader)
          Invokes the handler.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextAttributeUnmarshallingInHandler

public ContextAttributeUnmarshallingInHandler(Class clazz,
                                              String attributeName)
                                       throws WsBindingException
Create the unmarshaller using the binding factory for the "target class". This method can only be used with target classes that are mapped in only one binding. Note that there is no restriction on the "payload class" being the same as the target class. The only restriction is that the binding factory for the target class must include a binding for the payload class.

Parameters:
clazz - the target class
attributeName - the key to store the unmarshalled object in the current context
Throws:
WsBindingException - on any error in finding or accessing factory, or creating unmarshaller

ContextAttributeUnmarshallingInHandler

public ContextAttributeUnmarshallingInHandler(String className,
                                              String attributeName)
                                       throws WsBindingException,
                                              WsConfigurationException
Create the unmarshaller using the binding factory for the "target class". This method can only be used with target classes that are mapped in only one binding. Note that there is no restriction on the "payload class" being the same as the target class. The only restriction is that the binding factory for the target class must include a binding for the payload class.

Parameters:
className - the name of the target class
attributeName - the key to store the unmarshalled object in the current context
Throws:
WsBindingException - on any error in finding or accessing factory, or creating unmarshaller
WsConfigurationException - if specified class cannot be found

ContextAttributeUnmarshallingInHandler

public ContextAttributeUnmarshallingInHandler(String bindingName,
                                              String packageName,
                                              String attributeName)
                                       throws WsBindingException
Create the unmarshaller using the binding factory for the specified binding name and binding package name. See BindingDirectory.getFactory(String, String) for further definition of the required binding name and binding package name.

Parameters:
bindingName - binding name
packageName - target package for binding
attributeName - the key to store the unmarshalled object in the current context
Throws:
WsBindingException - on any error in finding or accessing factory, or creating unmarshaller

ContextAttributeUnmarshallingInHandler

public ContextAttributeUnmarshallingInHandler(IBindingFactory factory,
                                              String attributeName)
                                       throws WsBindingException
Create the unmarshaller using the specified binding factory.

Parameters:
factory - the binding factory
attributeName - the key to store the unmarshalled object in the current context
Throws:
WsBindingException - on any error in creating unmarshaller
Method Detail

invoke

public Object invoke(InContext context,
                     IXMLReader xmlReader)
              throws IOException,
                     WsException
Invokes the handler. If the handler processes the current element it needs to parse past the end tag of that element before returning. Invokes the handler and stores the result as an attribute in the InContext.

Specified by:
invoke in interface InHandler
Parameters:
context - the context of the current message being received
xmlReader - a reader for the XML message positioned at the start of the XML content for which the handler is configured
Returns:
the object the handler has read from the XML content, or null if the handler has not processed the XML content
Throws:
IOException - on I/O error reading the XML content
WsException - on errors other than I/O errors


Project Web Site