| ConfigEvent.java |
1 /**
2 * Distribution License:
3 * This is free software; you can redistribute it and/or modify it under
4 * the terms of the GNU Lesser General Public License, version 2.1 as published
5 * by the Free Software Foundation. This program is distributed in the hope
6 * that it will be useful, but WITHOUT ANY WARRANTY; without even the
7 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8 * See the GNU Lesser General Public License for more details.
9 *
10 * The License is available on the internet at:
11 * http://www.gnu.org/copyleft/llgpl.html
12 * or by writing to:
13 * Free Software Foundation, Inc.
14 * 59 Temple Place - Suite 330
15 * Boston, MA 02111-1307, USA
16 *
17 * Copyright: 2005
18 * The copyright to this program is held by it's authors.
19 *
20 * ID: $Id: ConfigEvent.java 1966 2009-10-30 01:15:14Z dmsmith $
21 */
22 package org.crosswire.common.config;
23
24 import java.io.IOException;
25 import java.io.ObjectInputStream;
26 import java.util.EventObject;
27
28 /**
29 * An event indicating that an exception has happened.
30 *
31 * @see gnu.lgpl.License for license details.<br>
32 * The copyright to this program is held by it's authors.
33 * @author Joe Walker [joe at eireneh dot com]
34 */
35 public class ConfigEvent extends EventObject {
36 /**
37 * Constructs an ConfigEvent object.
38 *
39 * @param source
40 * The event originator, or log stream
41 */
42 public ConfigEvent(Object source, String key, Choice model) {
43 super(source);
44
45 this.key = key;
46 this.model = model;
47 }
48
49 /**
50 * Returns the key.
51 *
52 * @return the key
53 */
54 public String getKey() {
55 return key;
56 }
57
58 /**
59 * Returns the choice.
60 *
61 * @return the choice
62 */
63 public Choice getChoice() {
64 return model;
65 }
66
67 /**
68 * Returns the choice.
69 *
70 * @return the choice
71 */
72 public Choice getPath() {
73 return model;
74 }
75
76 /**
77 * Serialization support.
78 *
79 * @param is
80 * @throws IOException
81 * @throws ClassNotFoundException
82 */
83 private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException {
84 // Broken but we don't serialize events
85 model = null;
86 is.defaultReadObject();
87 }
88
89 /**
90 * The name of the choice
91 */
92 private String key;
93
94 /**
95 * The Choice
96 */
97 private transient Choice model;
98
99 /**
100 * Serialization ID
101 */
102 private static final long serialVersionUID = 3257006561900376375L;
103 }
104