public class VersionValue extends java.lang.Object implements UnsavedValueStrategy
Modifier and Type | Field and Description |
---|---|
static VersionValue |
NEGATIVE
Assume the transient instance is newly instantiated if the version
is negative, otherwise assume it is a detached instance.
|
static VersionValue |
NULL
Assume the transient instance is newly instantiated if the version
is null, otherwise assume it is a detached instance.
|
static VersionValue |
UNDEFINED
Assume the transient instance is newly instantiated if the version
is null, otherwise defer to the identifier unsaved-value.
|
Modifier | Constructor and Description |
---|---|
protected |
VersionValue() |
|
VersionValue(java.lang.Object value)
Assume the transient instance is newly instantiated if
its version is null or equal to value
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getDefaultValue(java.lang.Object currentValue)
Get a default value meant to indicate transience.
|
java.lang.Boolean |
isUnsaved(java.lang.Object version)
Make the transient/detached determination
|
java.lang.String |
toString() |
public static final VersionValue NULL
public static final VersionValue UNDEFINED
public static final VersionValue NEGATIVE
protected VersionValue()
public VersionValue(java.lang.Object value)
value
- value to compare topublic java.lang.Boolean isUnsaved(java.lang.Object version) throws MappingException
UnsavedValueStrategy
isUnsaved
in interface UnsavedValueStrategy
version
- The value to be testedtrue
indicates the value corresponds to unsaved data (aka, transient state; false
indicates the value does not corresponds to unsaved data (aka, detached state); null
indicates that
this strategy was not able to determine conclusively.MappingException
public java.lang.Object getDefaultValue(java.lang.Object currentValue)
UnsavedValueStrategy
getDefaultValue
in interface UnsavedValueStrategy
currentValue
- The current state value.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.