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