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