hudson.plugins.dry.parser
Class AbstractDryParser

java.lang.Object
  extended by hudson.plugins.dry.parser.AbstractDryParser
All Implemented Interfaces:
AnnotationParser, java.io.Serializable
Direct Known Subclasses:
CpdParser

public abstract class AbstractDryParser
extends java.lang.Object
implements AnnotationParser

A base class for duplicate code parsers. Use this class as a starting point for your duplication result parser and register an instance in the DuplicationParserRegistry.

Author:
Ulli Hafner
See Also:
Serialized Form

Constructor Summary
AbstractDryParser()
           
 
Method Summary
protected abstract  boolean accepts(java.io.InputStream inputStream)
          Returns whether this parser accepts the specified stream as a valid file.
 java.util.Collection<FileAnnotation> parse(java.io.File file, java.lang.String moduleName)
          Returns the annotations found in the specified file.
protected abstract  java.util.Collection<FileAnnotation> parse(java.io.InputStream inputStream, java.lang.String moduleName)
          Returns the duplication annotations found in the specified file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDryParser

public AbstractDryParser()
Method Detail

parse

public java.util.Collection<FileAnnotation> parse(java.io.File file,
                                                  java.lang.String moduleName)
                                           throws java.lang.reflect.InvocationTargetException
Returns the annotations found in the specified file.

Specified by:
parse in interface AnnotationParser
Parameters:
file - the file to parse
moduleName - name of the maven module
Returns:
the parsed result (stored in the module instance)
Throws:
java.lang.reflect.InvocationTargetException - if the file could not be parsed (wrap your exception in this exception)

parse

protected abstract java.util.Collection<FileAnnotation> parse(java.io.InputStream inputStream,
                                                              java.lang.String moduleName)
                                                       throws java.lang.reflect.InvocationTargetException
Returns the duplication annotations found in the specified file.

Parameters:
inputStream - the file to parse
moduleName - name of the maven module
Returns:
the parsed annotations
Throws:
java.lang.reflect.InvocationTargetException - if the file could not be parsed (wrap your actual exception in this exception)

accepts

protected abstract boolean accepts(java.io.InputStream inputStream)
Returns whether this parser accepts the specified stream as a valid file.

Parameters:
inputStream - the file to parse
Returns:
true if this parser accepts the specified stream as a valid file, false if the parser can't read this file


Copyright © 2009. All Rights Reserved.