net.sf.cglib.proxy
Interface Factory
All enhanced instances returned by the
Enhancer
class implement this interface.
Using this interface for new instances is faster than going through the
Enhancer
interface or using reflection. In addition, to intercept methods called during
object construction you
must use these methods instead of reflection.
$Id: Factory.java,v 1.13 2004/06/24 21:15:20 herbyderby Exp $ Callback | getCallback(int index) - Return the
Callback implementation at the specified index.
|
Callback[] | getCallbacks() - Get the current set of callbacks for ths object.
|
Object | newInstance(Class[] types, Object[] args, Callback[] callbacks) - Creates a new instance of the same type, using the constructor
matching the given signature.
|
Object | newInstance(Callback callback) - Creates new instance of the same type, using the no-arg constructor.
|
Object | newInstance(Callback[] callbacks) - Creates new instance of the same type, using the no-arg constructor.
|
void | setCallback(int index, Callback callback) - Set the callback for this object for the given type.
|
void | setCallbacks(Callback[] callbacks) - Replace all of the callbacks for this object at once.
|
getCallback
public Callback getCallback(int index)
Return the Callback
implementation at the specified index.
index
- the callback index
- the callback implementation
getCallbacks
public Callback[] getCallbacks()
Get the current set of callbacks for ths object.
newInstance
public Object newInstance(Class[] types,
Object[] args,
Callback[] callbacks)
Creates a new instance of the same type, using the constructor
matching the given signature.
types
- the constructor argument typesargs
- the constructor argumentscallbacks
- the new interceptor(s) to use
- new instance of the same type
newInstance
public Object newInstance(Callback callback)
Creates new instance of the same type, using the no-arg constructor.
The class of this object must have been created using a single Callback type.
If multiple callbacks are required an exception will be thrown.
callback
- the new interceptor to use
- new instance of the same type
newInstance
public Object newInstance(Callback[] callbacks)
Creates new instance of the same type, using the no-arg constructor.
callbacks
- the new callbacks(s) to use
- new instance of the same type
setCallback
public void setCallback(int index,
Callback callback)
Set the callback for this object for the given type.
index
- the callback index to replacecallback
- the new callback
setCallbacks
public void setCallbacks(Callback[] callbacks)
Replace all of the callbacks for this object at once.
callbacks
- the new callbacks(s) to use
Copyright (c) 2001 - Apache Software Foundation