FileDocCategorySizeDatePackage
MultiplicityType.javaAPI DocHibernate 3.2.54016Thu Apr 28 10:44:16 BST 2005org.hibernate.test.legacy

MultiplicityType

public class MultiplicityType extends Object implements org.hibernate.usertype.CompositeUserType

Fields Summary
private static final String[]
PROP_NAMES
private static final int[]
SQL_TYPES
private static final org.hibernate.type.Type[]
TYPES
Constructors Summary
Methods Summary
public java.lang.Objectassemble(java.io.Serializable cached, org.hibernate.engine.SessionImplementor session, java.lang.Object owner)

		if (cached==null) return null;
		Serializable[] o = (Serializable[]) cached;
		Multiplicity m = new Multiplicity();
		m.count = ( (Integer) o[0] ).intValue();
		m.glarch = o[1]==null ? 
			null : 
			(GlarchProxy) session.internalLoad( Glarch.class.getName(), o[1], false, false );
		return m;
	
public java.lang.ObjectdeepCopy(java.lang.Object value)

		if (value==null) return null;
		Multiplicity v = (Multiplicity) value;
		Multiplicity m = new Multiplicity();
		m.count = v.count;
		m.glarch = v.glarch;
		return m;
	
public java.io.Serializabledisassemble(java.lang.Object value, org.hibernate.engine.SessionImplementor session)

		if (value==null) return null;
		Multiplicity m = (Multiplicity) value;
		return new Serializable[] { 
				new Integer(m.count), 
				ForeignKeys.getEntityIdentifierIfNotUnsaved( Glarch.class.getName(), m.glarch, session ) 
		};
	
public booleanequals(java.lang.Object x, java.lang.Object y)

		Multiplicity mx = (Multiplicity) x;
		Multiplicity my = (Multiplicity) y;
		if (mx==my) return true;
		if (mx==null || my==null) return false;
		return mx.count==my.count && mx.glarch==my.glarch;
	
public java.lang.String[]getPropertyNames()


	   
		return PROP_NAMES;
	
public org.hibernate.type.Type[]getPropertyTypes()

		return TYPES;
	
public java.lang.ObjectgetPropertyValue(java.lang.Object component, int property)

		Multiplicity o = (Multiplicity) component;
		return property==0 ?
			(Object) new Integer(o.count) :
			(Object) o.glarch;
	
public inthashCode(java.lang.Object x)

		Multiplicity o = (Multiplicity) x;
		return o.count + o.glarch.hashCode();
	
public booleanisMutable()

		return true;
	
public java.lang.ObjectnullSafeGet(java.sql.ResultSet rs, java.lang.String[] names, org.hibernate.engine.SessionImplementor session, java.lang.Object owner)


		Integer c = (Integer) Hibernate.INTEGER.nullSafeGet( rs, names[0] );
		GlarchProxy g = (GlarchProxy) Hibernate.entity(Glarch.class).nullSafeGet(rs, names[1], session, owner);
		Multiplicity m = new Multiplicity();
		m.count = c==null ? 0 : c.intValue();
		m.glarch = g;
		return m;
	
public voidnullSafeSet(java.sql.PreparedStatement st, java.lang.Object value, int index, org.hibernate.engine.SessionImplementor session)


		Multiplicity o = (Multiplicity) value;
		GlarchProxy g;
		Integer c;
		if (o==null) {
			g=null;
			c=new Integer(0);
		}
		else {
			g = o.glarch;
			c = new Integer(o.count);
		}
		Hibernate.INTEGER.nullSafeSet(st, c, index, session);
		Hibernate.entity(Glarch.class).nullSafeSet(st, g, index+1, session);

	
public java.lang.Objectreplace(java.lang.Object original, java.lang.Object target, org.hibernate.engine.SessionImplementor session, java.lang.Object owner)

		return assemble( disassemble(original, session), session, owner);
	
public java.lang.ClassreturnedClass()

		return Multiplicity.class;
	
public voidsetPropertyValue(java.lang.Object component, int property, java.lang.Object value)


		Multiplicity o = (Multiplicity) component;
		if (property==0) {
			o.count = ( (Integer) value ).intValue();
		}
		else {
			o.glarch = (Glarch) value;
		}
	
public int[]sqlTypes()

		return SQL_TYPES;