Class AbstractDescriptorConverter
- java.lang.Object
-
- net.ssehub.easy.instantiation.serializer.xml.converter.AbstractDescriptorConverter
-
- All Implemented Interfaces:
com.thoughtworks.xstream.converters.Converter,com.thoughtworks.xstream.converters.ConverterMatcher
- Direct Known Subclasses:
IvmlComparisonOperationDescriptorConverter,ReflectionOperationDescriptorConverter
public abstract class AbstractDescriptorConverter extends java.lang.Object implements com.thoughtworks.xstream.converters.ConverterAbstract converter used byReflectionOperationDescriptorConverterandIvmlComparisonOperationDescriptorConverter.- Author:
- Sass
-
-
Field Summary
Fields Modifier and Type Field Description protected EASyLoggerFactory.EASyLoggerloggerprivate static java.util.Map<java.lang.String,TypeDescriptor<?>>pseudoTypesprivate static TypeRegistrytypeRegistry
-
Constructor Summary
Constructors Constructor Description AbstractDescriptorConverter()Creates a singleton descriptor converter and gets all vil pseudo types.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttributes(com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, OperationDescriptor operationDescriptor)Adds the attributes to the node.private java.lang.ObjectgetOperationDescriptor(java.lang.String name, java.lang.Object result, java.lang.Iterable<OperationDescriptor> iterable, TypeDescriptor<?>[] parameters)Gets theOperationDescriptor.private TypeDescriptor<?>[]getParameterTypes(java.lang.String attribute, TypeDescriptor<?>[] parameters, java.lang.String regex)Collects the types of the parameters.private TypeDescriptor<?>getTypeDescriptor(java.lang.String attribute)Gets theTypeDescriptorfor a given attribute.static voidsetTypeRegistry(TypeRegistry registry)Setter for the type registry.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
-
typeRegistry
private static TypeRegistry typeRegistry
-
pseudoTypes
private static java.util.Map<java.lang.String,TypeDescriptor<?>> pseudoTypes
-
logger
protected EASyLoggerFactory.EASyLogger logger
-
-
Method Detail
-
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
-
addAttributes
public void addAttributes(com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, OperationDescriptor operationDescriptor)Adds the attributes to the node.- Parameters:
writer- the output stream writeroperationDescriptor- the OperationDescriptor
-
getTypeDescriptor
private TypeDescriptor<?> getTypeDescriptor(java.lang.String attribute)
Gets theTypeDescriptorfor a given attribute.- Parameters:
attribute- The attribute to be checked.- Returns:
- the
TypeDescriptorfor the given attribute, null if not found.
-
getParameterTypes
private TypeDescriptor<?>[] getParameterTypes(java.lang.String attribute, TypeDescriptor<?>[] parameters, java.lang.String regex)
Collects the types of the parameters.- Parameters:
attribute- The attribute to be parsedparameters- Array containing all typesregex- Regex to filter the string- Returns:
- Array with all types
-
getOperationDescriptor
private java.lang.Object getOperationDescriptor(java.lang.String name, java.lang.Object result, java.lang.Iterable<OperationDescriptor> iterable, TypeDescriptor<?>[] parameters)Gets theOperationDescriptor.- Parameters:
name- name of the attributeresult- the object to be returnediterable- Iterable ofOperationDescriptorparameters- Array with parameters- Returns:
- the
OperationDescriptorfor a given attribute
-
setTypeRegistry
public static void setTypeRegistry(TypeRegistry registry)
Setter for the type registry.- Parameters:
registry- The type registry to be set
-
-