org.progeeks.meta.util
Class FormatComparator

java.lang.Object
  extended by org.progeeks.meta.util.FormatComparator
All Implemented Interfaces:
java.util.Comparator

public class FormatComparator
extends java.lang.Object
implements java.util.Comparator

Uses an objects String as given by the contained formatter to use when comparing two values.

Version:
$Revision: 1.3 $
Author:
Paul Speed

Constructor Summary
FormatComparator()
          Creates a format comparator that will delegate to a DefaultPropertyFormat to convert compared objects to strings that it will use for the real comparison.
FormatComparator(PropertyFormat format)
          Creates a format comparator that will delegate to the specified PropertyFormat to convert compared objects to strings that it will use for the real comparison.
 
Method Summary
 int compare(java.lang.Object obj1, java.lang.Object obj2)
           
 PropertyFormat getPropertyFormat()
          Returns the property format object that will used to convert the objects into strings before comparisons are done.
 void setPropertyFormat(PropertyFormat format)
          Sets the property format object that will used to convert the objects into strings before comparisons are done.
 
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
 

Constructor Detail

FormatComparator

public FormatComparator()
Creates a format comparator that will delegate to a DefaultPropertyFormat to convert compared objects to strings that it will use for the real comparison.


FormatComparator

public FormatComparator(PropertyFormat format)
Creates a format comparator that will delegate to the specified PropertyFormat to convert compared objects to strings that it will use for the real comparison.

Method Detail

setPropertyFormat

public void setPropertyFormat(PropertyFormat format)
Sets the property format object that will used to convert the objects into strings before comparisons are done.


getPropertyFormat

public PropertyFormat getPropertyFormat()
Returns the property format object that will used to convert the objects into strings before comparisons are done.


compare

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


Copyright © 2002-2003 Paul Speed. All Rights Reserved.