|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.core.base.Adaptee
org.norther.tammi.core.converter.DefaultObjectConverter
public class DefaultObjectConverter
A default implementation of ObjectConverter acting also as an adapter to class specific implementations.
This implementation provides conversions between strings and Java base types. For more complicated cases, subclasses must implement specific conversion methods.
| 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.base.MBeanDelegate |
|---|
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE |
| Constructor Summary | |
|---|---|
DefaultObjectConverter()
Constructs a new converter. |
|
DefaultObjectConverter(ObjectConverter adaptee)
Constructs a new converter adapter. |
|
| Method Summary | |
|---|---|
protected Object |
fromLocalizedObject(String className,
Object object,
String pattern,
Locale locale,
ResourceBundle bundle)
Returns a non-localized source object to be applied in type conversion. |
protected Object |
getComponentInstance(String className,
Object object,
String pattern,
Object minValue,
Object maxValue)
Gets an instance of the named component class by converting the source object and optionally applying the specified pattern and limits. |
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 |
postmanaged()
This method is called when the implementing adaptee has been managed either during post-registration of the corresponding adapter MBean or just after it is explicitly added to the adapter MBean during run-time. |
void |
setResourceFinderName(ObjectName finder)
Sets the resource finder of this converter. |
protected String |
toComponentString(String className,
Object object,
String pattern)
Returns a string representation of an object of the named component class by optionally applying the specified pattern. |
protected String |
toLocalizedObject(String className,
String object,
String pattern,
Locale locale,
ResourceBundle bundle)
Returns a localized source object to be applied after type conversion. |
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. |
void |
unmanaged()
This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time. |
| 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 |
| Constructor Detail |
|---|
public DefaultObjectConverter()
public DefaultObjectConverter(ObjectConverter adaptee)
adaptee - the adaptee.| Method Detail |
|---|
public void postmanaged()
Manageable
postmanaged in interface Manageablepostmanaged in class Adaptee
public void unmanaged()
throws Exception
Manageable
unmanaged in interface Manageableunmanaged in class AdapteeException - if the adaptee refused to be unmanaged.
public Object getInstance(String className,
Object object,
String pattern,
Object minValue,
Object maxValue)
throws ConversionException
ObjectConverter
getInstance in interface ObjectConverterclassName - the name of the class.object - the source object.pattern - an optional conversion pattern.minValue - an optional minimum value.maxValue - an optional maximum value.
ConversionException - if conversion fails.
public Object getInstance(String className,
Object object,
String pattern,
Object minValue,
Object maxValue,
String baseName,
Locale locale)
throws ConversionException
ObjectConverter
getInstance in interface ObjectConverterclassName - 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.
ConversionException - if conversion fails.
public Object getInstance(String className,
Object object,
String pattern,
Object minValue,
Object maxValue,
Locale locale,
ResourceBundle bundle)
throws ConversionException
ObjectConverter
getInstance in interface ObjectConverterclassName - 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.
ConversionException - if conversion fails.
public String toString(String className,
Object object,
String pattern)
ObjectConverter
toString in interface ObjectConverterclassName - the name of the class.object - the source object.pattern - an optional conversion pattern.
public String toString(String className,
Object object,
String pattern,
String baseName,
Locale locale)
ObjectConverter
toString in interface ObjectConverterclassName - 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.
public String toString(String className,
Object object,
String pattern,
Locale locale,
ResourceBundle bundle)
ObjectConverter
toString in interface ObjectConverterclassName - 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.
public String[] toStrings(String className,
Object object,
String pattern)
ObjectConverter
toStrings in interface ObjectConverterclassName - the name of the class.object - the source object.pattern - an optional conversion pattern.
public String[] toStrings(String className,
Object object,
String pattern,
String baseName,
Locale locale)
ObjectConverter
toStrings in interface ObjectConverterclassName - 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.
public String[] toStrings(String className,
Object object,
String pattern,
Locale locale,
ResourceBundle bundle)
ObjectConverter
toStrings in interface ObjectConverterclassName - 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.
public boolean isConversionSupported(String className)
ObjectConverter
isConversionSupported in interface ObjectConverterclassName - the class name.
public String getFormatPattern(String className,
String pattern,
Locale locale)
ObjectConverter
getFormatPattern in interface ObjectConverterclassName - the class name.pattern - the conversion pattern.locale - an optional locale to apply.
public String getLocalizedPattern(String className,
String pattern,
Locale locale)
ObjectConverter
getLocalizedPattern in interface ObjectConverterclassName - the class name.pattern - the conversion pattern.locale - an optional locale to apply.
public ObjectName getResourceFinderName()
ObjectConverter
getResourceFinderName in interface ObjectConverterpublic void setResourceFinderName(ObjectName finder)
ObjectConverter
setResourceFinderName in interface ObjectConverterfinder - the object name of the resource finder or a query.
protected Object fromLocalizedObject(String className,
Object object,
String pattern,
Locale locale,
ResourceBundle bundle)
className - the name of the class.object - the source object.pattern - an optional conversion pattern.locale - the locale of the source object.bundle - the resource bundle if available.
protected String toLocalizedObject(String className,
String object,
String pattern,
Locale locale,
ResourceBundle bundle)
className - the name of the class.object - the source object.pattern - an optional conversion pattern.locale - the locale of the source object.bundle - the resource bundle if available.
protected Object getComponentInstance(String className,
Object object,
String pattern,
Object minValue,
Object maxValue)
throws ConversionException
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.
ConversionException - if conversion fails.
protected String toComponentString(String className,
Object object,
String pattern)
className - the name of the class.object - the source object.pattern - an optional conversion pattern.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||