Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DocumentTemplate |
|
| 2.6363636363636362;2,636 |
1 | /* | |
2 | =================== DO NOT EDIT THIS FILE ==================== | |
3 | Generated by Modello 1.4.1 on 2012-04-13 21:33:05, | |
4 | any modifications will be overwritten. | |
5 | ============================================================== | |
6 | */ | |
7 | ||
8 | package org.apache.maven.doxia.document; | |
9 | ||
10 | /** | |
11 | * A template that was used to create the document. | |
12 | * | |
13 | * @version $Revision$ $Date$ | |
14 | */ | |
15 | @SuppressWarnings( "all" ) | |
16 | 4 | public class DocumentTemplate |
17 | implements java.io.Serializable | |
18 | { | |
19 | ||
20 | //--------------------------/ | |
21 | //- Class/Member Variables -/ | |
22 | //--------------------------/ | |
23 | ||
24 | /** | |
25 | * | |
26 | * The location of the document template. | |
27 | * | |
28 | */ | |
29 | private String href; | |
30 | ||
31 | /** | |
32 | * | |
33 | * The name of the document template. | |
34 | * | |
35 | */ | |
36 | private String title; | |
37 | ||
38 | /** | |
39 | * | |
40 | * The date and time when the template was last | |
41 | * modified, prior | |
42 | * to being used to create the current document. | |
43 | * Use the ISO 8601 format | |
44 | * "yyyy-MM-dd'T'HH:mm:ss.SSS" in xml. | |
45 | * | |
46 | */ | |
47 | private java.util.Date date; | |
48 | ||
49 | /** | |
50 | * | |
51 | * The date as String (recommended format is ISO | |
52 | * 8601) when the template was last modified. | |
53 | * Only used if <code>date</code> is not set. | |
54 | * @since 1.1.1 | |
55 | * . | |
56 | */ | |
57 | private String modifydate; | |
58 | ||
59 | ||
60 | //-----------/ | |
61 | //- Methods -/ | |
62 | //-----------/ | |
63 | ||
64 | /** | |
65 | * Method equals. | |
66 | * | |
67 | * @param other | |
68 | * @return boolean | |
69 | */ | |
70 | public boolean equals( Object other ) | |
71 | { | |
72 | 2 | if ( this == other ) |
73 | { | |
74 | 0 | return true; |
75 | } | |
76 | ||
77 | 2 | if ( !( other instanceof DocumentTemplate ) ) |
78 | { | |
79 | 0 | return false; |
80 | } | |
81 | ||
82 | 2 | DocumentTemplate that = (DocumentTemplate) other; |
83 | 2 | boolean result = true; |
84 | ||
85 | 2 | result = result && ( getHref() == null ? that.getHref() == null : getHref().equals( that.getHref() ) ); |
86 | 2 | result = result && ( getTitle() == null ? that.getTitle() == null : getTitle().equals( that.getTitle() ) ); |
87 | 2 | result = result && ( getDate() == null ? that.getDate() == null : getDate().equals( that.getDate() ) ); |
88 | 2 | result = result && ( getModifydate() == null ? that.getModifydate() == null : getModifydate().equals( that.getModifydate() ) ); |
89 | ||
90 | 2 | return result; |
91 | } //-- boolean equals( Object ) | |
92 | ||
93 | /** | |
94 | * Get the date and time when the template was last modified, | |
95 | * prior | |
96 | * to being used to create the current document. | |
97 | * Use the ISO 8601 format | |
98 | * "yyyy-MM-dd'T'HH:mm:ss.SSS" in xml. | |
99 | * | |
100 | * @return Date | |
101 | */ | |
102 | public java.util.Date getDate() | |
103 | { | |
104 | 46 | return this.date; |
105 | } //-- java.util.Date getDate() | |
106 | ||
107 | /** | |
108 | * Get the location of the document template. | |
109 | * | |
110 | * @return String | |
111 | */ | |
112 | public String getHref() | |
113 | { | |
114 | 18 | return this.href; |
115 | } //-- String getHref() | |
116 | ||
117 | /** | |
118 | * Get the name of the document template. | |
119 | * | |
120 | * @return String | |
121 | */ | |
122 | public String getTitle() | |
123 | { | |
124 | 18 | return this.title; |
125 | } //-- String getTitle() | |
126 | ||
127 | /** | |
128 | * Method hashCode. | |
129 | * | |
130 | * @return int | |
131 | */ | |
132 | public int hashCode() | |
133 | { | |
134 | 4 | int result = 17; |
135 | ||
136 | 4 | result = 37 * result + ( href != null ? href.hashCode() : 0 ); |
137 | 4 | result = 37 * result + ( title != null ? title.hashCode() : 0 ); |
138 | 4 | result = 37 * result + ( date != null ? date.hashCode() : 0 ); |
139 | 4 | result = 37 * result + ( modifydate != null ? modifydate.hashCode() : 0 ); |
140 | ||
141 | 4 | return result; |
142 | } //-- int hashCode() | |
143 | ||
144 | /** | |
145 | * Set the date and time when the template was last modified, | |
146 | * prior | |
147 | * to being used to create the current document. | |
148 | * Use the ISO 8601 format | |
149 | * "yyyy-MM-dd'T'HH:mm:ss.SSS" in xml. | |
150 | * | |
151 | * @param date | |
152 | */ | |
153 | public void setDate( java.util.Date date ) | |
154 | { | |
155 | 4 | this.date = date; |
156 | 4 | } //-- void setDate( java.util.Date ) |
157 | ||
158 | /** | |
159 | * Set the location of the document template. | |
160 | * | |
161 | * @param href | |
162 | */ | |
163 | public void setHref( String href ) | |
164 | { | |
165 | 4 | this.href = href; |
166 | 4 | } //-- void setHref( String ) |
167 | ||
168 | /** | |
169 | * Set the date as String (recommended format is ISO 8601) when | |
170 | * the template was last modified. | |
171 | * Only used if <code>date</code> is not set. | |
172 | * @since 1.1.1. | |
173 | * | |
174 | * @param modifydate | |
175 | */ | |
176 | public void setModifydate( String modifydate ) | |
177 | { | |
178 | 2 | this.modifydate = modifydate; |
179 | 2 | } //-- void setModifydate( String ) |
180 | ||
181 | /** | |
182 | * Set the name of the document template. | |
183 | * | |
184 | * @param title | |
185 | */ | |
186 | public void setTitle( String title ) | |
187 | { | |
188 | 4 | this.title = title; |
189 | 4 | } //-- void setTitle( String ) |
190 | ||
191 | /** | |
192 | * Method toString. | |
193 | * | |
194 | * @return String | |
195 | */ | |
196 | public java.lang.String toString() | |
197 | { | |
198 | 4 | StringBuilder buf = new StringBuilder( 128 ); |
199 | ||
200 | 4 | buf.append( "href = '" ); |
201 | 4 | buf.append( getHref() ); |
202 | 4 | buf.append( "'" ); |
203 | 4 | buf.append( "\n" ); |
204 | 4 | buf.append( "title = '" ); |
205 | 4 | buf.append( getTitle() ); |
206 | 4 | buf.append( "'" ); |
207 | 4 | buf.append( "\n" ); |
208 | 4 | buf.append( "date = '" ); |
209 | 4 | buf.append( getDate() ); |
210 | 4 | buf.append( "'" ); |
211 | 4 | buf.append( "\n" ); |
212 | 4 | buf.append( "modifydate = '" ); |
213 | 4 | buf.append( getModifydate() ); |
214 | 4 | buf.append( "'" ); |
215 | ||
216 | 4 | return buf.toString(); |
217 | } //-- java.lang.String toString() | |
218 | ||
219 | ||
220 | ||
221 | /** ISO 8601 date format, i.e. <code>yyyy-MM-dd</code> **/ | |
222 | 2 | private static final java.text.DateFormat ISO_8601_FORMAT = new java.text.SimpleDateFormat( "yyyy-MM-dd", java.util.Locale.ENGLISH ); |
223 | ||
224 | /** | |
225 | * Get the date and time when the template was last modified. | |
226 | * | |
227 | * @return the <code>getDate()</code> if setted, formatted using ISO-8601 English format, otherwise return | |
228 | * the <code>modifydate</code>. | |
229 | * @since 1.1.1 | |
230 | * @see #getDate() | |
231 | */ | |
232 | public String getModifydate() | |
233 | { | |
234 | 14 | if ( getDate() != null ) |
235 | { | |
236 | 14 | return ISO_8601_FORMAT.format( getDate() ); |
237 | } | |
238 | ||
239 | 0 | return this.modifydate; |
240 | } | |
241 | ||
242 | ||
243 | } |