public class SupportsLastModified extends Object
| Constructor and Description |
|---|
SupportsLastModified() |
| Modifier and Type | Method and Description |
|---|---|
long |
getLastModified()
Retrieves a long value recording when (with unspecified origin) this object was last modified.
|
void |
modifyNow()
Specifies that this object is modified as of now, as specified by
now(). |
protected boolean |
modifyNowIfNeeded(Object oldValue,
Object newValue)
Sets the last modified time to now (as returned by
now()) if the specified values, presumably fields of the calling object, are different. |
static long |
now()
Retrieves a value representing the current instant / now, without specified origin so shouldn't be depended on to mark a meaningful instant in time by itself.
|
void |
setLastModified(long lastModified)
Sets the last modified marker to the specified value.
|
protected boolean modifyNowIfNeeded(Object oldValue, Object newValue)
now()) if the specified values, presumably fields of the calling object, are different. This method is useful to
marks this object as modified when setting a field to the specified new value would result in a modification of the object based on the specified current/old value of the
field. Values are compared using ParameterValidation.isOldAndNewDifferent(Object, Object).oldValue - the current / old value that might be replaced by the specified new valuenewValue - the new value that might replace the current / old onetrue if both given values were different and therefore would lead to the calling object being set as modified now, false otherwise.public void modifyNow()
now().public long getLastModified()
public void setLastModified(long lastModified)
modifyNow() instead.
This method is available for persistence layer implementations to restore value from storage.lastModified - the new last modified time markerpublic static long now()
Copyright © 2006-2014 GateIn. All Rights Reserved.