# Interface BeanContextServices

All Superinterfaces:
  `BeanContext, BeanContextChild, BeanContextServiceRevokedListener, BeanContextServicesListener, Collection, DesignMode, EventListener, Iterable, Visibility`

All Known Implementing Classes:
  `BeanContextServicesSupport`

@Deprecated(since="23", forRemoval=true) public interface BeanContextServices extends BeanContext, BeanContextServicesListener
Deprecated, for removal: This API element is subject to removal in a future version.

The BeanContextServices interface provides a mechanism for a BeanContext to expose generic "services" to the BeanContextChild objects within.

## Field Summary

### Fields declared in interface BeanContext

`globalHierarchyLock`
Modifier and Type
Field
Description
`static final Object`
`globalHierarchyLock`
Deprecated, for removal: This API element is subject to removal in a future version.
This global lock is used by both `BeanContext` and `BeanContextServices` implementors to serialize changes in a `BeanContext` hierarchy and any service requests etc.

### Fields declared in interface DesignMode

`PROPERTYNAME`
Modifier and Type
Field
Description
`static final String`
`PROPERTYNAME`
The standard value of the propertyName as fired from a BeanContext or other source of PropertyChangeEvents.

## Method Summary

Modifier and Type
Method
Description
`void`
`addBeanContextServicesListener(BeanContextServicesListener bcsl)`
Deprecated, for removal: This API element is subject to removal in a future version.
Adds a `BeanContextServicesListener` to this BeanContext
`boolean`
`addService(Class<?> serviceClass, BeanContextServiceProvider serviceProvider)`
Deprecated, for removal: This API element is subject to removal in a future version.
Adds a service to this BeanContext.
`Iterator<?>`
`getCurrentServiceClasses()`
Deprecated, for removal: This API element is subject to removal in a future version.
Gets the currently available services for this context.
`Iterator<?>`
`getCurrentServiceSelectors(Class<?> serviceClass)`
Deprecated, for removal: This API element is subject to removal in a future version.
Gets the list of service dependent service parameters (Service Selectors) for the specified service, by calling getCurrentServiceSelectors() on the underlying BeanContextServiceProvider.
`Object`
`getService(BeanContextChild child, Object requestor, Class<?> serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl)`
Deprecated, for removal: This API element is subject to removal in a future version.
A `BeanContextChild`, or any arbitrary object associated with a `BeanContextChild`, may obtain a reference to a currently registered service from its nesting `BeanContextServices` via invocation of this method.
`boolean`
`hasService(Class<?> serviceClass)`
Deprecated, for removal: This API element is subject to removal in a future version.
Reports whether or not a given service is currently available from this context.
`void`
`releaseService(BeanContextChild child, Object requestor, Object service)`
Deprecated, for removal: This API element is subject to removal in a future version.
Releases a `BeanContextChild`'s (or any arbitrary object associated with a BeanContextChild) reference to the specified service by calling releaseService() on the underlying `BeanContextServiceProvider`.
`void`
`removeBeanContextServicesListener(BeanContextServicesListener bcsl)`
Deprecated, for removal: This API element is subject to removal in a future version.
Removes a `BeanContextServicesListener` from this `BeanContext`
`void`
`revokeService(Class<?> serviceClass, BeanContextServiceProvider serviceProvider, boolean revokeCurrentServicesNow)`
Deprecated, for removal: This API element is subject to removal in a future version.
BeanContextServiceProviders wishing to remove a currently registered service from this context may do so via invocation of this method.

### Methods declared in interface BeanContext

`addBeanContextMembershipListener, getResource, getResourceAsStream, instantiateChild, removeBeanContextMembershipListener`
Modifier and Type
Method
Description
`void`
`addBeanContextMembershipListener(BeanContextMembershipListener bcml)`
Deprecated, for removal: This API element is subject to removal in a future version.
Adds the specified `BeanContextMembershipListener` to receive `BeanContextMembershipEvents` from this `BeanContext` whenever it adds or removes a child `Component`(s).
`URL`
`getResource(String name, BeanContextChild bcc)`
Deprecated, for removal: This API element is subject to removal in a future version.
Analogous to `java.lang.ClassLoader.getResource()`, this method allows a `BeanContext` implementation to interpose behavior between the child `Component` and underlying `ClassLoader`.
`InputStream`
`getResourceAsStream(String name, BeanContextChild bcc)`
Deprecated, for removal: This API element is subject to removal in a future version.
Analogous to `java.lang.ClassLoader.getResourceAsStream()`, this method allows a `BeanContext` implementation to interpose behavior between the child `Component` and underlying `ClassLoader`.
`Object`
`instantiateChild(String beanName)`
Deprecated, for removal: This API element is subject to removal in a future version.
Instantiate the javaBean named as a child of this `BeanContext`.
`void`
`removeBeanContextMembershipListener(BeanContextMembershipListener bcml)`
Deprecated, for removal: This API element is subject to removal in a future version.
Removes the specified `BeanContextMembershipListener` so that it no longer receives `BeanContextMembershipEvent`s when the child `Component`(s) are added or removed.

### Methods declared in interface BeanContextChild

`addPropertyChangeListener, addVetoableChangeListener, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext`
Modifier and Type
Method
Description
`void`
`addPropertyChangeListener(String name, PropertyChangeListener pcl)`
Deprecated, for removal: This API element is subject to removal in a future version.
Adds a `PropertyChangeListener` to this `BeanContextChild` in order to receive a `PropertyChangeEvent` whenever the specified property has changed.
`void`
`addVetoableChangeListener(String name, VetoableChangeListener vcl)`
Deprecated, for removal: This API element is subject to removal in a future version.
Adds a `VetoableChangeListener` to this `BeanContextChild` to receive events whenever the specified property changes.
`BeanContext`
`getBeanContext()`
Deprecated, for removal: This API element is subject to removal in a future version.
Gets the `BeanContext` associated with this `BeanContextChild`.
`void`
`removePropertyChangeListener(String name, PropertyChangeListener pcl)`
Deprecated, for removal: This API element is subject to removal in a future version.
Removes a `PropertyChangeListener` from this `BeanContextChild` so that it no longer receives `PropertyChangeEvents` when the specified property is changed.
`void`
`removeVetoableChangeListener(String name, VetoableChangeListener vcl)`
Deprecated, for removal: This API element is subject to removal in a future version.
Removes a `VetoableChangeListener` from this `BeanContextChild` so that it no longer receives events when the specified property changes.
`void`
`setBeanContext(BeanContext bc)`
Deprecated, for removal: This API element is subject to removal in a future version.
Objects that implement this interface, shall fire a java.beans.PropertyChangeEvent, with parameters: propertyName "beanContext", oldValue (the previous nesting `BeanContext` instance, or `null`), newValue (the current nesting `BeanContext` instance, or `null`).

### Methods declared in interface BeanContextServiceRevokedListener

`serviceRevoked`
Modifier and Type
Method
Description
`void`
`serviceRevoked(BeanContextServiceRevokedEvent bcsre)`
Deprecated, for removal: This API element is subject to removal in a future version.
The service named has been revoked. getService requests for this service will no longer be satisfied.

### Methods declared in interface BeanContextServicesListener

`serviceAvailable`
Modifier and Type
Method
Description
`void`
`serviceAvailable(BeanContextServiceAvailableEvent bcsae)`
Deprecated, for removal: This API element is subject to removal in a future version.
The service named has been registered. getService requests for this service may now be made.

### Methods declared in interface Collection

`add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray`
Modifier and Type
Method
Description
`boolean`
`add(Object e)`
Ensures that this collection contains the specified element (optional operation).
`boolean`
`addAll(Collection c)`
Adds all of the elements in the specified collection to this collection (optional operation).
`void`
`clear()`
Removes all of the elements from this collection (optional operation).
`boolean`
`contains(Object o)`
Returns `true` if this collection contains the specified element.
`boolean`
`containsAll(Collection c)`
Returns `true` if this collection contains all of the elements in the specified collection.
`boolean`
`equals(Object o)`
Compares the specified object with this collection for equality.
`int`
`hashCode()`
Returns the hash code value for this collection.
`boolean`
`isEmpty()`
Returns `true` if this collection contains no elements.
`Iterator`
`iterator()`
Returns an iterator over the elements in this collection.
`default Stream`
`parallelStream()`
Returns a possibly parallel `Stream` with this collection as its source.
`boolean`
`remove(Object o)`
Removes a single instance of the specified element from this collection, if it is present (optional operation).
`boolean`
`removeAll(Collection c)`
Removes all of this collection's elements that are also contained in the specified collection (optional operation).
`default boolean`
`removeIf(Predicate filter)`
Removes all of the elements of this collection that satisfy the given predicate (optional operation).
`boolean`
`retainAll(Collection c)`
Retains only the elements in this collection that are contained in the specified collection (optional operation).
`int`
`size()`
Returns the number of elements in this collection.
`default Spliterator`
`spliterator()`
Creates a `Spliterator` over the elements in this collection.
`default Stream`
`stream()`
Returns a sequential `Stream` with this collection as its source.
`Object[]`
`toArray()`
Returns an array containing all of the elements in this collection.
`default <T> Object[]`
`toArray(IntFunction generator)`
Returns an array containing all of the elements in this collection, using the provided `generator` function to allocate the returned array.
`<T> Object[]`
`toArray(Object[] a)`
Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.

### Methods declared in interface DesignMode

`isDesignTime, setDesignTime`
Modifier and Type
Method
Description
`boolean`
`isDesignTime()`
A value of true denotes that JavaBeans should behave in design time mode, a value of false denotes runtime behavior.
`void`
`setDesignTime(boolean designTime)`
Sets the "value" of the "designTime" property.

### Methods declared in interface Iterable

`forEach`
Modifier and Type
Method
Description
`default void`
`forEach(Consumer action)`
Performs the given action for each element of the `Iterable` until all elements have been processed or the action throws an exception.

### Methods declared in interface Visibility

`avoidingGui, dontUseGui, needsGui, okToUseGui`
Modifier and Type
Method
Description
`boolean`
`avoidingGui()`
Determines whether this bean is avoiding using a GUI.
`void`
`dontUseGui()`
This method instructs the bean that it should not use the Gui.
`boolean`
`needsGui()`
Determines whether this bean needs a GUI.
`void`
`okToUseGui()`
This method instructs the bean that it is OK to use the Gui.

## Method Details

### addService

boolean addService(Class<?> serviceClass, BeanContextServiceProvider serviceProvider)
Deprecated, for removal: This API element is subject to removal in a future version.
Adds a service to this BeanContext. `BeanContextServiceProvider`s call this method to register a particular service with this context. If the service has not previously been added, the `BeanContextServices` associates the service with the `BeanContextServiceProvider` and fires a `BeanContextServiceAvailableEvent` to all currently registered `BeanContextServicesListeners`. The method then returns `true`, indicating that the addition of the service was successful. If the given service has already been added, this method simply returns `false`.

Parameters:
  `serviceClass` - the service to add
  `serviceProvider` - the `BeanContextServiceProvider` associated with the service
Returns:
  true if the service was successful added, false otherwise

### revokeService

void revokeService(Class<?> serviceClass, BeanContextServiceProvider serviceProvider, boolean revokeCurrentServicesNow)
Deprecated, for removal: This API element is subject to removal in a future version.
BeanContextServiceProviders wishing to remove a currently registered service from this context may do so via invocation of this method. Upon revocation of the service, the `BeanContextServices` fires a `BeanContextServiceRevokedEvent` to its list of currently registered `BeanContextServiceRevokedListeners` and `BeanContextServicesListeners`.

Parameters:
  `serviceClass` - the service to revoke from this BeanContextServices
  `serviceProvider` - the BeanContextServiceProvider associated with this particular service that is being revoked
  `revokeCurrentServicesNow` - a value of `true` indicates an exceptional circumstance where the `BeanContextServiceProvider` or `BeanContextServices` wishes to immediately terminate service to all currently outstanding references to the specified service.

### hasService

boolean hasService(Class<?> serviceClass)
Deprecated, for removal: This API element is subject to removal in a future version.
Reports whether or not a given service is currently available from this context.

Parameters:
  `serviceClass` - the service in question
Returns:
  true if the service is available

### getService

Object getService(BeanContextChild child, Object requestor, Class<?> serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException
Deprecated, for removal: This API element is subject to removal in a future version.
A `BeanContextChild`, or any arbitrary object associated with a `BeanContextChild`, may obtain a reference to a currently registered service from its nesting `BeanContextServices` via invocation of this method. When invoked, this method gets the service by calling the getService() method on the underlying `BeanContextServiceProvider`.

Parameters:
  `child` - the `BeanContextChild` associated with this request
  `requestor` - the object requesting the service
  `serviceClass` - class of the requested service
  `serviceSelector` - the service dependent parameter
  `bcsrl` - the `BeanContextServiceRevokedListener` to notify if the service should later become revoked
Returns:
  a reference to this context's named Service as requested or `null`
Throws:
  `TooManyListenersException` - if there are too many listeners

### releaseService

void releaseService(BeanContextChild child, Object requestor, Object service)
Deprecated, for removal: This API element is subject to removal in a future version.
Releases a `BeanContextChild`'s (or any arbitrary object associated with a BeanContextChild) reference to the specified service by calling releaseService() on the underlying `BeanContextServiceProvider`.

Parameters:
  `child` - the `BeanContextChild`
  `requestor` - the requestor
  `service` - the service

### getCurrentServiceClasses

Iterator<?> getCurrentServiceClasses()
Deprecated, for removal: This API element is subject to removal in a future version.
Gets the currently available services for this context.

Returns:
  an `Iterator` consisting of the currently available services

### getCurrentServiceSelectors

Iterator<?> getCurrentServiceSelectors(Class<?> serviceClass)
Deprecated, for removal: This API element is subject to removal in a future version.
Gets the list of service dependent service parameters (Service Selectors) for the specified service, by calling getCurrentServiceSelectors() on the underlying BeanContextServiceProvider.

Parameters:
  `serviceClass` - the specified service
Returns:
  the currently available service selectors for the named serviceClass

### addBeanContextServicesListener

void addBeanContextServicesListener(BeanContextServicesListener bcsl)
Deprecated, for removal: This API element is subject to removal in a future version.
Adds a `BeanContextServicesListener` to this BeanContext

Parameters:
  `bcsl` - the `BeanContextServicesListener` to add

### removeBeanContextServicesListener

void removeBeanContextServicesListener(BeanContextServicesListener bcsl)
Deprecated, for removal: This API element is subject to removal in a future version.
Removes a `BeanContextServicesListener` from this `BeanContext`

Parameters:
  `bcsl` - the `BeanContextServicesListener` to remove from this context