1 /* 2 * Copyright (c) 1997, 2010, 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.api; 27 28 import java.util.Collection; 29 import java.util.Map; 30 31 import javax.xml.namespace.QName; 32 33 import javax.annotation.processing.ProcessingEnvironment; 34 35 36 /** 37 * Java-to-Schema compiler. 38 * 39 * @author 40 * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) 41 */ 42 public interface JavaCompiler { 43 44 /** 45 * Compiles the given annotated Java source code. 46 * 47 * <p> 48 * This operation takes a set of "root types", then compute the list of 49 * all the types that need to be bound by forming a transitive reflexive 50 * closure of types that are referenced by the root types. 51 * 52 * <p> 53 * Errors will be sent to {@link javax.annotation.processing.ProcessingEnvironment#getMessager()}. 54 * 55 * @param rootTypes 56 * The list of types that needs to be bound to XML. 57 * "root references" from JAX-RPC to JAXB is always in the form of (type,annotations) pair. 58 * 59 * @param additionalElementDecls 60 * Add element declarations for the specified element names to 61 * the XML types mapped from the corresponding {@link Reference}s. 62 * Those {@link Reference}s must be included in the <tt>rootTypes</tt> parameter. 63 * In this map, a {@link Reference} can be null, in which case the element name is 64 * declared to have an empty complex type. 65 * (<xs:element name='foo'><xs:complexType/></xs:element>) 66 * This parameter can be null, in which case the method behaves as if the empty map is given. 67 * 68 * @param defaultNamespaceRemap 69 * If not-null, all the uses of the empty default namespace ("") will 70 * be replaced by this namespace URI. 71 * 72 * @param source 73 * The caller supplied view to the annotated source code that JAXB is going to process. 74 * 75 * @return 76 * Non-null if no error was reported. Otherwise null. 77 */ 78 J2SJAXBModel bind( 79 Collection<Reference> rootTypes, 80 Map<QName, Reference> additionalElementDecls, 81 String defaultNamespaceRemap, 82 ProcessingEnvironment source); 83 }