|
J avolution v5.4 (J2SE 1.6+) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavolution.lang.Reflection.Constructor
public abstract class Reflection.Constructor
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.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));
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... args)
Invokes this constructor with the specified arguments. |
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 |
---|
protected Reflection.Constructor(java.lang.Class[] parameterTypes)
parameterTypes
- the parameters types.Method Detail |
---|
public java.lang.Class[] getParameterTypes()
Class
objects that represents
the formal parameter types, in declaration order of this constructor.
protected abstract java.lang.Object allocate(java.lang.Object[] args)
args
- the constructor arguments.
public final java.lang.Object newInstance()
java.lang.IllegalArgumentException
- if
this.getParametersTypes().length != 0
public final java.lang.Object newInstance(java.lang.Object arg0)
arg0
- the first argument.
java.lang.IllegalArgumentException
- if
this.getParametersTypes().length != 1
public final java.lang.Object newInstance(java.lang.Object arg0, java.lang.Object arg1)
arg0
- the first argument.arg1
- the second argument.
java.lang.IllegalArgumentException
- if
this.getParametersTypes().length != 2
public final java.lang.Object newInstance(java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2)
arg0
- the first argument.arg1
- the second argument.arg2
- the third argument.
java.lang.IllegalArgumentException
- if
this.getParametersTypes().length != 3
public final java.lang.Object newInstance(java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
arg0
- the first argument.arg1
- the second argument.arg2
- the third argument.arg3
- the fourth argument.
java.lang.IllegalArgumentException
- if
this.getParametersTypes().length != 4
public final java.lang.Object newInstance(java.lang.Object... args)
args
- the arguments.
java.lang.IllegalArgumentException
- if
this.getParametersTypes().length != args.length
|
J avolution v5.4 (J2SE 1.6+) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |