public class DelegateInvocationHandler<T> extends Object implements InvocationHandler
snapshot(Object) and #cement(Object) in here, which serves different purposes:
snapshot(Object): acquire the actual delegate at this particular point in time, pulling it out
from the proxy and using it directly. This is used for acquiring a snapshot and keep using that particular
instance, even if a new delegate is assigned for this handler.#cement(Object): acquire a proxy that will have its delegate assigned the next call to
setDelegate(Object). This is useful if one DelegateInvocationHandler depends on
another which will have its delegate set later than this one.| Constructor and Description |
|---|
DelegateInvocationHandler(Class<T> interfaceClass) |
| Modifier and Type | Method and Description |
|---|---|
T |
cement()
Cements this delegate, i.e.
|
void |
harden()
Updates
cemented delegates with the current delegate, making it concrete. |
Object |
invoke(Object proxy,
Method method,
Object[] args) |
void |
setDelegate(T delegate)
Updates the delegate for this handler, also
hardens instances
cemented from the last call to setDelegate(Object). |
static <T> T |
snapshot(T proxiedInstance)
Takes a snapshot of the current delegate and returns that.
|
String |
toString() |
public void setDelegate(T delegate)
hardens instances
cemented from the last call to setDelegate(Object).
This call will also dereference the Concrete, such that future calls to harden()
cannot affect any reference received from cement() prior to this call.delegate - the new delegate to set.public void harden()
cemented delegates with the current delegate, making it concrete.
Callers of #cement(Object) in between this call and the previous call to setDelegate(Object)
will see the current delegate.public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke in interface InvocationHandlerThrowablepublic T cement()
public static <T> T snapshot(T proxiedInstance)
Copyright © 2002–2015 The Neo4j Graph Database Project. All rights reserved.