接口 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.- 作者:
- Juozas Baliuka baliuka@mwm.lt
-
方法概要
修饰符和类型方法说明getCallback(int index) Return theCallbackimplementation at the specified index.Callback[]Get the current set of callbacks for ths object.newInstance(Callback callback) Creates new instance of the same type, using the no-arg constructor.newInstance(Callback[] callbacks) Creates new instance of the same type, using the no-arg constructor.newInstance(Class<?>[] types, Object[] args, Callback[] callbacks) Creates a new instance of the same type, using the constructor matching the given signature.voidsetCallback(int index, Callback callback) Set the callback for this object for the given type.voidsetCallbacks(Callback[] callbacks) Replace all of the callbacks for this object at once.
-
方法详细资料
-
newInstance
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
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
-
newInstance
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
-
getCallback
Return theCallbackimplementation at the specified index.- 参数:
index- the callback index- 返回:
- the callback implementation
-
setCallback
Set the callback for this object for the given type.- 参数:
index- the callback index to replacecallback- the new callback
-
setCallbacks
Replace all of the callbacks for this object at once.- 参数:
callbacks- the new callbacks(s) to use
-
getCallbacks
Callback[] getCallbacks()Get the current set of callbacks for ths object.- 返回:
- a new array instance
-