Class IfAny
- java.lang.Object
-
- org.apache.logging.log4j.core.appender.rolling.action.IfAny
-
- All Implemented Interfaces:
PathCondition
@Plugin(name="IfAny", category="Core", printObject=true) public final class IfAny extends java.lang.Object implements PathCondition
CompositePathConditionthat accepts objects that are accepted by any component conditions. Corresponds to logical "OR".
-
-
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 privateIfAny(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.voidbeforeFileTreeWalk()Invoked before a new file tree walk is started.static IfAnycreateOrCondition(PathCondition... components)Create a Composite PathCondition: accepts if any of the nested conditions accepts.PathCondition[]getDeleteFilters()java.lang.StringtoString()
-
-
-
Field Detail
-
components
private final PathCondition[] components
-
-
Constructor Detail
-
IfAny
private IfAny(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
-
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
-
createOrCondition
@PluginFactory public static IfAny createOrCondition(@PluginElement("PathConditions") PathCondition... components)
Create a Composite PathCondition: accepts if any of the nested conditions accepts.- Parameters:
components- The component conditions.- Returns:
- A Composite PathCondition.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-