Class RequireEnvironmentVariable
- java.lang.Object
-
- org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
-
- org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
-
- org.apache.maven.plugins.enforcer.AbstractPropertyEnforcerRule
-
- org.apache.maven.plugins.enforcer.RequireEnvironmentVariable
-
- All Implemented Interfaces:
EnforcerRule,EnforcerRule2
public class RequireEnvironmentVariable extends AbstractPropertyEnforcerRule
This rule checks that certain environment variable is set.- Author:
- Marvin Froeder
-
-
Constructor Summary
Constructors Constructor Description RequireEnvironmentVariable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetCacheId()If the rule is to be cached, this id is used as part of the key.StringgetName()How the property that is being evaluated is calledStringgetPropertyName()The name of the property currently being evaluated, this is used for default message pourpouses onlyStringgetVariableName()booleanisCacheable()This method tells the enforcer if the rule results may be cached.booleanisResultValid(EnforcerRule cachedRule)Checks if cached result is valid.StringresolveValue(EnforcerRuleHelper helper)Resolves the property valuevoidsetVariableName(String variableName)-
Methods inherited from class org.apache.maven.plugins.enforcer.AbstractPropertyEnforcerRule
execute, getRegex, getRegexMessage, setRegex, setRegexMessage
-
Methods inherited from class org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
getLevel, getMessage, setLevel, setMessage
-
-
-
-
Method Detail
-
setVariableName
public final void setVariableName(String variableName)
- Parameters:
variableName- the variable name- See Also:
setVariableName(String),getVariableName()
-
getVariableName
public final String getVariableName()
-
resolveValue
public String resolveValue(EnforcerRuleHelper helper)
Description copied from class:AbstractPropertyEnforcerRuleResolves the property value- Specified by:
resolveValuein classAbstractPropertyEnforcerRule
-
isCacheable
public boolean isCacheable()
Description copied from interface:EnforcerRuleThis method tells the enforcer if the rule results may be cached. If the result is true, the results will be remembered for future executions in the same build (ie children). Subsequent iterations of the rule will be queried to see if they are also cacheable. This will allow the rule to be uncached further down the tree if needed.- Specified by:
isCacheablein interfaceEnforcerRule- Overrides:
isCacheablein classAbstractNonCacheableEnforcerRule- Returns:
trueif rule is cacheable
-
isResultValid
public boolean isResultValid(EnforcerRule cachedRule)
Description copied from interface:EnforcerRuleChecks if cached result is valid.- Specified by:
isResultValidin interfaceEnforcerRule- Overrides:
isResultValidin classAbstractNonCacheableEnforcerRule- Parameters:
cachedRule- the last cached instance of the rule. This is to be used by the rule to potentially determine if the results are still valid (ie if the configuration has been overridden)- Returns:
trueif the stored results are valid for the same id.
-
getCacheId
public String getCacheId()
Description copied from interface:EnforcerRuleIf the rule is to be cached, this id is used as part of the key. This can allow rules to take parameters that allow multiple results of the same rule to be cached.- Specified by:
getCacheIdin interfaceEnforcerRule- Overrides:
getCacheIdin classAbstractNonCacheableEnforcerRule- Returns:
- id to be used by the enforcer to determine uniqueness of cache results. The ids only need to be unique within a given rule implementation as the full key will be [classname]-[id]
-
getPropertyName
public String getPropertyName()
Description copied from class:AbstractPropertyEnforcerRuleThe name of the property currently being evaluated, this is used for default message pourpouses only- Specified by:
getPropertyNamein classAbstractPropertyEnforcerRule
-
getName
public String getName()
Description copied from class:AbstractPropertyEnforcerRuleHow the property that is being evaluated is called- Specified by:
getNamein classAbstractPropertyEnforcerRule
-
-