Class AbstractQNameAwareCannedQueryFactory.PropertyBasedComparator<R>

  • All Implemented Interfaces:
    java.util.Comparator<R>
    Direct Known Subclasses:
    AbstractQNameAwareCannedQueryFactory.NodeBackedEntityComparator, GetCalendarEntriesCannedQuery.CalendarEntityComparator
    Enclosing class:
    AbstractQNameAwareCannedQueryFactory<R>

    public abstract static class AbstractQNameAwareCannedQueryFactory.PropertyBasedComparator<R>
    extends java.lang.Object
    implements java.util.Comparator<R>
    Utility class to sort Entities on the basis of a Comparable property. Comparisons of two null properties are considered 'equal' by this comparator. Comparisons involving one null and one non-null property will return the null property as being 'before' the non-null property. Note that it is the responsibility of the calling code to ensure that the specified property values actually implement Comparable themselves.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.alfresco.service.namespace.QName comparableProperty  
    • Constructor Summary

      Constructors 
      Constructor Description
      PropertyBasedComparator​(org.alfresco.service.namespace.QName comparableProperty)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(R r1, R r2)  
      protected abstract java.lang.Comparable getProperty​(R entity)  
      • 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 Detail

      • comparableProperty

        protected org.alfresco.service.namespace.QName comparableProperty
    • Constructor Detail

      • PropertyBasedComparator

        public PropertyBasedComparator​(org.alfresco.service.namespace.QName comparableProperty)
    • Method Detail

      • getProperty

        protected abstract java.lang.Comparable getProperty​(R entity)
      • compare

        public int compare​(R r1,
                           R r2)
        Specified by:
        compare in interface java.util.Comparator<R>