|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.omnaest.utils.beans.result.BeanPropertyAccessor<B>
B - Java Bean typepublic class BeanPropertyAccessor<B>
JavaBean property access object for Methods and Field of a special Java Bean type.
The BeanPropertyAccessor is Serializable and immutable. Changing the BeanPropertyAccessor.PropertyAccessType e.g. does
return a new instance. See newBeanPropertyAccessorWithPropertyAccessType(PropertyAccessType).
The default BeanPropertyAccessor.PropertyAccessType is on property level.
BeanUtils,
BeanProperty,
Serialized Form| Nested Class Summary | |
|---|---|
static class |
BeanPropertyAccessor.PropertyAccessType
|
| Field Summary | |
|---|---|
protected Class<B> |
beanType
|
protected Field |
field
|
protected Method |
methodGetter
|
protected Method |
methodSetter
|
protected BeanPropertyAccessor.PropertyAccessType |
propertyAccessType
|
protected String |
propertyName
|
| Constructor Summary | |
|---|---|
BeanPropertyAccessor(Field field,
Method methodGetter,
Method methodSetter,
String propertyName,
Class<B> beanType)
|
|
BeanPropertyAccessor(Field field,
Method methodGetter,
Method methodSetter,
String propertyName,
Class<B> beanType,
BeanPropertyAccessor.PropertyAccessType propertyAccessType)
|
|
| Method Summary | ||
|---|---|---|
boolean |
copyPropertyValue(B beanSource,
B beanDestination)
Copies the value of one Java Bean for the underlying Java Bean property of this BeanPropertyAccessor to another Java
Bean. |
|
boolean |
copyPropertyValue(B beanSource,
BeanPropertyAccessor<B> beanPropertyAccessorTarget,
B beanTarget)
Copies the addressed bean value of the given source instance using this BeanPropertyAccessor to another instance
using the given BeanPropertyAccessor |
|
|
getAnnotation(Class<A> annotationType)
Similar to getAnnotation(Class, PropertyAccessType) using the default BeanPropertyAccessor.PropertyAccessType |
|
|
getAnnotation(Class<A> annotationType,
BeanPropertyAccessor.PropertyAccessType propertyAccessType)
Returns the Annotation instance declared on the field or methods for the related property depending on the
BeanPropertyAccessor.PropertyAccessType. |
|
Class<B> |
getBeanClass()
Returns the class object of accepted bean type |
|
Class<?> |
getDeclaringPropertyType()
Similar to getDeclaringPropertyType(PropertyAccessType) using the default BeanPropertyAccessor.PropertyAccessType |
|
Class<?> |
getDeclaringPropertyType(BeanPropertyAccessor.PropertyAccessType... propertyAccessTypes)
Similar to getDeclaringPropertyType(PropertyAccessType) but using all given BeanPropertyAccessor.PropertyAccessTypes. |
|
Class<?> |
getDeclaringPropertyType(BeanPropertyAccessor.PropertyAccessType propertyAccessType)
Determines the Class type for the property. |
|
Field |
getField()
Returns the underlying Field |
|
Method |
getMethodGetter()
Returns the getter Method |
|
Method |
getMethodSetter()
Returns the setter Method |
|
String |
getPropertyName()
Returns the name of the property |
|
Object |
getPropertyValue(B bean)
Returns the property value for the underlying Java Bean property from the given Java Bean object. |
|
Object |
getPropertyValue(B bean,
BeanPropertyAccessor.PropertyAccessType... propertyAccessTypes)
Similar to getPropertyValue(Object, ExceptionHandler, PropertyAccessType...) with no ExceptionHandler |
|
Object |
getPropertyValue(B bean,
BeanPropertyAccessor.PropertyAccessType propertyAccessType)
Returns the property value for the underlying Java Bean property from the given Java Bean object. |
|
Object |
getPropertyValue(B bean,
BeanPropertyAccessor.PropertyAccessType propertyAccessType,
ExceptionHandler exceptionHandler)
Returns the property value for the underlying Java Bean property from the given Java Bean object. |
|
Object |
getPropertyValue(B bean,
ExceptionHandler exceptionHandler,
BeanPropertyAccessor.PropertyAccessType... propertyAccessTypes)
Similar to getPropertyValue(Object, PropertyAccessType, ExceptionHandler) using all the given
BeanPropertyAccessor.PropertyAccessTypes |
|
Tuple2<Object,Boolean> |
getPropertyValueAndSuccess(B bean,
BeanPropertyAccessor.PropertyAccessType propertyAccessType,
ExceptionHandler exceptionHandler)
Returns the property value for the underlying Java Bean property from the given Java Bean object. |
|
boolean |
hasField()
Returns true if an underlying field is available |
|
boolean |
hasGetter()
Returns true, if the method has no parameters but a return type. |
|
boolean |
hasGetterAndSetter()
Returns true, if the underlying Field has a getter and a setter method. |
|
boolean |
hasGetterOrSetter()
Returns true, if the underlying Field has at least a getter or a setter method or both available. |
|
boolean |
hasSetter()
Is true, if a method has only one parameter and begins with "set". |
|
boolean |
isReadable()
Returns true if the BeanPropertyAccessor.PropertyAccessType is field and the class definition has a field or if BeanPropertyAccessor.PropertyAccessType
is property and the class declares a getter. |
|
boolean |
isReadAndWritable()
Returns true if the BeanPropertyAccessor.PropertyAccessType is field and the class definition has a field or if BeanPropertyAccessor.PropertyAccessType
is property and the class declares a getter and a setter. |
|
boolean |
isWritable()
Returns true if the BeanPropertyAccessor.PropertyAccessType is field and the class definition has a field or if BeanPropertyAccessor.PropertyAccessType
is property and the class declares a setter. |
|
static
|
merge(BeanPropertyAccessor<B> beanPropertyAccessorA,
BeanPropertyAccessor<B> beanPropertyAccessorB)
Merges two BeanPropertyAccessor instances into one if the underlying Class and property are equal. |
|
BeanPropertyAccessor<B> |
newBeanPropertyAccessorWithPropertyAccessType(BeanPropertyAccessor.PropertyAccessType propertyAccessType)
Returns a new BeanPropertyAccessor which has the given BeanPropertyAccessor.PropertyAccessType set. |
|
Object |
readResolve()
|
|
boolean |
setPropertyValue(B bean,
Object value)
Sets the property value for the underlying Java Bean property for the given Java Bean object. |
|
boolean |
setPropertyValue(B bean,
Object value,
BeanPropertyAccessor.PropertyAccessType... propertyAccessTypes)
Similar to setPropertyValue(Object, Object, PropertyAccessType) using all given BeanPropertyAccessor.PropertyAccessTypes |
|
boolean |
setPropertyValue(B bean,
Object value,
BeanPropertyAccessor.PropertyAccessType propertyAccessType)
Sets the property value for the underlying Java Bean property for the given Java Bean object using the given BeanPropertyAccessor.PropertyAccessType. |
|
boolean |
setPropertyValue(B bean,
Object value,
BeanPropertyAccessor.PropertyAccessType propertyAccessType,
ExceptionHandler exceptionHandler)
Sets the property value for the underlying Java Bean property for the given Java Bean object using the given BeanPropertyAccessor.PropertyAccessType. |
|
boolean |
setPropertyValue(B bean,
Object value,
ExceptionHandler exceptionHandler,
BeanPropertyAccessor.PropertyAccessType... propertyAccessTypes)
Similar to setPropertyValue(Object, Object, PropertyAccessType, ExceptionHandler) using all given
BeanPropertyAccessor.PropertyAccessTypes |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected String propertyName
protected transient Field field
protected transient Method methodGetter
protected transient Method methodSetter
protected Class<B> beanType
protected BeanPropertyAccessor.PropertyAccessType propertyAccessType
| Constructor Detail |
|---|
public BeanPropertyAccessor(Field field,
Method methodGetter,
Method methodSetter,
String propertyName,
Class<B> beanType)
field - methodGetter - methodSetter - propertyName - beanType - BeanPropertyAccessor
public BeanPropertyAccessor(Field field,
Method methodGetter,
Method methodSetter,
String propertyName,
Class<B> beanType,
BeanPropertyAccessor.PropertyAccessType propertyAccessType)
field - methodGetter - methodSetter - propertyName - beanType - propertyAccessType - BeanPropertyAccessor| Method Detail |
|---|
public boolean copyPropertyValue(B beanSource,
B beanDestination)
BeanPropertyAccessor to another Java
Bean.
beanSource - beanDestination -
public boolean copyPropertyValue(B beanSource,
BeanPropertyAccessor<B> beanPropertyAccessorTarget,
B beanTarget)
BeanPropertyAccessor to another instance
using the given BeanPropertyAccessor
beanSource - beanPropertyAccessorTarget - beanTarget -
public Class<?> getDeclaringPropertyType(BeanPropertyAccessor.PropertyAccessType... propertyAccessTypes)
getDeclaringPropertyType(PropertyAccessType) but using all given BeanPropertyAccessor.PropertyAccessTypes.
public Class<?> getDeclaringPropertyType()
getDeclaringPropertyType(PropertyAccessType) using the default BeanPropertyAccessor.PropertyAccessType
public Class<?> getDeclaringPropertyType(BeanPropertyAccessor.PropertyAccessType propertyAccessType)
Class type for the property. This is also known as the declaring return or field type not the type of
any actual object instance.BeanPropertyAccessor.PropertyAccessType only the field type or the method return or parameter type is investigated, not
all at the same time.
propertyAccessType - BeanPropertyAccessor.PropertyAccessType
public <A extends Annotation> A getAnnotation(Class<A> annotationType)
getAnnotation(Class, PropertyAccessType) using the default BeanPropertyAccessor.PropertyAccessType
annotationType - Class of the Annotation
Annotation instance or null
public <A extends Annotation> A getAnnotation(Class<A> annotationType,
BeanPropertyAccessor.PropertyAccessType propertyAccessType)
Annotation instance declared on the field or methods for the related property depending on the
BeanPropertyAccessor.PropertyAccessType.
annotationType - Class of the AnnotationpropertyAccessType - BeanPropertyAccessor.PropertyAccessType
Annotation instance or null
public Object getPropertyValue(B bean,
BeanPropertyAccessor.PropertyAccessType propertyAccessType)
bean - propertyAccessType -
BeanPropertyAccessor.PropertyAccessType
public Object getPropertyValue(B bean,
BeanPropertyAccessor.PropertyAccessType... propertyAccessTypes)
getPropertyValue(Object, ExceptionHandler, PropertyAccessType...) with no ExceptionHandler
bean - propertyAccessTypes -
public Object getPropertyValue(B bean,
ExceptionHandler exceptionHandler,
BeanPropertyAccessor.PropertyAccessType... propertyAccessTypes)
getPropertyValue(Object, PropertyAccessType, ExceptionHandler) using all the given
BeanPropertyAccessor.PropertyAccessTypes
bean - exceptionHandler - propertyAccessTypes -
public Object getPropertyValue(B bean,
BeanPropertyAccessor.PropertyAccessType propertyAccessType,
ExceptionHandler exceptionHandler)
bean - propertyAccessType - exceptionHandler -
BeanPropertyAccessor.PropertyAccessType
public Tuple2<Object,Boolean> getPropertyValueAndSuccess(B bean,
BeanPropertyAccessor.PropertyAccessType propertyAccessType,
ExceptionHandler exceptionHandler)
bean - propertyAccessType - exceptionHandler -
BeanPropertyAccessor.PropertyAccessTypepublic Object getPropertyValue(B bean)
bean -
newBeanPropertyAccessorWithPropertyAccessType(PropertyAccessType)
public boolean setPropertyValue(B bean,
Object value)
bean - value -
public boolean setPropertyValue(B bean,
Object value,
BeanPropertyAccessor.PropertyAccessType propertyAccessType)
BeanPropertyAccessor.PropertyAccessType.
bean - value - propertyAccessType -
public boolean setPropertyValue(B bean,
Object value,
BeanPropertyAccessor.PropertyAccessType... propertyAccessTypes)
setPropertyValue(Object, Object, PropertyAccessType) using all given BeanPropertyAccessor.PropertyAccessTypes
bean - value - propertyAccessTypes -
public boolean setPropertyValue(B bean,
Object value,
ExceptionHandler exceptionHandler,
BeanPropertyAccessor.PropertyAccessType... propertyAccessTypes)
setPropertyValue(Object, Object, PropertyAccessType, ExceptionHandler) using all given
BeanPropertyAccessor.PropertyAccessTypes
bean - value - exceptionHandler - ExceptionHandlerpropertyAccessTypes -
public boolean setPropertyValue(B bean,
Object value,
BeanPropertyAccessor.PropertyAccessType propertyAccessType,
ExceptionHandler exceptionHandler)
BeanPropertyAccessor.PropertyAccessType.
bean - value - propertyAccessType - exceptionHandler -
public boolean hasGetterOrSetter()
Field has at least a getter or a setter method or both available.
public boolean hasGetterAndSetter()
Field has a getter and a setter method.
public boolean isReadAndWritable()
BeanPropertyAccessor.PropertyAccessType is field and the class definition has a field or if BeanPropertyAccessor.PropertyAccessType
is property and the class declares a getter and a setter.
public boolean isReadable()
BeanPropertyAccessor.PropertyAccessType is field and the class definition has a field or if BeanPropertyAccessor.PropertyAccessType
is property and the class declares a getter.
public boolean isWritable()
BeanPropertyAccessor.PropertyAccessType is field and the class definition has a field or if BeanPropertyAccessor.PropertyAccessType
is property and the class declares a setter.
public boolean hasField()
public boolean hasGetter()
public boolean hasSetter()
public static <B> BeanPropertyAccessor<B> merge(BeanPropertyAccessor<B> beanPropertyAccessorA,
BeanPropertyAccessor<B> beanPropertyAccessorB)
BeanPropertyAccessor instances into one if the underlying Class and property are equal.
B - beanPropertyAccessorA - beanPropertyAccessorB -
public Class<B> getBeanClass()
public String getPropertyName()
public Field getField()
Field
public Method getMethodGetter()
Method
public Method getMethodSetter()
Method
public String toString()
toString in class Objectpublic BeanPropertyAccessor<B> newBeanPropertyAccessorWithPropertyAccessType(BeanPropertyAccessor.PropertyAccessType propertyAccessType)
BeanPropertyAccessor which has the given BeanPropertyAccessor.PropertyAccessType set. This does not changed the
current instance.
propertyAccessType - BeanPropertyAccessor.PropertyAccessType
public Object readResolve()
throws ObjectStreamException
ObjectStreamException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||