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

ClassificationType

public class ClassificationType extends Object implements org.hibernate.usertype.EnhancedUserType
A custom type for mapping {@link org.hibernate.test.hql.Classification} instances to the respective db column.

THis is largely intended to mimic JDK5 enum support in JPA. Here we are using the approach of storing the ordinal values, rather than the names.
author
Steve Ebersole

Fields Summary
Constructors Summary
Methods Summary
public java.lang.Objectassemble(java.io.Serializable cached, java.lang.Object owner)

		return cached;
	
public java.lang.ObjectdeepCopy(java.lang.Object value)

		return value;
	
public java.io.Serializabledisassemble(java.lang.Object value)

		return ( Classification ) value;
	
public booleanequals(java.lang.Object x, java.lang.Object y)

		if ( x == null && y == null ) {
			return false;
		}
		else if ( x != null ) {
			return x.equals( y );
		}
		else {
			return y.equals( x );
		}
	
private java.lang.StringextractName(java.lang.Object obj)

		return ( ( Classification ) obj ).name();
	
private intextractOrdinal(java.lang.Object value)

		return ( ( Classification ) value ).ordinal();
	
private java.lang.StringextractOrdinalString(java.lang.Object value)

		return Integer.toString( extractOrdinal( value ) );
	
public java.lang.ObjectfromXMLString(java.lang.String xmlValue)

		return Classification.valueOf( xmlValue );
	
public inthashCode(java.lang.Object x)

		return x.hashCode();
	
public booleanisMutable()

		return false;
	
public java.lang.ObjectnullSafeGet(java.sql.ResultSet rs, java.lang.String[] names, java.lang.Object owner)

		Integer ordinal = ( Integer ) Hibernate.INTEGER.nullSafeGet( rs, names[0] );
		return Classification.valueOf( ordinal );
	
public voidnullSafeSet(java.sql.PreparedStatement st, java.lang.Object value, int index)

		Integer ordinal = value == null ? null : new Integer( ( ( Classification ) value ).ordinal() );
		Hibernate.INTEGER.nullSafeSet( st, ordinal, index );
	
public java.lang.StringobjectToSQLString(java.lang.Object value)

		return extractOrdinalString( value );
	
public java.lang.Objectreplace(java.lang.Object original, java.lang.Object target, java.lang.Object owner)

		return original;
	
public java.lang.ClassreturnedClass()

		return Classification.class;
	
public int[]sqlTypes()

		return new int[] { Types.TINYINT };
	
public java.lang.StringtoXMLString(java.lang.Object value)

		return extractName( value );