Interface Convertor

All Known Implementing Classes:
DummyStringConvertor, EnumConvertor, FormattingDateConvertor, FormattingDecimalConvertor, FormattingFloatConvertor, FormattingIntegerConvertor, FormattingLongConvertor, MillisDateConvertor, PlainBooleanConvertor, PlainDecimalConvertor, 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.

CVS $Id: Convertor.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Nested Class Summary
static interface Convertor.FormatCache
Method Summary
 Object 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)
 Class getTypeClass()

Method Detail


Object convertFromString(String value,
                         Locale locale,
                         Convertor.FormatCache formatCache)
Converts string representation into the object of convertor's type. Returns null if conversion fails.

formatCache - can be null if not needed


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


Class getTypeClass()

Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.