public abstract class AbstractPropertyEnforcerRule extends AbstractNonCacheableEnforcerRule
Constructor and Description |
---|
AbstractPropertyEnforcerRule() |
Modifier and Type | Method and Description |
---|---|
void |
execute(EnforcerRuleHelper helper)
This is the interface into the rule.
|
protected abstract String |
getName()
How the property that is being evaluated is called
|
protected abstract String |
getPropertyName()
The name of the property currently being evaluated, this is used for default message purposes only
|
String |
getRegex()
Get the property value to a given regular expression.
|
String |
getRegexMessage()
Get a warning message if the regular expression is not matched.
|
protected abstract Object |
resolveValue(EnforcerRuleHelper helper)
Resolves the property value
|
void |
setRegex(String regex)
Set the property value to a given regular expression.
|
void |
setRegexMessage(String regexMessage)
Set a warning message if the regular expression is not matched.
|
getCacheId, isCacheable, isResultValid
getLevel, getMessage, setLevel, setMessage
public AbstractPropertyEnforcerRule()
public final void setRegex(String regex)
null
(any value is ok).regex
- The regular expressionpublic final String getRegex()
null
(any value is ok).public final void setRegexMessage(String regexMessage)
regexMessage
- the regex messagepublic final String getRegexMessage()
public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException
EnforcerRule
helper
- The helper provides access to the log, MavenSession and has
helpers to get common components. It is also able to lookup components
by class name.EnforcerRuleException
- the enforcer rule exceptionprotected abstract String getName()
protected abstract String getPropertyName()
protected abstract Object resolveValue(EnforcerRuleHelper helper) throws EnforcerRuleException
helper
- EnforcerRuleException
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.