Skip to content

Commit

Permalink
Issue checkstyle#5879: new filter SuppressionXpathSingleFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
tsunghanjacktsai committed Oct 27, 2018
1 parent fd96d61 commit ce975bb
Showing 1 changed file with 90 additions and 0 deletions.
@@ -0,0 +1,90 @@
package com.puppycrawl.tools.checkstyle.filters;

import java.util.Collections;
import java.util.Objects;
import java.util.Set;
import java.util.regex.Pattern;

import com.puppycrawl.tools.checkstyle.api.*;

public class SuppressionXpathSingleFilter extends AutomaticBean implements
Filter, ExternalResourceHolder {

/** The regexp to match check names against. */
private Pattern checkRegexp;

/** The pattern for check class names. */
private String checkPattern;

/** The regexp to match message names against. */
private Pattern messageRegexp;

/** The pattern for message names. */
private String messagePattern;

/** Module id filter. */
private String moduleId;

/** Xpath query. */
private String xpathQuery;

/** Set of individual suppresses. */
private FilterSet filters = new FilterSet();

public void setCheckRegexp(Pattern checkRegexp) {
this.checkRegexp = checkRegexp;
}

public void setCheckPattern(String checkPattern) {
this.checkPattern = checkPattern;
}

public void setMessageRegexp(Pattern messageRegexp) {
this.messageRegexp = messageRegexp;
}

public void setMessagePattern(String messagePattern) {
this.messagePattern = messagePattern;
}

public void setModuleId(String moduleId) {
this.moduleId = moduleId;
}

public void setXpathQuery(String xpathQuery) {
this.xpathQuery = xpathQuery;
}


@Override
public boolean accept(AuditEvent event) {
return filters.accept(event);
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
final SuppressionXpathSingleFilter suppressionXpathSingleFilter = (SuppressionXpathSingleFilter) obj;
return Objects.equals(filters, suppressionXpathSingleFilter.filters);
}

@Override
public int hashCode() {
return Objects.hash(filters);
}

@Override
protected void finishLocalSetup() throws CheckstyleException {

}

@Override
public Set<String> getExternalResourceLocations() {
return null;
}
}

0 comments on commit ce975bb

Please sign in to comment.