Skip to content

Commit 9c45b24

Browse files
committed
Revert "try to fix Java 25 abstract interface issue"
This reverts commit 26f93f0.
1 parent 6c8aa60 commit 9c45b24

File tree

4 files changed

+112
-97
lines changed

4 files changed

+112
-97
lines changed

src/main/java/com/bandwidth/sdk/model/bxml/OutboundDestination.java

Lines changed: 17 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -4,97 +4,32 @@
44

55
package com.bandwidth.sdk.model.bxml;
66

7-
import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD;
7+
import jakarta.xml.bind.annotation.XmlAccessType;
8+
import jakarta.xml.bind.annotation.XmlAccessorType;
9+
import jakarta.xml.bind.annotation.XmlType;
810

9-
import jakarta.xml.bind.annotation.XmlAttribute;
10-
import jakarta.xml.bind.annotation.XmlTransient;
11-
import lombok.AllArgsConstructor;
12-
import lombok.Builder.Default;
13-
import lombok.experimental.SuperBuilder;
14-
import lombok.EqualsAndHashCode;
15-
import lombok.Getter;
16-
import lombok.NoArgsConstructor;
11+
@XmlAccessorType(XmlAccessType.FIELD)
12+
@XmlType
13+
public interface OutboundDestination {
14+
String getUsername();
1715

18-
@NoArgsConstructor
19-
@AllArgsConstructor
20-
@SuperBuilder
21-
@Getter
22-
@EqualsAndHashCode(callSuper = false)
16+
String getPassword();
2317

24-
@XmlTransient
25-
abstract public class OutboundDestination {
26-
@XmlAttribute
27-
protected String uui;
28-
public String getUui() {
29-
return uui;
30-
}
18+
String getTransferAnswerUrl();
3119

32-
@XmlAttribute
33-
protected String username;
34-
public String getUsername() {
35-
return username;
36-
}
20+
String getTransferAnswerMethod();
3721

38-
@XmlAttribute
39-
protected String password;
40-
public String getPassword() {
41-
return password;
42-
}
22+
String getTransferDisconnectUrl();
4323

44-
@XmlAttribute
45-
protected String fallbackUsername;
46-
public String getFallbackUsername() {
47-
return fallbackUsername;
48-
}
24+
String getTransferDisconnectMethod();
4925

50-
@XmlAttribute
51-
protected String fallbackPassword;
52-
public String getFallbackPassword() {
53-
return fallbackPassword;
54-
}
26+
String getFallbackUsername();
5527

56-
@XmlAttribute
57-
protected String transferAnswerUrl;
58-
public String getTransferAnswerUrl() {
59-
return transferAnswerUrl;
60-
}
28+
String getFallbackPassword();
6129

62-
@XmlAttribute
63-
@Default
64-
protected String transferAnswerMethod = DEFAULT_CALLBACK_METHOD;
65-
public String getTransferAnswerMethod() {
66-
return transferAnswerMethod;
67-
}
30+
String getTransferAnswerFallbackUrl();
6831

69-
@XmlAttribute
70-
protected String transferAnswerFallbackUrl;
71-
public String getTransferAnswerFallbackUrl() {
72-
return transferAnswerFallbackUrl;
73-
}
32+
String getTransferAnswerFallbackMethod();
7433

75-
@XmlAttribute
76-
@Default
77-
protected String transferAnswerFallbackMethod = DEFAULT_CALLBACK_METHOD;
78-
public String getTransferAnswerFallbackMethod() {
79-
return transferAnswerFallbackMethod;
80-
}
81-
82-
@XmlAttribute
83-
protected String transferDisconnectUrl;
84-
public String getTransferDisconnectUrl() {
85-
return transferDisconnectUrl;
86-
}
87-
88-
@XmlAttribute
89-
@Default
90-
protected String transferDisconnectMethod = DEFAULT_CALLBACK_METHOD;
91-
public String getTransferDisconnectMethod() {
92-
return transferDisconnectMethod;
93-
}
94-
95-
@XmlAttribute
96-
protected String tag;
97-
public String getTag() {
98-
return tag;
99-
}
34+
String getTag();
10035
}

src/main/java/com/bandwidth/sdk/model/bxml/PhoneNumber.java

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@
44
*/
55
package com.bandwidth.sdk.model.bxml;
66

7+
import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD;
8+
79
import jakarta.xml.bind.annotation.XmlAccessType;
810
import jakarta.xml.bind.annotation.XmlAccessorType;
11+
import jakarta.xml.bind.annotation.XmlAttribute;
912
import jakarta.xml.bind.annotation.XmlType;
1013
import jakarta.xml.bind.annotation.XmlValue;
1114
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
1215
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
1316
import lombok.AllArgsConstructor;
14-
import lombok.experimental.SuperBuilder;
17+
import lombok.Builder;
18+
import lombok.Builder.Default;
1519
import lombok.EqualsAndHashCode;
1620
import lombok.Getter;
1721
import lombok.NoArgsConstructor;
@@ -20,9 +24,9 @@
2024
@XmlType(name = PhoneNumber.TYPE_NAME)
2125
@NoArgsConstructor
2226
@AllArgsConstructor
23-
@SuperBuilder
27+
@Builder
2428
@Getter
25-
@EqualsAndHashCode(callSuper = false)
29+
@EqualsAndHashCode
2630
/**
2731
*
2832
* @param number (str): A phone number to transfer the call to. Value must be in E.164 format (e.g. +15555555555).
@@ -40,14 +44,50 @@
4044
* @param uui (str, optional): The value of the User-To-User header to send within the initial INVITE. Must include the encoding parameter as specified in RFC 7433. Only base64, jwt and hex encoding are currently allowed. This value, including the encoding specifier, may not exceed 256 characters.
4145
*
4246
*/
43-
public class PhoneNumber extends OutboundDestination {
47+
public class PhoneNumber implements OutboundDestination {
4448

4549
public static final String TYPE_NAME = "PhoneNumber";
4650

4751
@XmlValue
4852
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
4953
protected String number;
50-
public String getNumber() {
51-
return number;
52-
}
54+
55+
@XmlAttribute
56+
protected String username;
57+
58+
@XmlAttribute
59+
protected String password;
60+
61+
@XmlAttribute
62+
protected String fallbackUsername;
63+
64+
@XmlAttribute
65+
protected String fallbackPassword;
66+
67+
@XmlAttribute
68+
protected String transferAnswerUrl;
69+
70+
@XmlAttribute
71+
@Default
72+
protected String transferAnswerMethod = DEFAULT_CALLBACK_METHOD;
73+
74+
@XmlAttribute
75+
protected String transferAnswerFallbackUrl;
76+
77+
@XmlAttribute
78+
@Default
79+
protected String transferAnswerFallbackMethod = DEFAULT_CALLBACK_METHOD;
80+
81+
@XmlAttribute
82+
protected String transferDisconnectUrl;
83+
84+
@XmlAttribute
85+
@Default
86+
protected String transferDisconnectMethod = DEFAULT_CALLBACK_METHOD;
87+
88+
@XmlAttribute
89+
protected String tag;
90+
91+
@XmlAttribute
92+
protected String uui;
5393
}

src/main/java/com/bandwidth/sdk/model/bxml/SipUri.java

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@
55

66
package com.bandwidth.sdk.model.bxml;
77

8+
import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD;
9+
810
import jakarta.xml.bind.annotation.XmlAccessType;
911
import jakarta.xml.bind.annotation.XmlAccessorType;
12+
import jakarta.xml.bind.annotation.XmlAttribute;
1013
import jakarta.xml.bind.annotation.XmlType;
1114
import jakarta.xml.bind.annotation.XmlValue;
1215
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
1316
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
1417
import lombok.AllArgsConstructor;
15-
import lombok.experimental.SuperBuilder;
18+
import lombok.Builder;
19+
import lombok.Builder.Default;
1620
import lombok.EqualsAndHashCode;
1721
import lombok.Getter;
1822
import lombok.NoArgsConstructor;
@@ -21,9 +25,9 @@
2125
@XmlType(name = SipUri.TYPE_NAME)
2226
@NoArgsConstructor
2327
@AllArgsConstructor
24-
@SuperBuilder
28+
@Builder
2529
@Getter
26-
@EqualsAndHashCode(callSuper = false)
30+
@EqualsAndHashCode
2731
/**
2832
*
2933
* @param uri (str): A SIP URI to transfer the call to (e.g. sip:[email protected])
@@ -43,14 +47,50 @@
4347
* @param tag (str, optional): A custom string that will be sent with these and all future callbacks unless overwritten by a future tag attribute or cleared. May be cleared by setting tag="" Max length 256 characters. Defaults to None.
4448
*
4549
*/
46-
public class SipUri extends OutboundDestination {
50+
public class SipUri implements OutboundDestination {
4751

4852
public static final String TYPE_NAME = "SipUri";
4953

5054
@XmlValue
5155
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
5256
protected String uri;
53-
public String getUri() {
54-
return uri;
55-
}
57+
58+
@XmlAttribute
59+
protected String uui;
60+
61+
@XmlAttribute
62+
protected String username;
63+
64+
@XmlAttribute
65+
protected String password;
66+
67+
@XmlAttribute
68+
protected String fallbackUsername;
69+
70+
@XmlAttribute
71+
protected String fallbackPassword;
72+
73+
@XmlAttribute
74+
protected String transferAnswerUrl;
75+
76+
@XmlAttribute
77+
@Default
78+
protected String transferAnswerMethod = DEFAULT_CALLBACK_METHOD;
79+
80+
@XmlAttribute
81+
protected String transferAnswerFallbackUrl;
82+
83+
@XmlAttribute
84+
@Default
85+
protected String transferAnswerFallbackMethod = DEFAULT_CALLBACK_METHOD;
86+
87+
@XmlAttribute
88+
protected String transferDisconnectUrl;
89+
90+
@XmlAttribute
91+
@Default
92+
protected String transferDisconnectMethod = DEFAULT_CALLBACK_METHOD;
93+
94+
@XmlAttribute
95+
protected String tag;
5696
}

src/test/java/com/bandwidth/sdk/unit/models/bxml/TransferVerbTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class TransferVerbTest {
5959
public void transferVerbWorks() throws JAXBException {
6060
JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class);
6161
String expectedSipUriBxml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Bxml><Transfer transferCallerId=\"+19195554321\" callTimeout=\"15.0\" transferCompleteMethod=\"POST\" transferCompleteFallbackMethod=\"POST\" tag=\"test\" diversionTreatment=\"none\" diversionReason=\"unknown\"><SipUri uui=\"test\" transferAnswerUrl=\"https://example.com/webhooks/transfer_answer\" transferAnswerMethod=\"POST\" transferAnswerFallbackMethod=\"POST\" transferDisconnectMethod=\"POST\" tag=\"test\">[email protected]</SipUri></Transfer></Bxml>";
62-
String expectedPhoneNumberBxml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Bxml><Transfer transferCallerId=\"+19195554321\" transferCallerDisplayName=\"Clark Kent\" callTimeout=\"15.0\" transferCompleteMethod=\"POST\" transferCompleteFallbackMethod=\"POST\" tag=\"test\" diversionTreatment=\"none\" diversionReason=\"unknown\"><PhoneNumber uui=\"test\" transferAnswerUrl=\"https://example.com/webhooks/transfer_answer\" transferAnswerMethod=\"POST\" transferAnswerFallbackMethod=\"POST\" transferDisconnectMethod=\"POST\" tag=\"test\">+19195551234</PhoneNumber></Transfer></Bxml>";
62+
String expectedPhoneNumberBxml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Bxml><Transfer transferCallerId=\"+19195554321\" transferCallerDisplayName=\"Clark Kent\" callTimeout=\"15.0\" transferCompleteMethod=\"POST\" transferCompleteFallbackMethod=\"POST\" tag=\"test\" diversionTreatment=\"none\" diversionReason=\"unknown\"><PhoneNumber transferAnswerUrl=\"https://example.com/webhooks/transfer_answer\" transferAnswerMethod=\"POST\" transferAnswerFallbackMethod=\"POST\" transferDisconnectMethod=\"POST\" tag=\"test\" uui=\"test\">+19195551234</PhoneNumber></Transfer></Bxml>";
6363

6464
assertThat(new Bxml().with(transfer1).toBxml(jaxbContext), is(expectedSipUriBxml));
6565
assertThat(new Bxml().with(transfer2).toBxml(jaxbContext), is(expectedPhoneNumberBxml));

0 commit comments

Comments
 (0)