pl.bristleback.server.bristle.utils
Class Setter

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

public class Setter
extends java.lang.Object

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

Created on: 2011-02-23 11:40:30

Author:
Wojciech Niemiec

Constructor Summary
Setter(java.lang.String fieldName, java.lang.reflect.Method setterMethod)
          Creates a new Setter object with complete information.
 
Method Summary
 java.lang.String getFieldName()
          Name of the returned field name.
 java.lang.Class getFieldType()
          Gets the type of field.
 java.lang.reflect.Method getSetterMethod()
          Getter method.
 void invoke(java.lang.Object bean, java.lang.Object value)
          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

Setter

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

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

invoke

public void invoke(java.lang.Object bean,
                   java.lang.Object value)
            throws java.lang.IllegalAccessException,
                   java.lang.reflect.InvocationTargetException
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.
value - value of field.
Throws:
java.lang.IllegalAccessException - exception thrown for further processing.
java.lang.reflect.InvocationTargetException - exception thrown for further processing.

getFieldType

public java.lang.Class getFieldType()
Gets the type of field.

Returns:
type of object set by this setter method.

getFieldName

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

Returns:
name of the returned field name.

getSetterMethod

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

Returns:
getter method.


Copyright © 2011. All Rights Reserved.