com.lewisd.maven.lint.rules.AbstractRule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lint-maven-plugin Show documentation
Show all versions of lint-maven-plugin Show documentation
Generates a report of suspicious/inconsistent POM elements, and optionally fails the build if violations are found.
The newest version!
package com.lewisd.maven.lint.rules;
import com.lewisd.maven.lint.Rule;
import com.lewisd.maven.lint.util.ExpressionEvaluator;
import com.lewisd.maven.lint.util.ModelUtil;
import java.util.HashSet;
import java.util.Set;
public abstract class AbstractRule implements Rule {
protected static final String VERSION_PROPERTIES = "versionProperties";
//CHECKSTYLE.OFF: VisibilityModifier
protected final ExpressionEvaluator expressionEvaluator;
protected final ModelUtil modelUtil;
//CHECKSTYLE.ON: VisibilityModifier
protected AbstractRule() {
this(null, null);
}
protected AbstractRule(final ExpressionEvaluator expressionEvaluator, final ModelUtil modelUtil) {
this.expressionEvaluator = expressionEvaluator;
this.modelUtil = modelUtil;
}
public Set getRequiredModels() {
final Set requiredModels = new HashSet();
addRequiredModels(requiredModels);
return requiredModels;
}
protected void addRequiredModels(Set requiredModels) {
// do nothing by default
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AbstractRule rule = (AbstractRule) o;
if (expressionEvaluator != null ? !expressionEvaluator.equals(rule.expressionEvaluator) : rule.expressionEvaluator != null) {
return false;
}
if (modelUtil != null ? !modelUtil.equals(rule.modelUtil) : rule.modelUtil != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = expressionEvaluator != null ? expressionEvaluator.hashCode() : 0;
return 31 * result + (modelUtil != null ? modelUtil.hashCode() : 0);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy