javolution.lang
Interface Reflection.Constructor

Enclosing class:
Reflection

public static interface Reflection.Constructor

This interface represents a run-time constructor obtained through reflection. Here are few examples of utilization:

 // Default constructor (fastList = new FastList())
 Reflection.Constructor fastListConstructor
     = Reflection.getInstance().getConstructor("javolution.util.FastList()");
 Object fastList = fastListConstructor.newInstance();

 // Constructor with arguments (fastMap = new FastMap(64))
 Reflection.Constructor fastMapConstructor
     = Reflection.getInstance().getConstructor("javolution.util.FastMap(int)");
 Object fastMap = fastMapConstructor.newInstance(new Integer(64));
 


Method Summary
 Class[] getParameterTypes()
          Returns an array of Class objects that represents the formal parameter types, in declaration order of this constructor.
 Object newInstance()
          Invokes this constructor with no argument.
 Object newInstance(Object... args)
          Invokes this constructor with the specified arguments.
 Object newInstance(Object arg0)
          Invokes this constructor with the specified single argument.
 Object newInstance(Object arg0, Object arg1)
          Invokes this constructor with the specified two arguments.
 Object newInstance(Object arg0, Object arg1, Object arg2)
          Invokes this constructor with the specified three arguments.
 

Method Detail

getParameterTypes

Class[] getParameterTypes()
Returns an array of Class objects that represents the formal parameter types, in declaration order of this constructor.

Returns:
the parameter types for this constructor.

newInstance

Object newInstance()
Invokes this constructor with no argument.

Returns:
the object being instantiated.
Throws:
IllegalArgumentException - if this.getParametersTypes().length != 0

newInstance

Object newInstance(Object arg0)
Invokes this constructor with the specified single argument.

Parameters:
arg0 - the first argument.
Returns:
the object being instantiated.
Throws:
IllegalArgumentException - if this.getParametersTypes().length != 1

newInstance

Object newInstance(Object arg0,
                   Object arg1)
Invokes this constructor with the specified two arguments.

Parameters:
arg0 - the first argument.
arg1 - the second argument.
Returns:
the object being instantiated.
Throws:
IllegalArgumentException - if this.getParametersTypes().length != 2

newInstance

Object newInstance(Object arg0,
                   Object arg1,
                   Object arg2)
Invokes this constructor with the specified three arguments.

Parameters:
arg0 - the first argument.
arg1 - the second argument.
arg2 - the third argument.
Returns:
the object being instantiated.
Throws:
IllegalArgumentException - if this.getParametersTypes().length != 3

newInstance

Object newInstance(Object... args)
Invokes this constructor with the specified arguments.

Parameters:
args - the arguments.
Returns:
the object being instantiated.
Throws:
IllegalArgumentException - if this.getParametersTypes().length != args.length


Copyright © 2005-2012 Javolution. All Rights Reserved.