Class AbstractDryParser<T>
- java.lang.Object
-
- edu.hm.hafner.analysis.IssueParser
-
- edu.hm.hafner.analysis.parser.dry.AbstractDryParser<T>
-
- Type Parameters:
T- the type of the parsed warnings
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CpdParser,DupFinderParser,SimianParser
public abstract class AbstractDryParser<T> extends IssueParser
A duplication parser template for Digester based parsers.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractDryParser(int highThreshold, int normalThreshold)Creates a new instance ofAbstractDryParser.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidconfigureParser(org.apache.commons.digester3.Digester digester)Configures the Digester parser.protected abstract ReportconvertDuplicationsToIssues(List<T> duplications, IssueBuilder issueBuilder)Converts the parsed duplications from the original format to anReportinstance.protected SeveritygetPriority(int lines)Returns the priority of the warning.Reportparse(ReaderFactory readerFactory)Parses the specified file for issues.-
Methods inherited from class edu.hm.hafner.analysis.IssueParser
accepts, equalsIgnoreCase, isXmlFile, parseFile
-
-
-
-
Constructor Detail
-
AbstractDryParser
protected AbstractDryParser(int highThreshold, int normalThreshold)Creates a new instance ofAbstractDryParser.- Parameters:
highThreshold- minimum number of duplicate lines for high priority warningsnormalThreshold- minimum number of duplicate lines for normal priority warnings
-
-
Method Detail
-
getPriority
protected Severity getPriority(int lines)
Returns the priority of the warning.- Parameters:
lines- number of duplicate lines- Returns:
- the priority of the warning
-
parse
public Report parse(ReaderFactory readerFactory) throws ParsingCanceledException, ParsingException
Description copied from class:IssueParserParses the specified file for issues.- Specified by:
parsein classIssueParser- Parameters:
readerFactory- provides a reader to the reports- Returns:
- the issues
- Throws:
ParsingCanceledException- Signals that the parsing has been aborted by the userParsingException- Signals that during parsing a non recoverable error has been occurred
-
configureParser
protected abstract void configureParser(org.apache.commons.digester3.Digester digester)
Configures the Digester parser. Register all rules that are required to parse the file.- Parameters:
digester- the parser to configure
-
convertDuplicationsToIssues
protected abstract Report convertDuplicationsToIssues(List<T> duplications, IssueBuilder issueBuilder)
Converts the parsed duplications from the original format to anReportinstance.- Parameters:
duplications- the parsed warningsissueBuilder- the issue builder to use- Returns:
- the converted warnings
-
-