public abstract class AbstractStandardBasicType<T> extends Object implements BasicType, StringRepresentableType<T>, XmlRepresentableType<T>
Constructor and Description |
---|
AbstractStandardBasicType(SqlTypeDescriptor sqlTypeDescriptor,
JavaTypeDescriptor<T> javaTypeDescriptor) |
Modifier and Type | Method and Description |
---|---|
Object |
assemble(Serializable cached,
SessionImplementor session,
Object owner)
Reconstruct the object from its cached "disassembled" state.
|
void |
beforeAssemble(Serializable cached,
SessionImplementor session)
Called before assembling a query result set from the query cache, to allow batch fetching
of entities missing from the second-level cache.
|
int |
compare(Object x,
Object y,
EntityMode entityMode)
Perform a
Comparator style comparison between values |
Object |
deepCopy(Object value,
EntityMode entityMode,
SessionFactoryImplementor factory)
Return a deep copy of the persistent state, stopping at entities and at
collections.
|
protected T |
deepCopy(T value) |
Serializable |
disassemble(Object value,
SessionImplementor session,
Object owner)
Return a cacheable "disassembled" representation of the object.
|
T |
fromString(String string) |
T |
fromStringValue(String xml)
Consume the given string representation back into this types java form.
|
Object |
fromXMLNode(org.dom4j.Node xml,
Mapping factory)
Parse the XML representation of an instance.
|
T |
fromXMLString(String xml,
Mapping factory) |
Object |
get(ResultSet rs,
String name,
SessionImplementor session) |
int |
getColumnSpan(Mapping mapping)
How many columns are used to persist this type.
|
protected int |
getHashCode(Object x) |
int |
getHashCode(Object x,
EntityMode entityMode)
Get a hash code, consistent with persistence "equality".
|
int |
getHashCode(Object x,
EntityMode entityMode,
SessionFactoryImplementor factory)
Get a hash code, consistent with persistence "equality".
|
JavaTypeDescriptor<T> |
getJavaTypeDescriptor() |
protected MutabilityPlan<T> |
getMutabilityPlan() |
String[] |
getRegistrationKeys()
Get the names under which this type should be registered in the type registry.
|
protected T |
getReplacement(T original,
T target) |
Class |
getReturnedClass()
The class returned by
Type.nullSafeGet(java.sql.ResultSet, java.lang.String[], org.hibernate.engine.SessionImplementor, java.lang.Object) methods. |
Type |
getSemiResolvedType(SessionFactoryImplementor factory)
Get the type of a semi-resolved value.
|
SqlTypeDescriptor |
getSqlTypeDescriptor() |
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 |
isAnyType()
Return true if the implementation is castable to
AnyType . |
boolean |
isAssociationType()
Return true if the implementation is castable to
AssociationType . |
boolean |
isCollectionType()
Return true if the implementation is castable to
CollectionType . |
boolean |
isComponentType()
Return true if the implementation is castable to
CompositeType . |
protected boolean |
isDirty(Object old,
Object current) |
boolean |
isDirty(Object old,
Object current,
boolean[] checkable,
SessionImplementor session)
Should the parent be considered dirty, given both the old and current value?
|
boolean |
isDirty(Object old,
Object current,
SessionImplementor session)
Should the parent be considered dirty, given both the old and current value?
|
boolean |
isEntityType()
Return true if the implementation is castable to
EntityType . |
boolean |
isEqual(Object x,
Object y,
EntityMode entityMode)
Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent
state).
|
boolean |
isEqual(Object x,
Object y,
EntityMode entityMode,
SessionFactoryImplementor factory)
Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent
state).
|
boolean |
isEqual(T one,
T another) |
boolean |
isModified(Object oldHydratedState,
Object currentState,
boolean[] checkable,
SessionImplementor session)
Has the value been modified compared to the current database state? The difference between this
and the
Type.isDirty(java.lang.Object, java.lang.Object, org.hibernate.engine.SessionImplementor) methods is that here we need to account for "partially" built values. |
boolean |
isMutable()
Are objects of this type mutable.
|
protected boolean |
isSame(Object x,
Object y) |
boolean |
isSame(Object x,
Object y,
EntityMode entityMode)
Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent
state) taking a shortcut for entity references.
|
boolean |
isXMLElement() |
Object |
nullSafeGet(ResultSet rs,
String[] names,
SessionImplementor session,
Object owner)
Retrieve an instance of the mapped class from a JDBC resultset.
|
T |
nullSafeGet(ResultSet rs,
String name,
SessionImplementor session) |
Object |
nullSafeGet(ResultSet rs,
String name,
SessionImplementor session,
Object owner)
Retrieve an instance of the mapped class from a JDBC resultset.
|
protected T |
nullSafeGet(ResultSet rs,
String name,
WrapperOptions options) |
void |
nullSafeSet(PreparedStatement st,
Object value,
int index,
SessionImplementor session)
Write an instance of the mapped class to a prepared statement.
|
protected void |
nullSafeSet(PreparedStatement st,
Object value,
int index,
WrapperOptions options) |
protected boolean |
registerUnderJavaType() |
Object |
replace(Object original,
Object target,
SessionImplementor session,
Object owner,
Map copyCache)
During merge, replace the existing (target) value in the entity we are merging to
with a new (original) value from the detached entity we are merging.
|
Object |
replace(Object original,
Object target,
SessionImplementor session,
Object owner,
Map copyCache,
ForeignKeyDirection foreignKeyDirection)
During merge, replace the existing (target) value in the entity we are merging to
with a new (original) value from the detached entity we are merging.
|
Object |
resolve(Object value,
SessionImplementor session,
Object owner)
Map identifiers to entities or collections.
|
Object |
semiResolve(Object value,
SessionImplementor session,
Object owner)
Given a hydrated, but unresolved value, return a value that may be used to
reconstruct property-ref associations.
|
void |
set(PreparedStatement st,
T value,
int index,
SessionImplementor session) |
void |
setToXMLNode(org.dom4j.Node node,
Object value,
SessionFactoryImplementor factory)
A representation of the value to be embedded in an XML element.
|
int[] |
sqlTypes(Mapping mapping)
Return the JDBC types codes (per
Types ) for the columns mapped by this type. |
boolean[] |
toColumnNullness(Object value,
Mapping mapping)
Given an instance of the type, return an array of boolean, indicating
which mapped columns would be null.
|
String |
toLoggableString(Object value,
SessionFactoryImplementor factory)
A representation of the value to be embedded in a log file.
|
String |
toString(T value)
Render the value to the string representation.
|
String |
toXMLString(T value,
SessionFactoryImplementor factory) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName, nullSafeSet
public AbstractStandardBasicType(SqlTypeDescriptor sqlTypeDescriptor, JavaTypeDescriptor<T> javaTypeDescriptor)
public String toString(T value)
StringRepresentableType
toString
in interface StringRepresentableType<T>
value
- The value to render to string.public T fromStringValue(String xml) throws HibernateException
StringRepresentableType
fromStringValue
in interface StringRepresentableType<T>
xml
- The string representation to be consumed.HibernateException
- Problem consumingpublic String toXMLString(T value, SessionFactoryImplementor factory) throws HibernateException
toXMLString
in interface XmlRepresentableType<T>
HibernateException
public T fromXMLString(String xml, Mapping factory) throws HibernateException
fromXMLString
in interface XmlRepresentableType<T>
HibernateException
protected MutabilityPlan<T> getMutabilityPlan()
public boolean[] toColumnNullness(Object value, Mapping mapping)
Type
toColumnNullness
in interface Type
value
- an instance of the typepublic String[] getRegistrationKeys()
BasicType
getRegistrationKeys
in interface BasicType
protected boolean registerUnderJavaType()
public final JavaTypeDescriptor<T> getJavaTypeDescriptor()
public final SqlTypeDescriptor getSqlTypeDescriptor()
public final Class getReturnedClass()
Type
Type.nullSafeGet(java.sql.ResultSet, java.lang.String[], org.hibernate.engine.SessionImplementor, java.lang.Object)
methods. This is used to establish the class of an array of
this type.getReturnedClass
in interface Type
public final int[] sqlTypes(Mapping mapping) throws MappingException
Type
Types
) for the columns mapped by this type.sqlTypes
in interface Type
mapping
- The mapping object :/MappingException
- Generally indicates an issue accessing the passed mapping object.public final int getColumnSpan(Mapping mapping) throws MappingException
Type
sqlTypes(mapping).length
getColumnSpan
in interface Type
mapping
- The mapping object :/MappingException
- Generally indicates an issue accessing the passed mapping object.public final boolean isAssociationType()
Type
AssociationType
. This does not necessarily imply that
the type actually represents an association. Essentially a polymorphic version of
(type instanceof AssociationType.class)
isAssociationType
in interface Type
AssociationType
implementor; false otherwise.public final boolean isCollectionType()
Type
CollectionType
. Essentially a polymorphic version of
(type instanceof CollectionType.class)
A CollectionType
is additionally an AssociationType
; so if this method returns true,
Type.isAssociationType()
should also return true.isCollectionType
in interface Type
CollectionType
implementor; false otherwise.public final boolean isComponentType()
Type
CompositeType
. Essentially a polymorphic
version of (type instanceof CompositeType.class)
. A component type may own collections or
associations and hence must provide certain extra functionality.isComponentType
in interface Type
CompositeType
implementor; false otherwise.public final boolean isEntityType()
Type
EntityType
. Essentially a polymorphic
version of (type instanceof EntityType.class)
.
An EntityType
is additionally an AssociationType
; so if this method returns true,
Type.isAssociationType()
should also return true.isEntityType
in interface Type
EntityType
implementor; false otherwise.public final boolean isAnyType()
Type
AnyType
. Essentially a polymorphic
version of (type instanceof AnyType.class)
.
An AnyType
is additionally an AssociationType
; so if this method returns true,
Type.isAssociationType()
should also return true.public final boolean isXMLElement()
isXMLElement
in interface Type
public final boolean isSame(Object x, Object y, EntityMode entityMode)
Type
#equals
check on the values. For associations the implication
is a bit different. For most types it is conceivable to simply delegate to Type.isEqual(java.lang.Object, java.lang.Object, org.hibernate.EntityMode)
public final boolean isEqual(Object x, Object y, EntityMode entityMode)
Type
public final boolean isEqual(Object x, Object y, EntityMode entityMode, SessionFactoryImplementor factory)
Type
public final int getHashCode(Object x, EntityMode entityMode)
Type
#hashCode
.getHashCode
in interface Type
x
- The value for which to retrieve a hash codeentityMode
- The entity mode of the value.public final int getHashCode(Object x, EntityMode entityMode, SessionFactoryImplementor factory)
Type
#hashCode
.getHashCode
in interface Type
x
- The value for which to retrieve a hash codeentityMode
- The entity mode of the value.factory
- The session factoryprotected final int getHashCode(Object x)
public final int compare(Object x, Object y, EntityMode entityMode)
Type
Comparator
style comparison between valuescompare
in interface Type
x
- The first valuey
- The second valueentityMode
- The entity mode of the values.Comparator.compare(T, T)
for a discussion.public final boolean isDirty(Object old, Object current, SessionImplementor session)
Type
public final boolean isDirty(Object old, Object current, boolean[] checkable, SessionImplementor session)
Type
public final boolean isModified(Object oldHydratedState, Object currentState, boolean[] checkable, SessionImplementor session)
Type
Type.isDirty(java.lang.Object, java.lang.Object, org.hibernate.engine.SessionImplementor)
methods is that here we need to account for "partially" built values. This is really
only an issue with association types. For most type implementations it is enough to simply delegate to
Type.isDirty(java.lang.Object, java.lang.Object, org.hibernate.engine.SessionImplementor)
here/isModified
in interface Type
oldHydratedState
- the database state, in a "hydrated" form, with identifiers unresolvedcurrentState
- the current state of the objectcheckable
- which columns are actually updatablesession
- The session from which the request originated.public final Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws SQLException
Type
nullSafeGet
in interface Type
names
- the column namesowner
- the parent entitySQLException
alternative, 2-phase property initialization
public final Object nullSafeGet(ResultSet rs, String name, SessionImplementor session, Object owner) throws SQLException
Type
nullSafeGet
in interface Type
name
- the column nameowner
- the parent entitySQLException
public final T nullSafeGet(ResultSet rs, String name, SessionImplementor session) throws SQLException
SQLException
protected final T nullSafeGet(ResultSet rs, String name, WrapperOptions options) throws SQLException
SQLException
public Object get(ResultSet rs, String name, SessionImplementor session) throws HibernateException, SQLException
HibernateException
SQLException
public final void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws SQLException
Type
nullSafeSet
in interface Type
value
- the object to writeindex
- statement parameter indexSQLException
protected final void nullSafeSet(PreparedStatement st, Object value, int index, WrapperOptions options) throws SQLException
SQLException
public void set(PreparedStatement st, T value, int index, SessionImplementor session) throws HibernateException, SQLException
HibernateException
SQLException
public final String toLoggableString(Object value, SessionFactoryImplementor factory)
Type
toLoggableString
in interface Type
public final void setToXMLNode(org.dom4j.Node node, Object value, SessionFactoryImplementor factory)
Type
setToXMLNode
in interface Type
public final Object fromXMLNode(org.dom4j.Node xml, Mapping factory)
Type
fromXMLNode
in interface Type
public final boolean isMutable()
Type
public final Object deepCopy(Object value, EntityMode entityMode, SessionFactoryImplementor factory)
Type
public final Serializable disassemble(Object value, SessionImplementor session, Object owner) throws HibernateException
Type
disassemble
in interface Type
value
- the value to cachesession
- the sessionowner
- optional parent entity object (needed for collections)HibernateException
public final Object assemble(Serializable cached, SessionImplementor session, Object owner) throws HibernateException
Type
assemble
in interface Type
cached
- the disassembled state from the cachesession
- the sessionowner
- the parent entity objectHibernateException
public final void beforeAssemble(Serializable cached, SessionImplementor session)
Type
beforeAssemble
in interface Type
public final Object hydrate(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException
Type
hydrate
in interface Type
names
- the column namessession
- the sessionowner
- the parent entityHibernateException
SQLException
Type.resolve(Object, SessionImplementor, Object)
public final Object resolve(Object value, SessionImplementor session, Object owner) throws HibernateException
Type
resolve
in interface Type
value
- an identifier or value returned by hydrate()session
- the sessionowner
- the parent entityHibernateException
Type.hydrate(ResultSet, String[], SessionImplementor, Object)
public final Object semiResolve(Object value, SessionImplementor session, Object owner) throws HibernateException
Type
semiResolve
in interface Type
HibernateException
public final Type getSemiResolvedType(SessionFactoryImplementor factory)
Type
getSemiResolvedType
in interface Type
public final Object replace(Object original, Object target, SessionImplementor session, Object owner, Map copyCache)
Type
public Object replace(Object original, Object target, SessionImplementor session, Object owner, Map copyCache, ForeignKeyDirection foreignKeyDirection)
Type
Copyright © 2002-2015 Red Hat Middleware, LLC. All Rights Reserved