public class AssignFieldPathUpdate extends FieldPathUpdate
Modifier and Type | Class and Description |
---|---|
(package private) class |
AssignFieldPathUpdate.MathAssignIteratorHandler |
(package private) class |
AssignFieldPathUpdate.SimpleAssignIteratorHandler |
FieldPathUpdate.Type
Modifier and Type | Field and Description |
---|---|
static int |
ARITHMETIC_EXPRESSION |
static int |
CREATE_MISSING_PATH |
(package private) boolean |
createMissingPath |
(package private) String |
expression |
(package private) FieldValue |
fieldValue |
static int |
REMOVE_IF_ZERO |
(package private) boolean |
removeIfZero |
Constructor and Description |
---|
AssignFieldPathUpdate(DocumentType type,
DocumentUpdateReader reader)
Creates an assign update from a serialized object.
|
AssignFieldPathUpdate(DocumentType type,
String fieldPath) |
AssignFieldPathUpdate(DocumentType type,
String fieldPath,
FieldValue newValue) |
AssignFieldPathUpdate(DocumentType type,
String fieldPath,
String whereClause,
FieldValue newValue)
Creates an assignment update that overwrites the old value with the given new value.
|
AssignFieldPathUpdate(DocumentType type,
String fieldPath,
String whereClause,
String expression)
Creates an assign statement based on a mathematical expression.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
boolean |
getCreateMissingPath() |
String |
getExpression() |
FieldValue |
getFieldValue() |
(package private) FieldPathIteratorHandler |
getIteratorHandler(Document doc) |
FieldValue |
getNewValue() |
boolean |
getRemoveIfZero() |
int |
hashCode() |
boolean |
isArithmetic() |
void |
serialize(VespaDocumentSerializerHead data) |
void |
setCreateMissingPath(boolean createMissingPath)
If set to true, and any part of the field path specified does not exist (except for array indexes), we create the path as necessary.
|
void |
setExpression(String value)
Turns this assignment into a mathematical expression assignment.
|
void |
setNewValue(FieldValue value)
Turns this assignment into a literal one.
|
void |
setRemoveIfZero(boolean removeIfZero)
If set to true, and the new value assigned evaluates to a numeric value of 0, removes the value instead of setting it.
|
String |
toString() |
applyTo, create, getDocumentType, getFieldPath, getOriginalFieldPath, getOriginalWhereClause, getUpdateType, getWhereClause, setFieldPath, setWhereClause
FieldValue fieldValue
String expression
boolean createMissingPath
boolean removeIfZero
public static final int ARITHMETIC_EXPRESSION
public static final int REMOVE_IF_ZERO
public static final int CREATE_MISSING_PATH
public AssignFieldPathUpdate(DocumentType type, String fieldPath, String whereClause, FieldValue newValue)
type
- The document type the assignment works on.fieldPath
- The field path of the field to be overwritten.whereClause
- A document selection string that selects documents and variables to be updated.newValue
- The new value of the assignment.public AssignFieldPathUpdate(DocumentType type, String fieldPath, FieldValue newValue)
public AssignFieldPathUpdate(DocumentType type, String fieldPath, String whereClause, String expression)
type
- The document type the assignment works on.fieldPath
- The field path of the field to be overwritten.whereClause
- A document selection string that selects documents and variables to be updated.expression
- The mathematical expression to apply. Use $value to signify the previous value of the field.public AssignFieldPathUpdate(DocumentType type, DocumentUpdateReader reader)
type
- The document type the assignment will work on.reader
- A reader that can deserialize something into this object.public AssignFieldPathUpdate(DocumentType type, String fieldPath)
public void setNewValue(FieldValue value)
value
- The new value to assign to the document.public FieldValue getNewValue()
public void setExpression(String value)
value
- The expression to use for assignment.public String getExpression()
public void setRemoveIfZero(boolean removeIfZero)
public void setCreateMissingPath(boolean createMissingPath)
public boolean isArithmetic()
FieldPathIteratorHandler getIteratorHandler(Document doc)
getIteratorHandler
in class FieldPathUpdate
public void serialize(VespaDocumentSerializerHead data)
serialize
in class FieldPathUpdate
public boolean equals(Object o)
equals
in class FieldPathUpdate
public int hashCode()
hashCode
in class FieldPathUpdate
public String toString()
toString
in class FieldPathUpdate
public boolean getCreateMissingPath()
public boolean getRemoveIfZero()
public FieldValue getFieldValue()
Copyright © 2017. All rights reserved.