org.logicalcobwebs.cglib.reflect
Class FastClass
java.lang.Object
org.logicalcobwebs.cglib.reflect.FastClass
public abstract class FastClass
- extends java.lang.Object
Field Summary |
private java.lang.Class |
type
|
Constructor Summary |
protected |
FastClass(java.lang.Class type)
|
Method Summary |
static FastClass |
create(java.lang.Class type)
|
boolean |
equals(java.lang.Object o)
|
FastConstructor |
getConstructor(java.lang.Class[] parameterTypes)
|
FastConstructor |
getConstructor(java.lang.reflect.Constructor constructor)
|
abstract int |
getIndex(java.lang.Class[] parameterTypes)
Return the index of the matching constructor. |
abstract int |
getIndex(Signature sig)
|
abstract int |
getIndex(java.lang.String name,
java.lang.Class[] parameterTypes)
Return the index of the matching method. |
java.lang.Class |
getJavaClass()
|
abstract int |
getMaxIndex()
Returns the maximum method index for this class. |
FastMethod |
getMethod(java.lang.reflect.Method method)
|
FastMethod |
getMethod(java.lang.String name,
java.lang.Class[] parameterTypes)
|
java.lang.String |
getName()
|
protected static java.lang.String |
getSignatureWithoutReturnType(java.lang.String name,
java.lang.Class[] parameterTypes)
|
int |
hashCode()
|
abstract java.lang.Object |
invoke(int index,
java.lang.Object obj,
java.lang.Object[] args)
Invoke the method with the specified index. |
java.lang.Object |
invoke(java.lang.String name,
java.lang.Class[] parameterTypes,
java.lang.Object obj,
java.lang.Object[] args)
|
java.lang.Object |
newInstance()
|
java.lang.Object |
newInstance(java.lang.Class[] parameterTypes,
java.lang.Object[] args)
|
abstract java.lang.Object |
newInstance(int index,
java.lang.Object[] args)
Create a new instance using the specified constructor index and arguments. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
type
private java.lang.Class type
FastClass
protected FastClass(java.lang.Class type)
create
public static FastClass create(java.lang.Class type)
invoke
public java.lang.Object invoke(java.lang.String name,
java.lang.Class[] parameterTypes,
java.lang.Object obj,
java.lang.Object[] args)
throws java.lang.reflect.InvocationTargetException
- Throws:
java.lang.reflect.InvocationTargetException
newInstance
public java.lang.Object newInstance()
throws java.lang.reflect.InvocationTargetException
- Throws:
java.lang.reflect.InvocationTargetException
newInstance
public java.lang.Object newInstance(java.lang.Class[] parameterTypes,
java.lang.Object[] args)
throws java.lang.reflect.InvocationTargetException
- Throws:
java.lang.reflect.InvocationTargetException
getMethod
public FastMethod getMethod(java.lang.reflect.Method method)
getConstructor
public FastConstructor getConstructor(java.lang.reflect.Constructor constructor)
getMethod
public FastMethod getMethod(java.lang.String name,
java.lang.Class[] parameterTypes)
getConstructor
public FastConstructor getConstructor(java.lang.Class[] parameterTypes)
getName
public java.lang.String getName()
getJavaClass
public java.lang.Class getJavaClass()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in class java.lang.Object
getIndex
public abstract int getIndex(java.lang.String name,
java.lang.Class[] parameterTypes)
- Return the index of the matching method. The index may be used
later to invoke the method with less overhead. If more than one
method matches (i.e. they differ by return type only), one is
chosen arbitrarily.
- Parameters:
name
- the method nameparameterTypes
- the parameter array
- Returns:
- the index, or
-1
if none is found. - See Also:
invoke(int, Object, Object[])
getIndex
public abstract int getIndex(java.lang.Class[] parameterTypes)
- Return the index of the matching constructor. The index may be used
later to create a new instance with less overhead.
- Parameters:
parameterTypes
- the parameter array
- Returns:
- the constructor index, or
-1
if none is found. - See Also:
newInstance(int, Object[])
invoke
public abstract java.lang.Object invoke(int index,
java.lang.Object obj,
java.lang.Object[] args)
throws java.lang.reflect.InvocationTargetException
- Invoke the method with the specified index.
- Parameters:
index
- the method indexobj
- the object the underlying method is invoked fromargs
- the arguments used for the method call
- Throws:
java.lang.reflect.InvocationTargetException
- if the underlying method throws an exception- See Also:
getIndex(name, Class[])
newInstance
public abstract java.lang.Object newInstance(int index,
java.lang.Object[] args)
throws java.lang.reflect.InvocationTargetException
- Create a new instance using the specified constructor index and arguments.
- Parameters:
index
- the constructor indexargs
- the arguments passed to the constructor
- Throws:
java.lang.reflect.InvocationTargetException
- if the constructor throws an exception- See Also:
getIndex(Class[])
getIndex
public abstract int getIndex(Signature sig)
getMaxIndex
public abstract int getMaxIndex()
- Returns the maximum method index for this class.
getSignatureWithoutReturnType
protected static java.lang.String getSignatureWithoutReturnType(java.lang.String name,
java.lang.Class[] parameterTypes)