Skip to content

Commit f0f5cce

Browse files
committed
Removal of JAXB annotations
This PR removes the JAXB-bind related annotations. This change is needed due to Jakarta EE +9 compatibility. The existing code in `com.adyen.terminal.serialization` relies on GSON; thus, the JAXB annotations were replaced by the GSON's @SerializedName. The JAXB validations (e.g., type checks and required fields) were not processed by GSON and have no equivalent (see `AbortRequestTest` for instance). The migration was guided by test coverage and focused on serialization and deserialization of JSON payloads. POM XML changes: - removal of jaxb dependency - addition of plugin enforcement to block unwanted dependencies
1 parent 93aaa7e commit f0f5cce

247 files changed

Lines changed: 2136 additions & 2855 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.

pom.xml

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
<swagger-core-version>1.6.16</swagger-core-version>
4141
<swagger-annotations-v3-version>2.2.30</swagger-annotations-v3-version>
4242
<jakarta.ws.rs-api-version>3.1.0</jakarta.ws.rs-api-version>
43-
<jaxb-api-version>2.3.1</jaxb-api-version>
4443
<httpclient5-version>5.5</httpclient5-version>
4544

4645
<!-- Test -->
@@ -62,6 +61,7 @@
6261
<spotless-maven-plugin-version>3.2.1</spotless-maven-plugin-version>
6362
<maven-surefire-plugin-version>3.5.2</maven-surefire-plugin-version>
6463
<google-java-format-version>1.34.1</google-java-format-version>
64+
<maven-enforcer-version>3.4.1</maven-enforcer-version>
6565
</properties>
6666
<scm>
6767
<connection>scm:git:git@github.com:Adyen/adyen-java-api-library.git</connection>
@@ -237,7 +237,40 @@
237237
<artifactId>maven-surefire-plugin</artifactId>
238238
<version>${maven-surefire-plugin-version}</version>
239239
</plugin>
240+
<plugin>
241+
<groupId>org.apache.maven.plugins</groupId>
242+
<artifactId>maven-enforcer-plugin</artifactId>
243+
<version>${maven-enforcer-version}</version>
244+
<executions>
245+
<execution>
246+
<id>enforce-jakarta-compliance</id>
247+
<goals>
248+
<goal>enforce</goal>
249+
</goals>
250+
<configuration>
251+
<rules>
252+
<bannedDependencies>
253+
<excludes>
254+
<exclude>javax.xml.bind:jaxb-api</exclude>
240255

256+
<!-- Not used but keeping exclusions for Jakarta EE 9+ compatibility -->
257+
<exclude>javax.servlet:servlet-api</exclude>
258+
<exclude>javax.servlet:javax.servlet-api</exclude>
259+
<exclude>javax.persistence:javax.persistence-api</exclude>
260+
<exclude>javax.persistence:persistence-api</exclude>
261+
<exclude>javax.validation:validation-api</exclude>
262+
<exclude>javax.inject:javax.inject</exclude>
263+
</excludes>
264+
<message>
265+
STOP! A legacy javax.* dependency was detected
266+
</message>
267+
</bannedDependencies>
268+
</rules>
269+
<fail>true</fail>
270+
</configuration>
271+
</execution>
272+
</executions>
273+
</plugin>
241274
</plugins>
242275
</build>
243276
<dependencies>
@@ -282,11 +315,6 @@
282315
<artifactId>jakarta.ws.rs-api</artifactId>
283316
<version>${jakarta.ws.rs-api-version}</version>
284317
</dependency>
285-
<dependency>
286-
<groupId>javax.xml.bind</groupId>
287-
<artifactId>jaxb-api</artifactId>
288-
<version>${jaxb-api-version}</version>
289-
</dependency>
290318
<dependency>
291319
<groupId>org.apache.httpcomponents.client5</groupId>
292320
<artifactId>httpclient5</artifactId>

src/main/java/com/adyen/model/nexo/AbortRequest.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package com.adyen.model.nexo;
22

3+
import com.google.gson.annotations.SerializedName;
34
import io.swagger.v3.oas.annotations.media.Schema;
4-
import javax.xml.bind.annotation.XmlAccessType;
5-
import javax.xml.bind.annotation.XmlAccessorType;
6-
import javax.xml.bind.annotation.XmlElement;
7-
import javax.xml.bind.annotation.XmlType;
85

96
/**
107
* Definition: Body of the Abort Request messageType. -- Usage: It conveys Information requested for
@@ -29,24 +26,20 @@
2926
* &lt;/complexType&gt;
3027
* </pre>
3128
*/
32-
@XmlAccessorType(XmlAccessType.FIELD)
33-
@XmlType(
34-
name = "AbortRequest",
35-
propOrder = {"messageReference", "abortReason", "displayOutput"})
3629
public class AbortRequest {
3730

3831
/** The Message reference. */
39-
@XmlElement(name = "MessageReference", required = true)
32+
@SerializedName("MessageReference")
4033
@Schema(description = "Identification of a previous POI transaction.")
4134
protected MessageReference messageReference;
4235

4336
/** The Abort reason. */
44-
@XmlElement(name = "AbortReason", required = true)
37+
@SerializedName("AbortReason")
4538
@Schema(description = "Reason of aborting a transaction")
4639
protected String abortReason;
4740

4841
/** The Display output. */
49-
@XmlElement(name = "DisplayOutput")
42+
@SerializedName("DisplayOutput")
5043
@Schema(
5144
description =
5245
"Information to display and the way to process the display. --Rule: To display an abort message to the Customer")

src/main/java/com/adyen/model/nexo/AccountType.java

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package com.adyen.model.nexo;
22

3+
import com.google.gson.annotations.SerializedName;
34
import io.swagger.v3.oas.annotations.media.Schema;
45
import java.util.Arrays;
5-
import javax.xml.bind.annotation.XmlEnum;
6-
import javax.xml.bind.annotation.XmlEnumValue;
7-
import javax.xml.bind.annotation.XmlType;
86

97
/**
108
* Java class for AccountType.
@@ -26,47 +24,45 @@
2624
* &lt;/simpleType&gt;
2725
* </pre>
2826
*/
29-
@XmlType(name = "AccountType")
30-
@XmlEnum
3127
public enum AccountType {
3228

3329
/** Default account */
34-
@XmlEnumValue("Default")
30+
@SerializedName("Default")
3531
@Schema(description = "Default account")
3632
DEFAULT("Default"),
3733

3834
/** Savings account */
39-
@XmlEnumValue("Savings")
35+
@SerializedName("Savings")
4036
@Schema(description = "Savings account")
4137
SAVINGS("Savings"),
4238

4339
/** Checking account */
44-
@XmlEnumValue("Checking")
40+
@SerializedName("Checking")
4541
@Schema(description = "Checking account")
4642
CHECKING("Checking"),
4743

4844
/** Credit card account */
49-
@XmlEnumValue("CreditCard")
45+
@SerializedName("CreditCard")
5046
@Schema(description = "Credit card account")
5147
CREDIT_CARD("CreditCard"),
5248

5349
/** Universal account */
54-
@XmlEnumValue("Universal")
50+
@SerializedName("Universal")
5551
@Schema(description = "Universal account")
5652
UNIVERSAL("Universal"),
5753

5854
/** Investment account */
59-
@XmlEnumValue("Investment")
55+
@SerializedName("Investment")
6056
@Schema(description = "Investment account")
6157
INVESTMENT("Investment"),
6258

6359
/** Card totals */
64-
@XmlEnumValue("CardTotals")
60+
@SerializedName("CardTotals")
6561
@Schema(description = "Card totals")
6662
CARD_TOTALS("CardTotals"),
6763

6864
/** e-Purse card account */
69-
@XmlEnumValue("EpurseCard")
65+
@SerializedName("EpurseCard")
7066
@Schema(description = "e-Purse card account")
7167
EPURSE_CARD("EpurseCard");
7268

src/main/java/com/adyen/model/nexo/AdminRequest.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package com.adyen.model.nexo;
22

3+
import com.google.gson.annotations.SerializedName;
34
import io.swagger.v3.oas.annotations.media.Schema;
4-
import javax.xml.bind.annotation.XmlAccessType;
5-
import javax.xml.bind.annotation.XmlAccessorType;
6-
import javax.xml.bind.annotation.XmlElement;
7-
import javax.xml.bind.annotation.XmlType;
85

96
/**
107
* Definition: Content of the Custom Admin Request messageType. -- Usage: Empty
@@ -25,14 +22,10 @@
2522
* &lt;/complexType&gt;
2623
* </pre>
2724
*/
28-
@XmlAccessorType(XmlAccessType.FIELD)
29-
@XmlType(
30-
name = "AdminRequest",
31-
propOrder = {"serviceIdentification"})
3225
public class AdminRequest {
3326

3427
/** The Service identification. */
35-
@XmlElement(name = "ServiceIdentification")
28+
@SerializedName("ServiceIdentification")
3629
@Schema(description = "Identification of the administrative service to process.")
3730
protected String serviceIdentification;
3831

src/main/java/com/adyen/model/nexo/AdminResponse.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package com.adyen.model.nexo;
22

3+
import com.google.gson.annotations.SerializedName;
34
import io.swagger.v3.oas.annotations.media.Schema;
4-
import javax.xml.bind.annotation.XmlAccessType;
5-
import javax.xml.bind.annotation.XmlAccessorType;
6-
import javax.xml.bind.annotation.XmlElement;
7-
import javax.xml.bind.annotation.XmlType;
85

96
/**
107
* Definition: Content of the Custom Admin Response messageType. -- Usage: It conveys the result of
@@ -26,14 +23,10 @@
2623
* &lt;/complexType&gt;
2724
* </pre>
2825
*/
29-
@XmlAccessorType(XmlAccessType.FIELD)
30-
@XmlType(
31-
name = "AdminResponse",
32-
propOrder = {"response"})
3326
public class AdminResponse {
3427

3528
/** The Response. */
36-
@XmlElement(name = "Response", required = true)
29+
@SerializedName("Response")
3730
@Schema(description = "Result of a message request processing.")
3831
protected Response response;
3932

src/main/java/com/adyen/model/nexo/AlgorithmIdentifier.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package com.adyen.model.nexo;
22

3-
import javax.xml.bind.annotation.XmlAccessType;
4-
import javax.xml.bind.annotation.XmlAccessorType;
5-
import javax.xml.bind.annotation.XmlElement;
6-
import javax.xml.bind.annotation.XmlType;
3+
import com.google.gson.annotations.SerializedName;
74

85
/**
96
* Definition: Identification of a cryptographic algorithm -- Reference: RFC 3880: Internet X.509
@@ -27,18 +24,14 @@
2724
* &lt;/complexType&gt;
2825
* </pre>
2926
*/
30-
@XmlAccessorType(XmlAccessType.FIELD)
31-
@XmlType(
32-
name = "AlgorithmIdentifier",
33-
propOrder = {"parameter"})
3427
public class AlgorithmIdentifier {
3528

3629
/** The Parameter. */
37-
@XmlElement(name = "Parameter")
30+
@SerializedName("Parameter")
3831
protected Parameter parameter;
3932

4033
/** The Algorithm. */
41-
@XmlElement(name = "Algorithm", required = true)
34+
@SerializedName("Algorithm")
4235
protected AlgorithmType algorithm;
4336

4437
/**

src/main/java/com/adyen/model/nexo/AlgorithmType.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package com.adyen.model.nexo;
22

3+
import com.google.gson.annotations.SerializedName;
34
import java.util.Arrays;
4-
import javax.xml.bind.annotation.XmlEnum;
5-
import javax.xml.bind.annotation.XmlEnumValue;
6-
import javax.xml.bind.annotation.XmlType;
75

86
/**
97
* Java class for AlgorithmType.
@@ -26,68 +24,66 @@
2624
* &lt;/simpleType&gt;
2725
* </pre>
2826
*/
29-
@XmlType(name = "AlgorithmType")
30-
@XmlEnum
3127
public enum AlgorithmType {
3228

3329
/**
3430
* Retail CBC-MAC (cf. ISO 9807, ANSI X9.19) - (OID: iso(1) member-body(2) fr(250) type-org (1)
3531
* gie-cb(79) algorithm(10) epas(1) 2)
3632
*/
37-
@XmlEnumValue("id-retail-cbc-mac")
33+
@SerializedName("id-retail-cbc-mac")
3834
ID_RETAIL_CBC_MAC("id-retail-cbc-mac"),
3935

4036
/**
4137
* Retail-CBC-MAC with SHA-256 - (OID: iso(1) member-body(2) fr(250) type-org (1) gie-cb(79)
4238
* algorithm(10) epas(1) 3)
4339
*/
44-
@XmlEnumValue("id-retail-cbc-mac-sha-256")
40+
@SerializedName("id-retail-cbc-mac-sha-256")
4541
ID_RETAIL_CBC_MAC_SHA_256("id-retail-cbc-mac-sha-256"),
4642

4743
/**
4844
* The UKPT or Master Session Key key encryption - (OID: iso(1) member-body(2) fr(250) type-org
4945
* (1) gie-cb(79) algorithm(10) epas(1) 4)
5046
*/
51-
@XmlEnumValue("id-ukpt-wrap ")
47+
@SerializedName("id-ukpt-wrap ")
5248
ID_UKPT_WRAP("id-ukpt-wrap "),
5349

5450
/**
5551
* DUKPT is specified in ANS X9.24-2004, Annex A, and ISO/DIS 13492-2006. - (OID: iso(1)
5652
* member-body(2) fr(250) type-org (1) gie-cb(79) algorithm(10) epas(1) 1)
5753
*/
58-
@XmlEnumValue("id-dukpt-wrap")
54+
@SerializedName("id-dukpt-wrap")
5955
ID_DUKPT_WRAP("id-dukpt-wrap"),
6056

6157
/**
6258
* Triple DES ECB encryption with double length key (112 Bit) as defined in FIPS PUB 46-3 - (OID:
6359
* iso(1) member-body(2) fr(250) type-org (1) gie-cb(79)
6460
*/
65-
@XmlEnumValue("des-ede3-ecb")
61+
@SerializedName("des-ede3-ecb")
6662
DES_EDE_3_ECB("des-ede3-ecb"),
6763

6864
/**
6965
* Triple DES CBC encryption with double length key (112 Bit) as defined in FIPS PUB 46-3 - (OID:
7066
* iso(1) member-body(2) us(840) rsadsi(113549)
7167
*/
72-
@XmlEnumValue("des-ede3-cbc")
68+
@SerializedName("des-ede3-cbc")
7369
DES_EDE_3_CBC("des-ede3-cbc"),
7470

7571
/** Message Digest Algorithm SHA-256 as defined in FIPS 180-1 and 2 - (ISO20022 Label: SHA256) */
76-
@XmlEnumValue("id-sha256")
72+
@SerializedName("id-sha256")
7773
ID_SHA_256("id-sha256"),
7874

7975
/**
8076
* Signature Algorithms SHA-256 with RSA - (OID: iso(1) member-body(2) us(840) rsadsi(113549)
8177
* pkcs(1) pkcs-1(1) 11)
8278
*/
83-
@XmlEnumValue("sha256WithRSAEncryption")
79+
@SerializedName("sha256WithRSAEncryption")
8480
SHA_256_WITH_RSA_ENCRYPTION("sha256WithRSAEncryption"),
8581

8682
/**
8783
* Key Transport Algorithm RSA - (OID: iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1)
8884
* pkcs-1(1) 1)
8985
*/
90-
@XmlEnumValue("rsaEncryption")
86+
@SerializedName("rsaEncryption")
9187
RSA_ENCRYPTION("rsaEncryption");
9288
private final String value;
9389

src/main/java/com/adyen/model/nexo/AlignmentType.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package com.adyen.model.nexo;
22

3+
import com.google.gson.annotations.SerializedName;
34
import java.util.Arrays;
4-
import javax.xml.bind.annotation.XmlEnum;
5-
import javax.xml.bind.annotation.XmlEnumValue;
6-
import javax.xml.bind.annotation.XmlType;
75

86
/**
97
* Java class for AlignmentType.
@@ -21,21 +19,19 @@
2119
* &lt;/simpleType&gt;
2220
* </pre>
2321
*/
24-
@XmlType(name = "AlignmentType")
25-
@XmlEnum
2622
public enum AlignmentType {
2723

2824
/** Left alignment type. */
29-
@XmlEnumValue("Left")
25+
@SerializedName("Left")
3026
LEFT("Left"),
3127
/** Right alignment type. */
32-
@XmlEnumValue("Right")
28+
@SerializedName("Right")
3329
RIGHT("Right"),
3430
/** Centred alignment type. */
35-
@XmlEnumValue("Centred")
31+
@SerializedName("Centred")
3632
CENTRED("Centred"),
3733
/** Justified alignment type. */
38-
@XmlEnumValue("Justified")
34+
@SerializedName("Justified")
3935
JUSTIFIED("Justified");
4036
private final String value;
4137

0 commit comments

Comments
 (0)