KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > internal > parsing > IdentificationVariableDeclNode


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2005, Oracle. All rights reserved.
22
package oracle.toplink.essentials.internal.parsing;
23
24 /**
25  * INTERNAL
26  * <p><b>Purpose</b>: This is the superclass for all
27  * identification declaration nodes.
28  * <p><b>Responsibilities</b>:<ul>
29  * Manage the name of the identification variable.
30  * </ul>
31  */

32 public abstract class IdentificationVariableDeclNode extends Node {
33
34     /** The variable name as specified. */
35     private String JavaDoc name;
36     
37     /** The canonical represenatation of the variable name. */
38     private String JavaDoc canonicalName;
39     
40     /** */
41     public String JavaDoc getVariableName() {
42         return name;
43     }
44     
45     /** */
46     public void setVariableName(String JavaDoc name) {
47         this.name = name;
48         this.canonicalName = calculateCanonicalName(name);
49     }
50
51     /** */
52     public String JavaDoc getCanonicalVariableName() {
53         return canonicalName;
54     }
55
56     /** */
57     public static String JavaDoc calculateCanonicalName(String JavaDoc name) {
58         return name.toLowerCase();
59     }
60
61     /** */
62     public Node getPath() {
63         return null;
64     }
65     
66     /**
67      * INTERNAL
68      * Validate node and calculate its type.
69      */

70     public void validate(ParseTreeContext context) {
71         context.setScopeOfVariable(canonicalName);
72     }
73     
74 }
75
Popular Tags