1/* 2 * Copyright (c) 1997, 2012, 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 26package com.sun.tools.internal.xjc.reader.xmlschema; 27 28import com.sun.tools.internal.xjc.model.CClassInfo; 29import com.sun.tools.internal.xjc.model.CPropertyInfo; 30import com.sun.tools.internal.xjc.reader.Ring; 31import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIProperty; 32import com.sun.xml.internal.xsom.XSAnnotation; 33import com.sun.xml.internal.xsom.XSComponent; 34import com.sun.xml.internal.xsom.XSFacet; 35import com.sun.xml.internal.xsom.XSIdentityConstraint; 36import com.sun.xml.internal.xsom.XSNotation; 37import com.sun.xml.internal.xsom.XSSchema; 38import com.sun.xml.internal.xsom.XSSimpleType; 39import com.sun.xml.internal.xsom.XSXPath; 40import com.sun.xml.internal.xsom.visitor.XSVisitor; 41 42/** 43 * @author Kohsuke Kawaguchi 44 */ 45abstract class ColorBinder extends BindingComponent implements XSVisitor { 46 protected final BGMBuilder builder = Ring.get(BGMBuilder.class); 47 protected final ClassSelector selector = getClassSelector(); 48 49 protected final CClassInfo getCurrentBean() { 50 return selector.getCurrentBean(); 51 } 52 protected final XSComponent getCurrentRoot() { 53 return selector.getCurrentRoot(); 54 } 55 56 57 protected final void createSimpleTypeProperty(XSSimpleType type,String propName) { 58 BIProperty prop = BIProperty.getCustomization(type); 59 60 SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class); 61 // since we are building the simple type here, use buildDef 62 CPropertyInfo p = prop.createValueProperty(propName,false,type,stb.buildDef(type),BGMBuilder.getName(type)); 63 getCurrentBean().addProperty(p); 64 } 65 66 67 68 69 70 public final void annotation(XSAnnotation xsAnnotation) { 71 throw new IllegalStateException(); 72 } 73 74 public final void schema(XSSchema xsSchema) { 75 throw new IllegalStateException(); 76 } 77 78 public final void facet(XSFacet xsFacet) { 79 throw new IllegalStateException(); 80 } 81 82 public final void notation(XSNotation xsNotation) { 83 throw new IllegalStateException(); 84 } 85 86 public final void identityConstraint(XSIdentityConstraint xsIdentityConstraint) { 87 throw new IllegalStateException(); 88 } 89 90 public final void xpath(XSXPath xsxPath) { 91 throw new IllegalStateException(); 92 } 93} 94