FileDocCategorySizeDatePackage
Classification.javaAPI DocHibernate 3.2.51722Thu Oct 26 08:39:24 BST 2006org.hibernate.test.hql

Classification

public class Classification extends Object implements Serializable, Comparable
Mimic a JDK 5 enum.
author
Steve Ebersole

Fields Summary
public static final Classification
COOL
public static final Classification
LAME
private static final HashMap
INSTANCES
private final String
name
private final int
ordinal
private final int
hashCode
Constructors Summary
private Classification(String name, int ordinal)

		this.name = name;
		this.ordinal = ordinal;

		int hashCode = name.hashCode();
		hashCode = 29 * hashCode + ordinal;
		this.hashCode = hashCode;
	
Methods Summary
public intcompareTo(java.lang.Object o)

		int otherOrdinal = ( ( Classification ) o ).ordinal;
		if ( ordinal == otherOrdinal ) {
			return 0;
		}
		else if ( ordinal > otherOrdinal ) {
			return 1;
		}
		else {
			return -1;
		}
	
public booleanequals(java.lang.Object obj)

		return compareTo( obj ) == 0;
	
public inthashCode()

		return hashCode;
	
public java.lang.Stringname()

		return name;
	
public intordinal()

		return ordinal;
	
public static org.hibernate.test.hql.ClassificationvalueOf(java.lang.String name)

		return ( Classification ) INSTANCES.get( name );
	
public static org.hibernate.test.hql.ClassificationvalueOf(java.lang.Integer ordinal)

		if ( ordinal == null ) {
			return null;
		}
		switch ( ordinal.intValue() ) {
			case 0: return COOL;
			case 1: return LAME;
			default: throw new IllegalArgumentException( "unknown classification ordinal [" + ordinal + "]" );
		}