This repository was archived by the owner on May 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathErrorStatus.java
More file actions
78 lines (60 loc) · 1.82 KB
/
ErrorStatus.java
File metadata and controls
78 lines (60 loc) · 1.82 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
/*
* Upcloud api
* The UpCloud API consists of operations used to control resources on UpCloud. The API is a web service interface. HTTPS is used to connect to the API. The API follows the principles of a RESTful web service wherever possible. The base URL for all API operations is https://api.upcloud.com/. All API operations require authentication.
*
* OpenAPI spec version: 1.2.0
*
*/
package com.upcloud.client.models;
import java.util.Objects;
import com.google.gson.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Gets or Sets ErrorStatus
*/
@JsonAdapter(ErrorStatus.Adapter.class)
public enum ErrorStatus {
_400("400"),
_402("402"),
_403("403"),
_404("404"),
_409("409");
private String value;
ErrorStatus(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static ErrorStatus fromValue(String text) {
for (ErrorStatus b : ErrorStatus.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<ErrorStatus> {
@Override
public void write(final JsonWriter jsonWriter, final ErrorStatus enumeration) throws IOException {
if (enumeration != null) {
jsonWriter.value(enumeration.getValue());
} else {
jsonWriter.nullValue();
}
}
@Override
public ErrorStatus read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return ErrorStatus.fromValue(String.valueOf(value));
}
}
}