org.hibernate.type
Class TypeFactory

java.lang.Object
  extended by org.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)
          Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
static CollectionType bag(String role, String propertyRef, boolean embedded)
           
static Type basic(String name)
          Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
static void beforeAssemble(Serializable[] row, Type[] types, SessionImplementor session)
          Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
static CollectionType customCollection(String typeName, Properties typeParameters, String role, String propertyRef, boolean embedded)
           
static CollectionType customCollection(String typeName, String role, String propertyRef, boolean embedded)
          Deprecated. Use customCollection(String, java.util.Properties, String, String, boolean) instead
static void deepCopy(Object[] values, Type[] types, boolean[] copy, Object[] target, SessionImplementor session)
          Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
static Serializable[] disassemble(Object[] row, Type[] types, boolean[] nonCacheable, SessionImplementor session, Object owner)
          Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
static int[] findDirty(StandardProperty[] properties, Object[] currentState, Object[] previousState, boolean[][] includeColumns, boolean anyUninitializedProperties, SessionImplementor session)
          Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
static int[] findModified(StandardProperty[] properties, Object[] currentState, Object[] previousState, boolean[][] includeColumns, boolean anyUninitializedProperties, SessionImplementor session)
          Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
static Type heuristicType(String typeName)
          Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
static Type heuristicType(String typeName, Properties parameters)
          Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
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)
          Deprecated. Use manyToOne(String, String, boolean, boolean, boolean, boolean, boolean)
static EntityType manyToOne(String persistentClass, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, boolean isEmbeddedInXML, boolean ignoreNotFound, boolean isLogicalOneToOne)
          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)
          Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
static Object[] replace(Object[] original, Object[] target, Type[] types, SessionImplementor session, Object owner, Map copyCache, ForeignKeyDirection foreignKeyDirection)
          Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
static Object[] replaceAssociations(Object[] original, Object[] target, Type[] types, SessionImplementor session, Object owner, Map copyCache, ForeignKeyDirection foreignKeyDirection)
          Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
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)
Deprecated. Use manyToOne(String, String, boolean, boolean, boolean, boolean, boolean)

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,
                                   boolean isLogicalOneToOne)
A many-to-one association type for the given class


basic

public static Type basic(String name)
Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138

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
Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138

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
Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138

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)
Deprecated. Use customCollection(String, java.util.Properties, String, String, boolean) instead

The legacy contract.


customCollection

public static CollectionType customCollection(String typeName,
                                              Properties typeParameters,
                                              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)

injectParameters

public static void injectParameters(Object type,
                                    Properties parameters)

deepCopy

public static void deepCopy(Object[] values,
                            Type[] types,
                            boolean[] copy,
                            Object[] target,
                            SessionImplementor session)
Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138

Deep copy a series of values from one array to another...

Parameters:
values - The values to copy (the source)
types - The value types
copy - an array indicating which values to include in the copy
target - The array into which to copy the values
session - The orginating session

beforeAssemble

public static void beforeAssemble(Serializable[] row,
                                  Type[] types,
                                  SessionImplementor session)
Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138

Apply the Type.beforeAssemble(java.io.Serializable, org.hibernate.engine.SessionImplementor) operation across a series of values.

Parameters:
row - The values
types - The value types
session - The orginating session

assemble

public static Object[] assemble(Serializable[] row,
                                Type[] types,
                                SessionImplementor session,
                                Object owner)
Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138

Apply the Type.assemble(java.io.Serializable, org.hibernate.engine.SessionImplementor, java.lang.Object) operation across a series of values.

Parameters:
row - The values
types - The value types
session - The orginating session
owner - The entity "owning" the values
Returns:
The assembled state

disassemble

public static Serializable[] disassemble(Object[] row,
                                         Type[] types,
                                         boolean[] nonCacheable,
                                         SessionImplementor session,
                                         Object owner)
Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138

Apply the Type.disassemble(java.lang.Object, org.hibernate.engine.SessionImplementor, java.lang.Object) operation across a series of values.

Parameters:
row - The values
types - The value types
nonCacheable - An array indicating which values to include in the disassemled state
session - The orginating session
owner - The entity "owning" the values
Returns:
The disassembled state

replace

public static Object[] replace(Object[] original,
                               Object[] target,
                               Type[] types,
                               SessionImplementor session,
                               Object owner,
                               Map copyCache)
Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138

Apply the Type.replace(java.lang.Object, java.lang.Object, org.hibernate.engine.SessionImplementor, java.lang.Object, java.util.Map) operation across a series of values.

Parameters:
original - The source of the state
target - The target into which to replace the source values.
types - The value types
session - The orginating session
owner - The entity "owning" the values
copyCache - A map representing a cache of already replaced state
Returns:
The replaced state

replace

public static Object[] replace(Object[] original,
                               Object[] target,
                               Type[] types,
                               SessionImplementor session,
                               Object owner,
                               Map copyCache,
                               ForeignKeyDirection foreignKeyDirection)
Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138

Apply the Type.replace(java.lang.Object, java.lang.Object, org.hibernate.engine.SessionImplementor, java.lang.Object, java.util.Map) operation across a series of values.

Parameters:
original - The source of the state
target - The target into which to replace the source values.
types - The value types
session - The orginating session
owner - The entity "owning" the values
copyCache - A map representing a cache of already replaced state
foreignKeyDirection - FK directionality to be applied to the replacement
Returns:
The replaced state

replaceAssociations

public static Object[] replaceAssociations(Object[] original,
                                           Object[] target,
                                           Type[] types,
                                           SessionImplementor session,
                                           Object owner,
                                           Map copyCache,
                                           ForeignKeyDirection foreignKeyDirection)
Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138

Apply the Type.replace(java.lang.Object, java.lang.Object, org.hibernate.engine.SessionImplementor, java.lang.Object, java.util.Map) operation across a series of values, as long as the corresponding Type is an association.

If the corresponding type is a component type, then apply replaceAssociations(java.lang.Object[], java.lang.Object[], org.hibernate.type.Type[], org.hibernate.engine.SessionImplementor, java.lang.Object, java.util.Map, org.hibernate.type.ForeignKeyDirection) accross the component subtypes but do not replace the component value itself.

Parameters:
original - The source of the state
target - The target into which to replace the source values.
types - The value types
session - The orginating session
owner - The entity "owning" the values
copyCache - A map representing a cache of already replaced state
foreignKeyDirection - FK directionality to be applied to the replacement
Returns:
The replaced state

findDirty

public static int[] findDirty(StandardProperty[] properties,
                              Object[] currentState,
                              Object[] previousState,
                              boolean[][] includeColumns,
                              boolean anyUninitializedProperties,
                              SessionImplementor session)
Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138

Determine if any of the given field values are dirty, returning an array containing indices of the dirty fields.

If it is determined that no fields are dirty, null is returned.

Parameters:
properties - The property definitions
currentState - The current state of the entity
previousState - The baseline state of the entity
includeColumns - Columns to be included in the dirty checking, per property
anyUninitializedProperties - Does the entity currently hold any uninitialized property values?
session - The session from which the dirty check request originated.
Returns:
Array containing indices of the dirty properties, or null if no properties considered dirty.

findModified

public static int[] findModified(StandardProperty[] properties,
                                 Object[] currentState,
                                 Object[] previousState,
                                 boolean[][] includeColumns,
                                 boolean anyUninitializedProperties,
                                 SessionImplementor session)
Deprecated. see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138

Determine if any of the given field values are modified, returning an array containing indices of the modified fields.

If it is determined that no fields are dirty, null is returned.

Parameters:
properties - The property definitions
currentState - The current state of the entity
previousState - The baseline state of the entity
includeColumns - Columns to be included in the mod checking, per property
anyUninitializedProperties - Does the entity currently hold any uninitialized property values?
session - The session from which the dirty check request originated.
Returns:
Array containing indices of the modified properties, or null if no properties considered modified.


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.