Class DefaultPropertyType<ENTITY,BASIC,CONTAINER>
- Type Parameters:
ENTITY- the entity typeBASIC- the property basic typeCONTAINER- the property container type
- All Implemented Interfaces:
EntityPropertyType<ENTITY,BASIC>
- Direct Known Subclasses:
AssignedIdPropertyType,GeneratedIdPropertyType,TenantIdPropertyType,VersionPropertyType
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected final ColumnTypeprotected final PropertyField<ENTITY>protected final booleanprotected final Stringprotected final NamingTypeprotected final Stringprotected final booleanprotected final Stringprotected final boolean -
Constructor Summary
ConstructorsConstructorDescriptionDefaultPropertyType(Class<ENTITY> entityClass, Supplier<Scalar<BASIC, CONTAINER>> scalarSupplier, String name, String columnName, NamingType namingType, boolean insertable, boolean updatable, boolean quoteRequired) DefaultPropertyType(Class<ENTITY> entityClass, Supplier<Scalar<BASIC, CONTAINER>> scalarSupplier, String name, String columnName, NamingType namingType, boolean insertable, boolean updatable, boolean quoteRequired, EmbeddedType embeddedType) DefaultPropertyType(Class<ENTITY> entityClass, Supplier<Scalar<BASIC, CONTAINER>> scalarSupplier, PropertyPath path, String columnName, NamingType namingType, boolean insertable, boolean updatable, boolean quoteRequired, EmbeddedType embeddedType) -
Method Summary
Modifier and TypeMethodDescriptionvoidCopies the value of this property from one entity instance to another.Creates a property instance for this property type.Returns the database column name that this property maps to.getColumnName(BiFunction<NamingType, String, String> namingFunction) Returns the database column name with naming convention applied.getColumnName(BiFunction<NamingType, String, String> namingFunction, Function<String, String> quoteFunction) Returns the database column name with both naming convention and quotation marks applied.getColumnName(Function<String, String> quoteFunction) Returns the database column name with optional quotation marks applied.getName()Returns the name of this property.booleanisId()Determines whether this property represents a primary key (identifier).booleanDetermines whether the column mapped to this property is included in SQL INSERT statements.booleanDetermines whether quotation marks are required for the column name.booleanDetermines whether this property represents a tenant identifier for multi-tenancy.booleanDetermines whether the column mapped to this property is included in SQL UPDATE statements.booleanDetermines whether this property represents a version column for optimistic locking.protected <VALUE> ENTITYmodifyIfNecessary(EntityType<ENTITY> entityType, ENTITY entity, WrapperVisitor<Boolean, VALUE, Void, RuntimeException> visitor, VALUE value)
-
Field Details
-
entityClass
-
scalarSupplier
-
name
-
simpleName
-
columnName
-
namingType
-
insertable
protected final boolean insertable -
updatable
protected final boolean updatable -
quoteRequired
protected final boolean quoteRequired -
field
-
prefix
-
columnType
-
-
Constructor Details
-
DefaultPropertyType
-
DefaultPropertyType
public DefaultPropertyType(Class<ENTITY> entityClass, Supplier<Scalar<BASIC, CONTAINER>> scalarSupplier, String name, String columnName, NamingType namingType, boolean insertable, boolean updatable, boolean quoteRequired, EmbeddedType embeddedType) -
DefaultPropertyType
public DefaultPropertyType(Class<ENTITY> entityClass, Supplier<Scalar<BASIC, CONTAINER>> scalarSupplier, PropertyPath path, String columnName, NamingType namingType, boolean insertable, boolean updatable, boolean quoteRequired, EmbeddedType embeddedType)
-
-
Method Details
-
createProperty
Description copied from interface:EntityPropertyTypeCreates a property instance for this property type.The created property instance can be used to get and set property values on entity instances, as well as to convert between entity property values and database column values.
- Specified by:
createPropertyin interfaceEntityPropertyType<ENTITY,BASIC> - Returns:
- a new property instance
- See Also:
-
copy
Description copied from interface:EntityPropertyTypeCopies the value of this property from one entity instance to another.This method performs a deep copy of the property value. However, it does not copy JDBC-specific objects such as
Blob,Clob, orSQLXML.This method is useful for creating copies of entity instances while preserving the values of their properties.
- Specified by:
copyin interfaceEntityPropertyType<ENTITY,BASIC> - Parameters:
destEntity- the entity instance that is the copy destinationsrcEntity- the entity instance that is the copy source
-
getName
Description copied from interface:EntityPropertyTypeReturns the name of this property.The property name typically corresponds to the field or method name in the entity class that is mapped to a database column.
- Specified by:
getNamein interfaceEntityPropertyType<ENTITY,BASIC> - Returns:
- the property name
-
getColumnName
Description copied from interface:EntityPropertyTypeReturns the database column name that this property maps to.The column name is determined based on the
Columnannotation if present, or derived from the property name using the entity's naming convention.- Specified by:
getColumnNamein interfaceEntityPropertyType<ENTITY,BASIC> - Returns:
- the database column name
- See Also:
-
getColumnName
Description copied from interface:EntityPropertyTypeReturns the database column name with optional quotation marks applied.This method allows customizing how quotation marks are applied to the column name, which is useful when generating SQL for different database dialects.
- Specified by:
getColumnNamein interfaceEntityPropertyType<ENTITY,BASIC> - Parameters:
quoteFunction- the function that applies quotation marks to the column name- Returns:
- the column name with quotation marks applied as specified
- See Also:
-
getColumnName
Description copied from interface:EntityPropertyTypeReturns the database column name with naming convention applied.This method allows customizing how naming conventions are applied to the column name, which is useful when generating SQL for different database naming styles.
- Specified by:
getColumnNamein interfaceEntityPropertyType<ENTITY,BASIC> - Parameters:
namingFunction- the function that applies naming convention to the column name- Returns:
- the column name with naming convention applied
- See Also:
-
getColumnName
public String getColumnName(BiFunction<NamingType, String, String> namingFunction, Function<String, String> quoteFunction) Description copied from interface:EntityPropertyTypeReturns the database column name with both naming convention and quotation marks applied.This method combines the functionality of
EntityPropertyType.getColumnName(BiFunction)andEntityPropertyType.getColumnName(Function)to apply both naming conventions and quotation marks to the column name.- Specified by:
getColumnNamein interfaceEntityPropertyType<ENTITY,BASIC> - Parameters:
namingFunction- the function that applies naming convention to the column namequoteFunction- the function that applies quotation marks to the column name- Returns:
- the column name with both naming convention and quotation marks applied
- See Also:
-
isQuoteRequired
public boolean isQuoteRequired()Description copied from interface:EntityPropertyTypeDetermines whether quotation marks are required for the column name.This method indicates if the column name should be quoted in SQL statements, which is typically needed for reserved words or column names with special characters.
- Specified by:
isQuoteRequiredin interfaceEntityPropertyType<ENTITY,BASIC> - Returns:
trueif quotation marks are required,falseotherwise- See Also:
-
isId
public boolean isId()Description copied from interface:EntityPropertyTypeDetermines whether this property represents a primary key (identifier).This method indicates if the property is annotated with
Id, which marks it as a primary key column in the database table.- Specified by:
isIdin interfaceEntityPropertyType<ENTITY,BASIC> - Returns:
trueif this property is a primary key,falseotherwise- See Also:
-
isVersion
public boolean isVersion()Description copied from interface:EntityPropertyTypeDetermines whether this property represents a version column for optimistic locking.This method indicates if the property is annotated with
Version, which marks it as a version column used for optimistic concurrency control.- Specified by:
isVersionin interfaceEntityPropertyType<ENTITY,BASIC> - Returns:
trueif this property is a version column,falseotherwise- See Also:
-
isTenantId
public boolean isTenantId()Description copied from interface:EntityPropertyTypeDetermines whether this property represents a tenant identifier for multi-tenancy.This method indicates if the property is annotated with
TenantId, which marks it as a tenant identifier column used for multi-tenant database access.- Specified by:
isTenantIdin interfaceEntityPropertyType<ENTITY,BASIC> - Returns:
trueif this property is a tenant identifier,falseotherwise- See Also:
-
isInsertable
public boolean isInsertable()Description copied from interface:EntityPropertyTypeDetermines whether the column mapped to this property is included in SQL INSERT statements.This method indicates if the property should be included when generating INSERT statements. Properties may be excluded from INSERT statements if they are auto-generated or should not be explicitly set.
- Specified by:
isInsertablein interfaceEntityPropertyType<ENTITY,BASIC> - Returns:
trueif the property is included in SQL INSERT statements,falseotherwise- See Also:
-
isUpdatable
public boolean isUpdatable()Description copied from interface:EntityPropertyTypeDetermines whether the column mapped to this property is included in SQL UPDATE statements.This method indicates if the property should be included when generating UPDATE statements. Properties may be excluded from UPDATE statements if they are read-only or should not be modified after creation.
- Specified by:
isUpdatablein interfaceEntityPropertyType<ENTITY,BASIC> - Returns:
trueif the property is included in SQL UPDATE statements,falseotherwise- See Also:
-
modifyIfNecessary
protected <VALUE> ENTITY modifyIfNecessary(EntityType<ENTITY> entityType, ENTITY entity, WrapperVisitor<Boolean, VALUE, Void, RuntimeException> visitor, VALUE value)
-