DocumentComparator Class

DEPRECATED

com.bea.p13n.content.document.ref
DocumentComparator Class

public class DocumentComparator

    extends Object
    implements Comparator

A comparator which can sort DocumentMetadataDefs according to a list of SortCriteria.

This will not be a fast comparator due to the nature of the objects it supports. It is recommended to try to get the database to do as much sorting as possible.


Hierarchy
Object
  DocumentComparator
All Implemented Interfaces

Comparator

Field Summary

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

Constructor Summary

DocumentComparator(SortCriteria criteria)

Constructor.
DocumentComparator(String sortBy)

Constructor.
 

Method Summary

public int
compare(Object obj1, Object obj2)
Compare two DocumentMetadataDef objects according to the sort 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

DocumentComparator

public DocumentComparator(SortCriteria[] criteria)
Constructor.

DocumentComparator

public DocumentComparator(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 DocumentMetadataDef objects according to the sort 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 DocumentMetadataDef.

toString() Method

public String toString()
Get a string representation.

Overrides
Object.toString()