hudson.util
Class XStream2

java.lang.Object
  extended by com.thoughtworks.xstream.XStream
      extended by hudson.util.XStream2

public class XStream2
extends com.thoughtworks.xstream.XStream

XStream enhanced for additional Java5 support and improved robustness.

Author:
Kohsuke Kawaguchi

Nested Class Summary
static class XStream2.PassthruConverter<T>
          Create a nested ConverterImpl subclass that extends this class to run some callback code just after a type is unmarshalled by RobustReflectionConverter.
 
Nested classes/interfaces inherited from class com.thoughtworks.xstream.XStream
com.thoughtworks.xstream.XStream.InitializationException
 
Field Summary
 
Fields inherited from class com.thoughtworks.xstream.XStream
ID_REFERENCES, NO_REFERENCES, PRIORITY_LOW, PRIORITY_NORMAL, PRIORITY_VERY_HIGH, PRIORITY_VERY_LOW, SINGLE_NODE_XPATH_ABSOLUTE_REFERENCES, SINGLE_NODE_XPATH_RELATIVE_REFERENCES, XPATH_ABSOLUTE_REFERENCES, XPATH_RELATIVE_REFERENCES
 
Constructor Summary
XStream2()
           
XStream2(com.thoughtworks.xstream.io.HierarchicalStreamDriver hierarchicalStreamDriver)
           
 
Method Summary
 void addCompatibilityAlias(String oldClassName, Class newClass)
          Adds an alias in case class names change.
protected  com.thoughtworks.xstream.converters.Converter createDefaultConverter()
           
 com.thoughtworks.xstream.mapper.Mapper getMapperInjectionPoint()
           
 void setMapper(com.thoughtworks.xstream.mapper.Mapper m)
          This method allows one to insert additional mappers after XStream2 was created, but because of the way XStream works internally, this needs to be done carefully.
 void toXML(Object obj, OutputStream out)
          Deprecated. Uses default encoding yet fails to write an encoding header. Prefer toXMLUTF8(java.lang.Object, java.io.OutputStream).
 void toXMLUTF8(Object obj, OutputStream out)
          Serializes to a byte stream.
 Object unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, Object root, com.thoughtworks.xstream.converters.DataHolder dataHolder)
           
protected  com.thoughtworks.xstream.mapper.MapperWrapper wrapMapper(com.thoughtworks.xstream.mapper.MapperWrapper next)
           
 
Methods inherited from class com.thoughtworks.xstream.XStream
addDefaultImplementation, addImmutableType, addImplicitArray, addImplicitArray, addImplicitArray, addImplicitCollection, addImplicitCollection, addImplicitCollection, addImplicitMap, addImplicitMap, alias, alias, aliasAttribute, aliasAttribute, aliasField, aliasPackage, aliasSystemAttribute, aliasType, autodetectAnnotations, createObjectInputStream, createObjectInputStream, createObjectInputStream, createObjectOutputStream, createObjectOutputStream, createObjectOutputStream, createObjectOutputStream, createObjectOutputStream, createObjectOutputStream, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, getClassLoader, getConverterLookup, getConverterRegistry, getJvm, getMapper, getReflectionProvider, marshal, marshal, newDataHolder, omitField, processAnnotations, processAnnotations, registerConverter, registerConverter, registerConverter, registerConverter, registerLocalConverter, registerLocalConverter, setClassLoader, setMarshallingStrategy, setMode, setupAliases, setupConverters, setupDefaultImplementations, setupImmutableTypes, toXML, toXML, unmarshal, unmarshal, useAttributeFor, useAttributeFor, useAttributeFor, useXStream11XmlFriendlyMapper
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XStream2

public XStream2()

XStream2

public XStream2(com.thoughtworks.xstream.io.HierarchicalStreamDriver hierarchicalStreamDriver)
Method Detail

unmarshal

public Object unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader,
                        Object root,
                        com.thoughtworks.xstream.converters.DataHolder dataHolder)
Overrides:
unmarshal in class com.thoughtworks.xstream.XStream

createDefaultConverter

protected com.thoughtworks.xstream.converters.Converter createDefaultConverter()
Overrides:
createDefaultConverter in class com.thoughtworks.xstream.XStream

wrapMapper

protected com.thoughtworks.xstream.mapper.MapperWrapper wrapMapper(com.thoughtworks.xstream.mapper.MapperWrapper next)
Overrides:
wrapMapper in class com.thoughtworks.xstream.XStream

getMapperInjectionPoint

public com.thoughtworks.xstream.mapper.Mapper getMapperInjectionPoint()

toXML

@Deprecated
public void toXML(Object obj,
                             OutputStream out)
Deprecated. Uses default encoding yet fails to write an encoding header. Prefer toXMLUTF8(java.lang.Object, java.io.OutputStream).

Overrides:
toXML in class com.thoughtworks.xstream.XStream

toXMLUTF8

public void toXMLUTF8(Object obj,
                      OutputStream out)
               throws IOException
Serializes to a byte stream. Uses UTF-8 encoding and specifies that in the XML encoding declaration.

Throws:
IOException
Since:
1.504

setMapper

public void setMapper(com.thoughtworks.xstream.mapper.Mapper m)
This method allows one to insert additional mappers after XStream2 was created, but because of the way XStream works internally, this needs to be done carefully. Namely,
  1. You need to getMapperInjectionPoint() wrap it, then put that back into setMapper(Mapper).
  2. The whole sequence needs to be synchronized against this object to avoid a concurrency issue.


addCompatibilityAlias

public void addCompatibilityAlias(String oldClassName,
                                  Class newClass)
Adds an alias in case class names change. Unlike XStream.alias(String, Class), which uses the registered alias name for writing XML, this method registers an alias to be used only for the sake of reading from XML. This makes this method usable for the situation when class names change.

Parameters:
oldClassName - Fully qualified name of the old class name.
newClass - New class that's field-compatible with the given old class name.
Since:
1.416


Copyright © 2004-2013. All Rights Reserved.