Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedEvent.java
38918 views
/*1* Copyright (c) 1998, 2009, 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.beans.beancontext.BeanContextEvent;2829import java.beans.beancontext.BeanContextServices;3031/**32* <p>33* This event type is used by the34* <code>BeanContextServiceRevokedListener</code> in order to35* identify the service being revoked.36* </p>37*/38public class BeanContextServiceRevokedEvent extends BeanContextEvent {39private static final long serialVersionUID = -1295543154724961754L;4041/**42* Construct a <code>BeanContextServiceEvent</code>.43* @param bcs the <code>BeanContextServices</code>44* from which this service is being revoked45* @param sc the service that is being revoked46* @param invalidate <code>true</code> for immediate revocation47*/48public BeanContextServiceRevokedEvent(BeanContextServices bcs, Class sc, boolean invalidate) {49super((BeanContext)bcs);5051serviceClass = sc;52invalidateRefs = invalidate;53}5455/**56* Gets the source as a reference of type <code>BeanContextServices</code>57* @return the <code>BeanContextServices</code> from which58* this service is being revoked59*/60public BeanContextServices getSourceAsBeanContextServices() {61return (BeanContextServices)getBeanContext();62}6364/**65* Gets the service class that is the subject of this notification66* @return A <code>Class</code> reference to the67* service that is being revoked68*/69public Class getServiceClass() { return serviceClass; }7071/**72* Checks this event to determine whether or not73* the service being revoked is of a particular class.74* @param service the service of interest (should be non-null)75* @return <code>true</code> if the service being revoked is of the76* same class as the specified service77*/78public boolean isServiceClass(Class service) {79return serviceClass.equals(service);80}8182/**83* Reports if the current service is being forcibly revoked,84* in which case the references are now invalidated and unusable.85* @return <code>true</code> if current service is being forcibly revoked86*/87public boolean isCurrentServiceInvalidNow() { return invalidateRefs; }8889/**90* fields91*/9293/**94* A <code>Class</code> reference to the service that is being revoked.95*/96protected Class serviceClass;97private boolean invalidateRefs;98}99100101