| java.lang.Object org.apache.commons.beanutils.BeanUtilsBean org.apache.commons.beanutils.locale.LocaleBeanUtilsBean
LocaleBeanUtilsBean | public class LocaleBeanUtilsBean extends BeanUtilsBean (Code) | | Utility methods for populating JavaBeans properties
via reflection in a locale-dependent manner.
author: Craig R. McClanahan author: Ralph Schaer author: Chris Audley author: Rey Francois author: Gregor Rayman author: Yauheny Mikulski since: 1.7 |
Inner Class :protected class Descriptor | |
Method Summary | |
protected Descriptor | calculate(Object bean, String name) Resolve any nested expression to get the actual target property. | protected Object | convert(Class type, int index, Object value, String pattern) Convert the specified value to the required type using the
specified conversion pattern. | protected Object | convert(Class type, int index, Object value) Convert the specified value to the required type. | protected Class | definePropertyType(Object target, String name, String propName) Calculate the property type. | public boolean | getApplyLocalized() | public Locale | getDefaultLocale() | public String | getIndexedProperty(Object bean, String name, String pattern) Return the value of the specified locale-sensitive indexed property
of the specified bean, as a String. | public String | getIndexedProperty(Object bean, String name) Return the value of the specified locale-sensitive indexed property
of the specified bean, as a String using the default conversion pattern of
the corresponding
LocaleConverter . | public String | getIndexedProperty(Object bean, String name, int index, String pattern) Return the value of the specified locale-sensetive indexed property
of the specified bean, as a String using the specified conversion pattern. | public String | getIndexedProperty(Object bean, String name, int index) Return the value of the specified locale-sensetive indexed property
of the specified bean, as a String using the default conversion pattern of
the corresponding
LocaleConverter . | public static LocaleBeanUtilsBean | getLocaleBeanUtilsInstance() | public LocaleConvertUtilsBean | getLocaleConvertUtils() | public String | getMappedProperty(Object bean, String name, String key, String pattern) Return the value of the specified mapped locale-sensitive property
of the specified bean, as a String using the specified conversion pattern. | public String | getMappedProperty(Object bean, String name, String key) | public String | getMappedProperty(Object bean, String name) Return the value of the specified locale-sensitive mapped property
of the specified bean, as a String using the default
conversion pattern of the corresponding
LocaleConverter . | public String | getMappedPropertyLocale(Object bean, String name, String pattern) Return the value of the specified locale-sensitive mapped property
of the specified bean, as a String using the specified pattern. | public String | getNestedProperty(Object bean, String name, String pattern) Return the value of the (possibly nested) locale-sensitive property
of the specified name, for the specified bean,
as a String using the specified pattern. | public String | getNestedProperty(Object bean, String name) Return the value of the (possibly nested) locale-sensitive property
of the specified name, for the specified bean, as a String using the default
conversion pattern of the corresponding
LocaleConverter . | public String | getProperty(Object bean, String name, String pattern) Return the value of the specified locale-sensitive property
of the specified bean, no matter which property reference
format is used, as a String using the specified conversion pattern. | public String | getProperty(Object bean, String name) Return the value of the specified locale-sensitive property
of the specified bean, no matter which property reference
format is used, as a String using the default
conversion pattern of the corresponding
LocaleConverter . | public String | getSimpleProperty(Object bean, String name, String pattern) Return the value of the specified simple locale-sensitive property
of the specified bean, converted to a String using the specified
conversion pattern. | public String | getSimpleProperty(Object bean, String name) Return the value of the specified simple locale-sensitive property
of the specified bean, converted to a String using the default
conversion pattern of the corresponding
LocaleConverter . | protected void | invokeSetter(Object target, String propName, String key, int index, Object newValue) Invoke the setter method. | public void | setApplyLocalized(boolean newApplyLocalized) | public void | setDefaultLocale(Locale locale) Sets the default Locale. | public static void | setInstance(LocaleBeanUtilsBean newInstance) Sets the instance which provides the functionality for
LocaleBeanUtils . | public void | setProperty(Object bean, String name, Object value) Set the specified locale-sensitive property value, performing type
conversions as required to conform to the type of the destination property
using the default conversion pattern of the corresponding
LocaleConverter . | public void | setProperty(Object bean, String name, Object value, String pattern) Set the specified locale-sensitive property value, performing type
conversions as required to conform to the type of the destination
property using the specified conversion pattern. |
LocaleBeanUtilsBean | public LocaleBeanUtilsBean()(Code) | | Construct instance with standard conversion bean
|
LocaleBeanUtilsBean | public LocaleBeanUtilsBean(LocaleConvertUtilsBean localeConvertUtils, ConvertUtilsBean convertUtilsBean, PropertyUtilsBean propertyUtilsBean)(Code) | | Construct instance that uses given locale conversion
Parameters: localeConvertUtils - use this localeConvertUtils to performconversions Parameters: convertUtilsBean - use this for standard conversions Parameters: propertyUtilsBean - use this for property conversions |
LocaleBeanUtilsBean | public LocaleBeanUtilsBean(LocaleConvertUtilsBean localeConvertUtils)(Code) | | Construct instance that uses given locale conversion
Parameters: localeConvertUtils - use this localeConvertUtils to performconversions |
convert | protected Object convert(Class type, int index, Object value, String pattern)(Code) | | Convert the specified value to the required type using the
specified conversion pattern.
Parameters: type - The Java type of target property Parameters: index - The indexed subscript value (if any) Parameters: value - The value to be converted Parameters: pattern - The conversion pattern The converted value |
convert | protected Object convert(Class type, int index, Object value)(Code) | | Convert the specified value to the required type.
Parameters: type - The Java type of target property Parameters: index - The indexed subscript value (if any) Parameters: value - The value to be converted The converted value |
getApplyLocalized | public boolean getApplyLocalized()(Code) | | Is the pattern to be applied localized
(Indicate whether the pattern is localized or not)
true if pattern is localized,otherwise false |
getDefaultLocale | public Locale getDefaultLocale()(Code) | | Gets the default Locale
the default locale |
getIndexedProperty | public String getIndexedProperty(Object bean, String name, String pattern) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code) | | Return the value of the specified locale-sensitive indexed property
of the specified bean, as a String. The zero-relative index of the
required value must be included (in square brackets) as a suffix to
the property name, or IllegalArgumentException will be
thrown.
Parameters: bean - Bean whose property is to be extracted Parameters: name - propertyname[index] of the property valueto be extracted Parameters: pattern - The conversion pattern The indexed property's value, converted to a String exception: IllegalAccessException - if the caller does not haveaccess to the property accessor method exception: InvocationTargetException - if the property accessor methodthrows an exception exception: NoSuchMethodException - if an accessor method for thispropety cannot be found |
getIndexedProperty | public String getIndexedProperty(Object bean, String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code) | | Return the value of the specified locale-sensitive indexed property
of the specified bean, as a String using the default conversion pattern of
the corresponding
LocaleConverter . The zero-relative index
of the required value must be included (in square brackets) as a suffix
to the property name, or IllegalArgumentException will be thrown.
Parameters: bean - Bean whose property is to be extracted Parameters: name - propertyname[index] of the property valueto be extracted The indexed property's value, converted to a String exception: IllegalAccessException - if the caller does not haveaccess to the property accessor method exception: InvocationTargetException - if the property accessor methodthrows an exception exception: NoSuchMethodException - if an accessor method for thispropety cannot be found |
getIndexedProperty | public String getIndexedProperty(Object bean, String name, int index, String pattern) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code) | | Return the value of the specified locale-sensetive indexed property
of the specified bean, as a String using the specified conversion pattern.
The index is specified as a method parameter and
must *not* be included in the property name expression
Parameters: bean - Bean whose property is to be extracted Parameters: name - Simple property name of the property value to be extracted Parameters: index - Index of the property value to be extracted Parameters: pattern - The conversion pattern The indexed property's value, converted to a String exception: IllegalAccessException - if the caller does not haveaccess to the property accessor method exception: InvocationTargetException - if the property accessor methodthrows an exception exception: NoSuchMethodException - if an accessor method for thispropety cannot be found |
getIndexedProperty | public String getIndexedProperty(Object bean, String name, int index) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code) | | Return the value of the specified locale-sensetive indexed property
of the specified bean, as a String using the default conversion pattern of
the corresponding
LocaleConverter .
The index is specified as a method parameter and
must *not* be included in the property name expression
Parameters: bean - Bean whose property is to be extracted Parameters: name - Simple property name of the property value to be extracted Parameters: index - Index of the property value to be extracted The indexed property's value, converted to a String exception: IllegalAccessException - if the caller does not haveaccess to the property accessor method exception: InvocationTargetException - if the property accessor methodthrows an exception exception: NoSuchMethodException - if an accessor method for thispropety cannot be found |
getLocaleBeanUtilsInstance | public static LocaleBeanUtilsBean getLocaleBeanUtilsInstance()(Code) | | Gets singleton instance
the singleton instance |
getLocaleConvertUtils | public LocaleConvertUtilsBean getLocaleConvertUtils()(Code) | | Gets the bean instance used for conversions
the locale converter bean instance |
getMappedProperty | public String getMappedProperty(Object bean, String name, String key, String pattern) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code) | | Return the value of the specified mapped locale-sensitive property
of the specified bean, as a String using the specified conversion pattern.
The key is specified as a method parameter and must *not* be included in
the property name expression.
Parameters: bean - Bean whose property is to be extracted Parameters: name - Simple property name of the property value to be extracted Parameters: key - Lookup key of the property value to be extracted Parameters: pattern - The conversion pattern The mapped property's value, converted to a String exception: IllegalAccessException - if the caller does not haveaccess to the property accessor method exception: InvocationTargetException - if the property accessor methodthrows an exception exception: NoSuchMethodException - if an accessor method for thispropety cannot be found |
getMappedProperty | public String getMappedProperty(Object bean, String name, String key) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code) | | Return the value of the specified mapped locale-sensitive property
of the specified bean, as a String
The key is specified as a method parameter and must *not* be included
in the property name expression
Parameters: bean - Bean whose property is to be extracted Parameters: name - Simple property name of the property value to be extracted Parameters: key - Lookup key of the property value to be extracted The mapped property's value, converted to a String exception: IllegalAccessException - if the caller does not haveaccess to the property accessor method exception: InvocationTargetException - if the property accessor methodthrows an exception exception: NoSuchMethodException - if an accessor method for thispropety cannot be found |
getMappedProperty | public String getMappedProperty(Object bean, String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code) | | Return the value of the specified locale-sensitive mapped property
of the specified bean, as a String using the default
conversion pattern of the corresponding
LocaleConverter .
The String-valued key of the required value
must be included (in parentheses) as a suffix to
the property name, or IllegalArgumentException will be
thrown.
Parameters: bean - Bean whose property is to be extracted Parameters: name - propertyname(index) of the property valueto be extracted The mapped property's value, converted to a String exception: IllegalAccessException - if the caller does not haveaccess to the property accessor method exception: InvocationTargetException - if the property accessor methodthrows an exception exception: NoSuchMethodException - if an accessor method for thispropety cannot be found |
getMappedPropertyLocale | public String getMappedPropertyLocale(Object bean, String name, String pattern) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code) | | Return the value of the specified locale-sensitive mapped property
of the specified bean, as a String using the specified pattern.
The String-valued key of the required value
must be included (in parentheses) as a suffix to
the property name, or IllegalArgumentException will be
thrown.
Parameters: bean - Bean whose property is to be extracted Parameters: name - propertyname(index) of the property valueto be extracted Parameters: pattern - The conversion pattern The mapped property's value, converted to a String exception: IllegalAccessException - if the caller does not haveaccess to the property accessor method exception: InvocationTargetException - if the property accessor methodthrows an exception exception: NoSuchMethodException - if an accessor method for thispropety cannot be found |
getProperty | public String getProperty(Object bean, String name, String pattern) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code) | | Return the value of the specified locale-sensitive property
of the specified bean, no matter which property reference
format is used, as a String using the specified conversion pattern.
Parameters: bean - Bean whose property is to be extracted Parameters: name - Possibly indexed and/or nested name of the propertyto be extracted Parameters: pattern - The conversion pattern The nested property's value, converted to a String exception: IllegalAccessException - if the caller does not haveaccess to the property accessor method exception: InvocationTargetException - if the property accessor methodthrows an exception exception: NoSuchMethodException - if an accessor method for thispropety cannot be found |
invokeSetter | protected void invokeSetter(Object target, String propName, String key, int index, Object newValue) throws IllegalAccessException, InvocationTargetException(Code) | | Invoke the setter method.
Parameters: target - The bean Parameters: propName - The Simple name of target property Parameters: key - The Mapped key value (if any) Parameters: index - The indexed subscript value (if any) Parameters: newValue - The value to be set exception: IllegalAccessException - if the caller does not haveaccess to the property accessor method exception: InvocationTargetException - if the property accessor methodthrows an exception |
setApplyLocalized | public void setApplyLocalized(boolean newApplyLocalized)(Code) | | Sets whether the pattern is applied localized
(Indicate whether the pattern is localized or not)
Parameters: newApplyLocalized - true if pattern is localized,otherwise false |
setDefaultLocale | public void setDefaultLocale(Locale locale)(Code) | | Sets the default Locale.
Parameters: locale - the default locale |
setInstance | public static void setInstance(LocaleBeanUtilsBean newInstance)(Code) | | Sets the instance which provides the functionality for
LocaleBeanUtils .
This is a pseudo-singleton - an single instance is provided per (thread) context classloader.
This mechanism provides isolation for web apps deployed in the same container.
Parameters: newInstance - a new singleton instance |
setProperty | public void setProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException(Code) | | Set the specified locale-sensitive property value, performing type
conversions as required to conform to the type of the destination property
using the default conversion pattern of the corresponding
LocaleConverter .
Parameters: bean - Bean on which setting is to be performed Parameters: name - Property name (can be nested/indexed/mapped/combo) Parameters: value - Value to be set exception: IllegalAccessException - if the caller does not haveaccess to the property accessor method exception: InvocationTargetException - if the property accessor methodthrows an exception |
setProperty | public void setProperty(Object bean, String name, Object value, String pattern) throws IllegalAccessException, InvocationTargetException(Code) | | Set the specified locale-sensitive property value, performing type
conversions as required to conform to the type of the destination
property using the specified conversion pattern.
Parameters: bean - Bean on which setting is to be performed Parameters: name - Property name (can be nested/indexed/mapped/combo) Parameters: value - Value to be set Parameters: pattern - The conversion pattern exception: IllegalAccessException - if the caller does not haveaccess to the property accessor method exception: InvocationTargetException - if the property accessor methodthrows an exception |
Methods inherited from org.apache.commons.beanutils.BeanUtilsBean | public Object cloneBean(Object bean) throws IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException(Code)(Java Doc) protected Object convert(Object value, Class type)(Code)(Java Doc) public void copyProperties(Object dest, Object orig) throws IllegalAccessException, InvocationTargetException(Code)(Java Doc) public void copyProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException(Code)(Java Doc) public Map describe(Object bean) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code)(Java Doc) public String[] getArrayProperty(Object bean, String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code)(Java Doc) public ConvertUtilsBean getConvertUtils()(Code)(Java Doc) public String getIndexedProperty(Object bean, String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code)(Java Doc) public String getIndexedProperty(Object bean, String name, int index) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code)(Java Doc) public static BeanUtilsBean getInstance()(Code)(Java Doc) public String getMappedProperty(Object bean, String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code)(Java Doc) public String getMappedProperty(Object bean, String name, String key) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code)(Java Doc) public String getNestedProperty(Object bean, String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code)(Java Doc) public String getProperty(Object bean, String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code)(Java Doc) public PropertyUtilsBean getPropertyUtils()(Code)(Java Doc) public String getSimpleProperty(Object bean, String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code)(Java Doc) public boolean initCause(Throwable throwable, Throwable cause)(Code)(Java Doc) public void populate(Object bean, Map properties) throws IllegalAccessException, InvocationTargetException(Code)(Java Doc) public static void setInstance(BeanUtilsBean newInstance)(Code)(Java Doc) public void setProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException(Code)(Java Doc)
|
|
|