1 package net.sourceforge.harness.xml.jaxb;
2
3 import java.io.IOException;
4 import java.io.InputStream;
5
6 import javax.xml.bind.ConversionException;
7 import javax.xml.bind.Dispatcher;
8 import javax.xml.bind.Element;
9 import javax.xml.bind.InvalidAttributeException;
10 import javax.xml.bind.LocalValidationException;
11 import javax.xml.bind.MarshallableObject;
12 import javax.xml.bind.Marshaller;
13 import javax.xml.bind.StructureValidationException;
14 import javax.xml.bind.UnmarshalException;
15 import javax.xml.bind.Unmarshaller;
16 import javax.xml.bind.Validator;
17 import javax.xml.marshal.XMLScanner;
18 import javax.xml.marshal.XMLWriter;
19
20
21 public class JavaOptions extends MarshallableObject implements Element {
22 private String _Content;
23
24 public String getContent() {
25 return _Content;
26 }
27
28 public void setContent(String _Content) {
29 this._Content = _Content;
30
31 if (_Content == null) {
32 invalidate();
33 }
34 }
35
36 public void validateThis() throws LocalValidationException {
37 }
38
39 public void validate(Validator v) throws StructureValidationException {
40 }
41
42 public void marshal(Marshaller m) throws IOException {
43 XMLWriter w = m.writer();
44 w.start("javaOptions");
45
46 if (_Content != null) {
47 w.chars(_Content.toString());
48 }
49
50 w.end("javaOptions");
51 }
52
53 public void unmarshal(Unmarshaller u) throws UnmarshalException {
54 XMLScanner xs = u.scanner();
55 Validator v = u.validator();
56 xs.takeStart("javaOptions");
57
58 while (xs.atAttribute()) {
59 String an = xs.takeAttributeName();
60 throw new InvalidAttributeException(an);
61 }
62
63 {
64 String s;
65
66 if (xs.atChars(XMLScanner.WS_COLLAPSE)) {
67 s = xs.takeChars(XMLScanner.WS_COLLAPSE);
68 } else {
69 s = "";
70 }
71
72 try {
73 _Content = String.valueOf(s);
74 } catch (Exception x) {
75 throw new ConversionException("content", x);
76 }
77 }
78
79 xs.takeEnd("javaOptions");
80 }
81
82 public static JavaOptions unmarshal(InputStream in)
83 throws UnmarshalException {
84 return unmarshal(XMLScanner.open(in));
85 }
86
87 public static JavaOptions unmarshal(XMLScanner xs)
88 throws UnmarshalException {
89 return unmarshal(xs, newDispatcher());
90 }
91
92 public static JavaOptions unmarshal(XMLScanner xs, Dispatcher d)
93 throws UnmarshalException {
94 return ((JavaOptions) d.unmarshal(xs, (JavaOptions.class)));
95 }
96
97 public boolean equals(Object ob) {
98 if (this == ob) {
99 return true;
100 }
101
102 if (!(ob instanceof JavaOptions)) {
103 return false;
104 }
105
106 JavaOptions tob = ((JavaOptions) ob);
107
108 if (_Content != null) {
109 if (tob._Content == null) {
110 return false;
111 }
112
113 if (!_Content.equals(tob._Content)) {
114 return false;
115 }
116 } else {
117 if (tob._Content != null) {
118 return false;
119 }
120 }
121
122 return true;
123 }
124
125 public int hashCode() {
126 int h = 0;
127 h = ((127 * h) + ((_Content != null) ? _Content.hashCode() : 0));
128
129 return h;
130 }
131
132 public String toString() {
133 StringBuffer sb = new StringBuffer("<<javaOptions");
134
135 if (_Content != null) {
136 sb.append(" content=");
137 sb.append(_Content.toString());
138 }
139
140 sb.append(">>");
141
142 return sb.toString();
143 }
144
145 public static Dispatcher newDispatcher() {
146 return Author.newDispatcher();
147 }
148 }