public class VersionValue extends Object implements UnsavedValueStrategy
A strategy for determining if a version value is a version of a new transient instance or a previously persistent transient instance. The strategy is determined by the <tt>unsaved-value</tt> attribute in the mapping file.
| 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(Object value)
Assume the transient instance is newly instantiated if
its version is null or equal to <tt>value</tt>
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getDefaultValue(Object currentValue)
Get a default value meant to indicate transience.
|
Boolean |
isUnsaved(Object version)
Make the transient/detached determination
|
String |
toString() |
public static final VersionValue NULL
Assume the transient instance is newly instantiated if the version is null, otherwise assume it is a detached instance.
public static final VersionValue UNDEFINED
Assume the transient instance is newly instantiated if the version is null, otherwise defer to the identifier unsaved-value.
public static final VersionValue NEGATIVE
Assume the transient instance is newly instantiated if the version is negative, otherwise assume it is a detached instance.
protected VersionValue()
public VersionValue(Object value)
Assume the transient instance is newly instantiated if its version is null or equal to <tt>value</tt>
value - value to compare topublic Boolean isUnsaved(Object version) throws MappingException
UnsavedValueStrategyMake the transient/detached determination
isUnsaved in interface UnsavedValueStrategyversion - 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.MappingExceptionpublic Object getDefaultValue(Object currentValue)
UnsavedValueStrategyGet a default value meant to indicate transience.
getDefaultValue in interface UnsavedValueStrategycurrentValue - The current state value.Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.