net.sf.cglib
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.

Version:
$Id: Factory.java,v 1.13 2003/10/15 05:27:02 herbyderby Exp $
Author:
Juozas Baliuka baliuka@mwm.lt

Method Summary
 Callback getCallback(int type)
          Returns the current callback in use for the given type;
 Factory newInstance(Callback callback)
          Creates new instance of the same type, using the no-arg constructor.
 Factory newInstance(Callbacks callbacks)
          Creates new instance of the same type, using the no-arg constructor.
 Factory newInstance(java.lang.Class[] types, java.lang.Object[] args, Callbacks callbacks)
          Creates a new instance of the same type, using the constructor matching the given signature.
 void setCallback(int type, Callback callback)
          Set the callback for this object for the given type.
 void setCallbacks(Callbacks callbacks)
          Replace all of the callbacks for this object at once.
 

Method Detail

newInstance

public Factory 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 (or none). If multiple callbacks are required an exception will be thrown.

Parameters:
callback - the new interceptor to use
Returns:
new instance of the same type
See Also:
newInstance(Callbacks)

newInstance

public Factory newInstance(Callbacks 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 Factory newInstance(java.lang.Class[] types,
                           java.lang.Object[] args,
                           Callbacks 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 type)
Returns the current callback in use for the given type;

Parameters:
type - the callback type
See Also:
Callbacks

setCallback

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

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

setCallbacks

public void setCallbacks(Callbacks 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.