public class XStream2
extends com.thoughtworks.xstream.XStream
XStream enhanced for additional Java5 support and improved robustness.| Modifier and Type | Class and Description |
|---|---|
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. |
| Constructor and Description |
|---|
XStream2() |
XStream2(com.thoughtworks.xstream.io.HierarchicalStreamDriver hierarchicalStreamDriver) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCompatibilityAlias(String oldClassName,
Class newClass)
Adds an alias in case class names change.
|
void |
addCriticalField(Class<?> clazz,
String field)
Specifies that a given field of a given class should not be treated with laxity by
RobustCollectionConverter. |
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) |
addDefaultImplementation, addImmutableType, addImplicitArray, addImplicitArray, addImplicitArray, addImplicitCollection, addImplicitCollection, addImplicitCollection, addImplicitMap, addImplicitMap, addPermission, alias, alias, aliasAttribute, aliasAttribute, aliasField, aliasPackage, aliasSystemAttribute, aliasType, allowTypeHierarchy, allowTypes, allowTypes, allowTypesByRegExp, allowTypesByRegExp, allowTypesByWildcard, autodetectAnnotations, createObjectInputStream, createObjectInputStream, createObjectInputStream, createObjectOutputStream, createObjectOutputStream, createObjectOutputStream, createObjectOutputStream, createObjectOutputStream, createObjectOutputStream, denyPermission, denyTypeHierarchy, denyTypes, denyTypes, denyTypesByRegExp, denyTypesByRegExp, denyTypesByWildcard, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, getClassLoader, getClassLoaderReference, getConverterLookup, getConverterRegistry, getJvm, getMapper, getReflectionProvider, ignoreUnknownElements, ignoreUnknownElements, marshal, marshal, newDataHolder, omitField, processAnnotations, processAnnotations, registerConverter, registerConverter, registerConverter, registerConverter, registerLocalConverter, registerLocalConverter, setClassLoader, setMarshallingStrategy, setMode, setupAliases, setupConverters, setupDefaultImplementations, setupImmutableTypes, setupSecurity, toXML, toXML, unmarshal, unmarshal, useAttributeFor, useAttributeFor, useAttributeFor, useXStream11XmlFriendlyMapperpublic XStream2()
public XStream2(com.thoughtworks.xstream.io.HierarchicalStreamDriver hierarchicalStreamDriver)
public Object unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, Object root, com.thoughtworks.xstream.converters.DataHolder dataHolder)
unmarshal in class com.thoughtworks.xstream.XStreamprotected com.thoughtworks.xstream.converters.Converter createDefaultConverter()
createDefaultConverter in class com.thoughtworks.xstream.XStream@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public void addCriticalField(Class<?> clazz, String field)
RobustCollectionConverter.clazz - a class which we expect to hold a non-transient fieldfield - a field name in that classprotected com.thoughtworks.xstream.mapper.MapperWrapper wrapMapper(com.thoughtworks.xstream.mapper.MapperWrapper next)
wrapMapper in class com.thoughtworks.xstream.XStreampublic com.thoughtworks.xstream.mapper.Mapper getMapperInjectionPoint()
@Deprecated public void toXML(Object obj, OutputStream out)
toXMLUTF8(java.lang.Object, java.io.OutputStream).toXML in class com.thoughtworks.xstream.XStreampublic void toXMLUTF8(Object obj, OutputStream out) throws IOException
IOExceptionpublic void setMapper(com.thoughtworks.xstream.mapper.Mapper m)
XStream2 was created,
but because of the way XStream works internally, this needs to be done carefully.
Namely,
getMapperInjectionPoint() wrap it, then put that back into setMapper(Mapper).
public void addCompatibilityAlias(String oldClassName, Class newClass)
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.oldClassName - Fully qualified name of the old class name.newClass - New class that's field-compatible with the given old class name.Copyright © 2019. All rights reserved.