Package org.fastnate.generator.context
Class CollectionProperty<E,T>
java.lang.Object
org.fastnate.generator.context.Property<E,Collection<T>>
org.fastnate.generator.context.PluralProperty<E,Collection<T>,T>
org.fastnate.generator.context.CollectionProperty<E,T>
- Type Parameters:
E- The type of the container entityT- The type of the entity inside of the collection
Describes a property of an
EntityClass that contains more than one value.- Author:
- Tobias Liefke
-
Nested Class Summary
Nested classes/interfaces inherited from class org.fastnate.generator.context.PluralProperty
PluralProperty.EntityMappingInformation -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final GeneratorColumnThe name of the column that saves the order of the entries in the collection. -
Constructor Summary
ConstructorsConstructorDescriptionCollectionProperty(EntityClass<?> sourceClass, AttributeAccessor attribute, jakarta.persistence.AssociationOverride associationOverride, jakarta.persistence.AttributeOverride attributeOverride) Creates a new collection property. -
Method Summary
Modifier and TypeMethodDescriptionvoidcreatePostInsertStatements(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.protected GeneratorColumnAn optional column that contains the index / key of the values.The name of the column that saves the order of the entries in the collection.Resolves the current value for this property on the given entity.static booleanisCollectionProperty(AttributeAccessor attribute) Indicates that the given attribute references a collection and may be used by anCollectionProperty.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
-
orderColumn
The name of the column that saves the order of the entries in the collection.
-
-
Constructor Details
-
CollectionProperty
public CollectionProperty(EntityClass<?> sourceClass, AttributeAccessor attribute, jakarta.persistence.AssociationOverride associationOverride, jakarta.persistence.AttributeOverride attributeOverride) Creates a new collection property.- Parameters:
sourceClass- the description of the current inspected class that contains this propertyattribute- accessor to the represented attributeassociationOverride- the configured assocation overrideattributeOverride- the configured attribute override, if we reference anElementCollection
-
-
Method Details
-
isCollectionProperty
Indicates that the given attribute references a collection and may be used by anCollectionProperty.- Parameters:
attribute- the attribute to check- Returns:
trueif anCollectionPropertymay 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,Collection<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.- Overrides:
findReferencedEntitiesin classProperty<E,Collection<T>> - Parameters:
entity- the inspected entity- Returns:
- all referenced entities
-
getKeyColumn
Description copied from class:PluralPropertyAn optional column that contains the index / key of the values.- Specified by:
getKeyColumnin classPluralProperty<E,Collection<T>, T> - Returns:
- the key column for map properties resp. the index column for list properties
-
getValue
Description copied from class:PropertyResolves the current value for this property on the given entity.- Overrides:
getValuein classProperty<E,Collection<T>> - Parameters:
entity- the entity to inspect- Returns:
- the value,
nullif entity isnull
-
getOrderColumn
The name of the column that saves the order of the entries in the collection.
-