public abstract class AbstractEntityTuplizer extends Object implements EntityTuplizer
Support for tuplizers relating to entities.
| Modifier and Type | Field and Description |
|---|---|
protected Getter[] |
getters |
protected boolean |
hasCustomAccessors |
protected int |
propertySpan |
protected Setter[] |
setters |
| Constructor and Description |
|---|
AbstractEntityTuplizer(EntityMetamodel entityMetamodel,
PersistentClass mappingInfo)
Constructs a new AbstractEntityTuplizer instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterInitialize(Object entity,
SharedSessionContractImplementor session)
Called just after the entities properties have been initialized.
|
protected abstract Instantiator |
buildInstantiator(EntityMetamodel entityMetamodel,
PersistentClass mappingInfo)
Build an appropriate Instantiator for the given mapped entity.
|
protected abstract Getter |
buildPropertyGetter(Property mappedProperty,
PersistentClass mappedEntity)
Build an appropriate Getter for the given property.
|
protected abstract Setter |
buildPropertySetter(Property mappedProperty,
PersistentClass mappedEntity)
Build an appropriate Setter for the given property.
|
protected abstract ProxyFactory |
buildProxyFactory(PersistentClass mappingInfo,
Getter idGetter,
Setter idSetter)
Build an appropriate ProxyFactory for the given mapped entity.
|
Object |
createProxy(Serializable id,
SharedSessionContractImplementor session)
Generates an appropriate proxy representation of this entity for this
entity-mode.
|
protected Object |
getComponentValue(ComponentType type,
Object component,
String propertyPath)
Extract a component property value.
|
protected EntityMetamodel |
getEntityMetamodel() |
protected String |
getEntityName()
Retrieves the defined entity-name for the tuplized entity.
|
protected SessionFactoryImplementor |
getFactory() |
Getter |
getGetter(int i)
Retrieve the getter for the specified property.
|
Serializable |
getIdentifier(Object entity)
Extract the identifier value from the given entity.
|
Serializable |
getIdentifier(Object entity,
SharedSessionContractImplementor session)
Extract the identifier value from the given entity.
|
Getter |
getIdentifierGetter()
Retrieve the getter for the identifier property.
|
Type |
getIdentifierMapperType() |
protected Instantiator |
getInstantiator() |
Object |
getPropertyValue(Object entity,
int i)
Extract the value of a particular property from the given entity.
|
Object |
getPropertyValue(Object entity,
String propertyPath)
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,
SharedSessionContractImplementor session)
Extract the values of the insertable properties of the entity (including backrefs)
|
protected ProxyFactory |
getProxyFactory() |
protected Set |
getSubclassEntityNames()
Retrieves the defined entity-names for any subclasses defined for this
entity.
|
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?
|
Object |
instantiate()
Generate a new, empty entity.
|
Object |
instantiate(Serializable id)
Create an entity instance initialized with the given identifier.
|
Object |
instantiate(Serializable id,
SharedSessionContractImplementor session)
Create an entity instance initialized with the given identifier.
|
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()
|
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,
SharedSessionContractImplementor 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,
SharedSessionContractImplementor 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.
|
protected boolean |
shouldGetAllProperties(Object entity) |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdetermineConcreteSubclassEntityName, getConcreteProxyClass, getEntityMode, getEntityNameResolversgetMappedClassprotected final Getter[] getters
protected final Setter[] setters
protected final int propertySpan
protected final boolean hasCustomAccessors
public AbstractEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappingInfo)
Constructs a new AbstractEntityTuplizer instance.
entityMetamodel - The "interpreted" information relating to the mapped entity.mappingInfo - The parsed "raw" mapping data relating to the given entity.public Type getIdentifierMapperType()
protected abstract Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity)
Build an appropriate Getter for the given property.
mappedProperty - The property to be accessed via the built Getter.mappedEntity - The entity information regarding the mapped entity owning this property.protected abstract Setter buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity)
Build an appropriate Setter for the given property.
mappedProperty - The property to be accessed via the built Setter.mappedEntity - The entity information regarding the mapped entity owning this property.protected abstract Instantiator buildInstantiator(EntityMetamodel entityMetamodel, PersistentClass mappingInfo)
Build an appropriate Instantiator for the given mapped entity.
mappingInfo - The mapping information regarding the mapped entity.protected abstract ProxyFactory buildProxyFactory(PersistentClass mappingInfo, Getter idGetter, Setter idSetter)
Build an appropriate ProxyFactory for the given mapped entity.
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.protected String getEntityName()
Retrieves the defined entity-name for the tuplized entity.
protected Set getSubclassEntityNames()
Retrieves the defined entity-names for any subclasses defined for this entity.
public Serializable getIdentifier(Object entity) throws HibernateException
EntityTuplizerExtract the identifier value from the given entity.
getIdentifier in interface EntityTuplizerentity - The entity from which to extract the identifier value.HibernateException - If the entity does not define an identifier property, or an
error occurs accessing its value.public Serializable getIdentifier(Object entity, SharedSessionContractImplementor session)
EntityTuplizerExtract the identifier value from the given entity.
getIdentifier in interface EntityTuplizerentity - The entity from which to extract the identifier value.session - The session from which is requests originatespublic void setIdentifier(Object entity, Serializable id) throws HibernateException
EntityTuplizerInject the identifier value into the given entity. </p> Has no effect if the entity does not define an identifier property
setIdentifier in interface EntityTuplizerentity - The entity to inject with the identifier value.id - The value to be injected as the identifier.HibernateExceptionpublic void setIdentifier(Object entity, Serializable id, SharedSessionContractImplementor session)
EntityTuplizerInject the identifier value into the given entity. </p> Has no effect if the entity does not define an identifier property
setIdentifier in interface EntityTuplizerentity - The entity to inject with the identifier value.id - The value to be injected as the identifier.session - The session from which is requests originatespublic void resetIdentifier(Object entity, Serializable currentId, Object currentVersion)
EntityTuplizerInject the given identifier and version into the entity, in order to "roll back" to their original values.
resetIdentifier in interface EntityTuplizerentity - The entity for which to reset the id/version valuescurrentId - 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, SharedSessionContractImplementor session)
EntityTuplizerInject the given identifier and version into the entity, in order to "roll back" to their original values.
resetIdentifier in interface EntityTuplizerentity - The entity for which to reset the id/version valuescurrentId - The identifier value to inject into the entity.currentVersion - The version value to inject into the entity.session - The session from which the request originatedpublic Object getVersion(Object entity) throws HibernateException
EntityTuplizerExtract the value of the version property from the given entity.
getVersion in interface EntityTuplizerentity - The entity from which to extract the version value.HibernateException - Indicates a problem accessing the version propertyprotected boolean shouldGetAllProperties(Object entity)
public Object[] getPropertyValues(Object entity)
TuplizerExtract the current values contained on the given entity.
getPropertyValues in interface Tuplizerentity - The entity from which to extract values.public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SharedSessionContractImplementor session)
EntityTuplizerExtract the values of the insertable properties of the entity (including backrefs)
getPropertyValuesToInsert in interface EntityTuplizerentity - 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.public Object getPropertyValue(Object entity, int i) throws HibernateException
TuplizerExtract the value of a particular property from the given entity.
getPropertyValue in interface Tuplizerentity - The entity from which to extract the property value.i - The index of the property for which to extract the value.HibernateExceptionpublic Object getPropertyValue(Object entity, String propertyPath) throws HibernateException
EntityTuplizerExtract the value of a particular property from the given entity.
getPropertyValue in interface EntityTuplizerentity - The entity from which to extract the property value.propertyPath - The name of the property for which to extract the value.HibernateException - Indicates a problem access the propertyprotected Object getComponentValue(ComponentType type, Object component, String propertyPath)
Extract a component property value.
type - The component property types.component - The component instance itself.propertyPath - The property path for the property to be extracted.public void setPropertyValues(Object entity, Object[] values) throws HibernateException
TuplizerInject the given values into the given entity.
setPropertyValues in interface Tuplizerentity - The entity.values - The values to be injected.HibernateExceptionpublic void setPropertyValue(Object entity, int i, Object value) throws HibernateException
EntityTuplizerInject the value of a particular property.
setPropertyValue in interface EntityTuplizerentity - The entity into which to inject the value.i - The property’s index.value - The property value to inject.HibernateException - Indicates a problem access the propertypublic void setPropertyValue(Object entity, String propertyName, Object value) throws HibernateException
EntityTuplizerInject the value of a particular property.
setPropertyValue in interface EntityTuplizerentity - The entity into which to inject the value.propertyName - The name of the property.value - The property value to inject.HibernateException - Indicates a problem access the propertypublic final Object instantiate(Serializable id) throws HibernateException
EntityTuplizerCreate an entity instance initialized with the given identifier.
instantiate in interface EntityTuplizerid - The identifier value for the entity to be instantiated.HibernateExceptionpublic final Object instantiate(Serializable id, SharedSessionContractImplementor session)
EntityTuplizerCreate an entity instance initialized with the given identifier.
instantiate in interface EntityTuplizerid - The identifier value for the entity to be instantiated.session - The session from which is requests originatespublic final Object instantiate() throws HibernateException
TuplizerGenerate a new, empty entity.
instantiate in interface TuplizerHibernateExceptionpublic void afterInitialize(Object entity, SharedSessionContractImplementor session)
EntityTuplizerCalled just after the entities properties have been initialized.
afterInitialize in interface EntityTuplizerentity - The entity being initialized.session - The session initializing this entity.public final boolean isInstance(Object object)
TuplizerIs the given object considered an instance of the the entity (acconting for entity-mode) managed by this tuplizer.
isInstance in interface Tuplizerobject - The object to be checked.public boolean hasProxy()
EntityTuplizerDoes this entity, for this mode, present a possibility for proxying?
hasProxy in interface EntityTuplizerpublic final Object createProxy(Serializable id, SharedSessionContractImplementor session)
EntityTuplizerGenerates an appropriate proxy representation of this entity for this entity-mode.
createProxy in interface EntityTuplizerid - The id of the instance for which to generate a proxy.session - The session to which the proxy should be bound.public boolean isLifecycleImplementor()
EntityTuplizerisLifecycleImplementor in interface EntityTuplizerprotected final EntityMetamodel getEntityMetamodel()
protected final SessionFactoryImplementor getFactory()
protected final Instantiator getInstantiator()
protected final ProxyFactory getProxyFactory()
public Getter getIdentifierGetter()
EntityTuplizerRetrieve the getter for the identifier property. May return null.
getIdentifierGetter in interface EntityTuplizerpublic Getter getVersionGetter()
EntityTuplizerRetrieve the getter for the version property. May return null.
getVersionGetter in interface EntityTuplizerCopyright © 2001-2018 Red Hat, Inc. All Rights Reserved.