net.sf.cglib.proxy
Interface Factory


public 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.

Version:
$Id: Factory.java,v 1.11 2003/12/07 00:54:36 herbyderby Exp $
Author:
Juozas Baliuka baliuka@mwm.lt

Method Summary
 Callback getCallback(int index)
          Return the Callback implementation at the specified index.
 java.lang.Object newInstance()
          Creates new instance of the same type, using the no-arg contructor, and copying the callbacks from the existing instance.
 java.lang.Object newInstance(Callback callback)
          Creates new instance of the same type, using the no-arg constructor.
 java.lang.Object newInstance(Callback[] callbacks)
          Creates new instance of the same type, using the no-arg constructor.
 java.lang.Object newInstance(java.lang.Class[] type, java.lang.Object[] args)
          Creates a new instance of the same type, using the constructor matching the given signature, and copying the callbacks from the existing instance.
 java.lang.Object newInstance(java.lang.Class[] types, java.lang.Object[] args, Callback[] callbacks)
          Creates a new instance of the same type, using the constructor matching the given signature.
 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.
 

Method Detail

newInstance

public java.lang.Object newInstance()
Creates new instance of the same type, using the no-arg contructor, and copying the callbacks from the existing instance.

Returns:
new instance of the same type

newInstance

public java.lang.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.

Parameters:
callback - the new interceptor to use
Returns:
new instance of the same type

newInstance

public java.lang.Object newInstance(Callback[] callbacks)
Creates new instance of the same type, using the no-arg constructor.

Parameters:
callbacks - the new callbacks(s) to use
Returns:
new instance of the same type

newInstance

public java.lang.Object newInstance(java.lang.Class[] type,
                                    java.lang.Object[] args)
Creates a new instance of the same type, using the constructor matching the given signature, and copying the callbacks from the existing instance.

Parameters:
args - the constructor arguments
Returns:
new instance of the same type

newInstance

public java.lang.Object newInstance(java.lang.Class[] types,
                                    java.lang.Object[] args,
                                    Callback[] callbacks)
Creates a new instance of the same type, using the constructor matching the given signature.

Parameters:
types - the constructor argument types
args - the constructor arguments
callbacks - the new interceptor(s) to use
Returns:
new instance of the same type

getCallback

public Callback getCallback(int index)
Return the Callback implementation at the specified index.

Parameters:
index - the callback index
Returns:
the callback implementation

setCallback

public void setCallback(int index,
                        Callback callback)
Set the callback for this object for the given type.

Parameters:
index - the callback index to replace
callback - the new callback

setCallbacks

public void setCallbacks(Callback[] callbacks)
Replace all of the callbacks for this object at once.

Parameters:
callbacks - the new callbacks(s) to use


Copyright © 2002-2003 cglib. All Rights Reserved.