Package org.fastnate.generator.context
Class MapProperty<E,K,T>
java.lang.Object
org.fastnate.generator.context.Property<E,Map<K,T>>
org.fastnate.generator.context.PluralProperty<E,Map<K,T>,T>
org.fastnate.generator.context.MapProperty<E,K,T>
- Type Parameters:
E- The type of the container entityK- The type of the key of the mapT- The type of the entity inside of the collection
Describes a property of an
EntityClass that is a Map.- Author:
- Tobias Liefke
-
Nested Class Summary
Nested classes/interfaces inherited from class org.fastnate.generator.context.PluralProperty
PluralProperty.EntityMappingInformation -
Field Summary
FieldsModifier and TypeFieldDescriptionThe class of the key of the map.private final GeneratorColumnThe name of the column that contains the key.private final ValueConverter<K> The converter for the target value,nullif not a primitive value.private final EntityClass<K> The description of the key class,nullif not an entity. -
Constructor Summary
ConstructorsConstructorDescriptionMapProperty(EntityClass<?> sourceClass, AttributeAccessor attribute, jakarta.persistence.AssociationOverride associationOverride, jakarta.persistence.AttributeOverride attributeOverride) Creates a new map property. -
Method Summary
Modifier and TypeMethodDescriptionprivate static GeneratorColumnbuildKeyColumn(GeneratorTable table, jakarta.persistence.MapKeyColumn keyColumn, String defaultKeyColumn) private static GeneratorColumnbuildKeyColumn(GeneratorTable table, jakarta.persistence.MapKeyJoinColumn keyColumn, String defaultKeyColumn) voidcreatePostInsertStatements(StatementsWriter writer, E entity) Creates additional SQL statements that are necessary after this property is written (e.g. for mapping tables).Collection<?> findReferencedEntities(E entity) Finds all entities in the current property, that are referenced.The class of the key of the map.The name of the column that contains the key.The converter for the target value,nullif not a primitive value.The description of the key class,nullif not an entity.Resolves the current value for this property on the given entity.static booleanisMapProperty(AttributeAccessor attribute) Indicates that the given attribute references a map and may be used by anMapProperty.Methods inherited from class org.fastnate.generator.context.PluralProperty
addInsertExpression, buildEmbeddedProperties, buildIdColumn, createDirectValueStatement, createValueExpression, createValueStatement, findEntityMappingInformation, generatePendingStatements, getContext, getDialect, getEmbeddedProperties, getEmbeddedPropertiesByName, getIdColumn, getInverseProperty, getMappedBy, getMappedId, getPropertyArgument, getRequiredEmbeddedProperties, getTable, getValueClass, getValueColumn, getValueConstructor, getValueConverter, getValueEntityClass, hasPluralAnnotation, isComposition, isEmbedded, isEntityReference, isRequired, isTableColumn, isUseTargetTable, newElement, writeValueExpressionMethods inherited from class org.fastnate.generator.context.Property
createPreInsertStatements, failIfRequired, getAttribute, getExpression, getName, getPredicate, getType, isComposition, setValue, toString
-
Field Details
-
keyClass
The class of the key of the map. -
keyEntityClass
The description of the key class,nullif not an entity. -
keyConverter
The converter for the target value,nullif not a primitive value. -
keyColumn
The name of the column that contains the key.
-
-
Constructor Details
-
MapProperty
public MapProperty(EntityClass<?> sourceClass, AttributeAccessor attribute, jakarta.persistence.AssociationOverride associationOverride, jakarta.persistence.AttributeOverride attributeOverride) Creates a new map property.- Parameters:
sourceClass- the description of the current inspected class that contains this propertyattribute- the accessor of the represented attributeassociationOverride- the configured assocation overrideattributeOverride- the configured attribute override, if we reference anElementCollection
-
-
Method Details
-
buildKeyColumn
private static GeneratorColumn buildKeyColumn(GeneratorTable table, jakarta.persistence.MapKeyColumn keyColumn, String defaultKeyColumn) -
buildKeyColumn
private static GeneratorColumn buildKeyColumn(GeneratorTable table, jakarta.persistence.MapKeyJoinColumn keyColumn, String defaultKeyColumn) -
isMapProperty
Indicates that the given attribute references a map and may be used by anMapProperty.- Parameters:
attribute- the attribute to check- Returns:
trueif anMapPropertymay be created for the given attribute
-
createPostInsertStatements
Description copied from class:PropertyCreates additional SQL statements that are necessary after this property is written (e.g. for mapping tables).- Overrides:
createPostInsertStatementsin classProperty<E,Map<K, T>> - Parameters:
writer- the target of the created statementsentity- the inspected entity- Throws:
IOException- if the writer throws one
-
findReferencedEntities
Description copied from class:PropertyFinds all entities in the current property, that are referenced. -
getValue
Description copied from class:PropertyResolves the current value for this property on the given entity. -
getKeyClass
The class of the key of the map. -
getKeyEntityClass
The description of the key class,nullif not an entity. -
getKeyConverter
The converter for the target value,nullif not a primitive value. -
getKeyColumn
The name of the column that contains the key.- Specified by:
getKeyColumnin classPluralProperty<E,Map<K, T>, T> - Returns:
- the key column for map properties resp. the index column for list properties
-