Package org.hibernate.tuple.entity
Class AbstractEntityTuplizer
java.lang.Object
org.hibernate.tuple.entity.AbstractEntityTuplizer
- All Implemented Interfaces:
EntityTuplizer,Tuplizer
- Direct Known Subclasses:
Dom4jEntityTuplizer,DynamicMapEntityTuplizer,PojoEntityTuplizer
Support for tuplizers relating to entities.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappingInfo) Constructs a new AbstractEntityTuplizer instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidafterInitialize(Object entity, boolean lazyPropertiesAreUnfetched, SessionImplementor session) Called just after the entities properties have been initialized.protected abstract InstantiatorbuildInstantiator(PersistentClass mappingInfo) Build an appropriate Instantiator for the given mapped entity.protected abstract GetterbuildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity) Build an appropriate Getter for the given property.protected abstract SetterbuildPropertySetter(Property mappedProperty, PersistentClass mappedEntity) Build an appropriate Setter for the given property.protected abstract ProxyFactorybuildProxyFactory(PersistentClass mappingInfo, Getter idGetter, Setter idSetter) Build an appropriate ProxyFactory for the given mapped entity.final ObjectcreateProxy(Serializable id, SessionImplementor session) Generates an appropriate proxy representation of this entity for this entity-mode.protected ObjectgetComponentValue(ComponentType type, Object component, String propertyPath) Extract a component property value.protected final EntityMetamodelprotected StringRetreives the defined entity-name for the tuplized entity.protected final SessionFactoryImplementorgetGetter(int i) Retrieve the getter for the specified property.getIdentifier(Object entity) Extract the identifier value from the given entity.getIdentifier(Object entity, SessionImplementor session) Extract the identifier value from the given entity.Retrieve the getter for the identifier property.protected final InstantiatorgetPropertyValue(Object entity, int i) Extract the value of a particular property from the given entity.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, SessionImplementor session) Extract the values of the insertable properties of the entity (including backrefs)protected final ProxyFactoryprotected SetRetrieves the defined entity-names for any subclasses defined for this entity.getVersion(Object entity) Extract the value of the version property from the given entity.Retrieve the getter for the version property.booleanhasProxy()Does this entity, for this mode, present a possibility for proxying?booleanhasUninitializedLazyProperties(Object entity) Does the given entity instance have any currently uninitialized lazy properties?final ObjectGenerate a new, empty entity.final ObjectCreate an entity instance initialized with the given identifier.final Objectinstantiate(Serializable id, SessionImplementor session) Create an entity instance initialized with the given identifier.final booleanisInstance(Object object) Is the given object considered an instance of the the entity (acconting for entity-mode) managed by this tuplizer.booleanbooleanDoes theclassmanaged by this tuplizer implement theValidatableinterface.voidresetIdentifier(Object entity, Serializable currentId, Object currentVersion) Inject the given identifier and version into the entity, in order to "roll back" to their original values.voidresetIdentifier(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.voidsetIdentifier(Object entity, Serializable id) Inject the identifier value into the given entity.voidsetIdentifier(Object entity, Serializable id, SessionImplementor session) Inject the identifier value into the given entity.voidsetPropertyValue(Object entity, int i, Object value) Inject the value of a particular property.voidsetPropertyValue(Object entity, String propertyName, Object value) Inject the value of a particular property.voidsetPropertyValues(Object entity, Object[] values) Inject the given values into the given entity.protected booleanshouldGetAllProperties(Object entity) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.hibernate.tuple.entity.EntityTuplizer
determineConcreteSubclassEntityName, getConcreteProxyClass, getEntityMode, getEntityNameResolvers, isInstrumentedMethods inherited from interface org.hibernate.tuple.Tuplizer
getMappedClass
-
Field Details
-
getters
-
setters
-
propertySpan
protected final int propertySpan -
hasCustomAccessors
protected final boolean hasCustomAccessors
-
-
Constructor Details
-
AbstractEntityTuplizer
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.
-
-
Method Details
-
getIdentifierMapperType
-
buildPropertyGetter
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.
-
buildPropertySetter
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.
-
buildInstantiator
Build an appropriate Instantiator for the given mapped entity.- Parameters:
mappingInfo- The mapping information regarding the mapped entity.- Returns:
- An appropriate Instantiator instance.
-
buildProxyFactory
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.
-
getEntityName
Retreives the defined entity-name for the tuplized entity.- Returns:
- The entity-name.
-
getSubclassEntityNames
Retrieves the defined entity-names for any subclasses defined for this entity.- Returns:
- Any subclass entity-names.
-
getIdentifier
Description copied from interface:EntityTuplizerExtract the identifier value from the given entity.- Specified by:
getIdentifierin interfaceEntityTuplizer- Parameters:
entity- The entity from which to extract the identifier value.- Returns:
- The identifier value.
- Throws:
HibernateException- If the entity does not define an identifier property, or an error occurs accessing its value.
-
getIdentifier
Description copied from interface:EntityTuplizerExtract the identifier value from the given entity.- Specified by:
getIdentifierin interfaceEntityTuplizer- Parameters:
entity- The entity from which to extract the identifier value.session- The session from which is requests originates- Returns:
- The identifier value.
-
setIdentifier
Inject the identifier value into the given entity. Has no effect if the entity does not define an identifier property- Specified by:
setIdentifierin interfaceEntityTuplizer- Parameters:
entity- The entity to inject with the identifier value.id- The value to be injected as the identifier.- Throws:
HibernateException
-
setIdentifier
Inject the identifier value into the given entity. Has no effect if the entity does not define an identifier property- Specified by:
setIdentifierin interfaceEntityTuplizer- 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
-
resetIdentifier
Inject the given identifier and version into the entity, in order to "roll back" to their original values.- Specified by:
resetIdentifierin interfaceEntityTuplizer- Parameters:
entity- 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.
-
resetIdentifier
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.- Specified by:
resetIdentifierin interfaceEntityTuplizer- Parameters:
entity- 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 originated
-
getVersion
Description copied from interface:EntityTuplizerExtract the value of the version property from the given entity.- Specified by:
getVersionin interfaceEntityTuplizer- Parameters:
entity- The entity from which to extract the version value.- Returns:
- The value of the version property, or null if not versioned.
- Throws:
HibernateException
-
shouldGetAllProperties
-
getPropertyValues
Description copied from interface:TuplizerExtract the current values contained on the given entity.- Specified by:
getPropertyValuesin interfaceTuplizer- 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:EntityTuplizerExtract the values of the insertable properties of the entity (including backrefs)- Specified by:
getPropertyValuesToInsertin interfaceEntityTuplizer- Parameters:
entity- 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.- Returns:
- The insertable property values.
- Throws:
HibernateException
-
getPropertyValue
Description copied from interface:TuplizerExtract the value of a particular property from the given entity.- Specified by:
getPropertyValuein interfaceTuplizer- 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.
- Throws:
HibernateException
-
getPropertyValue
Description copied from interface:EntityTuplizerExtract the value of a particular property from the given entity.- Specified by:
getPropertyValuein interfaceEntityTuplizer- 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.
- Throws:
HibernateException
-
getComponentValue
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.
-
setPropertyValues
Description copied from interface:TuplizerInject the given values into the given entity.- Specified by:
setPropertyValuesin interfaceTuplizer- Parameters:
entity- The entity.values- The values to be injected.- Throws:
HibernateException
-
setPropertyValue
Description copied from interface:EntityTuplizerInject the value of a particular property.- Specified by:
setPropertyValuein interfaceEntityTuplizer- Parameters:
entity- The entity into which to inject the value.i- The property's index.value- The property value to inject.- Throws:
HibernateException
-
setPropertyValue
public void setPropertyValue(Object entity, String propertyName, Object value) throws HibernateException Description copied from interface:EntityTuplizerInject the value of a particular property.- Specified by:
setPropertyValuein interfaceEntityTuplizer- Parameters:
entity- The entity into which to inject the value.propertyName- The name of the property.value- The property value to inject.- Throws:
HibernateException
-
instantiate
Description copied from interface:EntityTuplizerCreate an entity instance initialized with the given identifier.- Specified by:
instantiatein interfaceEntityTuplizer- Parameters:
id- The identifier value for the entity to be instantiated.- Returns:
- The instantiated entity.
- Throws:
HibernateException
-
instantiate
Description copied from interface:EntityTuplizerCreate an entity instance initialized with the given identifier.- Specified by:
instantiatein interfaceEntityTuplizer- Parameters:
id- The identifier value for the entity to be instantiated.session- The session from which is requests originates- Returns:
- The instantiated entity.
-
instantiate
Description copied from interface:TuplizerGenerate a new, empty entity.- Specified by:
instantiatein interfaceTuplizer- Returns:
- The new, empty entity instance.
- Throws:
HibernateException
-
afterInitialize
public void afterInitialize(Object entity, boolean lazyPropertiesAreUnfetched, SessionImplementor session) Description copied from interface:EntityTuplizerCalled just after the entities properties have been initialized.- Specified by:
afterInitializein interfaceEntityTuplizer- Parameters:
entity- The entity being initialized.lazyPropertiesAreUnfetched- Are defined lazy properties currently unfecthedsession- The session initializing this entity.
-
hasUninitializedLazyProperties
Description copied from interface:EntityTuplizerDoes the given entity instance have any currently uninitialized lazy properties?- Specified by:
hasUninitializedLazyPropertiesin interfaceEntityTuplizer- Parameters:
entity- The entity to be check for uninitialized lazy properties.- Returns:
- True if uninitialized lazy properties were found; false otherwise.
-
isInstance
Description copied from interface:TuplizerIs the given object considered an instance of the the entity (acconting for entity-mode) managed by this tuplizer.- Specified by:
isInstancein interfaceTuplizer- Parameters:
object- The object to be checked.- Returns:
- True if the object is considered as an instance of this entity within the given mode.
-
hasProxy
public boolean hasProxy()Description copied from interface:EntityTuplizerDoes this entity, for this mode, present a possibility for proxying?- Specified by:
hasProxyin interfaceEntityTuplizer- Returns:
- True if this tuplizer can generate proxies for this entity.
-
createProxy
public final Object createProxy(Serializable id, SessionImplementor session) throws HibernateException Description copied from interface:EntityTuplizerGenerates an appropriate proxy representation of this entity for this entity-mode.- Specified by:
createProxyin interfaceEntityTuplizer- 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.
- Throws:
HibernateException- Indicates an error generating the proxy.
-
isLifecycleImplementor
public boolean isLifecycleImplementor()Description copied from interface:EntityTuplizer- Specified by:
isLifecycleImplementorin interfaceEntityTuplizer- Returns:
- True if the Lifecycle interface is implemented; false otherwise.
-
isValidatableImplementor
public boolean isValidatableImplementor()Description copied from interface:EntityTuplizerDoes theclassmanaged by this tuplizer implement theValidatableinterface.- Specified by:
isValidatableImplementorin interfaceEntityTuplizer- Returns:
- True if the Validatable interface is implemented; false otherwise.
-
getEntityMetamodel
-
getFactory
-
getInstantiator
-
getProxyFactory
-
toString
-
getIdentifierGetter
Description copied from interface:EntityTuplizerRetrieve the getter for the identifier property. May return null.- Specified by:
getIdentifierGetterin interfaceEntityTuplizer- Returns:
- The getter for the identifier property.
-
getVersionGetter
Description copied from interface:EntityTuplizerRetrieve the getter for the version property. May return null.- Specified by:
getVersionGetterin interfaceEntityTuplizer- Returns:
- The getter for the version property.
-
getGetter
Description copied from interface:TuplizerRetrieve the getter for the specified property.
-