|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lumis.util.converter.AbstractConverter
@StableMinor(version="5.5", sinceVersion="4.0") public abstract class AbstractConverter
This is a abstract converter where a default locale and pattern may be specified and has fallback conversion capability.
If the convertion implementation does not support the requested type, this
converter falls back to try to convert using
ConvertUtil.convert(Class, Object, Locale, String)
.
Constructor Summary | |
---|---|
AbstractConverter()
|
Method Summary | ||
---|---|---|
|
convert(Class<T> type,
Object value)
Converts the specified input object into an output object of the specified type. |
|
|
convert(Class<T> type,
Object value,
Locale locale)
Converts the specified input object into an output object of the specified type. |
|
|
convert(Class<T> type,
Object value,
Locale locale,
String pattern)
Converts the specified input object into an output object of the specified type. |
|
protected abstract
|
doConversion(Class<T> type,
Object value,
Locale locale,
String pattern)
Converts the specified input object into an output object of the specified type. |
|
protected boolean |
doesNullValueReturnNull()
|
|
protected boolean |
doesValueInstanceOfTypeReturnValue()
|
|
Locale |
getDefaultLocale()
|
|
String |
getDefaultPattern()
|
|
void |
setDefaultLocale(Locale defaultLocale)
|
|
void |
setDefaultPattern(String defaultPattern)
|
|
protected void |
setFallbackToRegisteredConverters(boolean fallbackToRegisteredConverters)
Sets if the registered converters should be tried if this converter does not know how to complete the conversion. |
|
protected boolean |
shouldFallbackToRegisteredConverters()
Indicates if the registered converters should be tried if this converter does not know how to complete the conversion. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractConverter()
Method Detail |
---|
public Locale getDefaultLocale()
public void setDefaultLocale(Locale defaultLocale)
public String getDefaultPattern()
public void setDefaultPattern(String defaultPattern)
protected boolean doesNullValueReturnNull()
protected boolean doesValueInstanceOfTypeReturnValue()
protected boolean shouldFallbackToRegisteredConverters()
protected void setFallbackToRegisteredConverters(boolean fallbackToRegisteredConverters)
Note that if this property is set to false
, it is important
not to fallback to the registered converters, since it may cause
an infinite loop.
fallbackToRegisteredConverters
- the value to set.protected abstract <T> T doConversion(Class<T> type, Object value, Locale locale, String pattern) throws UnsupportedConversionTypeException
T
- generics support for the data type specified.type
- data type to which the value should be converted.value
- the input value to be converted.locale
- locale to be used during conversion, if necessary.pattern
- converter specific conversion pattern, to be used during conversion, if necessary.
UnsupportedConversionTypeException
- if this converter does not supports converting to the specified type.public <T> T convert(Class<T> type, Object value, Locale locale, String pattern)
IConverter
convert
in interface IConverter
T
- generics support for the data type specified.type
- data type to which the value should be converted.value
- the input value to be converted.locale
- locale to be used during conversion, if necessary.pattern
- converter specific conversion pattern, to be used during conversion, if necessary.public <T> T convert(Class<T> type, Object value, Locale locale)
IConverter
convert
in interface IConverter
T
- generics support for the data type specified.type
- data type to which the value should be converted.value
- the input value to be converted.locale
- locale to be used during conversionpublic <T> T convert(Class<T> type, Object value)
IConverter
convert
in interface IConverter
T
- generics support for the data type specified.type
- data type to which the value should be converted.value
- the input value to be converted.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |