Skip to content

Commit de3d864

Browse files
committed
Applied 2_06_xml_scheme.patch
1 parent 8b49471 commit de3d864

File tree

7 files changed

+696
-0
lines changed

7 files changed

+696
-0
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
2+
package ru.javaops.masterjava.xml.schema;
3+
4+
import javax.xml.bind.annotation.XmlAccessType;
5+
import javax.xml.bind.annotation.XmlAccessorType;
6+
import javax.xml.bind.annotation.XmlAttribute;
7+
import javax.xml.bind.annotation.XmlID;
8+
import javax.xml.bind.annotation.XmlSchemaType;
9+
import javax.xml.bind.annotation.XmlType;
10+
import javax.xml.bind.annotation.XmlValue;
11+
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
12+
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
13+
14+
15+
/**
16+
* <p>Java class for cityType complex type.
17+
*
18+
* <p>The following schema fragment specifies the expected content contained within this class.
19+
*
20+
* <pre>
21+
* &lt;complexType name="cityType">
22+
* &lt;simpleContent>
23+
* &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string">
24+
* &lt;attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}ID" />
25+
* &lt;/extension>
26+
* &lt;/simpleContent>
27+
* &lt;/complexType>
28+
* </pre>
29+
*
30+
*
31+
*/
32+
@XmlAccessorType(XmlAccessType.FIELD)
33+
@XmlType(name = "cityType", namespace = "http://javaops.ru", propOrder = {
34+
"value"
35+
})
36+
public class CityType {
37+
38+
@XmlValue
39+
protected String value;
40+
@XmlAttribute(name = "id", required = true)
41+
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
42+
@XmlID
43+
@XmlSchemaType(name = "ID")
44+
protected String id;
45+
46+
/**
47+
* Gets the value of the value property.
48+
*
49+
* @return
50+
* possible object is
51+
* {@link String }
52+
*
53+
*/
54+
public String getValue() {
55+
return value;
56+
}
57+
58+
/**
59+
* Sets the value of the value property.
60+
*
61+
* @param value
62+
* allowed object is
63+
* {@link String }
64+
*
65+
*/
66+
public void setValue(String value) {
67+
this.value = value;
68+
}
69+
70+
/**
71+
* Gets the value of the id property.
72+
*
73+
* @return
74+
* possible object is
75+
* {@link String }
76+
*
77+
*/
78+
public String getId() {
79+
return id;
80+
}
81+
82+
/**
83+
* Sets the value of the id property.
84+
*
85+
* @param value
86+
* allowed object is
87+
* {@link String }
88+
*
89+
*/
90+
public void setId(String value) {
91+
this.id = value;
92+
}
93+
94+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
package ru.javaops.masterjava.xml.schema;
3+
4+
import javax.xml.bind.annotation.XmlEnum;
5+
import javax.xml.bind.annotation.XmlEnumValue;
6+
import javax.xml.bind.annotation.XmlType;
7+
8+
9+
/**
10+
* <p>Java class for flagType.
11+
*
12+
* <p>The following schema fragment specifies the expected content contained within this class.
13+
* <p>
14+
* <pre>
15+
* &lt;simpleType name="flagType">
16+
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
17+
* &lt;enumeration value="active"/>
18+
* &lt;enumeration value="deleted"/>
19+
* &lt;enumeration value="superuser"/>
20+
* &lt;/restriction>
21+
* &lt;/simpleType>
22+
* </pre>
23+
*
24+
*/
25+
@XmlType(name = "flagType", namespace = "http://javaops.ru")
26+
@XmlEnum
27+
public enum FlagType {
28+
29+
@XmlEnumValue("active")
30+
ACTIVE("active"),
31+
@XmlEnumValue("deleted")
32+
DELETED("deleted"),
33+
@XmlEnumValue("superuser")
34+
SUPERUSER("superuser");
35+
private final String value;
36+
37+
FlagType(String v) {
38+
value = v;
39+
}
40+
41+
public String value() {
42+
return value;
43+
}
44+
45+
public static FlagType fromValue(String v) {
46+
for (FlagType c: FlagType.values()) {
47+
if (c.value.equals(v)) {
48+
return c;
49+
}
50+
}
51+
throw new IllegalArgumentException(v);
52+
}
53+
54+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
2+
package ru.javaops.masterjava.xml.schema;
3+
4+
import javax.xml.bind.JAXBElement;
5+
import javax.xml.bind.annotation.XmlElementDecl;
6+
import javax.xml.bind.annotation.XmlRegistry;
7+
import javax.xml.namespace.QName;
8+
9+
10+
/**
11+
* This object contains factory methods for each
12+
* Java content interface and Java element interface
13+
* generated in the ru.javaops.masterjava.xml.schema package.
14+
* <p>An ObjectFactory allows you to programatically
15+
* construct new instances of the Java representation
16+
* for XML content. The Java representation of XML
17+
* content can consist of schema derived interfaces
18+
* and classes representing the binding of schema
19+
* type definitions, element declarations and model
20+
* groups. Factory methods for each of these are
21+
* provided in this class.
22+
*
23+
*/
24+
@XmlRegistry
25+
public class ObjectFactory {
26+
27+
private final static QName _City_QNAME = new QName("http://javaops.ru", "City");
28+
29+
/**
30+
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: ru.javaops.masterjava.xml.schema
31+
*
32+
*/
33+
public ObjectFactory() {
34+
}
35+
36+
/**
37+
* Create an instance of {@link Payload }
38+
*
39+
*/
40+
public Payload createPayload() {
41+
return new Payload();
42+
}
43+
44+
/**
45+
* Create an instance of {@link User }
46+
*
47+
*/
48+
public User createUser() {
49+
return new User();
50+
}
51+
52+
/**
53+
* Create an instance of {@link Payload.Cities }
54+
*
55+
*/
56+
public Payload.Cities createPayloadCities() {
57+
return new Payload.Cities();
58+
}
59+
60+
/**
61+
* Create an instance of {@link Payload.Users }
62+
*
63+
*/
64+
public Payload.Users createPayloadUsers() {
65+
return new Payload.Users();
66+
}
67+
68+
/**
69+
* Create an instance of {@link CityType }
70+
*
71+
*/
72+
public CityType createCityType() {
73+
return new CityType();
74+
}
75+
76+
/**
77+
* Create an instance of {@link JAXBElement }{@code <}{@link CityType }{@code >}}
78+
*
79+
*/
80+
@XmlElementDecl(namespace = "http://javaops.ru", name = "City")
81+
public JAXBElement<CityType> createCity(CityType value) {
82+
return new JAXBElement<CityType>(_City_QNAME, CityType.class, null, value);
83+
}
84+
85+
}

0 commit comments

Comments
 (0)