< prev index next >

src/java.xml.bind/share/classes/javax/xml/bind/JAXBContext.java

Print this page

        

*** 32,42 **** import java.util.Properties; import java.io.IOException; import java.io.InputStream; /** ! * The {@code JAXBContext} 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 --- 32,43 ---- import java.util.Properties; import java.io.IOException; import java.io.InputStream; /** ! * <p> ! * The <tt>JAXBContext</tt> 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
*** 59,78 **** * </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} file in * each package containing schema derived classes. The property file must ! * contain a property named {@code javax.xml.bind.context.factory} whose ! * value is the name of the class that implements the {@code createContext} * APIs.</i> * * <p><i> * The class supplied by the provider does not have to be assignable to ! * {@code javax.xml.bind.JAXBContext}, it simply has to provide a class that ! * implements the {@code createContext} APIs.</i> * * <p><i> * In addition, the provider must call the * {@link DatatypeConverter#setDatatypeConverter(DatatypeConverterInterface) * DatatypeConverter.setDatatypeConverter} api prior to any client --- 60,79 ---- * </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 <tt>jaxb.properties</tt> file in * each package containing schema derived classes. The property file must ! * contain a property named <tt>javax.xml.bind.context.factory</tt> whose ! * value is the name of the class that implements the <tt>createContext</tt> * APIs.</i> * * <p><i> * The class supplied by the provider does not have to be assignable to ! * <tt>javax.xml.bind.JAXBContext</tt>, it simply has to provide a class that ! * implements the <tt>createContext</tt> APIs.</i> * * <p><i> * In addition, the provider must call the * {@link DatatypeConverter#setDatatypeConverter(DatatypeConverterInterface) * DatatypeConverter.setDatatypeConverter} api prior to any client
*** 88,104 **** * 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} object * allows the merging of global elements and type definitions across a set of schemas (listed ! * in the {@code contextPath}). Since each schema in the schema set can belong * to distinct namespaces, the unification of schemas to an unmarshalling * context should 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}. 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 --- 89,105 ---- * 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 <tt>JAXBContext</tt> object * allows the merging of global elements and type definitions across a set of schemas (listed ! * in the <tt>contextPath</tt>). Since each schema in the schema set can belong * to distinct namespaces, the unification of schemas to an unmarshalling * context should 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 <tt>contextPath</tt>. 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
*** 111,126 **** * 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} classes that exist in each of ! * java packages contained in the {@code contextPath}. 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} ! * that contains a schema derived interface named {@code PurchaseOrder}. In * order to create objects of that type, the client application would use the * factory method like this: * * <pre> * com.acme.foo.PurchaseOrder po = --- 112,127 ---- * 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 <tt> ObjectFactory</tt> classes that exist in each of ! * java packages contained in the <tt>contextPath</tt>. 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 <tt>com.acme.foo</tt> ! * that contains a schema derived interface named <tt>PurchaseOrder</tt>. In * order to create objects of that type, the client application would use the * factory method like this: * * <pre> * com.acme.foo.PurchaseOrder po =
*** 130,158 **** * <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} 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 )} method</i> * * <h3>Marshalling</h3> * <p> * The {@link Marshaller} 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} ! * operation. Clients can marshal a java content tree back to XML data ! * to a {@code java.io.OutputStream} or a {@code java.io.Writer}. The * marshalling process can alternatively produce SAX2 event streams to a ! * registered {@code ContentHandler} 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> --- 131,159 ---- * <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 <tt>ObjectFactory</tt> 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 ! * <tt>newInstance( javaContentInterface )</tt> method</i> * * <h3>Marshalling</h3> * <p> * The {@link Marshaller} 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 <tt>unmarshal ! * </tt> operation. Clients can marshal a java content tree back to XML data ! * to a <tt>java.io.OutputStream</tt> or a <tt>java.io.Writer</tt>. The * marshalling process can alternatively produce SAX2 event streams to a ! * registered <tt>ContentHandler</tt> 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>
*** 175,185 **** * <h3>Validation</h3> * <p> * Validation has been changed significantly since JAXB 1.0. The {@link Validator} * 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} * will still work properly when deployed with the JAXB 1.0 runtime system. * * In JAXB 2.0, the {@link Unmarshaller} has included convenince methods that expose * the JAXP 1.3 {@link javax.xml.validation} framework. Please refer to the * {@link Unmarshaller#setSchema(javax.xml.validation.Schema)} API for more --- 176,186 ---- * <h3>Validation</h3> * <p> * Validation has been changed significantly since JAXB 1.0. The {@link Validator} * 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 <tt>Validator</tt> * will still work properly when deployed with the JAXB 1.0 runtime system. * * In JAXB 2.0, the {@link Unmarshaller} has included convenince methods that expose * the JAXP 1.3 {@link javax.xml.validation} framework. Please refer to the * {@link Unmarshaller#setSchema(javax.xml.validation.Schema)} API for more
*** 189,215 **** * <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}, 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> ! * When one of the {@code newInstance} methods is called, a JAXB implementation is discovered * by the following steps. * * <ol> * * <li> * For each package/class explicitly passed in to the {@link #newInstance} method, in the order they are specified, ! * {@code jaxb.properties} file is looked up in its package, by using the associated classloader &mdash; * this is {@link Class#getClassLoader() the owner class loader} for a {@link Class} argument, and for a package * the specified {@link ClassLoader}. * * <p> * If such a file is discovered, it is {@link Properties#load(InputStream) loaded} as a property file, and --- 190,216 ---- * <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 (<tt>JAXBContext, ! * Marshaller</tt>, 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> ! * When one of the <tt>newInstance</tt> methods is called, a JAXB implementation is discovered * by the following steps. * * <ol> * * <li> * For each package/class explicitly passed in to the {@link #newInstance} method, in the order they are specified, ! * <tt>jaxb.properties</tt> file is looked up in its package, by using the associated classloader &mdash; * this is {@link Class#getClassLoader() the owner class loader} for a {@link Class} argument, and for a package * the specified {@link ClassLoader}. * * <p> * If such a file is discovered, it is {@link Properties#load(InputStream) loaded} as a property file, and
*** 289,316 **** */ public abstract class JAXBContext { /** * The name of the property that contains the name of the class capable ! * of creating new {@code JAXBContext} objects. */ public static final String JAXB_CONTEXT_FACTORY = "javax.xml.bind.JAXBContextFactory"; protected JAXBContext() { } /** ! * Create a new instance of a {@code JAXBContext} class. * * <p> * This is a convenience method to invoke the * {@link #newInstance(String,ClassLoader)} method with * the context class loader of the current thread. * * @throws JAXBException if an error was encountered while creating the ! * {@code JAXBContext} 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> --- 290,318 ---- */ public abstract class JAXBContext { /** * The name of the property that contains the name of the class capable ! * of creating new <tt>JAXBContext</tt> objects. */ public static final String JAXB_CONTEXT_FACTORY = "javax.xml.bind.JAXBContextFactory"; protected JAXBContext() { } /** ! * <p> ! * Create a new instance of a <tt>JAXBContext</tt> class. * * <p> * This is a convenience method to invoke the * {@link #newInstance(String,ClassLoader)} method with * the context class loader of the current thread. * * @throws JAXBException if an error was encountered while creating the ! * <tt>JAXBContext</tt> 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>
*** 322,352 **** //return newInstance( contextPath, JAXBContext.class.getClassLoader() ); return newInstance( contextPath, getContextClassLoader()); } /** ! * Create a new instance of a {@code JAXBContext} class. * * <p> * The client application must supply a context path which is a list of * colon (':', \u005Cu003A) 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} 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} will be thrown: * </p> * <ol> * <li>it must contain ObjectFactory.class</li> * <li>it must contain jaxb.index</li> * </ol> --- 324,355 ---- //return newInstance( contextPath, JAXBContext.class.getClassLoader() ); return newInstance( contextPath, getContextClassLoader()); } /** ! * <p> ! * Create a new instance of a <tt>JAXBContext</tt> class. * * <p> * The client application must supply a context path which is a list of * colon (':', \u005Cu003A) 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 ! * <tt>jaxb.index</tt> 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 <tt>JAXBException</tt> will be thrown: * </p> * <ol> * <li>it must contain ObjectFactory.class</li> * <li>it must contain jaxb.index</li> * </ol>
*** 360,398 **** * 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 {@link #newInstance(Class...)}, from the * listed classes are also registered with JAXBContext. * <p> ! * Constraints on class name occuring in a {@code jaxb.index} file are: * <ul> * <li>Must not end with ".class".</li> * <li>Class names are resolved relative to package containing ! * {@code jaxb.index} file. Only classes occuring directly in package ! * containing {@code jaxb.index} 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">}, * the JAXB provider will ensure that each package on the context path ! * has a {@code jaxb.properties} file which contains a value for the ! * {@code javax.xml.bind.context.factory} 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}, a {@code JAXBException} * will be thrown. * * <p> * Mixing generated interface/impl bindings from multiple JAXB Providers ! * in the same context path may result in a {@code JAXBException} * being thrown. * * <p> * The steps involved in discovering the JAXB implementation is discussed in the class javadoc. * --- 363,401 ---- * 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 {@link #newInstance(Class...)}, from the * listed classes are also registered with JAXBContext. * <p> ! * Constraints on class name occuring in a <tt>jaxb.index</tt> file are: * <ul> * <li>Must not end with ".class".</li> * <li>Class names are resolved relative to package containing ! * <tt>jaxb.index</tt> file. Only classes occuring directly in package ! * containing <tt>jaxb.index</tt> 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 ! * <tt>{@literal <jaxb:globalBindings valueClass="false">}</tt>, * the JAXB provider will ensure that each package on the context path ! * has a <tt>jaxb.properties</tt> file which contains a value for the ! * <tt>javax.xml.bind.context.factory</tt> 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 <tt>contextPath</tt>, a <tt>JAXBException</tt> * will be thrown. * * <p> * Mixing generated interface/impl bindings from multiple JAXB Providers ! * in the same context path may result in a <tt>JAXBException</tt> * being thrown. * * <p> * The steps involved in discovering the JAXB implementation is discussed in the class javadoc. *
*** 401,413 **** * mapped classes * @param classLoader * This class loader will be used to locate the implementation * classes. * ! * @return a new instance of a {@code JAXBContext} * @throws JAXBException if an error was encountered while creating the ! * {@code JAXBContext} 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> --- 404,416 ---- * mapped classes * @param classLoader * This class loader will be used to locate the implementation * classes. * ! * @return a new instance of a <tt>JAXBContext</tt> * @throws JAXBException if an error was encountered while creating the ! * <tt>JAXBContext</tt> 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>
*** 417,447 **** return newInstance(contextPath,classLoader,Collections.<String,Object>emptyMap()); } /** ! * Create a new instance of a {@code JAXBContext} class. * * <p> * This is mostly the same as {@link JAXBContext#newInstance(String, ClassLoader)}, * but this version allows you to pass in provider-specific properties to configure * the instantiation of {@link JAXBContext}. * * <p> * The interpretation of properties is up to implementations. Implementations should ! * throw {@code JAXBException} if it finds properties that it doesn't understand. * * @param contextPath list of java package names that contain schema derived classes * @param classLoader * This class loader will be used to locate the implementation classes. * @param properties * provider-specific properties. Can be null, which means the same thing as passing * in an empty map. * ! * @return a new instance of a {@code JAXBContext} * @throws JAXBException if an error was encountered while creating the ! * {@code JAXBContext} 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> --- 420,451 ---- return newInstance(contextPath,classLoader,Collections.<String,Object>emptyMap()); } /** ! * <p> ! * Create a new instance of a <tt>JAXBContext</tt> class. * * <p> * This is mostly the same as {@link JAXBContext#newInstance(String, ClassLoader)}, * but this version allows you to pass in provider-specific properties to configure * the instantiation of {@link JAXBContext}. * * <p> * The interpretation of properties is up to implementations. Implementations should ! * throw <tt>JAXBException</tt> if it finds properties that it doesn't understand. * * @param contextPath list of java package names that contain schema derived classes * @param classLoader * This class loader will be used to locate the implementation classes. * @param properties * provider-specific properties. Can be null, which means the same thing as passing * in an empty map. * ! * @return a new instance of a <tt>JAXBContext</tt> * @throws JAXBException if an error was encountered while creating the ! * <tt>JAXBContext</tt> 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>
*** 464,486 **** properties ); } // TODO: resurrect this once we introduce external annotations // /** ! // * Create a new instance of a {@code JAXBContext} 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. // * // * For example, in the following Java code, if you do ! // * {@code newInstance(Foo.class)}, the newly created {@link JAXBContext} ! // * will recognize both {@code Foo} and {@code Bar}, but not {@code Zot}: // * <pre> // * class Foo { // * Bar b; // * } // * class Bar { int x; } --- 468,491 ---- properties ); } // TODO: resurrect this once we introduce external annotations // /** ! // * <p> ! // * Create a new instance of a <tt>JAXBContext</tt> 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. // * // * For example, in the following Java code, if you do ! // * <tt>newInstance(Foo.class)</tt>, the newly created {@link JAXBContext} ! // * will recognize both <tt>Foo</tt> and <tt>Bar</tt>, but not <tt>Zot</tt>: // * <pre> // * class Foo { // * Bar b; // * } // * class Bar { int x; }
*** 500,514 **** // * list of java classes to be recognized by the new {@link JAXBContext}. // * Can be empty, in which case a {@link JAXBContext} that only knows about // * spec-defined classes will be returned. // * // * @return ! // * A new instance of a {@code JAXBContext}. // * // * @throws JAXBException // * if an error was encountered while creating the ! // * {@code JAXBContext}, 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>Specified external bindings are incorrect --- 505,519 ---- // * list of java classes to be recognized by the new {@link JAXBContext}. // * Can be empty, in which case a {@link JAXBContext} that only knows about // * spec-defined classes will be returned. // * // * @return ! // * A new instance of a <tt>JAXBContext</tt>. // * // * @throws JAXBException // * if an error was encountered while creating the ! // * <tt>JAXBContext</tt>, 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>Specified external bindings are incorrect
*** 537,561 **** // // return ContextFinder.find(externalBindings,classesToBeBound); // } /** ! * Create a new instance of a {@code JAXBContext} 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} referenced classes * are not registered with JAXBContext. * * For example, in the following Java code, if you do ! * {@code newInstance(Foo.class)}, the newly created {@link JAXBContext} ! * will recognize both {@code Foo} and {@code Bar}, but not {@code Zot} or {@code FooBar}: * <pre> * class Foo { * @XmlTransient FooBar c; * Bar b; * } --- 542,567 ---- // // return ContextFinder.find(externalBindings,classesToBeBound); // } /** ! * <p> ! * Create a new instance of a <tt>JAXBContext</tt> 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 <tt>@XmlTransient</tt> referenced classes * are not registered with JAXBContext. * * For example, in the following Java code, if you do ! * <tt>newInstance(Foo.class)</tt>, the newly created {@link JAXBContext} ! * will recognize both <tt>Foo</tt> and <tt>Bar</tt>, but not <tt>Zot</tt> or <tt>FooBar</tt>: * <pre> * class Foo { * @XmlTransient FooBar c; * Bar b; * }
*** 579,593 **** * list of java classes to be recognized by the new {@link JAXBContext}. * Can be empty, in which case a {@link JAXBContext} that only knows about * spec-defined classes will be returned. * * @return ! * A new instance of a {@code JAXBContext}. * * @throws JAXBException * if an error was encountered while creating the ! * {@code JAXBContext}, 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 --- 585,599 ---- * list of java classes to be recognized by the new {@link JAXBContext}. * Can be empty, in which case a {@link JAXBContext} that only knows about * spec-defined classes will be returned. * * @return ! * A new instance of a <tt>JAXBContext</tt>. * * @throws JAXBException * if an error was encountered while creating the ! * <tt>JAXBContext</tt>, 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
*** 605,638 **** return newInstance(classesToBeBound,Collections.<String,Object>emptyMap()); } /** ! * Create a new instance of a {@code JAXBContext} class. * * <p> * An overloading of {@link JAXBContext#newInstance(Class...)} * to configure 'properties' for this instantiation of {@link JAXBContext}. * * <p> * The interpretation of properties is up to implementations. Implementations should ! * throw {@code JAXBException} if it finds properties that it doesn't understand. * * @param classesToBeBound * list of java classes to be recognized by the new {@link JAXBContext}. * Can be empty, in which case a {@link JAXBContext} that only knows about * spec-defined classes will be returned. * @param properties * provider-specific properties. Can be null, which means the same thing as passing * in an empty map. * * @return ! * A new instance of a {@code JAXBContext}. * * @throws JAXBException * if an error was encountered while creating the ! * {@code JAXBContext}, 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 --- 611,645 ---- return newInstance(classesToBeBound,Collections.<String,Object>emptyMap()); } /** ! * <p> ! * Create a new instance of a <tt>JAXBContext</tt> class. * * <p> * An overloading of {@link JAXBContext#newInstance(Class...)} * to configure 'properties' for this instantiation of {@link JAXBContext}. * * <p> * The interpretation of properties is up to implementations. Implementations should ! * throw <tt>JAXBException</tt> if it finds properties that it doesn't understand. * * @param classesToBeBound * list of java classes to be recognized by the new {@link JAXBContext}. * Can be empty, in which case a {@link JAXBContext} that only knows about * spec-defined classes will be returned. * @param properties * provider-specific properties. Can be null, which means the same thing as passing * in an empty map. * * @return ! * A new instance of a <tt>JAXBContext</tt>. * * @throws JAXBException * if an error was encountered while creating the ! * <tt>JAXBContext</tt>, 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
*** 661,718 **** return ContextFinder.find(classesToBeBound,properties); } /** ! * Create an {@code Unmarshaller} object that can be used to convert XML * data into a java content tree. * ! * @return an {@code Unmarshaller} object * * @throws JAXBException if an error was encountered while creating the ! * {@code Unmarshaller} object */ public abstract Unmarshaller createUnmarshaller() throws JAXBException; /** ! * Create a {@code Marshaller} object that can be used to convert a * java content tree into XML data. * ! * @return a {@code Marshaller} object * * @throws JAXBException if an error was encountered while creating the ! * {@code Marshaller} object */ public abstract Marshaller createMarshaller() throws JAXBException; /** * {@link Validator} has been made optional and deprecated in JAXB 2.0. Please * refer to the javadoc for {@link Validator} for more detail. * <p> ! * Create a {@code Validator} object that can be used to validate a * java content tree against its source schema. * ! * @return a {@code Validator} object * * @throws JAXBException if an error was encountered while creating the ! * {@code Validator} object * @deprecated since JAXB2.0 */ public abstract Validator createValidator() throws JAXBException; /** ! * Creates a {@code Binder} object that can be used for * associative/in-place unmarshalling/marshalling. * * @param domType select the DOM API to use by passing in its DOM Node class. * ! * @return always a new valid {@code Binder} object. * * @throws UnsupportedOperationException ! * if DOM API corresponding to {@code domType} is not supported by * the implementation. * * @since 1.6, JAXB 2.0 */ public <T> Binder<T> createBinder(Class<T> domType) { --- 668,725 ---- return ContextFinder.find(classesToBeBound,properties); } /** ! * Create an <tt>Unmarshaller</tt> object that can be used to convert XML * data into a java content tree. * ! * @return an <tt>Unmarshaller</tt> object * * @throws JAXBException if an error was encountered while creating the ! * <tt>Unmarshaller</tt> object */ public abstract Unmarshaller createUnmarshaller() throws JAXBException; /** ! * Create a <tt>Marshaller</tt> object that can be used to convert a * java content tree into XML data. * ! * @return a <tt>Marshaller</tt> object * * @throws JAXBException if an error was encountered while creating the ! * <tt>Marshaller</tt> object */ public abstract Marshaller createMarshaller() throws JAXBException; /** * {@link Validator} has been made optional and deprecated in JAXB 2.0. Please * refer to the javadoc for {@link Validator} for more detail. * <p> ! * Create a <tt>Validator</tt> object that can be used to validate a * java content tree against its source schema. * ! * @return a <tt>Validator</tt> object * * @throws JAXBException if an error was encountered while creating the ! * <tt>Validator</tt> object * @deprecated since JAXB2.0 */ public abstract Validator createValidator() throws JAXBException; /** ! * Creates a <tt>Binder</tt> object that can be used for * associative/in-place unmarshalling/marshalling. * * @param domType select the DOM API to use by passing in its DOM Node class. * ! * @return always a new valid <tt>Binder</tt> object. * * @throws UnsupportedOperationException ! * if DOM API corresponding to <tt>domType</tt> is not supported by * the implementation. * * @since 1.6, JAXB 2.0 */ public <T> Binder<T> createBinder(Class<T> domType) {
*** 720,745 **** // abstract throw new UnsupportedOperationException(); } /** ! * Creates a {@code Binder} for W3C DOM. * ! * @return always a new valid {@code Binder} object. * * @since 1.6, JAXB 2.0 */ public Binder<Node> createBinder() { return createBinder(Node.class); } /** ! * Creates a {@code JAXBIntrospector} object that can be used to * introspect JAXB objects. * * @return ! * always return a non-null valid {@code JAXBIntrospector} object. * * @throws UnsupportedOperationException * Calling this method on JAXB 1.0 implementations will throw * an UnsupportedOperationException. * --- 727,752 ---- // abstract throw new UnsupportedOperationException(); } /** ! * Creates a <tt>Binder</tt> for W3C DOM. * ! * @return always a new valid <tt>Binder</tt> object. * * @since 1.6, JAXB 2.0 */ public Binder<Node> createBinder() { return createBinder(Node.class); } /** ! * Creates a <tt>JAXBIntrospector</tt> object that can be used to * introspect JAXB objects. * * @return ! * always return a non-null valid <tt>JAXBIntrospector</tt> object. * * @throws UnsupportedOperationException * Calling this method on JAXB 1.0 implementations will throw * an UnsupportedOperationException. *
< prev index next >