org.cojen.util
Class BeanPropertyAccessor<B>

java.lang.Object
  extended by org.cojen.util.BeanPropertyAccessor<B>

public abstract class BeanPropertyAccessor<B>
extends Object

Provides a simple and efficient means of reading and writing bean properties. BeanPropertyAccessor auto-generates code, eliminating the need to invoke methods via reflection. Bean access methods are bound-to directly, using a special hash/switch design pattern.

Author:
Brian S O'Neill
See Also:
BeanPropertyMapFactory

Constructor Summary
protected BeanPropertyAccessor()
           
 
Method Summary
static
<B> BeanPropertyAccessor<B>
forClass(Class<B> clazz)
          Returns a new or cached BeanPropertyAccessor for the given class.
abstract  Object getPropertyValue(B bean, String property)
           
abstract  boolean hasPropertyValue(B bean, Object value)
          Returns true if at least one property is set to the given value.
abstract  boolean hasReadableProperty(String property)
          Returns true if readable bean property exists.
abstract  boolean hasWritableProperty(String property)
          Returns true if writable bean property exists.
abstract  void setPropertyValue(B bean, String property, Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanPropertyAccessor

protected BeanPropertyAccessor()
Method Detail

forClass

public static <B> BeanPropertyAccessor<B> forClass(Class<B> clazz)
Returns a new or cached BeanPropertyAccessor for the given class.


getPropertyValue

public abstract Object getPropertyValue(B bean,
                                        String property)
                                 throws NoSuchPropertyException
Throws:
NoSuchPropertyException

setPropertyValue

public abstract void setPropertyValue(B bean,
                                      String property,
                                      Object value)
                               throws NoSuchPropertyException
Throws:
NoSuchPropertyException

hasReadableProperty

public abstract boolean hasReadableProperty(String property)
Returns true if readable bean property exists.

Since:
2.1

hasWritableProperty

public abstract boolean hasWritableProperty(String property)
Returns true if writable bean property exists.

Since:
2.1

hasPropertyValue

public abstract boolean hasPropertyValue(B bean,
                                         Object value)
Returns true if at least one property is set to the given value.

Since:
2.1


Copyright © 2004-2007 Brian S O'Neill. All Rights Reserved.