Class NullValueConverter
- java.lang.Object
-
- net.ssehub.easy.instantiation.serializer.xml.converter.NullValueConverter
-
- All Implemented Interfaces:
com.thoughtworks.xstream.converters.Converter,com.thoughtworks.xstream.converters.ConverterMatcher
public class NullValueConverter extends java.lang.Object implements com.thoughtworks.xstream.converters.ConverterA type converter for delegating types. Background: In the IVML object model, delegating types are used to resolve class dependencies while defining IVML operations as constants. These delegating types are singleton instances and if serialized to an XML file, the type identity of the object constants defined in the IVML object model are not unique anymore. In this class, map the delegating type to a unique name and back to the actual singleton instance.- Author:
- Aike Sass
-
-
Constructor Summary
Constructors Constructor Description NullValueConverter()Creates a singleton type converter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanConvert(java.lang.Class cls)Determines whether this converter instance handles the given class.voidmarshal(java.lang.Object object, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context)Marshals a givenobjectto the givenwriterin the specified marshalingcontext.java.lang.Objectunmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)Unmarshals the current object to be read from the givenreaderin the specified unmarshalingcontext.
-
-
-
Method Detail
-
canConvert
public boolean canConvert(java.lang.Class cls)
Determines whether this converter instance handles the given class.- Specified by:
canConvertin interfacecom.thoughtworks.xstream.converters.ConverterMatcher- Parameters:
cls- the class to be tested- Returns:
trueif this instance handlesclass(this is only the case if it is a NullValue class),falseelse
-
marshal
public void marshal(java.lang.Object object, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context)Marshals a givenobjectto the givenwriterin the specified marshalingcontext. This method translates a NullValue type singleton to a name.- Specified by:
marshalin interfacecom.thoughtworks.xstream.converters.Converter- Parameters:
object- the object to be marshaledwriter- the output stream writercontext- the marshaling context
-
unmarshal
public java.lang.Object unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)Unmarshals the current object to be read from the givenreaderin the specified unmarshalingcontext. This method translates the name back to the singleton instance.- Specified by:
unmarshalin interfacecom.thoughtworks.xstream.converters.Converter- Parameters:
reader- the input stream writercontext- the marshaling context- Returns:
- the unmarshaled object
-
-