com.tibco.bw.poa.runtime
Class ReturnWrapper<N>

java.lang.Object
  extended by com.tibco.bw.poa.runtime.ReturnWrapper<N>

public class ReturnWrapper<N>
extends java.lang.Object

This class wraps an object of a particular ReturnWrapper.WrappedType.

This class is used by asynchronous advice implementations to wrap the response object that gets generated on the advice thread. For more information see AdviceController.setReady(ReturnWrapper).

The constructor is not exposed; instead use one of the following static methods to create an instance of ReturnWrapper:


To retrieve an object from a ReturnWrapper, first, ensure that the wrapped object is of the desired type by calling getWrappedType(); then call the appropriate accessor method:

Since:
1.0
See Also:
AsyncAdvice, AdviceController

Nested Class Summary
static class ReturnWrapper.WrappedType
          Indicates the type of the wrapped object
 
Method Summary
 AspectException getException()
          Returns the wrapped AspectException
 java.lang.Object getObject()
          Returns the wrapped object
 ReturnWrapper.WrappedType getWrappedType()
          Returns the WrappedType enum indicating the type of the wrapped object
 N getXmlNode()
          Returns the wrapped XML node
static
<N> ReturnWrapper<N>
wrapException(AspectException ex)
          Creates a ReturnWrapper instance containing an AspectException and a WrappedType of WrappedType.EXCEPTION
static
<N> ReturnWrapper<N>
wrapObject(java.lang.Object obj)
          Creates a ReturnWrapper instance containing an object and a WrappedType of WrappedType.OBJECT
static
<N> ReturnWrapper<N>
wrapXmlNode(N node)
          Creates a ReturnWrapper instance containing an XML node of type N and a WrappedType of WrappedType.XML_NODE
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

wrapObject

public static <N> ReturnWrapper<N> wrapObject(java.lang.Object obj)
Creates a ReturnWrapper instance containing an object and a WrappedType of WrappedType.OBJECT

Type Parameters:
N - the node type parameter
Parameters:
obj - the object to wrap
Returns:
ReturnWrapper instance

wrapException

public static <N> ReturnWrapper<N> wrapException(AspectException ex)
Creates a ReturnWrapper instance containing an AspectException and a WrappedType of WrappedType.EXCEPTION

Type Parameters:
N - the node type parameter
Parameters:
ex - the exception to wrap
Returns:
ReturnWrapper instance

wrapXmlNode

public static <N> ReturnWrapper<N> wrapXmlNode(N node)
Creates a ReturnWrapper instance containing an XML node of type N and a WrappedType of WrappedType.XML_NODE

Type Parameters:
N - the node type parameter
Parameters:
node - the node to wrap
Returns:
ReturnWrapper instance

getWrappedType

public ReturnWrapper.WrappedType getWrappedType()
Returns the WrappedType enum indicating the type of the wrapped object

Returns:

getException

public AspectException getException()
Returns the wrapped AspectException

Returns:
Throws:
java.lang.IllegalStateException - if wrapped item is not an AspectException and the ReturnWrapper instance was not created with the wrapException method

getObject

public java.lang.Object getObject()
Returns the wrapped object

Returns:
Throws:
java.lang.IllegalStateException - if wrapped item is not an Object and the ReturnWrapper instance was not created with the wrapObject method

getXmlNode

public N getXmlNode()
Returns the wrapped XML node

Returns:
Throws:
java.lang.IllegalStateException - if wrapped item is not an N and the ReturnWrapper instance was not created with the wrapXmlNode method


Copyright @ 2010, TIBCO Softwares (Inc). All right reserved