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 classFastClass.Generator
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Classtype
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static FastClasscreate(java.lang.Class type)static FastClasscreate(java.lang.ClassLoader loader, java.lang.Class type)booleanequals(java.lang.Object o)FastConstructorgetConstructor(java.lang.Class[] parameterTypes)FastConstructorgetConstructor(java.lang.reflect.Constructor constructor)abstract intgetIndex(java.lang.Class[] parameterTypes)Return the index of the matching constructor.abstract intgetIndex(java.lang.String name, java.lang.Class[] parameterTypes)Return the index of the matching method.abstract intgetIndex(Signature sig)java.lang.ClassgetJavaClass()abstract intgetMaxIndex()Returns the maximum method index for this class.FastMethodgetMethod(java.lang.reflect.Method method)FastMethodgetMethod(java.lang.String name, java.lang.Class[] parameterTypes)java.lang.StringgetName()protected static java.lang.StringgetSignatureWithoutReturnType(java.lang.String name, java.lang.Class[] parameterTypes)inthashCode()abstract java.lang.Objectinvoke(int index, java.lang.Object obj, java.lang.Object[] args)Invoke the method with the specified index.java.lang.Objectinvoke(java.lang.String name, java.lang.Class[] parameterTypes, java.lang.Object obj, java.lang.Object[] args)java.lang.ObjectnewInstance()abstract java.lang.ObjectnewInstance(int index, java.lang.Object[] args)Create a new instance using the specified constructor index and arguments.java.lang.ObjectnewInstance(java.lang.Class[] parameterTypes, java.lang.Object[] args)java.lang.StringtoString()
-
-
-
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:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin 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
-1if 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
-1if 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.InvocationTargetExceptionInvoke 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.InvocationTargetExceptionCreate 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)
-
-