net.sf.cglib.reflect

Class FastClass


public abstract class FastClass
extends java.lang.Object

Nested Class Summary

static class
FastClass.Generator

Method Summary

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()
int
hashCode()
Object
invoke(String name, Class[] parameterTypes, Object obj, Object[] args)
abstract Object
invoke(int index, Object obj, Object[] args)
Invoke the method with the specified index.
Object
newInstance()
Object
newInstance(Class[] parameterTypes, Object[] args)
abstract Object
newInstance(int index, Object[] args)
Create a new instance using the specified constructor index and arguments.
String
toString()

Method Details

create

public static FastClass create(Class type)

create

public static FastClass create(ClassLoader loader,
                               Class type)

equals

public boolean equals(Object o)

getConstructor

public FastConstructor getConstructor(Class[] parameterTypes)

getConstructor

public FastConstructor getConstructor(Constructor constructor)

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.

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 name
parameterTypes - the parameter array
Returns:
the index, or -1 if none is found.

getIndex

public abstract int getIndex(Signature sig)

getJavaClass

public Class getJavaClass()

getMaxIndex

public abstract int getMaxIndex()
Returns the maximum method index for this class.

getMethod

public FastMethod getMethod(Method method)

getMethod

public FastMethod getMethod(String name,
                            Class[] parameterTypes)

getName

public String getName()

hashCode

public int hashCode()

invoke

public Object invoke(String name,
                     Class[] parameterTypes,
                     Object obj,
                     Object[] args)
            throws InvocationTargetException

invoke

public abstract Object invoke(int index,
                              Object obj,
                              Object[] args)
            throws InvocationTargetException
Invoke the method with the specified index.
Parameters:
index - the method index
obj - the object the underlying method is invoked from
args - the arguments used for the method call
See Also:
getIndex(name, Class[])

newInstance

public Object newInstance()
            throws InvocationTargetException

newInstance

public Object newInstance(Class[] parameterTypes,
                          Object[] args)
            throws InvocationTargetException

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 index
args - the arguments passed to the constructor
See Also:
getIndex(Class[])

toString

public String toString()

Copyright (c) 2001 - Apache Software Foundation