org.norther.tammi.core.converter
Class DefaultNumberConverter

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.core.converter.DefaultObjectConverter
          extended by org.norther.tammi.core.converter.DefaultNumberConverter
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Manageable, MBeanDelegate, NumberConverter, ObjectConverter

public class DefaultNumberConverter
extends DefaultObjectConverter
implements NumberConverter

A default implementation of NumberConverter.

Author:
Marketta Priha
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Fields inherited from interface org.norther.tammi.core.converter.NumberConverter
CURRENCY, CURRENCY_IN_CENTS, DEFAULT, INTEGER, NUMBER, PERCENT
 
Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE
 
Constructor Summary
DefaultNumberConverter()
          Constructs a new converter.
 
Method Summary
 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.
 NumberFormat getNumberFormat(String pattern)
          Gets a number format for the specified pattern.
 NumberFormat getNumberFormat(String pattern, Locale locale)
          Gets a number format for the specified pattern and locale.
 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.
 
Methods inherited from class org.norther.tammi.core.converter.DefaultObjectConverter
fromLocalizedObject, getComponentInstance, getFormatPattern, getInstance, getLocalizedPattern, getResourceFinderName, isConversionSupported, postmanaged, setResourceFinderName, toComponentString, toLocalizedObject, toString, toStrings, toStrings, toStrings, unmanaged
 
Methods inherited from class org.norther.tammi.core.base.Adaptee
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.core.converter.ObjectConverter
getFormatPattern, getInstance, getLocalizedPattern, getResourceFinderName, isConversionSupported, setResourceFinderName, toString, toStrings, toStrings, toStrings
 

Constructor Detail

DefaultNumberConverter

public DefaultNumberConverter()
Constructs a new converter.

Method Detail

getNumberFormat

public NumberFormat getNumberFormat(String pattern)
Description copied from interface: NumberConverter
Gets a number format for the specified pattern.

Specified by:
getNumberFormat in interface NumberConverter
Parameters:
pattern - the pattern.
Returns:
the requested number format.
See Also:
NumberFormat, DecimalFormat

getNumberFormat

public NumberFormat getNumberFormat(String pattern,
                                    Locale locale)
Description copied from interface: NumberConverter
Gets a number format for the specified pattern and locale.

Specified by:
getNumberFormat in interface NumberConverter
Parameters:
pattern - the pattern.
locale - the locale.
Returns:
the requested number format.
See Also:
NumberFormat, DecimalFormat

getInstance

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

Specified by:
getInstance in interface ObjectConverter
Overrides:
getInstance in class DefaultObjectConverter
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

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

Specified by:
getInstance in interface ObjectConverter
Overrides:
getInstance in class DefaultObjectConverter
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

public String toString(String className,
                       Object object,
                       String pattern)
Description copied from interface: ObjectConverter
Returns a string representation of an object of the named class by optionally applying the specified pattern.

Specified by:
toString in interface ObjectConverter
Overrides:
toString in class DefaultObjectConverter
Parameters:
className - the name of the class.
object - the source object.
pattern - an optional conversion pattern.
Returns:
the string representation.

toString

public String toString(String className,
                       Object object,
                       String pattern,
                       Locale locale,
                       ResourceBundle bundle)
Description copied from interface: ObjectConverter
Returns a localized resource of the named class by optionally applying the specified pattern.

Specified by:
toString in interface ObjectConverter
Overrides:
toString in class DefaultObjectConverter
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.


Copyright © 2004 The Norther Organization. All rights reserved.