org.apache.bval.util
Class PropertyAccess

java.lang.Object
  extended by org.apache.bval.util.AccessStrategy
      extended by org.apache.bval.util.PropertyAccess

public class PropertyAccess
extends AccessStrategy

Description: Undefined dynamic strategy (FIELD or METHOD access) Uses PropertyUtils or tries to determine field to access the value


Constructor Summary
PropertyAccess(Class<?> clazz, String propertyName)
          Create a new PropertyAccess instance.
 
Method Summary
 boolean equals(Object o)
          
 Object get(Object bean)
          Get the value from the given instance.
 ElementType getElementType()
          Get the Java program ElementType used by this AccessStrategy to determine property values.
 Type getJavaType()
          Get the type of the property
static Object getProperty(Object bean, String propertyName)
          Get a named property from bean.
 String getPropertyName()
          Get a name representative of this property.
 int hashCode()
          
 boolean isKnown()
          Learn whether this PropertyAccess references a known property.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyAccess

public PropertyAccess(Class<?> clazz,
                      String propertyName)
Create a new PropertyAccess instance.

Parameters:
clazz -
propertyName -
Method Detail

getElementType

public ElementType getElementType()
Get the Java program ElementType used by this AccessStrategy to determine property values.

Specified by:
getElementType in class AccessStrategy
Returns:
ElementType

getProperty

public static Object getProperty(Object bean,
                                 String propertyName)
                          throws InvocationTargetException,
                                 NoSuchMethodException,
                                 IllegalAccessException
Get a named property from bean.

Parameters:
bean -
propertyName -
Returns:
Object found
Throws:
InvocationTargetException
NoSuchMethodException
IllegalAccessException

toString

public String toString()

Overrides:
toString in class Object

getJavaType

public Type getJavaType()
Get the type of the property

Specified by:
getJavaType in class AccessStrategy
Returns:
Type

isKnown

public boolean isKnown()
Learn whether this PropertyAccess references a known property.

Returns:
boolean

getPropertyName

public String getPropertyName()
Get a name representative of this property.

Specified by:
getPropertyName in class AccessStrategy
Returns:
String

get

public Object get(Object bean)
Get the value from the given instance.

Specified by:
get in class AccessStrategy
Returns:
the value

equals

public boolean equals(Object o)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object


Copyright © 2010-2012 Apache Software Foundation. All Rights Reserved.