BEA Systems, Inc.

com.beasys.commerce.axiom.document.fast
Class ContentComparator

java.lang.Object
  |
  +--com.beasys.commerce.axiom.document.fast.ContentComparator
All Implemented Interfaces:
java.util.Comparator

public class ContentComparator
extends java.lang.Object
implements java.util.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.

Version:
1.0
Author:
BEA Systems, Inc.

Field Summary
protected  SortCriteria[] criteria
          The SortCriteria this uses.
 
Constructor Summary
ContentComparator(SortCriteria[] criteria)
          Constructor.
ContentComparator(java.lang.String sortBy)
          Constructor.
 
Method Summary
 int compare(java.lang.Object obj1, java.lang.Object obj2)
          Compare two Content objects based upon the sorting criteria.
 java.lang.String toString()
          Get a string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

criteria

protected SortCriteria[] criteria
The SortCriteria this uses.
Constructor Detail

ContentComparator

public ContentComparator(SortCriteria[] criteria)
Constructor.

ContentComparator

public ContentComparator(java.lang.String sortBy)
                  throws java.lang.IllegalArgumentException
Constructor.
Parameters:
sortBy - the sort by string to use
Throws:
java.lang.IllegalArgumentException - on invlaid sortBy clause
See Also:
SortCriteria.getSortCriteria(java.lang.String)
Method Detail

compare

public int compare(java.lang.Object obj1,
                   java.lang.Object obj2)
            throws java.lang.ClassCastException
Compare two Content objects based upon the sorting criteria.
Specified by:
compare in interface java.util.Comparator
Parameters:
obj1 - the first object.
obj2 - the second object.
Returns:
-1 if obj1 less than obj2, 0 if equals, 1 if greater than.
Throws:
java.lang.ClassCastException - thrown if either obj1 or obj2 is not a DocumentMetadataDef.

toString

public java.lang.String toString()
Get a string representation.
Overrides:
toString in class java.lang.Object

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved