J avolution v5.2 (J2SE 1.5+)

javolution.lang
Class Reflection.Constructor

java.lang.Object
  extended by javolution.lang.Reflection.Constructor
Enclosing class:
Reflection

public abstract static class Reflection.Constructor
extends java.lang.Object

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

 // Default constructor (fastList = new FastList())
 Reflection.Constructor fastListConstructor 
     = Reflection.getConstructor("javolution.util.FastList()");
 Object fastList = fastListConstructor.newInstance();
 
 // Constructor with arguments (fastMap = new FastMap(64))
 Reflection.Constructor fastMapConstructor 
     = Reflection.getConstructor("javolution.util.FastMap(int)");
 Object fastMap = fastMapConstructor.newInstance(new Integer(64));
 


Constructor Summary
protected Reflection.Constructor(java.lang.Class[] parameterTypes)
          Creates a new constructor having the specified parameter types.
 
Method Summary
protected abstract  java.lang.Object allocate(java.lang.Object[] args)
          Allocates a new object using this constructor with the specified arguments.
 java.lang.Class[] getParameterTypes()
          Returns an array of Class objects that represents the formal parameter types, in declaration order of this constructor.
 java.lang.Object newInstance()
          Invokes this constructor with no argument (convenience method).
 java.lang.Object newInstance(java.lang.Object arg0)
          Invokes this constructor with the specified single argument.
 java.lang.Object newInstance(java.lang.Object arg0, java.lang.Object arg1)
          Invokes this constructor with the specified two arguments.
 java.lang.Object newInstance(java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2)
          Invokes this constructor with the specified three arguments.
 java.lang.Object newInstance(java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
          Invokes this constructor with the specified four arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reflection.Constructor

protected Reflection.Constructor(java.lang.Class[] parameterTypes)
Creates a new constructor having the specified parameter types.

Parameters:
parameterTypes - the parameters types.
Method Detail

getParameterTypes

public java.lang.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.

allocate

protected abstract java.lang.Object allocate(java.lang.Object[] args)
Allocates a new object using this constructor with the specified arguments.

Parameters:
args - the constructor arguments.
Returns:
the object being instantiated.

newInstance

public final java.lang.Object newInstance()
Invokes this constructor with no argument (convenience method).

Returns:
the object being instantiated.

newInstance

public final java.lang.Object newInstance(java.lang.Object arg0)
Invokes this constructor with the specified single argument.

Parameters:
arg0 - the first argument.
Returns:
the object being instantiated.

newInstance

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

Parameters:
arg0 - the first argument.
arg1 - the second argument.
Returns:
the object being instantiated.

newInstance

public final java.lang.Object newInstance(java.lang.Object arg0,
                                          java.lang.Object arg1,
                                          java.lang.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.

newInstance

public final java.lang.Object newInstance(java.lang.Object arg0,
                                          java.lang.Object arg1,
                                          java.lang.Object arg2,
                                          java.lang.Object arg3)
Invokes this constructor with the specified four arguments.

Parameters:
arg0 - the first argument.
arg1 - the second argument.
arg2 - the third argument.
arg3 - the fourth argument.
Returns:
the object being instantiated.

J avolution v5.2 (J2SE 1.5+)

Copyright © 2005 - 2007 Javolution.