Skip to content

Commit ac8d440

Browse files
authored
Add files via upload
1 parent 258a633 commit ac8d440

File tree

2 files changed

+138
-0
lines changed

2 files changed

+138
-0
lines changed

aqteqworkflows/Lab2/JsonUtils.java

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package com.ClassicQueue.config;
2+
3+
import com.fasterxml.jackson.core.JsonProcessingException;
4+
import com.fasterxml.jackson.core.type.TypeReference;
5+
import com.fasterxml.jackson.databind.ObjectMapper;
6+
import com.fasterxml.jackson.databind.SerializationFeature;
7+
8+
import java.io.IOException;
9+
10+
public class JsonUtils {
11+
private final ObjectMapper json;
12+
public JsonUtils() {
13+
json = new ObjectMapper();
14+
json.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
15+
}
16+
public static ObjectMapper json() {
17+
return InstanceHolder.json.json;
18+
}
19+
public static <T> T read(String src, Class<T> valueType) {
20+
try {
21+
return json().readValue(src, valueType);
22+
} catch (IOException e) {
23+
throw new IllegalStateException(e);
24+
}
25+
}
26+
public static <T> T read(String src, TypeReference<T> valueTypeRef) {
27+
try {
28+
return json().readValue(src, valueTypeRef);
29+
} catch (IOException e) {
30+
throw new IllegalStateException(e);
31+
}
32+
}
33+
public static <T> T read(byte[] src, Class<T> valueType) {
34+
try {
35+
return json().readValue(src, valueType);
36+
} catch (IOException e) {
37+
throw new IllegalStateException(e);
38+
}
39+
}
40+
public static <T> T read(byte[] src, TypeReference<T> valueTypeRef) {
41+
try {
42+
return json().readValue(src, valueTypeRef);
43+
} catch (IOException e) {
44+
throw new IllegalStateException(e);
45+
}
46+
}
47+
public static String writeValueAsString(Object value) {
48+
try {
49+
return json().writeValueAsString(value);
50+
} catch (JsonProcessingException e) {
51+
throw new IllegalStateException(e);
52+
}
53+
}
54+
public static byte[] writeValueAsBytes(Object value) {
55+
try {
56+
return json().writeValueAsBytes(value);
57+
} catch (JsonProcessingException e) {
58+
throw new IllegalStateException(e);
59+
}
60+
}
61+
private static class InstanceHolder {
62+
static final JsonUtils json = new JsonUtils();
63+
}
64+
}

aqteqworkflows/Lab2/UserDetails.java

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package com.ClassicQueue.DTO;
2+
3+
import java.io.Serializable;
4+
5+
6+
public class UserDetails implements Serializable {
7+
8+
private static final long serialVersionUID = 1L;
9+
10+
private int orderId;
11+
12+
private String username;
13+
14+
private int otp;
15+
16+
private String deliveryStatus;
17+
18+
private String deliveryLocation;
19+
20+
public UserDetails() {
21+
22+
}
23+
24+
public UserDetails(int orderId, String username, int otp, String deliveryStatus, String deliveryLocation) {
25+
super();
26+
this.orderId = orderId;
27+
this.username = username;
28+
this.otp = otp;
29+
this.deliveryStatus = deliveryStatus;
30+
this.deliveryLocation = deliveryLocation;
31+
}
32+
33+
public int getOrderId() {
34+
return orderId;
35+
}
36+
37+
public void setOrderId(int orderId) {
38+
this.orderId = orderId;
39+
}
40+
41+
public String getUsername() {
42+
return username;
43+
}
44+
45+
public void setUsername(String username) {
46+
this.username = username;
47+
}
48+
49+
public int getOtp() {
50+
return otp;
51+
}
52+
53+
public void setOtp(int otp) {
54+
this.otp = otp;
55+
}
56+
57+
public String getDeliveryStatus() {
58+
return deliveryStatus;
59+
}
60+
61+
public void setDeliveryStatus(String deliveryStatus) {
62+
this.deliveryStatus = deliveryStatus;
63+
}
64+
65+
public String getDeliveryLocation() {
66+
return deliveryLocation;
67+
}
68+
69+
public void setDeliveryLocation(String deliveryLocation) {
70+
this.deliveryLocation = deliveryLocation;
71+
}
72+
73+
74+
}

0 commit comments

Comments
 (0)