org.jcreme.enumerations
Class ComparatorType

java.lang.Object
  extended byorg.jcreme.enumerations.Enumeration
      extended byorg.jcreme.enumerations.ComparatorType
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class ComparatorType
extends Enumeration

This class defines an Enumeration of Comparators. This can be used to select comparators in Applications that need sorting. The class defines two basic comparatortype instances: NONE which holds a dummy comparator. DEFAULT which holds a dummy comparator for Comparable objects (it simply applies the Comparable's method).

Version:
$Revision: 1.4 $
Author:
$Author: dbregeon $
See Also:
Serialized Form

Field Summary
static java.lang.Class C_DEFAULT
          The Class to which the DEFAULT Comparator should be applied.
static java.lang.Class C_NONE
          The type for which the comparator in the NONE ComparatorType is applicable.
static ComparatorType DEFAULT
          The DEFAULT ComparatorType.
static ComparatorType NONE
          The NONE ComparatorType.
static java.lang.String S_DEFAULT
          The name of the DEFAULT ComparatorType.
static java.lang.String S_NONE
          The Name of the NONE ComparatorType.
(package private) static long serialVersionUID
           
 
Constructor Summary
protected ComparatorType(java.lang.String name)
          Creates a new instance of ComparatorType
 
Method Summary
static ComparatorType get(java.lang.String name)
          This method retrieves a ComparatorType from its name.
 java.util.Comparator getComparator()
          Gives access to the Comparator of this ComparatorType.
static ComparatorType[] getComparatorTypes()
          This methods gives the instances of this class.
static ComparatorType[] getComparatorTypes(java.lang.Class dataType)
          Looks into the existing ComparatorTypes to find those that apply to a given type.
 java.lang.Class getDataType()
          Gives access to the type that is associated to the ComparatorType.
protected  java.util.Hashtable getFromName()
          This method is for internal use only.
static Enumeration[] getValues()
          This method enables to retrieve all the possible values of an Enumeration class.
 void setComparator(java.util.Comparator c)
          Enables to set the Comparator for this ComparatorType.
 void setDataType(java.lang.Class type)
          Enables to set the type that can be used with the associated ComparatorType.
 
Methods inherited from class org.jcreme.enumerations.Enumeration
compareTo, getName, readResolve, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

S_NONE

public static final java.lang.String S_NONE
The Name of the NONE ComparatorType.

See Also:
Constant Field Values

C_NONE

public static final java.lang.Class C_NONE
The type for which the comparator in the NONE ComparatorType is applicable.


NONE

public static final ComparatorType NONE
The NONE ComparatorType.


S_DEFAULT

public static final java.lang.String S_DEFAULT
The name of the DEFAULT ComparatorType.

See Also:
Constant Field Values

C_DEFAULT

public static final java.lang.Class C_DEFAULT
The Class to which the DEFAULT Comparator should be applied.


DEFAULT

public static final ComparatorType DEFAULT
The DEFAULT ComparatorType.

Constructor Detail

ComparatorType

protected ComparatorType(java.lang.String name)
Creates a new instance of ComparatorType

Parameters:
name - the name of the enumerated value.
Method Detail

setDataType

public void setDataType(java.lang.Class type)
Enables to set the type that can be used with the associated ComparatorType.

Parameters:
type - the type used by the associated ComparatorType.

getDataType

public java.lang.Class getDataType()
Gives access to the type that is associated to the ComparatorType.

Returns:
the type currently associated to the ComparatorType

setComparator

public void setComparator(java.util.Comparator c)
Enables to set the Comparator for this ComparatorType.

Parameters:
c - the Comparator to use for this ComparatorType.

getComparator

public java.util.Comparator getComparator()
Gives access to the Comparator of this ComparatorType.

Returns:
the Comparator in this ComparatorType.

get

public static ComparatorType get(java.lang.String name)
This method retrieves a ComparatorType from its name. If no existing ComparatorType matches this name, a new one is created.

Parameters:
name - the name of the ComparatorType to find.
Returns:
the ComparatorType of the given name.

getComparatorTypes

public static ComparatorType[] getComparatorTypes()
This methods gives the instances of this class.

Returns:
all the instances of this class.

getComparatorTypes

public static ComparatorType[] getComparatorTypes(java.lang.Class dataType)
Looks into the existing ComparatorTypes to find those that apply to a given type.

Parameters:
dataType - the type for which we look for ComparatorTypes.
Returns:
the existing ComparatorTypes that apply to the given type.

getValues

public static Enumeration[] getValues()
This method enables to retrieve all the possible values of an Enumeration class.

Returns:
the values for this class.

getFromName

protected java.util.Hashtable getFromName()
This method is for internal use only.

Specified by:
getFromName in class Enumeration
Returns:
the Hashtable that links the enumerated values names with the actual enumerated value.


Copyright 2006 null. All Rights Reserved.