|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Converter
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.get(java.lang.Class)
Method Summary | |
---|---|
java.lang.Object |
decode(java.lang.String value,
java.lang.Object format)
Converts the specified String value to an object that is an instance of the class associated with this converter instance. |
java.lang.String |
encode(java.lang.Object value,
java.lang.Object format)
Converts the specified Object value to a string representation. |
Method Detail |
---|
java.lang.String encode(java.lang.Object value, java.lang.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 performedjava.lang.Object decode(java.lang.String value, java.lang.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 |