View Javadoc

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