File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
src/main/java/com/bandwidth/sdk/model Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 2222import com .google .gson .annotations .JsonAdapter ;
2323import com .google .gson .stream .JsonReader ;
2424import com .google .gson .stream .JsonWriter ;
25+ import jakarta .xml .bind .annotation .adapters .XmlAdapter ;
2526
2627/**
2728 * The direction of the call.
@@ -33,7 +34,7 @@ public enum CallDirectionEnum {
3334
3435 OUTBOUND ("outbound" );
3536
36- private String value ;
37+ private final String value ;
3738
3839 CallDirectionEnum (String value ) {
3940 this .value = value ;
@@ -45,7 +46,7 @@ public String getValue() {
4546
4647 @ Override
4748 public String toString () {
48- return String . valueOf ( value ) ;
49+ return value ;
4950 }
5051
5152 public static CallDirectionEnum fromValue (String value ) {
@@ -70,6 +71,24 @@ public CallDirectionEnum read(final JsonReader jsonReader) throws IOException {
7071 }
7172 }
7273
74+ public static class XMLAdapter extends XmlAdapter <String , CallDirectionEnum > {
75+ @ Override
76+ public CallDirectionEnum unmarshal (String v ) {
77+ for (CallDirectionEnum e : CallDirectionEnum .values ()) {
78+ if (e .toString ().equals (v )) {
79+ return e ;
80+ }
81+ }
82+ return null ;
83+ }
84+
85+ @ Override
86+ public String marshal (CallDirectionEnum v ) {
87+ return v .toString ();
88+ }
89+ }
90+
91+
7392 public static void validateJsonElement (JsonElement jsonElement ) throws IOException {
7493 String value = jsonElement .getAsString ();
7594 CallDirectionEnum .fromValue (value );
Original file line number Diff line number Diff line change 1717
1818import com .bandwidth .sdk .model .CallDirectionEnum ;
1919
20+ import jakarta .xml .bind .annotation .adapters .XmlJavaTypeAdapter ;
2021import lombok .AllArgsConstructor ;
2122import lombok .Builder ;
2223import lombok .Builder .Default ;
@@ -83,6 +84,7 @@ public class StartStream implements Verb {
8384 protected String mode ;
8485
8586 @ XmlAttribute
87+ @ XmlJavaTypeAdapter (CallDirectionEnum .XMLAdapter .class )
8688 @ Default
8789 protected CallDirectionEnum tracks = CallDirectionEnum .INBOUND ;
8890
You can’t perform that action at this time.
0 commit comments