org.hibernate.type
Class TypeFactory

java.lang.Object
  extended byorg.hibernate.type.TypeFactory

public final class TypeFactory
extends Object

Used internally to obtain instances of Type. Applications should use static methods and constants on org.hibernate.Hibernate.

Author:
Gavin King
See Also:
Hibernate

Method Summary
static CollectionType array(String role, String propertyRef, boolean embedded, Class elementClass)
           
static Object[] assemble(Serializable[] row, Type[] types, SessionImplementor session, Object owner)
           
static CollectionType bag(String role, String propertyRef, boolean embedded)
           
static Type basic(String name)
          Given the name of a Hibernate basic type, return an instance of org.hibernate.type.Type.
static void beforeAssemble(Serializable[] row, Type[] types, SessionImplementor session)
          Determine if any of the given field values are modified, returning an array containing indexes of the dirty fields or null if no fields are dirty.
static CollectionType customCollection(String typeName, String role, String propertyRef, boolean embedded)
           
static void deepCopy(Object[] values, Type[] types, boolean[] copy, Object[] target, SessionImplementor session)
          Deep copy values in the first array into the second
static Serializable[] disassemble(Object[] row, Type[] types, boolean[] nonCacheable, SessionImplementor session, Object owner)
           
static int[] findDirty(StandardProperty[] properties, Object[] x, Object[] y, boolean[][] includeColumns, boolean anyUninitializedProperties, SessionImplementor session)
          Determine if any of the given field values are dirty, returning an array containing indexes of the dirty fields or null if no fields are dirty.
static int[] findModified(StandardProperty[] properties, Object[] x, Object[] y, boolean[][] includeColumns, boolean anyUninitializedProperties, SessionImplementor session)
          Determine if any of the given field values are modified, returning an array containing indexes of the dirty fields or null if no fields are dirty.
static Type heuristicType(String typeName)
          Uses heuristics to deduce a Hibernate type given a string naming the type or Java class.
static Type heuristicType(String typeName, Properties parameters)
          Uses heuristics to deduce a Hibernate type given a string naming the type or Java class.
static CollectionType idbag(String role, String propertyRef, boolean embedded)
           
static void injectParameters(Object type, Properties parameters)
           
static CollectionType list(String role, String propertyRef, boolean embedded)
           
static EntityType manyToOne(String persistentClass)
          A many-to-one association type for the given class
static EntityType manyToOne(String persistentClass, boolean lazy)
          A many-to-one association type for the given class
static EntityType manyToOne(String persistentClass, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, boolean isEmbeddedInXML, boolean ignoreNotFound)
          A many-to-one association type for the given class
static CollectionType map(String role, String propertyRef, boolean embedded)
           
static EntityType oneToOne(String persistentClass, ForeignKeyDirection foreignKeyType, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, boolean isEmbeddedInXML, String entityName, String propertyName)
          A one-to-one association type for the given class
static CollectionType orderedMap(String role, String propertyRef, boolean embedded)
           
static CollectionType orderedSet(String role, String propertyRef, boolean embedded)
           
static Object[] replace(Object[] original, Object[] target, Type[] types, SessionImplementor session, Object owner, Map copyCache)
           
static Object[] replace(Object[] original, Object[] target, Type[] types, SessionImplementor session, Object owner, Map copyCache, ForeignKeyDirection foreignKeyDirection)
           
static CollectionType set(String role, String propertyRef, boolean embedded)
           
static CollectionType sortedMap(String role, String propertyRef, boolean embedded, Comparator comparator)
           
static CollectionType sortedSet(String role, String propertyRef, boolean embedded, Comparator comparator)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

oneToOne

public static EntityType oneToOne(String persistentClass,
                                  ForeignKeyDirection foreignKeyType,
                                  String uniqueKeyPropertyName,
                                  boolean lazy,
                                  boolean unwrapProxy,
                                  boolean isEmbeddedInXML,
                                  String entityName,
                                  String propertyName)
A one-to-one association type for the given class


manyToOne

public static EntityType manyToOne(String persistentClass)
A many-to-one association type for the given class


manyToOne

public static EntityType manyToOne(String persistentClass,
                                   boolean lazy)
A many-to-one association type for the given class


manyToOne

public static EntityType manyToOne(String persistentClass,
                                   String uniqueKeyPropertyName,
                                   boolean lazy,
                                   boolean unwrapProxy,
                                   boolean isEmbeddedInXML,
                                   boolean ignoreNotFound)
A many-to-one association type for the given class


basic

public static Type basic(String name)
Given the name of a Hibernate basic type, return an instance of org.hibernate.type.Type.


heuristicType

public static Type heuristicType(String typeName)
                          throws MappingException
Uses heuristics to deduce a Hibernate type given a string naming the type or Java class. Return an instance of org.hibernate.type.Type.

Throws:
MappingException

heuristicType

public static Type heuristicType(String typeName,
                                 Properties parameters)
                          throws MappingException
Uses heuristics to deduce a Hibernate type given a string naming the type or Java class. Return an instance of org.hibernate.type.Type.

Throws:
MappingException

customCollection

public static CollectionType customCollection(String typeName,
                                              String role,
                                              String propertyRef,
                                              boolean embedded)

array

public static CollectionType array(String role,
                                   String propertyRef,
                                   boolean embedded,
                                   Class elementClass)

list

public static CollectionType list(String role,
                                  String propertyRef,
                                  boolean embedded)

bag

public static CollectionType bag(String role,
                                 String propertyRef,
                                 boolean embedded)

idbag

public static CollectionType idbag(String role,
                                   String propertyRef,
                                   boolean embedded)

map

public static CollectionType map(String role,
                                 String propertyRef,
                                 boolean embedded)

orderedMap

public static CollectionType orderedMap(String role,
                                        String propertyRef,
                                        boolean embedded)

set

public static CollectionType set(String role,
                                 String propertyRef,
                                 boolean embedded)

orderedSet

public static CollectionType orderedSet(String role,
                                        String propertyRef,
                                        boolean embedded)

sortedMap

public static CollectionType sortedMap(String role,
                                       String propertyRef,
                                       boolean embedded,
                                       Comparator comparator)

sortedSet

public static CollectionType sortedSet(String role,
                                       String propertyRef,
                                       boolean embedded,
                                       Comparator comparator)

deepCopy

public static void deepCopy(Object[] values,
                            Type[] types,
                            boolean[] copy,
                            Object[] target,
                            SessionImplementor session)
                     throws HibernateException
Deep copy values in the first array into the second

Throws:
HibernateException

beforeAssemble

public static void beforeAssemble(Serializable[] row,
                                  Type[] types,
                                  SessionImplementor session)
                           throws HibernateException
Determine if any of the given field values are modified, returning an array containing indexes of the dirty fields or null if no fields are dirty.

Throws:
HibernateException

assemble

public static Object[] assemble(Serializable[] row,
                                Type[] types,
                                SessionImplementor session,
                                Object owner)
                         throws HibernateException
Throws:
HibernateException

disassemble

public static Serializable[] disassemble(Object[] row,
                                         Type[] types,
                                         boolean[] nonCacheable,
                                         SessionImplementor session,
                                         Object owner)
                                  throws HibernateException
Throws:
HibernateException

replace

public static Object[] replace(Object[] original,
                               Object[] target,
                               Type[] types,
                               SessionImplementor session,
                               Object owner,
                               Map copyCache)
                        throws HibernateException
Throws:
HibernateException

replace

public static Object[] replace(Object[] original,
                               Object[] target,
                               Type[] types,
                               SessionImplementor session,
                               Object owner,
                               Map copyCache,
                               ForeignKeyDirection foreignKeyDirection)
                        throws HibernateException
Throws:
HibernateException

findDirty

public static int[] findDirty(StandardProperty[] properties,
                              Object[] x,
                              Object[] y,
                              boolean[][] includeColumns,
                              boolean anyUninitializedProperties,
                              SessionImplementor session)
                       throws HibernateException
Determine if any of the given field values are dirty, returning an array containing indexes of the dirty fields or null if no fields are dirty.

Parameters:
x - the current state of the entity
y - the snapshot state from the time the object was loaded
Throws:
HibernateException

findModified

public static int[] findModified(StandardProperty[] properties,
                                 Object[] x,
                                 Object[] y,
                                 boolean[][] includeColumns,
                                 boolean anyUninitializedProperties,
                                 SessionImplementor session)
                          throws HibernateException
Determine if any of the given field values are modified, returning an array containing indexes of the dirty fields or null if no fields are dirty.

Parameters:
x - the current state of the entity
y - the snapshot state just retrieved from the database
Throws:
HibernateException

injectParameters

public static void injectParameters(Object type,
                                    Properties parameters)