Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.jgoodies.binding.beans
Class PropertyAccessor

    java.lang.Object
      com.jgoodies.binding.beans.PropertyAccessor

    public final class PropertyAccessor

extends Object

An unmodifiable Object that describes and provides access to a bean property.

Since:
  2.2
Version:
  $Revision: 1.2 $
Author:
  Karsten Lentzsch

Constructor Summary
`PropertyAccessor(String propertyName, Method readMethod, Method writeMethod)` Constructs a PropertyAcessor for the given property name, reader and writer.

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PropertyAccessor

    public PropertyAccessor(String propertyName,
                            Method readMethod,
                            Method writeMethod)

  Constructs a PropertyAcessor for the given property name, reader and writer.

  Parameters:
    `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)`
  Throws:
    `NullPointerException` - if `propertyName` is null

Method Detail

### getPropertyName

    public String getPropertyName()

  Returns:
    the bean property name.

### getPropertyType

    public Class<?> getPropertyType()

  Returns:
    the type of the accessed bean property

### getReadMethod

    public Method getReadMethod()

  Returns:
    the Method used to read the property value or `null`, if not available

### getWriteMethod

    public Method getWriteMethod()

  Returns:
    the Method used to write the property value or `null`, if not available

### isReadOnly

    public boolean isReadOnly()

  Returns:
    `true` if the property cannot be written, `false` if it can be written

### isWriteOnly

    public boolean isWriteOnly()

  Returns:
    `true` if the property cannot be read, `false` if it can be read

### getValue

    public Object getValue(Object bean)

  Invokes this accessor's reader on the given bean.

  Parameters:
    `bean` - the target bean where the reader is to be invoked
  Returns:
    the value of the property that is described by this accessor when read from the given bean
  Throws:
    `NullPointerException` - if `bean` is `null`
    `UnsupportedOperationException` - if the property is write-only

### setValue

    public void setValue(Object bean,
                         Object newValue)
                  throws PropertyVetoException

  Invokes this accessor's writer on the given bean with the given value.

  Parameters:
    `bean` - the target bean where the property value shall be set
    `newValue` - the value to set
  Throws:
    `NullPointerException` - if `bean` is `null`
    `UnsupportedOperationException` - if the property is write-only
    `PropertyVetoException` - if the invoked writer throws such an exception

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2013 JGoodies Software GmbH. All Rights Reserved.