Class TypeRegistryConverter
- java.lang.Object
-
- net.ssehub.easy.instantiation.serializer.xml.converter.TypeRegistryConverter
-
- All Implemented Interfaces:
com.thoughtworks.xstream.converters.Converter,com.thoughtworks.xstream.converters.ConverterMatcher
public class TypeRegistryConverter extends java.lang.Object implements com.thoughtworks.xstream.converters.ConverterA type converter for the TypeRegistry.- Author:
- Aike Sass
-
-
Field Summary
Fields Modifier and Type Field Description protected static EASyLoggerFactory.EASyLoggerloggerprivate static java.lang.StringprojectName
-
Constructor Summary
Constructors Constructor Description TypeRegistryConverter()Creates a singleton type converter.
-
Method Summary
All Methods Static 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.static voidsetProjectName(java.lang.String name)Setter for the project name.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.
-
-
-
Field Detail
-
logger
protected static EASyLoggerFactory.EASyLogger logger
-
projectName
private static java.lang.String projectName
-
-
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 TypeRegistry 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 TypeRegistry 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
-
setProjectName
public static void setProjectName(java.lang.String name)
Setter for the project name.- Parameters:
name- name of the project
-
-