Class AttributedValueReferenceConverter

java.lang.Object
com.thoughtworks.xstream.converters.extended.ToAttributedValueConverter
name.moore.kevin.ze.XMLdata.converters.AttributedValueReferenceConverter
All Implemented Interfaces:
com.thoughtworks.xstream.converters.Converter, com.thoughtworks.xstream.converters.ConverterMatcher

public class AttributedValueReferenceConverter extends com.thoughtworks.xstream.converters.extended.ToAttributedValueConverter
Processes an XML element in the form <element key="key">value</element> into a reference object that consists of a key to another entity and an optional value. It allows a 'soft pointer' to another entity that will need to be found later (via the key).

An example XML usage is <orbiting key="Sol">3</orbiting>

To make use of this converter it needs to be configured with

 @ZodiacEntityReference
 @XStreamConverter(value = AttributedValueReferenceConverter.class, strings = {"value"})
 @XStreamAlias("orbiting") 
 private reference orbiting;
 

If there is no value to be collected omit the strings parameter and a default of 1 will be used.

Author:
Kevin Moore <dev@kevin.moore.name>
See Also:
reference
  • Constructor Summary

    Constructors
    Constructor
    Description
    AttributedValueReferenceConverter​(Class type, com.thoughtworks.xstream.mapper.Mapper mapper, com.thoughtworks.xstream.converters.reflection.ReflectionProvider reflectionProvider, com.thoughtworks.xstream.converters.ConverterLookup lookup)
     
    AttributedValueReferenceConverter​(Class type, com.thoughtworks.xstream.mapper.Mapper mapper, com.thoughtworks.xstream.converters.reflection.ReflectionProvider reflectionProvider, com.thoughtworks.xstream.converters.ConverterLookup lookup, String valueFieldName)
     
    AttributedValueReferenceConverter​(Class type, com.thoughtworks.xstream.mapper.Mapper mapper, com.thoughtworks.xstream.converters.reflection.ReflectionProvider reflectionProvider, com.thoughtworks.xstream.converters.ConverterLookup lookup, String valueFieldName, Class valueDefinedIn)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canConvert​(Class type)
     

    Methods inherited from class com.thoughtworks.xstream.converters.extended.ToAttributedValueConverter

    marshal, unmarshal

    Methods inherited from class java.lang.Object

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

    • AttributedValueReferenceConverter

      public AttributedValueReferenceConverter(Class type, com.thoughtworks.xstream.mapper.Mapper mapper, com.thoughtworks.xstream.converters.reflection.ReflectionProvider reflectionProvider, com.thoughtworks.xstream.converters.ConverterLookup lookup)
      Parameters:
      type -
      mapper -
      reflectionProvider -
      lookup -
    • AttributedValueReferenceConverter

      public AttributedValueReferenceConverter(Class type, com.thoughtworks.xstream.mapper.Mapper mapper, com.thoughtworks.xstream.converters.reflection.ReflectionProvider reflectionProvider, com.thoughtworks.xstream.converters.ConverterLookup lookup, String valueFieldName)
      Parameters:
      type -
      mapper -
      reflectionProvider -
      lookup -
      valueFieldName -
    • AttributedValueReferenceConverter

      public AttributedValueReferenceConverter(Class type, com.thoughtworks.xstream.mapper.Mapper mapper, com.thoughtworks.xstream.converters.reflection.ReflectionProvider reflectionProvider, com.thoughtworks.xstream.converters.ConverterLookup lookup, String valueFieldName, Class valueDefinedIn)
      Parameters:
      type -
      mapper -
      reflectionProvider -
      lookup -
      valueFieldName -
      valueDefinedIn -
  • Method Details

    • canConvert

      public boolean canConvert(Class type)
      Specified by:
      canConvert in interface com.thoughtworks.xstream.converters.ConverterMatcher
      Overrides:
      canConvert in class com.thoughtworks.xstream.converters.extended.ToAttributedValueConverter