class H2MapToSet<K> extends java.util.HashMap<K,java.util.Set<?>> implements StoredCollection
After adding elements to this map, a HashMap.get(java.lang.Object)
operation needs to be performed, so that the
caller uses the db-backed collection.
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
childTableName
The child map's table name.
|
private java.lang.String |
childWorkTable
The child map's work table name.
|
private java.lang.String |
clearSql
The map's clear SQL.
|
private DBHelper |
helper
The helper for SQL usage.
|
private java.lang.String |
insertSql
The map's insert SQL.
|
private java.lang.Class<?> |
keyClass
The map key class.
|
private java.lang.String |
setClearSql
The child's set clear SQL.
|
private java.lang.String |
setInsertSql
The child's set insert SQL.
|
private java.lang.String |
setWorkClearSql
The child's work table clear SQL.
|
private java.lang.String |
setWorkInsertSql
The child's work table insert SQL.
|
private java.lang.String |
tableName
The map's table name.
|
private java.lang.Class<?> |
valueClass
The child's set key class.
|
Constructor and Description |
---|
H2MapToSet(java.lang.Class<?> keyClass,
java.lang.Class<?> valueClass,
java.lang.String table,
DBHelper helper)
Create a new db-backed map, with the specified name.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the map and all its changes.
|
private void |
loadChildSets()
Load all the child maps from the database, in their corresponding collections in the map.
|
void |
persist()
Persist this map and all the changes to the database.
|
java.util.Set<?> |
put(K key,
java.util.Set<?> value)
Perform a put operation.
|
void |
putAll(java.util.Map m)
Merge the specified map into this one.
|
java.util.Set<?> |
remove(java.lang.Object key)
Remove this key from the map.
|
boolean |
remove(java.lang.Object key,
java.lang.Object value)
This API is not currently supported.
|
clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putIfAbsent, replace, replace, replaceAll, size, values
finalize, getClass, notify, notifyAll, wait, wait, wait
compact, inPersist, unwrapValue, wrapValue
private DBHelper helper
private java.lang.Class<?> keyClass
private java.lang.Class<?> valueClass
private java.lang.String tableName
private final java.lang.String childTableName
private final java.lang.String childWorkTable
private final java.lang.String insertSql
private final java.lang.String clearSql
private final java.lang.String setInsertSql
private final java.lang.String setClearSql
private final java.lang.String setWorkInsertSql
private final java.lang.String setWorkClearSql
public H2MapToSet(java.lang.Class<?> keyClass, java.lang.Class<?> valueClass, java.lang.String table, DBHelper helper)
keyClass
- The map's key class.valueClass
- The map's value class.table
- The map's (and main table) name.helper
- The SQL helper.public java.util.Set<?> put(K key, java.util.Set<?> value)
The value set will be converted to a H2ChildSet
. Use a HashMap.get(java.lang.Object)
operation
to ensure the caller is using the db-backed set.
The access will be logged. This assumes the source AST requires for the key to have this specific value.
public void putAll(java.util.Map m)
put(K, java.util.Set<?>)
to log the access
to the map.public java.util.Set<?> remove(java.lang.Object key)
If the key exists, then all changes related to it will be cleared.
public boolean remove(java.lang.Object key, java.lang.Object value)
public void clear()
clear
in interface StoredCollection
clear
in interface java.util.Map<K,java.util.Set<?>>
clear
in class java.util.HashMap<K,java.util.Set<?>>
public void persist()
persist
in interface StoredCollection
private void loadChildSets()