ContentComparator Class

DEPRECATED

com.bea.p13n.content.expression
ContentComparator Class

public class ContentComparator

    extends Object
    implements Comparator

A comparator which can sort Content objects.

This will not be very fast since the comparision is done in Java. Try to do sorting in the database.


Hierarchy
Object
  ContentComparator
All Implemented Interfaces

Comparator

Field Summary

protected com.bea.p13n.content.expression.SortCriteria
criteria
The SortCriteria this uses.
 

Constructor Summary

ContentComparator(SortCriteria criteria)

Constructor.
ContentComparator(String sortBy)

Constructor.
 

Method Summary

public int
compare(Object obj1, Object obj2)
Compare two Content objects based upon the sorting criteria.
public String
toString()
Get a string representation.
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
   
Methods from interface java.util.Comparator
compare, equals
 

Field Detail

criteria

protected com.bea.p13n.content.expression.SortCriteria criteria
The SortCriteria this uses.

 

Constructor Detail

ContentComparator

public ContentComparator(SortCriteria[] criteria)
Constructor.

ContentComparator

public ContentComparator(String sortBy)
Constructor.

Related Topics

SortCriteria.getSortCriteria(String)

 

Method Detail

compare(Object, Object) Method

public int compare(Object obj1, 
                   Object obj2)
throws ClassCastException
Compare two Content objects based upon the sorting criteria.

Parameters

obj1
the first object.
obj2
the second object.

Returns

-1 if obj1 less than obj2, 0 if equals, 1 if greater than.

Exceptions

ClassCastException
thrown if either obj1 or obj2 is not a Content.

toString() Method

public String toString()
Get a string representation.

Overrides
Object.toString()