Package net.sf.cglib.reflect
Class FastClass
- java.lang.Object
-
- net.sf.cglib.reflect.FastClass
-
public abstract class FastClass extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FastClass.Generator
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static FastClass
create(Class type)
static FastClass
create(ClassLoader loader, Class type)
boolean
equals(Object o)
FastConstructor
getConstructor(Class[] parameterTypes)
FastConstructor
getConstructor(Constructor constructor)
abstract int
getIndex(Class[] parameterTypes)
Return the index of the matching constructor.abstract int
getIndex(String name, Class[] parameterTypes)
Return the index of the matching method.abstract int
getIndex(Signature sig)
Class
getJavaClass()
abstract int
getMaxIndex()
Returns the maximum method index for this class.FastMethod
getMethod(Method method)
FastMethod
getMethod(String name, Class[] parameterTypes)
String
getName()
protected static String
getSignatureWithoutReturnType(String name, Class[] parameterTypes)
int
hashCode()
abstract Object
invoke(int index, Object obj, Object[] args)
Invoke the method with the specified index.Object
invoke(String name, Class[] parameterTypes, Object obj, Object[] args)
Object
newInstance()
abstract Object
newInstance(int index, Object[] args)
Create a new instance using the specified constructor index and arguments.Object
newInstance(Class[] parameterTypes, Object[] args)
String
toString()
-
-
-
Constructor Detail
-
FastClass
protected FastClass()
-
FastClass
protected FastClass(Class type)
-
-
Method Detail
-
create
public static FastClass create(ClassLoader loader, Class type)
-
invoke
public Object invoke(String name, Class[] parameterTypes, Object obj, Object[] args) throws InvocationTargetException
- Throws:
InvocationTargetException
-
newInstance
public Object newInstance() throws InvocationTargetException
- Throws:
InvocationTargetException
-
newInstance
public Object newInstance(Class[] parameterTypes, Object[] args) throws InvocationTargetException
- Throws:
InvocationTargetException
-
getMethod
public FastMethod getMethod(Method method)
-
getConstructor
public FastConstructor getConstructor(Constructor constructor)
-
getMethod
public FastMethod getMethod(String name, Class[] parameterTypes)
-
getConstructor
public FastConstructor getConstructor(Class[] parameterTypes)
-
getName
public String getName()
-
getJavaClass
public Class getJavaClass()
-
getIndex
public abstract int getIndex(String name, 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(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 Object invoke(int index, Object obj, Object[] args) throws 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:
InvocationTargetException
- if the underlying method throws an exception- See Also:
getIndex(name, Class[])
-
newInstance
public abstract Object newInstance(int index, Object[] args) throws InvocationTargetException
Create a new instance using the specified constructor index and arguments.- Parameters:
index
- the constructor indexargs
- the arguments passed to the constructor- Throws:
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.
-
-