org.hudsonci.utils.marshal.xref
Class XReferenceConverter

java.lang.Object
  extended by com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
      extended by org.hudsonci.utils.marshal.xref.XReferenceConverter
All Implemented Interfaces:
com.thoughtworks.xstream.converters.Converter, com.thoughtworks.xstream.converters.ConverterMatcher
Direct Known Subclasses:
XReferenceStoreConverter

public abstract class XReferenceConverter
extends com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter

Converter for XReference types.

Since:
2.1.0
Author:
Jason Dillon

Nested Class Summary
protected  class XReferenceConverter.HolderSupport
          Support for XReference.Holder implementations.
static class XReferenceConverter.HolderType
          Default holder types.
protected  class XReferenceConverter.SoftUnmarshalHolder
          Unmarshalling holder with a soft reference.
protected  class XReferenceConverter.UnmarshalHolder
          Unmarshalling holder with a hard reference.
 
Nested classes/interfaces inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.DuplicateFieldException
 
Field Summary
protected  XReferenceConverter.HolderType holderType
           
 
Fields inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
mapper, reflectionProvider, serializationMethodInvoker
 
Constructor Summary
XReferenceConverter(com.thoughtworks.xstream.mapper.Mapper mapper, com.thoughtworks.xstream.converters.reflection.ReflectionProvider reflection)
           
 
Method Summary
 boolean canConvert(Class type)
           
protected  XReference.Holder createStoredHolder(XReference ref, Object target)
          Create the holder to be used after the reference has been stored.
protected  XReference.Holder createUnmarshalHolder(XReference ref)
          Create the holder to be used after the reference has been unmarshalled.
protected  void doMarshal(Object source, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context)
           
 Object doUnmarshal(Object result, com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
           
 XReferenceConverter.HolderType getHolderType()
           
protected abstract  Object load(XReference ref)
          Provides reference loading behavior.
 void setHolderType(XReferenceConverter.HolderType type)
           
protected abstract  void store(XReference ref)
          Provides reference storing behavior.
 
Methods inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
instantiateNewInstance, marshal, marshallField, shouldUnmarshalTransientFields, unmarshal, unmarshallField
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

holderType

protected XReferenceConverter.HolderType holderType
Constructor Detail

XReferenceConverter

public XReferenceConverter(com.thoughtworks.xstream.mapper.Mapper mapper,
                           com.thoughtworks.xstream.converters.reflection.ReflectionProvider reflection)
Method Detail

getHolderType

public XReferenceConverter.HolderType getHolderType()

setHolderType

public void setHolderType(XReferenceConverter.HolderType type)

canConvert

public boolean canConvert(Class type)

doMarshal

protected void doMarshal(Object source,
                         com.thoughtworks.xstream.io.HierarchicalStreamWriter writer,
                         com.thoughtworks.xstream.converters.MarshallingContext context)
Overrides:
doMarshal in class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter

doUnmarshal

public Object doUnmarshal(Object result,
                          com.thoughtworks.xstream.io.HierarchicalStreamReader reader,
                          com.thoughtworks.xstream.converters.UnmarshallingContext context)
Overrides:
doUnmarshal in class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter

store

protected abstract void store(XReference ref)
                       throws IOException
Provides reference storing behavior.

Throws:
IOException

load

protected abstract Object load(XReference ref)
                        throws IOException
Provides reference loading behavior.

Throws:
IOException

createStoredHolder

protected XReference.Holder createStoredHolder(XReference ref,
                                               Object target)
Create the holder to be used after the reference has been stored.


createUnmarshalHolder

protected XReference.Holder createUnmarshalHolder(XReference ref)
Create the holder to be used after the reference has been unmarshalled.



Copyright © 2004-2011 Hudson. All Rights Reserved.