org.hibernate.tuple.entity
Class PojoEntityTuplizer

java.lang.Object
  extended by org.hibernate.tuple.entity.AbstractEntityTuplizer
      extended by org.hibernate.tuple.entity.PojoEntityTuplizer
All Implemented Interfaces:
EntityTuplizer, Tuplizer

public class PojoEntityTuplizer
extends AbstractEntityTuplizer

An EntityTuplizer specific to the pojo entity mode.

Author:
Steve Ebersole, Gavin King

Field Summary
 
Fields inherited from class org.hibernate.tuple.entity.AbstractEntityTuplizer
getters, hasCustomAccessors, propertySpan, setters
 
Constructor Summary
PojoEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity)
           
 
Method Summary
 void afterInitialize(Object entity, boolean lazyPropertiesAreUnfetched, SessionImplementor session)
          Called just after the entities properties have been initialized.
protected  Instantiator buildInstantiator(PersistentClass persistentClass)
          Build an appropriate Instantiator for the given mapped entity.
protected  Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity)
          Build an appropriate Getter for the given property.
protected  Setter buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity)
          Build an appropriate Setter for the given property.
protected  ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter)
          Build an appropriate ProxyFactory for the given mapped entity.
protected  ProxyFactory buildProxyFactoryInternal(PersistentClass persistentClass, Getter idGetter, Setter idSetter)
           
 Class getConcreteProxyClass()
          Returns the java class to which generated proxies will be typed.
 EntityMode getEntityMode()
          Return the entity-mode handled by this tuplizer instance.
 Class getMappedClass()
          Return the pojo class managed by this tuplizer.
 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)
protected  Object[] getPropertyValuesWithOptimizer(Object object)
           
 boolean hasUninitializedLazyProperties(Object entity)
          Does the given entity instance have any currently uninitialized lazy properties?
 boolean isInstrumented()
          Is it an instrumented POJO?
 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 setPropertyValues(Object entity, Object[] values)
          Inject the given values into the given entity.
protected  void setPropertyValuesWithOptimizer(Object object, Object[] values)
           
 
Methods inherited from class org.hibernate.tuple.entity.AbstractEntityTuplizer
createProxy, getComponentValue, getEntityMetamodel, getEntityName, getFactory, getIdentifier, getInstantiator, getPropertyValue, getPropertyValue, getProxyFactory, getSubclassEntityNames, getVersion, hasProxy, instantiate, instantiate, isInstance, resetIdentifier, setIdentifier, setPropertyValue, setPropertyValue, shouldGetAllProperties, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PojoEntityTuplizer

public PojoEntityTuplizer(EntityMetamodel entityMetamodel,
                          PersistentClass mappedEntity)
Method Detail

buildProxyFactory

protected ProxyFactory buildProxyFactory(PersistentClass persistentClass,
                                         Getter idGetter,
                                         Setter idSetter)
Description copied from class: AbstractEntityTuplizer
Build an appropriate ProxyFactory for the given mapped entity.

Specified by:
buildProxyFactory in class AbstractEntityTuplizer
Parameters:
persistentClass - 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.

buildProxyFactoryInternal

protected ProxyFactory buildProxyFactoryInternal(PersistentClass persistentClass,
                                                 Getter idGetter,
                                                 Setter idSetter)

buildInstantiator

protected Instantiator buildInstantiator(PersistentClass persistentClass)
Description copied from class: AbstractEntityTuplizer
Build an appropriate Instantiator for the given mapped entity.

Specified by:
buildInstantiator in class AbstractEntityTuplizer
Parameters:
persistentClass - The mapping information regarding the mapped entity.
Returns:
An appropriate Instantiator instance.

setPropertyValues

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

Specified by:
setPropertyValues in interface Tuplizer
Overrides:
setPropertyValues in class AbstractEntityTuplizer
Parameters:
entity - The entity.
values - The values to be injected.
Throws:
HibernateException

getPropertyValues

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

Specified by:
getPropertyValues in interface Tuplizer
Overrides:
getPropertyValues in class AbstractEntityTuplizer
Parameters:
entity - The entity from which to extract values.
Returns:
The current property values.
Throws:
HibernateException

getPropertyValuesToInsert

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

Specified by:
getPropertyValuesToInsert in interface EntityTuplizer
Overrides:
getPropertyValuesToInsert in class AbstractEntityTuplizer
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.
Throws:
HibernateException

setPropertyValuesWithOptimizer

protected void setPropertyValuesWithOptimizer(Object object,
                                              Object[] values)

getPropertyValuesWithOptimizer

protected Object[] getPropertyValuesWithOptimizer(Object object)

getEntityMode

public EntityMode getEntityMode()
Description copied from class: AbstractEntityTuplizer
Return the entity-mode handled by this tuplizer instance.

Specified by:
getEntityMode in class AbstractEntityTuplizer
Returns:
The entity-mode

getMappedClass

public Class getMappedClass()
Description copied from interface: Tuplizer
Return the pojo class managed by this tuplizer.

Need to determine how to best handle this for the Tuplizers for EntityModes other than POJO.

todo : be really nice to not have this here since it is essentially pojo specific...

Returns:
The persistent class.

isLifecycleImplementor

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

Specified by:
isLifecycleImplementor in interface EntityTuplizer
Overrides:
isLifecycleImplementor in class AbstractEntityTuplizer
Returns:
True if the Lifecycle interface is implemented; false otherwise.

isValidatableImplementor

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

Specified by:
isValidatableImplementor in interface EntityTuplizer
Overrides:
isValidatableImplementor in class AbstractEntityTuplizer
Returns:
True if the Validatable interface is implemented; false otherwise.

buildPropertyGetter

protected Getter buildPropertyGetter(Property mappedProperty,
                                     PersistentClass mappedEntity)
Description copied from class: AbstractEntityTuplizer
Build an appropriate Getter for the given property.

Specified by:
buildPropertyGetter in class AbstractEntityTuplizer
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.

buildPropertySetter

protected Setter buildPropertySetter(Property mappedProperty,
                                     PersistentClass mappedEntity)
Description copied from class: AbstractEntityTuplizer
Build an appropriate Setter for the given property.

Specified by:
buildPropertySetter in class AbstractEntityTuplizer
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.

getConcreteProxyClass

public Class getConcreteProxyClass()
Description copied from interface: EntityTuplizer
Returns the java class to which generated proxies will be typed.

Returns:
The java class to which generated proxies will be typed

afterInitialize

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

Specified by:
afterInitialize in interface EntityTuplizer
Overrides:
afterInitialize in class AbstractEntityTuplizer
Parameters:
entity - The entity being initialized.
lazyPropertiesAreUnfetched - Are defined lazy properties currently unfecthed
session - The session initializing this entity.

hasUninitializedLazyProperties

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

Specified by:
hasUninitializedLazyProperties in interface EntityTuplizer
Overrides:
hasUninitializedLazyProperties in class AbstractEntityTuplizer
Parameters:
entity - The entity to be check for uninitialized lazy properties.
Returns:
True if uninitialized lazy properties were found; false otherwise.

isInstrumented

public boolean isInstrumented()
Description copied from interface: EntityTuplizer
Is it an instrumented POJO?