Class XmlMarshallerUtil


  • public class XmlMarshallerUtil
    extends java.lang.Object
    Provides utility methods to write XML.
    Author:
    Daniel Sagenschneider
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      protected static java.lang.Object getReturnValue​(java.lang.Object source, java.lang.reflect.Method getMethod)
      Obtains the return value from the input method on the source object.
      protected static java.lang.Class<?> obtainClass​(java.lang.String className)
      Obtains the Class from its class name.
      protected static java.lang.reflect.Method obtainMethod​(java.lang.Class object, java.lang.String methodName)
      Obtains the Method by its name from the input class.
      static java.lang.String transformValueForXml​(java.lang.String value)
      Transforms the input value for XML.
      protected static void writeXml​(java.lang.String xmlSnippet, XmlOutput output)
      Writes the xml to the output.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XmlMarshallerUtil

        public XmlMarshallerUtil()
    • Method Detail

      • writeXml

        protected static void writeXml​(java.lang.String xmlSnippet,
                                       XmlOutput output)
                                throws XmlMarshallException
        Writes the xml to the output.
        Parameters:
        xmlSnippet - XML snippet to write.
        output - Output to send XML snippet.
        Throws:
        XmlMarshallException - If fails to write XML.
      • transformValueForXml

        public static java.lang.String transformValueForXml​(java.lang.String value)
        Transforms the input value for XML.
        Parameters:
        value - Value to transformed.
        Returns:
        Value transformed to be utilised in XML.
      • obtainClass

        protected static java.lang.Class<?> obtainClass​(java.lang.String className)
                                                 throws XmlMarshallException
        Obtains the Class from its class name.
        Parameters:
        className - Name of the class.
        Returns:
        Class by the input class name.
        Throws:
        XmlMarshallException - If fails to obtain the Class.
      • obtainMethod

        protected static java.lang.reflect.Method obtainMethod​(java.lang.Class object,
                                                               java.lang.String methodName)
                                                        throws XmlMarshallException
        Obtains the Method by its name from the input class.
        Parameters:
        object - Class of the object to obtain the method.
        methodName - Name of the method to obtain.
        Returns:
        Method on the input class by the name.
        Throws:
        XmlMarshallException - If unable to obtain method.
      • getReturnValue

        protected static java.lang.Object getReturnValue​(java.lang.Object source,
                                                         java.lang.reflect.Method getMethod)
                                                  throws XmlMarshallException
        Obtains the return value from the input method on the source object.
        Parameters:
        source - Object to source the return value.
        getMethod - Method to utilise to obtain the value.
        Returns:
        Return value of method on source object.
        Throws:
        XmlMarshallException - If fails to obtain the return value.