/core/src/com/bluemarsh/jswat/core/session/SessionEvent.java

http://jswat.googlecode.com/ · Java · 96 lines · 27 code · 8 blank · 61 comment · 0 complexity · 53a64d93cbb7515a9a24416e1e12d857 MD5 · raw file

  1. /*
  2. * The contents of this file are subject to the terms of the Common Development
  3. * and Distribution License (the License). You may not use this file except in
  4. * compliance with the License.
  5. *
  6. * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  7. * or http://www.netbeans.org/cddl.txt.
  8. *
  9. * When distributing Covered Code, include this CDDL Header Notice in each file
  10. * and include the License file at http://www.netbeans.org/cddl.txt.
  11. * If applicable, add the following below the CDDL Header, with the fields
  12. * enclosed by brackets [] replaced by your own identifying information:
  13. * "Portions Copyrighted [year] [name of copyright owner]"
  14. *
  15. * The Original Software is JSwat. The Initial Developer of the Original
  16. * Software is Nathan L. Fiedler. Portions created by Nathan L. Fiedler
  17. * are Copyright (C) 2002-2010. All Rights Reserved.
  18. *
  19. * Contributor(s): Nathan L. Fiedler.
  20. *
  21. * $Id: SessionEvent.java 285 2010-11-20 23:56:08Z nathanfiedler $
  22. */
  23. package com.bluemarsh.jswat.core.session;
  24. import com.sun.jdi.event.Event;
  25. import java.util.EventObject;
  26. /**
  27. * Class SessionEvent encapsulates information about the Session and its
  28. * current state, as well as information about the event that is taking
  29. * place.
  30. *
  31. * @author Nathan Fiedler
  32. */
  33. public class SessionEvent extends EventObject {
  34. /** silence the compiler warnings */
  35. private static final long serialVersionUID = 1L;
  36. /** The Session related to this event. */
  37. private transient final Session session;
  38. /** The JDI event that caused this event. */
  39. private transient final Event event;
  40. /** The type of session change. */
  41. private final SessionEventType type;
  42. /**
  43. * Constructs a new SessionEvent.
  44. *
  45. * @param session Session related to this event.
  46. * @param type type of session change.
  47. */
  48. public SessionEvent(Session session, SessionEventType type) {
  49. this(session, type, null);
  50. }
  51. /**
  52. * Constructs a new SessionEvent.
  53. *
  54. * @param session Session related to this event.
  55. * @param type type of session change.
  56. * @param event event that brought about this event.
  57. */
  58. public SessionEvent(Session session, SessionEventType type, Event event) {
  59. super(session);
  60. this.event = event;
  61. this.session = session;
  62. this.type = type;
  63. }
  64. /**
  65. * Returns the JDI event object that caused this event to happen.
  66. *
  67. * @return event that caused this event; may be null.
  68. */
  69. public Event getEvent() {
  70. return event;
  71. }
  72. /**
  73. * Returns the Session relating to this event.
  74. *
  75. * @return Session for this event.
  76. */
  77. public Session getSession() {
  78. return session;
  79. }
  80. /**
  81. * Get the session event type.
  82. *
  83. * @return session event type.
  84. */
  85. public SessionEventType getType() {
  86. return type;
  87. }
  88. }