summaryrefslogtreecommitdiffstats
path: root/vespaclient-java/src/main/java/com/yahoo/vespastat/ClientParameters.java
blob: bba0d9803edbdc1d57ced63684b50177022a1703 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespastat;

/**
 * This class contains the program parameters.
 *
 * @author bjorncs
 */
public class ClientParameters {
    // Show help page if true
    public final boolean help;
    // Dump list of documents for all buckets matching the selection if true
    public final boolean dumpData;
    // The message bus route
    public final String route;
    // The selection type
    public final SelectionType selectionType;
    // The selection id
    public final String id;

    public ClientParameters(
            boolean help,
            boolean dumpData,
            String route,
            SelectionType selectionType,
            String id) {
        this.help = help;
        this.dumpData = dumpData;
        this.route = route;
        this.selectionType = selectionType;
        this.id = id;
    }

    public enum SelectionType {USER, GROUP, BUCKET, GID, DOCUMENT}

    public static class Builder {
        private boolean help;
        private boolean dumpData;
        private String route;
        private SelectionType selectionType;
        private String id;

        public Builder setHelp(boolean help) {
            this.help = help;
            return this;
        }

        public Builder setDumpData(boolean dumpData) {
            this.dumpData = dumpData;
            return this;
        }

        public Builder setRoute(String route) {
            this.route = route;
            return this;
        }

        public Builder setSelectionType(SelectionType selectionType) {
            this.selectionType = selectionType;
            return this;
        }

        public Builder setId(String id) {
            this.id = id;
            return this;
        }

        public ClientParameters build() {
            return new ClientParameters(help, dumpData, route, selectionType, id);
        }
    }

}