Class XmlMarshallerUtil

java.lang.Object
net.officefloor.plugin.xml.marshall.tree.XmlMarshallerUtil

public class XmlMarshallerUtil extends Object
Provides utility methods to write XML.
Author:
Daniel Sagenschneider
  • Constructor Details

    • XmlMarshallerUtil

      public XmlMarshallerUtil()
  • Method Details

    • writeXml

      protected static void writeXml(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 String transformValueForXml(String value)
      Transforms the input value for XML.
      Parameters:
      value - Value to transformed.
      Returns:
      Value transformed to be utilised in XML.
    • obtainClass

      protected static Class<?> obtainClass(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 Method obtainMethod(Class object, 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 Object getReturnValue(Object source, 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.