Interface EntityPropertyType<ENTITY,BASIC>
- Type Parameters:
ENTITY- the entity type that contains this propertyBASIC- the basic type that represents the property's value
- All Known Implementing Classes:
AssignedIdPropertyType,DefaultPropertyType,GeneratedIdPropertyType,TenantIdPropertyType,VersionPropertyType
This interface defines methods for accessing property metadata, such as property name, column name, and various property characteristics (ID, version, etc.). It also provides methods for creating property instances and copying property values.
Implementations of this interface are typically generated at compile time by the Doma
annotation processor based on Entity annotated classes.
This instance is not required to be thread safe.
-
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.
-
Method Details
-
getName
String getName()Returns 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.
- Returns:
- the property name
-
getColumnName
String getColumnName()Returns 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.- Returns:
- the database column name
- See Also:
-
getColumnName
Returns 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.
- 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
Returns 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.
- Parameters:
namingFunction- the function that applies naming convention to the column name- Returns:
- the column name with naming convention applied
- See Also:
-
getColumnName
String getColumnName(BiFunction<NamingType, String, String> namingFunction, Function<String, String> quoteFunction) Returns the database column name with both naming convention and quotation marks applied.This method combines the functionality of
getColumnName(BiFunction)andgetColumnName(Function)to apply both naming conventions and quotation marks to the column name.- 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
boolean isQuoteRequired()Determines 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.
- Returns:
trueif quotation marks are required,falseotherwise- See Also:
-
isId
boolean isId()Determines 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.- Returns:
trueif this property is a primary key,falseotherwise- See Also:
-
isVersion
boolean isVersion()Determines 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.- Returns:
trueif this property is a version column,falseotherwise- See Also:
-
isTenantId
boolean isTenantId()Determines 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.- Returns:
trueif this property is a tenant identifier,falseotherwise- See Also:
-
isInsertable
boolean isInsertable()Determines 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.
- Returns:
trueif the property is included in SQL INSERT statements,falseotherwise- See Also:
-
isUpdatable
boolean isUpdatable()Determines 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.
- Returns:
trueif the property is included in SQL UPDATE statements,falseotherwise- See Also:
-
createProperty
Creates 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.
- Returns:
- a new property instance
- See Also:
-
copy
Copies 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.
- Parameters:
dest- the entity instance that is the copy destinationsrc- the entity instance that is the copy source
-