View Javadoc

1   package net.sf.mavenhist.extractor.checkstyle;
2   
3   /**
4    * Extracts the number of all checkstyle warnings.
5    */
6   public abstract class AbstractCheckstyleViolationExtractor
7       extends AbstractCheckstyleSingleValueExtractor {
8   
9     /**
10     * XPath to extract the number of all checkstyle warnings.
11     * @return XPath to extract the number of all checkstyle warnings.
12     */
13    protected String getXPath(String version) {
14      StringBuffer buffer = new StringBuffer();
15      buffer.append("count(/checkstyle/file/error");
16      if (getSeverity() != null) {
17        buffer.append("[@severity = '");
18        buffer.append(getSeverity());
19        buffer.append("'])");
20      } else {
21        buffer.append(")");
22      }
23      return buffer.toString();
24    }
25    
26    /**
27     * Returns the severity as <code>String</code>. If severity is given as <code>null</code> no
28     * filtering is done.
29     * @return the severity.
30     */
31    protected abstract String getSeverity();
32  }