public abstract class AbstractVersionEnforcer extends AbstractStandardEnforcerRule
Constructor and Description |
---|
AbstractVersionEnforcer() |
Modifier and Type | Method and Description |
---|---|
static boolean |
containsVersion(org.apache.maven.artifact.versioning.VersionRange allowedRange,
org.apache.maven.artifact.versioning.ArtifactVersion theVersion)
Copied from Artifact.VersionRange.
|
void |
enforceVersion(org.apache.maven.plugin.logging.Log log,
String variableName,
String requiredVersionRange,
org.apache.maven.artifact.versioning.ArtifactVersion actualVersion)
Compares the specified version to see if it is allowed by the defined version range.
|
String |
getCacheId()
If the rule is to be cached, this id is used as part of the key.
|
String |
getVersion()
Gets the required version.
|
boolean |
isCacheable()
This method tells the enforcer if the rule results may be cached.
|
boolean |
isResultValid(EnforcerRule theCachedRule)
Checks if cached result is valid.
|
void |
setVersion(String theVersion)
Specify the required version.
|
getLevel, getMessage, setLevel, setMessage
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
execute
public AbstractVersionEnforcer()
public void enforceVersion(org.apache.maven.plugin.logging.Log log, String variableName, String requiredVersionRange, org.apache.maven.artifact.versioning.ArtifactVersion actualVersion) throws EnforcerRuleException
log
- the logvariableName
- name of variable to use in messages (Example: "Maven" or "Java" etc).requiredVersionRange
- range of allowed versions.actualVersion
- the version to be checked.EnforcerRuleException
- the enforcer rule exceptionpublic static boolean containsVersion(org.apache.maven.artifact.versioning.VersionRange allowedRange, org.apache.maven.artifact.versioning.ArtifactVersion theVersion)
allowedRange
- range of allowed versions.theVersion
- the version to be checked.public String getCacheId()
EnforcerRule
public boolean isCacheable()
EnforcerRule
true
if rule is cacheablepublic boolean isResultValid(EnforcerRule theCachedRule)
EnforcerRule
theCachedRule
- 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)true
if the stored results are valid for the same id.public final String getVersion()
public final void setVersion(String theVersion)
2.0.4
Version 2.0.4 and higher (different from Maven meaning)[2.0,2.1)
Versions 2.0 (included) to 2.1 (not included)[2.0,2.1]
Versions 2.0 to 2.1 (both included)[2.0.5,)
Versions 2.0.5 and higher(,2.0.5],[2.1.1,)
Versions up to 2.0.5 (included) and 2.1.1 or highertheVersion
- the required version to setCopyright © 2007–2015 The Apache Software Foundation. All rights reserved.