Skip to content

Commit eb1aa47

Browse files
authored
Merge pull request #222 from messagebird/Issue_221_220_fix
fixed objectmapper serialization and updated Language enum class
2 parents 65867a8 + 507d49a commit eb1aa47

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

api/src/main/java/com/messagebird/MessageBirdServiceImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,6 @@ public <P> HttpURLConnection getConnection(final String serviceUrl, final P body
590590
connection.setRequestProperty("Content-Type", "application/json");
591591
ObjectMapper mapper = new ObjectMapper();
592592
mapper.setSerializationInclusion(Include.NON_NULL);
593-
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
594593
// Specifically set the date format for POST requests so scheduled
595594
// messages and other things relying on specific date formats don't
596595
// fail when sending.

api/src/main/java/com/messagebird/objects/Language.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.messagebird.objects;
22

3+
import com.fasterxml.jackson.annotation.JsonValue;
4+
35
/**
46
* Created by faizan on 09/12/15.
57
*/
@@ -25,13 +27,21 @@ public enum Language {
2527
PT_BR("pt-br"),
2628
RO_RO("ro-ro");
2729

28-
private String code;
30+
final String code;
2931

3032
Language(String code) {
3133
this.code = code;
3234
}
3335

36+
@JsonValue
37+
public String getCode() {
38+
return code;
39+
}
40+
41+
@Override
3442
public String toString() {
35-
return this.code;
43+
return "Language{" +
44+
"code='" + code + '\'' +
45+
'}';
3646
}
3747
}

0 commit comments

Comments
 (0)