Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ConfigEvent |
|
| 1.0;1 |
1 | /** | |
2 | * Distribution License: | |
3 | * JSword 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 or later | |
5 | * as published by the Free Software Foundation. This program is distributed | |
6 | * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even | |
7 | * the 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/lgpl.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 | * © CrossWire Bible Society, 2005 - 2016 | |
18 | * | |
19 | */ | |
20 | package org.crosswire.common.config; | |
21 | ||
22 | import java.io.IOException; | |
23 | import java.io.ObjectInputStream; | |
24 | import java.util.EventObject; | |
25 | ||
26 | /** | |
27 | * An event indicating that an exception has happened. | |
28 | * | |
29 | * @see gnu.lgpl.License The GNU Lesser General Public License for details. | |
30 | * @author Joe Walker | |
31 | */ | |
32 | public class ConfigEvent extends EventObject { | |
33 | /** | |
34 | * Constructs an ConfigEvent object. | |
35 | * | |
36 | * @param source | |
37 | * The event originator, or log stream | |
38 | * @param key the key for the config item | |
39 | * @param model the config item | |
40 | */ | |
41 | public ConfigEvent(Object source, String key, Choice model) { | |
42 | 0 | super(source); |
43 | ||
44 | 0 | this.key = key; |
45 | 0 | this.model = model; |
46 | 0 | } |
47 | ||
48 | /** | |
49 | * Returns the key. | |
50 | * | |
51 | * @return the key | |
52 | */ | |
53 | public String getKey() { | |
54 | 0 | return key; |
55 | } | |
56 | ||
57 | /** | |
58 | * Returns the choice. | |
59 | * | |
60 | * @return the choice | |
61 | */ | |
62 | public Choice getChoice() { | |
63 | 0 | return model; |
64 | } | |
65 | ||
66 | /** | |
67 | * Returns the choice. | |
68 | * | |
69 | * @return the choice | |
70 | */ | |
71 | public Choice getPath() { | |
72 | 0 | return model; |
73 | } | |
74 | ||
75 | /** | |
76 | * Serialization support. | |
77 | * | |
78 | * @param is the input stream | |
79 | * @throws IOException if an I/O error occurs. | |
80 | * @throws ClassNotFoundException if the class of a serialized object | |
81 | * could not be found. | |
82 | */ | |
83 | private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { | |
84 | // Broken but we don't serialize events | |
85 | 0 | model = null; |
86 | 0 | is.defaultReadObject(); |
87 | 0 | } |
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 | } |