| <!DOCTYPE HTML> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (11.0.2) on Wed Apr 22 10:19:16 CDT 2020 --> |
| <title>JAXBContext (EclipseLink 3.0.0, API Reference)</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="dc.created" content="2020-04-22"> |
| <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../jquery/jquery-ui.css" title="Style"> |
| <script type="text/javascript" src="../../../script.js"></script> |
| <script type="text/javascript" src="../../../jquery/jszip/dist/jszip.min.js"></script> |
| <script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script> |
| <!--[if IE]> |
| <script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> |
| <![endif]--> |
| <script type="text/javascript" src="../../../jquery/jquery-3.3.1.js"></script> |
| <script type="text/javascript" src="../../../jquery/jquery-migrate-3.0.1.js"></script> |
| <script type="text/javascript" src="../../../jquery/jquery-ui.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="JAXBContext (EclipseLink 3.0.0, API Reference)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var data = {"i0":10,"i1":10,"i2":10,"i3":6,"i4":6,"i5":38,"i6":10,"i7":9,"i8":9,"i9":9,"i10":9,"i11":9}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| var pathtoroot = "../../../"; |
| var useModuleDirectories = true; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <header role="banner"> |
| <nav role="navigation"> |
| <div class="fixedNav"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a id="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../index-all.html">Index</a></li> |
| <li><a href="../../../help-doc.html">Help</a></li> |
| </ul> |
| <div class="aboutLanguage">EclipseLink 3.0.0, API Reference</div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <ul class="navListSearch"> |
| <li><label for="search">SEARCH:</label> |
| <input type="text" id="search" value="search" disabled="disabled"> |
| <input type="reset" id="reset" value="reset" disabled="disabled"> |
| </li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| </div> |
| <div class="navPadding"> </div> |
| <script type="text/javascript"><!-- |
| $('.navPadding').css('padding-top', $('.fixedNav').css("height")); |
| //--> |
| </script> |
| </nav> |
| </header> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <main role="main"> |
| <div class="header"> |
| <div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">jakarta.xml.bind</a></div> |
| <h2 title="Class JAXBContext" class="title">Class JAXBContext</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>jakarta.xml.bind.JAXBContext</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>Direct Known Subclasses:</dt> |
| <dd><code><a href="../../../org/eclipse/persistence/jaxb/JAXBContext.html" title="class in org.eclipse.persistence.jaxb">JAXBContext</a></code></dd> |
| </dl> |
| <hr> |
| <pre>public abstract class <span class="typeNameLabel">JAXBContext</span> |
| extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></pre> |
| <div class="block">The <code>JAXBContext</code> class provides the client's entry point to the |
| JAXB API. It provides an abstraction for managing the XML/Java binding |
| information necessary to implement the JAXB binding framework operations: |
| unmarshal, marshal and validate. |
| |
| <p>A client application normally obtains new instances of this class using |
| one of these two styles for newInstance methods, although there are other |
| specialized forms of the method available: |
| |
| <ul> |
| <li><a href="#newInstance(java.lang.String,java.lang.ClassLoader)"><code>JAXBContext.newInstance( "com.acme.foo:com.acme.bar" )</code></a> <br> |
| The JAXBContext instance is initialized from a list of colon |
| separated Java package names. Each java package contains |
| JAXB mapped classes, schema-derived classes and/or user annotated |
| classes. Additionally, the java package may contain JAXB package annotations |
| that must be processed. (see JLS, Section 7.4.1 "Named Packages"). |
| </li> |
| <li><a href="#newInstance(java.lang.Class...)"><code>JAXBContext.newInstance( com.acme.foo.Foo.class )</code></a> <br> |
| The JAXBContext instance is initialized with class(es) |
| passed as parameter(s) and classes that are statically reachable from |
| these class(es). See <a href="#newInstance(java.lang.Class...)"><code>newInstance(Class...)</code></a> for details. |
| </li> |
| </ul> |
| |
| <p><i> |
| The following JAXB 1.0 requirement is only required for schema to |
| java interface/implementation binding. It does not apply to JAXB annotated |
| classes. JAXB Providers must generate a <code>jaxb.properties</code> file in |
| each package containing schema derived classes. The property file must |
| contain a property named <code>jakarta.xml.bind.context.factory</code> whose |
| value is the name of the class that implements the <code>createContext</code> |
| APIs.</i> |
| |
| <p><i> |
| The class supplied by the provider does not have to be assignable to |
| <code>jakarta.xml.bind.JAXBContext</code>, it simply has to provide a class that |
| implements the <code>createContext</code> APIs.</i> |
| |
| <p><i> |
| In addition, the provider must call the |
| <a href="DatatypeConverter.html#setDatatypeConverter(jakarta.xml.bind.DatatypeConverterInterface)"><code>DatatypeConverter.setDatatypeConverter</code></a> api prior to any client |
| invocations of the marshal and unmarshal methods. This is necessary to |
| configure the datatype converter that will be used during these operations.</i> |
| |
| <a id="Unmarshalling"></a> |
| <h2>Unmarshalling</h2> |
| <p> |
| The <a href="Unmarshaller.html" title="interface in jakarta.xml.bind"><code>Unmarshaller</code></a> class provides the client application the ability |
| to convert XML data into a tree of Java content objects. |
| The unmarshal method allows for |
| any global XML element declared in the schema to be unmarshalled as |
| the root of an instance document. |
| Additionally, the unmarshal method allows for an unrecognized root element that |
| has an xsi:type attribute's value that references a type definition declared in |
| the schema to be unmarshalled as the root of an instance document. |
| The <code>JAXBContext</code> object |
| allows the merging of global elements and type definitions across a set of schemas (listed |
| in the <code>contextPath</code>). Since each schema in the schema set can belong |
| to distinct namespaces, the unification of schemas to an unmarshalling |
| context must be namespace independent. This means that a client |
| application is able to unmarshal XML documents that are instances of |
| any of the schemas listed in the <code>contextPath</code>. For example: |
| |
| <pre> |
| JAXBContext jc = JAXBContext.newInstance( "com.acme.foo:com.acme.bar" ); |
| Unmarshaller u = jc.createUnmarshaller(); |
| FooObject fooObj = (FooObject)u.unmarshal( new File( "foo.xml" ) ); // ok |
| BarObject barObj = (BarObject)u.unmarshal( new File( "bar.xml" ) ); // ok |
| BazObject bazObj = (BazObject)u.unmarshal( new File( "baz.xml" ) ); // error, "com.acme.baz" not in contextPath |
| </pre> |
| |
| <p> |
| The client application may also generate Java content trees explicitly rather |
| than unmarshalling existing XML data. For all JAXB-annotated value classes, |
| an application can create content using constructors. |
| For schema-derived interface/implementation classes and for the |
| creation of elements that are not bound to a JAXB-annotated |
| class, an application needs to have access and knowledge about each of |
| the schema derived <code>ObjectFactory</code> classes that exist in each of |
| java packages contained in the <code>contextPath</code>. For each schema |
| derived java class, there is a static factory method that produces objects |
| of that type. For example, |
| assume that after compiling a schema, you have a package <code>com.acme.foo</code> |
| that contains a schema derived interface named <code>PurchaseOrder</code>. In |
| order to create objects of that type, the client application would use the |
| factory method like this: |
| |
| <pre> |
| com.acme.foo.PurchaseOrder po = |
| com.acme.foo.ObjectFactory.createPurchaseOrder(); |
| </pre> |
| |
| <p> |
| Once the client application has an instance of the the schema derived object, |
| it can use the mutator methods to set content on it. |
| |
| <p> |
| For more information on the generated <code>ObjectFactory</code> classes, see |
| Section 4.2 <i>Java Package</i> of the specification. |
| |
| <p> |
| <i>The provider must generate a class in each |
| package that contains all of the necessary object factory methods for that |
| package named ObjectFactory as well as the static |
| <code>newInstance( javaContentInterface )</code> method</i> |
| |
| <h3>Marshalling</h3> |
| <p> |
| The <a href="Marshaller.html" title="interface in jakarta.xml.bind"><code>Marshaller</code></a> class provides the client application the ability |
| to convert a Java content tree back into XML data. There is no difference |
| between marshalling a content tree that is created manually using the factory |
| methods and marshalling a content tree that is the result an <code>unmarshal</code> |
| operation. Clients can marshal a java content tree back to XML data |
| to a <code>java.io.OutputStream</code> or a <code>java.io.Writer</code>. The |
| marshalling process can alternatively produce SAX2 event streams to a |
| registered <code>ContentHandler</code> or produce a DOM Node object. |
| Client applications have control over the output encoding as well as |
| whether or not to marshal the XML data as a complete document or |
| as a fragment. |
| |
| <p> |
| Here is a simple example that unmarshals an XML document and then marshals |
| it back out: |
| |
| <pre> |
| JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" ); |
| |
| // unmarshal from foo.xml |
| Unmarshaller u = jc.createUnmarshaller(); |
| FooObject fooObj = (FooObject)u.unmarshal( new File( "foo.xml" ) ); |
| |
| // marshal to System.out |
| Marshaller m = jc.createMarshaller(); |
| m.marshal( fooObj, System.out ); |
| </pre> |
| |
| |
| <h3>Validation</h3> |
| <p> |
| Validation has been changed significantly since JAXB 1.0. The <a href="Validator.html" title="interface in jakarta.xml.bind"><code>Validator</code></a> |
| class has been deprecated and made optional. This means that you are advised |
| not to use this class and, in fact, it may not even be available depending on |
| your JAXB provider. JAXB 1.0 client applications that rely on <code>Validator</code> |
| will still work properly when deployed with the JAXB 1.0 runtime system. |
| |
| In JAXB 2.0, the <a href="Unmarshaller.html" title="interface in jakarta.xml.bind"><code>Unmarshaller</code></a> has included convenince methods that expose |
| the JAXP 1.3 <a href="https://docs.oracle.com/javase/8/docs/api/javax/xml/validation/package-summary.html?is-external=true" class="externalLink"><code>javax.xml.validation</code></a> framework. Please refer to the |
| <a href="Unmarshaller.html#setSchema(javax.xml.validation.Schema)"><code>Unmarshaller.setSchema(javax.xml.validation.Schema)</code></a> API for more |
| information. |
| |
| |
| <h3>JAXB Runtime Binding Framework Compatibility</h3> |
| <p> |
| The following JAXB 1.0 restriction only applies to binding schema to |
| interfaces/implementation classes. |
| Since this binding does not require a common runtime system, a JAXB |
| client application must not attempt to mix runtime objects (<code>JAXBContext, |
| Marshaller</code>, etc. ) from different providers. This does not |
| mean that the client application isn't portable, it simply means that a |
| client has to use a runtime system provided by the same provider that was |
| used to compile the schema. |
| |
| |
| <h3>Discovery of JAXB implementation</h3> |
| <p> |
| To create an instance of <a href="JAXBContext.html" title="class in jakarta.xml.bind"><code>JAXBContext</code></a>, one of <code>JAXBContext.newInstance(...)</code> methods is invoked. After |
| JAX-B implementation is discovered, call is delegated to appropriate provider's method <code>createContext(...)</code> |
| passing parameters from the original call. |
| <p> |
| JAX-B implementation discovery happens each time <code>JAXBContext.newInstance</code> is invoked. If there is no user |
| specific configuration provided, default JAX-B provider must be returned. |
| <p> |
| Implementation discovery consists of following steps: |
| |
| <ol> |
| |
| <li> |
| Packages/classes explicitly passed in to the <a href="#newInstance(java.lang.String)"><code>newInstance(java.lang.String)</code></a> method are processed in the order they are |
| specified, until <code>jaxb.properties</code> file is looked up in its package, by using the associated classloader — |
| this is <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true#getClassLoader()" title="class or interface in java.lang" class="externalLink"><code>the owner class loader</code></a> for a <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>Class</code></a> argument, and for a package |
| the specified <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ClassLoader.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>ClassLoader</code></a>. |
| |
| <p> |
| If such a resource is discovered, it is <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html?is-external=true#load(java.io.InputStream)" title="class or interface in java.util" class="externalLink"><code>loaded</code></a> as a property file, and |
| the value of the <a href="#JAXB_CONTEXT_FACTORY"><code>JAXB_CONTEXT_FACTORY</code></a> key will be assumed to be the provider factory class. If no value |
| found, <code>"jakarta.xml.bind.context.factory"</code> is used as a key for backwards compatibility reasons. This class is |
| then loaded by the associated class loader discussed above. |
| |
| <p> |
| This phase of the look up allows some packages to force the use of a certain JAXB implementation. |
| (For example, perhaps the schema compiler has generated some vendor extension in the code.) |
| |
| <p> |
| This configuration method is deprecated. |
| |
| <li> |
| If the system property <a href="#JAXB_CONTEXT_FACTORY"><code>JAXB_CONTEXT_FACTORY</code></a> exists, then its value is assumed to be the provider |
| factory class. If no such property exists, properties <code>"jakarta.xml.bind.context.factory"</code> and |
| <code>"jakarta.xml.bind.JAXBContext"</code> are checked too (in this order), for backwards compatibility reasons. This phase |
| of the look up enables per-JVM override of the JAXB implementation. |
| |
| <li> |
| Provider of <a href="JAXBContextFactory.html" title="interface in jakarta.xml.bind"><code>JAXBContextFactory</code></a> is loaded using the service-provider loading |
| facilities, defined by the <a href="https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html?is-external=true" title="class or interface in java.util" class="externalLink"><code>ServiceLoader</code></a> class, to attempt |
| to locate and load an implementation of the service using the <a href="https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html?is-external=true#load(java.lang.Class)" title="class or interface in java.util" class="externalLink">default loading mechanism</a>: the service-provider loading facility |
| will use the <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html?is-external=true#getContextClassLoader()" title="class or interface in java.lang" class="externalLink">current thread's context class loader</a> |
| to attempt to load the context factory. If the context class loader is null, the |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ClassLoader.html?is-external=true#getSystemClassLoader()" title="class or interface in java.lang" class="externalLink">system class loader</a> will be used. |
| <br> |
| In case of <a href="https://docs.oracle.com/javase/8/docs/api/java/util/ServiceConfigurationError.html?is-external=true" title="class or interface in java.util" class="externalLink"><code>service |
| configuration error</code></a> a <a href="JAXBException.html" title="class in jakarta.xml.bind"><code>JAXBException</code></a> will be thrown. |
| |
| <li> |
| Look for resource <code>/META-INF/services/jakarta.xml.bind.JAXBContext</code> using provided class loader. |
| Methods without class loader parameter use <code>Thread.currentThread().getContextClassLoader()</code>. |
| If such a resource exists, its content is assumed to be the provider factory class. |
| |
| This configuration method is deprecated. |
| |
| <li> |
| Finally, if all the steps above fail, then the rest of the look up is unspecified. That said, |
| the recommended behavior is to simply look for some hard-coded platform default JAXB implementation. |
| This phase of the look up is so that Java SE can have its own JAXB implementation as the last resort. |
| </ol> |
| |
| <p> |
| Once the provider factory class is discovered, context creation is delegated to one of its |
| <code>createContext(...)</code> methods. |
| |
| For backward compatibility reasons, there are two ways how to implement provider factory class: |
| <ol> |
| <li>the class is implementation of <a href="JAXBContextFactory.html" title="interface in jakarta.xml.bind"><code>JAXBContextFactory</code></a>. It must also implement no-arg |
| constructor. If discovered in other step then 3, new instance using no-arg constructor is created first. |
| After that, appropriate instance method is invoked on this instance. |
| <li>the class is not implementation of interface above and then it is mandated to implement the following |
| static method signatures: |
| <pre> |
| |
| public static JAXBContext createContext( |
| String contextPath, |
| ClassLoader classLoader, |
| Map<String,Object> properties ) throws JAXBException |
| |
| public static JAXBContext createContext( |
| Class[] classes, |
| Map<String,Object> properties ) throws JAXBException |
| </pre> |
| In this scenario, appropriate static method is used instead of instance method. This approach is incompatible |
| with <a href="https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html?is-external=true" title="class or interface in java.util" class="externalLink"><code>ServiceLoader</code></a> so it can't be used with step 3. |
| </ol> |
| <p> |
| There is no difference in behavior of given method <code>createContext(...)</code> regardless of whether it uses approach |
| 1 (JAXBContextFactory) or 2 (no interface, static methods).</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="Marshaller.html" title="interface in jakarta.xml.bind"><code>Marshaller</code></a>, |
| <a href="Unmarshaller.html" title="interface in jakarta.xml.bind"><code>Unmarshaller</code></a>, |
| <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-7.html#jls-7.4.1">S 7.4.1 "Named Packages" |
| in Java Language Specification</a></dd> |
| <dt><span class="simpleTagLabel">Author:</span></dt> |
| <dd><ul><li>Ryan Shoemaker, Sun Microsystems, Inc.</li> |
| <li>Kohsuke Kawaguchi, Sun Microsystems, Inc.</li> |
| <li>Joe Fialli, Sun Microsystems, Inc.</li></ul></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.6, JAXB 1.0</dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <table class="memberSummary"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Field</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#JAXB_CONTEXT_FACTORY">JAXB_CONTEXT_FACTORY</a></span></code></th> |
| <td class="colLast"> |
| <div class="block">The name of the property that contains the name of the class capable |
| of creating new <code>JAXBContext</code> objects.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier</th> |
| <th class="colSecond" scope="col">Constructor</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected </code></td> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">JAXBContext</a></span>()</code></th> |
| <td class="colLast"> </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Method</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code><a href="Binder.html" title="class in jakarta.xml.bind">Binder</a><<a href="https://docs.oracle.com/javase/8/docs/api/org/w3c/dom/Node.html?is-external=true" title="class or interface in org.w3c.dom" class="externalLink">Node</a>></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createBinder()">createBinder</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Creates a <code>Binder</code> for W3C DOM.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code><T> <a href="Binder.html" title="class in jakarta.xml.bind">Binder</a><T></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createBinder(java.lang.Class)">createBinder</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><T> domType)</code></th> |
| <td class="colLast"> |
| <div class="block">Creates a <code>Binder</code> object that can be used for |
| associative/in-place unmarshalling/marshalling.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code><a href="JAXBIntrospector.html" title="class in jakarta.xml.bind">JAXBIntrospector</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createJAXBIntrospector()">createJAXBIntrospector</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Creates a <code>JAXBIntrospector</code> object that can be used to |
| introspect JAXB objects.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>abstract <a href="Marshaller.html" title="interface in jakarta.xml.bind">Marshaller</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createMarshaller()">createMarshaller</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Create a <code>Marshaller</code> object that can be used to convert a |
| java content tree into XML data.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>abstract <a href="Unmarshaller.html" title="interface in jakarta.xml.bind">Unmarshaller</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createUnmarshaller()">createUnmarshaller</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Create an <code>Unmarshaller</code> object that can be used to convert XML |
| data into a java content tree.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>abstract <a href="Validator.html" title="interface in jakarta.xml.bind">Validator</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createValidator()">createValidator</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="deprecationComment">since JAXB2.0</div> |
| </div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#generateSchema(jakarta.xml.bind.SchemaOutputResolver)">generateSchema</a></span>​(<a href="SchemaOutputResolver.html" title="class in jakarta.xml.bind">SchemaOutputResolver</a> outputResolver)</code></th> |
| <td class="colLast"> |
| <div class="block">Generates the schema documents for this context.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>static <a href="JAXBContext.html" title="class in jakarta.xml.bind">JAXBContext</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#newInstance(java.lang.Class...)">newInstance</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>... classesToBeBound)</code></th> |
| <td class="colLast"> |
| <div class="block">Create a new instance of a <code>JAXBContext</code> class.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>static <a href="JAXBContext.html" title="class in jakarta.xml.bind">JAXBContext</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#newInstance(java.lang.Class%5B%5D,java.util.Map)">newInstance</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>[] classesToBeBound, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>,​?> properties)</code></th> |
| <td class="colLast"> |
| <div class="block">Create a new instance of a <code>JAXBContext</code> class.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>static <a href="JAXBContext.html" title="class in jakarta.xml.bind">JAXBContext</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#newInstance(java.lang.String)">newInstance</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> contextPath)</code></th> |
| <td class="colLast"> |
| <div class="block">Create a new instance of a <code>JAXBContext</code> class.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>static <a href="JAXBContext.html" title="class in jakarta.xml.bind">JAXBContext</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#newInstance(java.lang.String,java.lang.ClassLoader)">newInstance</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> contextPath, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ClassLoader.html?is-external=true" title="class or interface in java.lang" class="externalLink">ClassLoader</a> classLoader)</code></th> |
| <td class="colLast"> |
| <div class="block">Create a new instance of a <code>JAXBContext</code> class.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>static <a href="JAXBContext.html" title="class in jakarta.xml.bind">JAXBContext</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#newInstance(java.lang.String,java.lang.ClassLoader,java.util.Map)">newInstance</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> contextPath, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ClassLoader.html?is-external=true" title="class or interface in java.lang" class="externalLink">ClassLoader</a> classLoader, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>,​?> properties)</code></th> |
| <td class="colLast"> |
| <div class="block">Create a new instance of a <code>JAXBContext</code> class.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a id="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang" class="externalLink">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang" class="externalLink">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang" class="externalLink">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang" class="externalLink">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang" class="externalLink">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang" class="externalLink">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang" class="externalLink">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long,int)" title="class or interface in java.lang" class="externalLink">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="field.detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a id="JAXB_CONTEXT_FACTORY"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>JAXB_CONTEXT_FACTORY</h4> |
| <pre>public static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> JAXB_CONTEXT_FACTORY</pre> |
| <div class="block">The name of the property that contains the name of the class capable |
| of creating new <code>JAXBContext</code> objects.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../constant-values.html#jakarta.xml.bind.JAXBContext.JAXB_CONTEXT_FACTORY">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a id="<init>()"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>JAXBContext</h4> |
| <pre>protected JAXBContext()</pre> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| <!-- ============ METHOD DETAIL ========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a id="newInstance(java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>newInstance</h4> |
| <pre class="methodSignature">public static <a href="JAXBContext.html" title="class in jakarta.xml.bind">JAXBContext</a> newInstance​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> contextPath) |
| throws <a href="JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre> |
| <div class="block">Create a new instance of a <code>JAXBContext</code> class. |
| |
| <p> |
| This is a convenience method to invoke the |
| <a href="#newInstance(java.lang.String,java.lang.ClassLoader)"><code>newInstance(String,ClassLoader)</code></a> method with |
| the context class loader of the current thread.</div> |
| <dl> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - if an error was encountered while creating the |
| <code>JAXBContext</code> such as |
| <ol> |
| <li>failure to locate either ObjectFactory.class or jaxb.index in the packages</li> |
| <li>an ambiguity among global elements contained in the contextPath</li> |
| <li>failure to locate a value for the context factory provider property</li> |
| <li>mixing schema derived packages from different providers on the same contextPath</li> |
| <li>packages are not open to <code>java.xml.bind</code> module</li> |
| </ol></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="newInstance(java.lang.String,java.lang.ClassLoader)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>newInstance</h4> |
| <pre class="methodSignature">public static <a href="JAXBContext.html" title="class in jakarta.xml.bind">JAXBContext</a> newInstance​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> contextPath, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ClassLoader.html?is-external=true" title="class or interface in java.lang" class="externalLink">ClassLoader</a> classLoader) |
| throws <a href="JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre> |
| <div class="block">Create a new instance of a <code>JAXBContext</code> class. |
| |
| <p> |
| The client application must supply a context path which is a list of |
| colon (':', \u003A) separated java package names that contain |
| schema-derived classes and/or fully qualified JAXB-annotated classes. |
| Schema-derived |
| code is registered with the JAXBContext by the |
| ObjectFactory.class generated per package. |
| Alternatively than being listed in the context path, programmer |
| annotated JAXB mapped classes can be listed in a |
| <code>jaxb.index</code> resource file, format described below. |
| Note that a java package can contain both schema-derived classes and |
| user annotated JAXB classes. Additionally, the java package may |
| contain JAXB package annotations that must be processed. (see JLS, |
| Section 7.4.1 "Named Packages"). |
| </p> |
| |
| <p> |
| Every package listed on the contextPath must meet <b>one or both</b> of the |
| following conditions otherwise a <code>JAXBException</code> will be thrown: |
| </p> |
| <ol> |
| <li>it must contain ObjectFactory.class</li> |
| <li>it must contain jaxb.index</li> |
| </ol> |
| |
| <p> |
| <b>Format for jaxb.index</b> |
| <p> |
| The file contains a newline-separated list of class names. |
| Space and tab characters, as well as blank |
| lines, are ignored. The comment character |
| is '#' (0x23); on each line all characters following the first comment |
| character are ignored. The file must be encoded in UTF-8. Classes that |
| are reachable, as defined in <a href="#newInstance(java.lang.Class...)"><code>newInstance(Class...)</code></a>, from the |
| listed classes are also registered with JAXBContext. |
| <p> |
| Constraints on class name occuring in a <code>jaxb.index</code> file are: |
| <ul> |
| <li>Must not end with ".class".</li> |
| <li>Class names are resolved relative to package containing |
| <code>jaxb.index</code> file. Only classes occuring directly in package |
| containing <code>jaxb.index</code> file are allowed.</li> |
| <li>Fully qualified class names are not allowed. |
| A qualified class name,relative to current package, |
| is only allowed to specify a nested or inner class.</li> |
| </ul> |
| |
| <p> |
| To maintain compatibility with JAXB 1.0 schema to java |
| interface/implementation binding, enabled by schema customization |
| <code><jaxb:globalBindings valueClass="false"></code>, |
| the JAXB provider will ensure that each package on the context path |
| has a <code>jaxb.properties</code> file which contains a value for the |
| <code>jakarta.xml.bind.context.factory</code> property and that all values |
| resolve to the same provider. This requirement does not apply to |
| JAXB annotated classes. |
| |
| <p> |
| If there are any global XML element name collisions across the various |
| packages listed on the <code>contextPath</code>, a <code>JAXBException</code> |
| will be thrown. |
| |
| <p> |
| Mixing generated interface/impl bindings from multiple JAXB Providers |
| in the same context path may result in a <code>JAXBException</code> |
| being thrown. |
| |
| <p> |
| The steps involved in discovering the JAXB implementation is discussed in the class javadoc.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>contextPath</code> - List of java package names that contain schema |
| derived class and/or java to schema (JAXB-annotated) |
| mapped classes. |
| Packages in <code>contextPath</code> that are in named modules must be |
| <code>open</code> to at least the <code>java.xml.bind</code> module.</dd> |
| <dd><code>classLoader</code> - This class loader will be used to locate the implementation |
| classes.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a new instance of a <code>JAXBContext</code></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - if an error was encountered while creating the |
| <code>JAXBContext</code> such as |
| <ol> |
| <li>failure to locate either ObjectFactory.class or jaxb.index in the packages</li> |
| <li>an ambiguity among global elements contained in the contextPath</li> |
| <li>failure to locate a value for the context factory provider property</li> |
| <li>mixing schema derived packages from different providers on the same contextPath</li> |
| <li>packages are not open to <code>java.xml.bind</code> module</li> |
| </ol></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="newInstance(java.lang.String,java.lang.ClassLoader,java.util.Map)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>newInstance</h4> |
| <pre class="methodSignature">public static <a href="JAXBContext.html" title="class in jakarta.xml.bind">JAXBContext</a> newInstance​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> contextPath, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ClassLoader.html?is-external=true" title="class or interface in java.lang" class="externalLink">ClassLoader</a> classLoader, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>,​?> properties) |
| throws <a href="JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre> |
| <div class="block">Create a new instance of a <code>JAXBContext</code> class. |
| |
| <p> |
| This is mostly the same as <a href="#newInstance(java.lang.String,java.lang.ClassLoader)"><code>newInstance(String, ClassLoader)</code></a>, |
| but this version allows you to pass in provider-specific properties to configure |
| the instantiation of <a href="JAXBContext.html" title="class in jakarta.xml.bind"><code>JAXBContext</code></a>. |
| |
| <p> |
| The interpretation of properties is up to implementations. Implementations must |
| throw <code>JAXBException</code> if it finds properties that it doesn't understand.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>contextPath</code> - List of java package names that contain schema |
| derived class and/or java to schema (JAXB-annotated) |
| mapped classes. |
| Packages in <code>contextPath</code> that are in named modules must be |
| <code>open</code> to at least the <code>java.xml.bind</code> module.</dd> |
| <dd><code>classLoader</code> - This class loader will be used to locate the implementation classes.</dd> |
| <dd><code>properties</code> - provider-specific properties. Can be null, which means the same thing as passing |
| in an empty map.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a new instance of a <code>JAXBContext</code></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - if an error was encountered while creating the |
| <code>JAXBContext</code> such as |
| <ol> |
| <li>failure to locate either ObjectFactory.class or jaxb.index in the packages</li> |
| <li>an ambiguity among global elements contained in the contextPath</li> |
| <li>failure to locate a value for the context factory provider property</li> |
| <li>mixing schema derived packages from different providers on the same contextPath</li> |
| <li>packages are not open to <code>java.xml.bind</code> module</li> |
| </ol></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.6, JAXB 2.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="newInstance(java.lang.Class...)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>newInstance</h4> |
| <pre class="methodSignature">public static <a href="JAXBContext.html" title="class in jakarta.xml.bind">JAXBContext</a> newInstance​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>... classesToBeBound) |
| throws <a href="JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre> |
| <div class="block">Create a new instance of a <code>JAXBContext</code> class. |
| |
| <p> |
| The client application must supply a list of classes that the new |
| context object needs to recognize. |
| |
| Not only the new context will recognize all the classes specified, |
| but it will also recognize any classes that are directly/indirectly |
| referenced statically from the specified classes. Subclasses of |
| referenced classes nor <code>@XmlTransient</code> referenced classes |
| are not registered with JAXBContext. |
| |
| For example, in the following Java code, if you do |
| <code>newInstance(Foo.class)</code>, the newly created <a href="JAXBContext.html" title="class in jakarta.xml.bind"><code>JAXBContext</code></a> |
| will recognize both <code>Foo</code> and <code>Bar</code>, but not <code>Zot</code> or <code>FooBar</code>: |
| <pre> |
| class Foo { |
| @XmlTransient FooBar c; |
| Bar b; |
| } |
| class Bar { int x; } |
| class Zot extends Bar { int y; } |
| class FooBar { } |
| </pre> |
| |
| Therefore, a typical client application only needs to specify the |
| top-level classes, but it needs to be careful. |
| |
| <p> |
| Note that for each java package registered with JAXBContext, |
| when the optional package annotations exist, they must be processed. |
| (see JLS, Section 7.4.1 "Named Packages"). |
| |
| <p> |
| The steps involved in discovering the JAXB implementation is discussed in the class javadoc.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>classesToBeBound</code> - List of java classes to be recognized by the new <a href="JAXBContext.html" title="class in jakarta.xml.bind"><code>JAXBContext</code></a>. |
| Classes in <code>classesToBeBound</code> that are in named modules must be in a package |
| that is <code>open</code> to at least the <code>java.xml.bind</code> module. |
| Can be empty, in which case a <a href="JAXBContext.html" title="class in jakarta.xml.bind"><code>JAXBContext</code></a> that only knows about |
| spec-defined classes will be returned.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>A new instance of a <code>JAXBContext</code>.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - if an error was encountered while creating the |
| <code>JAXBContext</code>, such as (but not limited to): |
| <ol> |
| <li>No JAXB implementation was discovered |
| <li>Classes use JAXB annotations incorrectly |
| <li>Classes have colliding annotations (i.e., two classes with the same type name) |
| <li>The JAXB implementation was unable to locate |
| provider-specific out-of-band information (such as additional |
| files generated at the development time.) |
| <li><code>classesToBeBound</code> are not open to <code>java.xml.bind</code> module |
| </ol></dd> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></code> - if the parameter contains <code>null</code> (i.e., <code>newInstance(null);</code>)</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.6, JAXB 2.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="newInstance(java.lang.Class[],java.util.Map)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>newInstance</h4> |
| <pre class="methodSignature">public static <a href="JAXBContext.html" title="class in jakarta.xml.bind">JAXBContext</a> newInstance​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>[] classesToBeBound, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>,​?> properties) |
| throws <a href="JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre> |
| <div class="block">Create a new instance of a <code>JAXBContext</code> class. |
| |
| <p> |
| An overloading of <a href="#newInstance(java.lang.Class...)"><code>newInstance(Class...)</code></a> |
| to configure 'properties' for this instantiation of <a href="JAXBContext.html" title="class in jakarta.xml.bind"><code>JAXBContext</code></a>. |
| |
| <p> |
| The interpretation of properties is up to implementations. Implementations must |
| throw <code>JAXBException</code> if it finds properties that it doesn't understand.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>classesToBeBound</code> - List of java classes to be recognized by the new <a href="JAXBContext.html" title="class in jakarta.xml.bind"><code>JAXBContext</code></a>. |
| Classes in <code>classesToBeBound</code> that are in named modules must be in a package |
| that is <code>open</code> to at least the <code>java.xml.bind</code> module. |
| Can be empty, in which case a <a href="JAXBContext.html" title="class in jakarta.xml.bind"><code>JAXBContext</code></a> that only knows about |
| spec-defined classes will be returned.</dd> |
| <dd><code>properties</code> - provider-specific properties. Can be null, which means the same thing as passing |
| in an empty map.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>A new instance of a <code>JAXBContext</code>.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - if an error was encountered while creating the |
| <code>JAXBContext</code>, such as (but not limited to): |
| <ol> |
| <li>No JAXB implementation was discovered |
| <li>Classes use JAXB annotations incorrectly |
| <li>Classes have colliding annotations (i.e., two classes with the same type name) |
| <li>The JAXB implementation was unable to locate |
| provider-specific out-of-band information (such as additional |
| files generated at the development time.) |
| <li><code>classesToBeBound</code> are not open to <code>java.xml.bind</code> module |
| </ol></dd> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></code> - if the parameter contains <code>null</code> (i.e., <code>newInstance(null,someMap);</code>)</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.6, JAXB 2.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="createUnmarshaller()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createUnmarshaller</h4> |
| <pre class="methodSignature">public abstract <a href="Unmarshaller.html" title="interface in jakarta.xml.bind">Unmarshaller</a> createUnmarshaller() |
| throws <a href="JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre> |
| <div class="block">Create an <code>Unmarshaller</code> object that can be used to convert XML |
| data into a java content tree.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an <code>Unmarshaller</code> object</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - if an error was encountered while creating the |
| <code>Unmarshaller</code> object</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="createMarshaller()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createMarshaller</h4> |
| <pre class="methodSignature">public abstract <a href="Marshaller.html" title="interface in jakarta.xml.bind">Marshaller</a> createMarshaller() |
| throws <a href="JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre> |
| <div class="block">Create a <code>Marshaller</code> object that can be used to convert a |
| java content tree into XML data.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a <code>Marshaller</code> object</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - if an error was encountered while creating the |
| <code>Marshaller</code> object</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="createValidator()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createValidator</h4> |
| <pre class="methodSignature"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang" class="externalLink">@Deprecated</a> |
| public abstract <a href="Validator.html" title="interface in jakarta.xml.bind">Validator</a> createValidator() |
| throws <a href="JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre> |
| <div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="deprecationComment">since JAXB2.0</div> |
| </div> |
| <div class="block"><a href="Validator.html" title="interface in jakarta.xml.bind"><code>Validator</code></a> has been made optional and deprecated in JAXB 2.0. Please |
| refer to the javadoc for <a href="Validator.html" title="interface in jakarta.xml.bind"><code>Validator</code></a> for more detail. |
| <p> |
| Create a <code>Validator</code> object that can be used to validate a |
| java content tree against its source schema.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a <code>Validator</code> object</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - if an error was encountered while creating the |
| <code>Validator</code> object</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="createBinder(java.lang.Class)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createBinder</h4> |
| <pre class="methodSignature">public <T> <a href="Binder.html" title="class in jakarta.xml.bind">Binder</a><T> createBinder​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><T> domType)</pre> |
| <div class="block">Creates a <code>Binder</code> object that can be used for |
| associative/in-place unmarshalling/marshalling.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>domType</code> - select the DOM API to use by passing in its DOM Node class.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>always a new valid <code>Binder</code> object.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/UnsupportedOperationException.html?is-external=true" title="class or interface in java.lang" class="externalLink">UnsupportedOperationException</a></code> - if DOM API corresponding to <code>domType</code> is not supported by |
| the implementation.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.6, JAXB 2.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="createBinder()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createBinder</h4> |
| <pre class="methodSignature">public <a href="Binder.html" title="class in jakarta.xml.bind">Binder</a><<a href="https://docs.oracle.com/javase/8/docs/api/org/w3c/dom/Node.html?is-external=true" title="class or interface in org.w3c.dom" class="externalLink">Node</a>> createBinder()</pre> |
| <div class="block">Creates a <code>Binder</code> for W3C DOM.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>always a new valid <code>Binder</code> object.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.6, JAXB 2.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="createJAXBIntrospector()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createJAXBIntrospector</h4> |
| <pre class="methodSignature">public <a href="JAXBIntrospector.html" title="class in jakarta.xml.bind">JAXBIntrospector</a> createJAXBIntrospector()</pre> |
| <div class="block">Creates a <code>JAXBIntrospector</code> object that can be used to |
| introspect JAXB objects.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>always return a non-null valid <code>JAXBIntrospector</code> object.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/UnsupportedOperationException.html?is-external=true" title="class or interface in java.lang" class="externalLink">UnsupportedOperationException</a></code> - Calling this method on JAXB 1.0 implementations will throw |
| an UnsupportedOperationException.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.6, JAXB 2.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="generateSchema(jakarta.xml.bind.SchemaOutputResolver)"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>generateSchema</h4> |
| <pre class="methodSignature">public void generateSchema​(<a href="SchemaOutputResolver.html" title="class in jakarta.xml.bind">SchemaOutputResolver</a> outputResolver) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io" class="externalLink">IOException</a></pre> |
| <div class="block">Generates the schema documents for this context.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>outputResolver</code> - this object controls the output to which schemas |
| will be sent.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io" class="externalLink">IOException</a></code> - if <a href="SchemaOutputResolver.html" title="class in jakarta.xml.bind"><code>SchemaOutputResolver</code></a> throws an <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io" class="externalLink"><code>IOException</code></a>.</dd> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/UnsupportedOperationException.html?is-external=true" title="class or interface in java.lang" class="externalLink">UnsupportedOperationException</a></code> - Calling this method on JAXB 1.0 implementations will throw |
| an UnsupportedOperationException.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.6, JAXB 2.0</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </main> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <footer role="contentinfo"> |
| <nav role="navigation"> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a id="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../index-all.html">Index</a></li> |
| <li><a href="../../../help-doc.html">Help</a></li> |
| </ul> |
| <div class="aboutLanguage">EclipseLink 3.0.0, API Reference</div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </nav> |
| <p class="legalCopy"><small>Copyright © 2017–2020 <a href="http://www.eclipse.org/eclipselink">Eclipse.org - EclipseLink Project</a>. All rights reserved.</small></p> |
| </footer> |
| </body> |
| </html> |