Source code: openfuture/masterdata/LDMasterData.java
1 package openfuture.masterdata;
2
3 /**
4 * This class extends the <tt>MasterData</tt> class to provide a simple
5 * language dependent Master Data class.
6 *
7 * Creation date: (09.09.00 19:17:24)
8 * @author: Markus Giebeler
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.<p>
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.<p>
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA<br>
23 * http://www.gnu.org/copyleft/lesser.html"
24 */
25 public class LDMasterData extends MasterData implements ILanguageDependent {
26 /** Field language (String) is used to hold the language */
27 private String language;
28
29 /**
30 * Constructor
31 */
32 public LDMasterData() {
33 super();
34 }
35 /**
36 * Constructor
37 *
38 * Creation date: (09.09.00 22:07:08)
39 * @param id java.lang.String
40 * @param language java.lang.String
41 * @param text java.lang.String
42 */
43 public LDMasterData(String id, String language, String text) {
44 super(id, text);
45 setLanguage(language);
46 }
47 /**
48 * Compares two objects for equality. Returns a boolean that indicates
49 * whether this object is equivalent to the specified object. This method
50 * is used when an object is stored in a hashtable.
51 * @param obj the Object to compare with
52 * @return true if these Objects are equal; false otherwise.
53 * @see java.util.Hashtable
54 */
55 public boolean equals(Object obj) {
56 // Insert code to compare the receiver and obj here.
57 // This implementation forwards the message to super. You may replace or supplement this.
58 // NOTE: obj might be an instance of any class
59 return super.equals(obj);
60 }
61 /**
62 * Return contents of field language
63 *
64 * @return (String) contents of field language
65 */
66 public final String getLanguage() {
67 if (language == null) {
68 language = "";
69 }
70 return language;
71 }
72 /**
73 * Generates a hash code for the receiver.
74 * This method is supported primarily for
75 * hash tables, such as those provided in java.util.
76 * @return an integer hash code for the receiver
77 * @see java.util.Hashtable
78 */
79 public int hashCode() {
80 // Insert code to generate a hash code for the receiver here.
81 // This implementation forwards the message to super. You may replace or supplement this.
82 // NOTE: if two objects are equal (equals(Object) returns true) they must have the same hash code
83 return super.hashCode();
84 }
85 /**
86 * Set contents of field language to the given value
87 *
88 * @param newValue (String) new value for field language
89 */
90 public final void setLanguage(String newValue) {
91 this.language = newValue;
92 }
93 /**
94 * Returns a String that represents the value of this object.
95 * @return a string representation of the receiver
96 */
97 public String toString() {
98 // return getId()+" ("+getLanguage()+") "+getText();
99 return getText();
100 }
101 }