Class IfAll
java.lang.Object
org.apache.logging.log4j.core.appender.rolling.action.IfAll
- All Implemented Interfaces:
PathCondition
@Plugin(name="IfAll",
category="Core",
printObject=true)
public final class IfAll
extends Object
implements PathCondition
Composite
PathCondition
that only accepts objects that are accepted by all component conditions.
Corresponds to logical "AND".-
Field Summary
Fields inherited from interface org.apache.logging.log4j.core.appender.rolling.action.PathCondition
EMPTY_ARRAY
-
Method Summary
Modifier and TypeMethodDescriptionboolean
accept
(Path baseDir, Path relativePath, BasicFileAttributes attrs) Returnstrue
if the specified candidate path should be deleted,false
otherwise.static boolean
accept
(PathCondition[] list, Path baseDir, Path relativePath, BasicFileAttributes attrs) Returnstrue
if all the specified conditions accept the specified path,false
otherwise.void
Invoked before a new file tree walk is started.static void
beforeFileTreeWalk
(PathCondition[] nestedConditions) CallsbeforeFileTreeWalk()
on all of the specified nested conditions.static IfAll
createAndCondition
(PathCondition... components) Create a Composite PathCondition whose components all need to accept before this condition accepts.toString()
-
Method Details
-
getDeleteFilters
-
accept
Description copied from interface:PathCondition
Returnstrue
if the specified candidate path should be deleted,false
otherwise.- Specified by:
accept
in interfacePathCondition
- Parameters:
baseDir
- the directory from where to start scanning for deletion candidate filesrelativePath
- the candidate for deletion. This path is relative to the baseDir.attrs
- attributes of the candidate path- Returns:
- whether the candidate path should be deleted
-
accept
public static boolean accept(PathCondition[] list, Path baseDir, Path relativePath, BasicFileAttributes attrs) Returnstrue
if all the specified conditions accept the specified path,false
otherwise.- Parameters:
list
- the array of conditions to evaluatebaseDir
- the directory from where to start scanning for deletion candidate filesrelativePath
- the candidate for deletion. This path is relative to the baseDir.attrs
- attributes of the candidate path- Returns:
true
if all the specified conditions accept the specified path,false
otherwise- Throws:
NullPointerException
- if any of the parameters isnull
-
beforeFileTreeWalk
public void beforeFileTreeWalk()Description copied from interface:PathCondition
Invoked before a new file tree walk is started. Stateful PathConditions can reset their state when this method is called.- Specified by:
beforeFileTreeWalk
in interfacePathCondition
-
beforeFileTreeWalk
CallsbeforeFileTreeWalk()
on all of the specified nested conditions.- Parameters:
nestedConditions
- the conditions to callbeforeFileTreeWalk()
on
-
createAndCondition
@PluginFactory public static IfAll createAndCondition(@PluginElement("PathConditions") @Required(message="No components provided for IfAll") PathCondition... components) Create a Composite PathCondition whose components all need to accept before this condition accepts.- Parameters:
components
- The component filters.- Returns:
- A Composite PathCondition.
-
toString
-