Class GenericFieldAttributeConverter<T>

  • Type Parameters:
    T - the type of object to convert
    All Implemented Interfaces:
    com.thoughtworks.xstream.converters.Converter, com.thoughtworks.xstream.converters.ConverterMatcher

    public class GenericFieldAttributeConverter<T>
    extends java.lang.Object
    implements com.thoughtworks.xstream.converters.Converter
    This is a generic converter that can be used by xstream to convert each field of a class into a <arrbname value="..." /> node.
    • Constructor Summary

      Constructors 
      Constructor Description
      GenericFieldAttributeConverter​(com.thoughtworks.xstream.XStream xStream, java.lang.Class<T> clazz)
      The constructor needs the xstream-object to get the mapper and the converter-lookup and a class which can then be converted by this mapper.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canConvert​(java.lang.Class otherClazz)  
      void marshal​(java.lang.Object object, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext ctx)  
      java.lang.Object unmarshal​(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext ctx)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GenericFieldAttributeConverter

        public GenericFieldAttributeConverter​(com.thoughtworks.xstream.XStream xStream,
                                              java.lang.Class<T> clazz)
        The constructor needs the xstream-object to get the mapper and the converter-lookup and a class which can then be converted by this mapper.
        Parameters:
        xStream - the xstream object
        clazz - the class to be treated by this converter
    • Method Detail

      • marshal

        public void marshal​(java.lang.Object object,
                            com.thoughtworks.xstream.io.HierarchicalStreamWriter writer,
                            com.thoughtworks.xstream.converters.MarshallingContext ctx)
        Specified by:
        marshal in interface com.thoughtworks.xstream.converters.Converter
      • unmarshal

        public java.lang.Object unmarshal​(com.thoughtworks.xstream.io.HierarchicalStreamReader reader,
                                          com.thoughtworks.xstream.converters.UnmarshallingContext ctx)
        Specified by:
        unmarshal in interface com.thoughtworks.xstream.converters.Converter
      • canConvert

        public boolean canConvert​(java.lang.Class otherClazz)
        Specified by:
        canConvert in interface com.thoughtworks.xstream.converters.ConverterMatcher