-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSolution.java
More file actions
34 lines (19 loc) · 1.24 KB
/
Solution.java
File metadata and controls
34 lines (19 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//And shall go out to deceive the nations which are in the four quarters of the earth, Gog and Magog, to gather them together to battle: the number of whom is as the sand of the sea. (Revelation 20:8)
public class Event {
public String name;
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "dd-MM-yyyy hh:mm:ss")
public Date eventDate;
public Event(String name) {
this.name = name;
eventDate = new Date();
}
}
/*
Сериализация даты в JSON
Используя аннотацию JsonFormat сделай так, чтобы поле содержащее дату в классе Event сериализировалось в формате (dd-MM-yyyy hh:mm:ss).
Требования:
1. Поле eventDate в классе Event должно быть отмечено аннотацией @JsonFormat.
2. Объекты типа Event должны корректно сериализовываться в JSON в соответствии с условием задачи.
3. В конструкторе класса Event должен быть создан новый объект типа Date без аргументов.
4. Поле eventDate должно быть публичным.
*/