Coverage Report - org.apache.maven.plugin.docck.reports.DocumentationReporter
 
Classes in this File Line Coverage Branch Coverage Complexity
DocumentationReporter
0%
0/26
0%
0/10
1,857
 
 1  
 package org.apache.maven.plugin.docck.reports;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.util.List;
 23  
 import java.util.ArrayList;
 24  
 import java.util.Iterator;
 25  
 
 26  
 /**
 27  
  * @author Edwin Punzalan
 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  
                 //first occurrence will do
 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  
 }