Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.hibernate.tuple
Class AbstractEntityTuplizer  view AbstractEntityTuplizer download AbstractEntityTuplizer.java

java.lang.Object
  extended byorg.hibernate.tuple.AbstractEntityTuplizer
All Implemented Interfaces:
EntityTuplizer, Tuplizer
Direct Known Subclasses:
Dom4jEntityTuplizer, DynamicMapEntityTuplizer, PojoEntityTuplizer

public abstract class AbstractEntityTuplizer
extends java.lang.Object
implements EntityTuplizer

Support base class for EntityTuplizer implementations.


Field Summary
private  EntityMetamodel entityMetamodel
           
protected  org.hibernate.property.Getter[] getters
           
protected  boolean hasCustomAccessors
           
private  org.hibernate.type.AbstractComponentType identifierMapperType
           
private  org.hibernate.property.Getter idGetter
           
private  org.hibernate.property.Setter idSetter
           
private  Instantiator instantiator
           
protected  int propertySpan
           
private  org.hibernate.proxy.ProxyFactory proxyFactory
           
protected  org.hibernate.property.Setter[] setters
           
 
Constructor Summary
AbstractEntityTuplizer(EntityMetamodel entityMetamodel, org.hibernate.mapping.PersistentClass mappingInfo)
          Constructs a new AbstractEntityTuplizer instance.
 
Method Summary
 void afterInitialize(java.lang.Object entity, boolean lazyPropertiesAreUnfetched, org.hibernate.engine.SessionImplementor session)
          Called just after the entities properties have been initialized.
protected abstract  Instantiator buildInstantiator(org.hibernate.mapping.PersistentClass mappingInfo)
          Build an appropriate Instantiator for the given mapped entity.
protected abstract  org.hibernate.property.Getter buildPropertyGetter(org.hibernate.mapping.Property mappedProperty, org.hibernate.mapping.PersistentClass mappedEntity)
          Build an appropriate Getter for the given property.
protected abstract  org.hibernate.property.Setter buildPropertySetter(org.hibernate.mapping.Property mappedProperty, org.hibernate.mapping.PersistentClass mappedEntity)
          Build an appropriate Setter for the given property.
protected abstract  org.hibernate.proxy.ProxyFactory buildProxyFactory(org.hibernate.mapping.PersistentClass mappingInfo, org.hibernate.property.Getter idGetter, org.hibernate.property.Setter idSetter)
          Build an appropriate ProxyFactory for the given mapped entity.
 java.lang.Object createProxy(java.io.Serializable id, org.hibernate.engine.SessionImplementor session)
          Generates an appropriate proxy representation of this entity for this entity-mode.
protected  java.lang.Object getComponentValue(org.hibernate.type.ComponentType type, java.lang.Object component, java.lang.String propertyPath)
          Extract a component property value.
protected  EntityMetamodel getEntityMetamodel()
           
protected abstract  org.hibernate.EntityMode getEntityMode()
          Return the entity-mode handled by this tuplizer instance.
protected  java.lang.String getEntityName()
          Retreives the defined entity-name for the tuplized entity.
protected  org.hibernate.engine.SessionFactoryImplementor getFactory()
           
 java.io.Serializable getIdentifier(java.lang.Object entity)
          Extract the identifier value from the given entity.
protected  Instantiator getInstantiator()
           
 java.lang.Object getPropertyValue(java.lang.Object entity, int i)
          Extract the value of a particular property from the given entity.
 java.lang.Object getPropertyValue(java.lang.Object entity, java.lang.String propertyPath)
          Extract the value of a particular property from the given entity.
 java.lang.Object[] getPropertyValues(java.lang.Object entity)
          Extract the current values contained on the given entity.
 java.lang.Object[] getPropertyValuesToInsert(java.lang.Object entity, java.util.Map mergeMap, org.hibernate.engine.SessionImplementor session)
          Extract the values of the insertable properties of the entity (including backrefs)
protected  org.hibernate.proxy.ProxyFactory getProxyFactory()
           
protected  java.util.Set getSubclassEntityNames()
          Retreives the defined entity-names for any subclasses defined for this entity.
 java.lang.Object getVersion(java.lang.Object entity)
          Extract the value of the version property from the given entity.
 boolean hasProxy()
          Does this entity, for this mode, present a possibility for proxying?
 boolean hasUninitializedLazyProperties(java.lang.Object entity)
          Does the given entity instance have any currently uninitialized lazy properties?
 java.lang.Object instantiate()
          Generate a new, empty entity.
 java.lang.Object instantiate(java.io.Serializable id)
          Create an entity instance initialized with the given identifier.
 boolean isInstance(java.lang.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 55 managed by this tuplizer implement the org.hibernate.classic.Lifecycle interface.
 boolean isValidatableImplementor()
          Does the class 55 managed by this tuplizer implement the org.hibernate.classic.Validatable interface.
 void resetIdentifier(java.lang.Object entity, java.io.Serializable currentId, java.lang.Object currentVersion)
          Inject the given identifier and version into the entity, in order to "roll back" to their original values.
 void setIdentifier(java.lang.Object entity, java.io.Serializable id)
          Inject the identifier value into the given entity.
 void setPropertyValue(java.lang.Object entity, int i, java.lang.Object value)
          Inject the value of a particular property.
 void setPropertyValue(java.lang.Object entity, java.lang.String propertyName, java.lang.Object value)
          Inject the value of a particular property.
 void setPropertyValues(java.lang.Object entity, java.lang.Object[] values)
          Inject the given values into the given entity.
protected  boolean shouldGetAllProperties(java.lang.Object entity)
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.hibernate.tuple.EntityTuplizer
getConcreteProxyClass, isInstrumented
 
Methods inherited from interface org.hibernate.tuple.Tuplizer
getMappedClass
 

Field Detail

entityMetamodel

private final EntityMetamodel entityMetamodel

idGetter

private final org.hibernate.property.Getter idGetter

idSetter

private final org.hibernate.property.Setter idSetter

getters

protected final org.hibernate.property.Getter[] getters

setters

protected final org.hibernate.property.Setter[] setters

propertySpan

protected final int propertySpan

hasCustomAccessors

protected final boolean hasCustomAccessors

instantiator

private final Instantiator instantiator

proxyFactory

private final org.hibernate.proxy.ProxyFactory proxyFactory

identifierMapperType

private final org.hibernate.type.AbstractComponentType identifierMapperType
Constructor Detail

AbstractEntityTuplizer

public AbstractEntityTuplizer(EntityMetamodel entityMetamodel,
                              org.hibernate.mapping.PersistentClass mappingInfo)
Constructs a new AbstractEntityTuplizer instance.

Method Detail

getEntityMode

protected abstract org.hibernate.EntityMode getEntityMode()
Return the entity-mode handled by this tuplizer instance.


buildPropertyGetter

protected abstract org.hibernate.property.Getter buildPropertyGetter(org.hibernate.mapping.Property mappedProperty,
                                                                     org.hibernate.mapping.PersistentClass mappedEntity)
Build an appropriate Getter for the given property.


buildPropertySetter

protected abstract org.hibernate.property.Setter buildPropertySetter(org.hibernate.mapping.Property mappedProperty,
                                                                     org.hibernate.mapping.PersistentClass mappedEntity)
Build an appropriate Setter for the given property.


buildInstantiator

protected abstract Instantiator buildInstantiator(org.hibernate.mapping.PersistentClass mappingInfo)
Build an appropriate Instantiator for the given mapped entity.


buildProxyFactory

protected abstract org.hibernate.proxy.ProxyFactory buildProxyFactory(org.hibernate.mapping.PersistentClass mappingInfo,
                                                                      org.hibernate.property.Getter idGetter,
                                                                      org.hibernate.property.Setter idSetter)
Build an appropriate ProxyFactory for the given mapped entity.


getEntityName

protected java.lang.String getEntityName()
Retreives the defined entity-name for the tuplized entity.


getSubclassEntityNames

protected java.util.Set getSubclassEntityNames()
Retreives the defined entity-names for any subclasses defined for this entity.


getIdentifier

public java.io.Serializable getIdentifier(java.lang.Object entity)
                                   throws org.hibernate.HibernateException
Description copied from interface: EntityTuplizer
Extract the identifier value from the given entity.

Specified by:
getIdentifier in interface EntityTuplizer

setIdentifier

public void setIdentifier(java.lang.Object entity,
                          java.io.Serializable id)
                   throws org.hibernate.HibernateException
Description copied from interface: EntityTuplizer
Inject the identifier value into the given entity.

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

Specified by:
setIdentifier in interface EntityTuplizer

resetIdentifier

public void resetIdentifier(java.lang.Object entity,
                            java.io.Serializable currentId,
                            java.lang.Object currentVersion)
Description copied from interface: EntityTuplizer
Inject the given identifier and version into the entity, in order to "roll back" to their original values.

Specified by:
resetIdentifier in interface EntityTuplizer

getVersion

public java.lang.Object getVersion(java.lang.Object entity)
                            throws org.hibernate.HibernateException
Description copied from interface: EntityTuplizer
Extract the value of the version property from the given entity.

Specified by:
getVersion in interface EntityTuplizer

shouldGetAllProperties

protected boolean shouldGetAllProperties(java.lang.Object entity)

getPropertyValues

public java.lang.Object[] getPropertyValues(java.lang.Object entity)
                                     throws org.hibernate.HibernateException
Description copied from interface: Tuplizer
Extract the current values contained on the given entity.

Specified by:
getPropertyValues in interface Tuplizer

getPropertyValuesToInsert

public java.lang.Object[] getPropertyValuesToInsert(java.lang.Object entity,
                                                    java.util.Map mergeMap,
                                                    org.hibernate.engine.SessionImplementor session)
                                             throws org.hibernate.HibernateException
Description copied from interface: EntityTuplizer
Extract the values of the insertable properties of the entity (including backrefs)

Specified by:
getPropertyValuesToInsert in interface EntityTuplizer

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.Object entity,
                                         int i)
                                  throws org.hibernate.HibernateException
Description copied from interface: Tuplizer
Extract the value of a particular property from the given entity.

Specified by:
getPropertyValue in interface Tuplizer

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.Object entity,
                                         java.lang.String propertyPath)
                                  throws org.hibernate.HibernateException
Description copied from interface: EntityTuplizer
Extract the value of a particular property from the given entity.

Specified by:
getPropertyValue in interface EntityTuplizer

getComponentValue

protected java.lang.Object getComponentValue(org.hibernate.type.ComponentType type,
                                             java.lang.Object component,
                                             java.lang.String propertyPath)
Extract a component property value.


setPropertyValues

public void setPropertyValues(java.lang.Object entity,
                              java.lang.Object[] values)
                       throws org.hibernate.HibernateException
Description copied from interface: Tuplizer
Inject the given values into the given entity.

Specified by:
setPropertyValues in interface Tuplizer

setPropertyValue

public void setPropertyValue(java.lang.Object entity,
                             int i,
                             java.lang.Object value)
                      throws org.hibernate.HibernateException
Description copied from interface: EntityTuplizer
Inject the value of a particular property.

Specified by:
setPropertyValue in interface EntityTuplizer

setPropertyValue

public void setPropertyValue(java.lang.Object entity,
                             java.lang.String propertyName,
                             java.lang.Object value)
                      throws org.hibernate.HibernateException
Description copied from interface: EntityTuplizer
Inject the value of a particular property.

Specified by:
setPropertyValue in interface EntityTuplizer

instantiate

public final java.lang.Object instantiate(java.io.Serializable id)
                                   throws org.hibernate.HibernateException
Description copied from interface: EntityTuplizer
Create an entity instance initialized with the given identifier.

Specified by:
instantiate in interface EntityTuplizer

instantiate

public final java.lang.Object instantiate()
                                   throws org.hibernate.HibernateException
Description copied from interface: Tuplizer
Generate a new, empty entity.

Specified by:
instantiate in interface Tuplizer

afterInitialize

public void afterInitialize(java.lang.Object entity,
                            boolean lazyPropertiesAreUnfetched,
                            org.hibernate.engine.SessionImplementor session)
Description copied from interface: EntityTuplizer
Called just after the entities properties have been initialized.

Specified by:
afterInitialize in interface EntityTuplizer

hasUninitializedLazyProperties

public boolean hasUninitializedLazyProperties(java.lang.Object entity)
Description copied from interface: EntityTuplizer
Does the given entity instance have any currently uninitialized lazy properties?

Specified by:
hasUninitializedLazyProperties in interface EntityTuplizer

isInstance

public final boolean isInstance(java.lang.Object object)
Description copied from interface: Tuplizer
Is the given object considered an instance of the the entity (acconting for entity-mode) managed by this tuplizer.

Specified by:
isInstance in interface Tuplizer

hasProxy

public boolean hasProxy()
Description copied from interface: EntityTuplizer
Does this entity, for this mode, present a possibility for proxying?

Specified by:
hasProxy in interface EntityTuplizer

createProxy

public final java.lang.Object createProxy(java.io.Serializable id,
                                          org.hibernate.engine.SessionImplementor session)
                                   throws org.hibernate.HibernateException
Description copied from interface: EntityTuplizer
Generates an appropriate proxy representation of this entity for this entity-mode.

Specified by:
createProxy in interface EntityTuplizer

isLifecycleImplementor

public boolean isLifecycleImplementor()
Description copied from interface: EntityTuplizer
Does the class 55 managed by this tuplizer implement the org.hibernate.classic.Lifecycle interface.

Specified by:
isLifecycleImplementor in interface EntityTuplizer

isValidatableImplementor

public boolean isValidatableImplementor()
Description copied from interface: EntityTuplizer
Does the class 55 managed by this tuplizer implement the org.hibernate.classic.Validatable interface.

Specified by:
isValidatableImplementor in interface EntityTuplizer

getEntityMetamodel

protected final EntityMetamodel getEntityMetamodel()

getFactory

protected final org.hibernate.engine.SessionFactoryImplementor getFactory()

getInstantiator

protected final Instantiator getInstantiator()

getProxyFactory

protected final org.hibernate.proxy.ProxyFactory getProxyFactory()

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).