E
- The type of the container class (the entity or parent embeddable)T
- The type of the embeddable objectpublic class EmbeddedProperty<E,T> extends Property<E,T>
Embeddable
s.Modifier and Type | Field and Description |
---|---|
private Constructor<T> |
constructor |
private Map<String,Property<? super T,?>> |
embeddedProperties
The properties within the embedded object.
|
private boolean |
id |
Constructor and Description |
---|
EmbeddedProperty(EntityClass<?> entityClass,
GeneratorTable table,
AttributeAccessor attribute,
Map<String,javax.persistence.AttributeOverride> surroundingAttributeOverrides,
Map<String,javax.persistence.AssociationOverride> surroundingAssociationOverrides)
Instantiates a new embedded property.
|
Modifier and Type | Method and Description |
---|---|
void |
addInsertExpression(TableStatement statement,
E entity)
Adds an expression according to the current value of the property for the given entity to an SQL insert
statement.
|
void |
createPostInsertStatements(StatementsWriter writer,
E entity)
Creates additional SQL statements that are necessary after this property is written (e.g. for mapping tables).
|
void |
createPreInsertStatements(StatementsWriter writer,
E entity)
Creates SQL statements that are necessary before this property is written (e.g. for updating the table
generator).
|
Collection<?> |
findReferencedEntities(E entity)
Finds all entities in the current property, that are referenced.
|
Map<String,Property<? super T,?>> |
getEmbeddedProperties()
The properties within the embedded object.
|
T |
getInitializedValue(E entity)
Ensures that the property of the given entity is initialized.
|
String |
getPredicate(E entity)
Creates an SQL predicate that references all entities that have the same value as the given entity.
|
boolean |
isId() |
boolean |
isRequired()
Indicates if this property is an required field in the database (needs to exist when the insert statement is
written).
|
boolean |
isTableColumn()
Indicates that this property maps to a column from the parent table.
|
failIfRequired, generatePendingStatements, getAttribute, getExpression, getName, getType, getValue, isComposition, setValue, toString
private final Map<String,Property<? super T,?>> embeddedProperties
private final boolean id
@Nonnull private final Constructor<T> constructor
public EmbeddedProperty(EntityClass<?> entityClass, GeneratorTable table, AttributeAccessor attribute, Map<String,javax.persistence.AttributeOverride> surroundingAttributeOverrides, Map<String,javax.persistence.AssociationOverride> surroundingAssociationOverrides)
entityClass
- the surrounding entity classtable
- the table that contains the attributeattribute
- the attribute that contains the embedded objectsurroundingAttributeOverrides
- the attribute overrides of the surrounding entity class or embedded property (if we are nested)surroundingAssociationOverrides
- the association overrides of the surrounding entity class or embedded property (if we are nested)public void addInsertExpression(TableStatement statement, E entity)
Property
addInsertExpression
in class Property<E,T>
statement
- the created statemententity
- the inspected entitypublic void createPostInsertStatements(StatementsWriter writer, E entity) throws IOException
Property
createPostInsertStatements
in class Property<E,T>
writer
- the target of the created statementsentity
- the inspected entityIOException
- if the writer throws onepublic void createPreInsertStatements(StatementsWriter writer, E entity) throws IOException
Property
createPreInsertStatements
in class Property<E,T>
writer
- the target of the created statementsentity
- the inspected entityIOException
- if the writer throws an exceptionpublic Collection<?> findReferencedEntities(E entity)
Property
findReferencedEntities
in class Property<E,T>
entity
- the inspected entitypublic T getInitializedValue(E entity)
null
value, the property is assigned with a new object using the noargs
constructor.entity
- the entity to initializepublic String getPredicate(E entity)
Property
getPredicate
in class Property<E,T>
entity
- the entitynull
if no such expression is availablepublic boolean isRequired()
Property
isRequired
in class Property<E,T>
true
if the field is requiredpublic boolean isTableColumn()
Property
isTableColumn
in class Property<E,T>
true
if Property.addInsertExpression(org.fastnate.generator.statements.TableStatement, E)
will add the corresponding value to the given statement@Generated(value="lombok") public Map<String,Property<? super T,?>> getEmbeddedProperties()
@Generated(value="lombok") public boolean isId()
Copyright © 2022 fastnate.org. All rights reserved.