net.vidageek.mirror.invoke
Class DefaultInvocationHandler<T>

java.lang.Object
  extended by net.vidageek.mirror.invoke.DefaultInvocationHandler<T>
All Implemented Interfaces:
InvocationHandler<T>

public final class DefaultInvocationHandler<T>
extends Object
implements InvocationHandler<T>

This class is responsible for choosing between invocation of constructor or methods.

Author:
jonasabreu

Constructor Summary
DefaultInvocationHandler(ReflectionProvider provider, Class<T> target)
           
DefaultInvocationHandler(ReflectionProvider provider, Object target)
           
 
Method Summary
 ConstructorHandler<T> constructor()
          Use this method to invoke a constructor using only arguments.
<C> ConstructorHandler<C>
constructor(Constructor<C> con)
          Use this method to invoke a constructor using its instance.
 Object getterFor(Field field)
          This is a convenience method for invoking getters that follow JavaBean notation
 Object getterFor(String fieldName)
          This is a convenience method for invoking getters that follow JavaBean notation
 MethodHandler method(Method method)
          Use this method to invoke a method using its instance.
 MethodHandler method(String methodName)
          Use this method to invoke a method by its name.
 SetterMethodHandler setterFor(Field field)
          This is a convenience method for invoking setters that follow JavaBean notation
 SetterMethodHandler setterFor(String fieldName)
          This is a convenience method for invoking setters that follow JavaBean notation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultInvocationHandler

public DefaultInvocationHandler(ReflectionProvider provider,
                                Object target)

DefaultInvocationHandler

public DefaultInvocationHandler(ReflectionProvider provider,
                                Class<T> target)
Method Detail

method

public MethodHandler method(String methodName)
Description copied from interface: InvocationHandler
Use this method to invoke a method by its name.

Specified by:
method in interface InvocationHandler<T>
Parameters:
methodName - name of the method to be invoked.
Returns:
An object responsible for method invocation.

constructor

public ConstructorHandler<T> constructor()
Description copied from interface: InvocationHandler
Use this method to invoke a constructor using only arguments.

Specified by:
constructor in interface InvocationHandler<T>
Returns:
An object responsible by constructor invocation.

method

public MethodHandler method(Method method)
Description copied from interface: InvocationHandler
Use this method to invoke a method using its instance.

Specified by:
method in interface InvocationHandler<T>
Parameters:
method - Method to be invoked.
Returns:
An object responsible for method invocation.

constructor

public <C> ConstructorHandler<C> constructor(Constructor<C> con)
Description copied from interface: InvocationHandler
Use this method to invoke a constructor using its instance.

Specified by:
constructor in interface InvocationHandler<T>
Parameters:
con - Constructor to be invoked.
Returns:
An object responsible for constructor invocation.

getterFor

public Object getterFor(String fieldName)
Description copied from interface: InvocationHandler
This is a convenience method for invoking getters that follow JavaBean notation

Specified by:
getterFor in interface InvocationHandler<T>
Returns:
Value of the field fieldName

getterFor

public Object getterFor(Field field)
Description copied from interface: InvocationHandler
This is a convenience method for invoking getters that follow JavaBean notation

Specified by:
getterFor in interface InvocationHandler<T>
Parameters:
field - field associated with the getter
Returns:
Value of the field fieldName

setterFor

public SetterMethodHandler setterFor(String fieldName)
Description copied from interface: InvocationHandler
This is a convenience method for invoking setters that follow JavaBean notation

Specified by:
setterFor in interface InvocationHandler<T>
Returns:
An object responsible for setting values

setterFor

public SetterMethodHandler setterFor(Field field)
Description copied from interface: InvocationHandler
This is a convenience method for invoking setters that follow JavaBean notation

Specified by:
setterFor in interface InvocationHandler<T>
Returns:
An object responsible for setting values


Copyright © 2011 VidaGeek.net. All Rights Reserved.