Package io.zeko.model
Class MapperConfig
-
- All Implemented Interfaces:
public final class MapperConfigMapperConfig is a wrapper for the table relationship info (hash map) to be pass into a DataMapper instance for mapping objects
-
-
Field Summary
Fields Modifier and Type Field Description private LinkedHashMap<String, TableInfo>tableInfoprivate StringlatestTableprivate StringdefaultPrimaryKeyprivate BooleanautoRemoveLinkKey
-
Constructor Summary
Constructors Constructor Description MapperConfig(String defaultPrimaryKey, Boolean autoRemoveLinkKey)
-
Method Summary
Modifier and Type Method Description final LinkedHashMap<String, TableInfo>getTableInfo()Underlying configuration hashmap that stores the table name and its relationship/field information final UnitsetTableInfo(LinkedHashMap<String, TableInfo> tableInfo)Underlying configuration hashmap that stores the table name and its relationship/field information final StringgetLatestTable()latest table that is added to the configuration via table() final UnitsetLatestTable(String latestTable)latest table that is added to the configuration via table() final StringgetDefaultPrimaryKey()Default primary such as ID field final UnitsetDefaultPrimaryKey(String defaultPrimaryKey)Default primary such as ID field final BooleangetAutoRemoveLinkKey()Indicate to automatically remove key that links two object/table together final UnitsetAutoRemoveLinkKey(Boolean autoRemoveLinkKey)Indicate to automatically remove key that links two object/table together final MapperConfigdefaultPrimaryKeyTo(String defaultPrimaryKey)final MapperConfigshouldRemoveLinkKey(Boolean autoRemoveLinkKey)final MapperConfigtable(String tableName)final MapperConfigtable(String tableName, String defaultPrimaryKey)final TableInfocurrentTable()final MapperConfigremoveLinkKey()final MapperConfigremove(Object fieldName)final MapperConfigprimaryKey(String fieldName)final MapperConfigrename(String tableName)final MapperConfigforeignKey(String fieldName)final MapperConfigoneToOne(Boolean bool)final MapperConfigmanyToMany(Boolean bool)final MapperConfigoneToMany(Boolean bool)final MapperConfigmanyToOne(Boolean bool)final MapperConfigmoveUnder(String fieldName)final MapperConfigmapTo(Function1<Map<String, Object>, Object> dataClassHandler)final LinkedHashMap<String, TableInfo>toArrayMap()final LinkedHashMap<String, TableInfo>toTableInfo()final LinkedHashMap<String, TableInfo>sortTableInfo(LinkedHashMap<String, TableInfo> tables)-
-
Method Detail
-
getTableInfo
final LinkedHashMap<String, TableInfo> getTableInfo()
Underlying configuration hashmap that stores the table name and its relationship/field information
-
setTableInfo
final Unit setTableInfo(LinkedHashMap<String, TableInfo> tableInfo)
Underlying configuration hashmap that stores the table name and its relationship/field information
-
getLatestTable
final String getLatestTable()
latest table that is added to the configuration via table()
-
setLatestTable
final Unit setLatestTable(String latestTable)
latest table that is added to the configuration via table()
-
getDefaultPrimaryKey
final String getDefaultPrimaryKey()
Default primary such as ID field
-
setDefaultPrimaryKey
final Unit setDefaultPrimaryKey(String defaultPrimaryKey)
Default primary such as ID field
-
getAutoRemoveLinkKey
final Boolean getAutoRemoveLinkKey()
Indicate to automatically remove key that links two object/table together
-
setAutoRemoveLinkKey
final Unit setAutoRemoveLinkKey(Boolean autoRemoveLinkKey)
Indicate to automatically remove key that links two object/table together
-
defaultPrimaryKeyTo
final MapperConfig defaultPrimaryKeyTo(String defaultPrimaryKey)
- Parameters:
defaultPrimaryKey- set default primary such as common id field
-
shouldRemoveLinkKey
final MapperConfig shouldRemoveLinkKey(Boolean autoRemoveLinkKey)
- Parameters:
autoRemoveLinkKey- set true to remove foreign key that is linking the two tables
-
table
final MapperConfig table(String tableName)
-
table
final MapperConfig table(String tableName, String defaultPrimaryKey)
-
currentTable
final TableInfo currentTable()
-
removeLinkKey
final MapperConfig removeLinkKey()
-
remove
final MapperConfig remove(Object fieldName)
-
primaryKey
final MapperConfig primaryKey(String fieldName)
-
rename
final MapperConfig rename(String tableName)
-
foreignKey
final MapperConfig foreignKey(String fieldName)
-
oneToOne
final MapperConfig oneToOne(Boolean bool)
-
manyToMany
final MapperConfig manyToMany(Boolean bool)
-
oneToMany
final MapperConfig oneToMany(Boolean bool)
-
manyToOne
final MapperConfig manyToOne(Boolean bool)
-
moveUnder
final MapperConfig moveUnder(String fieldName)
-
toArrayMap
final LinkedHashMap<String, TableInfo> toArrayMap()
-
toTableInfo
final LinkedHashMap<String, TableInfo> toTableInfo()
-
sortTableInfo
final LinkedHashMap<String, TableInfo> sortTableInfo(LinkedHashMap<String, TableInfo> tables)
-
-
-
-