pl.bristleback.server.bristle.utils
Class Getter

java.lang.Object
  extended by pl.bristleback.server.bristle.utils.Getter

public final class Getter
extends java.lang.Object

Utility class that holds information about object getter. Contains information about getter method and field name.

Created on: 2010-11-21 16:37:23

Author:
Wojciech Niemiec

Constructor Summary
Getter(java.lang.String fieldName, java.lang.reflect.Method getterMethod)
          Creates a new Getter object with complete information.
 
Method Summary
 java.lang.String getFieldName()
          Name of the returned field name.
 java.lang.reflect.Method getGetterMethod()
          Getter method.
 java.lang.Class getReturnType()
          Type of object returned by getter method.
 java.lang.Object invoke(java.lang.Object bean)
          Invokes getter method on the object given as parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Getter

public Getter(java.lang.String fieldName,
              java.lang.reflect.Method getterMethod)
Creates a new Getter object with complete information.

Parameters:
fieldName - name of the field.
getterMethod - getter method.
Method Detail

invoke

public java.lang.Object invoke(java.lang.Object bean)
Invokes getter method on the object given as parameter. Any exception while invoking method will cause BristleRuntimeException to throw.

Parameters:
bean - the object the underlying method is invoked from.
Returns:
the result of invoking getter method.

getReturnType

public java.lang.Class getReturnType()
Type of object returned by getter method.

Returns:
type of object returned by getter method.

getFieldName

public java.lang.String getFieldName()
Name of the returned field name.

Returns:
name of the returned field name.

getGetterMethod

public java.lang.reflect.Method getGetterMethod()
Getter method.

Returns:
getter method.


Copyright © 2011. All Rights Reserved.