public final class UpdateOp extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
UpdateOp.Condition
A condition to check before an update is applied.
|
static class |
UpdateOp.Key
A key for an operation consists of a property name and an optional
revision.
|
static class |
UpdateOp.Operation
A DocumentStore operation for a given key within a document.
|
| Constructor and Description |
|---|
UpdateOp(@NotNull String id,
boolean isNew)
Create an update operation for the document with the given id.
|
| Modifier and Type | Method and Description |
|---|---|
UpdateOp |
copy()
Creates a deep copy of this update operation.
|
Map<UpdateOp.Key,UpdateOp.Operation> |
getChanges() |
Map<UpdateOp.Key,UpdateOp.Condition> |
getConditions() |
@NotNull String |
getId() |
UpdateOp |
getReverseOperation() |
boolean |
hasChanges()
Checks if the UpdateOp has any change operation is registered with
current update operation
|
void |
increment(@NotNull String property,
long value)
Increment the value.
|
boolean |
isNew() |
void |
remove(@NotNull String property)
Remove a property.
|
void |
removeMapEntry(@NotNull String property,
@NotNull Revision revision)
Remove a map entry.
|
void |
set(String property,
boolean value)
Set the property to the given boolean value.
|
void |
set(String property,
long value)
Set the property to the given long value.
|
void |
set(String property,
String value)
Set the property to the given String value.
|
void |
setNew(boolean isNew) |
UpdateOp |
shallowCopy(String id)
Creates an update operation for the document with the given id.
|
String |
toString() |
public UpdateOp(@NotNull
@NotNull String id,
boolean isNew)
id - the primary keyisNew - whether this is a new documentpublic UpdateOp shallowCopy(String id)
id - the primary key.public UpdateOp copy()
UpdateOp do not affect this object.@NotNull public @NotNull String getId()
public boolean isNew()
public void setNew(boolean isNew)
public Map<UpdateOp.Key,UpdateOp.Operation> getChanges()
public Map<UpdateOp.Key,UpdateOp.Condition> getConditions()
public boolean hasChanges()
public void remove(@NotNull
@NotNull String property)
property - the property namepublic void removeMapEntry(@NotNull
@NotNull String property,
@NotNull
@NotNull Revision revision)
property - the propertyrevision - the revisionpublic void set(String property, long value)
property - the property namevalue - the valuepublic void set(String property, boolean value)
property - the property namevalue - the valuepublic void set(String property, String value)
Note that Document.ID must not be set using this method;
it is sufficiently specified by the id parameter set in the constructor.
property - the property namevalue - the valueIllegalArgumentException - if an attempt is made to set Document.ID.public void increment(@NotNull
@NotNull String property,
long value)
property - the keyvalue - the incrementpublic UpdateOp getReverseOperation()
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.