Class BeanUtil


  • public class BeanUtil
    extends Object
    • Constructor Detail

      • BeanUtil

        public BeanUtil()
    • Method Detail

      • getPullParser

        public static XMLStreamReader getPullParser​(Object beanObject,
                                                    QName beanName,
                                                    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​(OMElement response,
                                           Object[] javaTypes,
                                           ObjectSupplier objectSupplier)
                                    throws 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:
        AxisFault
      • 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​(OMFactory fac,
                                                    OMElement element,
                                                    Object resObject,
                                                    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 OMDocument convertOMtoDOM​(OMContainer omElement)
        Gets the DOOM implementation of org.w3c.dom.Document
        Parameters:
        omElement - the OMelement
        Returns:
        the DOOM document
      • convertDOMtoOM

        public static OMElement convertDOMtoOM​(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,
                                                                         OMElement omElement,
                                                                         MultirefHelper helper,
                                                                         Iterator parts,
                                                                         ObjectSupplier objectSupplier,
                                                                         Type genericType)
                                                                  throws 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:
        AxisFault - the axis fault
      • getMapElement

        public static List<OMElement> getMapElement​(OMFactory fac,
                                                    Type type,
                                                    Map results,
                                                    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​(OMElement omElement,
                                                                  Type generictype,
                                                                  MultirefHelper helper,
                                                                  ObjectSupplier objectSupplier)
                                                           throws AxisFault
        Process generic collection.
        Parameters:
        omElement - the om element
        generictype - the generictype
        helper - the helper
        objectSupplier - the object supplier
        Returns:
        the collection
        Throws:
        AxisFault - the axis fault
      • processGenericCollection

        public static Collection<Object> processGenericCollection​(OMElement omElement,
                                                                  OMElement[] toReturn,
                                                                  Type generictype,
                                                                  MultirefHelper helper,
                                                                  ObjectSupplier objectSupplier,
                                                                  Iterator parts,
                                                                  boolean bare)
                                                           throws 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:
        AxisFault - the axis fault
      • getCollectionElement

        public static OMElement getCollectionElement​(OMFactory fac,
                                                     Type type,
                                                     Collection results,
                                                     String name,
                                                     String innerName,
                                                     QName elementQName,
                                                     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