Skip to content

Commit e2e1c37

Browse files
committed
3_1_HW2_schema
1 parent 1819bf2 commit e2e1c37

7 files changed

Lines changed: 516 additions & 63 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
package ru.javaops.masterjava.xml.schema;
3+
4+
import javax.xml.bind.annotation.XmlEnum;
5+
import javax.xml.bind.annotation.XmlType;
6+
7+
8+
/**
9+
* <p>Java class for groupType.
10+
*
11+
* <p>The following schema fragment specifies the expected content contained within this class.
12+
* <p>
13+
* <pre>
14+
* &lt;simpleType name="groupType">
15+
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
16+
* &lt;enumeration value="REGISTERING"/>
17+
* &lt;enumeration value="CURRENT"/>
18+
* &lt;enumeration value="FINISHED"/>
19+
* &lt;/restriction>
20+
* &lt;/simpleType>
21+
* </pre>
22+
*
23+
*/
24+
@XmlType(name = "groupType", namespace = "http://javaops.ru")
25+
@XmlEnum
26+
public enum GroupType {
27+
28+
REGISTERING,
29+
CURRENT,
30+
FINISHED;
31+
32+
public String value() {
33+
return name();
34+
}
35+
36+
public static GroupType fromValue(String v) {
37+
return valueOf(v);
38+
}
39+
40+
}

‎src/main/java/ru/javaops/masterjava/xml/schema/ObjectFactory.java‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ public class ObjectFactory {
3333
public ObjectFactory() {
3434
}
3535

36+
/**
37+
* Create an instance of {@link Project }
38+
*
39+
*/
40+
public Project createProject() {
41+
return new Project();
42+
}
43+
3644
/**
3745
* Create an instance of {@link Payload }
3846
*
@@ -41,6 +49,14 @@ public Payload createPayload() {
4149
return new Payload();
4250
}
4351

52+
/**
53+
* Create an instance of {@link Project.Group }
54+
*
55+
*/
56+
public Project.Group createProjectGroup() {
57+
return new Project.Group();
58+
}
59+
4460
/**
4561
* Create an instance of {@link User }
4662
*
@@ -49,6 +65,14 @@ public User createUser() {
4965
return new User();
5066
}
5167

68+
/**
69+
* Create an instance of {@link Payload.Projects }
70+
*
71+
*/
72+
public Payload.Projects createPayloadProjects() {
73+
return new Payload.Projects();
74+
}
75+
5276
/**
5377
* Create an instance of {@link Payload.Cities }
5478
*

‎src/main/java/ru/javaops/masterjava/xml/schema/Payload.java‎

Lines changed: 103 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11

22
package ru.javaops.masterjava.xml.schema;
33

4+
import javax.xml.bind.annotation.*;
45
import java.util.ArrayList;
56
import java.util.List;
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.XmlType;
117

128

139
/**
@@ -19,7 +15,18 @@
1915
* &lt;complexType>
2016
* &lt;complexContent>
2117
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
22-
* &lt;all>
18+
* &lt;sequence>
19+
* &lt;element name="Projects">
20+
* &lt;complexType>
21+
* &lt;complexContent>
22+
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
23+
* &lt;sequence maxOccurs="unbounded">
24+
* &lt;element ref="{http://javaops.ru}Project"/>
25+
* &lt;/sequence>
26+
* &lt;/restriction>
27+
* &lt;/complexContent>
28+
* &lt;/complexType>
29+
* &lt;/element>
2330
* &lt;element name="Cities">
2431
* &lt;complexType>
2532
* &lt;complexContent>
@@ -42,7 +49,7 @@
4249
* &lt;/complexContent>
4350
* &lt;/complexType>
4451
* &lt;/element>
45-
* &lt;/all>
52+
* &lt;/sequence>
4653
* &lt;/restriction>
4754
* &lt;/complexContent>
4855
* &lt;/complexType>
@@ -52,16 +59,44 @@
5259
*/
5360
@XmlAccessorType(XmlAccessType.FIELD)
5461
@XmlType(name = "", propOrder = {
55-
62+
"projects",
63+
"cities",
64+
"users"
5665
})
5766
@XmlRootElement(name = "Payload", namespace = "http://javaops.ru")
5867
public class Payload {
5968

69+
@XmlElement(name = "Projects", namespace = "http://javaops.ru", required = true)
70+
protected Payload.Projects projects;
6071
@XmlElement(name = "Cities", namespace = "http://javaops.ru", required = true)
6172
protected Payload.Cities cities;
6273
@XmlElement(name = "Users", namespace = "http://javaops.ru", required = true)
6374
protected Payload.Users users;
6475

76+
/**
77+
* Gets the value of the projects property.
78+
*
79+
* @return
80+
* possible object is
81+
* {@link Payload.Projects }
82+
*
83+
*/
84+
public Payload.Projects getProjects() {
85+
return projects;
86+
}
87+
88+
/**
89+
* Sets the value of the projects property.
90+
*
91+
* @param value
92+
* allowed object is
93+
* {@link Payload.Projects }
94+
*
95+
*/
96+
public void setProjects(Payload.Projects value) {
97+
this.projects = value;
98+
}
99+
65100
/**
66101
* Gets the value of the cities property.
67102
*
@@ -171,6 +206,66 @@ public List<CityType> getCity() {
171206
}
172207

173208

209+
/**
210+
* <p>Java class for anonymous complex type.
211+
*
212+
* <p>The following schema fragment specifies the expected content contained within this class.
213+
*
214+
* <pre>
215+
* &lt;complexType>
216+
* &lt;complexContent>
217+
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
218+
* &lt;sequence maxOccurs="unbounded">
219+
* &lt;element ref="{http://javaops.ru}Project"/>
220+
* &lt;/sequence>
221+
* &lt;/restriction>
222+
* &lt;/complexContent>
223+
* &lt;/complexType>
224+
* </pre>
225+
*
226+
*
227+
*/
228+
@XmlAccessorType(XmlAccessType.FIELD)
229+
@XmlType(name = "", propOrder = {
230+
"project"
231+
})
232+
public static class Projects {
233+
234+
@XmlElement(name = "Project", namespace = "http://javaops.ru", required = true)
235+
protected List<Project> project;
236+
237+
/**
238+
* Gets the value of the project property.
239+
*
240+
* <p>
241+
* This accessor method returns a reference to the live list,
242+
* not a snapshot. Therefore any modification you make to the
243+
* returned list will be present inside the JAXB object.
244+
* This is why there is not a <CODE>set</CODE> method for the project property.
245+
*
246+
* <p>
247+
* For example, to add a new item, do as follows:
248+
* <pre>
249+
* getProject().add(newItem);
250+
* </pre>
251+
*
252+
*
253+
* <p>
254+
* Objects of the following type(s) are allowed in the list
255+
* {@link Project }
256+
*
257+
*
258+
*/
259+
public List<Project> getProject() {
260+
if (project == null) {
261+
project = new ArrayList<Project>();
262+
}
263+
return this.project;
264+
}
265+
266+
}
267+
268+
174269
/**
175270
* <p>Java class for anonymous complex type.
176271
*

0 commit comments

Comments
 (0)