|
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 java.util.Iterator; |
|
29 |
|
30 import com.sun.tools.internal.xjc.reader.Ring; |
|
31 import com.sun.tools.internal.xjc.reader.xmlschema.ct.ComplexTypeFieldBuilder; |
|
32 import com.sun.xml.internal.xsom.XSAttContainer; |
|
33 import com.sun.xml.internal.xsom.XSAttGroupDecl; |
|
34 import com.sun.xml.internal.xsom.XSAttributeDecl; |
|
35 import com.sun.xml.internal.xsom.XSAttributeUse; |
|
36 import com.sun.xml.internal.xsom.XSComplexType; |
|
37 import com.sun.xml.internal.xsom.XSContentType; |
|
38 import com.sun.xml.internal.xsom.XSElementDecl; |
|
39 import com.sun.xml.internal.xsom.XSModelGroup; |
|
40 import com.sun.xml.internal.xsom.XSModelGroupDecl; |
|
41 import com.sun.xml.internal.xsom.XSParticle; |
|
42 import com.sun.xml.internal.xsom.XSSimpleType; |
|
43 import com.sun.xml.internal.xsom.XSWildcard; |
|
44 |
|
45 /** |
|
46 * @author Kohsuke Kawaguchi |
|
47 */ |
|
48 public final class BindGreen extends ColorBinder { |
|
49 |
|
50 private final ComplexTypeFieldBuilder ctBuilder = Ring.get(ComplexTypeFieldBuilder.class); |
|
51 |
|
52 public void attGroupDecl(XSAttGroupDecl ag) { |
|
53 attContainer(ag); |
|
54 } |
|
55 |
|
56 public void attContainer(XSAttContainer cont) { |
|
57 // inline |
|
58 Iterator itr = cont.iterateDeclaredAttributeUses(); |
|
59 while(itr.hasNext()) |
|
60 builder.ying((XSAttributeUse)itr.next(),cont); |
|
61 itr = cont.iterateAttGroups(); |
|
62 while(itr.hasNext()) |
|
63 builder.ying((XSAttGroupDecl)itr.next(),cont); |
|
64 |
|
65 XSWildcard w = cont.getAttributeWildcard(); |
|
66 if(w!=null) |
|
67 builder.ying(w,cont); |
|
68 } |
|
69 |
|
70 public void complexType(XSComplexType ct) { |
|
71 ctBuilder.build(ct); |
|
72 } |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 public void attributeDecl(XSAttributeDecl xsAttributeDecl) { |
|
82 // TODO: implement this method later |
|
83 throw new UnsupportedOperationException(); |
|
84 } |
|
85 |
|
86 public void wildcard(XSWildcard xsWildcard) { |
|
87 // TODO: implement this method later |
|
88 throw new UnsupportedOperationException(); |
|
89 } |
|
90 |
|
91 public void modelGroupDecl(XSModelGroupDecl xsModelGroupDecl) { |
|
92 // TODO: implement this method later |
|
93 throw new UnsupportedOperationException(); |
|
94 } |
|
95 |
|
96 public void modelGroup(XSModelGroup xsModelGroup) { |
|
97 // TODO: implement this method later |
|
98 throw new UnsupportedOperationException(); |
|
99 } |
|
100 |
|
101 public void elementDecl(XSElementDecl xsElementDecl) { |
|
102 // TODO: implement this method later |
|
103 throw new UnsupportedOperationException(); |
|
104 } |
|
105 |
|
106 public void particle(XSParticle xsParticle) { |
|
107 // TODO: implement this method later |
|
108 throw new UnsupportedOperationException(); |
|
109 } |
|
110 |
|
111 public void empty(XSContentType xsContentType) { |
|
112 // TODO: implement this method later |
|
113 throw new UnsupportedOperationException(); |
|
114 } |
|
115 |
|
116 |
|
117 /* |
|
118 |
|
119 Components for which ying should yield to purple. |
|
120 |
|
121 */ |
|
122 public void simpleType(XSSimpleType xsSimpleType) { |
|
123 // simple type always maps to a type, so this is never possible |
|
124 throw new IllegalStateException(); |
|
125 } |
|
126 |
|
127 public void attributeUse(XSAttributeUse use) { |
|
128 // attribute use always maps to a property |
|
129 throw new IllegalStateException(); |
|
130 } |
|
131 } |