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

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

public final class ConstructorHandlerByConstructor<T>
extends Object
implements ConstructorHandler<T>

This class is responsible for invoking a constructor provided.

Author:
jonasabreu

Constructor Summary
ConstructorHandlerByConstructor(ReflectionProvider provider, Class<T> clazz, Constructor<T> con)
           
 
Method Summary
 T bypasser()
          Instantiates an object without using the constructor.
 T withArgs(Object... args)
          Invoke a constructor using args as its arguments.
 T withoutArgs()
          Invoke a constructor without arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstructorHandlerByConstructor

public ConstructorHandlerByConstructor(ReflectionProvider provider,
                                       Class<T> clazz,
                                       Constructor<T> con)
Method Detail

withArgs

public T withArgs(Object... args)
Description copied from interface: ConstructorHandler
Invoke a constructor using args as its arguments.

Specified by:
withArgs in interface ConstructorHandler<T>
Parameters:
args - arguments to use when invoking this constructor.
Returns:
An instance of object this constructor can create.

withoutArgs

public T withoutArgs()
Description copied from interface: ConstructorHandler
Invoke a constructor without arguments.

Specified by:
withoutArgs in interface ConstructorHandler<T>
Returns:
An instance of object this constructor can create.

bypasser

public T bypasser()
Description copied from interface: ConstructorHandler
Instantiates an object without using the constructor. This is only supported for Objenesis supported VM. Please check http://code.google.com/p/objenesis/wiki/ListOfCurrentlySupportedVMs to see if your VM is supported.

Specified by:
bypasser in interface ConstructorHandler<T>
Returns:
An instance created without invoking any constructor.


Copyright © 2011 VidaGeek.net. All Rights Reserved.