Package org.opencms.file.collectors
Class CmsPriorityDateResourceComparator
java.lang.Object
org.opencms.file.collectors.CmsPriorityDateResourceComparator
- All Implemented Interfaces:
Serializable
,Comparator<CmsResource>
public class CmsPriorityDateResourceComparator
extends Object
implements Serializable, Comparator<CmsResource>
Comparator for sorting resource objects based on priority and date.
Serves as Comparator
for resources and as comparator key for the resource
at the same time. Uses lazy initializing of comparator keys in a resource.
- Since:
- 6.0.0
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCmsPriorityDateResourceComparator
(CmsObject cms, boolean asc) Creates a new instance of this comparator key. -
Method Summary
Modifier and TypeMethodDescriptionint
compare
(CmsResource res0, CmsResource res1) long
getDate()
Returns the date of this resource comparator key.int
Returns the priority of this resource comparator key.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
-
Field Details
-
PROPERTY_DATE
The name of the date property to read.- See Also:
-
-
Constructor Details
-
CmsPriorityDateResourceComparator
Creates a new instance of this comparator key.- Parameters:
cms
- the current OpenCms user contextasc
- if true, the date sort order is ascending, otherwise descending
-
-
Method Details
-
compare
- Specified by:
compare
in interfaceComparator<CmsResource>
- See Also:
-
getDate
Returns the date of this resource comparator key.- Returns:
- the date of this resource comparator key
-
getPriority
Returns the priority of this resource comparator key.- Returns:
- the priority of this resource comparator key
-