Class SerializerTool


  • public class SerializerTool
    extends java.lang.Object
    Contains methods used to serialize JDOM objects during VelocityFormat page tranformations.
    • Constructor Summary

      Constructors 
      Constructor Description
      SerializerTool()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String getElementContents​(java.lang.String xml, java.lang.String elementName)
      Retrieves the contents of a particular element in an xml string.
      java.lang.String serialize​(org.jdom.Element elt, boolean removeRoot)  
      java.lang.String toJson​(java.lang.String xmlString, boolean removeRoot)  
      java.lang.String toJson​(java.util.Map<java.lang.String,​java.lang.Object> map)  
      java.lang.String toJson​(org.jdom.Element elt, boolean removeRoot)  
      • Methods inherited from class java.lang.Object

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

      • SerializerTool

        public SerializerTool()
    • Method Detail

      • serialize

        public java.lang.String serialize​(org.jdom.Element elt,
                                          boolean removeRoot)
                                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • toJson

        public java.lang.String toJson​(org.jdom.Element elt,
                                       boolean removeRoot)
                                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • toJson

        public java.lang.String toJson​(java.lang.String xmlString,
                                       boolean removeRoot)
                                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • toJson

        public java.lang.String toJson​(java.util.Map<java.lang.String,​java.lang.Object> map)
      • getElementContents

        protected java.lang.String getElementContents​(java.lang.String xml,
                                                      java.lang.String elementName)
        Retrieves the contents of a particular element in an xml string. Makes no assumptions about the format of the string passed in. Only attempts to extract the contents of a particular element. String returned is not necesarily well-formed xml.
        Parameters:
        xml -
        elementName - the name of the element whose contents is going to be returned
        Returns:
        Returns the contents of a particular element in an xml string. If xml or elementName are empty an empty string is returned