|
1 /* |
|
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. Oracle designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Oracle in the LICENSE file that accompanied this code. |
|
10 * |
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
|
15 * accompanied this code). |
|
16 * |
|
17 * You should have received a copy of the GNU General Public License version |
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 * |
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 * or visit www.oracle.com if you need additional information or have any |
|
23 * questions. |
|
24 */ |
|
25 |
|
26 package com.sun.tools.internal.xjc.reader.xmlschema; |
|
27 |
|
28 import com.sun.tools.internal.xjc.reader.Ring; |
|
29 import com.sun.tools.internal.xjc.reader.xmlschema.ct.ComplexTypeFieldBuilder; |
|
30 import com.sun.xml.internal.bind.v2.TODO; |
|
31 import com.sun.xml.internal.xsom.XSAttGroupDecl; |
|
32 import com.sun.xml.internal.xsom.XSAttributeDecl; |
|
33 import com.sun.xml.internal.xsom.XSAttributeUse; |
|
34 import com.sun.xml.internal.xsom.XSComplexType; |
|
35 import com.sun.xml.internal.xsom.XSContentType; |
|
36 import com.sun.xml.internal.xsom.XSElementDecl; |
|
37 import com.sun.xml.internal.xsom.XSModelGroup; |
|
38 import com.sun.xml.internal.xsom.XSModelGroupDecl; |
|
39 import com.sun.xml.internal.xsom.XSParticle; |
|
40 import com.sun.xml.internal.xsom.XSSimpleType; |
|
41 import com.sun.xml.internal.xsom.XSWildcard; |
|
42 |
|
43 /** |
|
44 * This is where a binding of a new class starts. |
|
45 * |
|
46 * @author Kohsuke Kawaguchi |
|
47 */ |
|
48 public final class BindRed extends ColorBinder { |
|
49 |
|
50 private final ComplexTypeFieldBuilder ctBuilder = Ring.get(ComplexTypeFieldBuilder.class); |
|
51 |
|
52 public void complexType(XSComplexType ct) { |
|
53 ctBuilder.build(ct); |
|
54 } |
|
55 |
|
56 public void wildcard(XSWildcard xsWildcard) { |
|
57 // TODO: implement this method later |
|
58 // I guess we might allow this to be mapped to a generic element property --- |
|
59 // not sure exactly how do we do it. |
|
60 TODO.checkSpec(); |
|
61 throw new UnsupportedOperationException(); |
|
62 } |
|
63 |
|
64 public void elementDecl(XSElementDecl e) { |
|
65 SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class); |
|
66 stb.refererStack.push(e); // referer is element |
|
67 builder.ying(e.getType(),e); |
|
68 stb.refererStack.pop(); |
|
69 } |
|
70 |
|
71 public void simpleType(XSSimpleType type) { |
|
72 SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class); |
|
73 stb.refererStack.push(type); // referer is itself |
|
74 createSimpleTypeProperty(type,"Value"); |
|
75 stb.refererStack.pop(); |
|
76 } |
|
77 |
|
78 /* |
|
79 Components that can never be mapped to a class |
|
80 */ |
|
81 public void attGroupDecl(XSAttGroupDecl ag) { |
|
82 throw new IllegalStateException(); |
|
83 } |
|
84 public void attributeDecl(XSAttributeDecl ad) { |
|
85 throw new IllegalStateException(); |
|
86 } |
|
87 public void attributeUse(XSAttributeUse au) { |
|
88 throw new IllegalStateException(); |
|
89 } |
|
90 public void empty(XSContentType xsContentType) { |
|
91 throw new IllegalStateException(); |
|
92 } |
|
93 public void modelGroupDecl(XSModelGroupDecl xsModelGroupDecl) { |
|
94 throw new IllegalStateException(); |
|
95 } |
|
96 public void modelGroup(XSModelGroup xsModelGroup) { |
|
97 throw new IllegalStateException(); |
|
98 } |
|
99 public void particle(XSParticle p) { |
|
100 throw new IllegalStateException(); |
|
101 } |
|
102 } |