public final class PropertyAccessor extends Object
Constructor and Description |
---|
PropertyAccessor(String propertyName,
Method readMethod,
Method writeMethod)
Constructs a PropertyAcessor for the given property name,
reader and writer.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getPropertyName() |
Class<?> |
getPropertyType() |
Method |
getReadMethod() |
Object |
getValue(Object bean)
Invokes this accessor's reader on the given bean.
|
Method |
getWriteMethod() |
int |
hashCode() |
boolean |
isReadOnly() |
boolean |
isWriteOnly() |
void |
setValue(Object bean,
Object newValue)
Invokes this accessor's writer on the given bean with the given value.
|
public PropertyAccessor(String propertyName, Method readMethod, Method writeMethod)
propertyName
- the name of the property, e.g. "name", "enabled"readMethod
- the method that returns the property value,
e.g. getName()
, isEnabled()
writeMethod
- the method that sets the property value,
e.g. setName(String)
, setEnabled(boolean)
NullPointerException
- if propertyName
is nullpublic String getPropertyName()
public Class<?> getPropertyType()
public Method getReadMethod()
null
, if not availablepublic Method getWriteMethod()
null
, if not availablepublic boolean isReadOnly()
true
if the property cannot be written,
false
if it can be writtenpublic boolean isWriteOnly()
true
if the property cannot be read,
false
if it can be readpublic Object getValue(Object bean)
bean
- the target bean where the reader is to be invokedNullPointerException
- if bean
is null
UnsupportedOperationException
- if the property is write-onlypublic void setValue(Object bean, Object newValue) throws PropertyVetoException
bean
- the target bean where the property value shall be setnewValue
- the value to setNullPointerException
- if bean
is null
UnsupportedOperationException
- if the property is write-onlyPropertyVetoException
- if the invoked writer throws such an exceptionCopyright © 2002-2015 JGoodies Software GmbH. All Rights Reserved.