E
- The type of the container classC
- The type of the collection of mapT
- The type of the elements in the collectionpublic abstract class PluralProperty<E,C,T> extends Property<E,C>
MapProperty
and CollectionProperty
.Constructor and Description |
---|
PluralProperty(GeneratorContext context,
AttributeAccessor attribute)
Creates a new property.
|
Modifier and Type | Method and Description |
---|---|
void |
addInsertExpression(E entity,
InsertStatement statement)
Adds an expression according to the current value of the property for the given entity to an SQL insert
statement.
|
protected void |
buildEmbeddedProperties(Class<?> targetType)
Builds the embedded properties of this property.
|
protected static String |
buildIdColumn(AttributeAccessor attribute,
javax.persistence.AssociationOverride override,
javax.persistence.CollectionTable collectionMetadata,
String defaultIdColumn)
Builds the name of the column that contains the ID of the entity for the given attribute.
|
protected static String |
buildIdColumn(AttributeAccessor attribute,
javax.persistence.AssociationOverride override,
javax.persistence.JoinTable joinTable,
javax.persistence.CollectionTable tableMetadata,
String defaultIdColumn)
Builds the name of the column that contains the ID of the entity for the given attribute.
|
protected static String |
buildTableName(AttributeAccessor attribute,
javax.persistence.AssociationOverride override,
javax.persistence.JoinTable joinTable,
javax.persistence.CollectionTable collectionTable,
String defaultTableName)
Builds the name of the table of the association for the given field.
|
protected static String |
buildTableName(javax.persistence.CollectionTable tableMetadata,
String defaultTableName)
Builds the name of the table of the association for the given field.
|
protected static String |
buildValueColumn(AttributeAccessor attribute,
String defaultValueColumn)
Builds the name of the column that contains the value for the collection / map.
|
abstract String |
getIdColumn()
The name of the column that contains the ID of the entity that contains this collection.
|
protected static <T> Class<T> |
getPropertyArgument(AttributeAccessor attribute,
Class<T> explicitClass,
int argumentIndex)
Inspects the given attribute and searches for a generic type argument.
|
abstract String |
getTable()
The name of the table of this property, if any.
|
abstract String |
getValueColumn()
The name of the column that contains the values of the collection.
|
boolean |
isEmbedded()
Indicates that this propery is a
ElementCollection that references Embeddable s. |
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.
|
createPostInsertStatements, createPreInsertStatements, failIfRequired, findReferencedEntities, generatePendingStatements, getExpression, getName, getPredicate, getValue, setValue, toString
public PluralProperty(GeneratorContext context, AttributeAccessor attribute)
context
- the current contextattribute
- accessor to the represented attributeprotected static String buildIdColumn(AttributeAccessor attribute, javax.persistence.AssociationOverride override, javax.persistence.CollectionTable collectionMetadata, String defaultIdColumn)
attribute
- the accessor for the inspected attributeoverride
- contains optional override optionscollectionMetadata
- the default join columndefaultIdColumn
- the default name for the column, if joinColumn
is empty or null
protected static String buildIdColumn(AttributeAccessor attribute, javax.persistence.AssociationOverride override, javax.persistence.JoinTable joinTable, javax.persistence.CollectionTable tableMetadata, String defaultIdColumn)
attribute
- the inspected attributeoverride
- contains optional override optionsjoinTable
- the optional join table datetableMetadata
- the optionaldefaultIdColumn
- the default name for the column, if joinColumn
is empty or null
protected static String buildTableName(AttributeAccessor attribute, javax.persistence.AssociationOverride override, javax.persistence.JoinTable joinTable, javax.persistence.CollectionTable collectionTable, String defaultTableName)
attribute
- the inspected fieldoverride
- contains optional override optionsjoinTable
- the optional join tablecollectionTable
- the optional metadata of the tabledefaultTableName
- the default name for the tableprotected static String buildTableName(javax.persistence.CollectionTable tableMetadata, String defaultTableName)
tableMetadata
- the current metadata of the fielddefaultTableName
- the default name for the tableprotected static String buildValueColumn(AttributeAccessor attribute, String defaultValueColumn)
attribute
- the inspected attributedefaultValueColumn
- the default nameprotected static <T> Class<T> getPropertyArgument(AttributeAccessor attribute, Class<T> explicitClass, int argumentIndex)
attribute
- the attribute to inspectexplicitClass
- an explicit class to use, if the metadata specified oneargumentIndex
- the index of the argument, for maps there are two: the key and the valuepublic void addInsertExpression(E entity, InsertStatement statement)
Property
addInsertExpression
in class Property<E,C>
entity
- the inspected entitystatement
- the created statementprotected void buildEmbeddedProperties(Class<?> targetType)
targetType
- the target typepublic abstract String getIdColumn()
public abstract String getTable()
public abstract String getValueColumn()
null
if embedded
public boolean isEmbedded()
ElementCollection
that references Embeddable
s.#getEmbeddedProperties()
returns a list of propertiespublic boolean isRequired()
Property
isRequired
in class Property<E,C>
true
if the field is requiredpublic boolean isTableColumn()
Property
isTableColumn
in class Property<E,C>
true
if Property.addInsertExpression(Object, InsertStatement)
will add the corresponding value to
the given statementCopyright © 2016 fastnate.org. All rights reserved.