1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package net.sf.maventaglib.checker;
25
26 import org.apache.commons.lang3.builder.CompareToBuilder;
27 import org.apache.commons.lang3.builder.EqualsBuilder;
28 import org.apache.commons.lang3.builder.HashCodeBuilder;
29
30
31
32
33
34
35 public class TldItem implements Comparable<TldItem>
36 {
37
38 private String name;
39
40 private String description;
41
42 private String example;
43
44 private boolean deprecated;
45
46 public String getName()
47 {
48 return this.name;
49 }
50
51 public void setName(String tagName)
52 {
53 this.name = tagName;
54 }
55
56 public String getDescription()
57 {
58 return this.description;
59 }
60
61 public void setDescription(String description)
62 {
63 this.description = description;
64 }
65
66 public String getExample()
67 {
68 return this.example;
69 }
70
71 public void setExample(String example)
72 {
73 this.example = example;
74 }
75
76 public boolean isDeprecated()
77 {
78 return this.deprecated;
79 }
80
81 public void setDeprecated(boolean deprecated)
82 {
83 this.deprecated = deprecated;
84 }
85
86
87
88
89 public int compareTo(TldItem object)
90 {
91 if(object == this)
92 {
93 return 0;
94 }
95
96 if(object.getClass() != getClass())
97 {
98 throw new ClassCastException("compareTo with different classes: " +
99 this.getClass().getName() +
100 " <> " +
101 object.getClass().getName());
102 }
103
104 return new CompareToBuilder()
105 .append(this.deprecated, object.deprecated)
106 .append(this.name, object.name)
107 .toComparison();
108 }
109
110
111
112
113 @Override
114 public boolean equals(Object obj)
115 {
116 if(obj == null)
117 {
118 return false;
119 }
120
121 if(obj == this)
122 {
123 return true;
124 }
125
126 if(obj.getClass() != getClass())
127 {
128 return false;
129 }
130
131 TldItem rhs = (TldItem) obj;
132 return new EqualsBuilder()
133 .append(this.deprecated, rhs.deprecated)
134 .append(this.name, rhs.name)
135 .isEquals();
136 }
137
138
139
140
141 @Override
142 public int hashCode() {
143 return new HashCodeBuilder()
144 .append(this.deprecated)
145 .append(this.name)
146 .toHashCode();
147 }
148 }