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;
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       * Whether to collapse children elements of an item menu (by
25       * default).
26       */
27      private boolean collapse = false;
28  
29      /**
30       * A reference to a pre-defined menu item, such as a report
31       * (specified by the report goal
32       *             name). Any elements explicitly given override
33       * those from the pre-defined reference.
34       */
35      private String ref;
36  
37      /**
38       * Field items.
39       */
40      private java.util.List<MenuItem> items;
41  
42  
43        //-----------/
44       //- Methods -/
45      //-----------/
46  
47      /**
48       * Method addItem.
49       * 
50       * @param menuItem a menuItem object.
51       */
52      public void addItem( MenuItem menuItem )
53      {
54          getItems().add( menuItem );
55      } //-- void addItem( MenuItem )
56  
57      /**
58       * Method clone.
59       * 
60       * @return MenuItem
61       */
62      public MenuItem clone()
63      {
64          try
65          {
66              MenuItem copy = (MenuItem) super.clone();
67  
68              if ( this.items != null )
69              {
70                  copy.items = new java.util.ArrayList<MenuItem>();
71                  for ( MenuItem item : this.items )
72                  {
73                      copy.items.add( ( (MenuItem) item).clone() );
74                  }
75              }
76  
77              return copy;
78          }
79          catch ( java.lang.Exception ex )
80          {
81              throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
82                  + " does not support clone()" ).initCause( ex );
83          }
84      } //-- MenuItem clone()
85  
86      /**
87       * Method equals.
88       * 
89       * @param other a other object.
90       * @return boolean
91       */
92      public boolean equals( Object other )
93      {
94          if ( this == other )
95          {
96              return true;
97          }
98  
99          if ( !( other instanceof MenuItem ) )
100         {
101             return false;
102         }
103 
104         MenuItem that = (MenuItem) other;
105         boolean result = true;
106 
107         result = result && collapse == that.collapse;
108         result = result && ( getRef() == null ? that.getRef() == null : getRef().equals( that.getRef() ) );
109         result = result && ( getItems() == null ? that.getItems() == null : getItems().equals( that.getItems() ) );
110         result = result && ( super.equals( other ) );
111 
112         return result;
113     } //-- boolean equals( Object )
114 
115     /**
116      * Method getItems.
117      * 
118      * @return List
119      */
120     public java.util.List<MenuItem> getItems()
121     {
122         if ( this.items == null )
123         {
124             this.items = new java.util.ArrayList<MenuItem>();
125         }
126 
127         return this.items;
128     } //-- java.util.List<MenuItem> getItems()
129 
130     /**
131      * Get a reference to a pre-defined menu item, such as a report
132      * (specified by the report goal
133      *             name). Any elements explicitly given override
134      * those from the pre-defined reference.
135      * 
136      * @return String
137      */
138     public String getRef()
139     {
140         return this.ref;
141     } //-- String getRef()
142 
143     /**
144      * Method hashCode.
145      * 
146      * @return int
147      */
148     public int hashCode()
149     {
150         int result = 17;
151 
152         result = 37 * result + ( collapse ? 0 : 1 );
153         result = 37 * result + ( ref != null ? ref.hashCode() : 0 );
154         result = 37 * result + ( items != null ? items.hashCode() : 0 );
155         result = 37 * result + super.hashCode();
156 
157         return result;
158     } //-- int hashCode()
159 
160     /**
161      * Get whether to collapse children elements of an item menu
162      * (by default).
163      * 
164      * @return boolean
165      */
166     public boolean isCollapse()
167     {
168         return this.collapse;
169     } //-- boolean isCollapse()
170 
171     /**
172      * Method removeItem.
173      * 
174      * @param menuItem a menuItem object.
175      */
176     public void removeItem( MenuItem menuItem )
177     {
178         getItems().remove( menuItem );
179     } //-- void removeItem( MenuItem )
180 
181     /**
182      * Set whether to collapse children elements of an item menu
183      * (by default).
184      * 
185      * @param collapse a collapse object.
186      */
187     public void setCollapse( boolean collapse )
188     {
189         this.collapse = collapse;
190     } //-- void setCollapse( boolean )
191 
192     /**
193      * Set a list of menu item.
194      * 
195      * @param items a items object.
196      */
197     public void setItems( java.util.List<MenuItem> items )
198     {
199         this.items = items;
200     } //-- void setItems( java.util.List )
201 
202     /**
203      * Set a reference to a pre-defined menu item, such as a report
204      * (specified by the report goal
205      *             name). Any elements explicitly given override
206      * those from the pre-defined reference.
207      * 
208      * @param ref a ref object.
209      */
210     public void setRef( String ref )
211     {
212         this.ref = ref;
213     } //-- void setRef( String )
214 
215     /**
216      * Method toString.
217      * 
218      * @return String
219      */
220     public java.lang.String toString()
221     {
222         StringBuilder buf = new StringBuilder( 128 );
223 
224         buf.append( "collapse = '" );
225         buf.append( isCollapse() );
226         buf.append( "'" );
227         buf.append( "\n" ); 
228         buf.append( "ref = '" );
229         buf.append( getRef() );
230         buf.append( "'" );
231         buf.append( "\n" ); 
232         buf.append( "items = '" );
233         buf.append( getItems() );
234         buf.append( "'" );
235         buf.append( "\n" );
236         buf.append( super.toString() );
237 
238         return buf.toString();
239     } //-- java.lang.String toString()
240 
241 }