blob: 8209322c4725fea2451ac9dc7f23b63e5c7f0d90 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document;
/**
* Base class for "document operations".
* These include "put" (DocumentPut), "update" (DocumentUpdate), "remove" (DocumentRemove)
* and "get" (DocumentGet). The latter only for internal use.
* Historically, put operations were represented by the Document class alone,
* but since it doesn't make much sense to put a *test and set* condition in Document,
* a more uniform interface for document operations was needed.
*
* @author Vegard Sjonfjell
*/
public abstract class DocumentOperation {
private TestAndSetCondition condition = TestAndSetCondition.NOT_PRESENT_CONDITION;
public abstract DocumentId getId();
public void setCondition(TestAndSetCondition condition) {
this.condition = condition;
}
public TestAndSetCondition getCondition() {
return condition;
}
protected DocumentOperation() {}
/**
* Copy constructor
* @param other DocumentOperation to copy
*/
protected DocumentOperation(DocumentOperation other) {
this.condition = other.condition;
}
}
|