org.alfresco.repo.query
Class AbstractQNameAwareCannedQueryFactory.PropertyBasedComparator

java.lang.Object
  extended by org.alfresco.repo.query.AbstractQNameAwareCannedQueryFactory.PropertyBasedComparator
All Implemented Interfaces:
java.util.Comparator
Direct Known Subclasses:
AbstractBlogPostsCannedQueryFactory.BlogEntityComparator, AbstractQNameAwareCannedQueryFactory.NodeBackedEntityComparator, GetCalendarEntriesCannedQuery.CalendarEntityComparator
Enclosing class:
AbstractQNameAwareCannedQueryFactory

public abstract static class AbstractQNameAwareCannedQueryFactory.PropertyBasedComparator
extends java.lang.Object
implements java.util.Comparator

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
protected  org.alfresco.service.namespace.QName comparableProperty
           
 
Constructor Summary
AbstractQNameAwareCannedQueryFactory.PropertyBasedComparator(org.alfresco.service.namespace.QName comparableProperty)
           
 
Method Summary
 int compare(java.lang.Object r1, java.lang.Object r2)
           
protected abstract  java.lang.Comparable getProperty(java.lang.Object 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
 

Field Detail

comparableProperty

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

AbstractQNameAwareCannedQueryFactory.PropertyBasedComparator

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

getProperty

protected abstract java.lang.Comparable getProperty(java.lang.Object entity)

compare

public int compare(java.lang.Object r1,
                   java.lang.Object r2)
Specified by:
compare in interface java.util.Comparator


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.