|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.beanutils.BeanUtilsBean
org.apache.commons.beanutils.locale.LocaleBeanUtilsBean
public class LocaleBeanUtilsBean
Utility methods for populating JavaBeans properties via reflection in a locale-dependent manner.
| Nested Class Summary | |
|---|---|
protected class |
LocaleBeanUtilsBean.Descriptor
Deprecated. Property name expressions are now processed by the configured Resolver implementation and this class
is no longer used by BeanUtils. |
| Constructor Summary | |
|---|---|
LocaleBeanUtilsBean()
Construct instance with standard conversion bean |
|
LocaleBeanUtilsBean(LocaleConvertUtilsBean localeConvertUtils)
Construct instance that uses given locale conversion |
|
LocaleBeanUtilsBean(LocaleConvertUtilsBean localeConvertUtils,
ConvertUtilsBean convertUtilsBean,
PropertyUtilsBean propertyUtilsBean)
Construct instance that uses given locale conversion |
|
| Method Summary | |
|---|---|
protected LocaleBeanUtilsBean.Descriptor |
calculate(Object bean,
String name)
Deprecated. Property name expressions are now processed by the configured Resolver implementation and this method
is no longer used by BeanUtils. |
protected Object |
convert(Class type,
int index,
Object value)
Convert the specified value to the required type. |
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 Class |
definePropertyType(Object target,
String name,
String propName)
Calculate the property type. |
boolean |
getApplyLocalized()
Is the pattern to be applied localized (Indicate whether the pattern is localized or not) |
Locale |
getDefaultLocale()
Gets the default Locale |
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. |
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. |
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. |
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. |
static LocaleBeanUtilsBean |
getLocaleBeanUtilsInstance()
Gets singleton instance |
LocaleConvertUtilsBean |
getLocaleConvertUtils()
Gets the bean instance used for conversions |
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. |
String |
getMappedProperty(Object bean,
String name,
String key)
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 |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
protected void |
invokeSetter(Object target,
String propName,
String key,
int index,
Object newValue)
Invoke the setter method. |
void |
setApplyLocalized(boolean newApplyLocalized)
Sets whether the pattern is applied localized (Indicate whether the pattern is localized or not) |
void |
setDefaultLocale(Locale locale)
Sets the default Locale. |
static void |
setInstance(LocaleBeanUtilsBean newInstance)
Sets the instance which provides the functionality for LocaleBeanUtils. |
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. |
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. |
| Methods inherited from class org.apache.commons.beanutils.BeanUtilsBean |
|---|
cloneBean, convert, copyProperties, copyProperty, describe, getArrayProperty, getConvertUtils, getInstance, getPropertyUtils, initCause, populate, setInstance |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LocaleBeanUtilsBean()
public LocaleBeanUtilsBean(LocaleConvertUtilsBean localeConvertUtils,
ConvertUtilsBean convertUtilsBean,
PropertyUtilsBean propertyUtilsBean)
localeConvertUtils - use this localeConvertUtils to perform
conversionsconvertUtilsBean - use this for standard conversionspropertyUtilsBean - use this for property conversionspublic LocaleBeanUtilsBean(LocaleConvertUtilsBean localeConvertUtils)
localeConvertUtils - use this localeConvertUtils to perform
conversions| Method Detail |
|---|
public static LocaleBeanUtilsBean getLocaleBeanUtilsInstance()
public static void setInstance(LocaleBeanUtilsBean newInstance)
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.
newInstance - a new singleton instancepublic LocaleConvertUtilsBean getLocaleConvertUtils()
public Locale getDefaultLocale()
public void setDefaultLocale(Locale locale)
locale - the default localepublic boolean getApplyLocalized()
true if pattern is localized,
otherwise falsepublic void setApplyLocalized(boolean newApplyLocalized)
newApplyLocalized - true if pattern is localized,
otherwise false
public String getIndexedProperty(Object bean,
String name,
String pattern)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
IllegalArgumentException will be
thrown.
bean - Bean whose property is to be extractedname - propertyname[index] of the property value
to be extractedpattern - The conversion pattern
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
NoSuchMethodException - if an accessor method for this
propety cannot be found
public String getIndexedProperty(Object bean,
String name)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
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.
getIndexedProperty in class BeanUtilsBeanbean - Bean whose property is to be extractedname - propertyname[index] of the property value
to be extracted
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
NoSuchMethodException - if an accessor method for this
propety cannot be found
public String getIndexedProperty(Object bean,
String name,
int index,
String pattern)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
bean - Bean whose property is to be extractedname - Simple property name of the property value to be extractedindex - Index of the property value to be extractedpattern - The conversion pattern
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
NoSuchMethodException - if an accessor method for this
propety cannot be found
public String getIndexedProperty(Object bean,
String name,
int index)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
LocaleConverter.
The index is specified as a method parameter and
must *not* be included in the property name expression
getIndexedProperty in class BeanUtilsBeanbean - Bean whose property is to be extractedname - Simple property name of the property value to be extractedindex - Index of the property value to be extracted
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
NoSuchMethodException - if an accessor method for this
propety cannot be found
public String getSimpleProperty(Object bean,
String name,
String pattern)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
bean - Bean whose property is to be extractedname - Name of the property to be extractedpattern - The conversion pattern
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
NoSuchMethodException - if an accessor method for this
propety cannot be found
public String getSimpleProperty(Object bean,
String name)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
LocaleConverter.
getSimpleProperty in class BeanUtilsBeanbean - Bean whose property is to be extractedname - Name of the property to be extracted
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
NoSuchMethodException - if an accessor method for this
propety cannot be found
public String getMappedProperty(Object bean,
String name,
String key,
String pattern)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
bean - Bean whose property is to be extractedname - Simple property name of the property value to be extractedkey - Lookup key of the property value to be extractedpattern - The conversion pattern
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
NoSuchMethodException - if an accessor method for this
propety cannot be found
public String getMappedProperty(Object bean,
String name,
String key)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
getMappedProperty in class BeanUtilsBeanbean - Bean whose property is to be extractedname - Simple property name of the property value to be extractedkey - Lookup key of the property value to be extracted
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
NoSuchMethodException - if an accessor method for this
propety cannot be found
public String getMappedPropertyLocale(Object bean,
String name,
String pattern)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
IllegalArgumentException will be
thrown.
bean - Bean whose property is to be extractedname - propertyname(index) of the property value
to be extractedpattern - The conversion pattern
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
NoSuchMethodException - if an accessor method for this
propety cannot be found
public String getMappedProperty(Object bean,
String name)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
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.
getMappedProperty in class BeanUtilsBeanbean - Bean whose property is to be extractedname - propertyname(index) of the property value
to be extracted
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
NoSuchMethodException - if an accessor method for this
propety cannot be found
public String getNestedProperty(Object bean,
String name,
String pattern)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
bean - Bean whose property is to be extractedname - Possibly nested name of the property to be extractedpattern - The conversion pattern
IllegalAccessException - if the caller does not have
access to the property accessor method
IllegalArgumentException - if a nested reference to a
property returns null
InvocationTargetException - if the property accessor method
throws an exception
NoSuchMethodException - if an accessor method for this
propety cannot be found
public String getNestedProperty(Object bean,
String name)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
LocaleConverter.
getNestedProperty in class BeanUtilsBeanbean - Bean whose property is to be extractedname - Possibly nested name of the property to be extracted
IllegalAccessException - if the caller does not have
access to the property accessor method
IllegalArgumentException - if a nested reference to a
property returns null
InvocationTargetException - if the property accessor method
throws an exception
NoSuchMethodException - if an accessor method for this
propety cannot be found
public String getProperty(Object bean,
String name,
String pattern)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
bean - Bean whose property is to be extractedname - Possibly indexed and/or nested name of the property
to be extractedpattern - The conversion pattern
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
NoSuchMethodException - if an accessor method for this
propety cannot be found
public String getProperty(Object bean,
String name)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
LocaleConverter.
getProperty in class BeanUtilsBeanbean - Bean whose property is to be extractedname - Possibly indexed and/or nested name of the property
to be extracted
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
NoSuchMethodException - if an accessor method for this
propety cannot be found
public void setProperty(Object bean,
String name,
Object value)
throws IllegalAccessException,
InvocationTargetException
LocaleConverter.
setProperty in class BeanUtilsBeanbean - Bean on which setting is to be performedname - Property name (can be nested/indexed/mapped/combo)value - Value to be set
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
public void setProperty(Object bean,
String name,
Object value,
String pattern)
throws IllegalAccessException,
InvocationTargetException
bean - Bean on which setting is to be performedname - Property name (can be nested/indexed/mapped/combo)value - Value to be setpattern - The conversion pattern
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
protected Class definePropertyType(Object target,
String name,
String propName)
throws IllegalAccessException,
InvocationTargetException
target - The beanname - The property namepropName - The Simple name of target property
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
protected Object convert(Class type,
int index,
Object value,
String pattern)
type - The Java type of target propertyindex - The indexed subscript value (if any)value - The value to be convertedpattern - The conversion pattern
protected Object convert(Class type,
int index,
Object value)
type - The Java type of target propertyindex - The indexed subscript value (if any)value - The value to be converted
protected void invokeSetter(Object target,
String propName,
String key,
int index,
Object newValue)
throws IllegalAccessException,
InvocationTargetException
target - The beanpropName - The Simple name of target propertykey - The Mapped key value (if any)index - The indexed subscript value (if any)newValue - The value to be set
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
protected LocaleBeanUtilsBean.Descriptor calculate(Object bean,
String name)
throws IllegalAccessException,
InvocationTargetException
Resolver implementation and this method
is no longer used by BeanUtils.
bean - The beanname - The property name
IllegalAccessException - if the caller does not have
access to the property accessor method
InvocationTargetException - if the property accessor method
throws an exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||