Class AbstractRequireFiles

All Implemented Interfaces:
EnforcerRuleBase
Direct Known Subclasses:
RequireFilesDontExist, RequireFilesExist, RequireFilesSize

abstract class AbstractRequireFiles extends AbstractStandardEnforcerRule
Contains the common code to compare an array of files against a requirement.
  • Field Details

    • files

      private List<File> files
      List of files to check.
    • allowNulls

      private boolean allowNulls
      if null file handles should be allowed. If they are allowed, it means treat it as a success.
    • satisfyAny

      private boolean satisfyAny
      Allow that a single one of the files can make the rule to pass.
  • Constructor Details

    • AbstractRequireFiles

      AbstractRequireFiles()
  • Method Details

    • checkFile

      abstract boolean checkFile(File file)
      Check one file.
      Parameters:
      file - the file
      Returns:
      true if successful
    • getErrorMsg

      abstract String getErrorMsg()
      Gets the error msg.
      Returns:
      the error msg
    • execute

      public void execute() throws EnforcerRuleException
      Description copied from class: AbstractEnforcerRule
      This is the interface into the rule. This method should throw an exception containing a reason message if the rule fails the check. The plugin will then decide based on the fail flag and rule level if it should stop or just log the message as a warning.
      Specified by:
      execute in class AbstractEnforcerRule
      Throws:
      EnforcerRuleException - the enforcer rule exception
    • fail

      private void fail(List<File> failures) throws EnforcerRuleException
      Throws:
      EnforcerRuleException
    • getCacheId

      public String getCacheId()
      Description copied from class: AbstractEnforcerRule
      If the rule is to be cached during session scope, whole executing of Maven build, this id is used as part of the key.

      Rule of the same class and the same cache id will be executed once.

      Overrides:
      getCacheId in class AbstractEnforcerRule
      Returns:
      id to be used by the Enforcer to determine uniqueness of cache results. Return null disable cache of rule executing.
    • setFilesList

      void setFilesList(List<File> files)
    • getFiles

      List<File> getFiles()
    • setAllowNulls

      void setAllowNulls(boolean allowNulls)
    • setSatisfyAny

      void setSatisfyAny(boolean satisfyAny)
    • toString

      public String toString()
      Overrides:
      toString in class Object