001: package org.tigris.scarab.util.build.l10nchecker;
002:
003: /* ================================================================
004: * Copyright (c) 2005 CollabNet. All rights reserved.
005: *
006: * Redistribution and use in source and binary forms, with or without
007: * modification, are permitted provided that the following conditions are
008: * met:
009: *
010: * 1. Redistributions of source code must retain the above copyright
011: * notice, this list of conditions and the following disclaimer.
012: *
013: * 2. Redistributions in binary form must reproduce the above copyright
014: * notice, this list of conditions and the following disclaimer in the
015: * documentation and/or other materials provided with the distribution.
016: *
017: * 3. The end-user documentation included with the redistribution, if
018: * any, must include the following acknowlegement: "This product includes
019: * software developed by Collab.Net <http://www.Collab.Net/>."
020: * Alternately, this acknowlegement may appear in the software itself, if
021: * and wherever such third-party acknowlegements normally appear.
022: *
023: * 4. The hosted project names must not be used to endorse or promote
024: * products derived from this software without prior written
025: * permission. For written permission, please contact info@collab.net.
026: *
027: * 5. Products derived from this software may not use the "Tigris" or
028: * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without
029: * prior written permission of Collab.Net.
030: *
031: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
032: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
033: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
034: * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
035: * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
036: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
037: * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
038: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
039: * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
040: * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
041: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
042: *
043: * ====================================================================
044: *
045: * This software consists of voluntary contributions made by many
046: * individuals on behalf of Collab.Net.
047: */
048:
049: import org.apache.commons.lang.builder.HashCodeBuilder;
050:
051: /**
052: * Localisation key. This key holds the information that is representing a
053: * single l10n property key.
054: *
055: * @author sreindl
056: */
057: public class L10nKey {
058: /**
059: * The key name
060: */
061: private String key;
062:
063: /**
064: * The actual value
065: */
066: private String value;
067:
068: /**
069: * The line number where this key has been defined first.
070: */
071: private int lineNo;
072:
073: /**
074: * Number of attributes this key processes
075: */
076: private int attributeCount = 0;
077:
078: /**
079: * If this property is set to true, the key has to be translated in every
080: * translation file. This might be used for example in case the translator
081: * or the translation version might be used. In case a translation is
082: * missing and this flag is set in the reference file, an error will be
083: * reported.
084: */
085: private boolean needTrans = false;
086:
087: /**
088: * Indicates that the value is part of the translated property file but is
089: * not going to be translated.
090: */
091: private boolean noTrans = false;
092:
093: /**
094: * create a key
095: *
096: * @param key
097: * The key itself
098: * @param value
099: * it's value
100: * @param lineNo
101: * The line number where the key has been defined
102: */
103: public L10nKey(String key, String value, int lineNo) {
104: this .key = key;
105: this .value = value;
106: this .lineNo = lineNo;
107: }
108:
109: /**
110: * @return Returns the key.
111: */
112: public String getKey() {
113: return key;
114: }
115:
116: /**
117: * @return Returns the lineNo.
118: */
119: public int getLineNo() {
120: return lineNo;
121: }
122:
123: /**
124: * @return Returns the value.
125: */
126: public String getValue() {
127: return value;
128: }
129:
130: /**
131: * @return Returns the attributeCount.
132: */
133: public int getAttributeCount() {
134: return attributeCount;
135: }
136:
137: /**
138: * @param attributeCount
139: * The attributeCount to set.
140: */
141: public void setAttributeCount(int attributeCount) {
142: this .attributeCount = attributeCount;
143: }
144:
145: /**
146: * @return Returns the needTrans.
147: */
148: public boolean isNeedTrans() {
149: return needTrans;
150: }
151:
152: /**
153: * @param needTrans
154: * The needTrans to set.
155: */
156: public void setNeedTrans(boolean needTrans) {
157: this .needTrans = needTrans;
158: }
159:
160: /**
161: * @return Returns the noTrans.
162: */
163: public boolean isNoTrans() {
164: return noTrans;
165: }
166:
167: /**
168: * @param noTrans
169: * The noTrans to set.
170: */
171: public void setNoTrans(boolean noTrans) {
172: this .noTrans = noTrans;
173: }
174:
175: /**
176: * @see java.lang.Object#hashCode()
177: */
178: public int hashCode() {
179: return new HashCodeBuilder(-995326837, 526330937).append(
180: this .key).toHashCode();
181: }
182:
183: /**
184: * @see java.lang.Object#equals(Object)
185: */
186: public boolean equals(Object object) {
187: if (!(object instanceof L10nKey)) {
188: return false;
189: }
190: L10nKey rhs = (L10nKey) object;
191: return this.key.equals(rhs.key);
192: }
193: }
|