Class XStreamSerializer

java.lang.Object
com.almis.awe.model.component.XStreamSerializer

public class XStreamSerializer extends Object
Author:
pgarcia
  • Constructor Details

    • XStreamSerializer

      public XStreamSerializer(org.springframework.oxm.xstream.XStreamMarshaller xStreamMarshaller)
      Autowired constructor
      Parameters:
      xStreamMarshaller - Marshaller
  • Method Details

    • writeXmlFromObject

      public <T> void writeXmlFromObject(Object object, OutputStream outputStream)
      Serialize an object to the given OutputStream as pretty-printed XML (Object to Xml)
      Parameters:
      object - Object to serialize
      outputStream - OutputStream to set
    • writeXmlFromObject

      public <T> void writeXmlFromObject(Class<T> wrapperClass, Object object, Writer writer)
      Serialize an object to the given Writer as pretty-printed XML (Object to Xml)
      Parameters:
      wrapperClass - Class with XStream annotations
      object - Object to serialize
      writer - Writer to set
    • writeStringFromObject

      public <T> String writeStringFromObject(Object object)
      Serialize an object to the given Writer as pretty-printed XML (Object to Xml)
      Parameters:
      object - Object to serialize
    • getObjectFromXml

      public <T> T getObjectFromXml(Class<T> wrapperClass, Reader reader)
      Deserialize an object from an XML reader (Xml to Reader (Object))
      Type Parameters:
      T - Object deserialize type
      Parameters:
      wrapperClass - Class with XStream annotations
      reader - Reader for deserialize
      Returns:
      Object deserialize
    • getObjectFromXml

      public <T> T getObjectFromXml(Class<T> wrapperClass, InputStream inputStream)
      Deserialize an object from an XML InputStream (Xml to InputStream (Object))
      Type Parameters:
      T - Object deserialize type
      Parameters:
      wrapperClass - Class with XStream annotations
      inputStream - InputStream for deserialize
      Returns:
      Object deserialize
    • getObjectFromTemplate

      public <T> T getObjectFromTemplate(Class<T> wrapperClass, String template)
      Deserialize an object from a string template (Xml to InputStream (Object))
      Type Parameters:
      T - Object deserialize type
      Parameters:
      wrapperClass - Class with XStream annotations
      template - Template for deserialize
      Returns:
      Object deserialize