站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 2.1.8 正式版 API 英文文档

AbstractType (Hibernate API Documentation) - Hibernate 2.1.8 正式版 API 英文文档


net.sf.hibernate.type
Class AbstractType

java.lang.Object
  extended bynet.sf.hibernate.type.AbstractType
All Implemented Interfaces:
Serializable, Type
Direct Known Subclasses:
ComponentType, CompositeCustomType, CustomType, DynamicComponentType, EntityType, MetaType, NullableType, ObjectType, PersistentCollectionType

public abstract class AbstractType
extends Object
implements Type

Abstract superclass of the built in Type hierarchy.

Author:
Gavin King
See Also:
Serialized Form

Constructor Summary
AbstractType()
           
 
Method Summary
 Object assemble(Serializable cached, SessionImplementor session, Object owner)
          Reconstruct the object from its cached "disassembled" state.
 Object copy(Object original, Object target, SessionImplementor session, Object owner, Map copiedAlready)
           
 Serializable disassemble(Object value, SessionImplementor session)
          Return a cacheable "disassembled" representation of the object.
 boolean equals(Object object)
           
 int hashCode()
           
 Object hydrate(ResultSet rs, String[] names, SessionImplementor session, Object owner)
          Retrieve an instance of the mapped class, or the identifier of an entity or collection, from a JDBC resultset.
 boolean isAssociationType()
          Return true if the implementation is castable to AssociationType.
 boolean isComponentType()
          Is this type a component type.
 boolean isDirty(Object old, Object current, SessionImplementor session)
          Should the parent be considered dirty, given both the old and current field or element value?
 boolean isEntityType()
          Is this type an entity type?
 boolean isModified(Object old, Object current, SessionImplementor session)
          Has the parent object been modified, compared to the current database state?
 boolean isObjectType()
          Is this an "object" type.
 boolean isPersistentCollectionType()
          Is this type a collection type.
 Object resolveIdentifier(Object value, SessionImplementor session, Object owner)
          Map identifiers to entities or collections.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.hibernate.type.Type
deepCopy, equals, fromString, getColumnSpan, getName, getReturnedClass, hasNiceEquals, isMutable, nullSafeGet, nullSafeGet, nullSafeSet, sqlTypes, toString
 

Constructor Detail

AbstractType

public AbstractType()
Method Detail

isAssociationType

public boolean isAssociationType()
Description copied from interface: Type
Return true if the implementation is castable to AssociationType. This does not necessarily imply that the type actually represents an association.

Specified by:
isAssociationType in interface Type
Returns:
boolean
See Also:
AssociationType

isPersistentCollectionType

public boolean isPersistentCollectionType()
Description copied from interface: Type
Is this type a collection type.

Specified by:
isPersistentCollectionType in interface Type

isComponentType

public boolean isComponentType()
Description copied from interface: Type
Is this type a component type. If so, the implementation must be castable to AbstractComponentType. A component type may own collections or associations and hence must provide certain extra functionality.

Specified by:
isComponentType in interface Type
Returns:
boolean
See Also:
AbstractComponentType

isEntityType

public boolean isEntityType()
Description copied from interface: Type
Is this type an entity type?

Specified by:
isEntityType in interface Type
Returns:
boolean

disassemble

public Serializable disassemble(Object value,
                                SessionImplementor session)
                         throws HibernateException
Description copied from interface: Type
Return a cacheable "disassembled" representation of the object.

Specified by:
disassemble in interface Type
Parameters:
value - the value to cache
session - the session
Returns:
the disassembled, deep cloned state
Throws:
HibernateException

assemble

public Object assemble(Serializable cached,
                       SessionImplementor session,
                       Object owner)
                throws HibernateException
Description copied from interface: Type
Reconstruct the object from its cached "disassembled" state.

Specified by:
assemble in interface Type
Parameters:
cached - the disassembled state from the cache
session - the session
owner - the parent entity object
Returns:
the the object
Throws:
HibernateException

isDirty

public boolean isDirty(Object old,
                       Object current,
                       SessionImplementor session)
                throws HibernateException
Description copied from interface: Type
Should the parent be considered dirty, given both the old and current field or element value?

Specified by:
isDirty in interface Type
Parameters:
old - the old value
current - the current value
session -
Returns:
true if the field is dirty
Throws:
HibernateException

hydrate

public Object hydrate(ResultSet rs,
                      String[] names,
                      SessionImplementor session,
                      Object owner)
               throws HibernateException,
                      SQLException
Description copied from interface: Type
Retrieve an instance of the mapped class, or the identifier of an entity or collection, from a JDBC resultset. This is useful for 2-phase property initialization - the second phase is a call to resolveIdentifier().

Specified by:
hydrate in interface Type
Parameters:
rs -
names - the column names
session - the session
owner - the parent entity
Returns:
Object an identifier or actual value
Throws:
SQLException
HibernateException
See Also:
Type.resolveIdentifier(Object, SessionImplementor, Object)

resolveIdentifier

public Object resolveIdentifier(Object value,
                                SessionImplementor session,
                                Object owner)
                         throws HibernateException
Description copied from interface: Type
Map identifiers to entities or collections. This is the second phase of 2-phase property initialization.

Specified by:
resolveIdentifier in interface Type
Parameters:
value - an identifier or value returned by hydrate()
owner - the parent entity
session - the session
Returns:
the given value, or the value associated with the identifier
Throws:
HibernateException
See Also:
Type.hydrate(ResultSet, String[], SessionImplementor, Object)

isObjectType

public boolean isObjectType()
Description copied from interface: Type
Is this an "object" type. I.e. a reference to a persistent entity that is not modelled as a (foreign key) association.

Specified by:
isObjectType in interface Type

isModified

public boolean isModified(Object old,
                          Object current,
                          SessionImplementor session)
                   throws HibernateException
Description copied from interface: Type
Has the parent object been modified, compared to the current database state?

Specified by:
isModified in interface Type
Parameters:
old - the database state, in a "hydrated" form, with identifiers unresolved
current - the current state of the object
session -
Returns:
true if the field has been modified
Throws:
HibernateException

copy

public Object copy(Object original,
                   Object target,
                   SessionImplementor session,
                   Object owner,
                   Map copiedAlready)
            throws HibernateException
Specified by:
copy in interface Type
Throws:
HibernateException

equals

public boolean equals(Object object)

hashCode

public int hashCode()