Class CompoundColumnizer<T>

java.lang.Object
com.valqueries.automapper.ValqueriesColumnizer
com.valqueries.automapper.CompoundColumnizer<T>
All Implemented Interfaces:
Setter, ObjectMapColumnizer

public class CompoundColumnizer<T> extends ValqueriesColumnizer implements Setter, ObjectMapColumnizer
  • Field Details

  • Constructor Details

  • Method Details

    • set

      public void set(IStatement statement)
      Specified by:
      set in interface Setter
      Overrides:
      set in class ValqueriesColumnizer
    • transformFieldPlaceholder

      protected String transformFieldPlaceholder(Property key)
      Overrides:
      transformFieldPlaceholder in class ValqueriesColumnizer
    • transformFieldPlaceholder

      protected String transformFieldPlaceholder(String snakeCaseKey)
    • add

      protected void add(Property property, Consumer<IStatement> consumer)
      Overrides:
      add in class ValqueriesColumnizer
    • addExtraValue

      public void addExtraValue(String snake_case, Object value)
    • getColumns

      public Set<String> getColumns()
      Gets all the columns that are used in this model.

      All columns are returned, including primary keys.

      The names returned are columnized names, not the actual field names.

      Returns:
      A set of column names.
    • getValueTokens

      public List<List<String>> getValueTokens()
    • getElementCount

      public int getElementCount()
      Used by new approach to avoid putting value tokens into the SQL string and then extracting them again.
      Returns:
      returns the number of elements in the compound statement
    • getElementSize

      public int getElementSize()
      Used by new approach to avoid putting value tokens into the SQL string and then extracting them again.
      Returns:
      returns the number of tokens in each element of the compound statement
    • getParameters

      public List<String> getParameters()
      Used by new approach to avoid putting value tokens into the SQL string and then extracting them again.
      Returns:
      all the parameter names in order they would appear in the SQL string
    • getKeyToValueTokensMap

      public Map<String,List<String>> getKeyToValueTokensMap()
    • getPrimaryKey

      public KeySet getPrimaryKey()
      Represents the primary key that is used in the compound statement. It consists of fields that are annotated with PrimaryKey)

      The primary key set is a special category of keys that are used to uniquely identify a row in a table. There can only ever be a single primary key set. The primary key set is always unique as a whole, but the individual fields in the set may not be unique.

      Fields that are part of a primary key may also be part of other key sets.

      Returns:
      The KeySet that is used as primary key
    • getNonPrimaryUniqueKeys

      public List<KeySet> getNonPrimaryUniqueKeys()
      Represents all the unique key sets that are used in the compound statement, excluding the primary key.

      Unique keys consist of fields that are annotated Key(unique = true). (For compound keys, if any of the annotations is marked unique, the whole key set is considered unique.)

      Each element in the list represents a set of fields that are used together, as a single unique key.

      Returns:
      A list of KeySets that are used as unique keys
    • getPrimaryKeyFirstColumn

      public String getPrimaryKeyFirstColumn()
    • getPrimaryKeyFirstColumnIndex

      public int getPrimaryKeyFirstColumnIndex()
    • removePrimaryKeyFirstColumnAndTokens

      public void removePrimaryKeyFirstColumnAndTokens()
      Removes the first column of the primary key. Used when inserting into table with auto-increment primary key.