public abstract class AbstractRequireFiles extends AbstractStandardEnforcerRule
Modifier and Type | Field and Description |
---|---|
private boolean |
allowNulls
if null file handles should be allowed.
|
private java.io.File[] |
files
Array of files to check.
|
Constructor and Description |
---|
AbstractRequireFiles() |
Modifier and Type | Method and Description |
---|---|
(package private) abstract boolean |
checkFile(java.io.File file)
Check one file.
|
void |
execute(EnforcerRuleHelper helper)
This is the interface into the rule.
|
java.lang.String |
getCacheId()
If the rule is to be cached, this id is used as part of the key.
|
(package private) abstract java.lang.String |
getErrorMsg()
Gets the error msg.
|
java.io.File[] |
getFiles() |
private static int |
hashCode(java.lang.Object[] items)
Calculates a hash code for the specified array as
Arrays.hashCode() would do. |
boolean |
isAllowNulls() |
boolean |
isCacheable()
This method tells the enforcer if the rule results may be cached.
|
boolean |
isResultValid(EnforcerRule cachedRule)
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.
|
void |
setAllowNulls(boolean allowNulls) |
void |
setFiles(java.io.File[] files) |
getLevel, getMessage, setLevel, setMessage
private java.io.File[] files
private boolean allowNulls
abstract boolean checkFile(java.io.File file)
file
- the filetrue
if successfulabstract java.lang.String getErrorMsg()
public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException
EnforcerRule
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.EnforcerRuleException
- the enforcer rule exceptionpublic java.lang.String getCacheId()
EnforcerRule
private static int hashCode(java.lang.Object[] items)
Arrays.hashCode()
would do. Unfortunately, the
mentioned method is only available for Java 1.5 and later.items
- The array for which to compute the hash code, may be null
.public boolean isCacheable()
EnforcerRule
true
if rule is cacheablepublic boolean isResultValid(EnforcerRule cachedRule)
EnforcerRule
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)true
if the stored results are valid for the same id.public java.io.File[] getFiles()
public void setFiles(java.io.File[] files)
public boolean isAllowNulls()
public void setAllowNulls(boolean allowNulls)