public class

TypeResolver

extends Object
implements Serializable
java.lang.Object
   ↳ org.hibernate.type.TypeResolver

Class Overview

Acts as the contract for getting types and as the mediator between BasicTypeRegistry and TypeFactory.

Summary

Public Constructors
TypeResolver()
TypeResolver(BasicTypeRegistry basicTypeRegistry, TypeFactory typeFactory)
Public Methods
BasicType basic(String name)
Locate a Hibernate basic type given (one of) its registration names; if scoped to a SessionFactoryImplementor, the scoped type is returned.
TypeFactory getTypeFactory()
Type heuristicType(String typeName, Properties parameters)
Uses heuristics to deduce the proper Type given a string naming the type or Java class.
Type heuristicType(String typeName)
void registerTypeOverride(BasicType type)
void registerTypeOverride(CompositeUserType type, String[] keys)
void registerTypeOverride(UserType type, String[] keys)
TypeResolver scope(SessionFactoryImplementor factory)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public TypeResolver ()

public TypeResolver (BasicTypeRegistry basicTypeRegistry, TypeFactory typeFactory)

Public Methods

public BasicType basic (String name)

Locate a Hibernate basic type given (one of) its registration names; if scoped to a SessionFactoryImplementor, the scoped type is returned.

Parameters
name The registration name
Returns
  • The registered type

public TypeFactory getTypeFactory ()

public Type heuristicType (String typeName, Properties parameters)

Uses heuristics to deduce the proper Type given a string naming the type or Java class.

The search goes as follows:

  1. search for a basic type with 'typeName' as a registration key
  2. look for 'typeName' as a class name and
    1. if it names a Type implementor, return an instance
    2. if it names a CompositeUserType or a UserType, return an instance of class wrapped intot the appropriate Type adapter
    3. if it implements Lifecycle, return the corresponding entity type
    4. if it implements Serializable, return the corresponding serializable type

Parameters
typeName The name (see heuristic algorithm above).
parameters Any parameters for the type. Only applied if built!
Returns
  • The deduced type; may be null.
Throws
MappingException Indicates a problem attempting to resolve 'typeName' as a Class

public Type heuristicType (String typeName)

Parameters
typeName The name (see heuristic algorithm discussion on heuristicType(String, Properties)).
Returns
  • The deduced type; may be null.

public void registerTypeOverride (BasicType type)

public void registerTypeOverride (CompositeUserType type, String[] keys)

public void registerTypeOverride (UserType type, String[] keys)

public TypeResolver scope (SessionFactoryImplementor factory)