Class XmlResourceLoader<T>
- java.lang.Object
-
- com.smartgridready.communicator.common.helper.XmlResourceLoader<T>
-
- Type Parameters:
T- The type to deserialize into.
public class XmlResourceLoader<T> extends java.lang.ObjectImplements 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 Tload(java.lang.String resourcePath, java.lang.String xmlContent, boolean validate)Deserializes XML into an object.
-
-
-
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 resourcexmlContent- the XML content loaded from the resourcevalidate- validates schema if true- Returns:
- an instance of the desired type
- Throws:
java.io.IOException- when deserialization failed
-
-