1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 *
4 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
5 *
6 * Portions Copyright Apache Software Foundation.
7 *
8 * The contents of this file are subject to the terms of either the GNU
9 * General Public License Version 2 only ("GPL") or the Common Development
10 * and Distribution License("CDDL") (collectively, the "License"). You
11 * may not use this file except in compliance with the License. You can obtain
12 * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
13 * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
14 * language governing permissions and limitations under the License.
15 *
16 * When distributing the software, include this License Header Notice in each
17 * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
18 * Sun designates this particular file as subject to the "Classpath" exception
19 * as provided by Sun in the GPL Version 2 section of the License file that
20 * accompanied this code. If applicable, add the following below the License
21 * Header, with the fields enclosed by brackets [] replaced by your own
22 * identifying information: "Portions Copyrighted [year]
23 * [name of copyright owner]"
24 *
25 * Contributor(s):
26 *
27 * If you wish your version of this file to be governed by only the CDDL or
28 * only the GPL Version 2, indicate your decision by adding "[Contributor]
29 * elects to include this software in this distribution under the [CDDL or GPL
30 * Version 2] license." If you don't indicate a single choice of license, a
31 * recipient has the option to distribute your version of this file under
32 * either the CDDL, the GPL Version 2 or to extend the choice of license to
33 * its licensees as provided above. However, if you add GPL Version 2 code
34 * and therefore, elected the GPL Version 2 license, then the option applies
35 * only if the new code is made subject to such option by the copyright
36 * holder.
37 */
38
39 package javax.servlet.jsp.tagext;
40
41 /**
42 * Variable information for a tag in a Tag Library;
43 * This class is instantiated from the Tag Library Descriptor file (TLD)
44 * and is available only at translation time.
45 *
46 * This object should be immutable.
47 *
48 * This information is only available in JSP 1.2 format TLDs or above.
49 */
50
51 public class TagVariableInfo {
52
53 /**
54 * Constructor for TagVariableInfo.
55 *
56 * @param nameGiven value of <name-given>
57 * @param nameFromAttribute value of <name-from-attribute>
58 * @param className value of <variable-class>
59 * @param declare value of <declare>
60 * @param scope value of <scope>
61 */
62 public TagVariableInfo(
63 String nameGiven,
64 String nameFromAttribute,
65 String className,
66 boolean declare,
67 int scope) {
68 this.nameGiven = nameGiven;
69 this.nameFromAttribute = nameFromAttribute;
70 this.className = className;
71 this.declare = declare;
72 this.scope = scope;
73 }
74
75 /**
76 * The body of the <name-given> element.
77 *
78 * @return The variable name as a constant
79 */
80
81 public String getNameGiven() {
82 return nameGiven;
83 }
84
85 /**
86 * The body of the <name-from-attribute> element.
87 * This is the name of an attribute whose (translation-time)
88 * value will give the name of the variable. One of
89 * <name-given> or <name-from-attribute> is required.
90 *
91 * @return The attribute whose value defines the variable name
92 */
93
94 public String getNameFromAttribute() {
95 return nameFromAttribute;
96 }
97
98 /**
99 * The body of the <variable-class> element.
100 *
101 * @return The name of the class of the variable or
102 * 'java.lang.String' if not defined in the TLD.
103 */
104
105 public String getClassName() {
106 return className;
107 }
108
109 /**
110 * The body of the <declare> element.
111 *
112 * @return Whether the variable is to be declared or not.
113 * If not defined in the TLD, 'true' will be returned.
114 */
115
116 public boolean getDeclare() {
117 return declare;
118 }
119
120 /**
121 * The body of the <scope> element.
122 *
123 * @return The scope to give the variable. NESTED
124 * scope will be returned if not defined in
125 * the TLD.
126 */
127
128 public int getScope() {
129 return scope;
130 }
131
132
133 /*
134 * private fields
135 */
136 private String nameGiven; // <name-given>
137 private String nameFromAttribute; // <name-from-attribute>
138 private String className; // <class>
139 private boolean declare; // <declare>
140 private int scope; // <scope>
141 }