org.apache.tuscany.sca.databinding.jaxb
Class JAXBWrapperHelper

java.lang.Object
  extended by org.apache.tuscany.sca.databinding.jaxb.JAXBWrapperHelper

public class JAXBWrapperHelper
extends java.lang.Object

The JAXBWrapper tool is used to create a JAXB Object from a series of child objects (wrap) or get the child objects from a JAXB Object (unwrap)


Constructor Summary
JAXBWrapperHelper()
           
 
Method Summary
 java.lang.Object[] unwrap(java.lang.Object jaxbObject, java.util.List<java.lang.String> childNames)
           
 java.lang.Object[] unwrap(java.lang.Object jaxbObject, java.util.List<java.lang.String> childNames, java.util.Map<java.lang.String,JAXBPropertyDescriptor> pdMap)
          unwrap Returns the list of child objects of the jaxb object
 java.lang.Object wrap(java.lang.Class<?> jaxbClass, java.util.List<java.lang.String> childNames, java.util.Map<java.lang.String,java.lang.Object> childObjects)
           
 java.lang.Object wrap(java.lang.Class<?> jaxbClass, java.util.List<java.lang.String> childNames, java.util.Map<java.lang.String,java.lang.Object> childObjects, java.util.Map<java.lang.String,JAXBPropertyDescriptor> pdMap)
          wrap Creates a jaxb object that is initialized with the child objects.
 void wrap(java.lang.Object jaxbObject, java.util.List<java.lang.String> childNames, java.util.Map<java.lang.String,java.lang.Object> childObjects, java.util.Map<java.lang.String,JAXBPropertyDescriptor> pdMap)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JAXBWrapperHelper

public JAXBWrapperHelper()
Method Detail

unwrap

public java.lang.Object[] unwrap(java.lang.Object jaxbObject,
                                 java.util.List<java.lang.String> childNames,
                                 java.util.Map<java.lang.String,JAXBPropertyDescriptor> pdMap)
                          throws JAXBWrapperException
unwrap Returns the list of child objects of the jaxb object

Parameters:
jaxbObject - that represents the type
childNames - list of xml child names as String
pdMap - PropertyDescriptor map for this jaxbObject
Returns:
list of Objects in the same order as the element names.
Throws:
JAXBWrapperException

wrap

public java.lang.Object wrap(java.lang.Class<?> jaxbClass,
                             java.util.List<java.lang.String> childNames,
                             java.util.Map<java.lang.String,java.lang.Object> childObjects,
                             java.util.Map<java.lang.String,JAXBPropertyDescriptor> pdMap)
                      throws JAXBWrapperException
wrap Creates a jaxb object that is initialized with the child objects.

Note that the jaxbClass must be the class the represents the complexType. (It should never be JAXBElement)

Parameters:
jaxbClass -
childNames - list of xml child names as String
childObjects, - component type objects
pdMap - PropertyDescriptor map for this jaxbObject
Throws:
JAXBWrapperException

wrap

public void wrap(java.lang.Object jaxbObject,
                 java.util.List<java.lang.String> childNames,
                 java.util.Map<java.lang.String,java.lang.Object> childObjects,
                 java.util.Map<java.lang.String,JAXBPropertyDescriptor> pdMap)

unwrap

public java.lang.Object[] unwrap(java.lang.Object jaxbObject,
                                 java.util.List<java.lang.String> childNames)
                          throws JAXBWrapperException
Throws:
JAXBWrapperException

wrap

public java.lang.Object wrap(java.lang.Class<?> jaxbClass,
                             java.util.List<java.lang.String> childNames,
                             java.util.Map<java.lang.String,java.lang.Object> childObjects)
                      throws JAXBWrapperException
Throws:
JAXBWrapperException