View Javadoc

    1   /**
    2    *
    3    * Copyright 2003-2004 The Apache Software Foundation
    4    *
    5    *  Licensed under the Apache License, Version 2.0 (the "License");
    6    *  you may not use this file except in compliance with the License.
    7    *  You may obtain a copy of the License at
    8    *
    9    *     http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   *  Unless required by applicable law or agreed to in writing, software
    12   *  distributed under the License is distributed on an "AS IS" BASIS,
    13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   *  See the License for the specific language governing permissions and
    15   *  limitations under the License.
    16   */
    17
    18  //
    19  // This source code implements specifications defined by the Java
    20  // Community Process. In order to remain compliant with the specification
    21  // DO NOT add / change / or delete method signatures!
    22  //
    23
    24  package javax.servlet.jsp.tagext;
    25
    26  /**
    27   * Variable information for a tag in a Tag Library;
    28   * This class is instantiated from the Tag Library Descriptor file (TLD)
    29   * and is available only at translation time.
    30   *
    31   * This object should be immutable.
    32   *
    33   * This information is only available in JSP 1.2 format TLDs or above.
    34   */
    35
    36  public class TagVariableInfo {
    37
    38      /**
    39       * Constructor for TagVariableInfo.
    40       *
    41       * @param nameGiven value of &lt;name-given&gt;
    42       * @param nameFromAttribute value of &lt;name-from-attribute&gt;
    43       * @param className value of &lt;variable-class&gt;
    44       * @param declare value of &lt;declare&gt;
    45       * @param scope value of &lt;scope&gt;
    46       */
    47      public TagVariableInfo(
    48  	    String nameGiven,
    49  	    String nameFromAttribute,
    50  	    String className,
    51  	    boolean declare,
    52  	    int scope) {
    53  	this.nameGiven         = nameGiven;
    54  	this.nameFromAttribute = nameFromAttribute;
    55  	this.className         = className;
    56  	this.declare           = declare;
    57  	this.scope             = scope;
    58      }
    59
    60      /**
    61       * The body of the &lt;name-given&gt; element.
    62       *
    63       * @return The variable name as a constant
    64       */
    65
    66      public String getNameGiven() {
    67  	return nameGiven;
    68      }
    69
    70      /**
    71       * The body of the &lt;name-from-attribute&gt; element.
    72       * This is the name of an attribute whose (translation-time)
    73       * value will give the name of the variable.  One of
    74       * &lt;name-given&gt; or &lt;name-from-attribute&gt; is required.
    75       *
    76       * @return The attribute whose value defines the variable name
    77       */
    78
    79      public String getNameFromAttribute() {
    80  	return nameFromAttribute;
    81      }
    82
    83      /**
    84       * The body of the &lt;variable-class&gt; element.
    85       *
    86       * @return The name of the class of the variable or
    87       *         'java.lang.String' if not defined in the TLD.
    88       */
    89
    90      public String getClassName() {
    91  	return className;
    92      }
    93
    94      /**
    95       * The body of the &lt;declare&gt; element.
    96       *
    97       * @return Whether the variable is to be declared or not.
    98       *         If not defined in the TLD, 'true' will be returned.
    99       */
    100
    101     public boolean getDeclare() {
    102 	return declare;
    103     }
    104
    105     /**
    106      * The body of the &lt;scope&gt; element.
    107      *
    108      * @return The scope to give the variable.  NESTED
    109      *         scope will be returned if not defined in
    110      *         the TLD.
    111      */
    112
    113     public int getScope() {
    114 	return scope;
    115     }
    116
    117
    118     /*
    119      * private fields
    120      */
    121     private String   nameGiven;         // <name-given>
    122     private String   nameFromAttribute; // <name-from-attribute>
    123     private String   className;         // <class>
    124     private boolean  declare;           // <declare>
    125     private int      scope;             // <scope>
    126 }