View Javadoc

    1   /*
    2    * Copyright 2002,2004 The Apache Software Foundation.
    3    *
    4    * Licensed under the Apache License, Version 2.0 (the "License");
    5    * you may not use this file except in compliance with the License.
    6    * You may obtain a copy of the License at
    7    *
    8    *      http://www.apache.org/licenses/LICENSE-2.0
    9    *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  package org.apache.commons.jelly.impl;
    17
    18  import org.apache.commons.jelly.expression.Expression;
    19
    20  /***
    21   * Represents the attribute definition used by dynamic tags, such as whether the attribute is required
    22   * or any default values etc.
    23   *
    24   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    25   * @version $Revision: 155420 $
    26   */
    27  public class Attribute {
    28
    29      /*** the name of the attribute */
    30      private String name;
    31
    32      /*** the default value expression */
    33      private Expression defaultValue;
    34
    35      /*** whether this attribute is required */
    36      private boolean required;
    37
    38      public Attribute() {
    39      }
    40
    41      // Properties
    42      //-------------------------------------------------------------------------
    43
    44      /***
    45       * Returns whether this attribute is required.
    46       * @return boolean
    47       */
    48      public boolean isRequired() {
    49          return required;
    50      }
    51
    52      /***
    53       * Sets whether this attribute is required.
    54       * @param required is true if this attribute is a mandatory attribute
    55       */
    56      public void setRequired(boolean required) {
    57          this.required = required;
    58      }
    59
    60      /***
    61       * Returns the name.
    62       * @return String
    63       */
    64      public String getName() {
    65          return name;
    66      }
    67
    68      /***
    69       * Sets the name.
    70       * @param name The name to set
    71       */
    72      public void setName(String name) {
    73          this.name = name;
    74      }
    75
    76      /***
    77       * Returns the defaultValue.
    78       * @return Expression
    79       */
    80      public Expression getDefaultValue() {
    81          return defaultValue;
    82      }
    83
    84      /***
    85       * Sets the defaultValue.
    86       * @param defaultValue The defaultValue to set
    87       */
    88      public void setDefaultValue(Expression defaultValue) {
    89          this.defaultValue = defaultValue;
    90      }
    91
    92  }