Class AbstractNonCacheableEnforcerRule

java.lang.Object
org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
All Implemented Interfaces:
EnforcerRule, EnforcerRule2
Direct Known Subclasses:
AbstractBanDependencies, AbstractPropertyEnforcerRule, AlwaysFail, AlwaysPass, BanDistributionManagement, BanDuplicatePomDependencyVersions, BannedRepositories, BanTransitiveDependencies, ReactorModuleConvergence, RequireActiveProfile, RequireFileChecksum, RequireJavaVendor, RequireNoRepositories, RequirePluginVersions, RequirePrerequisite, RequireProfileIdsExist, RequireReleaseVersion, RequireSameVersions, RequireSnapshotVersion, RequireUpperBoundDeps

public abstract class AbstractNonCacheableEnforcerRule extends AbstractStandardEnforcerRule
The Class AbstractNonCacheableEnforcerRule. This is to be used by rules that don't need caching... it saves implementing a bunch of methods.
  • Constructor Details

    • AbstractNonCacheableEnforcerRule

      public AbstractNonCacheableEnforcerRule()
  • Method Details

    • getCacheId

      public String getCacheId()
      Description copied from interface: EnforcerRule
      If 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.
      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]
    • isCacheable

      public boolean isCacheable()
      Description copied from interface: EnforcerRule
      This 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.
      Returns:
      true if rule is cacheable
    • isResultValid

      public boolean isResultValid(EnforcerRule cachedRule)
      Description copied from interface: EnforcerRule
      If the rule is cacheable and the same id is found in the cache, the stored results are passed to this method to allow double checking of the results. Most of the time this can be done by generating unique ids, but sometimes the results of objects returned by the helper need to be queried. You may for example, store certain objects in your rule and then query them later.
      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:
      true if the stored results are valid for the same id.