Top Description Fields Constructors Methods
com.thoughtworks.xstream.converters.extended

public Class JavaClassConverter

extends AbstractSingleValueConverter
Class Inheritance
Imports
com.thoughtworks.xstream.converters.ConversionException, com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter, com.thoughtworks.xstream.core.ClassLoaderReference, com.thoughtworks.xstream.mapper.CannotResolveClassException, .DefaultMapper, .Mapper

Converts a java.lang.Class to XML.
Authors
Aslak Hellesøy, Joe Walnes, Matthew Sandoz, Jörg Schaible

Field Summary

Modifier and TypeField and Description
private Mapper

Constructor Summary

AccessConstructor and Description
public
JavaClassConverter(ClassLoaderReference
the reference to the ClassLoader of the XStream instance
classLoaderReference
)

Construct a JavaClassConverter.

public
protected
JavaClassConverter(Mapper
to use
mapper
)

Construct a JavaClassConverter that uses a provided mapper.

Method Summary

Modifier and TypeMethod and Description
public boolean
canConvert(Class<T>
the Class representing the object type to be converted
clazz
)

Implements abstract com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter.canConvert.

Implements com.thoughtworks.xstream.converters.ConverterMatcher.canConvert.

Determines whether the converter can marshall a particular type.
public Object
fromString(String
the String with the single value of the Object
str
)

Implements abstract com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter.fromString.

Implements com.thoughtworks.xstream.converters.SingleValueConverter.fromString.

Unmarshals an Object from its single value representation.
public String
toString(Object
the Object to be converted
obj
)

Overrides com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter.toString.

Implements com.thoughtworks.xstream.converters.SingleValueConverter.toString.

Marshals an Object into a single value representation.

Field Detail

mapperback to summary
private Mapper mapper

Constructor Detail

JavaClassConverterback to summary
public JavaClassConverter(ClassLoaderReference classLoaderReference)

Construct a JavaClassConverter.

Parameters
classLoaderReference:ClassLoaderReference

the reference to the ClassLoader of the XStream instance

Since
1.4.5
JavaClassConverterback to summary
public JavaClassConverter(ClassLoader classLoader)

Deprecated

As of 1.4.5 use JavaClassConverter(ClassLoaderReference)

JavaClassConverterback to summary
protected JavaClassConverter(Mapper mapper)

Construct a JavaClassConverter that uses a provided mapper. Depending on the mapper chain it will not only be used to load classes, but also to support type aliases.

Parameters
mapper:Mapper

to use

Since
1.4.5

Method Detail

canConvertback to summary
public boolean canConvert(Class<T> clazz)

Implements abstract com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter.canConvert.

Implements com.thoughtworks.xstream.converters.ConverterMatcher.canConvert.

Doc from com.thoughtworks.xstream.converters.ConverterMatcher.canConvert.

Determines whether the converter can marshall a particular type.

Parameters
clazz:Class<T>

the Class representing the object type to be converted

fromStringback to summary
public Object fromString(String str)

Implements abstract com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter.fromString.

Implements com.thoughtworks.xstream.converters.SingleValueConverter.fromString.

Doc from com.thoughtworks.xstream.converters.SingleValueConverter.fromString.

Unmarshals an Object from its single value representation.

Parameters
str:String

the String with the single value of the Object

Returns:Object

the Object

toStringback to summary
public String toString(Object obj)

Overrides com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter.toString.

Implements com.thoughtworks.xstream.converters.SingleValueConverter.toString.

Doc from com.thoughtworks.xstream.converters.SingleValueConverter.toString.

Marshals an Object into a single value representation.

Parameters
obj:Object

the Object to be converted

Returns:String

a String with the single value of the Object or null