org.omnaest.utils.beans
Class BeanUtil

java.lang.Object
  extended by org.apache.commons.beanutils.BeanUtils
      extended by org.omnaest.utils.beans.BeanUtil

Deprecated. use BeanUtils instead

@Deprecated
public class BeanUtil
extends org.apache.commons.beanutils.BeanUtils

Simple utility class, which extends the Apache Common BeanUtils class.

Author:
Omnaest

Nested Class Summary
static class BeanUtil.BeanProperty
          Deprecated. Holds information about a beans property
static interface BeanUtil.CopyableProperty
          Deprecated. Marker annotation.
static class BeanUtil.PropertyCriterion
          Deprecated. Defines a interface for a criterion to retrieve property names of an object.
static class BeanUtil.PropertyCriterionAnnotationname
          Deprecated. Matches the name of an annotation of a property method, or the property with the same name as its property method, using regular expression.
static class BeanUtil.PropertyCriterionConjunction
          Deprecated. Base class for other cunjunction criteria.
static class BeanUtil.PropertyCriterionConjunctionAND
          Deprecated. Conjunction of sub criteria.
static class BeanUtil.PropertyCriterionConjunctionOR
          Deprecated. Conjunction of sub criteria.
static class BeanUtil.PropertyCriterionHasGetterSetter
          Deprecated. Test a method if it is a getter or / and a setter of a property.
static class BeanUtil.PropertyCriterionMethodname
          Deprecated. Matches the name of a method using regular expression.
 
Constructor Summary
BeanUtil()
          Deprecated.  
 
Method Summary
static List<Exception> copyProperties(Collection<Object> targetBeanCollection, Collection<Object> sourceBeanCollection)
          Deprecated. Copies the properties from a collection of JavaBeans to another collection of JavaBeans.
static List<Exception> copyProperties(Collection<Object> targetBeanCollection, Collection<Object> sourceBeanCollection, String... propertyNames)
          Deprecated. Copies the properties of a collection of JavaBeans to another collection of JavaBeans.
static List<Exception> copyProperties(Object targetBean, Object sourceBean, String... propertyNames)
          Deprecated. Copies the properties of the given list from the source to the target bean using their getter and setter methods.
static void copyPropertiesCopyable(Object targetBeanObject, Object sourceBeanObject)
          Deprecated. Copies all properties of a target java bean object, which are marked with the CopyableProperty annotation in the source bean class.
static boolean copyPropertiesWherePossible(Object targetBean, Object sourceBean)
          Deprecated. Copies all properties with the same signature.
static BeanUtil.BeanProperty[] determineBeanProperties(Class<?> beanClass)
          Deprecated.  
static String[] determineBeanProperties(Class<?> beanClass, BeanUtil.PropertyCriterion... propertyCriteria)
          Deprecated. Determines the property names of a java bean object class.
static BeanUtil.BeanProperty[] determineBeanProperties(Object beanObject)
          Deprecated.  
static String[] determineBeanProperties(Object beanObject, BeanUtil.PropertyCriterion... propertyCriteria)
          Deprecated.  
static String[] determineBeanPropertiesForAnnotations(Class<?> beanClass, Class<? extends Annotation>... annotationClasses)
          Deprecated. Determines the property names of all properties which are declared with the given annotation.
static String[] determineBeanPropertiesForAnnotations(Class<?> beanClass, String... annotationNames)
          Deprecated.  
static
<Value,Element>
Map<String,Value>
determineBeanPropertyNameToValueMap(Element beanObject, String... propertyNames)
          Deprecated. Returns a map with the values of the given bean object.
protected static String determinePropertyNameForMethodname(String methodName)
          Deprecated. Determines the property name of a getter, setter or isGetter method name.
static
<Value,Element>
Element
injectPropertyToValueMapIntoBean(Element beanObject, Map<String,Value> propertyToValueMap)
          Deprecated. Injects the values for the given property name keys of the map into the bean.
static
<Value,Element>
Element
injectValueOfPropertyIntoBean(Element beanObject, String propertyName, Value value)
          Deprecated. The value must not be null, otherwise null is returned.
static
<Value,Element>
Element
injectValueOfPropertyIntoBean(Element beanObject, String propertyName, Value value, Class<? extends Value> valueClass)
          Deprecated. Puts the given value into the property of the given bean object.
static
<P> P
invokeJavaBeanPropertyMethod(Object javaBeanObject, String methodName, P parameter)
          Deprecated. Executes the method of the given javaBean object that has the given name.
 
Methods inherited from class org.apache.commons.beanutils.BeanUtils
cloneBean, copyProperties, copyProperty, createCache, describe, getArrayProperty, getCacheFast, getDebug, getIndexedProperty, getIndexedProperty, getMappedProperty, getMappedProperty, getNestedProperty, getProperty, getSimpleProperty, initCause, populate, setCacheFast, setDebug, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanUtil

public BeanUtil()
Deprecated. 
Method Detail

determineBeanPropertyNameToValueMap

public static <Value,Element> Map<String,Value> determineBeanPropertyNameToValueMap(Element beanObject,
                                                                                    String... propertyNames)
Deprecated. 
Returns a map with the values of the given bean object. If property names are specified, only those values are extracted, whose property names are specified. If no property name is specified all properties are read.

Parameters:
beanObject -
propertyNames -

injectValueOfPropertyIntoBean

public static <Value,Element> Element injectValueOfPropertyIntoBean(Element beanObject,
                                                                    String propertyName,
                                                                    Value value)
Deprecated. 
The value must not be null, otherwise null is returned.

See Also:
injectValueOfPropertyIntoBean(Object, String, Object, Class)

injectPropertyToValueMapIntoBean

public static <Value,Element> Element injectPropertyToValueMapIntoBean(Element beanObject,
                                                                       Map<String,Value> propertyToValueMap)
Deprecated. 
Injects the values for the given property name keys of the map into the bean.

Parameters:
beanObject -
propertyToValueMap -
Returns:

injectValueOfPropertyIntoBean

public static <Value,Element> Element injectValueOfPropertyIntoBean(Element beanObject,
                                                                    String propertyName,
                                                                    Value value,
                                                                    Class<? extends Value> valueClass)
Deprecated. 
Puts the given value into the property of the given bean object.

Parameters:
beanObject -
propertyName -
value - : != null
Returns:

copyProperties

public static List<Exception> copyProperties(Object targetBean,
                                             Object sourceBean,
                                             String... propertyNames)
Deprecated. 
Copies the properties of the given list from the source to the target bean using their getter and setter methods.

Parameters:
targetBean -
sourceBean -
propertyNames -
Returns:
null: no exception occurred; list of exceptions: at least one exception has occurred

copyPropertiesWherePossible

public static boolean copyPropertiesWherePossible(Object targetBean,
                                                  Object sourceBean)
Deprecated. 
Copies all properties with the same signature.

Parameters:
targetBean -
sourceBean -
Returns:
true: operation was successful
See Also:
BeanUtils.copyProperties(Object, Object)

copyProperties

public static List<Exception> copyProperties(Collection<Object> targetBeanCollection,
                                             Collection<Object> sourceBeanCollection,
                                             String... propertyNames)
Deprecated. 
Copies the properties of a collection of JavaBeans to another collection of JavaBeans. The copy process goes in order of the collections. JavaBean 1 from Collection 1 is copied to JavaBean 1 in Collection 2. JavaBean 2 from Collection 1 is copied to JavaBean 2 from Collection 2. And so far... .The collections should have the same size. The copy process goes as long as there are JavaBeans on each collection left.

Parameters:
targetBeanCollection -
sourceBeanCollection -
propertyNames - indicates all names of properties, which are to be copied (other properties will be ignored)
Returns:
null: no exception has occurred; list of exceptions: at least one exception has occurred

copyProperties

public static List<Exception> copyProperties(Collection<Object> targetBeanCollection,
                                             Collection<Object> sourceBeanCollection)
Deprecated. 
Copies the properties from a collection of JavaBeans to another collection of JavaBeans. The copy process goes in order of the collections. JavaBean 1 from Collection 1 is copied to JavaBean 1 in Collection 2. JavaBean 2 from Collection 1 is copied to JavaBean 2 from Collection 2. And so far... All properties the match will be copied. The collections should have the same size. The copy process goes as long as there are JavaBeans on each collection left.

Parameters:
targetBeanCollection -
sourceBeanCollection -
Returns:
null: no exception has occurred; list of exceptions: at least one exception has occurred

determineBeanPropertiesForAnnotations

public static String[] determineBeanPropertiesForAnnotations(Class<?> beanClass,
                                                             Class<? extends Annotation>... annotationClasses)
Deprecated. 
Determines the property names of all properties which are declared with the given annotation.

Parameters:
beanClass -
annotationClass -
Returns:
See Also:
determineBeanPropertiesForAnnotations(Class, String...)

determineBeanPropertiesForAnnotations

public static String[] determineBeanPropertiesForAnnotations(Class<?> beanClass,
                                                             String... annotationNames)
Deprecated. 
Parameters:
beanClass -
annotationName -
Returns:
See Also:
#determineBeanPropertiesForAnnotations(Class, Class)

determineBeanProperties

public static String[] determineBeanProperties(Object beanObject,
                                               BeanUtil.PropertyCriterion... propertyCriteria)
Deprecated. 
Parameters:
beanObject -
propertyCriteria -
Returns:
See Also:
determineBeanProperties(Class, PropertyCriterion...)

determineBeanProperties

public static String[] determineBeanProperties(Class<?> beanClass,
                                               BeanUtil.PropertyCriterion... propertyCriteria)
Deprecated. 
Determines the property names of a java bean object class. To precise the search criteria can be used. The criteria will be combined by an AND conjunction. Only properties which defines public methods will be included.

See Also:
BeanUtil.PropertyCriterion

determinePropertyNameForMethodname

protected static String determinePropertyNameForMethodname(String methodName)
Deprecated. 
Determines the property name of a getter, setter or isGetter method name.

Parameters:
methodName -
Returns:

determineBeanProperties

public static BeanUtil.BeanProperty[] determineBeanProperties(Object beanObject)
Deprecated. 

determineBeanProperties

public static BeanUtil.BeanProperty[] determineBeanProperties(Class<?> beanClass)
Deprecated. 

invokeJavaBeanPropertyMethod

public static <P> P invokeJavaBeanPropertyMethod(Object javaBeanObject,
                                                 String methodName,
                                                 P parameter)
Deprecated. 
Executes the method of the given javaBean object that has the given name.

Type Parameters:
P -
Parameters:
javaBeanObject -
methodName -
parameter - null: no parameter is assumed for the method, not null: parameter like for setter method
Returns:

copyPropertiesCopyable

public static void copyPropertiesCopyable(Object targetBeanObject,
                                          Object sourceBeanObject)
Deprecated. 
Copies all properties of a target java bean object, which are marked with the CopyableProperty annotation in the source bean class.

Parameters:
targetBeanObject -
sourceBeanObject -
See Also:
BeanUtil.CopyableProperty


Copyright © 2011. All Rights Reserved.