Class CastorXMLToJava

  • All Implemented Interfaces:
    FunctionInterface, VersionInfoInterface

    public class CastorXMLToJava
    extends Function
    This is the CastorXMLToJava class. The CastorXMLToJava Function Component creates an Entry or a general Java object from an XML document. CastorXMLToJava provides the option to get data from certain parts of the XML tree when unmarshalling the XML document.
    • Constructor Detail

      • CastorXMLToJava

        public CastorXMLToJava()
    • Method Detail

      • initialize

        public void initialize​(java.lang.Object obj)
                        throws java.lang.Exception
        In the initialize method the FC initializes its parameters.
        Specified by:
        initialize in interface FunctionInterface
        Overrides:
        initialize in class Function
        Parameters:
        obj - not used.
        Throws:
        java.lang.Exception - If the mapping file parameter is missing or the return type is not valid.
      • perform

        public java.lang.Object perform​(java.lang.Object obj)
                                 throws java.lang.Exception
        This method retruns an XML document from a Java object or an Entry object. When the method is passed an Entry object on input, it will return an Entry object. This mode of operation is called Entry mode. If the "inputXMLType" parameter specifies "DOMElement", the method will expect on input an Entry with an Attribute named "xmlDOMElement" with value of type "org.w3c.dom.Element". If the "inputXMLType" parameter specifies "String", an Entry with an Attribute named "xmlString" and value of type "java.lang.String" is expected on input. The output generated is an Entry whose Attributes are the unmarshalled XML elements as specified by the "attributeSpecs" parameter and the mapping file. When the method is passed an object that is not an Entry on input (string or a DOM element) it returns the raw Java object as it is unmarshalled by Castor. This mode of operation is called non-Entry mode. If the "inputXMLType" parameter specifies "DOMElement", the method will expect on input a "org.w3c.dom.Element" object. If the "inputXMLType" parameter specifies "String", a "java.lang.String" object is expected on input.
        Parameters:
        obj - this is the input data passed to the FC.
        Returns:
        Returns an Entry or a Java object depending on the input data.
        Throws:
        java.lang.Exception - If initialization is not performed or if an Exception occur during the marshaling process.
      • unmarshal

        public Entry unmarshal​(Entry aEntry,
                               java.lang.String aMappingFile,
                               java.util.List aAttributeList)
                        throws java.lang.Exception
        This method is called when the CastorXMLToJava FC is passed an Entry object. The output generated is an Entry whose Attributes are the unmarshalled XML elements as specified by the "attributeSpecs" parameter and the mapping file.
        Parameters:
        aEntry - the input data as an Entry object.
        aMappingFile - the path to the Castor XML Mapping File that defines mapping rules.
        aAttributeList - List of attributes which contains the attributes specified in the Attribute Specification section of the FC.
        Returns:
        Returns an Entry object which contains the unmarshalled XML.
        Throws:
        java.lang.Exception - If an Exception occurs during the object unmarshaling.
      • unmarshal

        public java.lang.Object unmarshal​(java.lang.Object aInputXML,
                                          java.lang.String aMappingFile)
                                   throws java.lang.Exception
        This method is called when the CastorXMLToJava FC is passed a java.lang.Object.
        Parameters:
        aInputXML - the input data as a java.lang.Object.
        aMappingFile - the path to the Castor XML Mapping File that defines mapping rules.
        Returns:
        Returns the raw Java object as it is unmarshalled by Castor.
        Throws:
        java.lang.Exception - If an Exception occurs during the object unmarshaling.
      • getVersion

        public java.lang.String getVersion()
        Version information.
        Returns:
        version information.