public abstract class Dialect
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Dialect.MigrationData
Data for a database migration
|
| Modifier and Type | Field and Description |
|---|---|
protected @NotNull DataManager |
dataManager
The
DataManager to use for database operations |
| Constructor and Description |
|---|
Dialect(@NotNull DataManager dataManager)
Construct a new
Dialect with the given DataManager |
| Modifier and Type | Method and Description |
|---|---|
@NotNull java.util.Optional<java.lang.String> |
getFromCache(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key)
Get a value from the cache
|
protected abstract @NotNull java.util.Optional<java.lang.String> |
getFromCacheImpl(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key)
Get a value from the cache
|
@NotNull java.util.Optional<java.lang.String> |
getFromDatabase(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key)
Get a value from the database
|
protected abstract @NotNull java.util.Optional<java.lang.String> |
getFromDatabaseImpl(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key)
Get a value from the database
|
@NotNull java.util.Optional<Dialect.MigrationData> |
getMigrationDataFromDatabase(@NotNull DataManager newManager)
Get migration data from the database
|
protected abstract @NotNull java.util.Optional<Dialect.MigrationData> |
getMigrationDataFromDatabaseImpl(@NotNull DataManager newManager)
Get migration data from the database
|
void |
removeFromCache(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key)
Remove a value from the cache
|
protected abstract void |
removeFromCacheImpl(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key)
Remove a value from the cache
|
protected abstract boolean |
removeFromDatabaseImpl(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key)
Remove a value from the database
|
boolean |
removeValueFromDatabase(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key)
Remove a value from the database
|
void |
saveCache()
Save all cache data to the database
|
void |
saveCache(@NotNull java.lang.String table,
@NotNull java.lang.String target)
Save a specific target in a table to the cache
|
protected abstract void |
saveCacheImpl()
Save all cache data to the database
|
protected abstract void |
saveCacheImpl(@NotNull java.lang.String table,
@NotNull java.lang.String target)
Save a specific target in a table to the cache
|
void |
setToCache(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key,
@Nullable java.lang.String value)
Set a value to the cache
|
protected abstract void |
setToCacheImpl(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key,
@NotNull java.lang.String value)
Set a value to the cache
|
@NotNull java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>> |
setToDatabase(@NotNull java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>> data)
Set multiple values to the database
|
boolean |
setToDatabase(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.util.Map<java.lang.String,java.lang.String> data)
Set a value to the database
|
boolean |
setToDatabase(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key,
@NotNull java.lang.String value)
Set a value to the database
|
protected abstract boolean |
setToDatabaseImpl(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.util.Map<java.lang.String,java.lang.String> data)
Set multiple values to the database
|
protected abstract boolean |
setToDatabaseImpl(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key,
@NotNull java.lang.String value)
Set a value to the database
|
@NotNull protected final @NotNull DataManager dataManager
DataManager to use for database operationspublic Dialect(@NotNull
@NotNull DataManager dataManager)
Dialect with the given DataManagerdataManager - dataManager@NotNull
public @NotNull java.util.Optional<java.lang.String> getFromCache(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key)
table - the table to get fromtarget - the target to get fromkey - the key to getpublic void setToCache(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key,
@Nullable
@Nullable java.lang.String value)
table - the tabletarget - the targetkey - the keyvalue - the valuepublic void removeFromCache(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key)
table - the tabletarget - the targetkey - the keypublic void saveCache()
public void saveCache(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target)
table - the table to save intarget - the target to save@NotNull public final @NotNull java.util.Optional<Dialect.MigrationData> getMigrationDataFromDatabase(@NotNull @NotNull DataManager newManager)
newManager - the new DataManager to migrate to@NotNull
public final @NotNull java.util.Optional<java.lang.String> getFromDatabase(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key)
table - the tabletarget - the targetkey - the keypublic final boolean setToDatabase(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key,
@NotNull
@NotNull java.lang.String value)
table - the tabletarget - the targetkey - the keyvalue - the valuepublic final boolean setToDatabase(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.util.Map<java.lang.String,java.lang.String> data)
table - the tabletarget - the targetdata - the data to set@NotNull
public final @NotNull java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>> setToDatabase(@NotNull
@NotNull java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>> data)
data - the data to setpublic final boolean removeValueFromDatabase(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key)
table - the tabletarget - the targetkey - the key@NotNull
protected abstract @NotNull java.util.Optional<java.lang.String> getFromCacheImpl(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key)
table - the tabletarget - the targetkey - the keyprotected abstract void setToCacheImpl(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key,
@NotNull
@NotNull java.lang.String value)
table - the tabletarget - the targetkey - the keyvalue - the valueprotected abstract void removeFromCacheImpl(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key)
table - the tabletarget - the targetkey - the keyprotected abstract void saveCacheImpl()
protected abstract void saveCacheImpl(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target)
table - the table to save intarget - the target to save@NotNull protected abstract @NotNull java.util.Optional<Dialect.MigrationData> getMigrationDataFromDatabaseImpl(@NotNull @NotNull DataManager newManager)
newManager - the new DataManager to migrate to@NotNull
protected abstract @NotNull java.util.Optional<java.lang.String> getFromDatabaseImpl(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key)
table - the table to get fromtarget - the target to get fromkey - the key to getprotected abstract boolean setToDatabaseImpl(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key,
@NotNull
@NotNull java.lang.String value)
table - the table to set totarget - the target to set tokey - the key to setvalue - the value to setprotected abstract boolean setToDatabaseImpl(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.util.Map<java.lang.String,java.lang.String> data)
table - the table to set totarget - the target to set todata - the data to setprotected abstract boolean removeFromDatabaseImpl(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key)
table - the table to remove fromtarget - the target to remove fromkey - the key to remove