public interface Factory
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.Modifier and Type | Method and Description |
---|---|
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(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.
|
Object |
newInstance(Class[] types,
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.
|
Object newInstance(Callback callback)
callback
- the new interceptor to useObject newInstance(Callback[] callbacks)
callbacks
- the new callbacks(s) to useObject newInstance(Class[] types, Object[] args, Callback[] callbacks)
types
- the constructor argument typesargs
- the constructor argumentscallbacks
- the new interceptor(s) to useCallback getCallback(int index)
Callback
implementation at the specified index.index
- the callback indexvoid setCallback(int index, Callback callback)
index
- the callback index to replacecallback
- the new callbackvoid setCallbacks(Callback[] callbacks)
callbacks
- the new callbacks(s) to useCallback[] getCallbacks()
Copyright © 2018. All rights reserved.