com.iparelan.util.beans
Class BeanTools.PropertyChangeableProxyInvocationHandler<T extends PropertyChangeable>
java.lang.Object
com.iparelan.util.beans.BeanTools.PropertyChangeableProxyInvocationHandler<T>
- Type Parameters:
T
- The proxied JavaBean type.
- All Implemented Interfaces:
- PropertyChangeListener, InvocationHandler, EventListener
- Enclosing class:
- BeanTools
private static final class BeanTools.PropertyChangeableProxyInvocationHandler<T extends PropertyChangeable>
- extends Object
- implements InvocationHandler, PropertyChangeListener
An InvocationHandler
bound to a proxied bean. The InvocationHandler
intercepts PropertyChangeable
method invocations on the
bean as well as PropertyChangedEvent
s fired by the
bean.
PropertyChangeable
methods are intercepted and forwarded to
a proxied com.iparelan.util.beans.PropertyChangeSupport
. PropertyChangedEvent
s are re-fired to listeners. The re-fired events
appear to come from the proxy, not the proxied bean.
Note: Ordinarly, an InvocationHandler
may be bound to
several proxies. This InvocationHandler
is designed to be bound
to a single bean proxy and a single proxied PropertyChangeSupport
.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
enforceSingleInitializationDynamically
private final AtomicBoolean enforceSingleInitializationDynamically
proxiedBean
private final T extends PropertyChangeable proxiedBean
pcsProxy
private PropertyChangeSupport pcsProxy
proxy
private WeakReference<T extends PropertyChangeable> proxy
BeanTools.PropertyChangeableProxyInvocationHandler
BeanTools.PropertyChangeableProxyInvocationHandler(T proxiedBean)
setProxies
private void setProxies(T proxy,
PropertyChangeSupport pcsProxy)
- Code that would ideally be initalization code but cannot be due to
an ordering dependency. The proxy must be created with an
invocation handler, but the proxy is need by the invocation
handler. The order is: create the invocation handler, then create
the proxy, finally pass the proxy to the invocation handler with
this method.
- Parameters:
proxy
- The proxy for the bean.pcsProxy
- The com.iparelan.util.beans.PropertyChangeSupport
proxy for the bean.
propertyChange
public void propertyChange(PropertyChangeEvent evt)
- Specified by:
propertyChange
in interface PropertyChangeListener
invoke
public Object invoke(Object theProxy,
Method beanMethod,
Object[] args)
- Specified by:
invoke
in interface InvocationHandler
Copyright © 2008 Iparelan Solutions, LLC. All rights reserved.