org.wamblee.reflection
Class FieldAccessor<T>

java.lang.Object
  extended by org.wamblee.reflection.FieldAccessor<T>
Type Parameters:
T - Type of the field.
All Implemented Interfaces:
Accessor<T>

public class FieldAccessor<T>
extends Object
implements Accessor<T>

Utility for interfacing to a field of an object.

Author:
Erik Brakkee

Constructor Summary
FieldAccessor(Field aField)
          Constructs the accessor.
 
Method Summary
 T get(Object aEntity)
          Gets the value.
 Field getField()
          Gets the field.
 Class<T> getType()
          Gets the type of the value.
 void set(Object aEntity, T aValue)
          Sets the value.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FieldAccessor

public FieldAccessor(Field aField)
Constructs the accessor.

Parameters:
aField - Field.
Method Detail

get

public T get(Object aEntity)
Description copied from interface: Accessor
Gets the value.

Specified by:
get in interface Accessor<T>
Parameters:
aEntity - Object
Returns:
Value

set

public void set(Object aEntity,
                T aValue)
Description copied from interface: Accessor
Sets the value.

Specified by:
set in interface Accessor<T>
Parameters:
aEntity - Object.
aValue - Value.

getField

public Field getField()
Gets the field.

Returns:
Field.

getType

public Class<T> getType()
Description copied from interface: Accessor
Gets the type of the value.

Specified by:
getType in interface Accessor<T>
Returns:

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.