001: /*
002: * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package com.sun.tools.internal.xjc.reader.xmlschema;
027:
028: import com.sun.tools.internal.xjc.reader.Ring;
029: import com.sun.tools.internal.xjc.reader.xmlschema.ct.ComplexTypeFieldBuilder;
030: import com.sun.xml.internal.bind.v2.TODO;
031: import com.sun.xml.internal.xsom.XSAttGroupDecl;
032: import com.sun.xml.internal.xsom.XSAttributeDecl;
033: import com.sun.xml.internal.xsom.XSAttributeUse;
034: import com.sun.xml.internal.xsom.XSComplexType;
035: import com.sun.xml.internal.xsom.XSContentType;
036: import com.sun.xml.internal.xsom.XSElementDecl;
037: import com.sun.xml.internal.xsom.XSModelGroup;
038: import com.sun.xml.internal.xsom.XSModelGroupDecl;
039: import com.sun.xml.internal.xsom.XSParticle;
040: import com.sun.xml.internal.xsom.XSSimpleType;
041: import com.sun.xml.internal.xsom.XSWildcard;
042:
043: /**
044: * This is where a binding of a new class starts.
045: *
046: * @author Kohsuke Kawaguchi
047: */
048: public final class BindRed extends ColorBinder {
049:
050: private final ComplexTypeFieldBuilder ctBuilder = Ring
051: .get(ComplexTypeFieldBuilder.class);
052:
053: public void complexType(XSComplexType ct) {
054: ctBuilder.build(ct);
055: }
056:
057: public void wildcard(XSWildcard xsWildcard) {
058: // TODO: implement this method later
059: // I guess we might allow this to be mapped to a generic element property ---
060: // not sure exactly how do we do it.
061: TODO.checkSpec();
062: throw new UnsupportedOperationException();
063: }
064:
065: public void elementDecl(XSElementDecl e) {
066: SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class);
067: stb.refererStack.push(e); // referer is element
068: builder.ying(e.getType());
069: stb.refererStack.pop();
070: }
071:
072: public void simpleType(XSSimpleType type) {
073: SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class);
074: stb.refererStack.push(type); // referer is itself
075: createSimpleTypeProperty(type, "Value");
076: stb.refererStack.pop();
077: }
078:
079: /*
080: Components that can never be mapped to a class
081: */
082: public void attGroupDecl(XSAttGroupDecl ag) {
083: throw new IllegalStateException();
084: }
085:
086: public void attributeDecl(XSAttributeDecl ad) {
087: throw new IllegalStateException();
088: }
089:
090: public void attributeUse(XSAttributeUse au) {
091: throw new IllegalStateException();
092: }
093:
094: public void empty(XSContentType xsContentType) {
095: throw new IllegalStateException();
096: }
097:
098: public void modelGroupDecl(XSModelGroupDecl xsModelGroupDecl) {
099: throw new IllegalStateException();
100: }
101:
102: public void modelGroup(XSModelGroup xsModelGroup) {
103: throw new IllegalStateException();
104: }
105:
106: public void particle(XSParticle p) {
107: throw new IllegalStateException();
108: }
109: }
|