Interface Convertor

All Known Implementing Classes:
BeanConvertor, CharConvertor, DummyStringConvertor, EnumConvertor, FormattingDateConvertor, FormattingDecimalConvertor, HtmlCleaningConvertor, Icu4jDateConvertor, MillisDateConvertor, PlainBooleanConvertor, PlainDecimalConvertor, PlainDoubleConvertor, PlainFloatConvertor, PlainIntegerConvertor, PlainLongConvertor

public interface Convertor

The purpose of a Convertor is to convert between Object and String representations of the same thing. For example, convert Longs or Dates to strings, and vice versa. The behaviour of this conversion process can depend on the user's Locale.

If you need to do mass conversion of a lot of values, it may be beneficial to pass a Convertor.FormatCache object to the convert methods. Some convertors need to build and configure parser or formatting objects, which can be expensive if it needs to be done repeatedly.

$Id: Convertor.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Nested Class Summary
static interface Convertor.FormatCache
Method Summary
 ConversionResult convertFromString(String value, Locale locale, Convertor.FormatCache formatCache)
          Converts string representation into the object of convertor's type.
 String convertToString(Object value, Locale locale, Convertor.FormatCache formatCache)
 void generateSaxFragment(ContentHandler contentHandler, Locale locale)
          Generates a bit of information about this convertor (optional).
 Class getTypeClass()

Method Detail


public ConversionResult convertFromString(String value,
                                          Locale locale,
                                          Convertor.FormatCache formatCache)
Converts string representation into the object of convertor's type.

formatCache - can be null if not needed


public String convertToString(Object value,
                              Locale locale,
                              Convertor.FormatCache formatCache)


public Class getTypeClass()


public void generateSaxFragment(ContentHandler contentHandler,
                                Locale locale)
                         throws SAXException
Generates a bit of information about this convertor (optional).


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.