Package com.valqueries.automapper
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 Summary
FieldsModifier and TypeFieldDescriptionprotected List<Consumer<IStatement>>
protected final List<List<Consumer<IStatement>>>
Fields inherited from class com.valqueries.automapper.ValqueriesColumnizer
dialect, fields, fieldsWithoutKeys, key, keys
-
Constructor Summary
ConstructorsConstructorDescriptionCompoundColumnizer
(MappingHelper mappingHelper, Collection<T> ts, SqlDialect dialect) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
add
(Property property, Consumer<IStatement> consumer) void
addExtraValue
(String snake_case, Object value) Gets all the columns that are used in this model.int
Used by new approach to avoid putting value tokens into the SQL string and then extracting them again.int
Used by new approach to avoid putting value tokens into the SQL string and then extracting them again.Represents all the unique key sets that are used in the compound statement, excluding the primary key.Used by new approach to avoid putting value tokens into the SQL string and then extracting them again.Represents the primary key that is used in the compound statement.int
void
Removes the first column of the primary key.void
set
(IStatement statement) protected String
protected String
transformFieldPlaceholder
(String snakeCaseKey) Methods inherited from class com.valqueries.automapper.ValqueriesColumnizer
getFields, getFieldsWithoutKeys, getKeys, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, transformKey
-
Field Details
-
statements
-
currentStatements
-
-
Constructor Details
-
CompoundColumnizer
-
-
Method Details
-
set
- Specified by:
set
in interfaceSetter
- Overrides:
set
in classValqueriesColumnizer
-
transformFieldPlaceholder
- Overrides:
transformFieldPlaceholder
in classValqueriesColumnizer
-
transformFieldPlaceholder
-
add
- Overrides:
add
in classValqueriesColumnizer
-
addExtraValue
-
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
-
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
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
-
getPrimaryKey
Represents the primary key that is used in the compound statement. It consists of fields that are annotated withPrimaryKey
)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
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
-
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.
-