01: package org.geotools.po.bindings;
02:
03: import java.math.BigDecimal;
04:
05: import org.geotools.xml.*;
06:
07: import org.geotools.po.ObjectFactory;
08: import org.geotools.po.USAddress;
09:
10: import javax.xml.namespace.QName;
11:
12: /**
13: * Binding object for the type http://www.geotools.org/po:USAddress.
14: *
15: * <p>
16: * <pre>
17: * <code>
18: * <xsd:complexType name="USAddress">
19: * <xsd:sequence>
20: * <xsd:element name="name" type="xsd:string"/>
21: * <xsd:element name="street" type="xsd:string"/>
22: * <xsd:element name="city" type="xsd:string"/>
23: * <xsd:element name="state" type="xsd:string"/>
24: * <xsd:element name="zip" type="xsd:decimal"/>
25: * </xsd:sequence>
26: * <xsd:attribute fixed="US" name="country" type="xsd:NMTOKEN"/>
27: * </xsd:complexType>
28: *
29: * </code>
30: * </pre>
31: * </p>
32: *
33: * @generated
34: */
35: public class USAddressBinding extends AbstractComplexBinding {
36:
37: ObjectFactory factory;
38:
39: public USAddressBinding(ObjectFactory factory) {
40: this .factory = factory;
41: }
42:
43: /**
44: * @generated
45: */
46: public QName getTarget() {
47: return PO.USAddress;
48: }
49:
50: /**
51: * <!-- begin-user-doc -->
52: * <!-- end-user-doc -->
53: *
54: * @generated modifiable
55: */
56: public Class getType() {
57: return null;
58: }
59:
60: /**
61: * <!-- begin-user-doc -->
62: * <!-- end-user-doc -->
63: *
64: * @generated modifiable
65: */
66: public Object parse(ElementInstance instance, Node node,
67: Object value) throws Exception {
68:
69: USAddress address = factory.createUSAddress();
70:
71: //elements
72: address.setName((String) node.getChildValue("name"));
73: address.setStreet((String) node.getChildValue("street"));
74: address.setCity((String) node.getChildValue("city"));
75: address.setState((String) node.getChildValue("state"));
76: address.setZip((BigDecimal) node.getChildValue("zip"));
77:
78: //attribute
79: address.setCountry((String) node.getAttributeValue("country"));
80:
81: return address;
82: }
83:
84: }
|