org.apache.commons.convert
Interface LocalizedConverter<S,T>

All Superinterfaces:
Converter<S,T>
All Known Implementing Classes:
AbstractLocalizedConverter, DateTimeConverters.CalendarToString, DateTimeConverters.DateToCalendar, DateTimeConverters.DateToString, DateTimeConverters.GenericLocalizedConverter, DateTimeConverters.LongToCalendar, DateTimeConverters.SqlDateToString, DateTimeConverters.SqlTimeToString, DateTimeConverters.StringToCalendar, DateTimeConverters.StringToDate, DateTimeConverters.StringToSqlDate, DateTimeConverters.StringToSqlTime, DateTimeConverters.StringToTimestamp, DateTimeConverters.TimestampToString, NumberConverters.AbstractNumberToStringConverter, NumberConverters.AbstractStringToNumberConverter, NumberConverters.BigDecimalToString, NumberConverters.BigIntegerToString, NumberConverters.ByteToString, NumberConverters.DoubleToString, NumberConverters.FloatToString, NumberConverters.IntegerToString, NumberConverters.LongToString, NumberConverters.ShortToString, NumberConverters.StringToBigDecimal, NumberConverters.StringToBigInteger, NumberConverters.StringToDouble, NumberConverters.StringToFloat, NumberConverters.StringToInteger, NumberConverters.StringToLong

public interface LocalizedConverter<S,T>
extends Converter<S,T>

Localized converter interface. Classes implement this interface to convert one object type to another. Methods are provided to localize the conversion.

Localized converters are necessary for things like dates, times, and numbers. Those conversions are dependent on a locale and/or time zone. Java's default conversions (toString, valueOf) use the JVM's default locale and time zone - which might not be what the application requires. Implementations of LocalizedConverter will use the specified locale and time zone instead of the JVM defaults.


Method Summary
 T convert(S obj, Locale locale, TimeZone timeZone)
          Converts obj to T.
 T convert(S obj, Locale locale, TimeZone timeZone, String formatString)
          Converts obj to T.
 
Methods inherited from interface org.apache.commons.convert.Converter
canConvert, convert, getSourceClass, getTargetClass
 

Method Detail

convert

T convert(S obj,
          Locale locale,
          TimeZone timeZone)
          throws ConversionException
Converts obj to T.

Parameters:
obj - The source Object to convert
locale - The locale used for conversion - must not be null
timeZone - The time zone used for conversion - must not be null
Returns:
The converted Object
Throws:
ConversionException

convert

T convert(S obj,
          Locale locale,
          TimeZone timeZone,
          String formatString)
          throws ConversionException
Converts obj to T.

Parameters:
obj - The source Object to convert
locale - The locale used for conversion - must not be null
timeZone - The time zone used for conversion - must not be null
formatString - Optional formatting string
Returns:
The converted Object
Throws:
ConversionException


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.