public final class UpdateOp
extends java.lang.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 java.lang.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.
|
java.util.Map<UpdateOp.Key,UpdateOp.Operation> |
getChanges() |
java.util.Map<UpdateOp.Key,UpdateOp.Condition> |
getConditions() |
@NotNull java.lang.String |
getId() |
UpdateOp |
getReverseOperation() |
boolean |
hasChanges()
Checks if the UpdateOp has any change operation is registered with
current update operation
|
void |
increment(@NotNull java.lang.String property,
long value)
Increment the value.
|
boolean |
isNew() |
void |
remove(@NotNull java.lang.String property)
Remove a property.
|
void |
removeMapEntry(@NotNull java.lang.String property,
@NotNull Revision revision)
Remove a map entry.
|
void |
set(java.lang.String property,
boolean value)
Set the property to the given boolean value.
|
void |
set(java.lang.String property,
long value)
Set the property to the given long value.
|
void |
set(java.lang.String property,
java.lang.String value)
Set the property to the given String value.
|
void |
setNew(boolean isNew) |
UpdateOp |
shallowCopy(java.lang.String id)
Creates an update operation for the document with the given id.
|
java.lang.String |
toString() |
public UpdateOp(@NotNull @NotNull java.lang.String id, boolean isNew)
id
- the primary keyisNew
- whether this is a new documentpublic UpdateOp shallowCopy(java.lang.String id)
id
- the primary key.public UpdateOp copy()
UpdateOp
do not affect this object.@NotNull public @NotNull java.lang.String getId()
public boolean isNew()
public void setNew(boolean isNew)
public java.util.Map<UpdateOp.Key,UpdateOp.Operation> getChanges()
public java.util.Map<UpdateOp.Key,UpdateOp.Condition> getConditions()
public boolean hasChanges()
public void remove(@NotNull @NotNull java.lang.String property)
property
- the property namepublic void removeMapEntry(@NotNull @NotNull java.lang.String property, @NotNull @NotNull Revision revision)
property
- the propertyrevision
- the revisionpublic void set(java.lang.String property, long value)
property
- the property namevalue
- the valuepublic void set(java.lang.String property, boolean value)
property
- the property namevalue
- the valuepublic void set(java.lang.String property, java.lang.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 valuejava.lang.IllegalArgumentException
- if an attempt is made to set Document.ID
.public void increment(@NotNull @NotNull java.lang.String property, long value)
property
- the keyvalue
- the incrementpublic UpdateOp getReverseOperation()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2012–2022 The Apache Software Foundation. All rights reserved.