UntypedAttribute xref

View Javadoc

    1   /*
    2    * $Id: UntypedAttribute.java 471754 2006-11-06 14:55:09Z husted $
    3    *
    4    * Licensed to the Apache Software Foundation (ASF) under one
    5    * or more contributor license agreements.  See the NOTICE file
    6    * distributed with this work for additional information
    7    * regarding copyright ownership.  The ASF licenses this file
    8    * to you under the Apache License, Version 2.0 (the
    9    * "License"); you may not use this file except in compliance
    10   * with the License.  You may obtain a copy of the License at
    11   *
    12   *  http://www.apache.org/licenses/LICENSE-2.0
    13   *
    14   * Unless required by applicable law or agreed to in writing,
    15   * software distributed under the License is distributed on an
    16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    17   * KIND, either express or implied.  See the License for the
    18   * specific language governing permissions and limitations
    19   * under the License.
    20   */
    21
    22  package org.apache.struts.tiles;
    23
    24  /**
    25   * Common implementation of attribute definition.
    26   */
    27  public class UntypedAttribute implements AttributeDefinition {
    28
    29      /**
    30       * Role associated to this attribute.
    31       */
    32      protected String role = null;
    33
    34      protected Object value=null;
    35
    36      /**
    37       * Constructor.
    38       * @param value Object to store.
    39       */
    40      public UntypedAttribute(Object value) {
    41          this.value = value;
    42      }
    43
    44      /**
    45       * Constructor.
    46       * @param value Object to store.
    47       * @param role Asociated role.
    48       */
    49      public UntypedAttribute(Object value, String role) {
    50          this.value = value;
    51          this.role = role;
    52      }
    53
    54      /**
    55       * Get role.
    56       */
    57      public String getRole() {
    58          return role;
    59      }
    60
    61      /**
    62       * Set role.
    63       * @param role Associated role.
    64       */
    65      public void setRole(String role) {
    66          this.role = role;
    67      }
    68
    69      /**
    70       * Get value.
    71       */
    72      public Object getValue() {
    73          return value;
    74      }
    75
    76      /**
    77       * Set value.
    78       * @param value New value.
    79       */
    80      public void setValue(Object value) {
    81          this.value = value;
    82      }
    83
    84      /**
    85       * Get String representation of this object.
    86       */
    87      public String toString() {
    88          return value.toString();
    89      }
    90
    91  }