Class AbstractEmbeddableMapping
- java.lang.Object
-
- org.hibernate.metamodel.mapping.internal.AbstractEmbeddableMapping
-
- All Implemented Interfaces:
Bindable
,EmbeddableMappingType
,JdbcMappingContainer
,ManagedMappingType
,MappingModelExpressible
,MappingType
,ModelPart
,ModelPartContainer
,SelectableMappings
,FetchableContainer
- Direct Known Subclasses:
EmbeddableMappingTypeImpl
,IdClassEmbeddable
,VirtualIdEmbeddable
public abstract class AbstractEmbeddableMapping extends Object implements EmbeddableMappingType
Base support for EmbeddableMappingType implementations
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
AbstractEmbeddableMapping.AttributeTypeValidator
protected static interface
AbstractEmbeddableMapping.ConcreteTableResolver
protected static class
AbstractEmbeddableMapping.IllegalAttributeType
protected static interface
AbstractEmbeddableMapping.SuccessfulCompletionCallback
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.Bindable
Bindable.JdbcValuesBiConsumer<X,Y>, Bindable.JdbcValuesConsumer
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.ModelPart
ModelPart.JdbcValueBiConsumer<X,Y>, ModelPart.JdbcValueConsumer
-
-
Field Summary
Fields Modifier and Type Field Description protected MutableAttributeMappingList
attributeMappings
protected Getter[]
getterCache
protected SelectableMappings
selectableMappings
protected Setter[]
setterCache
-
Constructor Summary
Constructors Constructor Description AbstractEmbeddableMapping(MutableAttributeMappingList attributeMappings)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
addAttribute(AttributeMapping attributeMapping)
void
addToCacheKey(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session)
Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.<X,Y>
intbreakDownJdbcValues(Object domainValue, int offset, X x, Y y, ModelPart.JdbcValueBiConsumer<X,Y> valueConsumer, SharedSessionContractImplementor session)
Breaks down the domain value to its constituent JDBC values.protected void
buildGetterSetterCache()
protected String
determineEmbeddablePrefix()
Object
disassemble(Object value, SharedSessionContractImplementor session)
AttributeMapping
findAttributeMapping(String name)
Find an attribute by name.ModelPart
findSubPart(String name, EntityMappingType treatTargetType)
protected boolean
finishInitialization(NavigableRole navigableRole, Component bootDescriptor, CompositeType compositeType, String rootTableExpression, String[] rootTableKeyColumnNames, EmbeddableMappingType declarer, EmbeddableRepresentationStrategy representationStrategy, AbstractEmbeddableMapping.AttributeTypeValidator attributeTypeValidator, AbstractEmbeddableMapping.ConcreteTableResolver concreteTableResolver, Consumer<AttributeMapping> attributeConsumer, AbstractEmbeddableMapping.SuccessfulCompletionCallback completionCallback, MappingModelCreationProcess creationProcess)
void
forEachAttributeMapping(Consumer<? super AttributeMapping> action)
Visit attributes defined on this class and any supersvoid
forEachAttributeMapping(IndexedConsumer<? super AttributeMapping> consumer)
Visit attributes defined on this class and any supers<X,Y>
intforEachDisassembledJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> valuesConsumer, SharedSessionContractImplementor session)
LikeBindable.forEachDisassembledJdbcValue(Object, Object, Object, JdbcValuesBiConsumer, SharedSessionContractImplementor)
, but additionally receives an offset by which the selectionIndex is incremented when callingBindable.JdbcValuesBiConsumer.consume(int, Object, Object, Object, JdbcMapping)
.int
forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)
Visit each JdbcMapping starting from the given offset<X,Y>
intforEachJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> valuesConsumer, SharedSessionContractImplementor session)
Visit each constituent JDBC value extracted from the entity instance itself.int
forEachSelectable(int offset, SelectableConsumer consumer)
Visits each selectable mapping with the selectable index offset by the given value.int
forEachSelectable(SelectableConsumer consumer)
A short hand form ofModelPart.forEachSelectable(int, SelectableConsumer)
, that passes 0 as offset.void
forEachSubPart(IndexedConsumer<ModelPart> consumer, EntityMappingType treatTarget)
AttributeMapping
getAttributeMapping(int position)
Retrieve an attribute by its contributor positionAttributeMappingsList
getAttributeMappings()
Get access to the attributes defined on this class and any supersFetchable
getFetchable(int position)
JdbcMapping
getJdbcMapping(int index)
List<JdbcMapping>
getJdbcMappings()
Deprecated, for removal: This API element is subject to removal in a future version.int
getJdbcTypeCount()
The number of JDBC mappingsJavaType<?>
getMappedJavaType()
The descriptor descriptor for the mapped Java typeint
getNumberOfAttributeMappings()
Get the number of attributes defined on this class and any supersint
getNumberOfFetchables()
The number of fetchables in the containerSelectableMapping
getSelectable(int columnIndex)
Get the selectable at the given positionprotected SelectableMappings
getSelectableMappings()
Object
getValue(Object instance, int position)
Extract a specific attribute value from the entity instance, by positionObject[]
getValues(Object compositeInstance)
Extract the individual attribute values from the entity instanceprotected boolean
initColumnMappings()
protected boolean
inverseInitializeCallback(TableGroupProducer declaringTableGroupProducer, SelectableMappings selectableMappings, EmbeddableMappingType inverseMappingType, MappingModelCreationProcess creationProcess, ManagedMappingType declaringType, MutableAttributeMappingList mappings)
void
setValue(Object instance, int position, Object value)
Inject a specific attribute value into the entity instance, by positionvoid
setValues(Object component, Object[] values)
Inject the attribute values into the entity instancevoid
visitFetchables(Consumer<? super Fetchable> consumer, EntityMappingType treatTargetType)
void
visitFetchables(IndexedConsumer<? super Fetchable> indexedConsumer, EntityMappingType treatTargetType)
void
visitSubParts(Consumer<ModelPart> consumer, EntityMappingType treatTargetType)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.metamodel.mapping.Bindable
forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachJdbcValue, forEachJdbcValue
-
Methods inherited from interface org.hibernate.metamodel.mapping.EmbeddableMappingType
anyRequiresAggregateColumnWriter, applySqlSelections, applySqlSelections, compare, createDomainResult, createInverseMappingType, forEachInsertable, forEachUpdatable, getAggregateMapping, getEmbeddedValueMapping, getJdbcValueCount, getJdbcValueSelectable, getPartMappingType, getRepresentationStrategy, getSelectableIndex, isCreateEmptyCompositesEnabled, requiresAggregateColumnWriter, shouldBindAggregateMapping, shouldMutateAggregateMapping, shouldSelectAggregateMapping
-
Methods inherited from interface org.hibernate.sql.results.graph.FetchableContainer
getKeyFetchable, getNumberOfFetchableKeys, getNumberOfKeyFetchables, visitFetchables, visitKeyFetchables, visitKeyFetchables, visitKeyFetchables
-
Methods inherited from interface org.hibernate.metamodel.mapping.JdbcMappingContainer
getSingleJdbcMapping
-
Methods inherited from interface org.hibernate.metamodel.mapping.ManagedMappingType
getJavaType, hasPartitionedSelectionMapping
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
areEqual, asAttributeMapping, asBasicValuedModelPart, asEntityMappingType, breakDownJdbcValues, decompose, decompose, findContainingEntityMapping, getNavigableRole, getPartName, isEntityIdentifierMapping, isVirtual
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPartContainer
findByPath, findByPath, forEachSubPart
-
-
-
-
Field Detail
-
attributeMappings
protected final MutableAttributeMappingList attributeMappings
-
selectableMappings
protected SelectableMappings selectableMappings
-
getterCache
protected Getter[] getterCache
-
setterCache
protected Setter[] setterCache
-
-
Constructor Detail
-
AbstractEmbeddableMapping
public AbstractEmbeddableMapping(MutableAttributeMappingList attributeMappings)
-
-
Method Detail
-
getMappedJavaType
public JavaType<?> getMappedJavaType()
Description copied from interface:MappingType
The descriptor descriptor for the mapped Java type- Specified by:
getMappedJavaType
in interfaceMappingType
-
getValue
public Object getValue(Object instance, int position)
Description copied from interface:ManagedMappingType
Extract a specific attribute value from the entity instance, by position- Specified by:
getValue
in interfaceManagedMappingType
-
setValue
public void setValue(Object instance, int position, Object value)
Description copied from interface:ManagedMappingType
Inject a specific attribute value into the entity instance, by position- Specified by:
setValue
in interfaceManagedMappingType
-
getValues
public Object[] getValues(Object compositeInstance)
Description copied from interface:ManagedMappingType
Extract the individual attribute values from the entity instance- Specified by:
getValues
in interfaceManagedMappingType
-
setValues
public void setValues(Object component, Object[] values)
Description copied from interface:ManagedMappingType
Inject the attribute values into the entity instance- Specified by:
setValues
in interfaceManagedMappingType
-
inverseInitializeCallback
protected boolean inverseInitializeCallback(TableGroupProducer declaringTableGroupProducer, SelectableMappings selectableMappings, EmbeddableMappingType inverseMappingType, MappingModelCreationProcess creationProcess, ManagedMappingType declaringType, MutableAttributeMappingList mappings)
-
finishInitialization
protected boolean finishInitialization(NavigableRole navigableRole, Component bootDescriptor, CompositeType compositeType, String rootTableExpression, String[] rootTableKeyColumnNames, EmbeddableMappingType declarer, EmbeddableRepresentationStrategy representationStrategy, AbstractEmbeddableMapping.AttributeTypeValidator attributeTypeValidator, AbstractEmbeddableMapping.ConcreteTableResolver concreteTableResolver, Consumer<AttributeMapping> attributeConsumer, AbstractEmbeddableMapping.SuccessfulCompletionCallback completionCallback, MappingModelCreationProcess creationProcess)
-
determineEmbeddablePrefix
protected String determineEmbeddablePrefix()
-
getNumberOfFetchables
public int getNumberOfFetchables()
Description copied from interface:FetchableContainer
The number of fetchables in the container- Specified by:
getNumberOfFetchables
in interfaceFetchableContainer
-
getFetchable
public Fetchable getFetchable(int position)
- Specified by:
getFetchable
in interfaceFetchableContainer
-
visitFetchables
public void visitFetchables(Consumer<? super Fetchable> consumer, EntityMappingType treatTargetType)
- Specified by:
visitFetchables
in interfaceFetchableContainer
-
visitFetchables
public void visitFetchables(IndexedConsumer<? super Fetchable> indexedConsumer, EntityMappingType treatTargetType)
- Specified by:
visitFetchables
in interfaceFetchableContainer
-
getNumberOfAttributeMappings
public int getNumberOfAttributeMappings()
Description copied from interface:ManagedMappingType
Get the number of attributes defined on this class and any supers- Specified by:
getNumberOfAttributeMappings
in interfaceManagedMappingType
-
getAttributeMapping
public AttributeMapping getAttributeMapping(int position)
Description copied from interface:ManagedMappingType
Retrieve an attribute by its contributor position- Specified by:
getAttributeMapping
in interfaceManagedMappingType
-
findAttributeMapping
public AttributeMapping findAttributeMapping(String name)
Description copied from interface:ManagedMappingType
Find an attribute by name.- Specified by:
findAttributeMapping
in interfaceManagedMappingType
- Returns:
- The named attribute, or
null
if no match was found
-
getAttributeMappings
public AttributeMappingsList getAttributeMappings()
Description copied from interface:ManagedMappingType
Get access to the attributes defined on this class and any supers- Specified by:
getAttributeMappings
in interfaceManagedMappingType
-
getSelectable
public SelectableMapping getSelectable(int columnIndex)
Description copied from interface:SelectableMappings
Get the selectable at the given position- Specified by:
getSelectable
in interfaceSelectableMappings
-
forEachSelectable
public int forEachSelectable(SelectableConsumer consumer)
Description copied from interface:ModelPart
A short hand form ofModelPart.forEachSelectable(int, SelectableConsumer)
, that passes 0 as offset.- Specified by:
forEachSelectable
in interfaceEmbeddableMappingType
- Specified by:
forEachSelectable
in interfaceModelPart
- Specified by:
forEachSelectable
in interfaceSelectableMappings
-
forEachSelectable
public int forEachSelectable(int offset, SelectableConsumer consumer)
Description copied from interface:ModelPart
Visits each selectable mapping with the selectable index offset by the given value. Returns the amount of jdbc types that have been visited.- Specified by:
forEachSelectable
in interfaceEmbeddableMappingType
- Specified by:
forEachSelectable
in interfaceModelPart
- Specified by:
forEachSelectable
in interfaceSelectableMappings
- See Also:
SelectableConsumer.accept(int, SelectableMapping)
-
getJdbcTypeCount
public int getJdbcTypeCount()
Description copied from interface:Bindable
The number of JDBC mappings- Specified by:
getJdbcTypeCount
in interfaceBindable
- Specified by:
getJdbcTypeCount
in interfaceEmbeddableMappingType
- Specified by:
getJdbcTypeCount
in interfaceJdbcMappingContainer
- Specified by:
getJdbcTypeCount
in interfaceSelectableMappings
-
forEachJdbcType
public int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)
Description copied from interface:JdbcMappingContainer
Visit each JdbcMapping starting from the given offset- Specified by:
forEachJdbcType
in interfaceEmbeddableMappingType
- Specified by:
forEachJdbcType
in interfaceJdbcMappingContainer
-
getJdbcMappings
@Deprecated(forRemoval=true) public List<JdbcMapping> getJdbcMappings()
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:Bindable
The list of JDBC mappings- Specified by:
getJdbcMappings
in interfaceBindable
- Specified by:
getJdbcMappings
in interfaceEmbeddableMappingType
- Specified by:
getJdbcMappings
in interfaceJdbcMappingContainer
- Specified by:
getJdbcMappings
in interfaceSelectableMappings
- See Also:
SqlTypedMapping.getJdbcMapping()
-
getJdbcMapping
public JdbcMapping getJdbcMapping(int index)
- Specified by:
getJdbcMapping
in interfaceJdbcMappingContainer
-
forEachAttributeMapping
public void forEachAttributeMapping(IndexedConsumer<? super AttributeMapping> consumer)
Description copied from interface:ManagedMappingType
Visit attributes defined on this class and any supers- Specified by:
forEachAttributeMapping
in interfaceManagedMappingType
-
forEachAttributeMapping
public void forEachAttributeMapping(Consumer<? super AttributeMapping> action)
Description copied from interface:ManagedMappingType
Visit attributes defined on this class and any supers- Specified by:
forEachAttributeMapping
in interfaceManagedMappingType
-
findSubPart
public ModelPart findSubPart(String name, EntityMappingType treatTargetType)
- Specified by:
findSubPart
in interfaceModelPartContainer
-
forEachSubPart
public void forEachSubPart(IndexedConsumer<ModelPart> consumer, EntityMappingType treatTarget)
- Specified by:
forEachSubPart
in interfaceModelPartContainer
-
visitSubParts
public void visitSubParts(Consumer<ModelPart> consumer, EntityMappingType treatTargetType)
- Specified by:
visitSubParts
in interfaceModelPartContainer
-
breakDownJdbcValues
public <X,Y> int breakDownJdbcValues(Object domainValue, int offset, X x, Y y, ModelPart.JdbcValueBiConsumer<X,Y> valueConsumer, SharedSessionContractImplementor session)
Description copied from interface:ModelPart
Breaks down the domain value to its constituent JDBC values. Think of it as breaking the multi-dimensional array into a visitable flat array. Additionally, it passes through the valuesX
andY
to the consumer. Returns the amount of jdbc types that have been visited.- Specified by:
breakDownJdbcValues
in interfaceModelPart
-
disassemble
public Object disassemble(Object value, SharedSessionContractImplementor session)
- Specified by:
disassemble
in interfaceBindable
- See Also:
As an example, consider the following domain model: ````
-
addToCacheKey
public void addToCacheKey(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session)
Description copied from interface:Bindable
Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.- Specified by:
addToCacheKey
in interfaceBindable
- Parameters:
cacheKey
- the MutableCacheKey used to add the disassembled value and the hashCodevalue
- the value to disassemblesession
- the SharedSessionContractImplementor
-
forEachDisassembledJdbcValue
public <X,Y> int forEachDisassembledJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> valuesConsumer, SharedSessionContractImplementor session)
Description copied from interface:Bindable
LikeBindable.forEachDisassembledJdbcValue(Object, Object, Object, JdbcValuesBiConsumer, SharedSessionContractImplementor)
, but additionally receives an offset by which the selectionIndex is incremented when callingBindable.JdbcValuesBiConsumer.consume(int, Object, Object, Object, JdbcMapping)
.- Specified by:
forEachDisassembledJdbcValue
in interfaceBindable
-
forEachJdbcValue
public <X,Y> int forEachJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> valuesConsumer, SharedSessionContractImplementor session)
Description copied from interface:Bindable
Visit each constituent JDBC value extracted from the entity instance itself. Short-hand form of callingBindable.disassemble(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor)
and piping its result toBindable.forEachDisassembledJdbcValue(Object, int, JdbcValuesConsumer, SharedSessionContractImplementor)
- Specified by:
forEachJdbcValue
in interfaceBindable
-
addAttribute
protected void addAttribute(AttributeMapping attributeMapping)
-
getSelectableMappings
protected SelectableMappings getSelectableMappings()
-
initColumnMappings
protected boolean initColumnMappings()
-
buildGetterSetterCache
protected void buildGetterSetterCache()
-
-