Class BeanUtil


  • public class BeanUtil
    extends Object
    • Constructor Summary

      Constructors 
      Constructor Description
      BeanUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static void addInstanceTypeAttribute​(org.apache.axiom.om.OMFactory fac, org.apache.axiom.om.OMElement element, Object resObject, org.apache.axis2.description.java2wsdl.TypeTable typeTable)
      Adds the instance type attribute to the passed OMElement.
      static org.apache.axiom.om.OMElement convertDOMtoOM​(org.apache.axiom.om.OMFactory fac, Object document)
      Convert DOM Document to a OMElement.
      static org.apache.axiom.om.OMDocument convertOMtoDOM​(org.apache.axiom.om.OMContainer omElement)
      Gets the DOOM implementation of org.w3c.dom.Document
      static Object deserialize​(Class beanClass, org.apache.axiom.om.OMElement beanElement, MultirefHelper helper, org.apache.axis2.engine.ObjectSupplier objectSupplier)  
      static Object deserialize​(Class beanClass, org.apache.axiom.om.OMElement beanElement, org.apache.axis2.engine.ObjectSupplier objectSupplier, String arrayLocalName)  
      static Object[] deserialize​(org.apache.axiom.om.OMElement response, Object[] javaTypes, org.apache.axis2.engine.ObjectSupplier objectSupplier)
      To get JavaObjects from XML element , the element most of the time contains only one element in that case that element will be converted to the JavaType specified by the javaTypes array The algo is as follows, get the childerns of the response element , and if it conatian more than one element then check the retuen type of that element and conver that to corresponding JavaType
      static Object[] deserialize​(org.apache.axiom.om.OMElement response, Object[] javaTypes, org.apache.axis2.engine.ObjectSupplier objectSupplier, String[] parameterNames, Method method)  
      static org.apache.axiom.om.OMElement getCollectionElement​(org.apache.axiom.om.OMFactory fac, Type type, Collection results, String name, String innerName, QName elementQName, org.apache.axis2.description.java2wsdl.TypeTable typeTable, boolean elementFormDefault)
      Gets the collection element.
      static List<org.apache.axiom.om.OMElement> getMapElement​(org.apache.axiom.om.OMFactory fac, Type type, Map results, org.apache.axis2.description.java2wsdl.TypeTable typeTable, boolean elementFormDefault)
      This method convert a instance of java.util.Map into OM object model for serialization.
      static org.apache.axiom.om.OMElement getOMElement​(QName opName, Object[] args, QName partName, boolean qualifed, org.apache.axis2.description.java2wsdl.TypeTable typeTable)  
      static XMLStreamReader getPullParser​(Object beanObject)
      to get the pull parser for a given bean object , generate the wrpper element using class name
      static XMLStreamReader getPullParser​(Object beanObject, QName beanName, org.apache.axis2.description.java2wsdl.TypeTable typeTable, boolean qualified, boolean processingDocLitBare)
      To Serilize Bean object this method is used, this will create an object array using given bean object
      static String getUniquePrefix()
      increments the namespace counter and returns a new prefix
      static String getUniquePrifix()
      Deprecated.
      Please use getUniquePrefix
      static Object processEnumObject​(Class classType, org.apache.axiom.om.OMElement omElement)  
      static Collection<Object> processGenericCollection​(org.apache.axiom.om.OMElement omElement, Type generictype, MultirefHelper helper, org.apache.axis2.engine.ObjectSupplier objectSupplier)
      Process generic collection.
      static Collection<Object> processGenericCollection​(org.apache.axiom.om.OMElement omElement, org.apache.axiom.om.OMElement[] toReturn, Type generictype, MultirefHelper helper, org.apache.axis2.engine.ObjectSupplier objectSupplier, Iterator parts, boolean bare)
      Process collection.
      static Map<Object,​Object> processGenericsMapElement​(Type[] parameterArgTypes, org.apache.axiom.om.OMElement omElement, MultirefHelper helper, Iterator parts, org.apache.axis2.engine.ObjectSupplier objectSupplier, Type genericType)
      This method deserialize OM model in to a instance of java.util.Map
      static Object processObject​(org.apache.axiom.om.OMElement omElement, Class classType, MultirefHelper helper, boolean isArrayType, org.apache.axis2.engine.ObjectSupplier objectSupplier, Type generictype)  
    • Constructor Detail

      • BeanUtil

        public BeanUtil()
    • Method Detail

      • getPullParser

        public static XMLStreamReader getPullParser​(Object beanObject,
                                                    QName beanName,
                                                    org.apache.axis2.description.java2wsdl.TypeTable typeTable,
                                                    boolean qualified,
                                                    boolean processingDocLitBare)
        To Serilize Bean object this method is used, this will create an object array using given bean object
      • getPullParser

        public static XMLStreamReader getPullParser​(Object beanObject)
        to get the pull parser for a given bean object , generate the wrpper element using class name
        Parameters:
        beanObject -
      • deserialize

        public static Object deserialize​(Class beanClass,
                                         org.apache.axiom.om.OMElement beanElement,
                                         org.apache.axis2.engine.ObjectSupplier objectSupplier,
                                         String arrayLocalName)
                                  throws org.apache.axis2.AxisFault
        Throws:
        org.apache.axis2.AxisFault
      • deserialize

        public static Object deserialize​(Class beanClass,
                                         org.apache.axiom.om.OMElement beanElement,
                                         MultirefHelper helper,
                                         org.apache.axis2.engine.ObjectSupplier objectSupplier)
                                  throws org.apache.axis2.AxisFault
        Throws:
        org.apache.axis2.AxisFault
      • deserialize

        public static Object[] deserialize​(org.apache.axiom.om.OMElement response,
                                           Object[] javaTypes,
                                           org.apache.axis2.engine.ObjectSupplier objectSupplier)
                                    throws org.apache.axis2.AxisFault
        To get JavaObjects from XML element , the element most of the time contains only one element in that case that element will be converted to the JavaType specified by the javaTypes array The algo is as follows, get the childerns of the response element , and if it conatian more than one element then check the retuen type of that element and conver that to corresponding JavaType
        Parameters:
        response - OMElement
        javaTypes - Array of JavaTypes
        Returns:
        Array of objects
        Throws:
        org.apache.axis2.AxisFault
      • deserialize

        public static Object[] deserialize​(org.apache.axiom.om.OMElement response,
                                           Object[] javaTypes,
                                           org.apache.axis2.engine.ObjectSupplier objectSupplier,
                                           String[] parameterNames,
                                           Method method)
                                    throws org.apache.axis2.AxisFault
        Throws:
        org.apache.axis2.AxisFault
      • processObject

        public static Object processObject​(org.apache.axiom.om.OMElement omElement,
                                           Class classType,
                                           MultirefHelper helper,
                                           boolean isArrayType,
                                           org.apache.axis2.engine.ObjectSupplier objectSupplier,
                                           Type generictype)
                                    throws org.apache.axis2.AxisFault
        Throws:
        org.apache.axis2.AxisFault
      • processEnumObject

        public static Object processEnumObject​(Class classType,
                                               org.apache.axiom.om.OMElement omElement)
                                        throws org.apache.axis2.AxisFault
        Throws:
        org.apache.axis2.AxisFault
      • getOMElement

        public static org.apache.axiom.om.OMElement getOMElement​(QName opName,
                                                                 Object[] args,
                                                                 QName partName,
                                                                 boolean qualifed,
                                                                 org.apache.axis2.description.java2wsdl.TypeTable typeTable)
      • getUniquePrifix

        public static String getUniquePrifix()
        Deprecated.
        Please use getUniquePrefix
      • getUniquePrefix

        public static String getUniquePrefix()
        increments the namespace counter and returns a new prefix
        Returns:
        unique prefix
      • addInstanceTypeAttribute

        public static void addInstanceTypeAttribute​(org.apache.axiom.om.OMFactory fac,
                                                    org.apache.axiom.om.OMElement element,
                                                    Object resObject,
                                                    org.apache.axis2.description.java2wsdl.TypeTable typeTable)
        Adds the instance type attribute to the passed OMElement. e.g - String Value
        Parameters:
        fac - the SOAPFactory instance.
        element - the child OMElement to add attributes.
        resObject - the java reflection method
        resObject - the res object
        typeTable - the type table of particular Axis2 service
      • convertOMtoDOM

        public static org.apache.axiom.om.OMDocument convertOMtoDOM​(org.apache.axiom.om.OMContainer omElement)
        Gets the DOOM implementation of org.w3c.dom.Document
        Parameters:
        omElement - the OMelement
        Returns:
        the DOOM document
      • convertDOMtoOM

        public static org.apache.axiom.om.OMElement convertDOMtoOM​(org.apache.axiom.om.OMFactory fac,
                                                                   Object document)
        Convert DOM Document to a OMElement.
        Parameters:
        fac - the fac
        document - the document
        Returns:
        the OMElement
      • processGenericsMapElement

        public static Map<Object,​Object> processGenericsMapElement​(Type[] parameterArgTypes,
                                                                         org.apache.axiom.om.OMElement omElement,
                                                                         MultirefHelper helper,
                                                                         Iterator parts,
                                                                         org.apache.axis2.engine.ObjectSupplier objectSupplier,
                                                                         Type genericType)
                                                                  throws org.apache.axis2.AxisFault
        This method deserialize OM model in to a instance of java.util.Map
        Parameters:
        parameterArgTypes - the parameter argument types of Map
        omElement - the OMElement
        helper - the helper
        parts - the parts
        objectSupplier - the object supplier
        genericType - the generic type
        Returns:
        a instance of java.util.Map
        Throws:
        org.apache.axis2.AxisFault - the axis fault
      • getMapElement

        public static List<org.apache.axiom.om.OMElement> getMapElement​(org.apache.axiom.om.OMFactory fac,
                                                                        Type type,
                                                                        Map results,
                                                                        org.apache.axis2.description.java2wsdl.TypeTable typeTable,
                                                                        boolean elementFormDefault)
        This method convert a instance of java.util.Map into OM object model for serialization.
        Parameters:
        fac - the OMFactory
        type - of the java.util.Map
        results - the results values
        typeTable - the type table
        elementFormDefault - the element form default
        Returns:
        list of OMElement
      • processGenericCollection

        public static Collection<Object> processGenericCollection​(org.apache.axiom.om.OMElement omElement,
                                                                  Type generictype,
                                                                  MultirefHelper helper,
                                                                  org.apache.axis2.engine.ObjectSupplier objectSupplier)
                                                           throws org.apache.axis2.AxisFault
        Process generic collection.
        Parameters:
        omElement - the om element
        generictype - the generictype
        helper - the helper
        objectSupplier - the object supplier
        Returns:
        the collection
        Throws:
        org.apache.axis2.AxisFault - the axis fault
      • processGenericCollection

        public static Collection<Object> processGenericCollection​(org.apache.axiom.om.OMElement omElement,
                                                                  org.apache.axiom.om.OMElement[] toReturn,
                                                                  Type generictype,
                                                                  MultirefHelper helper,
                                                                  org.apache.axis2.engine.ObjectSupplier objectSupplier,
                                                                  Iterator parts,
                                                                  boolean bare)
                                                           throws org.apache.axis2.AxisFault
        Process collection.
        Parameters:
        omElement - the om element
        toReturn - the to return
        generictype - the generictype
        helper - the helper
        objectSupplier - the object supplier
        parts - the parts
        bare - the bare
        Returns:
        the collection
        Throws:
        org.apache.axis2.AxisFault - the axis fault
      • getCollectionElement

        public static org.apache.axiom.om.OMElement getCollectionElement​(org.apache.axiom.om.OMFactory fac,
                                                                         Type type,
                                                                         Collection results,
                                                                         String name,
                                                                         String innerName,
                                                                         QName elementQName,
                                                                         org.apache.axis2.description.java2wsdl.TypeTable typeTable,
                                                                         boolean elementFormDefault)
        Gets the collection element.
        Parameters:
        fac - the fac
        type - the type
        results - the results
        name - the name
        innerName - the inner name
        elementQName - the element q name
        typeTable - the type table
        elementFormDefault - the element form default
        Returns:
        the collection element