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

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


net.sf.hibernate.type
Class MetaType

java.lang.Object
  extended bynet.sf.hibernate.type.AbstractType
      extended bynet.sf.hibernate.type.MetaType
All Implemented Interfaces:
Serializable, Type

public class MetaType
extends AbstractType

Author:
Gavin King
See Also:
Serialized Form

Constructor Summary
MetaType(Map values, Type baseType)
           
 
Method Summary
 Object deepCopy(Object value)
          Return a deep copy of the persistent state, stopping at entities and at collections.
 boolean equals(Object x, Object y)
          Compare two instances of the class mapped by this type for persistence "equality", ie.
 Object fromString(String xml)
          Parse the XML representation of an instance.
 int getColumnSpan(Mapping mapping)
          How many columns are used to persist this type.
 String getName()
          Returns the abbreviated name of the type.
 Class getReturnedClass()
          The class returned by nullSafeGet() methods.
 boolean hasNiceEquals()
          Does this type implement a well-behaved equals() method.
 boolean isMutable()
          Are objects of this type mutable.
 Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner)
          Retrieve an instance of the mapped class from a JDBC resultset.
 Object nullSafeGet(ResultSet rs, String name, SessionImplementor session, Object owner)
          Retrieve an instance of the mapped class from a JDBC resultset.
 void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session)
          Write an instance of the mapped class to a prepared statement.
 int[] sqlTypes(Mapping mapping)
          Return the SQL type codes for the columns mapped by this type.
 String toString(Object value, SessionFactoryImplementor factory)
          A representation of the value to be embedded in an XML element.
 
Methods inherited from class net.sf.hibernate.type.AbstractType
assemble, copy, disassemble, equals, hashCode, hydrate, isAssociationType, isComponentType, isDirty, isEntityType, isModified, isObjectType, isPersistentCollectionType, resolveIdentifier
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetaType

public MetaType(Map values,
                Type baseType)
Method Detail

sqlTypes

public int[] sqlTypes(Mapping mapping)
               throws MappingException
Description copied from interface: Type
Return the SQL type codes for the columns mapped by this type. The codes are defined on java.sql.Types.

Returns:
the typecodes
Throws:
MappingException
See Also:
Types

getColumnSpan

public int getColumnSpan(Mapping mapping)
                  throws MappingException
Description copied from interface: Type
How many columns are used to persist this type.

Throws:
MappingException

getReturnedClass

public Class getReturnedClass()
Description copied from interface: Type
The class returned by nullSafeGet() methods. This is used to establish the class of an array of this type.

Returns:
Class

equals

public boolean equals(Object x,
                      Object y)
               throws HibernateException
Description copied from interface: Type
Compare two instances of the class mapped by this type for persistence "equality", ie. Equality of persistent state.

Parameters:
x -
y -
Returns:
boolean
Throws:
HibernateException

nullSafeGet

public Object nullSafeGet(ResultSet rs,
                          String[] names,
                          SessionImplementor session,
                          Object owner)
                   throws HibernateException,
                          SQLException
Description copied from interface: Type
Retrieve an instance of the mapped class from a JDBC resultset. Implementors should handle possibility of null values.

Parameters:
rs -
names - the column names
session -
owner - the parent entity
Returns:
Object
Throws:
HibernateException
SQLException
See Also:
alternative, 2-phase property initialization

nullSafeGet

public Object nullSafeGet(ResultSet rs,
                          String name,
                          SessionImplementor session,
                          Object owner)
                   throws HibernateException,
                          SQLException
Description copied from interface: Type
Retrieve an instance of the mapped class from a JDBC resultset. Implementations should handle possibility of null values. This method might be called if the type is known to be a single-column type.

Parameters:
rs -
name - the column name
session -
owner - the parent entity
Returns:
Object
Throws:
SQLException
HibernateException

nullSafeSet

public void nullSafeSet(PreparedStatement st,
                        Object value,
                        int index,
                        SessionImplementor session)
                 throws HibernateException,
                        SQLException
Description copied from interface: Type
Write an instance of the mapped class to a prepared statement. Implementors should handle possibility of null values. A multi-column type should be written to parameters starting from index.

Parameters:
st -
value - the object to write
index - statement parameter index
session -
Throws:
SQLException
HibernateException

toString

public String toString(Object value,
                       SessionFactoryImplementor factory)
                throws HibernateException
Description copied from interface: Type
A representation of the value to be embedded in an XML element.

Parameters:
value -
factory -
Returns:
String
Throws:
HibernateException

fromString

public Object fromString(String xml)
                  throws HibernateException
Description copied from interface: Type
Parse the XML representation of an instance.

Parameters:
xml -
Returns:
an instance of the type
Throws:
HibernateException

getName

public String getName()
Description copied from interface: Type
Returns the abbreviated name of the type.

Returns:
String the Hibernate type name

deepCopy

public Object deepCopy(Object value)
                throws HibernateException
Description copied from interface: Type
Return a deep copy of the persistent state, stopping at entities and at collections.

Parameters:
value - generally a collection element or entity field
Returns:
Object a copy
Throws:
HibernateException

isMutable

public boolean isMutable()
Description copied from interface: Type
Are objects of this type mutable. (With respect to the referencing object ... entities and collections are considered immutable because they manage their own internal state.)

Returns:
boolean

hasNiceEquals

public boolean hasNiceEquals()
Description copied from interface: Type
Does this type implement a well-behaved equals() method. (ie. one that is consistent with Type.equals().) Strictly, if this method returns true then x.equals(y) implies Type.equals(x, y) and also Type.equals(x, y) implies that probably x.equals(y)

See Also:
Object.equals(java.lang.Object), Type.equals(java.lang.Object, java.lang.Object)