1. /*
  2. * @(#)BeanContextServiceRevokedEvent.java 1.4 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.beans.beancontext;
  8. import java.beans.beancontext.BeanContextEvent;
  9. import java.beans.beancontext.BeanContextServices;
  10. /**
  11. * <p>
  12. * This event type is used by the BeanContextServicesListener in order to
  13. * identify the service being revoked.
  14. * </p>
  15. */
  16. public class BeanContextServiceRevokedEvent extends BeanContextEvent {
  17. /**
  18. * construct a BeanContextServiceEvent
  19. */
  20. public BeanContextServiceRevokedEvent(BeanContextServices bcs, Class sc, boolean invalidate) {
  21. super((BeanContext)bcs);
  22. serviceClass = sc;
  23. invalidateRefs = invalidate;
  24. }
  25. /**
  26. * get the source as a reference of type BeanContextServices
  27. */
  28. public BeanContextServices getSourceAsBeanContextServices() {
  29. return (BeanContextServices)getBeanContext();
  30. }
  31. /**
  32. * get the service class that is the subject of this notification
  33. */
  34. public Class getServiceClass() { return serviceClass; }
  35. /**
  36. * test service equality
  37. */
  38. public boolean isServiceClass(Class service) {
  39. return serviceClass.equals(service);
  40. }
  41. /**
  42. * true if current service references are now invalidated and unusable.
  43. */
  44. public boolean isCurrentServiceInvalidNow() { return invalidateRefs; }
  45. /**
  46. * fields
  47. */
  48. protected Class serviceClass;
  49. private boolean invalidateRefs;
  50. }