org.apache.bval.util
Class MethodAccess

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

public class MethodAccess
extends AccessStrategy

Description: invoke a zero-argument method (getter)


Constructor Summary
MethodAccess(Method method)
          Create a new MethodAccess instance.
MethodAccess(String propertyName, Method method)
          Create a new MethodAccess instance.
 
Method Summary
 boolean equals(Object o)
          
 Object get(Object instance)
          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
 String getPropertyName()
          Get a name representative of this property.
static String getPropertyName(Method member)
          Process bean properties getter by applying the JavaBean naming conventions.
 int hashCode()
          
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MethodAccess

public MethodAccess(Method method)
Create a new MethodAccess instance.

Parameters:
method -

MethodAccess

public MethodAccess(String propertyName,
                    Method method)
Create a new MethodAccess instance.

Parameters:
propertyName -
method -
Method Detail

getPropertyName

public static String getPropertyName(Method member)
Process bean properties getter by applying the JavaBean naming conventions.

Parameters:
member - the member for which to get the property name.
Returns:
The bean method name with the "is" or "get" prefix stripped off, null the method name id not according to the JavaBeans standard.

getPropertyName

public String getPropertyName()
Get a name representative of this property. normally the propertyName of the getter method, e.g.
method: getName() -> propertyName: name
method: isValid() -> propertyName: valid

Specified by:
getPropertyName in class AccessStrategy
Returns:
String

get

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

Specified by:
get in class AccessStrategy
Returns:
the value

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

getJavaType

public Type getJavaType()
Get the type of the property

Specified by:
getJavaType in class AccessStrategy
Returns:
Type

toString

public String toString()

Overrides:
toString in class Object

equals

public boolean equals(Object o)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object


Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.