1 | |
package org.apache.maven.plugin.docck.reports; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import java.util.List; |
23 | |
import java.util.ArrayList; |
24 | |
import java.util.Iterator; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | 0 | public class DocumentationReporter |
30 | |
{ |
31 | 0 | private List reports = new ArrayList(); |
32 | |
|
33 | |
public void info( String message ) |
34 | |
{ |
35 | 0 | reports.add( new InfoDocumentationReport( "[INFO] " + message ) ); |
36 | 0 | } |
37 | |
|
38 | |
public void warn( String message ) |
39 | |
{ |
40 | 0 | reports.add( new WarningDocumentationReport( "[WARN] " + message ) ); |
41 | 0 | } |
42 | |
|
43 | |
public void error( String message ) |
44 | |
{ |
45 | 0 | reports.add( new ErrorDocumentationReport( "[ERROR] " + message ) ); |
46 | 0 | } |
47 | |
|
48 | |
public List getMessagesByType( int type ) |
49 | |
{ |
50 | 0 | List list = new ArrayList(); |
51 | |
|
52 | 0 | for ( Iterator iter = reports.iterator(); iter.hasNext(); ) |
53 | |
{ |
54 | 0 | DocumentationReport report = (DocumentationReport) iter.next(); |
55 | |
|
56 | 0 | if ( report.getType() == type ) |
57 | |
{ |
58 | 0 | list.add( report.getMessage() ); |
59 | |
} |
60 | |
} |
61 | |
|
62 | 0 | return list; |
63 | |
} |
64 | |
|
65 | |
public List getMessages() |
66 | |
{ |
67 | 0 | List list = new ArrayList(); |
68 | |
|
69 | 0 | for ( Iterator iter = reports.iterator(); iter.hasNext(); ) |
70 | |
{ |
71 | 0 | DocumentationReport report = (DocumentationReport) iter.next(); |
72 | |
|
73 | 0 | list.add( report.getMessage() ); |
74 | |
} |
75 | |
|
76 | 0 | return list; |
77 | |
} |
78 | |
|
79 | |
public boolean hasErrors() |
80 | |
{ |
81 | 0 | for ( Iterator iter = reports.iterator(); iter.hasNext(); ) |
82 | |
{ |
83 | 0 | DocumentationReport report = (DocumentationReport) iter.next(); |
84 | |
|
85 | 0 | if ( report.getType() == DocumentationReport.TYPE_ERROR ) |
86 | |
{ |
87 | |
|
88 | 0 | return true; |
89 | |
} |
90 | |
} |
91 | |
|
92 | 0 | return false; |
93 | |
} |
94 | |
|
95 | |
public void clear() |
96 | |
{ |
97 | 0 | reports.clear(); |
98 | 0 | } |
99 | |
} |