Class RequireFilesSize

    • Field Detail

      • maxsize

        private long maxsize
        the max size allowed.
      • minsize

        private long minsize
        the min size allowed.
      • errorMsg

        private java.lang.String errorMsg
        The error msg.
      • log

        private org.apache.maven.plugin.logging.Log log
        The log.
    • Constructor Detail

      • RequireFilesSize

        public RequireFilesSize()
    • Method Detail

      • execute

        public void execute​(EnforcerRuleHelper helper)
                     throws EnforcerRuleException
        Description copied from interface: EnforcerRule
        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 if it should stop or just log the message as a warning.
        Specified by:
        execute in interface EnforcerRule
        Overrides:
        execute in class AbstractRequireFiles
        Parameters:
        helper - The helper provides access to the log, MavenSession and has helpers to get common components. It is also able to lookup components by class name.
        Throws:
        EnforcerRuleException - the enforcer rule exception
      • 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.
        Specified by:
        isCacheable in interface EnforcerRule
        Overrides:
        isCacheable in class AbstractRequireFiles
        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.
        Specified by:
        isResultValid in interface EnforcerRule
        Overrides:
        isResultValid in class AbstractRequireFiles
        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.
      • getMaxsize

        public long getMaxsize()
      • setMaxsize

        public void setMaxsize​(long maxsize)
      • getMinsize

        public long getMinsize()
      • setMinsize

        public void setMinsize​(long minsize)