aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/main/java/com/yahoo/document/DocumentOperation.java
blob: b719083bd11ce0e2312532f7ee7ea4027cc13180 (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
// Copyright Yahoo. 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).
 *
 * @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;
    }

}