2009/05/20 - Apache Shale has been retired.

For more information, please explore the Attic.

View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to you under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  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   * $Id: SymbolBean.java 464373 2006-10-16 04:21:54Z rahul $
20   */
21  package org.apache.shale.clay.config.beans;
22  
23  import java.io.Serializable;
24  
25  
26  /***
27   * <p>A symbol represents a variable replaced in a
28   * JSF binding expression.  Within the expression
29   * symbols are identified by the '@' prefix.</p>
30   *
31   */
32  public class SymbolBean extends AbstractBean implements Serializable,
33          Comparable {
34  
35      /***
36       * <p>Unique serialization id.</p>
37       */
38      private static final long serialVersionUID = -584466364674399355L;
39  
40      /***
41       * <p>Name of the symbol in the target JSF object property.</p>
42       */
43      private String name = null;
44  
45      /***
46       * <p>Value of the named symbol in the target JSF object property.</p>
47       */
48      private String value = null;
49  
50  
51      /***
52       * <p>Returns a name corresponding to an associated JSF object property.</p>
53       *
54       * @return symbol name
55       */
56      public String getName() {
57          return name;
58      }
59  
60      /***
61       * <p>Returns the value of the attribute that can be a literal or a
62       * expression.</p>
63       *
64       * @return symbol value
65       */
66      public String getValue() {
67          return value;
68      }
69  
70      /***
71       * <p>Sets the name of the attribute.</p>
72       *
73       * @param name symbol name
74       */
75      public void setName(String name) {
76          this.name = name;
77      }
78  
79      /***
80       * <p>Sets the value of the attribute.</p>
81       *
82       * @param value symbol value
83       */
84      public void setValue(String value) {
85          this.value = value;
86      }
87  
88      /***
89       * <p>This implementation of the <code>Comparable</code> interface makes
90       * the <code>name</code> property the compared key.</p>
91       *
92       * @param obj object to compare
93       * @return weighted value that describes this object compared with the obj
94       */
95      public int compareTo(Object obj) {
96          SymbolBean item = (SymbolBean) obj;
97  
98          return item.getName().compareTo(getName());
99      }
100 
101 
102     /***
103      * @return describes the state of the symbol
104      */
105     public String toString() {
106         StringBuffer buff = new StringBuffer();
107         buff.append("name=\"").append(name).append("\" value=\"").append(value)
108             .append("\"");
109         return buff.toString();
110     }
111 
112 }