1
2
3
4
5
6 package org.apache.maven.doxia.site.decoration;
7
8
9
10
11
12
13 @SuppressWarnings( "all" )
14 public class MenuItem
15 extends LinkItem
16 implements java.io.Serializable, java.lang.Cloneable
17 {
18
19
20
21
22
23
24
25
26
27 private String description;
28
29
30
31
32
33 private boolean collapse = false;
34
35
36
37
38
39
40
41 private String ref;
42
43
44
45
46 private java.util.List<MenuItem> items;
47
48
49
50
51
52
53
54
55
56
57
58 public void addItem( MenuItem menuItem )
59 {
60 getItems().add( menuItem );
61 }
62
63
64
65
66
67
68 public MenuItem clone()
69 {
70 try
71 {
72 MenuItem copy = (MenuItem) super.clone();
73
74 if ( this.items != null )
75 {
76 copy.items = new java.util.ArrayList<MenuItem>();
77 for ( MenuItem item : this.items )
78 {
79 copy.items.add( ( (MenuItem) item).clone() );
80 }
81 }
82
83 return copy;
84 }
85 catch ( java.lang.Exception ex )
86 {
87 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
88 + " does not support clone()" ).initCause( ex );
89 }
90 }
91
92
93
94
95
96
97
98 public boolean equals( Object other )
99 {
100 if ( this == other )
101 {
102 return true;
103 }
104
105 if ( !( other instanceof MenuItem ) )
106 {
107 return false;
108 }
109
110 MenuItem that = (MenuItem) other;
111 boolean result = true;
112
113 result = result && ( getDescription() == null ? that.getDescription() == null : getDescription().equals( that.getDescription() ) );
114 result = result && collapse == that.collapse;
115 result = result && ( getRef() == null ? that.getRef() == null : getRef().equals( that.getRef() ) );
116 result = result && ( getItems() == null ? that.getItems() == null : getItems().equals( that.getItems() ) );
117 result = result && ( super.equals( other ) );
118
119 return result;
120 }
121
122
123
124
125
126
127
128 public String getDescription()
129 {
130 return this.description;
131 }
132
133
134
135
136
137
138 public java.util.List<MenuItem> getItems()
139 {
140 if ( this.items == null )
141 {
142 this.items = new java.util.ArrayList<MenuItem>();
143 }
144
145 return this.items;
146 }
147
148
149
150
151
152
153
154
155
156 public String getRef()
157 {
158 return this.ref;
159 }
160
161
162
163
164
165
166 public int hashCode()
167 {
168 int result = 17;
169
170 result = 37 * result + ( description != null ? description.hashCode() : 0 );
171 result = 37 * result + ( collapse ? 0 : 1 );
172 result = 37 * result + ( ref != null ? ref.hashCode() : 0 );
173 result = 37 * result + ( items != null ? items.hashCode() : 0 );
174 result = 37 * result + super.hashCode();
175
176 return result;
177 }
178
179
180
181
182
183
184
185 public boolean isCollapse()
186 {
187 return this.collapse;
188 }
189
190
191
192
193
194
195 public void removeItem( MenuItem menuItem )
196 {
197 getItems().remove( menuItem );
198 }
199
200
201
202
203
204
205
206 public void setCollapse( boolean collapse )
207 {
208 this.collapse = collapse;
209 }
210
211
212
213
214
215
216
217 public void setDescription( String description )
218 {
219 this.description = description;
220 }
221
222
223
224
225
226
227 public void setItems( java.util.List<MenuItem> items )
228 {
229 this.items = items;
230 }
231
232
233
234
235
236
237
238
239
240 public void setRef( String ref )
241 {
242 this.ref = ref;
243 }
244
245
246
247
248
249
250 public java.lang.String toString()
251 {
252 StringBuilder buf = new StringBuilder( 128 );
253
254 buf.append( "description = '" );
255 buf.append( getDescription() );
256 buf.append( "'" );
257 buf.append( "\n" );
258 buf.append( "collapse = '" );
259 buf.append( isCollapse() );
260 buf.append( "'" );
261 buf.append( "\n" );
262 buf.append( "ref = '" );
263 buf.append( getRef() );
264 buf.append( "'" );
265 buf.append( "\n" );
266 buf.append( "items = '" );
267 buf.append( getItems() );
268 buf.append( "'" );
269 buf.append( "\n" );
270 buf.append( super.toString() );
271
272 return buf.toString();
273 }
274
275 }