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
ConstructorsConstructorDescriptionGenericUnmarshaller(Class<T> clazz) Creates a new instance of this class with the specified parameter. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleancanConvert(@Nullable Class paramClass) Class<?> Returns the class of the result typefinal voidmarshal(@Nullable Object value, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context) protected static StringrequireNonEmpty(@Nullable String string, String message) Checks that the specified string is notnulland not empty and throws a customizedConversionExceptionif it is.protected static ObjectrequireNonNull(@Nullable Object object, String message) Checks that the specified object is notnulland throws a customizedConversionExceptionif it is.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
canConvertin 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:
marshalin interfacecom.thoughtworks.xstream.converters.Converter
-
requireNonNull
Checks that the specified object is notnulland throws a customizedConversionExceptionif it is.- Parameters:
object- the object to check for nullitymessage- detail message to be used in the event that aConversionExceptionis thrown- Returns:
objectif notnull- Throws:
com.thoughtworks.xstream.converters.ConversionException- ifobjectisnull
-
requireNonEmpty
Checks that the specified string is notnulland not empty and throws a customizedConversionExceptionif it is.- Parameters:
string- the string to check for nullity and emptinessmessage- detail message to be used in the event that aConversionExceptionis thrown- Returns:
stringif notnulland not empty- Throws:
com.thoughtworks.xstream.converters.ConversionException- ifstringisnullor empty
-