- Type Parameters:
T- the record type.ID- the primary key type.
public interface ModelMapper<T extends Record,ID>
Maps a record to a set of columns.
- Since:
- 1.2
-
Method Summary
Modifier and TypeMethodDescriptionbooleanisDefaultValue(ID pk) Returnstrueif the given primary key is the default value,falseotherwise.Extracts the value for the specified column for the given record.default SequencedMap<Column, Object> Maps the values from the given record to a set of columns.Maps the values from the given record to a set of columns.static <T extends Record,ID>
ModelMapper<T, ID> Creates a new instance of the model mapper for the given model.
-
Method Details
-
of
Creates a new instance of the model mapper for the given model.- Type Parameters:
T- the record type.ID- the primary key type.- Parameters:
model- the model to map.- Returns:
- a new instance of the model mapper.
-
isDefaultValue
Returnstrueif the given primary key is the default value,falseotherwise.- Parameters:
pk- the primary key to check.- Returns:
trueif the given primary key is the default value,falseotherwise.
-
map
Extracts the value for the specified column for the given record.- Parameters:
column- the column to extract the value for.record- the record to extract the value from.- Returns:
- the value for the specified column for the given record.
- Throws:
SqlTemplateException- if an error occurs while extracting the value.
-
map
Maps the values from the given record to a set of columns.- Parameters:
record- the record to map.- Returns:
- the values from the given record to a set of columns.
- Throws:
SqlTemplateException- if an error occurs while extracting the values.
-
map
SequencedMap<Column,Object> map(@Nonnull T record, @Nonnull Predicate<Column> columnFilter) throws SqlTemplateException Maps the values from the given record to a set of columns.- Parameters:
record- the record to map.columnFilter- the filter to determine which columns to include.- Returns:
- the values from the given record to a set of columns.
- Throws:
SqlTemplateException- if an error occurs while extracting the values.
-