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 public class DocumentationReporter
30 {
31 private List reports = new ArrayList();
32
33 public void info( String message )
34 {
35 reports.add( new InfoDocumentationReport( "[INFO] " + message ) );
36 }
37
38 public void warn( String message )
39 {
40 reports.add( new WarningDocumentationReport( "[WARN] " + message ) );
41 }
42
43 public void error( String message )
44 {
45 reports.add( new ErrorDocumentationReport( "[ERROR] " + message ) );
46 }
47
48 public List getMessagesByType( int type )
49 {
50 List list = new ArrayList();
51
52 for ( Iterator iter = reports.iterator(); iter.hasNext(); )
53 {
54 DocumentationReport report = (DocumentationReport) iter.next();
55
56 if ( report.getType() == type )
57 {
58 list.add( report.getMessage() );
59 }
60 }
61
62 return list;
63 }
64
65 public List getMessages()
66 {
67 List list = new ArrayList();
68
69 for ( Iterator iter = reports.iterator(); iter.hasNext(); )
70 {
71 DocumentationReport report = (DocumentationReport) iter.next();
72
73 list.add( report.getMessage() );
74 }
75
76 return list;
77 }
78
79 public boolean hasErrors()
80 {
81 for ( Iterator iter = reports.iterator(); iter.hasNext(); )
82 {
83 DocumentationReport report = (DocumentationReport) iter.next();
84
85 if ( report.getType() == DocumentationReport.TYPE_ERROR )
86 {
87
88 return true;
89 }
90 }
91
92 return false;
93 }
94
95 public void clear()
96 {
97 reports.clear();
98 }
99 }