public class DifferenceMap extends Object implements Serializable
DifferenceEntry
objects.
Difference map is used when you need to take some actions when something
changed in the system. Difference map allows to describe any types of changes
using simple map-based storage mechanism
DifferenceMap diffMap = new DifferenceMap(); diffMap.put("property", "old value", "new value"); .... DifferenceEntry diffEntry = diffMap.get("property); // do some logic with difference entry if (diffEntry.getOldValue() ...) { }
DifferenceEntry
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
lineSeparator |
Constructor and Description |
---|
DifferenceMap()
Create difference entries storage
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all inserted difference entries
|
protected void |
finalize()
Remove unused outside references
|
DifferenceEntry |
get(String name)
Retrieve specified difference entry by name
|
Serializable |
getReference()
Get additional object reference tight to difference map
|
boolean |
isEmpty()
Returns true if container is empty
|
Iterator<DifferenceEntry> |
iterator()
Returns iterator to all values inside difference storage
|
void |
put(DifferenceEntry diffEntry)
Put an instance of
DifferenceEntry to the map |
void |
put(String name,
Object oldValue,
Object newValue)
Put a new entry with the specified difference values
|
void |
putAll(DifferenceMap map)
Joins 2 difference maps together
|
void |
setReference(Serializable reference)
Set reference instance object (should be
Serializable )
Allows to specify some object tight to particular difference map |
int |
size()
Returns current quantity of difference entries inside the container
|
String |
toString()
Provides string presentation of the difference map for the debugging purposes
|
public static final String lineSeparator
protected void finalize() throws Throwable
public void clear()
public int size()
public boolean isEmpty()
public Iterator<DifferenceEntry> iterator()
DifferenceEntry
objectspublic void put(String name, Object oldValue, Object newValue)
name
- Entry nameoldValue
- Old entry valuenewValue
- New entry valuepublic void put(DifferenceEntry diffEntry)
DifferenceEntry
to the mapdiffEntry
- Created DifferenceEntry
instancepublic void putAll(DifferenceMap map)
map
- Difference map to combinepublic DifferenceEntry get(String name)
name
- Entry name to retrieveDifferenceEntry
or null if no entry corresponds to
specified namepublic String toString()
public void setReference(Serializable reference)
Serializable
)
Allows to specify some object tight to particular difference mapreference
- Object instance to serve as an additional data to
difference mappublic Serializable getReference()