Class PathSortByModificationTime
java.lang.Object
org.apache.logging.log4j.core.appender.rolling.action.PathSortByModificationTime
- All Implemented Interfaces:
Serializable
,Comparator<PathWithAttributes>
,PathSorter
@Plugin(name="SortByModificationTime",
category="Core",
printObject=true)
public class PathSortByModificationTime
extends Object
implements PathSorter, Serializable
PathSorter
that sorts path by their LastModified attribute.- See Also:
-
Constructor Summary
ConstructorDescriptionPathSortByModificationTime
(boolean recentFirst) Constructs a new SortByModificationTime sorter. -
Method Summary
Modifier and TypeMethodDescriptionint
compare
(PathWithAttributes path1, PathWithAttributes path2) static PathSorter
createSorter
(boolean recentFirst) Create a PathSorter that sorts by lastModified time.boolean
Returns whether this sorter sorts recent files first.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
PathSortByModificationTime
public PathSortByModificationTime(boolean recentFirst) Constructs a new SortByModificationTime sorter.- Parameters:
recentFirst
- if true, most recently modified paths should come first
-
-
Method Details
-
createSorter
@PluginFactory public static PathSorter createSorter(@PluginAttribute(value="recentFirst",defaultBoolean=true) boolean recentFirst) Create a PathSorter that sorts by lastModified time.- Parameters:
recentFirst
- if true, most recently modified paths should come first.- Returns:
- A PathSorter.
-
isRecentFirst
public boolean isRecentFirst()Returns whether this sorter sorts recent files first.- Returns:
- whether this sorter sorts recent files first
-
compare
- Specified by:
compare
in interfaceComparator<PathWithAttributes>
-