FileDocCategorySizeDatePackage
DefaultValueIntegerType.javaAPI DocHibernate 3.2.52250Tue Feb 22 01:15:34 GMT 2005org.hibernate.test.typeparameters

DefaultValueIntegerType

public class DefaultValueIntegerType extends Object implements org.hibernate.usertype.ParameterizedType, Serializable, org.hibernate.usertype.UserType
author
Michi

Fields Summary
private Integer
defaultValue
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 new Integer(((Integer)value).intValue());
	
public java.io.Serializabledisassemble(java.lang.Object value)

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

		if (x==y) return true;
		if (x==null || y==null) return false;
		return x.equals(y);
	
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)

		Number result = (Number) rs.getObject(names[0]);
		return result==null ? defaultValue : new Integer(result.intValue());
	
public voidnullSafeSet(java.sql.PreparedStatement st, java.lang.Object value, int index)

		if (value == null || defaultValue.equals(value) ) {
			LogFactory.getLog( getClass() ).trace("binding null to parameter: " + index);
			st.setNull(index, Types.INTEGER);
		} else {
			LogFactory.getLog( getClass() ).trace("binding " + value + " to parameter: " + index);
			st.setInt(index, ((Integer)value).intValue());
		}
	
public java.lang.Objectreplace(java.lang.Object original, java.lang.Object target, java.lang.Object owner)

		return original;
	
public java.lang.ClassreturnedClass()

		return int.class;
	
public voidsetParameterValues(java.util.Properties parameters)

		this.defaultValue = Integer.valueOf((String) parameters.get("default"));
	
public int[]sqlTypes()

		return new int[] {Types.INTEGER};