BeanContext
, BeanContextChild
, BeanContextServiceRevokedListener
, BeanContextServices
, BeanContextServicesListener
, DesignMode
, PropertyChangeListener
, VetoableChangeListener
, Visibility
, Serializable
, Iterable
, Collection
, EventListener
public class BeanContextServicesSupport extends BeanContextSupport implements BeanContextServices
This helper class provides a utility implementation of the java.beans.beancontext.BeanContextServices interface.
Since this class directly implements the BeanContextServices interface, the class can, and is intended to be used either by subclassing this implementation, or via delegation of an instance of this class from another through the BeanContextProxy interface.
Modifier and Type | Class | Description |
---|---|---|
protected class |
BeanContextServicesSupport.BCSSChild |
A protected nested class containing per-child information in the children hashtable. |
protected class |
BeanContextServicesSupport.BCSSProxyServiceProvider |
Subclasses may subclass this nested class to represent a proxy for each BeanContextServiceProvider. |
protected static class |
BeanContextServicesSupport.BCSSServiceProvider |
subclasses may subclass this nested class to add behaviors for each BeanContextServicesProvider. |
BeanContextSupport.BCSChild, BeanContextSupport.BCSIterator
Modifier and Type | Field | Description |
---|---|---|
protected ArrayList |
bcsListeners |
List of BeanContextServicesListener objects. |
protected BeanContextServicesSupport.BCSSProxyServiceProvider |
proxy |
Delegate for the BeanContextServiceProvider . |
protected int |
serializable |
The number of instances of a serializable BeanContextServceProvider . |
protected HashMap |
services |
all accesses to the protected transient HashMap services field should be synchronized on that object |
bcmListeners, children, designTime, locale, okToUseGui
beanContext, beanContextChildPeer, pcSupport, rejectedSetBCOnce, vcSupport
globalHierarchyLock
PROPERTYNAME
Constructor | Description |
---|---|
BeanContextServicesSupport() |
Create an instance that is not a delegate of another object |
BeanContextServicesSupport |
Create an instance with a peer |
BeanContextServicesSupport |
Create an instance using the specified locale |
BeanContextServicesSupport |
Create an instance using the specified Locale and design mode. |
BeanContextServicesSupport |
Construct a BeanContextServicesSupport instance |
Modifier and Type | Method | Description |
---|---|---|
void |
addBeanContextServicesListener |
add a BeanContextServicesListener |
boolean |
addService |
add a service |
protected boolean |
addService |
add a service |
protected void |
bcsPreDeserializationHook |
called from BeanContextSupport readObject before it deserializes the children ... |
protected void |
bcsPreSerializationHook |
called from BeanContextSupport writeObject before it serializes the children ... |
protected void |
childJustRemovedHook |
called from superclass child removal operations after a child has been successfully removed. called with child synchronized. |
protected BeanContextSupport.BCSChild |
createBCSChild |
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 BeanContextServicesSupport.BCSSServiceProvider |
createBCSSServiceProvider |
subclasses can override this method to create new subclasses of BCSSServiceProvider without having to override addService() in order to instantiate. |
protected final void |
fireServiceAdded |
Fires a BeanContextServiceAvailableEvent indicating that a new service has become available. |
protected final void |
fireServiceAdded |
Fires a BeanContextServiceEvent notifying of a new service. |
protected final void |
fireServiceRevoked |
Fires a BeanContextServiceEvent notifying of a service being revoked. |
protected final void |
fireServiceRevoked |
Fires a BeanContextServiceRevokedEvent indicating that a particular service is no longer available. |
BeanContextServices |
getBeanContextServicesPeer() |
Gets the BeanContextServices associated with this BeanContextServicesSupport . |
protected static final BeanContextServicesListener |
getChildBeanContextServicesListener |
Gets the BeanContextServicesListener (if any) of the specified child. |
Iterator |
getCurrentServiceClasses() |
Gets the currently available services for this context. |
Iterator |
getCurrentServiceSelectors |
Gets the list of service dependent service parameters (Service Selectors) for the specified service, by calling getCurrentServiceSelectors() on the underlying BeanContextServiceProvider. |
Object |
getService |
obtain a service which may be delegated |
boolean |
hasService |
has a service, which may be delegated |
void |
initialize() |
called by BeanContextSupport superclass during construction and deserialization to initialize subclass transient state. |
protected void |
initializeBeanContextResources() |
called from setBeanContext to notify a BeanContextChild to allocate resources obtained from the nesting BeanContext. |
protected void |
releaseBeanContextResources() |
called from setBeanContext to notify a BeanContextChild to release resources obtained from the nesting BeanContext. |
void |
releaseService |
release a service |
void |
removeBeanContextServicesListener |
remove a BeanContextServicesListener |
void |
revokeService |
remove a service |
void |
serviceAvailable |
BeanContextServicesListener callback, propagates event to all currently registered listeners and BeanContextServices children, if this BeanContextService does not already implement this service itself. |
void |
serviceRevoked |
BeanContextServicesListener callback, propagates event to all currently registered listeners and BeanContextServices children, if this BeanContextService does not already implement this service itself. |
add, addAll, addBeanContextMembershipListener, avoidingGui, bcsChildren, childDeserializedHook, childJustAddedHook, classEquals, clear, contains, containsAll, containsKey, copyChildren, deserialize, dontUseGui, fireChildrenAdded, fireChildrenRemoved, getBeanContextPeer, getChildBeanContextChild, getChildBeanContextMembershipListener, getChildPropertyChangeListener, getChildSerializable, getChildVetoableChangeListener, getChildVisibility, getLocale, getResource, getResourceAsStream, instantiateChild, isDesignTime, isEmpty, isSerializing, iterator, needsGui, okToUseGui, propertyChange, readChildren, remove, remove, removeAll, removeBeanContextMembershipListener, retainAll, serialize, setDesignTime, setLocale, size, toArray, toArray, validatePendingAdd, validatePendingRemove, vetoableChange, writeChildren
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, isDelegated, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, validatePendingSetBeanContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addBeanContextMembershipListener, getResource, getResourceAsStream, instantiateChild, removeBeanContextMembershipListener
addPropertyChangeListener, addVetoableChangeListener, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray
isDesignTime, setDesignTime
avoidingGui, dontUseGui, needsGui, okToUseGui
protected transient HashMap<Object,BeanContextServicesSupport.BCSSServiceProvider> services
protected transient HashMap services
field should be synchronized on that objectprotected transient int serializable
BeanContextServceProvider
.protected transient BeanContextServicesSupport.BCSSProxyServiceProvider proxy
BeanContextServiceProvider
.protected transient ArrayList<BeanContextServicesListener> bcsListeners
BeanContextServicesListener
objects.public BeanContextServicesSupport(BeanContextServices peer, Locale lcle, boolean dTime, boolean visible)
Construct a BeanContextServicesSupport instance
peer
- The peer BeanContext we are supplying an implementation for, if null the this object is its own peerlcle
- The current Locale for this BeanContext.dTime
- The initial state, true if in design mode, false if runtime.visible
- The initial visibility.public BeanContextServicesSupport(BeanContextServices peer, Locale lcle, boolean dtime)
peer
- The peer BeanContext we are supplying an implementation for, if null the this object is its own peerlcle
- The current Locale for this BeanContext.dtime
- The initial state, true if in design mode, false if runtime.public BeanContextServicesSupport(BeanContextServices peer, Locale lcle)
peer
- The peer BeanContext we are supplying an implementation for, if null the this object is its own peerlcle
- The current Locale for this BeanContext.public BeanContextServicesSupport(BeanContextServices peer)
peer
- The peer BeanContext we are supplying an implementation for, if null the this object is its own peerpublic BeanContextServicesSupport()
public void initialize()
initialize
in class BeanContextSupport
public BeanContextServices getBeanContextServicesPeer()
BeanContextServices
associated with this BeanContextServicesSupport
.BeanContext
this object is providing the implementation for.protected BeanContextSupport.BCSChild createBCSChild(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.
createBCSChild
in class BeanContextSupport
targetChild
- the child to create the Child on behalf ofpeer
- the peer if the targetChild and peer are related by BeanContextProxyprotected BeanContextServicesSupport.BCSSServiceProvider createBCSSServiceProvider(Class<?> sc, BeanContextServiceProvider bcsp)
sc
- the classbcsp
- the service providerpublic void addBeanContextServicesListener(BeanContextServicesListener bcsl)
addBeanContextServicesListener
in interface BeanContextServices
bcsl
- the BeanContextServicesListener
to addNullPointerException
- if the argument is nullpublic void removeBeanContextServicesListener(BeanContextServicesListener bcsl)
removeBeanContextServicesListener
in interface BeanContextServices
bcsl
- the BeanContextServicesListener
to remove from this contextpublic boolean addService(Class<?> serviceClass, BeanContextServiceProvider bcsp)
addService
in interface BeanContextServices
serviceClass
- the service classbcsp
- the service providerprotected boolean addService(Class<?> serviceClass, BeanContextServiceProvider bcsp, boolean fireEvent)
serviceClass
- the service classbcsp
- the service providerfireEvent
- whether or not an event should be firedpublic void revokeService(Class<?> serviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow)
revokeService
in interface BeanContextServices
serviceClass
- the service classbcsp
- the service providerrevokeCurrentServicesNow
- whether or not to revoke the servicepublic boolean hasService(Class<?> serviceClass)
hasService
in interface BeanContextServices
serviceClass
- the service in questionpublic Object getService(BeanContextChild child, Object requestor, Class<?> serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException
getService
in interface BeanContextServices
child
- the BeanContextChild
associated with this requestrequestor
- the object requesting the serviceserviceClass
- class of the requested serviceserviceSelector
- the service dependent parameterbcsrl
- the BeanContextServiceRevokedListener
to notify if the service should later become revokednull
TooManyListenersException
- if there are too many listenerspublic void releaseService(BeanContextChild child, Object requestor, Object service)
releaseService
in interface BeanContextServices
child
- the BeanContextChild
requestor
- the requestorservice
- the servicepublic Iterator<Object> getCurrentServiceClasses()
BeanContextServices
getCurrentServiceClasses
in interface BeanContextServices
public Iterator<?> getCurrentServiceSelectors(Class<?> serviceClass)
BeanContextServices
getCurrentServiceSelectors
in interface BeanContextServices
serviceClass
- the specified servicepublic void serviceAvailable(BeanContextServiceAvailableEvent bcssae)
serviceAvailable
in interface BeanContextServicesListener
serviceAvailable
in class BeanContextChildSupport
bcssae
- The BeanContextServiceAvailableEvent fired as a result of a service becoming availablepublic void serviceRevoked(BeanContextServiceRevokedEvent bcssre)
serviceRevoked
in interface BeanContextServiceRevokedListener
serviceRevoked
in class BeanContextChildSupport
bcssre
- The BeanContextServiceRevokedEvent
fired as a result of a service being revokedprotected static final BeanContextServicesListener getChildBeanContextServicesListener(Object child)
BeanContextServicesListener
(if any) of the specified child.child
- the specified childprotected void childJustRemovedHook(Object child, BeanContextSupport.BCSChild bcsc)
childJustRemovedHook
in class BeanContextSupport
child
- the childbcsc
- the BCSChildprotected void releaseBeanContextResources()
releaseBeanContextResources
in class BeanContextChildSupport
protected void initializeBeanContextResources()
initializeBeanContextResources
in class BeanContextChildSupport
protected final void fireServiceAdded(Class<?> serviceClass)
BeanContextServiceEvent
notifying of a new service.serviceClass
- the service classprotected final void fireServiceAdded(BeanContextServiceAvailableEvent bcssae)
BeanContextServiceAvailableEvent
indicating that a new service has become available.bcssae
- the BeanContextServiceAvailableEvent
protected final void fireServiceRevoked(BeanContextServiceRevokedEvent bcsre)
BeanContextServiceEvent
notifying of a service being revoked.bcsre
- the BeanContextServiceRevokedEvent
protected final void fireServiceRevoked(Class<?> serviceClass, boolean revokeNow)
BeanContextServiceRevokedEvent
indicating that a particular service is no longer available.serviceClass
- the service classrevokeNow
- whether or not the event should be revoked nowprotected void bcsPreSerializationHook(ObjectOutputStream oos) throws IOException
bcsPreSerializationHook
in class BeanContextSupport
oos
- the ObjectOutputStream
to use during serializationIOException
- if serialization failedprotected void bcsPreDeserializationHook(ObjectInputStream ois) throws IOException, ClassNotFoundException
bcsPreDeserializationHook
in class BeanContextSupport
ois
- the ObjectInputStream
to use during deserializationIOException
- if deserialization failedClassNotFoundException
- if needed classes are not found
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/java/beans/beancontext/BeanContextServicesSupport.html