intarsys runtime library

de.intarsys.tools.reflect
Class PojoReflector

java.lang.Object
  extended by de.intarsys.tools.reflect.PojoReflector
All Implemented Interfaces:
IAccessSupport, IInvocationSupport

public class PojoReflector
extends Object
implements IAccessSupport, IInvocationSupport

A POJO wrapper for the ease of reflective access.


Constructor Summary
PojoReflector(Object target)
           
 
Method Summary
 Object getPojo()
           
 Object getValue(String name)
          Make a reflective get access to the field name.
 Object invoke(String name, IArgs args)
          Make a reflective call to the method name.
 Object setValue(String name, Object value)
          Make a reflective set access to the field name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PojoReflector

public PojoReflector(Object target)
Method Detail

getPojo

public Object getPojo()

getValue

public Object getValue(String name)
                throws FieldException
Description copied from interface: IAccessSupport
Make a reflective get access to the field name.

Specified by:
getValue in interface IAccessSupport
Parameters:
name - The name of the field to get.
Returns:
The field value
Throws:
FieldException

invoke

public Object invoke(String name,
                     IArgs args)
              throws MethodException
Description copied from interface: IInvocationSupport
Make a reflective call to the method name.

Specified by:
invoke in interface IInvocationSupport
Parameters:
name - The name of the method to call.
args - The arguments for the invocation.
Returns:
The result of the invocation.
Throws:
MethodException

setValue

public Object setValue(String name,
                       Object value)
                throws FieldException
Description copied from interface: IAccessSupport
Make a reflective set access to the field name.

Specified by:
setValue in interface IAccessSupport
Parameters:
name - The name of the field to get.
value - The new value for the field
Returns:
The previous field value. This is an optional feature.
Throws:
FieldException

intarsys runtime library

Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.