Class XmlResourceLoader<T>

  • Type Parameters:
    T - The type to deserialize into.

    public class XmlResourceLoader<T>
    extends java.lang.Object
    Implements a generic XML deserializer that loads resources.
    • Constructor Summary

      Constructors 
      Constructor Description
      XmlResourceLoader​(java.lang.Class<T> clazz)
      Constructs a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T load​(java.lang.String resourcePath, java.lang.String xmlContent, boolean validate)
      Deserializes XML into an object.
      • Methods inherited from class java.lang.Object

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

      • XmlResourceLoader

        public XmlResourceLoader​(java.lang.Class<T> clazz)
        Constructs a new instance.
        Parameters:
        clazz - type to deserialize into
    • Method Detail

      • load

        public T load​(java.lang.String resourcePath,
                      java.lang.String xmlContent,
                      boolean validate)
               throws java.io.IOException
        Deserializes XML into an object.
        Parameters:
        resourcePath - the path of the loaded resource
        xmlContent - the XML content loaded from the resource
        validate - validates schema if true
        Returns:
        an instance of the desired type
        Throws:
        java.io.IOException - when deserialization failed