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 your rule is cacheable, you must return a unique id when parameters or conditions change that would cause the
result to be different.
|
(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 tells the system if the results are cacheable at all.
|
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()
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()
true
if rule is cacheablepublic boolean isResultValid(EnforcerRule cachedRule)
cachedRule
- the cached ruletrue
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)