forked from roastedroot/proxy-wasm-java-host
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAction.java
More file actions
44 lines (39 loc) · 1021 Bytes
/
Action.java
File metadata and controls
44 lines (39 loc) · 1021 Bytes
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
package io.roastedroot.proxywasm;
/**
* Action represents the action which Wasm contexts expects hosts to take.
*/
public enum Action {
CONTINUE(0),
PAUSE(1);
private final int value;
/**
* Constructor for BufferType enum.
*
* @param value The integer value of the buffer type
*/
Action(int value) {
this.value = value;
}
/**
* Get the integer value of this buffer type.
*
* @return The integer value
*/
public int getValue() {
return value;
}
/**
* Convert an integer value to a BufferType.
*
* @param value The integer value to convert
* @return The corresponding BufferType or null if the value doesn't match any BufferType
*/
public static Action fromInt(int value) {
for (Action type : values()) {
if (type.value == value) {
return type;
}
}
throw new IllegalArgumentException("Unknown Action value: " + value);
}
}