1. /*
  2. * @(#)NodeChangeEvent.java 1.4 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.util.prefs;
  8. import java.io.NotSerializableException;
  9. /**
  10. * An event emitted by a <tt>Preferences</tt> node to indicate that
  11. * a child of that node has been added or removed.<p>
  12. *
  13. * Note, that although NodeChangeEvent inherits Serializable interface from
  14. * java.util.EventObject, it is not intended to be Serializable. Appropriate
  15. * serialization methods are implemented to throw NotSerializableException.
  16. *
  17. * @author Josh Bloch
  18. * @version $I$, $G$
  19. * @see Preferences
  20. * @see NodeChangeListener
  21. * @see PreferenceChangeEvent
  22. * @since 1.4
  23. * @serial exclude
  24. */
  25. public class NodeChangeEvent extends java.util.EventObject {
  26. /**
  27. * The node that was added or removed.
  28. *
  29. * @serial
  30. */
  31. private Preferences child;
  32. /**
  33. * Constructs a new <code>NodeChangeEvent</code> instance.
  34. *
  35. * @param parent The parent of the node that was added or removed.
  36. * @param child The node that was added or removed.
  37. */
  38. public NodeChangeEvent(Preferences parent, Preferences child) {
  39. super(parent);
  40. this.child = child;
  41. }
  42. /**
  43. * Returns the parent of the node that was added or removed.
  44. *
  45. * @return The parent Preferences node whose child was added or removed
  46. */
  47. public Preferences getParent() {
  48. return (Preferences) getSource();
  49. }
  50. /**
  51. * Returns the node that was added or removed.
  52. *
  53. * @return The node that was added or removed.
  54. */
  55. public Preferences getChild() {
  56. return child;
  57. }
  58. /**
  59. * Throws NotSerializableException, since NodeChangeEvent objects are not
  60. * intended to be serializable.
  61. */
  62. private void writeObject(java.io.ObjectOutputStream out)
  63. throws NotSerializableException {
  64. throw new NotSerializableException("Not serializable.");
  65. }
  66. /**
  67. * Throws NotSerializableException, since NodeChangeEvent objects are not
  68. * intended to be serializable.
  69. */
  70. private void readObject(java.io.ObjectInputStream in)
  71. throws NotSerializableException {
  72. throw new NotSerializableException("Not serializable.");
  73. }
  74. }