Path: blob/master/src/java.desktop/share/classes/java/beans/beancontext/BeanContextServiceAvailableEvent.java
41159 views
/*1* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.beans.beancontext;2627import java.io.Serial;28import java.util.Iterator;2930/**31* <p>32* This event type is used by the BeanContextServicesListener in order to33* identify the service being registered.34* </p>35*/3637public class BeanContextServiceAvailableEvent extends BeanContextEvent {3839/**40* Use serialVersionUID from JDK 1.7 for interoperability.41*/42@Serial43private static final long serialVersionUID = -5333985775656400778L;4445/**46* Construct a {@code BeanContextAvailableServiceEvent}.47* @param bcs The context in which the service has become available48* @param sc A {@code Class} reference to the newly available service49*/50public BeanContextServiceAvailableEvent(BeanContextServices bcs, Class<?> sc) {51super((BeanContext)bcs);5253serviceClass = sc;54}5556/**57* Gets the source as a reference of type {@code BeanContextServices}.58* @return The context in which the service has become available59*/60public BeanContextServices getSourceAsBeanContextServices() {61return (BeanContextServices)getBeanContext();62}6364/**65* Gets the service class that is the subject of this notification.66* @return A {@code Class} reference to the newly available service67*/68public Class<?> getServiceClass() { return serviceClass; }6970/**71* Gets the list of service dependent selectors.72* @return the current selectors available from the service73*/74public Iterator<?> getCurrentServiceSelectors() {75return ((BeanContextServices)getSource()).getCurrentServiceSelectors(serviceClass);76}7778/*79* fields80*/8182/**83* A {@code Class} reference to the newly available service84*/85protected Class<?> serviceClass;86}878889