01: package org.geotools.ml.bindings;
02:
03: import java.math.BigInteger;
04: import java.util.List;
05:
06: import javax.xml.namespace.QName;
07:
08: import org.geotools.ml.Attachment;
09: import org.geotools.ml.Envelope;
10: import org.geotools.ml.Mail;
11: import org.geotools.xml.AbstractComplexBinding;
12: import org.geotools.xml.ElementInstance;
13: import org.geotools.xml.Node;
14:
15: /**
16: * Strategy object for the type http://mails/refractions/net:mailType.
17: *
18: * <p>
19: * <pre>
20: * <code>
21: * <xsd:complexType name="mailType">
22: * <xsd:sequence>
23: * <xsd:element name="envelope" type="ml:envelopeType"/>
24: * <xsd:element name="body" type="ml:bodyType"/>
25: * <xsd:element maxOccurs="unbounded" minOccurs="0"
26: * name="attachment" type="ml:attachmentType"/>
27: * </xsd:sequence>
28: * <xsd:attribute name="id" type="xsd:integer" use="required"/>
29: * </xsd:complexType>
30: *
31: * </code>
32: * </pre>
33: * </p>
34: *
35: * @generated
36: */
37: public class MLMailTypeBinding extends AbstractComplexBinding {
38:
39: /**
40: * @generated
41: */
42: public QName getTarget() {
43: return ML.MAILTYPE;
44: }
45:
46: public Class getType() {
47: return Mail.class;
48: }
49:
50: /**
51: * <!-- begin-user-doc -->
52: * <!-- end-user-doc -->
53: *
54: * @generated modifiable
55: */
56: public Object parse(ElementInstance instance, Node node,
57: Object value) throws Exception {
58:
59: Envelope envelope = (Envelope) node.getChildValue("envelope");
60: String body = (String) node.getChildValue("body");
61: BigInteger id = (BigInteger) node.getAttributeValue("id");
62:
63: List atts = node.getChildValues("attachment");
64: Attachment[] attachments = (Attachment[]) atts
65: .toArray(new Attachment[atts.size()]);
66:
67: return new Mail(id, body, envelope, attachments);
68: }
69: }
|