org.norther.tammi.core.converter
Interface ObjectConverter

All Known Subinterfaces:
ConfigurableConverter, Converter, DateConverter, NumberConverter, VariableConverter
All Known Implementing Classes:
DefaultConfigurableConverter, DefaultConverter, DefaultDateConverter, DefaultIdentityConverter, DefaultInternetAddressConverter, DefaultNumberConverter, DefaultObjectConverter, DefaultObjectNameConverter, DefaultPermissionConverter, DefaultVariableConverter

public interface ObjectConverter

An interface to object converters providing a set of conversion methods required by registration to Converter.

Author:
Ilkka Priha

Method Summary
 String getFormatPattern(String className, String pattern, Locale locale)
          Gets the format pattern.
 Object getInstance(String className, Object object, String pattern, Object minValue, Object maxValue)
          Gets an instance of the named class by converting the source object and optionally applying the specified pattern and limits.
 Object getInstance(String className, Object object, String pattern, Object minValue, Object maxValue, Locale locale, ResourceBundle bundle)
          Gets an instance of the named class by converting the localized source resource and optionally applying the specified pattern and limits.
 Object getInstance(String className, Object object, String pattern, Object minValue, Object maxValue, String baseName, Locale locale)
          Gets an instance of the named class by converting the localized source object and optionally applying the specified pattern and limits.
 String getLocalizedPattern(String className, String pattern, Locale locale)
          Gets the localized format pattern.
 ObjectName getResourceFinderName()
          Gets the the resource finder of this converter.
 boolean isConversionSupported(String className)
          Checks whether conversion of the specified class is supported.
 void setResourceFinderName(ObjectName finder)
          Sets the resource finder of this converter.
 String toString(String className, Object object, String pattern)
          Returns a string representation of an object of the named class by optionally applying the specified pattern.
 String toString(String className, Object object, String pattern, Locale locale, ResourceBundle bundle)
          Returns a localized resource of the named class by optionally applying the specified pattern.
 String toString(String className, Object object, String pattern, String baseName, Locale locale)
          Returns a localized string representation of an object of the named class by optionally applying the specified pattern.
 String[] toStrings(String className, Object object, String pattern)
          Returns a string representation of an array object of the named class by optionally applying the specified pattern.
 String[] toStrings(String className, Object object, String pattern, Locale locale, ResourceBundle bundle)
          Returns a localized resource of the named class by optionally applying the specified pattern.
 String[] toStrings(String className, Object object, String pattern, String baseName, Locale locale)
          Returns a localized string representation of an object of the named class by optionally applying the specified pattern.
 

Method Detail

getInstance

Object getInstance(String className,
                   Object object,
                   String pattern,
                   Object minValue,
                   Object maxValue)
                   throws ConversionException
Gets an instance of the named class by converting the source object and optionally applying the specified pattern and limits.

Parameters:
className - the name of the class.
object - the source object.
pattern - an optional conversion pattern.
minValue - an optional minimum value.
maxValue - an optional maximum value.
Returns:
the instance.
Throws:
ConversionException - if conversion fails.

getInstance

Object getInstance(String className,
                   Object object,
                   String pattern,
                   Object minValue,
                   Object maxValue,
                   String baseName,
                   Locale locale)
                   throws ConversionException
Gets an instance of the named class by converting the localized source object and optionally applying the specified pattern and limits.

Parameters:
className - the name of the class.
object - the source object.
pattern - an optional conversion pattern.
minValue - an optional minimum value.
maxValue - an optional maximum value.
baseName - the base name of the resource bundle.
locale - the optional locale of the source object.
Returns:
the instance.
Throws:
ConversionException - if conversion fails.

getInstance

Object getInstance(String className,
                   Object object,
                   String pattern,
                   Object minValue,
                   Object maxValue,
                   Locale locale,
                   ResourceBundle bundle)
                   throws ConversionException
Gets an instance of the named class by converting the localized source resource and optionally applying the specified pattern and limits.

Parameters:
className - the name of the class.
object - the source object.
pattern - an optional conversion pattern.
minValue - an optional minimum value.
maxValue - an optional maximum value.
locale - the locale of the source object.
bundle - the resource bundle to apply.
Returns:
the instance.
Throws:
ConversionException - if conversion fails.

toString

String toString(String className,
                Object object,
                String pattern)
Returns a string representation of an object of the named class by optionally applying the specified pattern.

Parameters:
className - the name of the class.
object - the source object.
pattern - an optional conversion pattern.
Returns:
the string representation.

toString

String toString(String className,
                Object object,
                String pattern,
                String baseName,
                Locale locale)
Returns a localized string representation of an object of the named class by optionally applying the specified pattern.

Parameters:
className - the name of the class.
object - the source object.
pattern - the conversion pattern.
baseName - the base name of the resource bundle.
locale - the optional locale of the result.
Returns:
the string representation.

toString

String toString(String className,
                Object object,
                String pattern,
                Locale locale,
                ResourceBundle bundle)
Returns a localized resource of the named class by optionally applying the specified pattern.

Parameters:
className - the name of the class.
object - the source object.
pattern - the conversion pattern.
locale - the optional locale of the result.
bundle - the resource bundle to apply.
Returns:
the string resource.

toStrings

String[] toStrings(String className,
                   Object object,
                   String pattern)
Returns a string representation of an array object of the named class by optionally applying the specified pattern.

Parameters:
className - the name of the class.
object - the source object.
pattern - an optional conversion pattern.
Returns:
the string representation.

toStrings

String[] toStrings(String className,
                   Object object,
                   String pattern,
                   String baseName,
                   Locale locale)
Returns a localized string representation of an object of the named class by optionally applying the specified pattern.

Parameters:
className - the name of the class.
object - the source object.
pattern - the conversion pattern.
baseName - the base name of the resource bundle.
locale - the optional locale of the result.
Returns:
the string representation.

toStrings

String[] toStrings(String className,
                   Object object,
                   String pattern,
                   Locale locale,
                   ResourceBundle bundle)
Returns a localized resource of the named class by optionally applying the specified pattern.

Parameters:
className - the name of the class.
object - the source object.
pattern - the conversion pattern.
locale - the optional locale of the result.
bundle - the resource bundle to apply.
Returns:
the string resource.

isConversionSupported

boolean isConversionSupported(String className)
Checks whether conversion of the specified class is supported.

Parameters:
className - the class name.
Returns:
true for a supported conversion, false otherwise.

getFormatPattern

String getFormatPattern(String className,
                        String pattern,
                        Locale locale)
Gets the format pattern.

Parameters:
className - the class name.
pattern - the conversion pattern.
locale - an optional locale to apply.
Returns:
the format pattern or the conversion pattern if the same.

getLocalizedPattern

String getLocalizedPattern(String className,
                           String pattern,
                           Locale locale)
Gets the localized format pattern.

Parameters:
className - the class name.
pattern - the conversion pattern.
locale - an optional locale to apply.
Returns:
the localized pattern or the conversion pattern if the same.

getResourceFinderName

ObjectName getResourceFinderName()
Gets the the resource finder of this converter.

Returns:
the object name of the resource finder or a query.

setResourceFinderName

void setResourceFinderName(ObjectName finder)
Sets the resource finder of this converter. If it is not set, the default one will be used.

Parameters:
finder - the object name of the resource finder or a query.


Copyright © 2004 The Norther Organization. All rights reserved.