|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Interface for defining objects which perform bi-directional conversion between string values and Java objects. A unified conversion interface is required for serializing and de-serializing data values to and from a textual representation, which is a common requirement when interacting with a network or web-based data source.
For many Java classes (Date, Color, etc), an instance may be
represented in a variety of string formats, hence both conversion methods
take an optional format parameter for specifying an
unambiguous string format to use during conversion. A Converter class
must document the format classes it supports and must also accept a
null value for the format parameter,
in which case a suitable and well-documented default should be used.
Converters should support standard formats whenever possible.
Converters#getConverter| Method Summary | |
Object |
decode(String value,
Object format)
Converts the specified String value to an object that is an instance of the class associated with this converter instance. |
String |
encode(Object value,
Object format)
Converts the specified Object value to a string representation. |
| Method Detail |
public String encode(Object value,
Object format)
throws ConversionException
value - the object to be convertedformat - object containing string format information, or null
if format information is either not relevant or unspecified
ConversionException - if the conversion could not be performed
public Object decode(String value,
Object format)
throws ConversionException
value - String object to be convertedformat - object containing string format information, or null
if format information is either not relevant or unspecified
ConversionException - if the conversion could not be performed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||