KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > i18n > HardCodedString


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20
21 package org.netbeans.modules.i18n;
22
23
24 import javax.swing.text.Position JavaDoc;
25
26
27 /**
28  * Object representing found hard coded string in internationalized document.
29  * @author Peter Zavadsky
30  */

31 public class HardCodedString extends Object JavaDoc {
32
33     /** Actual text representing hard coded string. */
34     private String JavaDoc text;
35
36     /** Start position of hard coded string. */
37     private Position JavaDoc startPosition;
38
39     /** End position of hard coded string. */
40     private Position JavaDoc endPosition;
41
42
43     /** Creates new <code>HardCodedString</code>. */
44     public HardCodedString(String JavaDoc text, Position JavaDoc startPosition, Position JavaDoc endPosition) {
45         this.text = text;
46         this.startPosition = startPosition;
47         this.endPosition = endPosition;
48     }
49     
50
51     /** Getter for hard coded value. Text without double quotes. */
52     public String JavaDoc getText() {
53         return text;
54     }
55
56     /** Getter for start position. */
57     public Position JavaDoc getStartPosition() {
58         return startPosition;
59     }
60
61     /** Getter for end position. */
62     public Position JavaDoc getEndPosition() {
63         return endPosition;
64     }
65     
66     /** Gets length of hard coded string double quotes included. */
67     public int getLength() {
68         return endPosition.getOffset() - startPosition.getOffset();
69     }
70 }
71
Popular Tags