com.iparelan.util.beans
Class BeanTools
java.lang.Object
com.iparelan.util.UtilObject
com.iparelan.util.beans.BeanTools
@Copyright(value="Copyright © 2008, Iparelan Solutions, LLC. All rights reserved.")
public final class BeanTools
- extends UtilObject
This utility class contains JavaBeans
convenience
algorithms.
- Version:
- July 2008
- Author:
- Greg Mattes
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NON_NULL_PROPERTY_CHANGE_EVENT_VALIDATOR
public static final ValidationStrategy<PropertyChangeEvent> NON_NULL_PROPERTY_CHANGE_EVENT_VALIDATOR
- A
pre-fabricated validator
for PropertyChangeEvent
s.
BeanTools
public BeanTools()
newPropertyChangeableProxy
public static <T extends PropertyChangeable> T newPropertyChangeableProxy(T bean,
PropertyChangeSupportFactory pcsFactory)
- Produces a dynamic proxy for a
PropertyChangeable
that intercepts PropertyChangeable
method invocations and forwards them to a proxy
PropertyChangeSupport
.
This proxy makes it possible to override the behavior of the PropertyChangeSupport
embedded in bean
. For example, suppose
that it is required that all PropertyChangeEvent
s
are executed on the AWT/Swing Event Dispatch Thread (EDT). This proxy
can enforce such a policy if pcsFactory
creates PropertyChangeSupport
that dispatches PropertyChangeEvent
s on
the EDT.
- Parameters:
bean
- The JavaBean for which a dynamic proxy is created. May not be
null
.pcsFactory
- The PropertyChangeSupportFactory
that produces a PropertyChangeSupport
with desirable
behaviors. May not be null
.
- Returns:
- A dynamic proxy for
bean
that overrides embedded PropertyChangeSupport
behavior with the behavior of a PropertyChangeSupport
created with pcsFactory
. Never
null
.
- Throws:
ValidationException
- Iff proxyType
is neither a class, nor an interface.
IllegalArgumentException
- Iff a valid proxy cannot be created. See the documentation for
Proxy
for more details.
Copyright © 2008 Iparelan Solutions, LLC. All rights reserved.