Class GenericUnmarshaller<T>
java.lang.Object
org.openhab.core.config.core.xml.util.GenericUnmarshaller<T>
- Type Parameters:
T
- the result type of the conversion
- All Implemented Interfaces:
com.thoughtworks.xstream.converters.Converter
,com.thoughtworks.xstream.converters.ConverterMatcher
- Direct Known Subclasses:
ConfigDescriptionConverter
,ConfigDescriptionParameterConverter
,ConfigDescriptionParameterGroupConverter
,FilterCriteriaConverter
,NodeAttributesConverter
,NodeListConverter
,NodeValueConverter
@NonNullByDefault
public abstract class GenericUnmarshaller<T>
extends Object
implements com.thoughtworks.xstream.converters.Converter
The
GenericUnmarshaller
is an abstract implementation of the XStream
Converter
interface used
to convert XML tags within an XML document into its
according objects.
Hint: This class only supports unmarshalling functionality.
- Author:
- Michael Grammling - Initial contribution
-
Constructor Summary
ConstructorDescriptionGenericUnmarshaller
(Class<T> clazz) Creates a new instance of this class with the specified parameter. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
canConvert
(@Nullable Class paramClass) Class<?>
Returns the class of the result typefinal void
marshal
(@Nullable Object value, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context) protected static String
requireNonEmpty
(@Nullable String string, String message) Checks that the specified string is notnull
and not empty and throws a customizedConversionException
if it is.protected static Object
requireNonNull
(@Nullable Object object, String message) Checks that the specified object is notnull
and throws a customizedConversionException
if it is.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.thoughtworks.xstream.converters.Converter
unmarshal
-
Constructor Details
-
GenericUnmarshaller
Creates a new instance of this class with the specified parameter.- Parameters:
clazz
- the class of the result type (must not be null)
-
-
Method Details
-
getResultType
Returns the class of the result type- Returns:
- the class of the result type
-
canConvert
- Specified by:
canConvert
in interfacecom.thoughtworks.xstream.converters.ConverterMatcher
-
marshal
public final void marshal(@Nullable Object value, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context) - Specified by:
marshal
in interfacecom.thoughtworks.xstream.converters.Converter
-
requireNonNull
Checks that the specified object is notnull
and throws a customizedConversionException
if it is.- Parameters:
object
- the object to check for nullitymessage
- detail message to be used in the event that aConversionException
is thrown- Returns:
object
if notnull
- Throws:
com.thoughtworks.xstream.converters.ConversionException
- ifobject
isnull
-
requireNonEmpty
Checks that the specified string is notnull
and not empty and throws a customizedConversionException
if it is.- Parameters:
string
- the string to check for nullity and emptinessmessage
- detail message to be used in the event that aConversionException
is thrown- Returns:
string
if notnull
and not empty- Throws:
com.thoughtworks.xstream.converters.ConversionException
- ifstring
isnull
or empty
-