Package org.opencms.file.collectors
Class CmsPropertyResourceComparator
java.lang.Object
org.opencms.file.collectors.CmsPropertyResourceComparator
- All Implemented Interfaces:
Serializable
,Comparator<CmsResource>
public class CmsPropertyResourceComparator
extends Object
implements Serializable, Comparator<CmsResource>
Comparator for sorting resource objects based on a selected property value.
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:
- 8.0.4
- See Also:
-
Constructor Summary
ConstructorDescriptionCmsPropertyResourceComparator
(CmsObject cms, String property, boolean asc) Creates a new instance of this comparator key. -
Method Summary
Modifier and TypeMethodDescriptionint
compare
(CmsResource res0, CmsResource res1) Returns the property value 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
-
Constructor Details
-
CmsPropertyResourceComparator
Creates a new instance of this comparator key.- Parameters:
cms
- the current OpenCms user contextproperty
- the name of the sort property (case sensitive)asc
- the sort order (true=asc, false=desc)
-
-
Method Details
-
compare
- Specified by:
compare
in interfaceComparator<CmsResource>
- See Also:
-
getPropertyValue
Returns the property value of this resource comparator key.- Returns:
- property value of this resource comparator key
-