Tue, 06 Mar 2012 16:09:35 -0800
7150322: Stop using drop source bundles in jaxws
Reviewed-by: darcy, ohrstrom
ohair@286 | 1 | /* |
ohair@286 | 2 | * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
ohair@286 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohair@286 | 4 | * |
ohair@286 | 5 | * This code is free software; you can redistribute it and/or modify it |
ohair@286 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@286 | 7 | * published by the Free Software Foundation. Oracle designates this |
ohair@286 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@286 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
ohair@286 | 10 | * |
ohair@286 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
ohair@286 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohair@286 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohair@286 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
ohair@286 | 15 | * accompanied this code). |
ohair@286 | 16 | * |
ohair@286 | 17 | * You should have received a copy of the GNU General Public License version |
ohair@286 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
ohair@286 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohair@286 | 20 | * |
ohair@286 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@286 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@286 | 23 | * questions. |
ohair@286 | 24 | */ |
ohair@286 | 25 | |
ohair@286 | 26 | package com.sun.xml.internal.bind.api; |
ohair@286 | 27 | |
ohair@286 | 28 | import java.io.IOException; |
ohair@286 | 29 | import java.lang.reflect.Type; |
ohair@286 | 30 | import java.util.Collection; |
ohair@286 | 31 | import java.util.Collections; |
ohair@286 | 32 | import java.util.List; |
ohair@286 | 33 | import java.util.Map; |
ohair@286 | 34 | |
ohair@286 | 35 | import javax.xml.bind.JAXBContext; |
ohair@286 | 36 | import javax.xml.bind.JAXBException; |
ohair@286 | 37 | import javax.xml.bind.Marshaller; |
ohair@286 | 38 | import javax.xml.bind.SchemaOutputResolver; |
ohair@286 | 39 | import javax.xml.bind.annotation.XmlAttachmentRef; |
ohair@286 | 40 | import javax.xml.namespace.QName; |
ohair@286 | 41 | import javax.xml.transform.Result; |
ohair@286 | 42 | |
ohair@286 | 43 | import com.sun.istack.internal.NotNull; |
ohair@286 | 44 | import com.sun.istack.internal.Nullable; |
ohair@286 | 45 | import com.sun.xml.internal.bind.api.impl.NameConverter; |
ohair@286 | 46 | import com.sun.xml.internal.bind.v2.ContextFactory; |
ohair@286 | 47 | import com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader; |
ohair@286 | 48 | import com.sun.xml.internal.bind.v2.model.nav.Navigator; |
ohair@286 | 49 | import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeInfoSet; |
ohair@286 | 50 | |
ohair@286 | 51 | /** |
ohair@286 | 52 | * {@link JAXBContext} enhanced with JAXB RI specific functionalities. |
ohair@286 | 53 | * |
ohair@286 | 54 | * <p> |
ohair@286 | 55 | * <b>Subject to change without notice</b>. |
ohair@286 | 56 | * |
ohair@286 | 57 | * @since 2.0 EA1 |
ohair@286 | 58 | * @author |
ohair@286 | 59 | * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) |
ohair@286 | 60 | */ |
ohair@286 | 61 | public abstract class JAXBRIContext extends JAXBContext { |
ohair@286 | 62 | |
ohair@286 | 63 | protected JAXBRIContext() {} |
ohair@286 | 64 | |
ohair@286 | 65 | /** |
ohair@286 | 66 | * Creates a new {@link JAXBRIContext}. |
ohair@286 | 67 | * |
ohair@286 | 68 | * <p> |
ohair@286 | 69 | * {@link JAXBContext#newInstance(Class[]) JAXBContext.newInstance()} methods may |
ohair@286 | 70 | * return other JAXB providers that are not compatible with the JAX-RPC RI. |
ohair@286 | 71 | * This method guarantees that the JAX-WS RI will finds the JAXB RI. |
ohair@286 | 72 | * |
ohair@286 | 73 | * @param classes |
ohair@286 | 74 | * Classes to be bound. See {@link JAXBContext#newInstance(Class[])} for the meaning. |
ohair@286 | 75 | * @param typeRefs |
ohair@286 | 76 | * See {@link #TYPE_REFERENCES} for the meaning of this parameter. |
ohair@286 | 77 | * Can be null. |
ohair@286 | 78 | * @param subclassReplacements |
ohair@286 | 79 | * See {@link #SUBCLASS_REPLACEMENTS} for the meaning of this parameter. |
ohair@286 | 80 | * Can be null. |
ohair@286 | 81 | * @param defaultNamespaceRemap |
ohair@286 | 82 | * See {@link #DEFAULT_NAMESPACE_REMAP} for the meaning of this parameter. |
ohair@286 | 83 | * Can be null (and should be null for ordinary use of JAXB.) |
ohair@286 | 84 | * @param c14nSupport |
ohair@286 | 85 | * See {@link #CANONICALIZATION_SUPPORT} for the meaning of this parameter. |
ohair@286 | 86 | * @param ar |
ohair@286 | 87 | * See {@link #ANNOTATION_READER} for the meaning of this parameter. |
ohair@286 | 88 | * Can be null. |
ohair@286 | 89 | * @since JAXB 2.1 EA2 |
ohair@286 | 90 | */ |
ohair@286 | 91 | public static JAXBRIContext newInstance(@NotNull Class[] classes, |
ohair@286 | 92 | @Nullable Collection<TypeReference> typeRefs, |
ohair@286 | 93 | @Nullable Map<Class,Class> subclassReplacements, |
ohair@286 | 94 | @Nullable String defaultNamespaceRemap, boolean c14nSupport, |
ohair@286 | 95 | @Nullable RuntimeAnnotationReader ar) throws JAXBException { |
ohair@286 | 96 | return ContextFactory.createContext(classes, typeRefs, subclassReplacements, |
ohair@286 | 97 | defaultNamespaceRemap, c14nSupport, ar, false, false, false, false); |
ohair@286 | 98 | } |
ohair@286 | 99 | |
ohair@286 | 100 | /** |
ohair@286 | 101 | * Creates a new {@link JAXBRIContext}. |
ohair@286 | 102 | * |
ohair@286 | 103 | * <p> |
ohair@286 | 104 | * {@link JAXBContext#newInstance(Class[]) JAXBContext.newInstance()} methods may |
ohair@286 | 105 | * return other JAXB providers that are not compatible with the JAX-RPC RI. |
ohair@286 | 106 | * This method guarantees that the JAX-WS RI will finds the JAXB RI. |
ohair@286 | 107 | * |
ohair@286 | 108 | * @param classes |
ohair@286 | 109 | * Classes to be bound. See {@link JAXBContext#newInstance(Class[])} for the meaning. |
ohair@286 | 110 | * @param typeRefs |
ohair@286 | 111 | * See {@link #TYPE_REFERENCES} for the meaning of this parameter. |
ohair@286 | 112 | * Can be null. |
ohair@286 | 113 | * @param subclassReplacements |
ohair@286 | 114 | * See {@link #SUBCLASS_REPLACEMENTS} for the meaning of this parameter. |
ohair@286 | 115 | * Can be null. |
ohair@286 | 116 | * @param defaultNamespaceRemap |
ohair@286 | 117 | * See {@link #DEFAULT_NAMESPACE_REMAP} for the meaning of this parameter. |
ohair@286 | 118 | * Can be null (and should be null for ordinary use of JAXB.) |
ohair@286 | 119 | * @param c14nSupport |
ohair@286 | 120 | * See {@link #CANONICALIZATION_SUPPORT} for the meaning of this parameter. |
ohair@286 | 121 | * @param ar |
ohair@286 | 122 | * See {@link #ANNOTATION_READER} for the meaning of this parameter. |
ohair@286 | 123 | * Can be null. |
ohair@286 | 124 | * @param xmlAccessorFactorySupport |
ohair@286 | 125 | * See {@link #XMLACCESSORFACTORY_SUPPORT} for the meaning of this parameter. |
ohair@286 | 126 | * @param allNillable |
ohair@286 | 127 | * See {@link #TREAT_EVERYTHING_NILLABLE} for the meaning of this parameter. |
ohair@286 | 128 | * @param retainPropertyInfo |
ohair@286 | 129 | * See {@link #RETAIN_REFERENCE_TO_INFO} for the meaning of this parameter. |
ohair@286 | 130 | * @param supressAccessorWarnings |
ohair@286 | 131 | * See {@link #SUPRESS_ACCESSOR_WARNINGS} for the meaning of this parameter. |
ohair@286 | 132 | */ |
ohair@286 | 133 | public static JAXBRIContext newInstance(@NotNull Class[] classes, |
ohair@286 | 134 | @Nullable Collection<TypeReference> typeRefs, |
ohair@286 | 135 | @Nullable Map<Class,Class> subclassReplacements, |
ohair@286 | 136 | @Nullable String defaultNamespaceRemap, boolean c14nSupport, |
ohair@286 | 137 | @Nullable RuntimeAnnotationReader ar, |
ohair@286 | 138 | boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo, boolean supressAccessorWarnings) throws JAXBException { |
ohair@286 | 139 | return ContextFactory.createContext(classes, typeRefs, subclassReplacements, |
ohair@286 | 140 | defaultNamespaceRemap, c14nSupport, ar, xmlAccessorFactorySupport, allNillable, retainPropertyInfo, supressAccessorWarnings); |
ohair@286 | 141 | } |
ohair@286 | 142 | |
ohair@286 | 143 | /** |
ohair@286 | 144 | * @deprecated |
ohair@286 | 145 | * Compatibility with older versions. |
ohair@286 | 146 | */ |
ohair@286 | 147 | public static JAXBRIContext newInstance(@NotNull Class[] classes, |
ohair@286 | 148 | @Nullable Collection<TypeReference> typeRefs, |
ohair@286 | 149 | @Nullable String defaultNamespaceRemap, boolean c14nSupport ) throws JAXBException { |
ohair@286 | 150 | return newInstance(classes,typeRefs, Collections.<Class,Class>emptyMap(), |
ohair@286 | 151 | defaultNamespaceRemap,c14nSupport,null); |
ohair@286 | 152 | } |
ohair@286 | 153 | |
ohair@286 | 154 | /** |
ohair@286 | 155 | * Returns true if this context includes a class |
ohair@286 | 156 | * that has {@link XmlAttachmentRef}. |
ohair@286 | 157 | * |
ohair@286 | 158 | * @since 2.1 |
ohair@286 | 159 | */ |
ohair@286 | 160 | public abstract boolean hasSwaRef(); |
ohair@286 | 161 | |
ohair@286 | 162 | /** |
ohair@286 | 163 | * If the given object is bound to an element in XML by JAXB, |
ohair@286 | 164 | * returns the element name. |
ohair@286 | 165 | * |
ohair@286 | 166 | * @return null |
ohair@286 | 167 | * if the object is not bound to an element. |
ohair@286 | 168 | * @throws JAXBException |
ohair@286 | 169 | * if the object is not known to this context. |
ohair@286 | 170 | * |
ohair@286 | 171 | * @since 2.0 EA1 |
ohair@286 | 172 | */ |
ohair@286 | 173 | public abstract @Nullable QName getElementName(@NotNull Object o) throws JAXBException; |
ohair@286 | 174 | |
ohair@286 | 175 | /** |
ohair@286 | 176 | * Allows to retrieve the element name based on Class. |
ohair@286 | 177 | * @param o |
ohair@286 | 178 | * @return |
ohair@286 | 179 | * @throws javax.xml.bind.JAXBException |
ohair@286 | 180 | * @since 2.1.10 |
ohair@286 | 181 | */ |
ohair@286 | 182 | public abstract @Nullable QName getElementName(@NotNull Class o) throws JAXBException; |
ohair@286 | 183 | |
ohair@286 | 184 | /** |
ohair@286 | 185 | * Creates a mini-marshaller/unmarshaller that can process a {@link TypeReference}. |
ohair@286 | 186 | * |
ohair@286 | 187 | * @return |
ohair@286 | 188 | * null if the specified reference is not given to {@link JAXBRIContext#newInstance}. |
ohair@286 | 189 | * |
ohair@286 | 190 | * @since 2.0 EA1 |
ohair@286 | 191 | */ |
ohair@286 | 192 | public abstract Bridge createBridge(@NotNull TypeReference ref); |
ohair@286 | 193 | |
ohair@286 | 194 | /** |
ohair@286 | 195 | * Creates a new {@link BridgeContext} instance. |
ohair@286 | 196 | * |
ohair@286 | 197 | * @return |
ohair@286 | 198 | * always a valid non-null instance. |
ohair@286 | 199 | * |
ohair@286 | 200 | * @since 2.0 EA1 |
ohair@286 | 201 | */ |
ohair@286 | 202 | public abstract @NotNull BridgeContext createBridgeContext(); |
ohair@286 | 203 | |
ohair@286 | 204 | /** |
ohair@286 | 205 | * Gets a {@link RawAccessor} for the specified element property of the specified wrapper bean class. |
ohair@286 | 206 | * |
ohair@286 | 207 | * <p> |
ohair@286 | 208 | * This method is designed to assist the JAX-RPC RI fill in a wrapper bean (in the doc/lit/wrap mode.) |
ohair@286 | 209 | * In the said mode, a wrapper bean is supposed to only have properties that match elements, |
ohair@286 | 210 | * and for each element that appear in the content model there's one property. |
ohair@286 | 211 | * |
ohair@286 | 212 | * <p> |
ohair@286 | 213 | * Therefore, this method takes a wrapper bean and a tag name that identifies a property |
ohair@286 | 214 | * on the given wrapper bean, then returns a {@link RawAccessor} that allows the caller |
ohair@286 | 215 | * to set/get a value from the property of the bean. |
ohair@286 | 216 | * |
ohair@286 | 217 | * <p> |
ohair@286 | 218 | * This method is not designed for a performance. The caller is expected to cache the result. |
ohair@286 | 219 | * |
ohair@286 | 220 | * @param <B> |
ohair@286 | 221 | * type of the wrapper bean |
ohair@286 | 222 | * @param <V> |
ohair@286 | 223 | * type of the property of the bean |
ohair@286 | 224 | * @return |
ohair@286 | 225 | * always return non-null valid accessor object. |
ohair@286 | 226 | * @throws JAXBException |
ohair@286 | 227 | * if the specified wrapper bean is not bound by JAXB, or if it doesn't have an element property |
ohair@286 | 228 | * of the given name. |
ohair@286 | 229 | * |
ohair@286 | 230 | * @since 2.0 EA1 |
ohair@286 | 231 | */ |
ohair@286 | 232 | public abstract <B,V> RawAccessor<B,V> getElementPropertyAccessor( Class<B> wrapperBean, String nsUri, String localName ) |
ohair@286 | 233 | throws JAXBException; |
ohair@286 | 234 | |
ohair@286 | 235 | /** |
ohair@286 | 236 | * Gets the namespace URIs statically known to this {@link JAXBContext}. |
ohair@286 | 237 | * |
ohair@286 | 238 | * <p> |
ohair@286 | 239 | * When JAXB is used to marshal into sub-trees, it declares |
ohair@286 | 240 | * these namespace URIs at each top-level element that it marshals. |
ohair@286 | 241 | * |
ohair@286 | 242 | * To avoid repeated namespace declarations at sub-elements, the application |
ohair@286 | 243 | * may declare those namespaces at a higher level. |
ohair@286 | 244 | * |
ohair@286 | 245 | * @return |
ohair@286 | 246 | * always non-null. |
ohair@286 | 247 | * |
ohair@286 | 248 | * @since 2.0 EA2 |
ohair@286 | 249 | */ |
ohair@286 | 250 | public abstract @NotNull List<String> getKnownNamespaceURIs(); |
ohair@286 | 251 | |
ohair@286 | 252 | |
ohair@286 | 253 | /** |
ohair@286 | 254 | * Generates the schema documents from the model. |
ohair@286 | 255 | * |
ohair@286 | 256 | * <p> |
ohair@286 | 257 | * The caller can use the additionalElementDecls parameter to |
ohair@286 | 258 | * add element declarations to the generate schema. |
ohair@286 | 259 | * For example, if the JAX-RPC passes in the following entry: |
ohair@286 | 260 | * |
ohair@286 | 261 | * {foo}bar -> DeclaredType for java.lang.String |
ohair@286 | 262 | * |
ohair@286 | 263 | * then JAXB generates the following element declaration (in the schema |
ohair@286 | 264 | * document for the namespace "foo")" |
ohair@286 | 265 | * |
ohair@286 | 266 | * <xs:element name="bar" type="xs:string" /> |
ohair@286 | 267 | * |
ohair@286 | 268 | * This can be used for generating schema components necessary for WSDL. |
ohair@286 | 269 | * |
ohair@286 | 270 | * @param outputResolver |
ohair@286 | 271 | * this object controls the output to which schemas |
ohair@286 | 272 | * will be sent. |
ohair@286 | 273 | * |
ohair@286 | 274 | * @throws IOException |
ohair@286 | 275 | * if {@link SchemaOutputResolver} throws an {@link IOException}. |
ohair@286 | 276 | */ |
ohair@286 | 277 | @Override |
ohair@286 | 278 | public abstract void generateSchema(@NotNull SchemaOutputResolver outputResolver) throws IOException; |
ohair@286 | 279 | |
ohair@286 | 280 | /** |
ohair@286 | 281 | * Returns the name of the XML Type bound to the |
ohair@286 | 282 | * specified Java type. |
ohair@286 | 283 | * |
ohair@286 | 284 | * @param tr |
ohair@286 | 285 | * must not be null. This must be one of the {@link TypeReference}s specified |
ohair@286 | 286 | * in the {@link JAXBRIContext#newInstance} method. |
ohair@286 | 287 | * |
ohair@286 | 288 | * @throws IllegalArgumentException |
ohair@286 | 289 | * if the parameter is null or not a part of the {@link TypeReference}s specified |
ohair@286 | 290 | * in the {@link JAXBRIContext#newInstance} method. |
ohair@286 | 291 | * |
ohair@286 | 292 | * @return null |
ohair@286 | 293 | * if the referenced type is an anonymous and therefore doesn't have a name. |
ohair@286 | 294 | */ |
ohair@286 | 295 | public abstract QName getTypeName(@NotNull TypeReference tr); |
ohair@286 | 296 | |
ohair@286 | 297 | /** |
ohair@286 | 298 | * Gets the build information of the JAXB runtime. |
ohair@286 | 299 | * |
ohair@286 | 300 | * @return |
ohair@286 | 301 | * may be null, if the runtime is loaded by a class loader that doesn't support |
ohair@286 | 302 | * the access to the manifest informatino. |
ohair@286 | 303 | */ |
ohair@286 | 304 | public abstract @NotNull String getBuildId(); |
ohair@286 | 305 | |
ohair@286 | 306 | /** |
ohair@286 | 307 | * Generates the episode file that represents the binding known to this {@link JAXBContext}, |
ohair@286 | 308 | * so that XJC can later do separate compilation. |
ohair@286 | 309 | * |
ohair@286 | 310 | * <p> |
ohair@286 | 311 | * Episode file is really just a JAXB customization file, except that currently |
ohair@286 | 312 | * we use the RI-specific SCD to refer to schema components. |
ohair@286 | 313 | * |
ohair@286 | 314 | * @param output |
ohair@286 | 315 | * This receives the generated episode file. |
ohair@286 | 316 | * |
ohair@286 | 317 | * @since 2.1 |
ohair@286 | 318 | */ |
ohair@286 | 319 | public abstract void generateEpisode(Result output); |
ohair@286 | 320 | |
ohair@286 | 321 | /** |
ohair@286 | 322 | * Allows you to access the runtime model information of the JAXB XML/Java binding. |
ohair@286 | 323 | * |
ohair@286 | 324 | * <p> |
ohair@286 | 325 | * This is useful for doing a deeper integration with the JAXB RI. |
ohair@286 | 326 | * For more information about the model, see https://jaxb2-reflection.dev.java.net/ |
ohair@286 | 327 | * |
ohair@286 | 328 | * @since 2.1.10 |
ohair@286 | 329 | */ |
ohair@286 | 330 | public abstract RuntimeTypeInfoSet getRuntimeTypeInfoSet(); |
ohair@286 | 331 | |
ohair@286 | 332 | /** |
ohair@286 | 333 | * Computes a Java identifier from a local name. |
ohair@286 | 334 | * |
ohair@286 | 335 | * <p> |
ohair@286 | 336 | * This method faithfully implements the name mangling rule as specified in the JAXB spec. |
ohair@286 | 337 | * |
ohair@286 | 338 | * <p> |
ohair@286 | 339 | * In JAXB, a collision with a Java reserved word (such as "return") never happens. |
ohair@286 | 340 | * Accordingly, this method may return an identifier that collides with reserved words. |
ohair@286 | 341 | * |
ohair@286 | 342 | * <p> |
ohair@286 | 343 | * Use <tt>JJavaName.isJavaIdentifier(String)</tt> to check for such collision. |
ohair@286 | 344 | * |
ohair@286 | 345 | * @return |
ohair@286 | 346 | * Typically, this method returns "nameLikeThis". |
ohair@286 | 347 | */ |
ohair@286 | 348 | public static @NotNull String mangleNameToVariableName(@NotNull String localName) { |
ohair@286 | 349 | return NameConverter.standard.toVariableName(localName); |
ohair@286 | 350 | } |
ohair@286 | 351 | |
ohair@286 | 352 | /** |
ohair@286 | 353 | * Computes a Java class name from a local name. |
ohair@286 | 354 | * |
ohair@286 | 355 | * <p> |
ohair@286 | 356 | * This method faithfully implements the name mangling rule as specified in the JAXB spec. |
ohair@286 | 357 | * |
ohair@286 | 358 | * @return |
ohair@286 | 359 | * Typically, this method returns "NameLikeThis". |
ohair@286 | 360 | */ |
ohair@286 | 361 | public static @NotNull String mangleNameToClassName(@NotNull String localName) { |
ohair@286 | 362 | return NameConverter.standard.toClassName(localName); |
ohair@286 | 363 | } |
ohair@286 | 364 | |
ohair@286 | 365 | /** |
ohair@286 | 366 | * Computes a Java class name from a local name. |
ohair@286 | 367 | * |
ohair@286 | 368 | * <p> |
ohair@286 | 369 | * This method faithfully implements the name mangling rule as specified in the JAXB spec. |
ohair@286 | 370 | * This method works like {@link #mangleNameToClassName(String)} except that it looks |
ohair@286 | 371 | * for "getClass" and returns something else. |
ohair@286 | 372 | * |
ohair@286 | 373 | * @return |
ohair@286 | 374 | * Typically, this method returns "NameLikeThis". |
ohair@286 | 375 | */ |
ohair@286 | 376 | public static @NotNull String mangleNameToPropertyName(@NotNull String localName) { |
ohair@286 | 377 | return NameConverter.standard.toPropertyName(localName); |
ohair@286 | 378 | } |
ohair@286 | 379 | |
ohair@286 | 380 | /** |
ohair@286 | 381 | * Gets the parameterization of the given base type. |
ohair@286 | 382 | * |
ohair@286 | 383 | * <p> |
ohair@286 | 384 | * For example, given the following |
ohair@286 | 385 | * <pre><xmp> |
ohair@286 | 386 | * interface Foo<T> extends List<List<T>> {} |
ohair@286 | 387 | * interface Bar extends Foo<String> {} |
ohair@286 | 388 | * </xmp></pre> |
ohair@286 | 389 | * This method works like this: |
ohair@286 | 390 | * <pre><xmp> |
ohair@286 | 391 | * getBaseClass( Bar, List ) = List<List<String> |
ohair@286 | 392 | * getBaseClass( Bar, Foo ) = Foo<String> |
ohair@286 | 393 | * getBaseClass( Foo<? extends Number>, Collection ) = Collection<List<? extends Number>> |
ohair@286 | 394 | * getBaseClass( ArrayList<? extends BigInteger>, List ) = List<? extends BigInteger> |
ohair@286 | 395 | * </xmp></pre> |
ohair@286 | 396 | * |
ohair@286 | 397 | * @param type |
ohair@286 | 398 | * The type that derives from {@code baseType} |
ohair@286 | 399 | * @param baseType |
ohair@286 | 400 | * The class whose parameterization we are interested in. |
ohair@286 | 401 | * @return |
ohair@286 | 402 | * The use of {@code baseType} in {@code type}. |
ohair@286 | 403 | * or null if the type is not assignable to the base type. |
ohair@286 | 404 | * @since 2.0 FCS |
ohair@286 | 405 | */ |
ohair@286 | 406 | public static @Nullable Type getBaseType(@NotNull Type type, @NotNull Class baseType) { |
ohair@286 | 407 | return Navigator.REFLECTION.getBaseClass(type,baseType); |
ohair@286 | 408 | } |
ohair@286 | 409 | |
ohair@286 | 410 | |
ohair@286 | 411 | /** |
ohair@286 | 412 | * The property that you can specify to {@link JAXBContext#newInstance} |
ohair@286 | 413 | * to reassign the default namespace URI to something else at the runtime. |
ohair@286 | 414 | * |
ohair@286 | 415 | * <p> |
ohair@286 | 416 | * The value of the property is {@link String}, and it is used as the namespace URI |
ohair@286 | 417 | * that succeeds the default namespace URI. |
ohair@286 | 418 | * |
ohair@286 | 419 | * @since 2.0 EA1 |
ohair@286 | 420 | */ |
ohair@286 | 421 | public static final String DEFAULT_NAMESPACE_REMAP = "com.sun.xml.internal.bind.defaultNamespaceRemap"; |
ohair@286 | 422 | |
ohair@286 | 423 | /** |
ohair@286 | 424 | * The property that you can specify to {@link JAXBContext#newInstance} |
ohair@286 | 425 | * to put additional JAXB type references into the {@link JAXBContext}. |
ohair@286 | 426 | * |
ohair@286 | 427 | * <p> |
ohair@286 | 428 | * The value of the property is {@link Collection}<{@link TypeReference}>. |
ohair@286 | 429 | * Those {@link TypeReference}s can then be used to create {@link Bridge}s. |
ohair@286 | 430 | * |
ohair@286 | 431 | * <p> |
ohair@286 | 432 | * This mechanism allows additional element declarations that were not a part of |
ohair@286 | 433 | * the schema into the created {@link JAXBContext}. |
ohair@286 | 434 | * |
ohair@286 | 435 | * @since 2.0 EA1 |
ohair@286 | 436 | */ |
ohair@286 | 437 | public static final String TYPE_REFERENCES = "com.sun.xml.internal.bind.typeReferences"; |
ohair@286 | 438 | |
ohair@286 | 439 | /** |
ohair@286 | 440 | * The property that you can specify to {@link JAXBContext#newInstance} |
ohair@286 | 441 | * and {@link Marshaller#setProperty(String, Object)} |
ohair@286 | 442 | * to enable the c14n marshalling support in the {@link JAXBContext}. |
ohair@286 | 443 | * |
ohair@286 | 444 | * @see C14nSupport_ArchitectureDocument |
ohair@286 | 445 | * @since 2.0 EA2 |
ohair@286 | 446 | */ |
ohair@286 | 447 | public static final String CANONICALIZATION_SUPPORT = "com.sun.xml.internal.bind.c14n"; |
ohair@286 | 448 | |
ohair@286 | 449 | /** |
ohair@286 | 450 | * The property that you can specify to {@link JAXBContext#newInstance} |
ohair@286 | 451 | * to allow unmarshaller to honor <tt>xsi:nil</tt> anywhere, even if they are |
ohair@286 | 452 | * not specifically allowed by the schema. |
ohair@286 | 453 | * |
ohair@286 | 454 | * @since 2.1.3 |
ohair@286 | 455 | */ |
ohair@286 | 456 | public static final String TREAT_EVERYTHING_NILLABLE = "com.sun.xml.internal.bind.treatEverythingNillable"; |
ohair@286 | 457 | |
ohair@286 | 458 | /** |
ohair@286 | 459 | * The property that you can specify to {@link JAXBContext#newInstance} |
ohair@286 | 460 | * to use alternative {@link RuntimeAnnotationReader} implementation. |
ohair@286 | 461 | * |
ohair@286 | 462 | * @since 2.1 EA2 |
ohair@286 | 463 | */ |
ohair@286 | 464 | public static final String ANNOTATION_READER = RuntimeAnnotationReader.class.getName(); |
ohair@286 | 465 | |
ohair@286 | 466 | /** |
ohair@286 | 467 | * Marshaller/Unmarshaller property to enable XOP processing. |
ohair@286 | 468 | * |
ohair@286 | 469 | * @since 2.0 EA2 |
ohair@286 | 470 | */ |
ohair@286 | 471 | public static final String ENABLE_XOP = "com.sun.xml.internal.bind.XOP"; |
ohair@286 | 472 | |
ohair@286 | 473 | /** |
ohair@286 | 474 | * The property that you can specify to {@link JAXBContext#newInstance} |
ohair@286 | 475 | * to specify specific classes that replace the reference to generic classes. |
ohair@286 | 476 | * |
ohair@286 | 477 | * <p> |
ohair@286 | 478 | * See the release notes for more details about this feature. |
ohair@286 | 479 | * |
ohair@286 | 480 | * @since 2.1 EA2 |
ohair@286 | 481 | */ |
ohair@286 | 482 | public static final String SUBCLASS_REPLACEMENTS = "com.sun.xml.internal.bind.subclassReplacements"; |
ohair@286 | 483 | |
ohair@286 | 484 | /** |
ohair@286 | 485 | * The property that you can specify to {@link JAXBContext#newInstance} |
ohair@286 | 486 | * enable support of XmlAccessorFactory annotation in the {@link JAXBContext}. |
ohair@286 | 487 | * |
ohair@286 | 488 | * @since 2.1 EA2 |
ohair@286 | 489 | */ |
ohair@286 | 490 | public static final String XMLACCESSORFACTORY_SUPPORT = "com.sun.xml.internal.bind.XmlAccessorFactory"; |
ohair@286 | 491 | |
ohair@286 | 492 | /** |
ohair@286 | 493 | * Retains references to PropertyInfos. |
ohair@286 | 494 | * |
ohair@286 | 495 | * @since 2.1.10 |
ohair@286 | 496 | */ |
ohair@286 | 497 | public static final String RETAIN_REFERENCE_TO_INFO = "retainReferenceToInfo"; |
ohair@286 | 498 | |
ohair@286 | 499 | /** |
ohair@286 | 500 | * Supress security warnings when trying to access fields through reflection. |
ohair@286 | 501 | * |
ohair@286 | 502 | * @since 2.1.14, 2.2.2 |
ohair@286 | 503 | */ |
ohair@286 | 504 | public static final String SUPRESS_ACCESSOR_WARNINGS = "supressAccessorWarnings"; |
ohair@286 | 505 | |
ohair@286 | 506 | /** |
ohair@286 | 507 | * Improves handling of xsi:type used on leaf properties. |
ohair@286 | 508 | * |
ohair@286 | 509 | * @since 2.2.3 |
ohair@286 | 510 | */ |
ohair@286 | 511 | public static final String IMPROVED_XSI_TYPE_HANDLING = "com.sun.xml.internal.bind.improvedXsiTypeHandling"; |
ohair@286 | 512 | |
ohair@286 | 513 | } |