Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 34e7277

Browse files
authoredFeb 1, 2022
[JAVA-9021] Clean up uncommitted artifacts (eugenp#11754)
1 parent 49fc854 commit 34e7277

File tree

10 files changed

+382
-329
lines changed

10 files changed

+382
-329
lines changed
 

‎apache-poi/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
*.docx
22
temp.xls
33
temp.xlsx
4+
5+
CellStyleTest_output.xlsx
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/target/
22
.settings/
33
.classpath
4-
.project
4+
.project
5+
6+
*.log

‎core-java-modules/core-java-serialization/src/test/java/com/baeldung/externalizable/ExternalizableUnitTest.java

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
11
package com.baeldung.externalizable;
22

3+
import org.junit.Before;
4+
import org.junit.Rule;
35
import org.junit.Test;
6+
import org.junit.rules.TemporaryFolder;
47

58
import java.io.*;
69

10+
import static org.junit.Assert.assertEquals;
11+
import static org.junit.Assert.assertNull;
712
import static org.junit.Assert.assertTrue;
813

914
public class ExternalizableUnitTest {
1015

11-
private final static String OUTPUT_FILE = "externalizable.txt";
16+
private final static String OUTPUT_FILE_NAME = "externalizable.txt";
17+
18+
@Rule
19+
public TemporaryFolder tempFolder = new TemporaryFolder();
20+
21+
private File outputFile;
22+
23+
@Before
24+
public void setUp() throws Exception {
25+
outputFile = tempFolder.newFile(OUTPUT_FILE_NAME);
26+
}
1227

1328
@Test
1429
public void whenSerializing_thenUseExternalizable() throws IOException, ClassNotFoundException {
@@ -18,15 +33,15 @@ public void whenSerializing_thenUseExternalizable() throws IOException, ClassNot
1833
c.setCode(374);
1934
c.setName("Armenia");
2035

21-
FileOutputStream fileOutputStream = new FileOutputStream(OUTPUT_FILE);
36+
FileOutputStream fileOutputStream = new FileOutputStream(outputFile);
2237
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
2338
c.writeExternal(objectOutputStream);
2439

2540
objectOutputStream.flush();
2641
objectOutputStream.close();
2742
fileOutputStream.close();
2843

29-
FileInputStream fileInputStream = new FileInputStream(OUTPUT_FILE);
44+
FileInputStream fileInputStream = new FileInputStream(outputFile);
3045
ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
3146

3247
Country c2 = new Country();
@@ -35,8 +50,8 @@ public void whenSerializing_thenUseExternalizable() throws IOException, ClassNot
3550
objectInputStream.close();
3651
fileInputStream.close();
3752

38-
assertTrue(c2.getCode() == c.getCode());
39-
assertTrue(c2.getName().equals(c.getName()));
53+
assertEquals(c2.getCode(), c.getCode());
54+
assertEquals(c2.getName(), c.getName());
4055
}
4156

4257
@Test
@@ -49,15 +64,15 @@ public void whenInheritanceSerialization_then_UseExternalizable() throws IOExcep
4964
r.setClimate("Mediterranean");
5065
r.setPopulation(120.000);
5166

52-
FileOutputStream fileOutputStream = new FileOutputStream(OUTPUT_FILE);
67+
FileOutputStream fileOutputStream = new FileOutputStream(outputFile);
5368
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
5469
r.writeExternal(objectOutputStream);
5570

5671
objectOutputStream.flush();
5772
objectOutputStream.close();
5873
fileOutputStream.close();
5974

60-
FileInputStream fileInputStream = new FileInputStream(OUTPUT_FILE);
75+
FileInputStream fileInputStream = new FileInputStream(outputFile);
6176
ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
6277

6378
Region r2 = new Region();
@@ -66,6 +81,6 @@ public void whenInheritanceSerialization_then_UseExternalizable() throws IOExcep
6681
objectInputStream.close();
6782
fileInputStream.close();
6883

69-
assertTrue(r2.getPopulation() == null);
84+
assertNull(r2.getPopulation());
7085
}
7186
}
Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,54 @@
11
package com.baeldung.serialization;
22

3+
import org.junit.Before;
4+
import org.junit.Rule;
35
import org.junit.Test;
6+
import org.junit.rules.TemporaryFolder;
47

8+
import java.io.File;
59
import java.io.FileInputStream;
610
import java.io.FileOutputStream;
711
import java.io.IOException;
812
import java.io.ObjectInputStream;
913
import java.io.ObjectOutputStream;
1014

15+
import static org.junit.Assert.assertEquals;
1116
import static org.junit.Assert.assertTrue;
1217

1318
public class PersonUnitTest {
1419

20+
@Rule
21+
public TemporaryFolder tempFolder = new TemporaryFolder();
22+
23+
private File outputFile;
24+
25+
private File outputFile2;
26+
27+
@Before
28+
public void setUp() throws Exception {
29+
outputFile = tempFolder.newFile("yourfile.txt");
30+
outputFile2 = tempFolder.newFile("yourfile2.txt");
31+
}
32+
1533
@Test
1634
public void whenSerializingAndDeserializing_ThenObjectIsTheSame() throws IOException, ClassNotFoundException {
1735
Person p = new Person();
1836
p.setAge(20);
1937
p.setName("Joe");
2038

21-
FileOutputStream fileOutputStream = new FileOutputStream("yofile.txt");
39+
FileOutputStream fileOutputStream = new FileOutputStream(outputFile);
2240
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
2341
objectOutputStream.writeObject(p);
2442
objectOutputStream.flush();
2543
objectOutputStream.close();
2644

27-
FileInputStream fileInputStream = new FileInputStream("yofile.txt");
45+
FileInputStream fileInputStream = new FileInputStream(outputFile);
2846
ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
2947
Person p2 = (Person) objectInputStream.readObject();
3048
objectInputStream.close();
3149

32-
assertTrue(p2.getAge() == p.getAge());
33-
assertTrue(p2.getName().equals(p.getName()));
50+
assertEquals(p2.getAge(), p.getAge());
51+
assertEquals(p2.getName(), p.getName());
3452
}
3553

3654
@Test
@@ -46,19 +64,19 @@ public void whenCustomSerializingAndDeserializing_ThenObjectIsTheSame() throws I
4664
e.setPerson(p);
4765
e.setAddress(a);
4866

49-
FileOutputStream fileOutputStream = new FileOutputStream("yofile2.txt");
67+
FileOutputStream fileOutputStream = new FileOutputStream(outputFile2);
5068
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
5169
objectOutputStream.writeObject(e);
5270
objectOutputStream.flush();
5371
objectOutputStream.close();
5472

55-
FileInputStream fileInputStream = new FileInputStream("yofile2.txt");
73+
FileInputStream fileInputStream = new FileInputStream(outputFile2);
5674
ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
5775
Employee e2 = (Employee) objectInputStream.readObject();
5876
objectInputStream.close();
5977

60-
assertTrue(e2.getPerson().getAge() == e.getPerson().getAge());
61-
assertTrue(e2.getAddress().getHouseNumber() == (e.getAddress().getHouseNumber()));
78+
assertEquals(e2.getPerson().getAge(), e.getPerson().getAge());
79+
assertEquals(e2.getAddress().getHouseNumber(), (e.getAddress().getHouseNumber()));
6280
}
6381

6482
}

‎core-java-modules/core-java-serialization/src/test/java/com/baeldung/serialization/SerializationUnitTest.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import static org.junit.Assert.assertFalse;
55
import static org.junit.jupiter.api.Assertions.assertTrue;
66

7+
import java.io.File;
78
import java.io.FileInputStream;
89
import java.io.FileOutputStream;
910
import java.io.IOException;
@@ -13,17 +14,32 @@
1314
import java.io.Serializable;
1415

1516
import org.apache.commons.lang3.SerializationUtils;
17+
import org.junit.Before;
18+
import org.junit.Rule;
1619
import org.junit.Test;
1720

1821
import com.baeldung.util.MySerializationUtils;
22+
import org.junit.rules.TemporaryFolder;
1923

2024
public class SerializationUnitTest {
2125

26+
private final static String OUTPUT_FILE_NAME = "yourfile.txt";
27+
28+
@Rule
29+
public TemporaryFolder tempFolder = new TemporaryFolder();
30+
31+
private File outputFile;
32+
33+
@Before
34+
public void setUp() throws Exception {
35+
outputFile = tempFolder.newFile(OUTPUT_FILE_NAME);
36+
}
37+
2238
@Test(expected = NotSerializableException.class)
2339
public void whenSerializing_ThenThrowsError() throws IOException {
2440
Address address = new Address();
2541
address.setHouseNumber(10);
26-
FileOutputStream fileOutputStream = new FileOutputStream("yofile.txt");
42+
FileOutputStream fileOutputStream = new FileOutputStream(outputFile);
2743
try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream)) {
2844
objectOutputStream.writeObject(address);
2945
}
@@ -35,12 +51,12 @@ public void whenSerializingAndDeserializing_ThenObjectIsTheSame() throws IOExcep
3551
p.setAge(20);
3652
p.setName("Joe");
3753

38-
FileOutputStream fileOutputStream = new FileOutputStream("yofile.txt");
54+
FileOutputStream fileOutputStream = new FileOutputStream(outputFile);
3955
try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream)) {
4056
objectOutputStream.writeObject(p);
4157
}
4258

43-
FileInputStream fileInputStream = new FileInputStream("yofile.txt");
59+
FileInputStream fileInputStream = new FileInputStream(outputFile);
4460
try (ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream)) {
4561
Person p2 = (Person) objectInputStream.readObject();
4662
assertEquals(p2.getAge(), p.getAge());
Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
2-
package com.baeldung.jaxb.gen;
3-
4-
import javax.xml.bind.annotation.XmlRegistry;
5-
6-
7-
/**
8-
* This object contains factory methods for each
9-
* Java content interface and Java element interface
10-
* generated in the com.baeldung.jaxb.gen package.
11-
* <p>An ObjectFactory allows you to programatically
12-
* construct new instances of the Java representation
13-
* for XML content. The Java representation of XML
14-
* content can consist of schema derived interfaces
15-
* and classes representing the binding of schema
16-
* type definitions, element declarations and model
17-
* groups. Factory methods for each of these are
18-
* provided in this class.
19-
*
20-
*/
21-
@XmlRegistry
22-
public class ObjectFactory {
23-
24-
25-
/**
26-
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.baeldung.jaxb.gen
27-
*
28-
*/
29-
public ObjectFactory() {
30-
}
31-
32-
/**
33-
* Create an instance of {@link UserRequest }
34-
*
35-
*/
36-
public UserRequest createUserRequest() {
37-
return new UserRequest();
38-
}
39-
40-
/**
41-
* Create an instance of {@link UserResponse }
42-
*
43-
*/
44-
public UserResponse createUserResponse() {
45-
return new UserResponse();
46-
}
47-
48-
}
1+
2+
package com.baeldung.jaxb.gen;
3+
4+
import javax.xml.bind.annotation.XmlRegistry;
5+
6+
7+
/**
8+
* This object contains factory methods for each
9+
* Java content interface and Java element interface
10+
* generated in the com.baeldung.jaxb.gen package.
11+
* <p>An ObjectFactory allows you to programatically
12+
* construct new instances of the Java representation
13+
* for XML content. The Java representation of XML
14+
* content can consist of schema derived interfaces
15+
* and classes representing the binding of schema
16+
* type definitions, element declarations and model
17+
* groups. Factory methods for each of these are
18+
* provided in this class.
19+
*
20+
*/
21+
@XmlRegistry
22+
public class ObjectFactory {
23+
24+
25+
/**
26+
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.baeldung.jaxb.gen
27+
*
28+
*/
29+
public ObjectFactory() {
30+
}
31+
32+
/**
33+
* Create an instance of {@link UserRequest }
34+
*
35+
*/
36+
public UserRequest createUserRequest() {
37+
return new UserRequest();
38+
}
39+
40+
/**
41+
* Create an instance of {@link UserResponse }
42+
*
43+
*/
44+
public UserResponse createUserResponse() {
45+
return new UserResponse();
46+
}
47+
48+
}
Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,87 @@
1-
2-
package com.baeldung.jaxb.gen;
3-
4-
import java.io.Serializable;
5-
import javax.xml.bind.annotation.XmlAccessType;
6-
import javax.xml.bind.annotation.XmlAccessorType;
7-
import javax.xml.bind.annotation.XmlElement;
8-
import javax.xml.bind.annotation.XmlRootElement;
9-
import javax.xml.bind.annotation.XmlType;
10-
11-
12-
/**
13-
* <p>Java class for UserRequest complex type.
14-
*
15-
* <p>The following schema fragment specifies the expected content contained within this class.
16-
*
17-
* <pre>
18-
* &lt;complexType name="UserRequest"&gt;
19-
* &lt;complexContent&gt;
20-
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
21-
* &lt;sequence&gt;
22-
* &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/&gt;
23-
* &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
24-
* &lt;/sequence&gt;
25-
* &lt;/restriction&gt;
26-
* &lt;/complexContent&gt;
27-
* &lt;/complexType&gt;
28-
* </pre>
29-
*
30-
*
31-
*/
32-
@XmlAccessorType(XmlAccessType.FIELD)
33-
@XmlType(name = "UserRequest", propOrder = {
34-
"id",
35-
"name"
36-
})
37-
@XmlRootElement(name = "userRequest")
38-
public class UserRequest
39-
implements Serializable
40-
{
41-
42-
private final static long serialVersionUID = -1L;
43-
protected int id;
44-
@XmlElement(required = true)
45-
protected String name;
46-
47-
/**
48-
* Gets the value of the id property.
49-
*
50-
*/
51-
public int getId() {
52-
return id;
53-
}
54-
55-
/**
56-
* Sets the value of the id property.
57-
*
58-
*/
59-
public void setId(int value) {
60-
this.id = value;
61-
}
62-
63-
/**
64-
* Gets the value of the name property.
65-
*
66-
* @return
67-
* possible object is
68-
* {@link String }
69-
*
70-
*/
71-
public String getName() {
72-
return name;
73-
}
74-
75-
/**
76-
* Sets the value of the name property.
77-
*
78-
* @param value
79-
* allowed object is
80-
* {@link String }
81-
*
82-
*/
83-
public void setName(String value) {
84-
this.name = value;
85-
}
86-
87-
}
1+
2+
package com.baeldung.jaxb.gen;
3+
4+
import java.io.Serializable;
5+
import javax.xml.bind.annotation.XmlAccessType;
6+
import javax.xml.bind.annotation.XmlAccessorType;
7+
import javax.xml.bind.annotation.XmlElement;
8+
import javax.xml.bind.annotation.XmlRootElement;
9+
import javax.xml.bind.annotation.XmlType;
10+
11+
12+
/**
13+
* <p>Java class for UserRequest complex type.
14+
*
15+
* <p>The following schema fragment specifies the expected content contained within this class.
16+
*
17+
* <pre>
18+
* &lt;complexType name="UserRequest"&gt;
19+
* &lt;complexContent&gt;
20+
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
21+
* &lt;sequence&gt;
22+
* &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/&gt;
23+
* &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
24+
* &lt;/sequence&gt;
25+
* &lt;/restriction&gt;
26+
* &lt;/complexContent&gt;
27+
* &lt;/complexType&gt;
28+
* </pre>
29+
*
30+
*
31+
*/
32+
@XmlAccessorType(XmlAccessType.FIELD)
33+
@XmlType(name = "UserRequest", propOrder = {
34+
"id",
35+
"name"
36+
})
37+
@XmlRootElement(name = "userRequest")
38+
public class UserRequest
39+
implements Serializable
40+
{
41+
42+
private final static long serialVersionUID = -1L;
43+
protected int id;
44+
@XmlElement(required = true)
45+
protected String name;
46+
47+
/**
48+
* Gets the value of the id property.
49+
*
50+
*/
51+
public int getId() {
52+
return id;
53+
}
54+
55+
/**
56+
* Sets the value of the id property.
57+
*
58+
*/
59+
public void setId(int value) {
60+
this.id = value;
61+
}
62+
63+
/**
64+
* Gets the value of the name property.
65+
*
66+
* @return
67+
* possible object is
68+
* {@link String }
69+
*
70+
*/
71+
public String getName() {
72+
return name;
73+
}
74+
75+
/**
76+
* Sets the value of the name property.
77+
*
78+
* @param value
79+
* allowed object is
80+
* {@link String }
81+
*
82+
*/
83+
public void setName(String value) {
84+
this.name = value;
85+
}
86+
87+
}
Lines changed: 149 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,149 @@
1-
2-
package com.baeldung.jaxb.gen;
3-
4-
import java.io.Serializable;
5-
import java.util.Calendar;
6-
import javax.xml.bind.annotation.XmlAccessType;
7-
import javax.xml.bind.annotation.XmlAccessorType;
8-
import javax.xml.bind.annotation.XmlElement;
9-
import javax.xml.bind.annotation.XmlRootElement;
10-
import javax.xml.bind.annotation.XmlSchemaType;
11-
import javax.xml.bind.annotation.XmlType;
12-
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
13-
import org.w3._2001.xmlschema.Adapter1;
14-
15-
16-
/**
17-
* <p>Java class for UserResponse complex type.
18-
*
19-
* <p>The following schema fragment specifies the expected content contained within this class.
20-
*
21-
* <pre>
22-
* &lt;complexType name="UserResponse"&gt;
23-
* &lt;complexContent&gt;
24-
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
25-
* &lt;sequence&gt;
26-
* &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/&gt;
27-
* &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
28-
* &lt;element name="gender" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
29-
* &lt;element name="created" type="{http://www.w3.org/2001/XMLSchema}dateTime"/&gt;
30-
* &lt;/sequence&gt;
31-
* &lt;/restriction&gt;
32-
* &lt;/complexContent&gt;
33-
* &lt;/complexType&gt;
34-
* </pre>
35-
*
36-
*
37-
*/
38-
@XmlAccessorType(XmlAccessType.FIELD)
39-
@XmlType(name = "UserResponse", propOrder = {
40-
"id",
41-
"name",
42-
"gender",
43-
"created"
44-
})
45-
@XmlRootElement(name = "userResponse")
46-
public class UserResponse
47-
implements Serializable
48-
{
49-
50-
private final static long serialVersionUID = -1L;
51-
protected int id;
52-
@XmlElement(required = true)
53-
protected String name;
54-
@XmlElement(required = true)
55-
protected String gender;
56-
@XmlElement(required = true, type = String.class)
57-
@XmlJavaTypeAdapter(Adapter1 .class)
58-
@XmlSchemaType(name = "dateTime")
59-
protected Calendar created;
60-
61-
/**
62-
* Gets the value of the id property.
63-
*
64-
*/
65-
public int getId() {
66-
return id;
67-
}
68-
69-
/**
70-
* Sets the value of the id property.
71-
*
72-
*/
73-
public void setId(int value) {
74-
this.id = value;
75-
}
76-
77-
/**
78-
* Gets the value of the name property.
79-
*
80-
* @return
81-
* possible object is
82-
* {@link String }
83-
*
84-
*/
85-
public String getName() {
86-
return name;
87-
}
88-
89-
/**
90-
* Sets the value of the name property.
91-
*
92-
* @param value
93-
* allowed object is
94-
* {@link String }
95-
*
96-
*/
97-
public void setName(String value) {
98-
this.name = value;
99-
}
100-
101-
/**
102-
* Gets the value of the gender property.
103-
*
104-
* @return
105-
* possible object is
106-
* {@link String }
107-
*
108-
*/
109-
public String getGender() {
110-
return gender;
111-
}
112-
113-
/**
114-
* Sets the value of the gender property.
115-
*
116-
* @param value
117-
* allowed object is
118-
* {@link String }
119-
*
120-
*/
121-
public void setGender(String value) {
122-
this.gender = value;
123-
}
124-
125-
/**
126-
* Gets the value of the created property.
127-
*
128-
* @return
129-
* possible object is
130-
* {@link String }
131-
*
132-
*/
133-
public Calendar getCreated() {
134-
return created;
135-
}
136-
137-
/**
138-
* Sets the value of the created property.
139-
*
140-
* @param value
141-
* allowed object is
142-
* {@link String }
143-
*
144-
*/
145-
public void setCreated(Calendar value) {
146-
this.created = value;
147-
}
148-
149-
}
1+
2+
package com.baeldung.jaxb.gen;
3+
4+
import java.io.Serializable;
5+
import java.util.Calendar;
6+
import javax.xml.bind.annotation.XmlAccessType;
7+
import javax.xml.bind.annotation.XmlAccessorType;
8+
import javax.xml.bind.annotation.XmlElement;
9+
import javax.xml.bind.annotation.XmlRootElement;
10+
import javax.xml.bind.annotation.XmlSchemaType;
11+
import javax.xml.bind.annotation.XmlType;
12+
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
13+
import org.w3._2001.xmlschema.Adapter1;
14+
15+
16+
/**
17+
* <p>Java class for UserResponse complex type.
18+
*
19+
* <p>The following schema fragment specifies the expected content contained within this class.
20+
*
21+
* <pre>
22+
* &lt;complexType name="UserResponse"&gt;
23+
* &lt;complexContent&gt;
24+
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
25+
* &lt;sequence&gt;
26+
* &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/&gt;
27+
* &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
28+
* &lt;element name="gender" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
29+
* &lt;element name="created" type="{http://www.w3.org/2001/XMLSchema}dateTime"/&gt;
30+
* &lt;/sequence&gt;
31+
* &lt;/restriction&gt;
32+
* &lt;/complexContent&gt;
33+
* &lt;/complexType&gt;
34+
* </pre>
35+
*
36+
*
37+
*/
38+
@XmlAccessorType(XmlAccessType.FIELD)
39+
@XmlType(name = "UserResponse", propOrder = {
40+
"id",
41+
"name",
42+
"gender",
43+
"created"
44+
})
45+
@XmlRootElement(name = "userResponse")
46+
public class UserResponse
47+
implements Serializable
48+
{
49+
50+
private final static long serialVersionUID = -1L;
51+
protected int id;
52+
@XmlElement(required = true)
53+
protected String name;
54+
@XmlElement(required = true)
55+
protected String gender;
56+
@XmlElement(required = true, type = String.class)
57+
@XmlJavaTypeAdapter(Adapter1 .class)
58+
@XmlSchemaType(name = "dateTime")
59+
protected Calendar created;
60+
61+
/**
62+
* Gets the value of the id property.
63+
*
64+
*/
65+
public int getId() {
66+
return id;
67+
}
68+
69+
/**
70+
* Sets the value of the id property.
71+
*
72+
*/
73+
public void setId(int value) {
74+
this.id = value;
75+
}
76+
77+
/**
78+
* Gets the value of the name property.
79+
*
80+
* @return
81+
* possible object is
82+
* {@link String }
83+
*
84+
*/
85+
public String getName() {
86+
return name;
87+
}
88+
89+
/**
90+
* Sets the value of the name property.
91+
*
92+
* @param value
93+
* allowed object is
94+
* {@link String }
95+
*
96+
*/
97+
public void setName(String value) {
98+
this.name = value;
99+
}
100+
101+
/**
102+
* Gets the value of the gender property.
103+
*
104+
* @return
105+
* possible object is
106+
* {@link String }
107+
*
108+
*/
109+
public String getGender() {
110+
return gender;
111+
}
112+
113+
/**
114+
* Sets the value of the gender property.
115+
*
116+
* @param value
117+
* allowed object is
118+
* {@link String }
119+
*
120+
*/
121+
public void setGender(String value) {
122+
this.gender = value;
123+
}
124+
125+
/**
126+
* Gets the value of the created property.
127+
*
128+
* @return
129+
* possible object is
130+
* {@link String }
131+
*
132+
*/
133+
public Calendar getCreated() {
134+
return created;
135+
}
136+
137+
/**
138+
* Sets the value of the created property.
139+
*
140+
* @param value
141+
* allowed object is
142+
* {@link String }
143+
*
144+
*/
145+
public void setCreated(Calendar value) {
146+
this.created = value;
147+
}
148+
149+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.baeldung.com/jaxb/gen", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
2-
package com.baeldung.jaxb.gen;
1+
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.baeldung.com/jaxb/gen", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
2+
package com.baeldung.jaxb.gen;
Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
2-
package org.w3._2001.xmlschema;
3-
4-
import java.util.Calendar;
5-
import javax.xml.bind.annotation.adapters.XmlAdapter;
6-
7-
public class Adapter1
8-
extends XmlAdapter<String, Calendar>
9-
{
10-
11-
12-
public Calendar unmarshal(String value) {
13-
return (javax.xml.bind.DatatypeConverter.parseDateTime(value));
14-
}
15-
16-
public String marshal(Calendar value) {
17-
if (value == null) {
18-
return null;
19-
}
20-
return (javax.xml.bind.DatatypeConverter.printDateTime(value));
21-
}
22-
23-
}
1+
2+
package org.w3._2001.xmlschema;
3+
4+
import java.util.Calendar;
5+
import javax.xml.bind.annotation.adapters.XmlAdapter;
6+
7+
public class Adapter1
8+
extends XmlAdapter<String, Calendar>
9+
{
10+
11+
12+
public Calendar unmarshal(String value) {
13+
return (javax.xml.bind.DatatypeConverter.parseDateTime(value));
14+
}
15+
16+
public String marshal(Calendar value) {
17+
if (value == null) {
18+
return null;
19+
}
20+
return (javax.xml.bind.DatatypeConverter.printDateTime(value));
21+
}
22+
23+
}

0 commit comments

Comments
 (0)
Please sign in to comment.