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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PathSortByModificationTime(boolean recentFirst)
Constructs a new SortByModificationTime sorter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(PathWithAttributes path1, PathWithAttributes path2)
static PathSorter
createSorter(boolean recentFirst)
Create a PathSorter that sorts by lastModified time.boolean
isRecentFirst()
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
-
-
-
-
Method Detail
-
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
public int compare(PathWithAttributes path1, PathWithAttributes path2)
- Specified by:
compare
in interfaceComparator<PathWithAttributes>
-
-