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