blob: 8e7bce3503cf22f5c93bdf8b7817c5c18231638e (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vdslib.state;
import java.util.List;
public enum NodeType {
STORAGE("storage"),
DISTRIBUTOR("distributor");
private final String serializeAs;
NodeType(String serializeAs) {
this.serializeAs = serializeAs;
}
public String toString() {
return serializeAs;
}
public static NodeType get(String serialized) {
for (NodeType type : values()) {
if (type.serializeAs.equals(serialized)) return type;
}
throw new IllegalArgumentException("Unknown node type '" + serialized + "'. Legal values are 'storage' and 'distributor'.");
}
public static List<NodeType> getTypes() { return List.of(STORAGE, DISTRIBUTOR); }
}
|