Package net.sf.cglib.reflect
Class FastClass
- java.lang.Object
-
- net.sf.cglib.reflect.FastClass
-
public abstract class FastClass extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FastClass.Generator
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class
type
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static FastClass
create(java.lang.Class type)
static FastClass
create(java.lang.ClassLoader loader, 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(java.lang.String name, java.lang.Class[] parameterTypes)
Return the index of the matching method.abstract int
getIndex(Signature sig)
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()
abstract java.lang.Object
newInstance(int index, java.lang.Object[] args)
Create a new instance using the specified constructor index and arguments.java.lang.Object
newInstance(java.lang.Class[] parameterTypes, java.lang.Object[] args)
java.lang.String
toString()
-
-
-
Method Detail
-
create
public static FastClass create(java.lang.Class type)
-
create
public static FastClass create(java.lang.ClassLoader loader, 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 classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.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(java.lang.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)
-
-