View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   // Generated by Modello 2.1.2,
3   // any modifications will be overwritten.
4   // ==============================================================
5   
6   package org.apache.maven.doxia.site.decoration;
7   
8   /**
9    * A menu item.
10   * 
11   * @version $Revision$ $Date$
12   */
13  @SuppressWarnings( "all" )
14  public class MenuItem
15      extends LinkItem
16      implements java.io.Serializable, java.lang.Cloneable
17  {
18  
19        //--------------------------/
20       //- Class/Member Variables -/
21      //--------------------------/
22  
23      /**
24       * A description of the menu item. This is used on any summary
25       * pages for a menu.
26       */
27      private String description;
28  
29      /**
30       * Whether to collapse children elements of an item menu (by
31       * default).
32       */
33      private boolean collapse = false;
34  
35      /**
36       * A reference to a pre-defined menu item, such as a report
37       * (specified by the report goal
38       *             name). Any elements explicitly given override
39       * those from the pre-defined reference.
40       */
41      private String ref;
42  
43      /**
44       * Field items.
45       */
46      private java.util.List<MenuItem> items;
47  
48  
49        //-----------/
50       //- Methods -/
51      //-----------/
52  
53      /**
54       * Method addItem.
55       * 
56       * @param menuItem a menuItem object.
57       */
58      public void addItem( MenuItem menuItem )
59      {
60          getItems().add( menuItem );
61      } //-- void addItem( MenuItem )
62  
63      /**
64       * Method clone.
65       * 
66       * @return MenuItem
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      } //-- MenuItem clone()
91  
92      /**
93       * Method equals.
94       * 
95       * @param other a other object.
96       * @return boolean
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     } //-- boolean equals( Object )
121 
122     /**
123      * Get a description of the menu item. This is used on any
124      * summary pages for a menu.
125      * 
126      * @return String
127      */
128     public String getDescription()
129     {
130         return this.description;
131     } //-- String getDescription()
132 
133     /**
134      * Method getItems.
135      * 
136      * @return List
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     } //-- java.util.List<MenuItem> getItems()
147 
148     /**
149      * Get a reference to a pre-defined menu item, such as a report
150      * (specified by the report goal
151      *             name). Any elements explicitly given override
152      * those from the pre-defined reference.
153      * 
154      * @return String
155      */
156     public String getRef()
157     {
158         return this.ref;
159     } //-- String getRef()
160 
161     /**
162      * Method hashCode.
163      * 
164      * @return int
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     } //-- int hashCode()
178 
179     /**
180      * Get whether to collapse children elements of an item menu
181      * (by default).
182      * 
183      * @return boolean
184      */
185     public boolean isCollapse()
186     {
187         return this.collapse;
188     } //-- boolean isCollapse()
189 
190     /**
191      * Method removeItem.
192      * 
193      * @param menuItem a menuItem object.
194      */
195     public void removeItem( MenuItem menuItem )
196     {
197         getItems().remove( menuItem );
198     } //-- void removeItem( MenuItem )
199 
200     /**
201      * Set whether to collapse children elements of an item menu
202      * (by default).
203      * 
204      * @param collapse a collapse object.
205      */
206     public void setCollapse( boolean collapse )
207     {
208         this.collapse = collapse;
209     } //-- void setCollapse( boolean )
210 
211     /**
212      * Set a description of the menu item. This is used on any
213      * summary pages for a menu.
214      * 
215      * @param description a description object.
216      */
217     public void setDescription( String description )
218     {
219         this.description = description;
220     } //-- void setDescription( String )
221 
222     /**
223      * Set a list of menu item.
224      * 
225      * @param items a items object.
226      */
227     public void setItems( java.util.List<MenuItem> items )
228     {
229         this.items = items;
230     } //-- void setItems( java.util.List )
231 
232     /**
233      * Set a reference to a pre-defined menu item, such as a report
234      * (specified by the report goal
235      *             name). Any elements explicitly given override
236      * those from the pre-defined reference.
237      * 
238      * @param ref a ref object.
239      */
240     public void setRef( String ref )
241     {
242         this.ref = ref;
243     } //-- void setRef( String )
244 
245     /**
246      * Method toString.
247      * 
248      * @return String
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     } //-- java.lang.String toString()
274 
275 }