com.amazon.carbonado.util
Class ConversionComparator

java.lang.Object
  extended by com.amazon.carbonado.util.ConversionComparator
All Implemented Interfaces:
Comparator<Class>

public class ConversionComparator
extends Object
implements Comparator<Class>

Compares type conversions, finding the one that is nearest.

Since:
1.2
Author:
Brian S O'Neill

Constructor Summary
ConversionComparator(Class fromType)
           
 
Method Summary
 int compare(Class toType_a, Class toType_b)
          Evaluates two types, to see which one is nearest to the from type.
 boolean isConversionPossible(Class toType)
          Returns true if a coversion is possible to the given type.
 
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

ConversionComparator

public ConversionComparator(Class fromType)
Method Detail

isConversionPossible

public boolean isConversionPossible(Class toType)
Returns true if a coversion is possible to the given type.


compare

public int compare(Class toType_a,
                   Class toType_b)
Evaluates two types, to see which one is nearest to the from type. Return <0 if "a" is nearest, 0 if both are equally good, >0 if "b" is nearest.

Specified by:
compare in interface Comparator<Class>


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.