net.sf.tie
Class ProxyInjector
java.lang.Object
net.sf.tie.ProxyInjector
- All Implemented Interfaces:
- InterceptionInjector
public class ProxyInjector
- extends Object
- implements InterceptionInjector
An implementation of InterceptionInjector
that uses Java dynamic proxies (Proxy
).
Method Summary |
boolean |
isWrapped(Object value)
Determines whether the supplied value is a wrapped value from this interceptor. |
|
wrapObject(Class<T> type,
T endPoint)
Wraps the designated object endPoint in any preconfigured MethodInterceptors . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ProxyInjector
public ProxyInjector(MethodInterceptorStack interceptors)
wrapObject
public <T> T wrapObject(Class<T> type,
T endPoint)
- Description copied from interface:
InterceptionInjector
- Wraps the designated object
endPoint
in any preconfigured MethodInterceptors
.
Returns an object O, such that if a method M is invoked on O, then the provided
interceptors
will be called, prior to an invocation of the original method M on endPoint
.
It is acceptable for implementations to return the endPoint
directly if there is no interception to perform, or if the
interception can be performed without constructing additional objects. However, it is typical for the return value to be a dynamically
created proxy around endPoint
.
- Specified by:
wrapObject
in interface InterceptionInjector
- Parameters:
type
- The java type (typically an interface) which the returned object should implement.- See Also:
ProxyInjector
isWrapped
public boolean isWrapped(Object value)
- Description copied from interface:
InterceptionInjector
- Determines whether the supplied
value
is a wrapped value from this interceptor.
NB: If value
has been wrapped multiple times, then only the injector
that performed the last wrapping is required to return true
. It is acceptible for all other
interceptors to return false
.
- Specified by:
isWrapped
in interface InterceptionInjector