Package org.opencms.file.collectors
Class CmsPriorityDateResourceComparator
- java.lang.Object
-
- org.opencms.file.collectors.CmsPriorityDateResourceComparator
-
- All Implemented Interfaces:
java.io.Serializable
,java.util.Comparator<CmsResource>
public class CmsPriorityDateResourceComparator extends java.lang.Object implements java.io.Serializable, java.util.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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROPERTY_DATE
The name of the date property to read.
-
Constructor Summary
Constructors Constructor Description CmsPriorityDateResourceComparator(CmsObject cms, boolean asc)
Creates a new instance of this comparator key.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(CmsResource res0, CmsResource res1)
long
getDate()
Returns the date of this resource comparator key.int
getPriority()
Returns the priority of this resource comparator key.
-
-
-
Field Detail
-
PROPERTY_DATE
public static final java.lang.String PROPERTY_DATE
The name of the date property to read.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsPriorityDateResourceComparator
public CmsPriorityDateResourceComparator(CmsObject cms, boolean asc)
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 Detail
-
compare
public int compare(CmsResource res0, CmsResource res1)
- Specified by:
compare
in interfacejava.util.Comparator<CmsResource>
- See Also:
Comparator.compare(java.lang.Object, java.lang.Object)
-
getDate
public long getDate()
Returns the date of this resource comparator key.- Returns:
- the date of this resource comparator key
-
getPriority
public int getPriority()
Returns the priority of this resource comparator key.- Returns:
- the priority of this resource comparator key
-
-