|
||||||||||
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()
|
Method Summary | |
---|---|
void |
clear()
Clears this hashtable so that it contains no keys. |
void |
clearChanges()
Clears the list of changed mappings. |
List<Map.Entry<K,V>> |
getChanges(Class<? extends V>... pValueType)
Gets the tracked changes of this Hashtable but return only
the values with a specified class type. |
List<Map.Entry<K,V>> |
getLastChanges()
Gets the last tracked changes of this Hashtable but return only
the values with a specified class type. |
List<Map.Entry<K,V>> |
getMapping(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(Object pKey)
Removes the key (and its corresponding value) from this hashtable. |
V |
remove(Object pKey,
boolean pTrackChanges)
Removes the key (and its corresponding value) from this hashtable with optional tracking of changes. |
V |
remove(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()
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 Map<K,V>
put
in class 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(Object pKey)
This method tracks all changes to the hashtable.
remove
in interface Map<K,V>
remove
in class Hashtable<K,V>
pKey
- the key that needs to be removed.
null
if the key did not have a mapping.
NullPointerException
- if the key is null
.public void clear()
clear
in interface Map<K,V>
clear
in class 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(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.
NullPointerException
- if the key is null
.public V remove(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.
NullPointerException
- if the key is null
.public List<Map.Entry<K,V>> getChanges(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 List<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 List<Map.Entry<K,V>> getMapping(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 |