Class DefaultPropertyType<ENTITY,BASIC,CONTAINER>

java.lang.Object
org.seasar.doma.jdbc.entity.DefaultPropertyType<ENTITY,BASIC,CONTAINER>
Type Parameters:
ENTITY - the entity type
BASIC - the property basic type
CONTAINER - the property container type
All Implemented Interfaces:
EntityPropertyType<ENTITY,BASIC>
Direct Known Subclasses:
AssignedIdPropertyType, GeneratedIdPropertyType, TenantIdPropertyType, VersionPropertyType

public class DefaultPropertyType<ENTITY,BASIC,CONTAINER> extends Object implements EntityPropertyType<ENTITY,BASIC>
A description for a default property.
  • Field Details

    • entityClass

      protected final Class<ENTITY> entityClass
    • scalarSupplier

      protected final Supplier<Scalar<BASIC,CONTAINER>> scalarSupplier
    • name

      protected final String name
    • simpleName

      protected final String simpleName
    • columnName

      protected final String columnName
    • namingType

      protected final NamingType namingType
    • insertable

      protected final boolean insertable
    • updatable

      protected final boolean updatable
    • quoteRequired

      protected final boolean quoteRequired
    • field

      protected final PropertyField<ENTITY> field
    • prefix

      protected final String prefix
    • columnType

      protected final ColumnType columnType
  • Constructor Details

  • Method Details

    • createProperty

      public Property<ENTITY,BASIC> createProperty()
      Description copied from interface: EntityPropertyType
      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.

      Specified by:
      createProperty in interface EntityPropertyType<ENTITY,BASIC>
      Returns:
      a new property instance
      See Also:
    • copy

      public void copy(ENTITY destEntity, ENTITY srcEntity)
      Description copied from interface: EntityPropertyType
      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, or SQLXML.

      This method is useful for creating copies of entity instances while preserving the values of their properties.

      Specified by:
      copy in interface EntityPropertyType<ENTITY,BASIC>
      Parameters:
      destEntity - the entity instance that is the copy destination
      srcEntity - the entity instance that is the copy source
    • getName

      public String getName()
      Description copied from interface: EntityPropertyType
      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.

      Specified by:
      getName in interface EntityPropertyType<ENTITY,BASIC>
      Returns:
      the property name
    • getColumnName

      public String getColumnName()
      Description copied from interface: EntityPropertyType
      Returns the database column name that this property maps to.

      The column name is determined based on the Column annotation if present, or derived from the property name using the entity's naming convention.

      Specified by:
      getColumnName in interface EntityPropertyType<ENTITY,BASIC>
      Returns:
      the database column name
      See Also:
    • getColumnName

      public String getColumnName(Function<String,String> quoteFunction)
      Description copied from interface: EntityPropertyType
      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.

      Specified by:
      getColumnName in interface EntityPropertyType<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

      public String getColumnName(BiFunction<NamingType,String,String> namingFunction)
      Description copied from interface: EntityPropertyType
      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.

      Specified by:
      getColumnName in interface EntityPropertyType<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: EntityPropertyType
      Returns the database column name with both naming convention and quotation marks applied.

      This method combines the functionality of EntityPropertyType.getColumnName(BiFunction) and EntityPropertyType.getColumnName(Function) to apply both naming conventions and quotation marks to the column name.

      Specified by:
      getColumnName in interface EntityPropertyType<ENTITY,BASIC>
      Parameters:
      namingFunction - the function that applies naming convention to the column name
      quoteFunction - 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: EntityPropertyType
      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.

      Specified by:
      isQuoteRequired in interface EntityPropertyType<ENTITY,BASIC>
      Returns:
      true if quotation marks are required, false otherwise
      See Also:
    • isId

      public boolean isId()
      Description copied from interface: EntityPropertyType
      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.

      Specified by:
      isId in interface EntityPropertyType<ENTITY,BASIC>
      Returns:
      true if this property is a primary key, false otherwise
      See Also:
    • isVersion

      public boolean isVersion()
      Description copied from interface: EntityPropertyType
      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.

      Specified by:
      isVersion in interface EntityPropertyType<ENTITY,BASIC>
      Returns:
      true if this property is a version column, false otherwise
      See Also:
    • isTenantId

      public boolean isTenantId()
      Description copied from interface: EntityPropertyType
      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.

      Specified by:
      isTenantId in interface EntityPropertyType<ENTITY,BASIC>
      Returns:
      true if this property is a tenant identifier, false otherwise
      See Also:
    • isInsertable

      public boolean isInsertable()
      Description copied from interface: EntityPropertyType
      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.

      Specified by:
      isInsertable in interface EntityPropertyType<ENTITY,BASIC>
      Returns:
      true if the property is included in SQL INSERT statements, false otherwise
      See Also:
    • isUpdatable

      public boolean isUpdatable()
      Description copied from interface: EntityPropertyType
      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.

      Specified by:
      isUpdatable in interface EntityPropertyType<ENTITY,BASIC>
      Returns:
      true if the property is included in SQL UPDATE statements, false otherwise
      See Also:
    • modifyIfNecessary

      protected <VALUE> ENTITY modifyIfNecessary(EntityType<ENTITY> entityType, ENTITY entity, WrapperVisitor<Boolean,VALUE,Void,RuntimeException> visitor, VALUE value)