java.beans.beancontext

Class BeanContextServiceAvailableEvent

Implemented Interfaces:
Serializable

public class BeanContextServiceAvailableEvent
extends BeanContextEvent

This event type is used by the BeanContextServicesListener in order to identify the service being registered.
See Also:
Serialized Form

Field Summary

protected Class<T>
serviceClass
A Class reference to the newly available service

Fields inherited from class java.beans.beancontext.BeanContextEvent

propagatedFrom

Fields inherited from class java.util.EventObject

source

Constructor Summary

BeanContextServiceAvailableEvent(BeanContextServices bcs, Class<T> sc)
Construct a BeanContextAvailableServiceEvent.

Method Summary

Iterator<E>
getCurrentServiceSelectors()
Gets the list of service dependent selectors.
Class<T>
getServiceClass()
Gets the service class that is the subject of this notification.
BeanContextServices
getSourceAsBeanContextServices()
Gets the source as a reference of type BeanContextServices.

Methods inherited from class java.beans.beancontext.BeanContextEvent

getBeanContext, getPropagatedFrom, isPropagated, setPropagatedFrom

Methods inherited from class java.util.EventObject

getSource, toString

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

serviceClass

protected Class<T> serviceClass
A Class reference to the newly available service

Constructor Details

BeanContextServiceAvailableEvent

public BeanContextServiceAvailableEvent(BeanContextServices bcs,
                                        Class<T> sc)
Construct a BeanContextAvailableServiceEvent.
Parameters:
bcs - The context in which the service has become available
sc - A Class reference to the newly available service

Method Details

getCurrentServiceSelectors

public Iterator<E> getCurrentServiceSelectors()
Gets the list of service dependent selectors.
Returns:
the current selectors available from the service

getServiceClass

public Class<T> getServiceClass()
Gets the service class that is the subject of this notification.
Returns:
A Class reference to the newly available service

getSourceAsBeanContextServices

public BeanContextServices getSourceAsBeanContextServices()
Gets the source as a reference of type BeanContextServices.
Returns:
The context in which the service has become available
Usages and Demos :

View More Examples of getSourceAsBeanContextServices()
   1: 
   2:     public void serviceAvailable(BeanContextServiceAvailableEvent bcsae) {
   3:         System.out.println("[Detected a service being added to the context]");
   4:         ...
   5: 
   6:         BeanContextServices context = bcsae.getSourceAsBeanContextServices();
   7:         System.out.println("Is the context offering a WordCount service? "
   8:                            + context.hasService(WordCount.class)); 

View Full Code Here