Class AbstractRequireFiles

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean allowNulls
      if null file handles should be allowed.
      private java.util.List<java.io.File> files
      List of files to check.
      private boolean satisfyAny
      Allow that a single one of the files can make the rule to pass.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) abstract boolean checkFile​(java.io.File file)
      Check one file.
      void execute()
      This is the interface into the rule.
      private void fail​(java.util.List<java.io.File> failures)  
      (package private) boolean fileExists​(java.io.File file)
      Checks whether the given file exists under exactly the given name.
      java.lang.String getCacheId()
      If the rule is to be cached during session scope, whole executing of Maven build, this id is used as part of the key.
      (package private) abstract java.lang.String getErrorMsg()
      Gets the error msg.
      (package private) java.util.List<java.io.File> getFiles()  
      private boolean osIndependentNameMatch​(java.io.File file)
      OSes like Windows are case-insensitive, so this method will compare the file path with the actual path.
      (package private) void setAllowNulls​(boolean allowNulls)  
      (package private) void setFilesList​(java.util.List<java.io.File> files)  
      (package private) void setSatisfyAny​(boolean satisfyAny)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • files

        private java.util.List<java.io.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 Detail

      • AbstractRequireFiles

        AbstractRequireFiles()
    • Method Detail

      • checkFile

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

        abstract java.lang.String getErrorMsg()
        Gets the error msg.
        Returns:
        the error msg
      • fileExists

        boolean fileExists​(java.io.File file)
        Checks whether the given file exists under exactly the given name.
        Parameters:
        file - the file to check
        Returns:
        true if the file exists and its name matches the name on disk
      • osIndependentNameMatch

        private boolean osIndependentNameMatch​(java.io.File file)
        OSes like Windows are case-insensitive, so this method will compare the file path with the actual path. A simple File.exists() is not enough for such OS, as it reports a file as existing even when the name differs in case from the one on disk.
        Parameters:
        file - the file to verify, must exist
        Returns:
        true if the name of the file matches the name on disk
      • 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
        EnforcerRuleError - in order to brake a build immediately
      • getCacheId

        public java.lang.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​(java.util.List<java.io.File> files)
      • getFiles

        java.util.List<java.io.File> getFiles()
      • setAllowNulls

        void setAllowNulls​(boolean allowNulls)
      • setSatisfyAny

        void setSatisfyAny​(boolean satisfyAny)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object