001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036:
037: package com.sun.tools.xjc.api;
038:
039: import java.util.Collection;
040: import java.util.List;
041:
042: import javax.xml.namespace.QName;
043: import javax.xml.bind.annotation.XmlSeeAlso;
044:
045: import com.sun.codemodel.CodeWriter;
046: import com.sun.codemodel.JCodeModel;
047: import com.sun.codemodel.JClass;
048: import com.sun.tools.xjc.Options;
049: import com.sun.tools.xjc.Plugin;
050:
051: /**
052: * {@link JAXBModel} that exposes additional information available
053: * only for the schema->java direction.
054: *
055: * @author Kohsuke Kawaguchi
056: */
057: public interface S2JJAXBModel extends JAXBModel {
058:
059: /**
060: * Gets a {@link Mapping} object for the given global element.
061: *
062: * @return
063: * null if the element name is not a defined global element in the schema.
064: */
065: Mapping get(QName elementName);
066:
067: /**
068: * Gets all the <tt>ObjectFactory</tt> classes generated by the compilation.
069: *
070: * <p>
071: * This should be used for generating {@link XmlSeeAlso} on the SEI.
072: */
073: List<JClass> getAllObjectFactories();
074:
075: /**
076: * Gets a read-only view of all the {@link Mapping}s.
077: */
078: Collection<? extends Mapping> getMappings();
079:
080: /**
081: * Returns the fully-qualified name of the Java type that is bound to the
082: * specified XML type.
083: *
084: * @param xmlTypeName
085: * must not be null.
086: * @return
087: * null if the XML type is not bound to any Java type.
088: */
089: TypeAndAnnotation getJavaType(QName xmlTypeName);
090:
091: /**
092: * Generates artifacts.
093: *
094: * <p>
095: * TODO: if JAXB supports various modes of code generations
096: * (such as public interface only or implementation only or
097: * etc), we should define bit flags to control those.
098: *
099: * <p>
100: * This operation is only supported for a model built from a schema.
101: *
102: * @param extensions
103: * The JAXB RI extensions to run. This can be null or empty
104: * array if the caller wishes not to run any extension.
105: * <br>
106: *
107: * Those specified extensions
108: * will participate in the code generation. Specifying an extension
109: * in this list has the same effect of turning that extension on
110: * via command line.
111: * <br>
112: *
113: * It is the caller's responsibility to configure each augmenter
114: * properly by using {@link Plugin#parseArgument(Options, String[], int)}.
115: *
116: * @return
117: * object filled with the generated code. Use
118: * {@link JCodeModel#build(CodeWriter)} to write them
119: * to a disk.
120: */
121: JCodeModel generateCode(Plugin[] extensions,
122: ErrorListener errorListener);
123: }
|