com.uwyn.rife.tools
Class BeanUtils

java.lang.Object
  extended by com.uwyn.rife.tools.BeanUtils

public abstract class BeanUtils
extends Object


Field Summary
static com.uwyn.rife.tools.BeanUtils.Accessors GETTERS
           
static com.uwyn.rife.tools.BeanUtils.Accessors GETTERS_SETTERS
           
static com.uwyn.rife.tools.BeanUtils.Accessors SETTERS
           
 
Constructor Summary
BeanUtils()
           
 
Method Summary
static int countProperties(com.uwyn.rife.tools.BeanUtils.Accessors accessors, Class beanClass, String[] includedProperties, String[] excludedProperties, String prefix)
           
static int countProperties(Class beanClass, String[] includedProperties, String[] excludedProperties, String prefix)
           
static String formatPropertyValue(Object propertyValue, ConstrainedProperty constrainedProperty)
           
static BeanInfo getBeanInfo(Class beanClass)
           
static DateFormat getConcisePreciseDateFormat()
           
static Set<String> getPropertyNames(com.uwyn.rife.tools.BeanUtils.Accessors accessors, Class beanClass, String[] includedProperties, String[] excludedProperties, String prefix)
           
static Set<String> getPropertyNames(Class beanClass, String[] includedProperties, String[] excludedProperties, String prefix)
           
static Class getPropertyType(Class beanClass, String name)
           
static Map<String,Class> getPropertyTypes(com.uwyn.rife.tools.BeanUtils.Accessors accessors, Class beanClass, String[] includedProperties, String[] excludedProperties, String prefix)
           
static Map<String,Class> getPropertyTypes(Class beanClass, String[] includedProperties, String[] excludedProperties, String prefix)
           
static Object getPropertyValue(Object bean, String name)
           
static Map<String,Object> getPropertyValues(com.uwyn.rife.tools.BeanUtils.Accessors accessors, Object bean, String[] includedProperties, String[] excludedProperties, String prefix)
           
static Map<String,Object> getPropertyValues(Object bean, String[] includedProperties, String[] excludedProperties, String prefix)
           
static HashMap<String,PropertyDescriptor> getUppercasedBeanProperties(Class beanClass)
          Retrieves a map of all the properties of a bean and their descriptors.
 Object parseDate(String date, Format format)
          Parses the textual representation of the date using a custom format, or by relying on the standard date formats.
static void processProperties(com.uwyn.rife.tools.BeanUtils.Accessors accessors, Class beanClass, String[] includedProperties, String[] excludedProperties, String prefix, BeanPropertyProcessor processor)
           
static void processProperties(Class beanClass, String[] includedProperties, String[] excludedProperties, String prefix, BeanPropertyProcessor processor)
           
static void processPropertyValues(com.uwyn.rife.tools.BeanUtils.Accessors accessors, Object bean, String[] includedProperties, String[] excludedProperties, String prefix, BeanPropertyValueProcessor processor)
           
static void processPropertyValues(Object bean, String[] includedProperties, String[] excludedProperties, String prefix, BeanPropertyValueProcessor processor)
           
static void setPropertyValue(Object bean, String name, Object value)
           
static void setUppercasedBeanProperty(String propertyName, String[] propertyValues, String propertyNamePrefix, Map<String,PropertyDescriptor> beanProperties, Object beanInstance, Object emptyBean)
          Set the value of a bean property from an array of strings.
static void setUppercasedBeanProperty(String propertyName, UploadedFile propertyFile, String propertyNamePrefix, Map<String,PropertyDescriptor> beanProperties, Object beanInstance)
          Set the value of a bean property from an uploaded file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GETTERS

public static final com.uwyn.rife.tools.BeanUtils.Accessors GETTERS

SETTERS

public static final com.uwyn.rife.tools.BeanUtils.Accessors SETTERS

GETTERS_SETTERS

public static final com.uwyn.rife.tools.BeanUtils.Accessors GETTERS_SETTERS
Constructor Detail

BeanUtils

public BeanUtils()
Method Detail

getConcisePreciseDateFormat

public static DateFormat getConcisePreciseDateFormat()

getBeanInfo

public static BeanInfo getBeanInfo(Class beanClass)
                            throws BeanUtilsException
Throws:
BeanUtilsException

getPropertyNames

public static Set<String> getPropertyNames(Class beanClass,
                                           String[] includedProperties,
                                           String[] excludedProperties,
                                           String prefix)
                                    throws BeanUtilsException
Throws:
BeanUtilsException

getPropertyNames

public static Set<String> getPropertyNames(com.uwyn.rife.tools.BeanUtils.Accessors accessors,
                                           Class beanClass,
                                           String[] includedProperties,
                                           String[] excludedProperties,
                                           String prefix)
                                    throws BeanUtilsException
Throws:
BeanUtilsException

processProperties

public static void processProperties(Class beanClass,
                                     String[] includedProperties,
                                     String[] excludedProperties,
                                     String prefix,
                                     BeanPropertyProcessor processor)
                              throws BeanUtilsException
Throws:
BeanUtilsException

processProperties

public static void processProperties(com.uwyn.rife.tools.BeanUtils.Accessors accessors,
                                     Class beanClass,
                                     String[] includedProperties,
                                     String[] excludedProperties,
                                     String prefix,
                                     BeanPropertyProcessor processor)
                              throws BeanUtilsException
Throws:
BeanUtilsException

processPropertyValues

public static void processPropertyValues(Object bean,
                                         String[] includedProperties,
                                         String[] excludedProperties,
                                         String prefix,
                                         BeanPropertyValueProcessor processor)
                                  throws BeanUtilsException
Throws:
BeanUtilsException

processPropertyValues

public static void processPropertyValues(com.uwyn.rife.tools.BeanUtils.Accessors accessors,
                                         Object bean,
                                         String[] includedProperties,
                                         String[] excludedProperties,
                                         String prefix,
                                         BeanPropertyValueProcessor processor)
                                  throws BeanUtilsException
Throws:
BeanUtilsException

countProperties

public static int countProperties(Class beanClass,
                                  String[] includedProperties,
                                  String[] excludedProperties,
                                  String prefix)
                           throws BeanUtilsException
Throws:
BeanUtilsException

countProperties

public static int countProperties(com.uwyn.rife.tools.BeanUtils.Accessors accessors,
                                  Class beanClass,
                                  String[] includedProperties,
                                  String[] excludedProperties,
                                  String prefix)
                           throws BeanUtilsException
Throws:
BeanUtilsException

getPropertyValue

public static Object getPropertyValue(Object bean,
                                      String name)
                               throws BeanUtilsException
Throws:
BeanUtilsException

setPropertyValue

public static void setPropertyValue(Object bean,
                                    String name,
                                    Object value)
                             throws BeanUtilsException
Throws:
BeanUtilsException

getPropertyType

public static Class getPropertyType(Class beanClass,
                                    String name)
                             throws BeanUtilsException
Throws:
BeanUtilsException

getPropertyValues

public static Map<String,Object> getPropertyValues(Object bean,
                                                   String[] includedProperties,
                                                   String[] excludedProperties,
                                                   String prefix)
                                            throws BeanUtilsException
Throws:
BeanUtilsException

getPropertyValues

public static Map<String,Object> getPropertyValues(com.uwyn.rife.tools.BeanUtils.Accessors accessors,
                                                   Object bean,
                                                   String[] includedProperties,
                                                   String[] excludedProperties,
                                                   String prefix)
                                            throws BeanUtilsException
Throws:
BeanUtilsException

formatPropertyValue

public static String formatPropertyValue(Object propertyValue,
                                         ConstrainedProperty constrainedProperty)

getPropertyTypes

public static Map<String,Class> getPropertyTypes(Class beanClass,
                                                 String[] includedProperties,
                                                 String[] excludedProperties,
                                                 String prefix)
                                          throws BeanUtilsException
Throws:
BeanUtilsException

getPropertyTypes

public static Map<String,Class> getPropertyTypes(com.uwyn.rife.tools.BeanUtils.Accessors accessors,
                                                 Class beanClass,
                                                 String[] includedProperties,
                                                 String[] excludedProperties,
                                                 String prefix)
                                          throws BeanUtilsException
Throws:
BeanUtilsException

getUppercasedBeanProperties

public static HashMap<String,PropertyDescriptor> getUppercasedBeanProperties(Class beanClass)
                                                                      throws BeanUtilsException
Retrieves a map of all the properties of a bean and their descriptors.

The property names will be uppercased and an exception will be thrown if two properties are equals case-insensitively.

Parameters:
beanClass - the class of the bean
Returns:
the map of the bean properties
Throws:
BeanUtilsException - when an error occurred while obtaining the bean properties
Since:
1.4
See Also:
setUppercasedBeanProperty(String, String[], String, Map, Object, Object), setUppercasedBeanProperty(String, UploadedFile, String, Map, Object)

parseDate

public Object parseDate(String date,
                        Format format)
                 throws ParseException
Parses the textual representation of the date using a custom format, or by relying on the standard date formats.

Parameters:
date - the textual representation of the date
format - the custom format that should be used for parsing the string representation of the date; or null if the default formats should be used
Returns:
the parsed date
Throws:
ParseException - if an error occurred when the date was parsed
Since:
1.6

setUppercasedBeanProperty

public static void setUppercasedBeanProperty(String propertyName,
                                             String[] propertyValues,
                                             String propertyNamePrefix,
                                             Map<String,PropertyDescriptor> beanProperties,
                                             Object beanInstance,
                                             Object emptyBean)
                                      throws BeanUtilsException
Set the value of a bean property from an array of strings.

Parameters:
propertyName - the name of the property
propertyValues - the values that will be set, can be null
propertyNamePrefix - the prefix that the propertyName parameter should have, can be null
beanProperties - the map of the uppercased bean property names and their descriptors
beanInstance - the bean instance whose property should be updated
emptyBean - this bean instance will be used to set the value of the property in case the propertyValues parameter is empty or null, can be null
Throws:
BeanUtilsException - when an error occurred while setting the bean property
Since:
1.4
See Also:
getUppercasedBeanProperties(Class), setUppercasedBeanProperty(String, UploadedFile, String, Map, Object)

setUppercasedBeanProperty

public static void setUppercasedBeanProperty(String propertyName,
                                             UploadedFile propertyFile,
                                             String propertyNamePrefix,
                                             Map<String,PropertyDescriptor> beanProperties,
                                             Object beanInstance)
                                      throws BeanUtilsException
Set the value of a bean property from an uploaded file.

Parameters:
propertyName - the name of the property
propertyFile - the file that will be set, can be null
propertyNamePrefix - the prefix that the propertyName parameter should have, can be null
beanProperties - the map of the uppercased bean property names and their descriptors
beanInstance - the bean instance whose property should be updated
Throws:
BeanUtilsException - when an error occurred while setting the bean property
Since:
1.4
See Also:
getUppercasedBeanProperties(Class), setUppercasedBeanProperty(String, String[], String, Map, Object, Object)


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.