public final class Transaction<T extends DataSerializable> extends Object implements DataSerializable
Modifier and Type | Field and Description |
---|---|
static DataQuery |
CUSTOM_REPLACEMENT |
static DataQuery |
DEFAULT_REPLACEMENT |
static DataQuery |
ORIGINAL |
static DataQuery |
TYPE_CLASS |
static DataQuery |
VALID |
Constructor and Description |
---|
Transaction(T original,
T defaultReplacement) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Optional<T> |
getCustom()
Gets the custom snapshot if one was set.
|
T |
getDefaultReplacement()
Gets the default replacement snapshot.
|
T |
getFinal()
Gets the proposed final snapshot, if the
getCustom() returns
Optional.isPresent() , the custom is returned, otherwise,
getDefaultReplacement() is returned. |
T |
getOriginal()
Gets the original snapshot.
|
int |
hashCode() |
boolean |
isValid()
Gets whether this transaction is marked as valid.
|
void |
setCustom(T custom)
Sets the custom snapshot.
|
void |
setValid(boolean valid)
Sets whether this transaction is valid or not.
|
DataContainer |
toContainer()
Serializes this object into a comprehensible
DataContainer . |
String |
toString() |
public static final DataQuery TYPE_CLASS
public static final DataQuery ORIGINAL
public static final DataQuery DEFAULT_REPLACEMENT
public static final DataQuery CUSTOM_REPLACEMENT
public static final DataQuery VALID
public T getOriginal()
public T getDefaultReplacement()
public Optional<T> getCustom()
public void setCustom(@Nullable T custom)
null
, this will
reset to use the getDefaultReplacement()
snapshot.custom
- The custom snapshotpublic T getFinal()
getCustom()
returns
Optional.isPresent()
, the custom is returned, otherwise,
getDefaultReplacement()
is returned.public boolean isValid()
public void setValid(boolean valid)
valid
- The valid state of this transactionpublic DataContainer toContainer()
DataSerializable
DataContainer
.toContainer
in interface DataSerializable