- All Implemented Interfaces:
- BeanContext,- BeanContextChild,- BeanContextServiceRevokedListener,- BeanContextServicesListener,- DesignMode,- PropertyChangeListener,- VetoableChangeListener,- Visibility,- Serializable,- Iterable,- Collection,- EventListener
- Direct Known Subclasses:
- BeanContextServicesSupport
Since this class directly implements the BeanContext interface, the class can, and is intended to be used either by subclassing this implementation, or via ad-hoc delegation of an instance of this class from another.
- Since:
- 1.2
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classA protected nested class containing per-child information in thechildrenhashtable.protected static final classprotected final subclass that encapsulates an iterator but implements a noop remove() method.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected ArrayList<BeanContextMembershipListener> all accesses to theprotected ArrayList bcmListenersfield shall be synchronized on that object.protected HashMap<Object, BeanContextSupport.BCSChild> all accesses to theprotected HashMap childrenfield shall be synchronized on that object.protected booleanAbooleanindicating whether or not this object is currently in design time mode.protected LocaleThe current locale of this BeanContext.protected booleanAbooleanindicating if this instance may now render a GUI.Fields declared in class java.beans.beancontext.BeanContextChildSupportbeanContext, beanContextChildPeer, pcSupport, rejectedSetBCOnce, vcSupportFields declared in interface java.beans.beancontext.BeanContextglobalHierarchyLockFields declared in interface java.beans.DesignModePROPERTYNAME
- 
Constructor SummaryConstructorsConstructorDescriptionCreate an instance that is not a delegate of another objectCreate an instance using with a default localeBeanContextSupport(BeanContext peer, Locale lcle) Create an instance using the specified localeBeanContextSupport(BeanContext peer, Locale lcle, boolean dtime) Create an instance using the specified Locale and design mode.BeanContextSupport(BeanContext peer, Locale lcle, boolean dTime, boolean visible) Construct a BeanContextSupport instance
- 
Method SummaryModifier and TypeMethodDescriptionbooleanAdds/nests a child within thisBeanContext.booleanaddAll(Collection c) add Collection to set of Children (Unsupported) implementations must synchronized on the hierarchy lock and "children" protected fieldvoidAdds a BeanContextMembershipListenerbooleanUsed to determine if theBeanContextchild is avoiding using its GUI.protected Iterator<BeanContextSupport.BCSChild> Returns an iterator of all children of thisBeanContext.protected voidcalled by readObject after defaultReadObject() but prior to deserialization of any children.protected voidcalled by writeObject after defaultWriteObject() but prior to serialization of currently serializable children.protected voidchildDeserializedHook(Object child, BeanContextSupport.BCSChild bcsc) Called by readObject with the newly deserialized child and BCSChild.protected voidchildJustAddedHook(Object child, BeanContextSupport.BCSChild bcsc) subclasses may override this method to simply extend add() semantics after the child has been added and before the event notification has occurred.protected voidchildJustRemovedHook(Object child, BeanContextSupport.BCSChild bcsc) subclasses may override this method to simply extend remove() semantics after the child has been removed and before the event notification has occurred.protected static final booleanclassEquals(Class<?> first, Class<?> second) Tests to see if two class objects, or their names are equal.voidclear()clear the children (Unsupported) implementations must synchronized on the hierarchy lock and "children" protected fieldbooleanDetermines whether or not the specified object is currently a child of thisBeanContext.booleanTests to see if all objects in the specifiedCollectionare children of thisBeanContext.booleanDetermines whether or not the specified object is currently a child of thisBeanContext.protected final Object[]Gets a copy of the this BeanContext's children.protected BeanContextSupport.BCSChildcreateBCSChild(Object targetChild, Object peer) Subclasses can override this method to insert their own subclass of Child without having to override add() or the other Collection methods that add children to the set.protected final voiddeserialize(ObjectInputStream ois, Collection coll) used by readObject to deserialize a collection.voidnotify this instance that it may no longer render a GUI.protected final voidFire a BeanContextshipEvent on the BeanContextMembershipListener interfaceprotected final voidFire a BeanContextshipEvent on the BeanContextMembershipListener interfaceGets the instance ofBeanContextthat this object is providing the implementation for.protected static final BeanContextChildgetChildBeanContextChild(Object child) Gets the BeanContextChild (if any) of the specified childprotected static final BeanContextMembershipListenerGets the BeanContextMembershipListener (if any) of the specified childprotected static final PropertyChangeListenerGets the PropertyChangeListener (if any) of the specified childprotected static final SerializablegetChildSerializable(Object child) Gets the Serializable (if any) associated with the specified Childprotected static final VetoableChangeListenerGets the VetoableChangeListener (if any) of the specified childprotected static final VisibilitygetChildVisibility(Object child) Gets the Component (if any) associated with the specified child.Gets the locale for thisBeanContext.getResource(String name, BeanContextChild bcc) Analogous tojava.lang.ClassLoader.getResource(), this method allows aBeanContextimplementation to interpose behavior between the childComponentand underlyingClassLoader.getResourceAsStream(String name, BeanContextChild bcc) Analogous tojava.lang.ClassLoader.getResourceAsStream(), this method allows aBeanContextimplementation to interpose behavior between the childComponentand underlyingClassLoader.protected voidprotected method called from constructor and readObject to initialize transient state of BeanContextSupport instance.instantiateChild(String beanName) The instantiateChild method is a convenience hook in BeanContext to simplify the task of instantiating a Bean, nested, into aBeanContext.booleanReports whether or not this object is in currently in design time mode.booleanisEmpty()Reports whether or not thisBeanContextis empty.booleanIs thisBeanContextin the process of being serialized?iterator()Gets all JavaBean orBeanContextinstances currently nested in thisBeanContext.booleanneedsGui()This method is typically called from the environment in order to determine if the implementor "needs" a GUI.voidNotify this instance that it may now render a GUIvoidsubclasses may envelope to monitor child property changes.final voidWhen an instance of this class is used as a delegate for the implementation of the BeanContext protocols (and its subprotocols) there exists a 'chicken and egg' problem during deserializationbooleanRemoves a child from this BeanContext.protected booleaninternal remove used when removal caused by unexpectedsetBeanContextor byremove()invocation.booleanremove all specified children (Unsupported) implementations must synchronized on the hierarchy lock and "children" protected fieldvoidRemoves a BeanContextMembershipListenerbooleanretain only specified children (Unsupported) implementations must synchronized on the hierarchy lock and "children" protected fieldprotected final voidserialize(ObjectOutputStream oos, Collection<?> coll) Used by writeObject to serialize a Collection.voidsetDesignTime(boolean dTime) Sets the new design time value for thisBeanContext.voidSets the locale of this BeanContext.intsize()Gets the number of children currently nested in this BeanContext.Object[]toArray()Gets all JavaBean orBeanContextinstances currently nested in this BeanContext.Object[]Gets an array containing all children of thisBeanContextthat match the types contained in arry.protected booleanvalidatePendingAdd(Object targetChild) Subclasses of this class may override, or envelope, this method to add validation behavior for the BeanContext to examine child objects immediately prior to their being added to the BeanContext.protected booleanvalidatePendingRemove(Object targetChild) Subclasses of this class may override, or envelope, this method to add validation behavior for the BeanContext to examine child objects immediately prior to their being removed from the BeanContext.voidsubclasses may envelope to monitor veto child property changes.final voidUsed to serialize all children of thisBeanContext.Methods declared in class java.beans.beancontext.BeanContextChildSupportaddPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, initializeBeanContextResources, isDelegated, releaseBeanContextResources, removePropertyChangeListener, removeVetoableChangeListener, serviceAvailable, serviceRevoked, setBeanContext, validatePendingSetBeanContextMethods declared in class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods declared in interface java.beans.beancontext.BeanContextChildaddPropertyChangeListener, addVetoableChangeListener, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContextMethods declared in interface java.util.Collectionequals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
- 
Field Details- 
childrenall accesses to theprotected HashMap childrenfield shall be synchronized on that object.
- 
bcmListenersall accesses to theprotected ArrayList bcmListenersfield shall be synchronized on that object.
- 
localeThe current locale of this BeanContext.
- 
okToUseGuiprotected boolean okToUseGuiAbooleanindicating if this instance may now render a GUI.
- 
designTimeprotected boolean designTimeAbooleanindicating whether or not this object is currently in design time mode.
 
- 
- 
Constructor Details- 
BeanContextSupportConstruct a BeanContextSupport instance- Parameters:
- peer- The peer- BeanContextwe are supplying an implementation for, or- nullif this object is its own peer
- lcle- The current Locale for this BeanContext. If- lcleis- null, the default locale is assigned to the- BeanContextinstance.
- dTime- The initial state,- trueif in design mode,- falseif runtime.
- visible- The initial visibility.
- See Also:
 
- 
BeanContextSupportCreate an instance using the specified Locale and design mode.- Parameters:
- peer- The peer- BeanContextwe are supplying an implementation for, or- nullif this object is its own peer
- lcle- The current Locale for this- BeanContext. If- lcleis- null, the default locale is assigned to the- BeanContextinstance.
- dtime- The initial state,- trueif in design mode,- falseif runtime.
- See Also:
 
- 
BeanContextSupportCreate an instance using the specified locale- Parameters:
- peer- The peer BeanContext we are supplying an implementation for, or- nullif this object is its own peer
- lcle- The current Locale for this- BeanContext. If- lcleis- null, the default locale is assigned to the- BeanContextinstance.
- See Also:
 
- 
BeanContextSupportCreate an instance using with a default locale- Parameters:
- peer- The peer- BeanContextwe are supplying an implementation for, or- nullif this object is its own peer
 
- 
BeanContextSupportpublic BeanContextSupport()Create an instance that is not a delegate of another object
 
- 
- 
Method Details- 
getBeanContextPeerGets the instance ofBeanContextthat this object is providing the implementation for.- Returns:
- the BeanContext instance
 
- 
instantiateChildThe instantiateChild method is a convenience hook in BeanContext to simplify the task of instantiating a Bean, nested, into a BeanContext.The semantics of the beanName parameter are defined by java.beans.Beans.instantiate. - Specified by:
- instantiateChildin interface- BeanContext
- Parameters:
- beanName- the name of the Bean to instantiate within this BeanContext
- Returns:
- the new object
- Throws:
- IOException- if there is an I/O error when the bean is being deserialized
- ClassNotFoundException- if the class identified by the beanName parameter is not found
 
- 
sizepublic int size()Gets the number of children currently nested in this BeanContext.- Specified by:
- sizein interface- Collection
- Returns:
- number of children
 
- 
isEmptypublic boolean isEmpty()Reports whether or not thisBeanContextis empty. ABeanContextis considered empty when it contains zero nested children.- Specified by:
- isEmptyin interface- Collection
- Returns:
- if there are not children
 
- 
containsDetermines whether or not the specified object is currently a child of thisBeanContext.- Specified by:
- containsin interface- Collection
- Parameters:
- o- the Object in question
- Returns:
- if this object is a child
 
- 
containsKeyDetermines whether or not the specified object is currently a child of thisBeanContext.- Parameters:
- o- the Object in question
- Returns:
- if this object is a child
 
- 
iteratorGets all JavaBean orBeanContextinstances currently nested in thisBeanContext.- Specified by:
- iteratorin interface- Collection
- Specified by:
- iteratorin interface- Iterable
- Returns:
- an Iteratorof the nested children
 
- 
toArrayGets all JavaBean orBeanContextinstances currently nested in this BeanContext.- Specified by:
- toArrayin interface- Collection
- Returns:
- an array, whose runtime component
 type is Object, containing all of the elements in this collection
 
- 
toArrayGets an array containing all children of thisBeanContextthat match the types contained in arry.- Specified by:
- toArrayin interface- Collection
- Parameters:
- arry- The array of object types that are of interest.
- Returns:
- an array of children
 
- 
createBCSChildSubclasses can override this method to insert their own subclass of Child without having to override add() or the other Collection methods that add children to the set. - Parameters:
- targetChild- the child to create the Child on behalf of
- peer- the peer if the tragetChild and the peer are related by an implementation of BeanContextProxy
- Returns:
- Subtype-specific subclass of Child without overriding collection methods
 
- 
addAdds/nests a child within thisBeanContext.Invoked as a side effect of java.beans.Beans.instantiate(). If the child object is not valid for adding then this method throws an IllegalStateException. - Specified by:
- addin interface- Collection
- Parameters:
- targetChild- The child objects to nest within this- BeanContext
- Returns:
- true if the child was added successfully.
- See Also:
 
- 
removeRemoves a child from this BeanContext. If the child object is not for adding then this method throws an IllegalStateException.- Specified by:
- removein interface- Collection
- Parameters:
- targetChild- The child objects to remove
- Returns:
- trueif an element was removed as a result of this call
- See Also:
 
- 
removeinternal remove used when removal caused by unexpectedsetBeanContextor byremove()invocation.- Parameters:
- targetChild- the JavaBean, BeanContext, or Object to be removed
- callChildSetBC- used to indicate that the child should be notified that it is no longer nested in this- BeanContext.
- Returns:
- whether or not was present before being removed
 
- 
containsAllTests to see if all objects in the specifiedCollectionare children of thisBeanContext.- Specified by:
- containsAllin interface- Collection
- Parameters:
- c- the specified- Collection
- Returns:
- trueif all objects in the collection are children of this- BeanContext, false if not.
- See Also:
 
- 
addAlladd Collection to set of Children (Unsupported) implementations must synchronized on the hierarchy lock and "children" protected field- Specified by:
- addAllin interface- Collection
- Parameters:
- c- collection containing elements to be added to this collection
- Returns:
- this implementation unconditionally throws UnsupportedOperationException
- Throws:
- UnsupportedOperationException- thrown unconditionally by this implementation
- See Also:
 
- 
removeAllremove all specified children (Unsupported) implementations must synchronized on the hierarchy lock and "children" protected field- Specified by:
- removeAllin interface- Collection
- Parameters:
- c- collection containing elements to be removed from this collection
- Returns:
- this implementation unconditionally throws UnsupportedOperationException
- Throws:
- UnsupportedOperationException- thrown unconditionally by this implementation
- See Also:
 
- 
retainAllretain only specified children (Unsupported) implementations must synchronized on the hierarchy lock and "children" protected field- Specified by:
- retainAllin interface- Collection
- Parameters:
- c- collection containing elements to be retained in this collection
- Returns:
- this implementation unconditionally throws UnsupportedOperationException
- Throws:
- UnsupportedOperationException- thrown unconditionally by this implementation
- See Also:
 
- 
clearpublic void clear()clear the children (Unsupported) implementations must synchronized on the hierarchy lock and "children" protected field- Specified by:
- clearin interface- Collection
- Throws:
- UnsupportedOperationException- thrown unconditionally by this implementation
 
- 
addBeanContextMembershipListenerAdds a BeanContextMembershipListener- Specified by:
- addBeanContextMembershipListenerin interface- BeanContext
- Parameters:
- bcml- the BeanContextMembershipListener to add
- Throws:
- NullPointerException- if the argument is null
 
- 
removeBeanContextMembershipListenerRemoves a BeanContextMembershipListener- Specified by:
- removeBeanContextMembershipListenerin interface- BeanContext
- Parameters:
- bcml- the BeanContextMembershipListener to remove
- Throws:
- NullPointerException- if the argument is null
 
- 
getResourceAsStreamDescription copied from interface:BeanContextAnalogous tojava.lang.ClassLoader.getResourceAsStream(), this method allows aBeanContextimplementation to interpose behavior between the childComponentand underlyingClassLoader.- Specified by:
- getResourceAsStreamin interface- BeanContext
- Parameters:
- name- the name of the resource requested.
- bcc- the child object making the request.
- Returns:
- the requested resource as an InputStream
- Throws:
- NullPointerException- if the argument is null
 
- 
getResourceDescription copied from interface:BeanContextAnalogous tojava.lang.ClassLoader.getResource(), this method allows aBeanContextimplementation to interpose behavior between the childComponentand underlyingClassLoader.- Specified by:
- getResourcein interface- BeanContext
- Parameters:
- name- the name of the resource requested.
- bcc- the child object making the request.
- Returns:
- the requested resource as an InputStream
 
- 
setDesignTimepublic void setDesignTime(boolean dTime) Sets the new design time value for thisBeanContext.- Specified by:
- setDesignTimein interface- DesignMode
- Parameters:
- dTime- the new designTime value
- See Also:
 
- 
isDesignTimepublic boolean isDesignTime()Reports whether or not this object is in currently in design time mode.- Specified by:
- isDesignTimein interface- DesignMode
- Returns:
- trueif in design time mode,- falseif not
 
- 
setLocaleSets the locale of this BeanContext.- Parameters:
- newLocale- the new locale. This method call will have no effect if newLocale is- null.
- Throws:
- PropertyVetoException- if the new value is rejected
 
- 
getLocaleGets the locale for thisBeanContext.- Returns:
- the current Locale of the BeanContext
 
- 
needsGuipublic boolean needsGui()This method is typically called from the environment in order to determine if the implementor "needs" a GUI. The algorithm used herein tests the BeanContextPeer, and its current children to determine if they are either Containers, Components, or if they implement Visibility and return needsGui() == true. - Specified by:
- needsGuiin interface- Visibility
- Returns:
- trueif the implementor needs a GUI
 
- 
dontUseGuipublic void dontUseGui()notify this instance that it may no longer render a GUI.- Specified by:
- dontUseGuiin interface- Visibility
 
- 
okToUseGuipublic void okToUseGui()Notify this instance that it may now render a GUI- Specified by:
- okToUseGuiin interface- Visibility
 
- 
avoidingGuipublic boolean avoidingGui()Used to determine if theBeanContextchild is avoiding using its GUI.- Specified by:
- avoidingGuiin interface- Visibility
- Returns:
- is this instance avoiding using its GUI?
- See Also:
 
- 
isSerializingpublic boolean isSerializing()Is thisBeanContextin the process of being serialized?- Returns:
- if this BeanContextis currently being serialized
 
- 
bcsChildrenReturns an iterator of all children of thisBeanContext.- Returns:
- an iterator for all the current BCSChild values
 
- 
bcsPreSerializationHookcalled by writeObject after defaultWriteObject() but prior to serialization of currently serializable children. This method may be overridden by subclasses to perform custom serialization of their state prior to this superclass serializing the children. This method should not however be used by subclasses to replace their own implementation (if any) of writeObject().- Parameters:
- oos- the- ObjectOutputStreamto use during serialization
- Throws:
- IOException- if serialization failed
 
- 
bcsPreDeserializationHookprotected void bcsPreDeserializationHook(ObjectInputStream ois) throws IOException, ClassNotFoundException called by readObject after defaultReadObject() but prior to deserialization of any children. This method may be overridden by subclasses to perform custom deserialization of their state prior to this superclass deserializing the children. This method should not however be used by subclasses to replace their own implementation (if any) of readObject().- Parameters:
- ois- the- ObjectInputStreamto use during deserialization
- Throws:
- IOException- if deserialization failed
- ClassNotFoundException- if needed classes are not found
 
- 
childDeserializedHookCalled by readObject with the newly deserialized child and BCSChild.- Parameters:
- child- the newly deserialized child
- bcsc- the newly deserialized BCSChild
 
- 
serializeUsed by writeObject to serialize a Collection.- Parameters:
- oos- the- ObjectOutputStreamto use during serialization
- coll- the- Collectionto serialize
- Throws:
- IOException- if serialization failed
 
- 
deserializeprotected final void deserialize(ObjectInputStream ois, Collection coll) throws IOException, ClassNotFoundException used by readObject to deserialize a collection.- Parameters:
- ois- the ObjectInputStream to use
- coll- the Collection
- Throws:
- IOException- if deserialization failed
- ClassNotFoundException- if needed classes are not found
 
- 
writeChildrenUsed to serialize all children of thisBeanContext.- Parameters:
- oos- the- ObjectOutputStreamto use during serialization
- Throws:
- IOException- if serialization failed
 
- 
readChildrenWhen an instance of this class is used as a delegate for the implementation of the BeanContext protocols (and its subprotocols) there exists a 'chicken and egg' problem during deserialization- Parameters:
- ois- the ObjectInputStream to use
- Throws:
- IOException- if deserialization failed
- ClassNotFoundException- if needed classes are not found
 
- 
vetoableChangesubclasses may envelope to monitor veto child property changes.- Specified by:
- vetoableChangein interface- VetoableChangeListener
- Parameters:
- pce- a- PropertyChangeEventobject describing the event source and the property that has changed.
- Throws:
- PropertyVetoException- if the recipient wishes the property change to be rolled back.
 
- 
propertyChangesubclasses may envelope to monitor child property changes.- Specified by:
- propertyChangein interface- PropertyChangeListener
- Parameters:
- pce- A PropertyChangeEvent object describing the event source and the property that has changed.
 
- 
validatePendingAddSubclasses of this class may override, or envelope, this method to add validation behavior for the BeanContext to examine child objects immediately prior to their being added to the BeanContext. - Parameters:
- targetChild- the child to create the Child on behalf of
- Returns:
- true iff the child may be added to this BeanContext, otherwise false.
 
- 
validatePendingRemoveSubclasses of this class may override, or envelope, this method to add validation behavior for the BeanContext to examine child objects immediately prior to their being removed from the BeanContext. - Parameters:
- targetChild- the child to create the Child on behalf of
- Returns:
- true iff the child may be removed from this BeanContext, otherwise false.
 
- 
childJustAddedHooksubclasses may override this method to simply extend add() semantics after the child has been added and before the event notification has occurred. The method is called with the child synchronized.- Parameters:
- child- the child
- bcsc- the BCSChild
 
- 
childJustRemovedHooksubclasses may override this method to simply extend remove() semantics after the child has been removed and before the event notification has occurred. The method is called with the child synchronized.- Parameters:
- child- the child
- bcsc- the BCSChild
 
- 
getChildVisibilityGets the Component (if any) associated with the specified child.- Parameters:
- child- the specified child
- Returns:
- the Component (if any) associated with the specified child.
 
- 
getChildSerializableGets the Serializable (if any) associated with the specified Child- Parameters:
- child- the specified child
- Returns:
- the Serializable (if any) associated with the specified Child
 
- 
getChildPropertyChangeListenerGets the PropertyChangeListener (if any) of the specified child- Parameters:
- child- the specified child
- Returns:
- the PropertyChangeListener (if any) of the specified child
 
- 
getChildVetoableChangeListenerGets the VetoableChangeListener (if any) of the specified child- Parameters:
- child- the specified child
- Returns:
- the VetoableChangeListener (if any) of the specified child
 
- 
getChildBeanContextMembershipListenerprotected static final BeanContextMembershipListener getChildBeanContextMembershipListener(Object child) Gets the BeanContextMembershipListener (if any) of the specified child- Parameters:
- child- the specified child
- Returns:
- the BeanContextMembershipListener (if any) of the specified child
 
- 
getChildBeanContextChildGets the BeanContextChild (if any) of the specified child- Parameters:
- child- the specified child
- Returns:
- the BeanContextChild (if any) of the specified child
- Throws:
- IllegalArgumentException- if child implements both BeanContextChild and BeanContextProxy
 
- 
fireChildrenAddedFire a BeanContextshipEvent on the BeanContextMembershipListener interface- Parameters:
- bcme- the event to fire
 
- 
fireChildrenRemovedFire a BeanContextshipEvent on the BeanContextMembershipListener interface- Parameters:
- bcme- the event to fire
 
- 
initializeprotected void initialize()protected method called from constructor and readObject to initialize transient state of BeanContextSupport instance. This class uses this method to instantiate inner class listeners used to monitor PropertyChange and VetoableChange events on children. subclasses may envelope this method to add their own initialization behavior
- 
copyChildrenGets a copy of the this BeanContext's children.- Returns:
- a copy of the current nested children
 
- 
classEqualsTests to see if two class objects, or their names are equal.- Parameters:
- first- the first object
- second- the second object
- Returns:
- true if equal, false if not
 
 
-