Class UpsertAssemblerSupport

java.lang.Object
org.seasar.doma.jdbc.query.UpsertAssemblerSupport

public class UpsertAssemblerSupport extends Object
Support class for assembling UPSERT SQL statements. Provides utilities for handling table and column names with different formatting options.
  • Constructor Details

    • UpsertAssemblerSupport

      public UpsertAssemblerSupport(Naming naming, Dialect dialect)
      Creates a new instance with default alias constants.
      Parameters:
      naming - the naming convention
      dialect - the SQL dialect
    • UpsertAssemblerSupport

      public UpsertAssemblerSupport(Naming naming, Dialect dialect, UpsertAssemblerSupport.UpsertAliasConstants aliasConstants)
      Creates a new instance with the specified alias constants.
      Parameters:
      naming - the naming convention
      dialect - the SQL dialect
      aliasConstants - the constants for table aliases
  • Method Details

    • targetTable

      public String targetTable(EntityType<?> entityType, UpsertAssemblerSupport.TableNameType tableNameType)
      Formats a table name based on the specified entity type and table name type.
      Parameters:
      entityType - the entity type
      tableNameType - the table name formatting type
      Returns:
      the formatted table name
      Throws:
      IllegalArgumentException - if the table name type is unknown
    • targetTable

      public String targetTable(List<EntityPropertyType<?,?>> entityPropertyTypes, UpsertAssemblerSupport.TableNameType tableNameType)
      Formats a table name based on the specified entity property types and table name type.
      Parameters:
      entityPropertyTypes - the entity property types
      tableNameType - the table name formatting type
      Returns:
      the formatted table name
      Throws:
      UnsupportedOperationException - if the table name type is NAME or NAME_ALIAS
      IllegalArgumentException - if the table name type is unknown
    • targetProp

      public String targetProp(EntityPropertyType<?,?> propertyType, UpsertAssemblerSupport.ColumnNameType columnNameType)
      Formats a property name for the target table based on the specified property type and column name type.
      Parameters:
      propertyType - the entity property type
      columnNameType - the column name formatting type
      Returns:
      the formatted property name
      Throws:
      IllegalArgumentException - if the column name type is unknown
    • excludeAlias

      public String excludeAlias()
      Gets the alias for the excluded table.
      Returns:
      the excluded table alias
    • excludeProp

      public String excludeProp(EntityPropertyType<?,?> propertyType, UpsertAssemblerSupport.ColumnNameType columnNameType)
      Formats a property name for the excluded table based on the specified property type and column name type.
      Parameters:
      propertyType - the entity property type
      columnNameType - the column name formatting type
      Returns:
      the formatted property name
      Throws:
      IllegalArgumentException - if the column name type is unknown
    • prop

      public String prop(EntityPropertyType<?,?> propertyType)
      Gets the column name for the specified property type.
      Parameters:
      propertyType - the entity property type
      Returns:
      the column name
    • param

      public InParameter<?> param(EntityPropertyType<?,?> propertyType, Map<EntityPropertyType<?,?>,InParameter<?>> values)
      Gets the input parameter for the specified property type from the values map.
      Parameters:
      propertyType - the entity property type
      values - the map of property types to input parameters
      Returns:
      the input parameter for the property type, or null if not found