1
2
3
4
5
6
7
8
9
10
11 package org.apache.maven.doxia.site;
12
13
14
15
16
17
18 @SuppressWarnings( "all" )
19 public class Menu
20 implements java.io.Serializable, java.lang.Cloneable
21 {
22
23
24
25
26
27
28
29
30 private String name;
31
32
33
34
35
36
37
38 private String inherit;
39
40
41
42
43
44
45
46
47
48
49 private boolean inheritAsRef = false;
50
51
52
53
54
55
56
57
58
59 private String ref;
60
61
62
63
64 private Image image;
65
66
67
68
69 private java.util.List<MenuItem> items;
70
71
72
73
74
75
76
77
78
79
80
81 public void addItem( MenuItem menuItem )
82 {
83 getItems().add( menuItem );
84 }
85
86
87
88
89
90
91 public Menu clone()
92 {
93 try
94 {
95 Menu copy = (Menu) super.clone();
96
97 if ( this.image != null )
98 {
99 copy.image = (Image) this.image.clone();
100 }
101
102 if ( this.items != null )
103 {
104 copy.items = new java.util.ArrayList<MenuItem>();
105 for ( MenuItem item : this.items )
106 {
107 copy.items.add( ( (MenuItem) item).clone() );
108 }
109 }
110
111 return copy;
112 }
113 catch ( java.lang.Exception ex )
114 {
115 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
116 + " does not support clone()" ).initCause( ex );
117 }
118 }
119
120
121
122
123
124
125
126 public boolean equals( Object other )
127 {
128 if ( this == other )
129 {
130 return true;
131 }
132
133 if ( !( other instanceof Menu ) )
134 {
135 return false;
136 }
137
138 Menu that = (Menu) other;
139 boolean result = true;
140
141 result = result && ( getName() == null ? that.getName() == null : getName().equals( that.getName() ) );
142 result = result && ( getInherit() == null ? that.getInherit() == null : getInherit().equals( that.getInherit() ) );
143 result = result && ( getRef() == null ? that.getRef() == null : getRef().equals( that.getRef() ) );
144 result = result && ( getImage() == null ? that.getImage() == null : getImage().equals( that.getImage() ) );
145 result = result && ( getItems() == null ? that.getItems() == null : getItems().equals( that.getItems() ) );
146
147 return result;
148 }
149
150
151
152
153
154
155 public Image getImage()
156 {
157 return this.image;
158 }
159
160
161
162
163
164
165
166 public String getInherit()
167 {
168 return this.inherit;
169 }
170
171
172
173
174
175
176 public java.util.List<MenuItem> getItems()
177 {
178 if ( this.items == null )
179 {
180 this.items = new java.util.ArrayList<MenuItem>();
181 }
182
183 return this.items;
184 }
185
186
187
188
189
190
191 public String getName()
192 {
193 return this.name;
194 }
195
196
197
198
199
200
201
202
203
204 public String getRef()
205 {
206 return this.ref;
207 }
208
209
210
211
212
213
214 public int hashCode()
215 {
216 int result = 17;
217
218 result = 37 * result + ( name != null ? name.hashCode() : 0 );
219 result = 37 * result + ( inherit != null ? inherit.hashCode() : 0 );
220 result = 37 * result + ( ref != null ? ref.hashCode() : 0 );
221 result = 37 * result + ( image != null ? image.hashCode() : 0 );
222 result = 37 * result + ( items != null ? items.hashCode() : 0 );
223
224 return result;
225 }
226
227
228
229
230
231
232
233
234
235
236 public boolean isInheritAsRef()
237 {
238 return this.inheritAsRef;
239 }
240
241
242
243
244
245
246 public void removeItem( MenuItem menuItem )
247 {
248 getItems().remove( menuItem );
249 }
250
251
252
253
254
255
256 public void setImage( Image image )
257 {
258 this.image = image;
259 }
260
261
262
263
264
265
266
267 public void setInherit( String inherit )
268 {
269 this.inherit = inherit;
270 }
271
272
273
274
275
276
277
278
279
280
281 public void setInheritAsRef( boolean inheritAsRef )
282 {
283 this.inheritAsRef = inheritAsRef;
284 }
285
286
287
288
289
290
291 public void setItems( java.util.List<MenuItem> items )
292 {
293 this.items = items;
294 }
295
296
297
298
299
300
301 public void setName( String name )
302 {
303 this.name = name;
304 }
305
306
307
308
309
310
311
312
313
314 public void setRef( String ref )
315 {
316 this.ref = ref;
317 }
318
319
320
321
322
323
324 public java.lang.String toString()
325 {
326 StringBuilder buf = new StringBuilder( 128 );
327
328 buf.append( "name = '" );
329 buf.append( getName() );
330 buf.append( "'" );
331 buf.append( "\n" );
332 buf.append( "inherit = '" );
333 buf.append( getInherit() );
334 buf.append( "'" );
335 buf.append( "\n" );
336 buf.append( "ref = '" );
337 buf.append( getRef() );
338 buf.append( "'" );
339 buf.append( "\n" );
340 buf.append( "image = '" );
341 buf.append( getImage() );
342 buf.append( "'" );
343 buf.append( "\n" );
344 buf.append( "items = '" );
345 buf.append( getItems() );
346 buf.append( "'" );
347
348 return buf.toString();
349 }
350
351 }