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 java.lang.Object implements PathCondition
CompositePathConditionthat only accepts objects that are accepted by all component conditions. Corresponds to logical "AND".
-
-
Field Summary
Fields Modifier and Type Field Description private PathCondition[]components-
Fields inherited from interface org.apache.logging.log4j.core.appender.rolling.action.PathCondition
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Modifier Constructor Description privateIfAll(PathCondition... filters)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccept(java.nio.file.Path baseDir, java.nio.file.Path relativePath, java.nio.file.attribute.BasicFileAttributes attrs)Returnstrueif the specified candidate path should be deleted,falseotherwise.static booleanaccept(PathCondition[] list, java.nio.file.Path baseDir, java.nio.file.Path relativePath, java.nio.file.attribute.BasicFileAttributes attrs)Returnstrueif all the specified conditions accept the specified path,falseotherwise.voidbeforeFileTreeWalk()Invoked before a new file tree walk is started.static voidbeforeFileTreeWalk(PathCondition[] nestedConditions)CallsbeforeFileTreeWalk()on all of the specified nested conditions.static IfAllcreateAndCondition(PathCondition... components)Create a Composite PathCondition whose components all need to accept before this condition accepts.PathCondition[]getDeleteFilters()java.lang.StringtoString()
-
-
-
Field Detail
-
components
private final PathCondition[] components
-
-
Constructor Detail
-
IfAll
private IfAll(PathCondition... filters)
-
-
Method Detail
-
getDeleteFilters
public PathCondition[] getDeleteFilters()
-
accept
public boolean accept(java.nio.file.Path baseDir, java.nio.file.Path relativePath, java.nio.file.attribute.BasicFileAttributes attrs)Description copied from interface:PathConditionReturnstrueif the specified candidate path should be deleted,falseotherwise.- Specified by:
acceptin 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, java.nio.file.Path baseDir, java.nio.file.Path relativePath, java.nio.file.attribute.BasicFileAttributes attrs)
Returnstrueif all the specified conditions accept the specified path,falseotherwise.- 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:
trueif all the specified conditions accept the specified path,falseotherwise- Throws:
java.lang.NullPointerException- if any of the parameters isnull
-
beforeFileTreeWalk
public void beforeFileTreeWalk()
Description copied from interface:PathConditionInvoked before a new file tree walk is started. Stateful PathConditions can reset their state when this method is called.- Specified by:
beforeFileTreeWalkin interfacePathCondition
-
beforeFileTreeWalk
public static void beforeFileTreeWalk(PathCondition[] nestedConditions)
CallsbeforeFileTreeWalk()on all of the specified nested conditions.- Parameters:
nestedConditions- the conditions to callbeforeFileTreeWalk()on
-
createAndCondition
@PluginFactory public static IfAll createAndCondition(@PluginElement("PathConditions") 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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-