public class PojoEntityTuplizer extends AbstractEntityTuplizer
An EntityTuplizer specific to the pojo entity mode.
getters, hasCustomAccessors, propertySpan, setters| Constructor and Description |
|---|
PojoEntityTuplizer(EntityMetamodel entityMetamodel,
PersistentClass mappedEntity) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterInitialize(Object entity,
SharedSessionContractImplementor session)
Called just after the entities properties have been initialized.
|
protected Instantiator |
buildInstantiator(EntityMetamodel entityMetamodel,
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) |
String |
determineConcreteSubclassEntityName(Object entityInstance,
SessionFactoryImplementor factory)
Given an entity instance, determine the most appropriate (most targeted) entity-name which represents it.
|
Class |
getConcreteProxyClass()
Returns the java class to which generated proxies will be typed.
|
EntityMode |
getEntityMode()
Return the entity-mode handled by this tuplizer instance.
|
EntityNameResolver[] |
getEntityNameResolvers()
Get any
EntityNameResolvers associated with this Tuplizer. |
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,
SharedSessionContractImplementor session)
Extract the values of the insertable properties of the entity (including backrefs)
|
protected Object[] |
getPropertyValuesWithOptimizer(Object object) |
boolean |
isLifecycleImplementor()
|
void |
setPropertyValues(Object entity,
Object[] values)
Inject the given values into the given entity.
|
protected void |
setPropertyValuesWithOptimizer(Object object,
Object[] values) |
createProxy, getComponentValue, getEntityMetamodel, getEntityName, getFactory, getGetter, getIdentifier, getIdentifier, getIdentifierGetter, getIdentifierMapperType, getInstantiator, getPropertyValue, getPropertyValue, getProxyFactory, getSubclassEntityNames, getVersion, getVersionGetter, hasProxy, instantiate, instantiate, instantiate, isInstance, resetIdentifier, resetIdentifier, setIdentifier, setIdentifier, setPropertyValue, setPropertyValue, shouldGetAllProperties, toStringpublic PojoEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity)
protected ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter)
AbstractEntityTuplizerBuild an appropriate ProxyFactory for the given mapped entity.
buildProxyFactory in class AbstractEntityTuplizerpersistentClass - 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.protected ProxyFactory buildProxyFactoryInternal(PersistentClass persistentClass, Getter idGetter, Setter idSetter)
protected Instantiator buildInstantiator(EntityMetamodel entityMetamodel, PersistentClass persistentClass)
AbstractEntityTuplizerBuild an appropriate Instantiator for the given mapped entity.
buildInstantiator in class AbstractEntityTuplizerpersistentClass - The mapping information regarding the mapped entity.public void setPropertyValues(Object entity, Object[] values) throws HibernateException
TuplizerInject the given values into the given entity.
setPropertyValues in interface TuplizersetPropertyValues in class AbstractEntityTuplizerentity - The entity.values - The values to be injected.HibernateExceptionpublic Object[] getPropertyValues(Object entity) throws HibernateException
TuplizerExtract the current values contained on the given entity.
getPropertyValues in interface TuplizergetPropertyValues in class AbstractEntityTuplizerentity - The entity from which to extract values.HibernateExceptionpublic Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SharedSessionContractImplementor session)
EntityTuplizerExtract the values of the insertable properties of the entity (including backrefs)
getPropertyValuesToInsert in interface EntityTuplizergetPropertyValuesToInsert in class AbstractEntityTuplizerentity - The entity from which to extract.mergeMap - a map of instances being merged to merged instancessession - The session in which the resuest is being made.protected void setPropertyValuesWithOptimizer(Object object, Object[] values)
public EntityMode getEntityMode()
EntityTuplizerReturn the entity-mode handled by this tuplizer instance.
public Class getMappedClass()
TuplizerReturn the pojo class managed by this tuplizer. </p> Need to determine how to best handle this for the Tuplizers for EntityModes other than POJO. </p> todo : be really nice to not have this here since it is essentially pojo specific…
public boolean isLifecycleImplementor()
EntityTuplizerisLifecycleImplementor in interface EntityTuplizerisLifecycleImplementor in class AbstractEntityTuplizerprotected Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity)
AbstractEntityTuplizerBuild an appropriate Getter for the given property.
buildPropertyGetter in class AbstractEntityTuplizermappedProperty - The property to be accessed via the built Getter.mappedEntity - The entity information regarding the mapped entity owning this property.protected Setter buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity)
AbstractEntityTuplizerBuild an appropriate Setter for the given property.
buildPropertySetter in class AbstractEntityTuplizermappedProperty - The property to be accessed via the built Setter.mappedEntity - The entity information regarding the mapped entity owning this property.public Class getConcreteProxyClass()
EntityTuplizerReturns the java class to which generated proxies will be typed.
<p/>
todo : look at fully encapsulating PersistenceContext.narrowProxy(java.lang.Object, org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.EntityKey, java.lang.Object) here,
since that is the only external use of this method
public void afterInitialize(Object entity, SharedSessionContractImplementor session)
EntityTuplizerCalled just after the entities properties have been initialized.
afterInitialize in interface EntityTuplizerafterInitialize in class AbstractEntityTuplizerentity - The entity being initialized.session - The session initializing this entity.public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory)
EntityTuplizerGiven an entity instance, determine the most appropriate (most targeted) entity-name which represents it. This is called in situations where we already know an entity name for the given entityInstance; we are being asked to determine if there is a more appropriate entity-name to use, specifically within an inheritence hierarchy. <p/> For example, consider a case where a user calls <tt>session.update( "Animal", cat );</tt>. Here, the user has explicitly provided <tt>Animal</tt> as the entity-name. However, they have passed in an instance of <tt>Cat</tt> which is a subclass of <tt>Animal</tt>. In this case, we would return <tt>Cat</tt> as the entity-name. <p/> <tt>null</tt> may be returned from calls to this method. The meaining of <tt>null</tt> in that case is assumed to be that we should use whatever explicit entity-name the user provided (<tt>Animal</tt> rather than <tt>Cat</tt> in the example above).
entityInstance - The entity instance.factory - Reference to the SessionFactory.public EntityNameResolver[] getEntityNameResolvers()
EntityTuplizerGet any EntityNameResolvers associated with this Tuplizer.
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.