public class

CharConverter

extends Object
implements Converter SingleValueConverter
java.lang.Object
   ↳ com.thoughtworks.xstream.converters.basic.CharConverter

Class Overview

Converts a char primitive or java.lang.Character wrapper to a String. If char is \0 the representing String is empty.

Summary

Public Constructors
CharConverter()
Public Methods
boolean canConvert(Class type)
Determines whether the converter can marshall a particular type.
Object fromString(String str)
Unmarshals an Object from its single value representation.
void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context)
Convert an object to textual data.
String toString(Object obj)
Marshals an Object into a single value representation.
Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
Convert textual data back into an object.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.thoughtworks.xstream.converters.Converter
From interface com.thoughtworks.xstream.converters.ConverterMatcher
From interface com.thoughtworks.xstream.converters.SingleValueConverter

Public Constructors

public CharConverter ()

Public Methods

public boolean canConvert (Class type)

Determines whether the converter can marshall a particular type.

Parameters
type the Class representing the object type to be converted

public Object fromString (String str)

Unmarshals an Object from its single value representation.

Parameters
str the String with the single value of the Object
Returns
  • the Object

public void marshal (Object source, HierarchicalStreamWriter writer, MarshallingContext context)

Convert an object to textual data.

Parameters
source The object to be marshalled.
writer A stream to write to.
context A context that allows nested objects to be processed by XStream.

public String toString (Object obj)

Marshals an Object into a single value representation.

Parameters
obj the Object to be converted
Returns
  • a String with the single value of the Object or null

public Object unmarshal (HierarchicalStreamReader reader, UnmarshallingContext context)

Convert textual data back into an object.

Parameters
reader The stream to read the text from.
Returns
  • The resulting object.