001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package javax.servlet.jsp.tagext;
019:
020: /**
021: * Variable information for a tag in a Tag Library;
022: * This class is instantiated from the Tag Library Descriptor file (TLD)
023: * and is available only at translation time.
024: *
025: * This object should be immutable.
026: *
027: * This information is only available in JSP 1.2 format TLDs or above.
028: */
029:
030: public class TagVariableInfo {
031:
032: /**
033: * Constructor for TagVariableInfo.
034: *
035: * @param nameGiven value of <name-given>
036: * @param nameFromAttribute value of <name-from-attribute>
037: * @param className value of <variable-class>
038: * @param declare value of <declare>
039: * @param scope value of <scope>
040: */
041: public TagVariableInfo(String nameGiven, String nameFromAttribute,
042: String className, boolean declare, int scope) {
043: this .nameGiven = nameGiven;
044: this .nameFromAttribute = nameFromAttribute;
045: this .className = className;
046: this .declare = declare;
047: this .scope = scope;
048: }
049:
050: /**
051: * The body of the <name-given> element.
052: *
053: * @return The variable name as a constant
054: */
055:
056: public String getNameGiven() {
057: return nameGiven;
058: }
059:
060: /**
061: * The body of the <name-from-attribute> element.
062: * This is the name of an attribute whose (translation-time)
063: * value will give the name of the variable. One of
064: * <name-given> or <name-from-attribute> is required.
065: *
066: * @return The attribute whose value defines the variable name
067: */
068:
069: public String getNameFromAttribute() {
070: return nameFromAttribute;
071: }
072:
073: /**
074: * The body of the <variable-class> element.
075: *
076: * @return The name of the class of the variable or
077: * 'java.lang.String' if not defined in the TLD.
078: */
079:
080: public String getClassName() {
081: return className;
082: }
083:
084: /**
085: * The body of the <declare> element.
086: *
087: * @return Whether the variable is to be declared or not.
088: * If not defined in the TLD, 'true' will be returned.
089: */
090:
091: public boolean getDeclare() {
092: return declare;
093: }
094:
095: /**
096: * The body of the <scope> element.
097: *
098: * @return The scope to give the variable. NESTED
099: * scope will be returned if not defined in
100: * the TLD.
101: */
102:
103: public int getScope() {
104: return scope;
105: }
106:
107: /*
108: * private fields
109: */
110: private String nameGiven; // <name-given>
111: private String nameFromAttribute; // <name-from-attribute>
112: private String className; // <class>
113: private boolean declare; // <declare>
114: private int scope; // <scope>
115: }
|