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.model;
027:
028: import javax.activation.MimeType;
029:
030: import com.sun.codemodel.internal.JCodeModel;
031: import com.sun.codemodel.internal.JExpression;
032: import com.sun.xml.internal.bind.v2.model.annotation.Locatable;
033: import com.sun.xml.internal.bind.v2.model.core.ID;
034: import com.sun.xml.internal.bind.v2.runtime.Location;
035: import com.sun.xml.internal.xsom.XSComponent;
036: import com.sun.xml.internal.xsom.XmlString;
037: import com.sun.tools.internal.xjc.outline.Outline;
038:
039: /**
040: * Partial implementation of {@link CTypeInfo}.
041: *
042: * <p>
043: * The inheritance of {@link TypeUse} by {@link CTypeInfo}
044: * isn't a normal inheritance (see {@link CTypeInfo} for more.)
045: * This class implments methods on {@link TypeUse} for {@link CTypeInfo}.
046: *
047: * @author Kohsuke Kawaguchi
048: */
049: abstract class AbstractCTypeInfoImpl implements CTypeInfo {
050:
051: private final CCustomizations customizations;
052:
053: private final XSComponent source;
054:
055: protected AbstractCTypeInfoImpl(Model model, XSComponent source,
056: CCustomizations customizations) {
057: if (customizations == null)
058: customizations = CCustomizations.EMPTY;
059: else
060: customizations.setParent(model, this );
061: this .customizations = customizations;
062: this .source = source;
063: }
064:
065: public final boolean isCollection() {
066: return false;
067: }
068:
069: public final CAdapter getAdapterUse() {
070: return null;
071: }
072:
073: public final CTypeInfo getInfo() {
074: return this ;
075: }
076:
077: public final ID idUse() {
078: return ID.NONE;
079: }
080:
081: public final XSComponent getSchemaComponent() {
082: return source;
083: }
084:
085: /**
086: * @deprecated
087: * why are you calling an unimplemented method?
088: */
089: public final boolean canBeReferencedByIDREF() {
090: // we aren't doing any error check in XJC, so no point in implementing this method.
091: throw new UnsupportedOperationException();
092: }
093:
094: /**
095: * No default {@link MimeType}.
096: */
097: public MimeType getExpectedMimeType() {
098: return null;
099: }
100:
101: public CCustomizations getCustomizations() {
102: return customizations;
103: }
104:
105: // this is just a convenient default
106: public JExpression createConstant(Outline outline, XmlString lexical) {
107: return null;
108: }
109:
110: public final Locatable getUpstream() {
111: throw new UnsupportedOperationException();
112: }
113:
114: public final Location getLocation() {
115: throw new UnsupportedOperationException();
116: }
117: }
|