public final class ParamsUtil extends Object
Modifier and Type | Method and Description |
---|---|
static <T extends Serializable> |
clone(T object)
Clones a
Serializable object using serialization. |
static XStream |
getXStreamInstance()
Returns the
XStream instance used for XML serialization. |
static <T extends Enum<T>> |
obtainEnumDomain(Class<T> enumType)
Obtains the domain for given
enumType to be used in
Properties objects. |
static <T> T |
readFromXml(Path path,
Class<T> clazz)
Reads an xml file and returns its data as an object, using
XStream instance. |
static void |
writeToXml(Object object,
Path path)
Data from given object is written to an XML file, using
XStream
instance. |
public static XStream getXStreamInstance()
XStream
instance used for XML serialization.
XStream
is thread-safe. See documentation for details.
XStream
instancepublic static <T> T readFromXml(Path path, Class<T> clazz) throws IOException, XStreamException
XStream
instance.path
- the path to the XML file to readclazz
- class to be used for the returned objectIOException
- if an I/O error occurs opening the fileXStreamException
- if the object cannot be deserializedpublic static void writeToXml(Object object, Path path) throws IOException, XStreamException
XStream
instance.object
- path
- the path to the file that has to be writtenIOException
- if an I/O error occurs opening or creating the fileXStreamException
- if the object cannot be serializedpublic static <T extends Enum<T>> String[] obtainEnumDomain(Class<T> enumType)
enumType
to be used in
Properties
objects.enumType
- enumType
public static <T extends Serializable> T clone(T object)
Serializable
object using serialization.object
-