|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Dictionary<K,V>
java.util.Hashtable<K,V>
com.sibvisions.util.ChangedHashtable<K,V>
K - the key classV - the value classpublic class ChangedHashtable<K,V>
The ChangedHashtable is a synchronized Hashtable
which tracks changes to keys and values. Synchronized means
that the operations are synchronized themselve.
The changes are available as key/value list, for other operations.
| Constructor Summary | |
|---|---|
ChangedHashtable()
Creates a new instance of ChangedHashtable, with a default initial capacity (11)
and load factor (0.75). |
|
ChangedHashtable(int pInitialCapacity)
Creates a new instance of ChangedHashtable, with the specified initial capacity
and default load factor (0.75). |
|
ChangedHashtable(int pInitialCapacity,
float pLoadFactor)
Creates a new instance of ChangedHashtable with the specified initial
capacity and the specified load factor. |
|
ChangedHashtable(java.util.Map<? extends K,? extends V> pMap)
Creates a new instance of ChangedHashtable with the same mappings as the given
Map. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears this hashtable so that it contains no keys. |
void |
clearChanges()
Clears the list of changed mappings. |
java.util.List<java.util.Map.Entry<K,V>> |
getChanges(java.lang.Class<? extends V>... pValueType)
Gets the tracked changes of this Hashtable but return only
the values with a specified class type. |
java.util.List<java.util.Map.Entry<K,V>> |
getLastChanges()
Gets the last tracked changes of this Hashtable but return only
the values with a specified class type. |
java.util.List<java.util.Map.Entry<K,V>> |
getMapping(java.lang.Class<? extends V>... pValueType)
Gets a list of entries but only includes the values of a specific type. |
boolean |
isChanged(K pKey)
Checks if a the value of a property is currently marked as changed. |
V |
put(K pKey,
V pValue)
Maps the specified key to the specified value in this hashtable. |
V |
put(K pKey,
V pValue,
boolean pTrackChanges)
Maps the specified key to the specified value in this hashtable with optional tracking of changes. |
V |
put(K pKey,
V pValue,
boolean pTrackChanges,
boolean pOverride)
Maps the specified key to the specified value in this hashtable with optional tracking of changes. |
V |
remove(java.lang.Object pKey)
Removes the key (and its corresponding value) from this hashtable. |
V |
remove(java.lang.Object pKey,
boolean pTrackChanges)
Removes the key (and its corresponding value) from this hashtable with optional tracking of changes. |
V |
remove(java.lang.Object pKey,
boolean pTrackChanges,
boolean pOverride)
Removes the key (and its corresponding value) from this hashtable with optional tracking of changes. |
| Methods inherited from class java.util.Hashtable |
|---|
clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, putAll, rehash, size, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ChangedHashtable()
ChangedHashtable, with a default initial capacity (11)
and load factor (0.75).
public ChangedHashtable(int pInitialCapacity)
ChangedHashtable, with the specified initial capacity
and default load factor (0.75).
pInitialCapacity - the initial capacity of the hashtable
java.lang.IllegalArgumentException - if the initial capacity is less than zero
public ChangedHashtable(int pInitialCapacity,
float pLoadFactor)
ChangedHashtable with the specified initial
capacity and the specified load factor.
pInitialCapacity - the initial capacity of the hashtablepLoadFactor - the load factor of the hashtable
java.lang.IllegalArgumentException - if the initial capacity is less than zero,
or if the load factor is nonpositivepublic ChangedHashtable(java.util.Map<? extends K,? extends V> pMap)
ChangedHashtable with the same mappings as the given
Map. The hashtable is created with an initial capacity sufficient to hold the mappings in
the given Map and a default load factor (0.75).
pMap - the map whose mappings are to be placed in this map
java.lang.NullPointerException - if the specified map is null| Method Detail |
|---|
public V put(K pKey,
V pValue)
pValue is null, the pKey will removed from this
hashtable, if present.This method tracks all changes to the hashtable.
put in interface java.util.Map<K,V>put in class java.util.Hashtable<K,V>pKey - the key with which the specified value is to be associatedpValue - the value to be associated with the specified key
pKey in this hashtable,
or null if it did not have one.public V remove(java.lang.Object pKey)
This method tracks all changes to the hashtable.
remove in interface java.util.Map<K,V>remove in class java.util.Hashtable<K,V>pKey - the key that needs to be removed.
null if the key did not have a mapping.
java.lang.NullPointerException - if the key is null.public void clear()
clear in interface java.util.Map<K,V>clear in class java.util.Hashtable<K,V>
public V put(K pKey,
V pValue,
boolean pTrackChanges)
pKey - the key with which the specified value is to be associatedpValue - the value to be associated with the specified keypTrackChanges - true to track all changes to the hashtable
pKey in this hashtable,
or null if it did not have one.
public V put(K pKey,
V pValue,
boolean pTrackChanges,
boolean pOverride)
pKey - the key with which the specified value is to be associatedpValue - the value to be associated with the specified keypTrackChanges - true to track all changes to the hashtablepOverride - true to track changes, if pTrackChanges = true independent of the
old value
pKey in this hashtable,
or null if it did not have one.
public V remove(java.lang.Object pKey,
boolean pTrackChanges)
pKey - the key that needs to be removed.pTrackChanges - true to track all changes to the hashtable
null if the key did not have a mapping.
java.lang.NullPointerException - if the key is null.
public V remove(java.lang.Object pKey,
boolean pTrackChanges,
boolean pOverride)
pKey - the key that needs to be removed.pTrackChanges - true to track all changes to the hashtablepOverride - true to track changes, if pTrackChanges = true independent of the
old value
null if the key did not have a mapping.
java.lang.NullPointerException - if the key is null.public java.util.List<java.util.Map.Entry<K,V>> getChanges(java.lang.Class<? extends V>... pValueType)
Hashtable but return only
the values with a specified class type. If the Hashtable contains
Object types as values, then you can return all values with Integer
types or String types:
ChangedHashtable<String, Object> table = new ChangedHashtable<String, Object>();
List<Entry<String, Object>> changes = table.getChanges(String.class);
ALL changes will be reset.
pValueType - missing or null to return all values, or a list of class types
to return the values with this class types.
(null values are always included)
Map.Entry list or null if there are no changespublic java.util.List<java.util.Map.Entry<K,V>> getLastChanges()
Hashtable but return only
the values with a specified class type. If the Hashtable contains
Object types as values, then you can return all values with Integer
types or String types:
ChangedHashtable<String, Object> table = new ChangedHashtable<String, Object>();
List<Entry<String, Object>> changes = table.getChanges(String.class);
ALL changes will be reset.
Map.Entry list or null if there are no changespublic void clearChanges()
public java.util.List<java.util.Map.Entry<K,V>> getMapping(java.lang.Class<? extends V>... pValueType)
Hashtable contains Object types as values, then you can
return all values with Integer types or String types:
ChangedHashtable<String, Object> table = new ChangedHashtable<String, Object>();
List<Entry<String, Object>> changes = table.getMapping(String.class);
pValueType - missing or null to return all values, or a list of class types
to return the values with this class types.
(null values are always included)
Map.Entry listpublic boolean isChanged(K pKey)
pKey - the property name
true if the property value has changed since last accessgetChanges(Class...),
getLastChanges()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||