2009/05/20 - Apache Shale has been retired.
For more information, please explore the Attic.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 }