-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCallDirectionEnum.java
More file actions
97 lines (78 loc) · 2.36 KB
/
CallDirectionEnum.java
File metadata and controls
97 lines (78 loc) · 2.36 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
* Bandwidth
* Bandwidth's Communication APIs
*
* The version of the OpenAPI document: 1.0.0
* Contact: letstalk@bandwidth.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.bandwidth.sdk.model;
import java.util.Objects;
import com.google.gson.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import jakarta.xml.bind.annotation.adapters.XmlAdapter;
/**
* The direction of the call.
*/
@JsonAdapter(CallDirectionEnum.Adapter.class)
public enum CallDirectionEnum {
INBOUND("inbound"),
OUTBOUND("outbound");
private final String value;
CallDirectionEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return value;
}
public static CallDirectionEnum fromValue(String value) {
for (CallDirectionEnum b : CallDirectionEnum.values()) {
if (b.value.equalsIgnoreCase(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<CallDirectionEnum> {
@Override
public void write(final JsonWriter jsonWriter, final CallDirectionEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public CallDirectionEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return CallDirectionEnum.fromValue(value);
}
}
public static class XMLAdapter extends XmlAdapter<String, CallDirectionEnum> {
@Override
public CallDirectionEnum unmarshal(String v) {
for (CallDirectionEnum e : CallDirectionEnum.values()) {
if (e.toString().equals(v)) {
return e;
}
}
return null;
}
@Override
public String marshal(CallDirectionEnum v) {
return v.toString();
}
}
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
CallDirectionEnum.fromValue(value);
}
}