org.apache.cocoon.forms.datatype.convertor
Interface Convertor

All Known Implementing Classes:
BeanConvertor, 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.

Version:
$Id: Convertor.java 151179 2005-02-03 16:55:16Z tim $

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

convertFromString

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

Parameters:
formatCache - can be null if not needed

convertToString

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

getTypeClass

public Class getTypeClass()

generateSaxFragment

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

Throws:
SAXException


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.