Skip to content

Commit a68c8bc

Browse files
committed
Replace enums with string constants
1 parent 2f790ec commit a68c8bc

131 files changed

Lines changed: 1600 additions & 2620 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/com/recurly/v3/BaseClient.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.recurly.v3;
22

3-
import com.google.gson.annotations.SerializedName;
43
import com.recurly.v3.exception.ExceptionFactory;
54
import com.recurly.v3.http.HttpTransport;
65
import com.recurly.v3.http.HttpURLConnectionTransport;
@@ -9,7 +8,6 @@
98
import java.io.IOException;
109
import java.io.InputStream;
1110
import java.io.UnsupportedEncodingException;
12-
import java.lang.reflect.Field;
1311
import java.lang.reflect.Type;
1412
import java.net.URLEncoder;
1513
import java.nio.charset.StandardCharsets;
@@ -204,16 +202,6 @@ public int getRecordCount(final String url, final HashMap<String, Object> queryP
204202
}
205203
}
206204

207-
private String getSerializedEnumName(Enum<?> e) {
208-
try {
209-
Field f = e.getClass().getField(e.name());
210-
SerializedName a = f.getAnnotation(SerializedName.class);
211-
return a == null ? null : a.value();
212-
} catch (NoSuchFieldException ignored) {
213-
return null;
214-
}
215-
}
216-
217205
private SimpleHttpRequest buildRequest(
218206
final String method,
219207
final String url,
@@ -242,8 +230,6 @@ private SimpleHttpRequest buildRequest(
242230
stringValue = Double.toString((Double) value);
243231
} else if (value instanceof Long) {
244232
stringValue = Long.toString((Long) value);
245-
} else if (value instanceof Enum) {
246-
stringValue = getSerializedEnumName((Enum<?>) value);
247233
} else {
248234
stringValue = value.toString();
249235
}

0 commit comments

Comments
 (0)