|
API Enhancements to the JavaBeansTM Component API in v1.4 |
JavaBeansTM Component API |
This document describes changes to the java.beans package that were introduced in version 1.4 of the Java 2 Platform, Standard Edition.To support long-term persistence, the following classes were added:
Class Description StatementAn object that represents a method call, possibly with arguments, upon an object. For example: a.setFoo(b).ExpressionA statement that returns a result. For example: a.getFoo().XMLDecoderReads XML documents that were created using XMLEncoder.EncoderUses persistence delegates to break an object graph down into a series of Statements andExpressions that can be used to recreate it.XMLEncoderAn Encoderthat produces statements and expressions in an XML encoding.PersistenceDelegateAn abstract class that defines objects that can express the state of another object using the public methods of that object's class. DefaultPersistenceDelegateThe persistence delegate used, by default, for beans. See JavaBeans Component API for links to where you can find more information about long-term persistence.
The following classes were also added in v1.4:
Class Description EventHandlerProvides support for dynamically generating event listeners that have a small footprint and can be saved automatically by the persistence scheme. ExceptionListenerDefines a listener to be notified when a exception was thrown but then recovered from. You can register an exception listener on an XMLEncoderorXMLDecoderobject to be notified when the object encounters a recoverable problem while writing or reading a bean.PropertyChangeListenerProxyA proxy that implements PropertyChangeListenerand serves to group anotherPropertyChangeListener(the real event handler) with a specific property; the proxy forwards property change events to the real event handler.VetoableChangeListenerProxyA proxy that implements VetoableChangeListenerand serves to group anotherVetoableChangeListener(the real event handler) with a specific constrained property; the proxy forwards vetoable property change events to the real event handler.The following classes have additional methods:
The
- The
PropertyChangeSupportclass now contains a no-argument method to get all the registered property change listeners:getPropertyChangeListeners.- Similarly, the
VetoableChangeSupportclass now contains a no-argument method to get all the registered vetoable change listeners:getVetoableChangeListeners.Introspectorclass has been reimplemented, and its performance has improved. The new implementation has caused the following changes in the behavior of the introspector:
FeatureDescriptors are now shared, rather than copied. This change cuts down on the space requirements ofBeanInfos. It also means that when a value in aPropertyDescriptorchanges, that change is perpetuated throughout theBeanInfo.
- The
getBeanInfomethods no longer create a copy of the requestedBeanInfo. Instead, they cache theBeanInfoand return it. If necessary, you can get the old behavior by storing a reference to the returnedBeanInfoand using theflushFromCachesmethod to flush the bean's class from the introspector's cache.
- If the
instantiatemethod can't instantiate a particular class using the sibling or bootstrap class loader, it now tries to load the class using the current thread's class loader.
|
Copyright © 2001 Sun Microsystems, Inc. All Rights Reserved. |
Java Software |