Class AbstractRequireFiles
- java.lang.Object
-
- org.apache.maven.enforcer.rule.api.AbstractEnforcerRuleBase
-
- org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
-
- org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
-
- org.apache.maven.enforcer.rules.files.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 Summary
Fields Modifier and Type Field Description private booleanallowNullsif null file handles should be allowed.private java.util.List<java.io.File>filesList of files to check.private booleansatisfyAnyAllow that a single one of the files can make the rule to pass.
-
Constructor Summary
Constructors Constructor Description AbstractRequireFiles()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract booleancheckFile(java.io.File file)Check one file.voidexecute()This is the interface into the rule.private voidfail(java.util.List<java.io.File> failures)java.lang.StringgetCacheId()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.StringgetErrorMsg()Gets the error msg.(package private) java.util.List<java.io.File>getFiles()(package private) voidsetAllowNulls(boolean allowNulls)(package private) voidsetFilesList(java.util.List<java.io.File> files)(package private) voidsetSatisfyAny(boolean satisfyAny)java.lang.StringtoString()-
Methods inherited from class org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
formatLocation, getMessage, setMessage
-
Methods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
getLevel, getRuleName
-
Methods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRuleBase
getLog, setLog
-
-
-
-
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.
-
-
Method Detail
-
checkFile
abstract boolean checkFile(java.io.File file)
Check one file.- Parameters:
file- the file- Returns:
trueif successful
-
getErrorMsg
abstract java.lang.String getErrorMsg()
Gets the error msg.- Returns:
- the error msg
-
execute
public void execute() throws EnforcerRuleExceptionDescription copied from class:AbstractEnforcerRuleThis 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:
executein classAbstractEnforcerRule- Throws:
EnforcerRuleException- the enforcer rule exceptionEnforcerRuleError- in order to brake a build immediately
-
fail
private void fail(java.util.List<java.io.File> failures) throws EnforcerRuleException- Throws:
EnforcerRuleException
-
getCacheId
public java.lang.String getCacheId()
Description copied from class:AbstractEnforcerRuleIf 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:
getCacheIdin classAbstractEnforcerRule- Returns:
- id to be used by the Enforcer to determine uniqueness of cache results.
Return
nulldisable 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:
toStringin classjava.lang.Object
-
-