src/share/classes/java/beans/beancontext/BeanContextServiceAvailableEvent.java

Print this page




  30 
  31 import java.beans.beancontext.BeanContextServices;
  32 
  33 import java.util.Iterator;
  34 
  35 /**
  36  * <p>
  37  * This event type is used by the BeanContextServicesListener in order to
  38  * identify the service being registered.
  39  * </p>
  40  */
  41 
  42 public class BeanContextServiceAvailableEvent extends BeanContextEvent {
  43     private static final long serialVersionUID = -5333985775656400778L;
  44 
  45     /**
  46      * Construct a <code>BeanContextAvailableServiceEvent</code>.
  47      * @param bcs The context in which the service has become available
  48      * @param sc A <code>Class</code> reference to the newly available service
  49      */
  50     public BeanContextServiceAvailableEvent(BeanContextServices bcs, Class sc) {
  51         super((BeanContext)bcs);
  52 
  53         serviceClass = sc;
  54     }
  55 
  56     /**
  57      * Gets the source as a reference of type <code>BeanContextServices</code>.
  58      * @return The context in which the service has become available
  59      */
  60     public BeanContextServices getSourceAsBeanContextServices() {
  61         return (BeanContextServices)getBeanContext();
  62     }
  63 
  64     /**
  65      * Gets the service class that is the subject of this notification.
  66      * @return A <code>Class</code> reference to the newly available service
  67      */
  68     public Class getServiceClass() { return serviceClass; }
  69 
  70     /**
  71      * Gets the list of service dependent selectors.
  72      * @return the current selectors available from the service
  73      */
  74     public Iterator getCurrentServiceSelectors() {
  75         return ((BeanContextServices)getSource()).getCurrentServiceSelectors(serviceClass);
  76     }
  77 
  78     /*
  79      * fields
  80      */
  81 
  82     /**
  83      * A <code>Class</code> reference to the newly available service
  84      */
  85     protected Class                      serviceClass;
  86 }


  30 
  31 import java.beans.beancontext.BeanContextServices;
  32 
  33 import java.util.Iterator;
  34 
  35 /**
  36  * <p>
  37  * This event type is used by the BeanContextServicesListener in order to
  38  * identify the service being registered.
  39  * </p>
  40  */
  41 
  42 public class BeanContextServiceAvailableEvent extends BeanContextEvent {
  43     private static final long serialVersionUID = -5333985775656400778L;
  44 
  45     /**
  46      * Construct a <code>BeanContextAvailableServiceEvent</code>.
  47      * @param bcs The context in which the service has become available
  48      * @param sc A <code>Class</code> reference to the newly available service
  49      */
  50     public BeanContextServiceAvailableEvent(BeanContextServices bcs, Class<?> sc) {
  51         super((BeanContext)bcs);
  52 
  53         serviceClass = sc;
  54     }
  55 
  56     /**
  57      * Gets the source as a reference of type <code>BeanContextServices</code>.
  58      * @return The context in which the service has become available
  59      */
  60     public BeanContextServices getSourceAsBeanContextServices() {
  61         return (BeanContextServices)getBeanContext();
  62     }
  63 
  64     /**
  65      * Gets the service class that is the subject of this notification.
  66      * @return A <code>Class</code> reference to the newly available service
  67      */
  68     public Class<?> getServiceClass() { return serviceClass; }
  69 
  70     /**
  71      * Gets the list of service dependent selectors.
  72      * @return the current selectors available from the service
  73      */
  74     public Iterator<?> getCurrentServiceSelectors() {
  75         return ((BeanContextServices)getSource()).getCurrentServiceSelectors(serviceClass);
  76     }
  77 
  78     /*
  79      * fields
  80      */
  81 
  82     /**
  83      * A <code>Class</code> reference to the newly available service
  84      */
  85     protected Class<?>                   serviceClass;
  86 }