public abstract class

AbstractEntityTuplizer

extends Object
implements EntityTuplizer
java.lang.Object
   ↳ org.hibernate.tuple.entity.AbstractEntityTuplizer
Known Direct Subclasses

Class Overview

Support for tuplizers relating to entities.

Summary

Fields
protected final Getter[] getters
protected final boolean hasCustomAccessors
protected final int propertySpan
protected final Setter[] setters
Public Constructors
AbstractEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappingInfo)
Constructs a new AbstractEntityTuplizer instance.
Public Methods
void afterInitialize(Object entity, boolean lazyPropertiesAreUnfetched, SessionImplementor session)
Called just after the entities properties have been initialized.
final Object createProxy(Serializable id, SessionImplementor session)
Generates an appropriate proxy representation of this entity for this entity-mode.
Getter getGetter(int i)
Retrieve the getter for the specified property.
Serializable getIdentifier(Object entity, SessionImplementor session)
Extract the identifier value from the given entity.
Serializable getIdentifier(Object entity)
Extract the identifier value from the given entity.
Getter getIdentifierGetter()
Retrieve the getter for the identifier property.
Type getIdentifierMapperType()
Object getPropertyValue(Object entity, String propertyPath)
Extract the value of a particular property from the given entity.
Object getPropertyValue(Object entity, int i)
Extract the value of a particular property from the given entity.
Object[] getPropertyValues(Object entity)
Extract the current values contained on the given entity.
Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session)
Extract the values of the insertable properties of the entity (including backrefs)
Object getVersion(Object entity)
Extract the value of the version property from the given entity.
Getter getVersionGetter()
Retrieve the getter for the version property.
boolean hasProxy()
Does this entity, for this mode, present a possibility for proxying?
boolean hasUninitializedLazyProperties(Object entity)
Does the given entity instance have any currently uninitialized lazy properties?
final Object instantiate()
Generate a new, empty entity.
final Object instantiate(Serializable id, SessionImplementor session)
Create an entity instance initialized with the given identifier.
final Object instantiate(Serializable id)
Create an entity instance initialized with the given identifier.
final boolean isInstance(Object object)
Is the given object considered an instance of the the entity (acconting for entity-mode) managed by this tuplizer.
boolean isLifecycleImplementor()
Does the class managed by this tuplizer implement the Lifecycle interface.
boolean isValidatableImplementor()
Does the class managed by this tuplizer implement the Validatable interface.
void resetIdentifier(Object entity, Serializable currentId, Object currentVersion)
Inject the given identifier and version into the entity, in order to "roll back" to their original values.
void resetIdentifier(Object entity, Serializable currentId, Object currentVersion, SessionImplementor session)
Inject the given identifier and version into the entity, in order to "roll back" to their original values.
void setIdentifier(Object entity, Serializable id)
Inject the identifier value into the given entity.
void setIdentifier(Object entity, Serializable id, SessionImplementor session)
Inject the identifier value into the given entity.
void setPropertyValue(Object entity, int i, Object value)
Inject the value of a particular property.
void setPropertyValue(Object entity, String propertyName, Object value)
Inject the value of a particular property.
void setPropertyValues(Object entity, Object[] values)
Inject the given values into the given entity.
String toString()
Protected Methods
abstract Instantiator buildInstantiator(PersistentClass mappingInfo)
Build an appropriate Instantiator for the given mapped entity.
abstract Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity)
Build an appropriate Getter for the given property.
abstract Setter buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity)
Build an appropriate Setter for the given property.
abstract ProxyFactory buildProxyFactory(PersistentClass mappingInfo, Getter idGetter, Setter idSetter)
Build an appropriate ProxyFactory for the given mapped entity.
Object getComponentValue(ComponentType type, Object component, String propertyPath)
Extract a component property value.
final EntityMetamodel getEntityMetamodel()
String getEntityName()
Retreives the defined entity-name for the tuplized entity.
final SessionFactoryImplementor getFactory()
final Instantiator getInstantiator()
final ProxyFactory getProxyFactory()
Set getSubclassEntityNames()
Retrieves the defined entity-names for any subclasses defined for this entity.
boolean shouldGetAllProperties(Object entity)
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.hibernate.tuple.Tuplizer
From interface org.hibernate.tuple.entity.EntityTuplizer

Fields

protected final Getter[] getters

protected final boolean hasCustomAccessors

protected final int propertySpan

protected final Setter[] setters

Public Constructors

public AbstractEntityTuplizer (EntityMetamodel entityMetamodel, PersistentClass mappingInfo)

Constructs a new AbstractEntityTuplizer instance.

Parameters
entityMetamodel The "interpreted" information relating to the mapped entity.
mappingInfo The parsed "raw" mapping data relating to the given entity.

Public Methods

public void afterInitialize (Object entity, boolean lazyPropertiesAreUnfetched, SessionImplementor session)

Called just after the entities properties have been initialized.

Parameters
entity The entity being initialized.
lazyPropertiesAreUnfetched Are defined lazy properties currently unfecthed
session The session initializing this entity.

public final Object createProxy (Serializable id, SessionImplementor session)

Generates an appropriate proxy representation of this entity for this entity-mode.

Parameters
id The id of the instance for which to generate a proxy.
session The session to which the proxy should be bound.
Returns
  • The generate proxies.

public Getter getGetter (int i)

Retrieve the getter for the specified property.

Parameters
i The property index.
Returns
  • The property getter.

public Serializable getIdentifier (Object entity, SessionImplementor session)

Extract the identifier value from the given entity.

Parameters
entity The entity from which to extract the identifier value.
session The session from which is requests originates
Returns
  • The identifier value.

public Serializable getIdentifier (Object entity)

Extract the identifier value from the given entity.

Parameters
entity The entity from which to extract the identifier value.
Returns
  • The identifier value.

public Getter getIdentifierGetter ()

Retrieve the getter for the identifier property. May return null.

Returns
  • The getter for the identifier property.

public Type getIdentifierMapperType ()

public Object getPropertyValue (Object entity, String propertyPath)

Extract the value of a particular property from the given entity.

Parameters
entity The entity from which to extract the property value.
propertyPath The name of the property for which to extract the value.
Returns
  • The current value of the given property on the given entity.

public Object getPropertyValue (Object entity, int i)

Extract the value of a particular property from the given entity.

Parameters
entity The entity from which to extract the property value.
i The index of the property for which to extract the value.
Returns
  • The current value of the given property on the given entity.

public Object[] getPropertyValues (Object entity)

Extract the current values contained on the given entity.

Parameters
entity The entity from which to extract values.
Returns
  • The current property values.

public Object[] getPropertyValuesToInsert (Object entity, Map mergeMap, SessionImplementor session)

Extract the values of the insertable properties of the entity (including backrefs)

Parameters
entity The entity from which to extract.
mergeMap a map of instances being merged to merged instances
session The session in which the resuest is being made.
Returns
  • The insertable property values.

public Object getVersion (Object entity)

Extract the value of the version property from the given entity.

Parameters
entity The entity from which to extract the version value.
Returns
  • The value of the version property, or null if not versioned.

public Getter getVersionGetter ()

Retrieve the getter for the version property. May return null.

Returns
  • The getter for the version property.

public boolean hasProxy ()

Does this entity, for this mode, present a possibility for proxying?

Returns
  • True if this tuplizer can generate proxies for this entity.

public boolean hasUninitializedLazyProperties (Object entity)

Does the given entity instance have any currently uninitialized lazy properties?

Parameters
entity The entity to be check for uninitialized lazy properties.
Returns
  • True if uninitialized lazy properties were found; false otherwise.

public final Object instantiate ()

Generate a new, empty entity.

Returns
  • The new, empty entity instance.

public final Object instantiate (Serializable id, SessionImplementor session)

Create an entity instance initialized with the given identifier.

Parameters
id The identifier value for the entity to be instantiated.
session The session from which is requests originates
Returns
  • The instantiated entity.

public final Object instantiate (Serializable id)

Create an entity instance initialized with the given identifier.

Parameters
id The identifier value for the entity to be instantiated.
Returns
  • The instantiated entity.

public final boolean isInstance (Object object)

Is the given object considered an instance of the the entity (acconting for entity-mode) managed by this tuplizer.

Parameters
object The object to be checked.
Returns
  • True if the object is considered as an instance of this entity within the given mode.

public boolean isLifecycleImplementor ()

Does the class managed by this tuplizer implement the Lifecycle interface.

Returns
  • True if the Lifecycle interface is implemented; false otherwise.

public boolean isValidatableImplementor ()

Does the class managed by this tuplizer implement the Validatable interface.

Returns
  • True if the Validatable interface is implemented; false otherwise.

public void resetIdentifier (Object entity, Serializable currentId, Object currentVersion)

Inject the given identifier and version into the entity, in order to "roll back" to their original values.

Parameters
entity The entity for which to reset the id/version values
currentId The identifier value to inject into the entity.
currentVersion The version value to inject into the entity.

public void resetIdentifier (Object entity, Serializable currentId, Object currentVersion, SessionImplementor session)

Inject the given identifier and version into the entity, in order to "roll back" to their original values.

Parameters
entity The entity for which to reset the id/version values
currentId The identifier value to inject into the entity.
currentVersion The version value to inject into the entity.
session The session from which the request originated

public void setIdentifier (Object entity, Serializable id)

Inject the identifier value into the given entity.

Has no effect if the entity does not define an identifier property

Parameters
entity The entity to inject with the identifier value.
id The value to be injected as the identifier.

public void setIdentifier (Object entity, Serializable id, SessionImplementor session)

Inject the identifier value into the given entity.

Has no effect if the entity does not define an identifier property

Parameters
entity The entity to inject with the identifier value.
id The value to be injected as the identifier.
session The session from which is requests originates

public void setPropertyValue (Object entity, int i, Object value)

Inject the value of a particular property.

Parameters
entity The entity into which to inject the value.
i The property's index.
value The property value to inject.

public void setPropertyValue (Object entity, String propertyName, Object value)

Inject the value of a particular property.

Parameters
entity The entity into which to inject the value.
propertyName The name of the property.
value The property value to inject.

public void setPropertyValues (Object entity, Object[] values)

Inject the given values into the given entity.

Parameters
entity The entity.
values The values to be injected.

public String toString ()

Protected Methods

protected abstract Instantiator buildInstantiator (PersistentClass mappingInfo)

Build an appropriate Instantiator for the given mapped entity.

Parameters
mappingInfo The mapping information regarding the mapped entity.
Returns
  • An appropriate Instantiator instance.

protected abstract Getter buildPropertyGetter (Property mappedProperty, PersistentClass mappedEntity)

Build an appropriate Getter for the given property.

Parameters
mappedProperty The property to be accessed via the built Getter.
mappedEntity The entity information regarding the mapped entity owning this property.
Returns
  • An appropriate Getter instance.

protected abstract Setter buildPropertySetter (Property mappedProperty, PersistentClass mappedEntity)

Build an appropriate Setter for the given property.

Parameters
mappedProperty The property to be accessed via the built Setter.
mappedEntity The entity information regarding the mapped entity owning this property.
Returns
  • An appropriate Setter instance.

protected abstract ProxyFactory buildProxyFactory (PersistentClass mappingInfo, Getter idGetter, Setter idSetter)

Build an appropriate ProxyFactory for the given mapped entity.

Parameters
mappingInfo The mapping information regarding the mapped entity.
idGetter The constructed Getter relating to the entity's id property.
idSetter The constructed Setter relating to the entity's id property.
Returns
  • An appropriate ProxyFactory instance.

protected Object getComponentValue (ComponentType type, Object component, String propertyPath)

Extract a component property value.

Parameters
type The component property types.
component The component instance itself.
propertyPath The property path for the property to be extracted.
Returns
  • The property value extracted.

protected final EntityMetamodel getEntityMetamodel ()

protected String getEntityName ()

Retreives the defined entity-name for the tuplized entity.

Returns
  • The entity-name.

protected final SessionFactoryImplementor getFactory ()

protected final Instantiator getInstantiator ()

protected final ProxyFactory getProxyFactory ()

protected Set getSubclassEntityNames ()

Retrieves the defined entity-names for any subclasses defined for this entity.

Returns
  • Any subclass entity-names.

protected boolean shouldGetAllProperties (Object entity)