Skip to content

Commit b779c1d

Browse files
authored
rest of dead lived not again til thousand years
But the rest of the dead lived not again until the thousand years were finished. This is the first resurrection. (Revelation 20:5)
1 parent 3d064b4 commit b779c1d

1 file changed

Lines changed: 83 additions & 0 deletions

File tree

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
2+
//But the rest of the dead lived not again until the thousand years were finished. This is the first resurrection. (Revelation 20:5)
3+
4+
package com.javarush.task.task33.task3305;
5+
6+
import com.fasterxml.jackson.annotation.JsonSubTypes;
7+
import com.fasterxml.jackson.annotation.JsonTypeInfo;
8+
9+
10+
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, property = "className")
11+
@JsonSubTypes({
12+
@JsonSubTypes.Type(value = RaceBike.class, name = "race-bike"),
13+
@JsonSubTypes.Type(value = Motorbike.class, name = "motorbike"),
14+
@JsonSubTypes.Type(value = Car.class, name = "car")
15+
16+
})
17+
public abstract class Auto {
18+
protected String name;
19+
protected String owner;
20+
protected int age;
21+
}
22+
23+
/*
24+
Конвертация из одного класса в другой используя JSON
25+
26+
НЕОБХОДИМО: подключенные библиотеки Jackson Core, Bind и Annotation версии 2.6.1
27+
28+
29+
30+
Расставь JSON аннотации так, чтобы результат выполнения метода main был следующим:
31+
32+
{
33+
34+
"className" : ".Parking",
35+
36+
"name" : "Super Parking",
37+
38+
"city" : "Kyiv",
39+
40+
"autos" : [ {
41+
42+
"className" : "com.javarush.task.task33.task3305.RaceBike",
43+
44+
"name" : "Simba",
45+
46+
"owner" : "Peter",
47+
48+
"age" : 2
49+
50+
}, {
51+
52+
"className" : "com.javarush.task.task33.task3305.Motorbike",
53+
54+
"name" : "Manny",
55+
56+
"owner" : null
57+
58+
}, {
59+
60+
"className" : "com.javarush.task.task33.task3305.Car"
61+
62+
} ]
63+
64+
}
65+
66+
67+
68+
Подсказка: это всего два класса.
69+
70+
71+
72+
73+
74+
Требования:
75+
76+
1. Вывод на экран должен соответствовать условию задачи.
77+
78+
2. Класс Parking должен быть отмечен аннотацией @JsonTypeInfo с подходящим набором параметров.
79+
80+
3. Класс Auto должен быть отмечен аннотацией @JsonTypeInfo с подходящим набором параметров.
81+
82+
4. Класс Auto должен быть отмечен аннотацией @JsonSubTypes с подходящим набором параметров.
83+
*/

0 commit comments

Comments
 (0)