Package org.hibernate.tuple.entity
Class AbstractEntityTuplizer
- java.lang.Object
-
- org.hibernate.tuple.entity.AbstractEntityTuplizer
-
- All Implemented Interfaces:
EntityTuplizer
,Tuplizer
- Direct Known Subclasses:
DynamicMapEntityTuplizer
,PojoEntityTuplizer
public abstract class AbstractEntityTuplizer extends Object implements EntityTuplizer
Support for tuplizers relating to entities.
-
-
Field Summary
Fields Modifier and Type Field Description protected Getter[]
getters
protected boolean
hasCustomAccessors
protected int
propertySpan
protected Setter[]
setters
-
Constructor Summary
Constructors Constructor Description AbstractEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappingInfo)
Constructs a new AbstractEntityTuplizer instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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.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.Object
getIdentifier(Object entity, SharedSessionContractImplementor session)
Extract the identifier value from the given entity.Object
getPropertyValue(Object entity, int i)
Extract the value of a particular property from the given entity.Object[]
getPropertyValuesToInsert(Object entity, Map mergeMap, SharedSessionContractImplementor session)
Extract the values of the insertable properties of the entity (including backrefs)protected Set<String>
getSubclassEntityNames()
Retrieves the defined entity-names for any subclasses defined for this entity.protected EntityIdentifierMapping
resolveIdentifierDescriptor()
protected boolean
shouldGetAllProperties(Object entity)
String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.tuple.entity.EntityTuplizer
determineConcreteSubclassEntityName, getEntityNameResolvers
-
Methods inherited from interface org.hibernate.tuple.Tuplizer
getMappedClass
-
-
-
-
Constructor Detail
-
AbstractEntityTuplizer
public AbstractEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappingInfo)
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 Detail
-
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.
-
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
protected String getEntityName()
Retrieves the defined entity-name for the tuplized entity.- Returns:
- The entity-name.
-
getSubclassEntityNames
protected Set<String> getSubclassEntityNames()
Retrieves the defined entity-names for any subclasses defined for this entity.- Returns:
- Any subclass entity-names.
-
getIdentifier
public Object getIdentifier(Object entity, SharedSessionContractImplementor session)
Description copied from interface:EntityTuplizer
Extract the identifier value from the given entity.- Specified by:
getIdentifier
in interfaceEntityTuplizer
- Parameters:
entity
- The entity from which to extract the identifier value.session
- The session from which is requests originates- Returns:
- The identifier value.
-
resolveIdentifierDescriptor
protected EntityIdentifierMapping resolveIdentifierDescriptor()
-
shouldGetAllProperties
protected boolean shouldGetAllProperties(Object entity)
-
getPropertyValuesToInsert
public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SharedSessionContractImplementor session)
Description copied from interface:EntityTuplizer
Extract the values of the insertable properties of the entity (including backrefs)- Specified by:
getPropertyValuesToInsert
in interfaceEntityTuplizer
- Parameters:
entity
- The entity from which to extract.mergeMap
- a map of instances being merged to merged instancessession
- The session in which the result set is being made.- Returns:
- The insertable property values.
-
getPropertyValue
public Object getPropertyValue(Object entity, int i) throws HibernateException
Description copied from interface:Tuplizer
Extract the value of a particular property from the given entity.- Specified by:
getPropertyValue
in 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
-
getComponentValue
protected Object getComponentValue(ComponentType type, Object component, String propertyPath)
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.
-
getEntityMetamodel
protected final EntityMetamodel getEntityMetamodel()
-
getFactory
protected final SessionFactoryImplementor getFactory()
-
-