KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > tigris > scarab > util > build > l10nchecker > L10nKey


1 package org.tigris.scarab.util.build.l10nchecker;
2
3 /* ================================================================
4  * Copyright (c) 2005 CollabNet. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution.
16  *
17  * 3. The end-user documentation included with the redistribution, if
18  * any, must include the following acknowlegement: "This product includes
19  * software developed by Collab.Net <http://www.Collab.Net/>."
20  * Alternately, this acknowlegement may appear in the software itself, if
21  * and wherever such third-party acknowlegements normally appear.
22  *
23  * 4. The hosted project names must not be used to endorse or promote
24  * products derived from this software without prior written
25  * permission. For written permission, please contact info@collab.net.
26  *
27  * 5. Products derived from this software may not use the "Tigris" or
28  * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without
29  * prior written permission of Collab.Net.
30  *
31  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
32  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
33  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
34  * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
35  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
37  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
39  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
40  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
41  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42  *
43  * ====================================================================
44  *
45  * This software consists of voluntary contributions made by many
46  * individuals on behalf of Collab.Net.
47  */

48
49 import org.apache.commons.lang.builder.HashCodeBuilder;
50
51 /**
52  * Localisation key. This key holds the information that is representing a
53  * single l10n property key.
54  *
55  * @author sreindl
56  */

57 public class L10nKey
58 {
59     /**
60      * The key name
61      */

62     private String JavaDoc key;
63
64     /**
65      * The actual value
66      */

67     private String JavaDoc value;
68
69     /**
70      * The line number where this key has been defined first.
71      */

72     private int lineNo;
73
74     /**
75      * Number of attributes this key processes
76      */

77     private int attributeCount = 0;
78
79     /**
80      * If this property is set to true, the key has to be translated in every
81      * translation file. This might be used for example in case the translator
82      * or the translation version might be used. In case a translation is
83      * missing and this flag is set in the reference file, an error will be
84      * reported.
85      */

86     private boolean needTrans = false;
87
88     /**
89      * Indicates that the value is part of the translated property file but is
90      * not going to be translated.
91      */

92     private boolean noTrans = false;
93
94     /**
95      * create a key
96      *
97      * @param key
98      * The key itself
99      * @param value
100      * it's value
101      * @param lineNo
102      * The line number where the key has been defined
103      */

104     public L10nKey(String JavaDoc key, String JavaDoc value, int lineNo)
105     {
106         this.key = key;
107         this.value = value;
108         this.lineNo = lineNo;
109     }
110
111     /**
112      * @return Returns the key.
113      */

114     public String JavaDoc getKey()
115     {
116         return key;
117     }
118
119     /**
120      * @return Returns the lineNo.
121      */

122     public int getLineNo()
123     {
124         return lineNo;
125     }
126
127     /**
128      * @return Returns the value.
129      */

130     public String JavaDoc getValue()
131     {
132         return value;
133     }
134
135     /**
136      * @return Returns the attributeCount.
137      */

138     public int getAttributeCount()
139     {
140         return attributeCount;
141     }
142
143     /**
144      * @param attributeCount
145      * The attributeCount to set.
146      */

147     public void setAttributeCount(int attributeCount)
148     {
149         this.attributeCount = attributeCount;
150     }
151
152     /**
153      * @return Returns the needTrans.
154      */

155     public boolean isNeedTrans()
156     {
157         return needTrans;
158     }
159
160     /**
161      * @param needTrans
162      * The needTrans to set.
163      */

164     public void setNeedTrans(boolean needTrans)
165     {
166         this.needTrans = needTrans;
167     }
168
169     /**
170      * @return Returns the noTrans.
171      */

172     public boolean isNoTrans()
173     {
174         return noTrans;
175     }
176
177     /**
178      * @param noTrans
179      * The noTrans to set.
180      */

181     public void setNoTrans(boolean noTrans)
182     {
183         this.noTrans = noTrans;
184     }
185
186     /**
187      * @see java.lang.Object#hashCode()
188      */

189     public int hashCode()
190     {
191         return new HashCodeBuilder(-995326837, 526330937).append(this.key)
192                 .toHashCode();
193     }
194
195     /**
196      * @see java.lang.Object#equals(Object)
197      */

198     public boolean equals(Object JavaDoc object)
199     {
200         if (!(object instanceof L10nKey))
201         {
202             return false;
203         }
204         L10nKey rhs = (L10nKey) object;
205         return this.key.equals(rhs.key);
206     }
207 }
208
Popular Tags