KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > type > MutableType


1 //$Id: MutableType.java,v 1.7 2005/05/24 16:22:15 oneovthafew Exp $
2
package org.hibernate.type;
3
4 import java.util.Map JavaDoc;
5
6 import org.hibernate.EntityMode;
7 import org.hibernate.HibernateException;
8 import org.hibernate.engine.SessionFactoryImplementor;
9 import org.hibernate.engine.SessionImplementor;
10
11 /**
12  * Superclass for mutable nullable types
13  * @author Gavin King
14  */

15 public abstract class MutableType extends NullableType {
16
17     public final boolean isMutable() {
18         return true;
19     }
20
21     protected abstract Object JavaDoc deepCopyNotNull(Object JavaDoc value) throws HibernateException;
22
23     public final Object JavaDoc deepCopy(Object JavaDoc value, EntityMode entityMode, SessionFactoryImplementor factory)
24     throws HibernateException {
25         return (value==null) ? null : deepCopyNotNull(value);
26     }
27
28     public Object JavaDoc replace(
29         Object JavaDoc original,
30         Object JavaDoc target,
31         SessionImplementor session,
32         Object JavaDoc owner,
33         Map JavaDoc copyCache)
34     throws HibernateException {
35         if ( isEqual( original, target, session.getEntityMode() ) ) return original;
36         return deepCopy( original, session.getEntityMode(), session.getFactory() );
37     }
38
39 }
40
Popular Tags