├── .github └── workflows │ └── maven.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE.md ├── NOTICE.md ├── README.md ├── SECURITY.md ├── api ├── pom.xml └── src │ ├── main │ ├── java │ │ ├── jakarta │ │ │ └── xml │ │ │ │ └── bind │ │ │ │ ├── Binder.java │ │ │ │ ├── ContextFinder.java │ │ │ │ ├── DataBindingException.java │ │ │ │ ├── DatatypeConverter.java │ │ │ │ ├── DatatypeConverterImpl.java │ │ │ │ ├── DatatypeConverterInterface.java │ │ │ │ ├── Element.java │ │ │ │ ├── GetPropertyAction.java │ │ │ │ ├── JAXB.java │ │ │ │ ├── JAXBContext.java │ │ │ │ ├── JAXBContextFactory.java │ │ │ │ ├── JAXBElement.java │ │ │ │ ├── JAXBException.java │ │ │ │ ├── JAXBIntrospector.java │ │ │ │ ├── JAXBPermission.java │ │ │ │ ├── MarshalException.java │ │ │ │ ├── Marshaller.java │ │ │ │ ├── Messages.java │ │ │ │ ├── ModuleUtil.java │ │ │ │ ├── NotIdentifiableEvent.java │ │ │ │ ├── ParseConversionEvent.java │ │ │ │ ├── PrintConversionEvent.java │ │ │ │ ├── PropertyException.java │ │ │ │ ├── SchemaOutputResolver.java │ │ │ │ ├── ServiceLoaderUtil.java │ │ │ │ ├── TypeConstraintException.java │ │ │ │ ├── UnmarshalException.java │ │ │ │ ├── Unmarshaller.java │ │ │ │ ├── UnmarshallerHandler.java │ │ │ │ ├── ValidationEvent.java │ │ │ │ ├── ValidationEventHandler.java │ │ │ │ ├── ValidationEventLocator.java │ │ │ │ ├── ValidationException.java │ │ │ │ ├── WhiteSpaceProcessor.java │ │ │ │ ├── annotation │ │ │ │ ├── DomHandler.java │ │ │ │ ├── W3CDomHandler.java │ │ │ │ ├── XmlAccessOrder.java │ │ │ │ ├── XmlAccessType.java │ │ │ │ ├── XmlAccessorOrder.java │ │ │ │ ├── XmlAccessorType.java │ │ │ │ ├── XmlAnyAttribute.java │ │ │ │ ├── XmlAnyElement.java │ │ │ │ ├── XmlAttachmentRef.java │ │ │ │ ├── XmlAttribute.java │ │ │ │ ├── XmlElement.java │ │ │ │ ├── XmlElementDecl.java │ │ │ │ ├── XmlElementRef.java │ │ │ │ ├── XmlElementRefs.java │ │ │ │ ├── XmlElementWrapper.java │ │ │ │ ├── XmlElements.java │ │ │ │ ├── XmlEnum.java │ │ │ │ ├── XmlEnumValue.java │ │ │ │ ├── XmlID.java │ │ │ │ ├── XmlIDREF.java │ │ │ │ ├── XmlInlineBinaryData.java │ │ │ │ ├── XmlList.java │ │ │ │ ├── XmlMimeType.java │ │ │ │ ├── XmlMixed.java │ │ │ │ ├── XmlNs.java │ │ │ │ ├── XmlNsForm.java │ │ │ │ ├── XmlRegistry.java │ │ │ │ ├── XmlRootElement.java │ │ │ │ ├── XmlSchema.java │ │ │ │ ├── XmlSchemaType.java │ │ │ │ ├── XmlSchemaTypes.java │ │ │ │ ├── XmlSeeAlso.java │ │ │ │ ├── XmlTransient.java │ │ │ │ ├── XmlType.java │ │ │ │ ├── XmlValue.java │ │ │ │ ├── adapters │ │ │ │ │ ├── CollapsedStringAdapter.java │ │ │ │ │ ├── HexBinaryAdapter.java │ │ │ │ │ ├── NormalizedStringAdapter.java │ │ │ │ │ ├── XmlAdapter.java │ │ │ │ │ ├── XmlJavaTypeAdapter.java │ │ │ │ │ ├── XmlJavaTypeAdapters.java │ │ │ │ │ └── package-info.java │ │ │ │ └── package-info.java │ │ │ │ ├── attachment │ │ │ │ ├── AttachmentMarshaller.java │ │ │ │ ├── AttachmentUnmarshaller.java │ │ │ │ └── package-info.java │ │ │ │ ├── helpers │ │ │ │ ├── AbstractMarshallerImpl.java │ │ │ │ ├── AbstractUnmarshallerImpl.java │ │ │ │ ├── DefaultValidationEventHandler.java │ │ │ │ ├── Messages.java │ │ │ │ ├── NotIdentifiableEventImpl.java │ │ │ │ ├── ParseConversionEventImpl.java │ │ │ │ ├── PrintConversionEventImpl.java │ │ │ │ ├── ValidationEventImpl.java │ │ │ │ ├── ValidationEventLocatorImpl.java │ │ │ │ └── package-info.java │ │ │ │ ├── package-info.java │ │ │ │ └── util │ │ │ │ ├── JAXBResult.java │ │ │ │ ├── JAXBSource.java │ │ │ │ ├── Messages.java │ │ │ │ ├── ValidationEventCollector.java │ │ │ │ └── package-info.java │ │ └── module-info.java │ ├── javadoc │ │ └── doc-files │ │ │ └── speclicense.html │ └── resources │ │ └── jakarta │ │ └── xml │ │ └── bind │ │ ├── Messages.properties │ │ ├── bindingschema_1_0.xsd │ │ ├── bindingschema_2_0.xsd │ │ ├── bindingschema_3_0.xsd │ │ ├── helpers │ │ └── Messages.properties │ │ └── util │ │ └── Messages.properties │ └── test │ └── java │ └── org │ └── eclipse │ └── jaxb │ └── api │ └── DatatypeConverterTest.java ├── etc ├── config │ ├── copyright-exclude │ └── edl-copyright.txt ├── jenkins │ ├── continuous.groovy │ ├── continuous.sh │ ├── release.groovy │ └── release.sh ├── scripts │ ├── maven.incl.sh │ └── nexus.incl.sh └── spotbugs-exclude.xml ├── jaxb-api-test ├── pom.xml └── src │ ├── main │ ├── java │ │ ├── jakarta │ │ │ └── xml │ │ │ │ └── bind │ │ │ │ └── tests │ │ │ │ └── SampleTest.java │ │ └── module-info.java │ └── javadoc │ │ └── doc-files │ │ └── speclicense.html │ └── test │ ├── java │ ├── jakarta │ │ └── xml │ │ │ └── bind │ │ │ └── test │ │ │ ├── JAXBContextServiceProviderNPETest.java │ │ │ ├── JAXBContextTest.java │ │ │ └── JAXBContextWrapExceptionTest.java │ ├── jaxb │ │ ├── factory │ │ │ ├── legacy │ │ │ │ ├── Invalid.java │ │ │ │ ├── Valid.java │ │ │ │ ├── Valid2.java │ │ │ │ └── Valid3.java │ │ │ └── spi │ │ │ │ ├── Invalid.java │ │ │ │ ├── Valid.java │ │ │ │ ├── Valid2.java │ │ │ │ └── Valid3.java │ │ └── test │ │ │ └── usr │ │ │ └── A.java │ └── module-info.java │ └── resources │ ├── jakarta │ └── xml │ │ └── bind │ │ └── test.policy │ ├── jaxb │ └── test │ │ └── usr │ │ └── jaxb.index │ └── logging.properties ├── pom.xml ├── spec ├── LICENSE ├── README.md ├── pom.xml └── src │ ├── assembly │ └── assembly.xml │ ├── main │ └── asciidoc │ │ ├── XMLBinding.adoc │ │ ├── appA-references.adoc │ │ ├── appB-runtime_processing.adoc │ │ ├── appC-normative_schema.adoc │ │ ├── appD-binding_xml.adoc │ │ ├── appE-external_binding.adoc │ │ ├── appF-xml_schema.adoc │ │ ├── appH-binary_data.adoc │ │ ├── appI-changelog.adoc │ │ ├── ch01-introduction.adoc │ │ ├── ch02-requirements.adoc │ │ ├── ch03-architecture.adoc │ │ ├── ch04-binding_framework.adoc │ │ ├── ch05-java_representation.adoc │ │ ├── ch06-binding_xml_schema.adoc │ │ ├── ch07-customize_xml_schema.adoc │ │ ├── ch08-java_types.adoc │ │ ├── ch09-compatibility.adoc │ │ ├── images │ │ ├── jakarta_ee_logo_schooner_color_stacked_default.png │ │ ├── xmlb-10.svg │ │ ├── xmlb-11.svg │ │ ├── xmlb-12.svg │ │ ├── xmlb-13.svg │ │ ├── xmlb-15.png │ │ ├── xmlb-16.svg │ │ ├── xmlb-17.svg │ │ ├── xmlb-18.svg │ │ ├── xmlb-2.svg │ │ ├── xmlb-23.svg │ │ ├── xmlb-3.svg │ │ ├── xmlb-4.svg │ │ ├── xmlb-8.svg │ │ └── xmlb-9.svg │ │ ├── license-efsl.adoc │ │ ├── scope.adoc │ │ ├── xml-binding-spec.adoc │ │ └── xml-binding.adoc │ └── theme │ └── jakartaee-theme.yml └── tools └── rewrite_poms_git.sh /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2021, 2024 Contributors to the Eclipse Foundation 3 | # 4 | # This program and the accompanying materials are made available under the 5 | # terms of the Eclipse Public License v. 2.0 which is available at 6 | # http://www.eclipse.org/legal/epl-2.0, 7 | # or the Eclipse Distribution License v. 1.0 which is available at 8 | # http://www.eclipse.org/org/documents/edl-v10.php. 9 | # 10 | # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | # 12 | 13 | name: XML Binding API 14 | 15 | on: 16 | pull_request: 17 | push: 18 | 19 | jobs: 20 | build: 21 | name: Test on JDK ${{ matrix.java_version }} 22 | runs-on: ubuntu-latest 23 | 24 | strategy: 25 | matrix: 26 | java_version: [ 21 ] 27 | 28 | steps: 29 | - name: Checkout for build 30 | uses: actions/checkout@v4 31 | - name: Set up JDK 32 | uses: actions/setup-java@v4 33 | with: 34 | distribution: 'zulu' 35 | java-version: ${{ matrix.java_version }} 36 | cache: maven 37 | - name: Verify 38 | run: mvn -B -V -U -C -Poss-release -Pstaging clean verify -Dgpg.skip=true org.glassfish.copyright:glassfish-copyright-maven-plugin:check -Dcopyright.ignoreyear=true 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | **/.classpath 3 | **/.project 4 | .settings/ 5 | 6 | # IntelliJ # 7 | .idea/ 8 | *.iml 9 | 10 | # OS Files # 11 | .DS_Store -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | [//]: # " Copyright (c) 2018, 2024 Oracle and/or its affiliates. All rights reserved. " 2 | [//]: # " " 3 | [//]: # " This program and the accompanying materials are made available under the " 4 | [//]: # " terms of the Eclipse Distribution License v. 1.0, which is available at " 5 | [//]: # " http://www.eclipse.org/org/documents/edl-v10.php. " 6 | [//]: # " " 7 | [//]: # " SPDX-License-Identifier: BSD-3-Clause " 8 | 9 | # Contributing to Jakarta XML Binding 10 | 11 | Thanks for your interest in this project. 12 | 13 | ## Project description 14 | 15 | Jakarta XML Binding™ defines an API and tools that automate the mapping 16 | between XML documents and Java objects. 17 | 18 | * https://projects.eclipse.org/projects/ee4j.jaxb 19 | 20 | ## Terms of Use 21 | 22 | This repository is subject to the Terms of Use of the Eclipse Foundation 23 | 24 | * https://www.eclipse.org/legal/termsofuse.php 25 | 26 | ## Developer resources 27 | 28 | Information regarding source code management, builds, coding standards, and 29 | more. 30 | 31 | * https://projects.eclipse.org/projects/ee4j.jaxb/developer 32 | 33 | The project maintains the following source code repositories 34 | 35 | * https://github.com/jakartaee/jaxb-api 36 | * https://github.com/jakartaee/jaxb-tck 37 | 38 | ## Eclipse Development Process 39 | 40 | This Eclipse Foundation open project is governed by the Eclipse Foundation 41 | Development Process and operates under the terms of the Eclipse IP Policy. 42 | 43 | The Jakarta EE Specification Committee has adopted the Jakarta EE Specification 44 | Process (JESP) in accordance with the Eclipse Foundation Specification Process 45 | v1.2 (EFSP) to ensure that the specification process is complied with by all 46 | Jakarta EE specification projects. 47 | 48 | * https://eclipse.org/projects/dev_process 49 | * https://www.eclipse.org/org/documents/Eclipse_IP_Policy.pdf 50 | * https://jakarta.ee/about/jesp/ 51 | * https://www.eclipse.org/legal/efsp_non_assert.php 52 | 53 | ## Eclipse Contributor Agreement 54 | 55 | In order to be able to contribute to Eclipse Foundation projects you must 56 | electronically sign the Eclipse Contributor Agreement (ECA). 57 | 58 | * https://www.eclipse.org/legal/ECA.php 59 | 60 | The ECA provides the Eclipse Foundation with a permanent record that you agree 61 | that each of your contributions will comply with the commitments documented in 62 | the Developer Certificate of Origin (DCO). Having an ECA on file associated with 63 | the email address matching the "Author" field of your contribution's Git commits 64 | fulfills the DCO's requirement that you sign-off on your contributions. 65 | 66 | For more information, please see the Eclipse Committer Handbook: 67 | https://www.eclipse.org/projects/handbook/#resources-commit 68 | 69 | ## Contact 70 | 71 | Contact the project developers via the project's "dev" list. 72 | 73 | * https://accounts.eclipse.org/mailing-list/jaxb-dev 74 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | - Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | - Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | - Neither the name of the Eclipse Foundation, Inc. nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 20 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 23 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /NOTICE.md: -------------------------------------------------------------------------------- 1 | [//]: # " Copyright (c) 2018, 2024 Oracle and/or its affiliates. All rights reserved. " 2 | [//]: # " " 3 | [//]: # " This program and the accompanying materials are made available under the " 4 | [//]: # " terms of the Eclipse Distribution License v. 1.0, which is available at " 5 | [//]: # " http://www.eclipse.org/org/documents/edl-v10.php. " 6 | [//]: # " " 7 | [//]: # " SPDX-License-Identifier: BSD-3-Clause " 8 | 9 | # Notices for Jakarta XML Binding 10 | 11 | This content is produced and maintained by the Jakarta XML Binding project. 12 | 13 | * Project home: https://projects.eclipse.org/projects/ee4j.jaxb 14 | 15 | ## Trademarks 16 | 17 | Jakarta XML Binding™ is a trademark of the Eclipse Foundation. 18 | 19 | ## Copyright 20 | 21 | All content is the property of the respective authors or their employers. For 22 | more information regarding authorship of content, please consult the listed 23 | source code repository logs. 24 | 25 | ## Declared Project Licenses 26 | 27 | This program and the accompanying materials are made available under the terms 28 | of the Eclipse Distribution License v1.0 which is available at 29 | https://www.eclipse.org/org/documents/edl-v10.php. 30 | 31 | SPDX-License-Identifier: BSD-3-Clause 32 | 33 | ## Source Code 34 | 35 | The project maintains the following source code repositories: 36 | 37 | * https://github.com/jakartaee/jaxb-api 38 | * https://github.com/jakartaee/jaxb-tck 39 | 40 | ## Cryptography 41 | 42 | Content may contain encryption software. The country in which you are currently 43 | may have restrictions on the import, possession, and use, and/or re-export to 44 | another country, of encryption software. BEFORE using any encryption software, 45 | please check the country's laws, regulations and policies concerning the import, 46 | possession, or use, and re-export of encryption software, to see if this is 47 | permitted. 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [//]: # " Copyright (c) 2018, 2022 Oracle and/or its affiliates. All rights reserved. " 2 | [//]: # " " 3 | [//]: # " This program and the accompanying materials are made available under the " 4 | [//]: # " terms of the Eclipse Distribution License v. 1.0, which is available at " 5 | [//]: # " http://www.eclipse.org/org/documents/edl-v10.php. " 6 | [//]: # " " 7 | [//]: # " SPDX-License-Identifier: BSD-3-Clause " 8 | 9 | # Jakarta XML Binding project 10 | 11 | [](https://github.com/jakartaee/jaxb-api/actions/workflows/maven.yml?branch=master) 12 | [](https://jakarta.oss.sonatype.org/content/repositories/staging/jakarta/xml/bind/jakarta.xml.bind-api/) 13 | 14 | The Jakarta XML Binding provides an API and tools that automate the mapping 15 | between XML documents and Java objects. 16 | 17 | ## License 18 | 19 | * Most of the Jakarta XML Binding project source code is licensed 20 | under the [Eclipse Distribution License (EDL) v1.0.](https://www.eclipse.org/org/documents/edl-v10.php); 21 | see the license information at the top of each source file. 22 | * The source code for the Jakarta XML Binding Specification project 23 | is licensed under the [Eclipse Public License (EPL) v2.0](https://www.eclipse.org/legal/epl-2.0/) 24 | and [GNU General Public License (GPL) v2 with Classpath Exception](https://www.gnu.org/software/classpath/license.html); 25 | again, the license is in each source file. 26 | * The binary jar files published to the Maven repository are licensed 27 | under the same licenses as the corresponding source code; 28 | see the file `META-INF/LICENSE.txt` in each jar file. 29 | 30 | You’ll find the text of the licenses in the workspace in various `LICENSE.txt` or `LICENSE.md` files. 31 | Don’t let the presence of these license files in the workspace confuse you into thinking 32 | that they apply to all files in the workspace. 33 | 34 | You should always read the license file included with every download, and read 35 | the license text included in every source file. 36 | 37 | ## Contributing 38 | 39 | We use [contribution policy](CONTRIBUTING.md), which means we can only accept contributions under 40 | the terms of [Eclipse Contributor Agreement](http://www.eclipse.org/legal/ECA.php). 41 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | [//]: # " Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved. " 2 | [//]: # " " 3 | [//]: # " This program and the accompanying materials are made available under the " 4 | [//]: # " terms of the Eclipse Distribution License v. 1.0, which is available at " 5 | [//]: # " http://www.eclipse.org/org/documents/edl-v10.php. " 6 | [//]: # " " 7 | [//]: # " SPDX-License-Identifier: BSD-3-Clause " 8 | 9 | # Security Policy 10 | 11 | This project implements the Eclipse Foundation Security Policy 12 | 13 | * https://www.eclipse.org/security 14 | 15 | ## Supported Versions 16 | 17 | These versions of Jakarta XML Binding are currently being supported with 18 | security updates. 19 | 20 | | Version | Released | Supported | 21 | | ------- | ---------- | --------- | 22 | | 4.0 | 2022-03-30 | Yes | 23 | | 3.0.1 | 2021-03-26 | Yes | 24 | | < 3.0 | 2020-11-04 | No | 25 | 26 | ## Reporting a Vulnerability 27 | 28 | Please report vulnerabilities to the Eclipse Foundation Security Team at 29 | security@eclipse.org 30 | -------------------------------------------------------------------------------- /api/src/main/java/jakarta/xml/bind/DataBindingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006, 2021 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Distribution License v. 1.0, which is available at 6 | * http://www.eclipse.org/org/documents/edl-v10.php. 7 | * 8 | * SPDX-License-Identifier: BSD-3-Clause 9 | */ 10 | 11 | package jakarta.xml.bind; 12 | 13 | /** 14 | * Exception that represents a failure in a Jakarta XML Binding operation. 15 | * 16 | *
17 | * This exception differs from {@link JAXBException} in that 18 | * this is an unchecked exception, while {@code JAXBException} 19 | * is a checked exception. 20 | * 21 | * @see JAXB 22 | * @since 1.6, JAXB 2.1 23 | */ 24 | public class DataBindingException extends RuntimeException { 25 | 26 | private static final long serialVersionUID = 4743686626270704879L; 27 | 28 | public DataBindingException(String message, Throwable cause) { 29 | super(message, cause); 30 | } 31 | 32 | public DataBindingException(Throwable cause) { 33 | super(cause); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /api/src/main/java/jakarta/xml/bind/Element.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003, 2024 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Distribution License v. 1.0, which is available at 6 | * http://www.eclipse.org/org/documents/edl-v10.php. 7 | * 8 | * SPDX-License-Identifier: BSD-3-Clause 9 | */ 10 | 11 | package jakarta.xml.bind; 12 | 13 | /** 14 | * This is an element marker interface. 15 | *
16 | * Under certain circumstances, it is necessary for the binding compiler to 17 | * generate derived java content classes that implement this interface. In 18 | * those cases, client applications must supply element instances rather than 19 | * types of elements. For more detail, see section 5.7 "Element Declaration" 20 | * and 5.7.1 "Bind to Java Element Interface" of the specification. 21 | * 22 | * @author
19 | * Initially, the intent of this class is to just conceptualize how 20 | * a Jakarta XML Binding application developer can access xml binding information, 21 | * independent if binding model is java to schema or schema to java. 22 | * Since accessing the XML element name related to a Jakarta XML Binding element is 23 | * a highly requested feature, demonstrate access to this 24 | * binding information. 25 | *
26 | * The factory method to get a JAXBIntrospector
instance is
27 | * {@link JAXBContext#createJAXBIntrospector()}.
28 | *
29 | * @see JAXBContext#createJAXBIntrospector()
30 | * @since 1.6, JAXB 2.0
31 | */
32 | public abstract class JAXBIntrospector {
33 |
34 | /**
35 | * Do-nothing constructor for the derived classes.
36 | */
37 | protected JAXBIntrospector() {}
38 |
39 | /**
40 | *
Return true if object
represents a Jakarta XML Binding element.
Parameter object
is a Jakarta XML Binding element for following cases:
42 | *
jakarta.xml.bind.JAXBElement
.object
is annotated with
45 | * @XmlRootElement
.
46 | * Get xml element qname for jaxbElement
.
jaxbElement
is not a JAXBElement.
60 | */
61 | public abstract QName getElementName(Object jaxbElement);
62 |
63 | /**
64 | * Get the element value of a Jakarta XML Binding element.
65 | * 66 | *Convenience method to abstract whether working with either 67 | * a jakarta.xml.bind.JAXBElement instance or an instance of 68 | * {@code @XmlRootElement} annotated Java class.
69 | * 70 | * @param jaxbElement object that #isElement(Object) returns true. 71 | * 72 | * @return The element value of thejaxbElement
.
73 | */
74 | public static Object getValue(Object jaxbElement) {
75 | if (jaxbElement instanceof JAXBElement) {
76 | return ((JAXBElement>)jaxbElement).getValue();
77 | } else {
78 | // assume that class of this instance is
79 | // annotated with @XmlRootElement.
80 | return jaxbElement;
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/JAXBPermission.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007, 2021 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind;
12 |
13 | import java.security.BasicPermission;
14 |
15 | /**
16 | * This class is for Jakarta XML Binding permissions. A {@code JAXBPermission}
17 | * contains a name (also referred to as a "target name") but
18 | * no actions list; you either have the named permission
19 | * or you don't.
20 | *
21 | * 22 | * The target name is the name of the Jakarta XML Binding permission (see below). 23 | * 24 | *
25 | * The following table lists all the possible {@code JAXBPermission} target names, 26 | * and for each provides a description of what the permission allows 27 | * and a discussion of the risks of granting code the permission. 28 | * 29 | *
Permission Target Name | 34 | *What the Permission Allows | 35 | *Risks of Allowing this Permission | 36 | *
---|---|---|
setDatatypeConverter | 42 | *43 | * Allows the code to set VM-wide {@link DatatypeConverterInterface} 44 | * via {@link DatatypeConverter#setDatatypeConverter(DatatypeConverterInterface) the setDatatypeConverter method} 45 | * that all the methods on {@link DatatypeConverter} uses. 46 | * | 47 | *48 | * Malicious code can set {@link DatatypeConverterInterface}, which has 49 | * VM-wide singleton semantics, before a genuine Jakarta XML Binding implementation sets one. 50 | * This allows malicious code to gain access to objects that it may otherwise 51 | * not have access to, such as {@code java.awt.Frame#getFrames()} that belongs to 52 | * another application running in the same JVM. 53 | * | 54 | *
18 | * The {@code ValidationEventHandler} can cause this exception to be thrown 19 | * during the marshal operations. See 20 | * {@link ValidationEventHandler#handleEvent(ValidationEvent) 21 | * ValidationEventHandler.handleEvent(ValidationEvent)}. 22 | * 23 | * @author
21 | * An implementation of this abstract class has to be provided by the calling 22 | * application to generate schemas. 23 | * 24 | *
25 | * This is a class, not an interface to allow future versions to evolve 26 | * without breaking the compatibility. 27 | * 28 | * @author 29 | * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) 30 | * @since 1.6 31 | */ 32 | public abstract class SchemaOutputResolver { 33 | 34 | /** 35 | * Do-nothing constructor for the derived classes. 36 | */ 37 | protected SchemaOutputResolver() {} 38 | 39 | /** 40 | * Decides where the schema file (of the given namespace URI) 41 | * will be written, and return it as a {@link Result} object. 42 | * 43 | *
44 | * This method is called only once for any given namespace. 45 | * IOW, all the components in one namespace is always written 46 | * into the same schema document. 47 | * 48 | * @param namespaceUri 49 | * The namespace URI that the schema declares. 50 | * Can be the empty string, but never be null. 51 | * @param suggestedFileName 52 | * A Jakarta XML Binding implementation generates a unique file name (like "schema1.xsd") 53 | * for the convenience of the callee. This name can be 54 | * used for the file name of the schema, or the callee can just 55 | * ignore this name and come up with its own name. 56 | * This is just a hint. 57 | * 58 | * @return 59 | * a {@link Result} object that encapsulates the actual destination 60 | * of the schema. 61 | *
62 | * If the {@link Result} object has a system ID, it must be an
63 | * absolute system ID. Those system IDs are relativized by the caller and used
64 | * for {@literal
66 | * If the {@link Result} object does not have a system ID, a schema
67 | * for the namespace URI is generated but it won't be explicitly
68 | * {@literal
70 | * If {@code null} is returned, the schema generation for this
71 | * namespace URI will be skipped.
72 | */
73 | public abstract Result createOutput( String namespaceUri, String suggestedFileName ) throws IOException;
74 | }
75 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/UnmarshalException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2021 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind;
12 |
13 | /**
14 | * This exception indicates that an error has occurred while performing
15 | * an unmarshal operation that prevents the Jakarta XML Binding Provider from completing
16 | * the operation.
17 | *
18 | *
19 | * The {@code ValidationEventHandler} can cause this exception to be thrown
20 | * during the unmarshal operations. See
21 | * {@link ValidationEventHandler#handleEvent(ValidationEvent)
22 | * ValidationEventHandler.handleEvent(ValidationEvent)}.
23 | *
24 | * @author
19 | * Applications can use this interface to use their Jakarta XML Binding provider as a component
20 | * in an XML pipeline. For example:
21 | *
22 | * {@snippet :
23 | * JAXBContext context = JAXBContext.newInstance( "org.acme.foo" );
24 | *
25 | * Unmarshaller unmarshaller = context.createUnmarshaller();
26 | *
27 | * UnmarshallerHandler unmarshallerHandler = unmarshaller.getUnmarshallerHandler();
28 | *
29 | * SAXParserFactory spf = SAXParserFactory.newInstance();
30 | * spf.setNamespaceAware( true );
31 | *
32 | * XMLReader xmlReader = spf.newSAXParser().getXMLReader();
33 | * xmlReader.setContentHandler( unmarshallerHandler );
34 | * xmlReader.parse(new InputSource( new FileInputStream( XML_FILE ) ) );
35 | *
36 | * MyObject myObject= (MyObject)unmarshallerHandler.getResult();
37 | * }
38 | *
39 | *
40 | * This interface is reusable: even if the user fails to unmarshal
41 | * an object, s/he can still start a new round of unmarshalling.
42 | *
43 | * @author
52 | * This method can be called only after this handler
53 | * receives the endDocument SAX event.
54 | *
55 | * @exception IllegalStateException
56 | * if this method is called before this handler
57 | * receives the endDocument event.
58 | *
59 | * @exception JAXBException
60 | * if there is any unmarshalling error.
61 | * Note that the implementation is allowed to throw SAXException
62 | * during the parsing when it finds an error.
63 | *
64 | * @return
65 | * always return a non-null valid object which was unmarshalled.
66 | */
67 | Object getResult() throws JAXBException, IllegalStateException;
68 | }
69 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/ValidationEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2021 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind;
12 |
13 | /**
14 | * This event indicates that a problem was encountered while validating the
15 | * incoming XML data during an unmarshal operation, while performing
16 | * on-demand validation of the Java content tree, or while marshalling the
17 | * Java content tree back to XML data.
18 | *
19 | * @author
47 | * Must be one of {@code ValidationEvent.WARNING},
48 | * {@code ValidationEvent.ERROR}, or {@code ValidationEvent.FATAL_ERROR}.
49 | *
50 | * @return the severity code for this warning/error
51 | */
52 | int getSeverity();
53 |
54 | /**
55 | * Retrieve the text message for this warning/error.
56 | *
57 | * @return the text message for this warning/error or null if one wasn't set
58 | */
59 | String getMessage();
60 |
61 | /**
62 | * Retrieve the linked exception for this warning/error.
63 | *
64 | * @return the linked exception for this warning/error or null if one
65 | * wasn't set
66 | */
67 | Throwable getLinkedException();
68 |
69 | /**
70 | * Retrieve the locator for this warning/error.
71 | *
72 | * @return the locator that indicates where the warning/error occurred
73 | */
74 | ValidationEventLocator getLocator();
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/ValidationEventHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind;
12 |
13 | /**
14 | * A basic event handler interface for validation errors.
15 | *
16 | *
17 | * If an application needs to implement customized event handling, it must
18 | * implement this interface and then register it with either the
19 | * {@link Unmarshaller#setEventHandler(ValidationEventHandler) Unmarshaller}, or
20 | * the {@link Marshaller#setEventHandler(ValidationEventHandler) Marshaller}.
21 | * The Jakarta XML Binding Provider will then report validation errors and warnings encountered
22 | * during the unmarshal, marshal, and validate operations to these event
23 | * handlers.
24 | *
25 | *
26 | * If the {@code handleEvent} method throws an unchecked runtime exception,
27 | * the Jakarta XML Binding Provider must treat that as if the method returned false, effectively
28 | * terminating whatever operation was in progress at the time (unmarshal,
29 | * validate, or marshal).
30 | *
31 | *
32 | * Modifying the Java content tree within your event handler is undefined
33 | * by the specification and may result in unexpected behaviour.
34 | *
35 | *
36 | * Failing to return false from the {@code handleEvent} method after
37 | * encountering a fatal error is undefined by the specification and may result
38 | * in unexpected behavior.
39 | *
40 | *
41 | * Default Event Handler
42 | *
65 | * The ValidationEvent will have a
66 | * {@link ValidationEventLocator ValidationEventLocator} embedded in it that
67 | * indicates where the error or warning occurred.
68 | *
69 | *
70 | * If an unchecked runtime exception is thrown from this method, the Jakarta XML Binding
71 | * provider will treat it as if the method returned false and interrupt
72 | * the current unmarshal, validate, or marshal operation.
73 | *
74 | * @param event the encapsulated validation event information. It is a
75 | * provider error if this parameter is null.
76 | * @return true if the Jakarta XML Binding Provider should attempt to continue the current
77 | * unmarshal, validate, or marshal operation after handling this
78 | * warning/error, false if the provider should terminate the current
79 | * operation with the appropriate {@code UnmarshalException},
80 | * {@code ValidationException}, or {@code MarshalException}.
81 | * @throws IllegalArgumentException if the event object is null.
82 | */
83 | boolean handleEvent(ValidationEvent event);
84 |
85 | }
86 |
87 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/ValidationEventLocator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind;
12 |
13 | /**
14 | * Encapsulate the location of a ValidationEvent.
15 | *
16 | *
17 | * The {@code ValidationEventLocator} indicates where the {@code ValidationEvent}
18 | * occurred. Different fields will be set depending on the type of
19 | * validation that was being performed when the error or warning was detected.
20 | * For example, on-demand validation would produce locators that contained
21 | * references to objects in the Java content tree while unmarshal-time
22 | * validation would produce locators containing information appropriate to the
23 | * source of the XML data (file, url, Node, etc.).
24 | *
25 | * @author
18 | * The {@code ValidationEventHandler} can cause this exception to be thrown
19 | * during the validate operations. See
20 | * {@link ValidationEventHandler#handleEvent(ValidationEvent)
21 | * ValidationEventHandler.handleEvent(ValidationEvent)}.
22 | *
23 | * @author
22 | * Implementations of this interface will be used in conjunction with
23 | * {@link XmlAnyElement} annotation to map an element of XML into a representation
24 | * of infoset such as W3C DOM.
25 | *
26 | *
27 | * Implementations hide how a portion of XML is converted into/from such
28 | * DOM-like representation, allowing Jakarta XML Binding providers to work with arbitrary
29 | * such library.
30 | *
31 | *
32 | * This interface is intended to be implemented by library writers
33 | * and consumed by Jakarta XML Binding providers. None of those methods are intended to
34 | * be called from applications.
35 | *
36 | * @author Kohsuke Kawaguchi
37 | * @since 1.6, JAXB 2.0
38 | */
39 | public interface DomHandler
46 | * A Jakarta XML Binding provider will then send a portion of the XML
47 | * into the given result. Such a portion always form a subtree
48 | * of the whole XML document rooted at an element.
49 | *
50 | * @param errorHandler
51 | * if any error happens between the invocation of this method
52 | * and the invocation of {@link #getElement(Result)}, they
53 | * must be reported to this handler.
54 | *
55 | * The caller must provide a non-null error handler.
56 | *
57 | * The {@link Result} object created from this method
58 | * may hold a reference to this error handler.
59 | *
60 | * @return
61 | * null if the operation fails. The error must have been reported
62 | * to the error handler.
63 | */
64 | ResultT createUnmarshaller( ValidationEventHandler errorHandler );
65 |
66 | /**
67 | * Once the portion is sent to the {@link Result}. This method is called
68 | * by a Jakarta XML Binding provider to obtain the unmarshalled element representation.
69 | *
70 | *
71 | * Multiple invocations of this method may return different objects.
72 | * This method can be invoked only when the whole subtree are fed
73 | * to the {@link Result} object.
74 | *
75 | * @param rt
76 | * The {@link Result} object created by {@link #createUnmarshaller(ValidationEventHandler)}.
77 | *
78 | * @return
79 | * null if the operation fails. The error must have been reported
80 | * to the error handler.
81 | */
82 | ElementT getElement(ResultT rt);
83 |
84 | /**
85 | * This method is called when a Jakarta XML Binding provider needs to marshal an element
86 | * to XML.
87 | *
88 | *
89 | * If non-null, the returned {@link Source} must contain a whole document
90 | * rooted at one element, which will then be woven into a bigger document
91 | * that the Jakarta XML Binding provider is marshalling.
92 | *
93 | * @param errorHandler
94 | * Receives any errors happened during the process of converting
95 | * an element into a {@link Source}.
96 | *
97 | * The caller must provide a non-null error handler.
98 | *
99 | * @return
100 | * null if there was an error. The error should have been reported
101 | * to the handler.
102 | */
103 | Source marshal( ElementT n, ValidationEventHandler errorHandler );
104 | }
105 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/W3CDomHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | import org.w3c.dom.Document;
14 | import org.w3c.dom.DocumentFragment;
15 | import org.w3c.dom.Element;
16 | import org.w3c.dom.Node;
17 |
18 | import jakarta.xml.bind.ValidationEventHandler;
19 | import javax.xml.parsers.DocumentBuilder;
20 | import javax.xml.transform.Source;
21 | import javax.xml.transform.dom.DOMResult;
22 | import javax.xml.transform.dom.DOMSource;
23 |
24 | /**
25 | * {@link DomHandler} implementation for W3C DOM (
37 | * It is up to a Jakarta XML Binding provider to decide which DOM implementation
38 | * to use or how that is configured.
39 | */
40 | public W3CDomHandler() {
41 | this.builder = null;
42 | }
43 |
44 | /**
45 | * Constructor that allows applications to specify which DOM implementation
46 | * to be used.
47 | *
48 | * @param builder
49 | * must not be null. Jakarta XML Binding uses this {@link DocumentBuilder} to create
50 | * a new element.
51 | */
52 | public W3CDomHandler(DocumentBuilder builder) {
53 | if(builder==null)
54 | throw new IllegalArgumentException();
55 | this.builder = builder;
56 | }
57 |
58 | public DocumentBuilder getBuilder() {
59 | return builder;
60 | }
61 |
62 | public void setBuilder(DocumentBuilder builder) {
63 | this.builder = builder;
64 | }
65 |
66 | @Override
67 | public DOMResult createUnmarshaller(ValidationEventHandler errorHandler) {
68 | if(builder==null)
69 | return new DOMResult();
70 | else
71 | return new DOMResult(builder.newDocument());
72 | }
73 |
74 | @Override
75 | public Element getElement(DOMResult r) {
76 | // JAXP spec is ambiguous about what really happens in this case,
77 | // so work defensively
78 | Node n = r.getNode();
79 | if( n instanceof Document ) {
80 | return ((Document)n).getDocumentElement();
81 | }
82 | if( n instanceof Element )
83 | return (Element)n;
84 | if( n instanceof DocumentFragment )
85 | return (Element)n.getChildNodes().item(0);
86 |
87 | // if the result object contains something strange,
88 | // it is not a user problem, but it is a Jakarta XML Binding provider's problem.
89 | // That's why we throw a runtime exception.
90 | throw new IllegalStateException(n.toString());
91 | }
92 |
93 | @Override
94 | public Source marshal(Element element, ValidationEventHandler errorHandler) {
95 | return new DOMSource(element);
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlAccessOrder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2021 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | /**
14 | * Used by XmlAccessorOrder to control the ordering of properties and
15 | * fields in a Jakarta XML Binding bound class.
16 | *
17 | * @author Sekhar Vajjhala, Sun Microsystems, Inc.
18 | * @since 1.6, JAXB 2.0
19 | * @see XmlAccessorOrder
20 | */
21 |
22 | public enum XmlAccessOrder {
23 | /**
24 | * The ordering of fields and properties in a class is undefined.
25 | */
26 | UNDEFINED,
27 | /**
28 | * The ordering of fields and properties in a class is in
29 | * alphabetical order as determined by the
30 | * method java.lang.String.compareTo(String anotherString).
31 | */
32 | ALPHABETICAL
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlAccessType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 |
14 |
15 | /**
16 | * Used by XmlAccessorType to control serialization of fields or
17 | * properties.
18 | *
19 | * @author Sekhar Vajjhala, Sun Microsystems, Inc.
20 | * @since 1.6, JAXB 2.0
21 | * @see XmlAccessorType
22 | */
23 |
24 | public enum XmlAccessType {
25 | /**
26 | * Every getter/setter pair in a Jakarta XML Binding-bound class will be automatically
27 | * bound to XML, unless annotated by {@link XmlTransient}.
28 | *
29 | * Fields are bound to XML only when they are explicitly annotated
30 | * by some of the Jakarta XML Binding annotations.
31 | */
32 | PROPERTY,
33 | /**
34 | * Every non-static, non-transient field in a Jakarta XML Binding-bound class will be automatically
35 | * bound to XML, unless annotated by {@link XmlTransient}.
36 | *
37 | * Getter/setter pairs are bound to XML only when they are explicitly annotated
38 | * by some of the Jakarta XML Binding annotations.
39 | */
40 | FIELD,
41 | /**
42 | * Every public getter/setter pair and every public field will be
43 | * automatically bound to XML, unless annotated by {@link XmlTransient}.
44 | *
45 | * Fields or getter/setter pairs that are private, protected, or
46 | * defaulted to package-only access are bound to XML only when they are
47 | * explicitly annotated by the appropriate Jakarta XML Binding annotations.
48 | */
49 | PUBLIC_MEMBER,
50 | /**
51 | * None of the fields or properties is bound to XML unless they
52 | * are specifically annotated with some of the Jakarta XML Binding annotations.
53 | */
54 | NONE
55 | }
56 |
57 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlAccessorOrder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
14 | import java.lang.annotation.Target;
15 | import java.lang.annotation.Retention;
16 | import java.lang.annotation.Inherited;
17 |
18 | import static java.lang.annotation.ElementType.*;
19 | import static java.lang.annotation.RetentionPolicy.*;
20 |
21 | /**
22 | * Controls the ordering of fields and properties in a class. {@code @XmlAccessorOrder} annotation can be used with the following
27 | * program elements: See "Package Specification" in {@code jakarta.xml.bind} package javadoc for
35 | * additional common information. The effective {@link XmlAccessOrder} on a class is determined
38 | * as follows:
39 | *
40 | * This annotation can be used with the following annotations:
52 | * {@link XmlType}, {@link XmlRootElement}, {@link XmlAccessorType},
53 | * {@link XmlSchema}, {@link XmlSchemaType}, {@link XmlSchemaTypes},
54 | * {@link XmlJavaTypeAdapter}. It can also be used with the
55 | * following annotations at the package level: {@link XmlJavaTypeAdapter}.
56 | *
57 | * @author Sekhar Vajjhala, Sun Microsystems, Inc.
58 | * @since 1.6, JAXB 2.0
59 | * @see XmlAccessOrder
60 | */
61 |
62 | @Inherited @Retention(RUNTIME) @Target({PACKAGE, TYPE})
63 | public @interface XmlAccessorOrder {
64 | XmlAccessOrder value() default XmlAccessOrder.UNDEFINED;
65 | }
66 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlAccessorType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
14 | import java.lang.annotation.Target;
15 | import java.lang.annotation.Retention;
16 | import java.lang.annotation.Inherited;
17 |
18 | import static java.lang.annotation.ElementType.*;
19 | import static java.lang.annotation.RetentionPolicy.*;
20 |
21 | /**
22 | * Controls whether fields or Javabean properties are serialized by default. Usage {@code @XmlAccessorType} annotation can be used with the following program elements: See "Package Specification" in jakarta.xml.bind.package javadoc for
34 | * additional common information. This annotation provides control over the default serialization
37 | * of properties and fields in a class.
38 | *
39 | * The annotation {@code @XmlAccessorType} on a package applies to
40 | * all classes in the package. The following inheritance
41 | * semantics apply:
42 | *
43 | * Defaulting Rules: By default, if {@code @XmlAccessorType} on a package is absent,
54 | * then the following package level annotation is assumed. By default, if {@code @XmlAccessorType} on a class is absent,
59 | * and none of its super classes is annotated with
60 | * {@code @XmlAccessorType}, then the following default on the class
61 | * is assumed: This annotation can be used with the following annotations:
66 | * {@link XmlType}, {@link XmlRootElement}, {@link XmlAccessorOrder},
67 | * {@link XmlSchema}, {@link XmlSchemaType}, {@link XmlSchemaTypes},
68 | * , {@link XmlJavaTypeAdapter}. It can also be used with the
69 | * following annotations at the package level: {@link XmlJavaTypeAdapter}.
70 | *
71 | * @author Sekhar Vajjhala, Sun Microsystems, Inc.
72 | * @since 1.6, JAXB 2.0
73 | * @see XmlAccessType
74 | */
75 | @Inherited @Retention(RUNTIME) @Target({PACKAGE, TYPE})
76 | public @interface XmlAccessorType {
77 |
78 | /**
79 | * Specifies whether fields or properties are serialized.
80 | *
81 | * @see XmlAccessType
82 | */
83 | XmlAccessType value() default XmlAccessType.PUBLIC_MEMBER;
84 | }
85 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlAnyAttribute.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | import javax.xml.namespace.QName;
14 | import java.lang.annotation.Retention;
15 | import java.lang.annotation.Target;
16 | import java.util.Map;
17 |
18 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
19 | import static java.lang.annotation.ElementType.FIELD;
20 | import static java.lang.annotation.ElementType.METHOD;
21 |
22 | /**
23 | *
24 | * Maps a JavaBean property to a map of wildcard attributes.
25 | *
26 | * Usage
28 | * The {@code @XmlAnyAttribute} annotation can be used with the
29 | * following program elements:
30 | * See "Package Specification" in jakarta.xml.bind.package javadoc for
36 | * additional common information.
46 | * While processing attributes to be unmarshalled into a value class,
47 | * each attribute that is not statically associated with another
48 | * JavaBean property, via {@link XmlAttribute}, is entered into the
49 | * wildcard attribute map represented by
50 | * {@link Map}<{@link QName},{@link Object}>. The attribute QName is the
51 | * map's key. The key's value is the String value of the attribute.
52 | *
53 | * @author Kohsuke Kawaguchi, Sun Microsystems, Inc.
54 | * @since 1.6, JAXB 2.0
55 | */
56 | @Retention(RUNTIME)
57 | @Target({FIELD,METHOD})
58 | public @interface XmlAnyAttribute {
59 | }
60 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlAttachmentRef.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | import static java.lang.annotation.ElementType.FIELD;
14 | import static java.lang.annotation.ElementType.METHOD;
15 | import static java.lang.annotation.ElementType.PARAMETER;
16 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
17 |
18 | import java.lang.annotation.Retention;
19 | import java.lang.annotation.Target;
20 |
21 | import jakarta.activation.DataHandler;
22 |
23 | /**
24 | * Marks a field/property that its XML form is a URI reference to mime content.
25 | * The mime content is optimally stored out-of-line as an attachment.
26 | *
27 | * A field/property must always map to the {@link DataHandler} class.
28 | *
29 | *
55 | * The above binding supports WS-I AP 1.0 WS-I Attachments Profile Version 1.0.
56 | *
57 | * @author Kohsuke Kawaguchi
58 | * @since 1.6, JAXB 2.0
59 | */
60 | @Retention(RUNTIME)
61 | @Target({FIELD,METHOD,PARAMETER})
62 | public @interface XmlAttachmentRef {
63 | }
64 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlElementRefs.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
14 | import java.lang.annotation.Retention;
15 | import java.lang.annotation.Target;
16 | import static java.lang.annotation.ElementType.FIELD;
17 | import static java.lang.annotation.ElementType.METHOD;
18 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
19 |
20 | /**
21 | * Marks a property that refers to classes with {@link XmlElement}
22 | * or JAXBElement.
23 | *
24 | *
25 | * Compared to an element property (property with {@link XmlElement}
26 | * annotation), a reference property has a different substitution semantics.
27 | * When a subclass is assigned to a property, an element property produces
28 | * the same tag name with @xsi:type, whereas a reference property produces
29 | * a different tag name (the tag name that's on the subclass.)
30 | *
31 | * This annotation can be used with the following annotations:
32 | * {@link XmlJavaTypeAdapter}, {@link XmlElementWrapper}.
33 | *
34 | * @author
20 | * Maps an enum type {@link Enum} to XML representation.
21 | *
22 | * This annotation, together with {@link XmlEnumValue} provides a
23 | * mapping of enum type to XML representation.
24 | *
25 | * Usage
27 | * The {@code @XmlEnum} annotation can be used with the
28 | * following program elements:
29 | * The usage is subject to the following constraints:
34 | * See "Package Specification" in jakarta.xml.bind.package javadoc for
40 | * additional common information An enum type is mapped to a schema simple type with enumeration
43 | * facets. The schema type is derived from the Java type to which
44 | * {@code @XmlEnum.value()}. Each enum constant {@code @XmlEnumValue}
45 | * must have a valid lexical representation for the type
46 | * {@code @XmlEnum.value()}.
47 | *
48 | * Examples: See examples in {@link XmlEnumValue}
49 | *
50 | * @since 1.6, JAXB 2.0
51 | */
52 | @Retention(RUNTIME) @Target({TYPE})
53 | public @interface XmlEnum {
54 | /**
55 | * Java type that is mapped to an XML simple type.
56 | *
57 | */
58 | Class> value() default String.class;
59 | }
60 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlEnumValue.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | import java.lang.annotation.Retention;
14 | import java.lang.annotation.Target;
15 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
16 | import static java.lang.annotation.ElementType.FIELD;
17 |
18 | /**
19 | * Maps an enum constant in {@link Enum} type to XML representation.
20 | *
21 | * Usage The {@code @XmlEnumValue} annotation can be used with the
24 | * following program elements:
25 | * See "Package Specification" in jakarta.xml.bind.package javadoc for
30 | * additional common information. This annotation, together with {@link XmlEnum} provides a
33 | * mapping of enum type to XML representation.
34 | *
35 | * An enum type is mapped to a schema simple type with enumeration
36 | * facets. The schema type is derived from the Java type specified in
37 | * {@code @XmlEnum.value()}. Each enum constant {@code @XmlEnumValue}
38 | * must have a valid lexical representation for the type
39 | * {@code @XmlEnum.value()}
40 | *
41 | * In the absence of this annotation, {@link Enum#name()} is used
42 | * as the XML representation.
43 | *
44 | * Example 1: Map enum constant name {@literal ->} enumeration facet Example 2: Map enum constant name(value) {@literal ->} enumeration facet Example 3: Map enum constant name {@literal ->} enumeration facet
20 | * Maps a JavaBean property to XML ID.
21 | *
22 | *
23 | * To preserve referential integrity of an object graph across XML
24 | * serialization followed by an XML deserialization, requires an object
25 | * reference to be marshalled by reference or containment
26 | * appropriately. Annotations {@code @XmlID} and {@code @XmlIDREF}
27 | * together allow a customized mapping of a JavaBean property's
28 | * type by containment or reference.
29 | *
30 | * Usage See "Package Specification" in jakarta.xml.bind.package javadoc for
39 | * additional common information. Example: Map a JavaBean property's type to {@code xs:ID}
29 | * When XOP encoding is enabled as described in {@link AttachmentMarshaller#isXOPPackage()},
30 | * this annotation disables datatypes such as {@code java.awt.Image} or {@link Source}
31 | * or {@code byte[]} that are bound to base64-encoded binary from being considered for
32 | * XOP encoding. If a Jakarta XML Binding property is annotated with this annotation or if
33 | * the Jakarta XML Binding property's base type is annotated with this annotation,
34 | * neither
35 | * {@link AttachmentMarshaller#addMtomAttachment(DataHandler, String, String)}
36 | * nor
37 | * {@link AttachmentMarshaller#addMtomAttachment(byte[], int, int, String, String, String)} is
38 | * ever called for the property. The binary data will always be inlined.
39 | *
40 | * @author Joseph Fialli
41 | * @since 1.6, JAXB 2.0
42 | */
43 | @Retention(RUNTIME)
44 | @Target({FIELD,METHOD,TYPE})
45 | public @interface XmlInlineBinaryData {
46 | }
47 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlList.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | import java.lang.annotation.Retention;
14 | import java.lang.annotation.Target;
15 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
16 | import static java.lang.annotation.ElementType.FIELD;
17 | import static java.lang.annotation.ElementType.METHOD;
18 | import static java.lang.annotation.ElementType.PARAMETER;
19 |
20 | /**
21 | * Used to map a property to a list simple type.
22 | *
23 | * Usage
25 | * The {@code @XmlList} annotation can be used with the
26 | * following program elements:
27 | *
33 | * When a collection property is annotated just with @XmlElement,
34 | * each item in the collection will be wrapped by an element.
35 | * For example,
36 | *
37 | * {@snippet :
38 | * @XmlRootElement
39 | * class Foo {
40 | * @XmlElement
41 | * List This annotation can be used with the following annotations:
75 | * {@link XmlElement},
76 | * {@link XmlAttribute},
77 | * {@link XmlValue},
78 | * {@link XmlIDREF}.
79 | *
26 | * This annotation is used in conjunction with datatypes such as
27 | * {@code java.awt.Image} or {@link Source} that are bound to base64-encoded binary in XML.
28 | *
29 | *
30 | * If a property that has this annotation has a sibling property bound to
31 | * the xmime:contentType attribute, and if in the instance the property has a value,
32 | * the value of the attribute takes precedence and that will control the marshalling.
33 | *
34 | * @author Kohsuke Kawaguchi
35 | * @since 1.6, JAXB 2.0
36 | */
37 | @Retention(RUNTIME)
38 | @Target({FIELD,METHOD,PARAMETER})
39 | public @interface XmlMimeType {
40 | /**
41 | * The textual representation of the MIME type,
42 | * such as "image/jpeg" "image/*", "text/xml; charset=iso-8859-1" and so on.
43 | */
44 | String value();
45 | }
46 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlNs.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | import java.lang.annotation.Retention;
14 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
15 | import java.lang.annotation.Target;
16 |
17 | /**
18 | *
19 | * Associates a namespace prefix with an XML namespace URI.
20 | *
21 | * Usage {@code @XmlNs} annotation is intended for use from other
23 | * program annotations.
24 | *
25 | * See "Package Specification" in jakarta.xml.bind.package javadoc for
26 | * additional common information. Example:See {@code XmlSchema} annotation type for an example.
29 | * @author Sekhar Vajjhala, Sun Microsystems, Inc.
30 | * @since 1.6, JAXB 2.0
31 | */
32 | @Retention(RUNTIME) @Target({})
33 | public @interface XmlNs {
34 | /**
35 | * Namespace prefix
36 | */
37 | String prefix();
38 |
39 | /**
40 | * Namespace URI
41 | */
42 | String namespaceURI();
43 | }
44 |
45 |
46 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlNsForm.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | /**
14 | * Enumeration of XML Schema namespace qualifications.
15 | *
16 | * See "Package Specification" in jakarta.xml.bind.package javadoc for
17 | * additional common information. Usage
20 | *
21 | * The namespace qualification values are used in the annotations
22 | * defined in this package. The enumeration values are mapped as follows:
23 | *
24 | * Usage
26 | * {@code @XmlSchemaType} annotation can be used with the following program
27 | * elements:
28 | * {@code @XmlSchemaType} annotation defined for Java type
35 | * applies to all references to the Java type from a property/field.
36 | * A {@code @XmlSchemaType} annotation specified on the
37 | * property/field overrides the {@code @XmlSchemaType} annotation
38 | * specified at the package level.
39 | *
40 | * This annotation can be used with the following annotations:
41 | * {@link XmlElement}, {@link XmlAttribute}.
42 | *
43 | * Example 1: Customize mapping of XMLGregorianCalendar on the
44 | * field.
45 | *
46 | * {@snippet :
47 | * //Example: Code fragment
48 | * public class USPrice {
49 | * @XmlElement
50 | * @XmlSchemaType(name="date")
51 | * public XMLGregorianCalendar date;
52 | * }
53 | * }
54 | * {@snippet lang="XML" :
55 | *
56 | * Example 2: Customize mapping of XMLGregorianCalendar at package
64 | * level
20 | * A container for multiple {@link XmlSchemaType} annotations.
21 | *
22 | * Multiple annotations of the same type are not allowed on a program
23 | * element. This annotation therefore serves as a container annotation
24 | * for multiple {@link XmlSchemaType} annotations as follows:
25 | *
26 | * {@snippet :
27 | * @XmlSchemaTypes({ @XmlSchemaType(...), @XmlSchemaType(...) })
28 | * }
29 | * The {@code @XmlSchemaTypes} annotation can be used to
30 | * define {@link XmlSchemaType} for different types at the
31 | * package level.
32 | *
33 | * See "Package Specification" in jakarta.xml.bind.package javadoc for
34 | * additional common information.
23 | * Java makes it impractical/impossible to list all subclasses of
24 | * a given class. This often gets in a way of Jakarta XML Binding users, as it Jakarta XML Binding
25 | * cannot automatically list up the classes that need to be known
26 | * to {@link JAXBContext}.
27 | *
28 | *
29 | * For example, with the following class definitions:
30 | *
31 | * {@snippet :
32 | * class Animal {}
33 | * class Dog extends Animal {}
34 | * class Cat extends Animal {}
35 | * }
36 | *
37 | *
38 | * The user would be required to create {@link JAXBContext} as
39 | * {@code JAXBContext.newInstance(Dog.class,Cat.class)}
40 | * ({@code Animal} will be automatically picked up since {@code Dog}
41 | * and {@code Cat} refers to it.)
42 | *
43 | *
44 | * {@link XmlSeeAlso} annotation would allow you to write:
45 | * {@snippet :
46 | * @XmlSeeAlso({Dog.class,Cat.class})
47 | * class Animal {}
48 | * class Dog extends Animal {}
49 | * class Cat extends Animal {}
50 | * }
51 | *
52 | *
53 | * This would allow you to do {@code JAXBContext.newInstance(Animal.class)}.
54 | * By the help of this annotation, Jakarta XML Binding implementations will be able to
55 | * correctly bind {@code Dog} and {@code Cat}.
56 | *
57 | * @author Kohsuke Kawaguchi
58 | * @since 1.6, JAXB 2.1
59 | */
60 | @Target({ElementType.TYPE})
61 | @Retention(RUNTIME)
62 | public @interface XmlSeeAlso {
63 | Class>[] value();
64 | }
65 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlTransient.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | import java.lang.annotation.Target;
14 | import java.lang.annotation.Retention;
15 | import static java.lang.annotation.ElementType.*;
16 | import static java.lang.annotation.RetentionPolicy.*;
17 |
18 | /**
19 | *
20 | * Prevents the mapping of a JavaBean property/type to XML representation.
21 | *
22 | * The {@code @XmlTransient} annotation is useful for resolving name
23 | * collisions between a JavaBean property name and a field name or
24 | * preventing the mapping of a field/property. A name collision can
25 | * occur when the decapitalized JavaBean property name and a field
26 | * name are the same. If the JavaBean property refers to the field,
27 | * then the name collision can be resolved by preventing the
28 | * mapping of either the field or the JavaBean property using the
29 | * {@code @XmlTransient} annotation.
30 | *
31 | *
32 | * When placed on a class, it indicates that the class shouldn't be mapped
33 | * to XML by itself. Properties on such class will be mapped to XML along
34 | * with its derived classes, as if the class is inlined.
35 | *
36 | * Usage The {@code @XmlTransient} annotation can be used with the following
38 | * program elements:
39 | * {@code @XmlTransient} is mutually exclusive with all other
46 | * Jakarta XML Binding defined annotations. See "Package Specification" in jakarta.xml.bind.package javadoc for
49 | * additional common information. Example: Resolve name collision between JavaBean property and
52 | * field name
20 | * Enables mapping a class to a XML Schema complex type with a
21 | * simpleContent or an XML Schema simple type.
22 | *
25 | * Usage:
26 | *
27 | * The {@code @XmlValue} annotation can be used with the following program
28 | * elements:
29 | * See "Package Specification" in jakarta.xml.bind.package javadoc for
35 | * additional common information.
56 | * If the annotated JavaBean property is the sole class member being
57 | * mapped to XML Schema construct, then the class is mapped to a
58 | * simple type.
59 | *
60 | * If there are additional JavaBean properties (other than the
61 | * JavaBean property annotated with {@code @XmlValue} annotation)
62 | * that are mapped to XML attributes, then the class is mapped to a
63 | * complex type with simpleContent.
64 | * Example 1: Map a class to XML Schema simpleType Example 2: Map a class to XML Schema complexType with
83 | * with simpleContent.
17 | * This adapter removes leading and trailing whitespaces, then truncate any
18 | * sequence of tab, CR, LF, and SP by a single whitespace character ' '.
19 | *
20 | * @author Kohsuke Kawaguchi
21 | * @since 1.6, JAXB 2.0
22 | */
23 | public class CollapsedStringAdapter extends XmlAdapter
90 | * Just return the same string given as the parameter.
91 | */
92 | @Override
93 | public String marshal(String s) {
94 | return s;
95 | }
96 |
97 |
98 | /** returns true if the specified char is a white space character. */
99 | protected static boolean isWhiteSpace(char ch) {
100 | // most of the characters are non-control characters.
101 | // so check that first to quickly return false for most of the cases.
102 | if( ch>0x20 ) return false;
103 |
104 | // other than we have to do four comparisons.
105 | return ch == 0x9 || ch == 0xA || ch == 0xD || ch == 0x20;
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/adapters/HexBinaryAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004, 2021 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation.adapters;
12 |
13 | import jakarta.xml.bind.DatatypeConverter;
14 |
15 | /**
16 | * {@link XmlAdapter} for {@code xs:hexBinary}.
17 | *
18 | *
19 | * This {@link XmlAdapter} binds {@code byte[]} to the hexBinary representation in XML.
20 | *
21 | * @author Kohsuke Kawaguchi
22 | * @since 1.6, JAXB 2.0
23 | */
24 | public final class HexBinaryAdapter extends XmlAdapter
17 | * Replaces any tab, CR, and LF by a whitespace character ' ',
18 | * as specified in the whitespace facet 'replace'
19 | *
20 | * @author Kohsuke Kawaguchi, Martin Grebac
21 | * @since 1.6, JAXB 2.0
22 | */
23 | public final class NormalizedStringAdapter extends XmlAdapter Usage: The {@code @XmlJavaTypeAdapter} annotation can be used with the
39 | * following program elements:
40 | * When {@code @XmlJavaTypeAdapter} annotation is defined on a
49 | * class, it applies to all references to the class.
50 | * When {@code @XmlJavaTypeAdapter} annotation is defined at the
51 | * package level it applies to all references from within the package
52 | * to {@code @XmlJavaTypeAdapter.type()}.
53 | * When {@code @XmlJavaTypeAdapter} annotation is defined on the
54 | * field, property or parameter, then the annotation applies to the
55 | * field, property or the parameter only.
56 | * A {@code @XmlJavaTypeAdapter} annotation on a field, property
57 | * or parameter overrides the {@code @XmlJavaTypeAdapter} annotation
58 | * associated with the class being referenced by the field, property
59 | * or parameter.
60 | * A {@code @XmlJavaTypeAdapter} annotation on a class overrides
61 | * the {@code @XmlJavaTypeAdapter} annotation specified at the
62 | * package level for that class.
63 | *
64 | * This annotation can be used with the following other annotations:
65 | * {@link XmlElement}, {@link XmlAttribute}, {@link XmlElementRef},
66 | * {@link XmlElementRefs}, {@link XmlAnyElement}. This can also be
67 | * used at the package level with the following annotations:
68 | * {@link XmlAccessorType}, {@link XmlSchema}, {@link XmlSchemaType},
69 | * {@link XmlSchemaTypes}.
70 | *
71 | * Example: See example in {@link XmlAdapter}
72 | *
73 | * @author
20 | * A container for multiple @{@link XmlJavaTypeAdapter} annotations.
21 | *
22 | * Multiple annotations of the same type are not allowed on a program
23 | * element. This annotation therefore serves as a container annotation
24 | * for multiple @XmlJavaTypeAdapter as follows:
25 | *
26 | * {@snippet :
27 | * @XmlJavaTypeAdapters ({ @XmlJavaTypeAdapter(...), @XmlJavaTypeAdapter(...) })
28 | * }
29 | *
30 | * The {@code @XmlJavaTypeAdapters} annotation is useful for
31 | * defining {@link XmlJavaTypeAdapter} annotations for different types
32 | * at the package level.
33 | *
34 | * See "Package Specification" in jakarta.xml.bind.package javadoc for
35 | * additional common information.
16 | * References in this document to JAXB refer to the Jakarta XML Binding unless otherwise noted.
17 | *
18 | *
16 | * Soap MTOM[1], XOP([2][3]) and WS-I AP[4] standardize approaches to
17 | * optimized transmission of binary datatypes as an attachment.
18 | * To optimally support these standards within a message passing
19 | * environment, this package enables an integrated solution between
20 | * a MIME-based package processor and Jakarta XML Binding unmarshall/marshal processes.
21 | *
22 | * References in this document to JAXB refer to the Jakarta XML Binding unless otherwise noted.
23 | *
24 | *
19 | * Jakarta XML Binding providers are allowed to use whatever class that implements
20 | * the ValidationEvent interface. This class is just provided for a
21 | * convenience.
22 | *
23 | * @author
20 | * Jakarta XML Binding providers are allowed to use whatever class that implements
21 | * the ValidationEvent interface. This class is just provided for a
22 | * convenience.
23 | *
24 | * @author
20 | * Jakarta XML Binding providers are allowed to use whatever class that implements
21 | * the ValidationEvent interface. This class is just provided for a
22 | * convenience.
23 | *
24 | * @author
16 | * Jakarta XML Binding Providers can extend these classes and implement the abstract
17 | * methods.
18 | *
19 | *
20 | * References in this document to JAXB refer to the Jakarta XML Binding unless otherwise noted.
21 | *
22 | *
30 | * For overviews, tutorials, examples, guides, and tool documentation,
31 | * please see:
32 | *
15 | *
18 | * References in this document to JAXB refer to the Jakarta XML Binding unless otherwise noted.
19 | *
20 | *
23 | * To use this class, create a new instance and pass it to the setEventHandler
24 | * method of the Unmarshaller, Marshaller class. After the call to
25 | * validate or unmarshal completes, call the getEvents method to retrieve all
26 | * the reported errors and warnings.
27 | *
28 | * @author
15 | * References in this document to JAXB refer to the Jakarta XML Binding unless otherwise noted.
16 | *
17 | *
25 | * For overviews, tutorials, examples, guides, and tool documentation,
26 | * please see:
27 | *
15 | * References in this document to JAXB refer to the Jakarta XML Binding unless otherwise noted.
16 | */
17 | module jakarta.xml.bind {
18 | requires transitive jakarta.activation;
19 | requires transitive java.xml;
20 | requires java.logging;
21 |
22 | exports jakarta.xml.bind;
23 | exports jakarta.xml.bind.annotation;
24 | exports jakarta.xml.bind.annotation.adapters;
25 | exports jakarta.xml.bind.attachment;
26 | exports jakarta.xml.bind.helpers;
27 | exports jakarta.xml.bind.util;
28 |
29 | uses jakarta.xml.bind.JAXBContextFactory;
30 | }
31 |
--------------------------------------------------------------------------------
/api/src/main/javadoc/doc-files/speclicense.html:
--------------------------------------------------------------------------------
1 |
2 | By using and/or copying this document, or the Eclipse Foundation
8 | document from which this statement is linked, you (the licensee) agree
9 | that you have read, understood, and will comply with the following
10 | terms and conditions: Permission to copy, and distribute the contents of this document, or
13 | the Eclipse Foundation document from which this statement is linked, in
14 | any medium for any purpose and without fee or royalty is hereby
15 | granted, provided that you include the following on ALL copies of the
16 | document, or portions thereof, that you use: Inclusion of the full text of this NOTICE must be provided. We
29 | request that authorship attribution be provided in any software,
30 | documents, or other items or products that you create pursuant to the
31 | implementation of the contents of this document, or any portion
32 | thereof. No right to create modifications or derivatives of Eclipse Foundation
35 | documents is granted pursuant to this license, except anyone may
36 | prepare and distribute derivative works and portions of this document
37 | in software that implements the specification, in supporting materials
38 | accompanying such software, and in documentation of such software,
39 | PROVIDED that all such works include the notice below. HOWEVER, the
40 | publication of derivative works of this document for use as a technical
41 | specification is expressly prohibited. The notice is: "Copyright © 2018 Eclipse Foundation. This software or
46 | document includes material copied from or derived from [title and URI
47 | of the Eclipse Foundation specification document]." THIS DOCUMENT IS PROVIDED "AS IS," AND THE COPYRIGHT
52 | HOLDERS AND THE ECLIPSE FOUNDATION MAKE NO REPRESENTATIONS OR
53 | WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
54 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
55 | NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE
56 | SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS
57 | WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR
58 | OTHER RIGHTS. THE COPYRIGHT HOLDERS AND THE ECLIPSE FOUNDATION WILL NOT BE LIABLE
61 | FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT
62 | OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE
63 | CONTENTS THEREOF. The name and trademarks of the copyright holders or the Eclipse
66 | Foundation may NOT be used in advertising or publicity pertaining to
67 | this document or its contents without specific, written prior
68 | permission. Title to copyright in this document will at all times
69 | remain with copyright holders. By using and/or copying this document, or the Eclipse Foundation
8 | document from which this statement is linked, you (the licensee) agree
9 | that you have read, understood, and will comply with the following
10 | terms and conditions: Permission to copy, and distribute the contents of this document, or
13 | the Eclipse Foundation document from which this statement is linked, in
14 | any medium for any purpose and without fee or royalty is hereby
15 | granted, provided that you include the following on ALL copies of the
16 | document, or portions thereof, that you use: Inclusion of the full text of this NOTICE must be provided. We
29 | request that authorship attribution be provided in any software,
30 | documents, or other items or products that you create pursuant to the
31 | implementation of the contents of this document, or any portion
32 | thereof. No right to create modifications or derivatives of Eclipse Foundation
35 | documents is granted pursuant to this license, except anyone may
36 | prepare and distribute derivative works and portions of this document
37 | in software that implements the specification, in supporting materials
38 | accompanying such software, and in documentation of such software,
39 | PROVIDED that all such works include the notice below. HOWEVER, the
40 | publication of derivative works of this document for use as a technical
41 | specification is expressly prohibited. The notice is: "Copyright © 2018 Eclipse Foundation. This software or
46 | document includes material copied from or derived from [title and URI
47 | of the Eclipse Foundation specification document]." THIS DOCUMENT IS PROVIDED "AS IS," AND THE COPYRIGHT
52 | HOLDERS AND THE ECLIPSE FOUNDATION MAKE NO REPRESENTATIONS OR
53 | WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
54 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
55 | NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE
56 | SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS
57 | WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR
58 | OTHER RIGHTS. THE COPYRIGHT HOLDERS AND THE ECLIPSE FOUNDATION WILL NOT BE LIABLE
61 | FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT
62 | OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE
63 | CONTENTS THEREOF. The name and trademarks of the copyright holders or the Eclipse
66 | Foundation may NOT be used in advertising or publicity pertaining to
67 | this document or its contents without specific, written prior
68 | permission. Title to copyright in this document will at all times
69 | remain with copyright holders.
25 | * @see JAXBException
26 | * @see Unmarshaller
27 | * @see ValidationEventHandler
28 | * @since 1.6, JAXB 1.0
29 | */
30 | public class UnmarshalException extends JAXBException {
31 |
32 | private static final long serialVersionUID = 6121932693435295453L;
33 |
34 | /**
35 | * Construct an UnmarshalException with the specified detail message. The
36 | * errorCode and linkedException will default to null.
37 | *
38 | * @param message a description of the exception
39 | */
40 | public UnmarshalException( String message ) {
41 | this( message, null, null );
42 | }
43 |
44 | /**
45 | * Construct an UnmarshalException with the specified detail message and vendor
46 | * specific errorCode. The linkedException will default to null.
47 | *
48 | * @param message a description of the exception
49 | * @param errorCode a string specifying the vendor specific error code
50 | */
51 | public UnmarshalException( String message, String errorCode ) {
52 | this( message, errorCode, null );
53 | }
54 |
55 | /**
56 | * Construct an UnmarshalException with a linkedException. The detail message and
57 | * vendor specific errorCode will default to null.
58 | *
59 | * @param exception the linked exception
60 | */
61 | public UnmarshalException( Throwable exception ) {
62 | this( null, null, exception );
63 | }
64 |
65 | /**
66 | * Construct an UnmarshalException with the specified detail message and
67 | * linkedException. The errorCode will default to null.
68 | *
69 | * @param message a description of the exception
70 | * @param exception the linked exception
71 | */
72 | public UnmarshalException( String message, Throwable exception ) {
73 | this( message, null, exception );
74 | }
75 |
76 | /**
77 | * Construct an UnmarshalException with the specified detail message, vendor
78 | * specific errorCode, and linkedException.
79 | *
80 | * @param message a description of the exception
81 | * @param errorCode a string specifying the vendor specific error code
82 | * @param exception the linked exception
83 | */
84 | public UnmarshalException( String message, String errorCode, Throwable exception ) {
85 | super( message, errorCode, exception );
86 | }
87 |
88 | }
89 |
90 |
91 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/UnmarshallerHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind;
12 |
13 | import org.xml.sax.ContentHandler;
14 |
15 | /**
16 | * Unmarshaller implemented as SAX ContentHandler.
17 | *
18 | *
44 | * @see Unmarshaller#getUnmarshallerHandler()
45 | * @since 1.6, JAXB 1.0
46 | */
47 | public interface UnmarshallerHandler extends ContentHandler
48 | {
49 | /**
50 | * Obtains the unmarshalled result.
51 | *
20 | * @see ValidationEventHandler
21 | * @since 1.6, JAXB 1.0
22 | */
23 | public interface ValidationEvent {
24 |
25 | /**
26 | * Conditions that are not errors or fatal errors as defined by the
27 | * XML 1.0 recommendation
28 | */
29 | int WARNING = 0;
30 |
31 | /**
32 | * Conditions that correspond to the definition of "error" in section
33 | * 1.2 of the W3C XML 1.0 Recommendation
34 | */
35 | int ERROR = 1;
36 |
37 | /**
38 | * Conditions that correspond to the definition of "fatal error" in section
39 | * 1.2 of the W3C XML 1.0 Recommendation
40 | */
41 | int FATAL_ERROR = 2;
42 |
43 | /**
44 | * Retrieve the severity code for this warning/error.
45 | *
46 | *
43 | * If the client application does not set an event handler on their
44 | * {@code Unmarshaller}, or {@code Marshaller} prior to
45 | * calling the validate, unmarshal, or marshal methods, then a default event
46 | * handler will receive notification of any errors or warnings encountered.
47 | * The default event handler will cause the current operation to halt after
48 | * encountering the first error or fatal error (but will attempt to continue
49 | * after receiving warnings).
50 | *
51 | *
52 | * @author
55 | * @see Unmarshaller
56 | * @see Marshaller
57 | * @see ValidationEvent
58 | * @see jakarta.xml.bind.util.ValidationEventCollector
59 | * @since 1.6, JAXB 1.0
60 | */
61 | public interface ValidationEventHandler {
62 | /**
63 | * Receive notification of a validation warning or error.
64 | *
28 | * @see ValidationEvent
29 | * @since 1.6, JAXB 1.0
30 | */
31 | public interface ValidationEventLocator {
32 |
33 | /**
34 | * Return the name of the XML source as a URL if available
35 | *
36 | * @return the name of the XML source as a URL or null if unavailable
37 | */
38 | java.net.URL getURL();
39 |
40 | /**
41 | * Return the byte offset if available
42 | *
43 | * @return the byte offset into the input source or -1 if unavailable
44 | */
45 | int getOffset();
46 |
47 | /**
48 | * Return the line number if available
49 | *
50 | * @return the line number or -1 if unavailable
51 | */
52 | int getLineNumber();
53 |
54 | /**
55 | * Return the column number if available
56 | *
57 | * @return the column number or -1 if unavailable
58 | */
59 | int getColumnNumber();
60 |
61 | /**
62 | * Return a reference to the object in the Java content tree if available
63 | *
64 | * @return a reference to the object in the Java content tree or null if
65 | * unavailable
66 | */
67 | java.lang.Object getObject();
68 |
69 | /**
70 | * Return a reference to the DOM Node if available
71 | *
72 | * @return a reference to the DOM Node or null if unavailable
73 | */
74 | org.w3c.dom.Node getNode();
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/ValidationException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2021 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind;
12 |
13 | /**
14 | * This exception indicates that an error has occurred while performing
15 | * a validate operation.
16 | *
17 | *
24 | * @see JAXBException
25 | * @since 1.6, JAXB 1.0
26 | */
27 | public class ValidationException extends JAXBException {
28 |
29 | private static final long serialVersionUID = 2206436657505193108L;
30 |
31 | /**
32 | * Construct an ValidationException with the specified detail message. The
33 | * errorCode and linkedException will default to null.
34 | *
35 | * @param message a description of the exception
36 | */
37 | public ValidationException(String message) {
38 | this( message, null, null );
39 | }
40 |
41 | /**
42 | * Construct an ValidationException with the specified detail message and vendor
43 | * specific errorCode. The linkedException will default to null.
44 | *
45 | * @param message a description of the exception
46 | * @param errorCode a string specifying the vendor specific error code
47 | */
48 | public ValidationException(String message, String errorCode) {
49 | this( message, errorCode, null );
50 | }
51 |
52 | /**
53 | * Construct an ValidationException with a linkedException. The detail message and
54 | * vendor specific errorCode will default to null.
55 | *
56 | * @param exception the linked exception
57 | */
58 | public ValidationException(Throwable exception) {
59 | this( null, null, exception );
60 | }
61 |
62 | /**
63 | * Construct an ValidationException with the specified detail message and
64 | * linkedException. The errorCode will default to null.
65 | *
66 | * @param message a description of the exception
67 | * @param exception the linked exception
68 | */
69 | public ValidationException(String message, Throwable exception) {
70 | this( message, null, exception );
71 | }
72 |
73 | /**
74 | * Construct an ValidationException with the specified detail message, vendor
75 | * specific errorCode, and linkedException.
76 | *
77 | * @param message a description of the exception
78 | * @param errorCode a string specifying the vendor specific error code
79 | * @param exception the linked exception
80 | */
81 | public ValidationException(String message, String errorCode, Throwable exception) {
82 | super( message, errorCode, exception );
83 | }
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/DomHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | import jakarta.xml.bind.ValidationEventHandler;
14 | import javax.xml.transform.Result;
15 | import javax.xml.transform.Source;
16 |
17 | /**
18 | * Converts an element (and its descendants)
19 | * from/to DOM (or similar) representation.
20 | *
21 | * org.w3c.dom
package.)
26 | *
27 | * @author Kohsuke Kawaguchi
28 | * @since 1.6, JAXB 2.0
29 | */
30 | public class W3CDomHandler implements DomHandlerUsage
25 | *
26 | *
30 | *
33 | *
34 | *
41 | *
50 | *
51 | *
29 | *
32 | *
33 | *
44 | *
51 | *
31 | *
34 | *
35 | *
40 | *
44 | *
45 | * Usage
30 | * {@snippet :
31 | * @XmlRootElement
32 | * class Foo {
33 | * @XmlAttachmentRef
34 | * @XmlAttribute
35 | * DataHandler data;
36 | *
37 | * @XmlAttachmentRef
38 | * @XmlElement
39 | * DataHandler body;
40 | * }
41 | * }
42 | * The above code maps to the following XML:
43 | * {@snippet lang="XML" :
44 | *
35 | *
36 | * @see XmlElementWrapper
37 | * @see XmlElementRef
38 | * @since 1.6, JAXB 2.0
39 | */
40 | @Retention(RUNTIME)
41 | @Target({FIELD,METHOD})
42 | public @interface XmlElementRefs {
43 | XmlElementRef[] value();
44 | }
45 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlEnum.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | import static java.lang.annotation.ElementType.TYPE;
14 | import java.lang.annotation.Retention;
15 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
16 | import java.lang.annotation.Target;
17 |
18 | /**
19 | *
30 | *
32 | *
33 | *
35 | *
39 | *
26 | *
28 | *
29 | *
34 | *
37 | *
38 | *
43 | *
50 | *
51 | *
28 | *
31 | *
32 | *
80 | *
90 | *
91 | * @author
92 | * @since 1.6, JAXB 2.0
93 | */
94 | @Retention(RUNTIME) @Target({FIELD,METHOD,PARAMETER})
95 | public @interface XmlList {
96 | }
97 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlMimeType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2021 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | import java.lang.annotation.Retention;
14 | import java.lang.annotation.Target;
15 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
16 | import static java.lang.annotation.ElementType.FIELD;
17 | import static java.lang.annotation.ElementType.METHOD;
18 | import static java.lang.annotation.ElementType.PARAMETER;
19 |
20 | import javax.xml.transform.Source;
21 |
22 | /**
23 | * Associates the MIME type that controls the XML representation of the property.
24 | *
25 | *
25 | *
49 | *
50 | * @author Sekhar Vajjhala, Sun Microsystems, Inc.
51 | * @since 1.6, JAXB 2.0
52 | */
53 | public enum XmlNsForm {UNQUALIFIED, QUALIFIED, UNSET}
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlRegistry.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004, 2021 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | import java.lang.annotation.Retention;
14 | import java.lang.annotation.Target;
15 | import static java.lang.annotation.ElementType.TYPE;
16 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
17 |
18 | /**
19 | * Marks a class that has {@link XmlElementDecl}s.
20 | *
21 | * @author
26 | *
27 | *
28 | *
31 | *
32 | *
33 | *
34 | * Enum Value
29 | * XML Schema Value
30 | *
35 | *
38 | * UNQUALIFIED
36 | * unqualified
37 | *
39 | *
42 | * QUALIFIED
40 | * qualified
41 | *
43 | *
47 | *
48 | * UNSET
44 | * namespace qualification attribute is absent from the
45 | * XML Schema fragment
46 | *
22 | * @since 1.6, JAXB 2.0
23 | * @see XmlElementDecl
24 | */
25 | @Retention(RUNTIME)
26 | @Target({TYPE})
27 | public @interface XmlRegistry {
28 | }
29 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlSchemaType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | import java.lang.annotation.Retention;
14 | import java.lang.annotation.Target;
15 |
16 | import static java.lang.annotation.ElementType.FIELD;
17 | import static java.lang.annotation.ElementType.METHOD;
18 | import static java.lang.annotation.ElementType.PACKAGE;
19 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
20 |
21 | /**
22 | * Maps a Java type to a simple schema built-in type.
23 | *
24 | *
29 | *
33 | *
34 | *
37 | * @see XmlSchemaType
38 | * @since 1.6, JAXB 2.0
39 | */
40 | @Retention(RUNTIME) @Target({PACKAGE})
41 | public @interface XmlSchemaTypes {
42 | /**
43 | * Collection of @{@link XmlSchemaType} annotations
44 | */
45 | XmlSchemaType[] value();
46 | }
47 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/XmlSeeAlso.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation;
12 |
13 | import jakarta.xml.bind.JAXBContext;
14 | import java.lang.annotation.ElementType;
15 | import java.lang.annotation.Retention;
16 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
17 | import java.lang.annotation.Target;
18 |
19 | /**
20 | * Instructs Jakarta XML Binding to also bind other classes when binding this class.
21 | *
22 | *
40 | *
44 | *
45 | *
30 | *
33 | *
34 | *
39 | *
55 | *
41 | *
47 | *
48 | *
74 | * @since 1.6, JAXB 2.0
75 | * @see XmlAdapter
76 | */
77 | @Retention(RUNTIME) @Target({PACKAGE,FIELD,METHOD,TYPE,PARAMETER})
78 | public @interface XmlJavaTypeAdapter {
79 | /**
80 | * Points to the class that converts a value type to a bound type or vice versa.
81 | * See {@link XmlAdapter} for more details.
82 | */
83 | @SuppressWarnings({"rawtypes"})
84 | Class extends XmlAdapter> value();
85 |
86 | /**
87 | * If this annotation is used at the package level, then value of
88 | * the type() must be specified.
89 | */
90 |
91 | Class> type() default DEFAULT.class;
92 |
93 | /**
94 | * Used in {@link XmlJavaTypeAdapter#type()} to
95 | * signal that the type be inferred from the signature
96 | * of the field, property, parameter or the class.
97 | */
98 |
99 | final class DEFAULT {
100 | private DEFAULT() {}
101 | }
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.annotation.adapters;
12 |
13 | import static java.lang.annotation.ElementType.PACKAGE;
14 | import java.lang.annotation.Retention;
15 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
16 | import java.lang.annotation.Target;
17 |
18 | /**
19 | *
38 | * @see XmlJavaTypeAdapter
39 | * @since 1.6, JAXB 2.0
40 | */
41 | @Retention(RUNTIME) @Target({PACKAGE})
42 | public @interface XmlJavaTypeAdapters {
43 | /**
44 | * Collection of @{@link XmlJavaTypeAdapter} annotations
45 | */
46 | XmlJavaTypeAdapter[] value();
47 | }
48 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/annotation/adapters/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | /**
12 | * {@link jakarta.xml.bind.annotation.adapters.XmlAdapter} and its spec-defined
13 | * subclasses to allow arbitrary Java classes to be used with Jakarta XML Binding.
14 | *
15 | * Package Specification
19 | *
20 | *
21 | *
23 | *
24 | * Related Documentation
25 | *
26 | * For overviews, tutorials, examples, guides, and tool documentation,
27 | * please see:
28 | *
29 | *
31 | *
32 | * @see Jakarta XML Binding Website
33 | */
34 | package jakarta.xml.bind.annotation.adapters;
35 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/attachment/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2023 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | /**
12 | * This package is implemented by a MIME-based package processor that
13 | * enables the interpretation and creation of optimized binary data
14 | * within an MIME-based package format.
15 | * Package Specification
25 | *
26 | *
28 | * Related Standards
29 | *
30 | *
35 | *
36 | * @see [1]SOAP Message Transmission Optimization Mechanism
37 | * @see [2]XML-binary Optimized Packaging
38 | * @see [3]WS-I Attachments Profile Version 1.0.
39 | * @see [4]Describing Media Content of Binary Data in XML
40 | * @since JAXB 2.0
41 | */
42 | package jakarta.xml.bind.attachment;
43 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/helpers/Messages.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2021 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.helpers;
12 |
13 | import java.text.MessageFormat;
14 | import java.util.ResourceBundle;
15 |
16 | /**
17 | * Formats error messages.
18 | */
19 | class Messages
20 | {
21 | static String format( String property ) {
22 | return format( property, null );
23 | }
24 |
25 | static String format( String property, Object arg1 ) {
26 | return format( property, new Object[]{arg1} );
27 | }
28 |
29 | static String format( String property, Object arg1, Object arg2 ) {
30 | return format( property, new Object[]{arg1,arg2} );
31 | }
32 |
33 | static String format( String property, Object arg1, Object arg2, Object arg3 ) {
34 | return format( property, new Object[]{arg1,arg2,arg3} );
35 | }
36 |
37 | // add more if necessary.
38 |
39 | /** Loads a string resource and formats it with specified arguments. */
40 | static String format( String property, Object[] args ) {
41 | String text = ResourceBundle.getBundle(Messages.class.getName()).getString(property);
42 | return MessageFormat.format(text,args);
43 | }
44 |
45 | //
46 | //
47 | // Message resources
48 | //
49 | //
50 | static final String INPUTSTREAM_NOT_NULL = // 0 args
51 | "AbstractUnmarshallerImpl.ISNotNull";
52 |
53 | static final String MUST_BE_BOOLEAN = // 1 arg
54 | "AbstractMarshallerImpl.MustBeBoolean";
55 |
56 | static final String MUST_BE_STRING = // 1 arg
57 | "AbstractMarshallerImpl.MustBeString";
58 |
59 | static final String SEVERITY_MESSAGE = // 3 args
60 | "DefaultValidationEventHandler.SeverityMessage";
61 |
62 | static final String LOCATION_UNAVAILABLE = // 0 args
63 | "DefaultValidationEventHandler.LocationUnavailable";
64 |
65 | static final String UNRECOGNIZED_SEVERITY = // 1 arg
66 | "DefaultValidationEventHandler.UnrecognizedSeverity";
67 |
68 | static final String WARNING = // 0 args
69 | "DefaultValidationEventHandler.Warning";
70 |
71 | static final String ERROR = // 0 args
72 | "DefaultValidationEventHandler.Error";
73 |
74 | static final String FATAL_ERROR = // 0 args
75 | "DefaultValidationEventHandler.FatalError";
76 |
77 | static final String ILLEGAL_SEVERITY = // 0 args
78 | "ValidationEventImpl.IllegalSeverity";
79 |
80 | static final String MUST_NOT_BE_NULL = // 1 arg
81 | "Shared.MustNotBeNull";
82 | }
83 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/helpers/NotIdentifiableEventImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2021 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.helpers;
12 |
13 | import jakarta.xml.bind.ValidationEventLocator;
14 |
15 | /**
16 | * Default implementation of the NotIdentifiableEvent interface.
17 | *
18 | *
24 | * @see jakarta.xml.bind.NotIdentifiableEvent
25 | * @see jakarta.xml.bind.ValidationEventHandler
26 | * @see jakarta.xml.bind.ValidationEvent
27 | * @see jakarta.xml.bind.ValidationEventLocator
28 | * @since 1.6, JAXB 1.0
29 | */
30 | public class NotIdentifiableEventImpl
31 | extends ValidationEventImpl
32 | implements jakarta.xml.bind.NotIdentifiableEvent {
33 |
34 | /**
35 | * Create a new NotIdentifiableEventImpl.
36 | *
37 | * @param _severity The severity value for this event. Must be one of
38 | * ValidationEvent.WARNING, ValidationEvent.ERROR, or
39 | * ValidationEvent.FATAL_ERROR
40 | * @param _message The text message for this event - may be null.
41 | * @param _locator The locator object for this event - may be null.
42 | * @throws IllegalArgumentException if an illegal severity field is supplied
43 | */
44 | public NotIdentifiableEventImpl( int _severity, String _message,
45 | ValidationEventLocator _locator) {
46 |
47 | super(_severity, _message, _locator);
48 | }
49 |
50 | /**
51 | * Create a new NotIdentifiableEventImpl.
52 | *
53 | * @param _severity The severity value for this event. Must be one of
54 | * ValidationEvent.WARNING, ValidationEvent.ERROR, or
55 | * ValidationEvent.FATAL_ERROR
56 | * @param _message The text message for this event - may be null.
57 | * @param _locator The locator object for this event - may be null.
58 | * @param _linkedException An optional linked exception that may provide
59 | * additional information about the event - may be null.
60 | * @throws IllegalArgumentException if an illegal severity field is supplied
61 | */
62 | public NotIdentifiableEventImpl( int _severity, String _message,
63 | ValidationEventLocator _locator,
64 | Throwable _linkedException) {
65 |
66 | super(_severity, _message, _locator, _linkedException);
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/helpers/ParseConversionEventImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2021 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.helpers;
12 |
13 | import jakarta.xml.bind.ParseConversionEvent;
14 | import jakarta.xml.bind.ValidationEventLocator;
15 |
16 | /**
17 | * Default implementation of the ParseConversionEvent interface.
18 | *
19 | *
25 | * @see jakarta.xml.bind.ParseConversionEvent
26 | * @see jakarta.xml.bind.ValidationEventHandler
27 | * @see jakarta.xml.bind.ValidationEvent
28 | * @see jakarta.xml.bind.ValidationEventLocator
29 | * @since 1.6, JAXB 1.0
30 | */
31 | public class ParseConversionEventImpl
32 | extends ValidationEventImpl
33 | implements ParseConversionEvent {
34 |
35 | /**
36 | * Create a new ParseConversionEventImpl.
37 | *
38 | * @param _severity The severity value for this event. Must be one of
39 | * ValidationEvent.WARNING, ValidationEvent.ERROR, or
40 | * ValidationEvent.FATAL_ERROR
41 | * @param _message The text message for this event - may be null.
42 | * @param _locator The locator object for this event - may be null.
43 | * @throws IllegalArgumentException if an illegal severity field is supplied
44 | */
45 | public ParseConversionEventImpl( int _severity, String _message,
46 | ValidationEventLocator _locator) {
47 |
48 | super(_severity, _message, _locator);
49 | }
50 |
51 | /**
52 | * Create a new ParseConversionEventImpl.
53 | *
54 | * @param _severity The severity value for this event. Must be one of
55 | * ValidationEvent.WARNING, ValidationEvent.ERROR, or
56 | * ValidationEvent.FATAL_ERROR
57 | * @param _message The text message for this event - may be null.
58 | * @param _locator The locator object for this event - may be null.
59 | * @param _linkedException An optional linked exception that may provide
60 | * additional information about the event - may be null.
61 | * @throws IllegalArgumentException if an illegal severity field is supplied
62 | */
63 | public ParseConversionEventImpl( int _severity, String _message,
64 | ValidationEventLocator _locator,
65 | Throwable _linkedException) {
66 |
67 | super(_severity, _message, _locator, _linkedException);
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/helpers/PrintConversionEventImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2021 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.helpers;
12 |
13 | import jakarta.xml.bind.PrintConversionEvent;
14 | import jakarta.xml.bind.ValidationEventLocator;
15 |
16 | /**
17 | * Default implementation of the PrintConversionEvent interface.
18 | *
19 | *
25 | * @see jakarta.xml.bind.PrintConversionEvent
26 | * @see jakarta.xml.bind.ValidationEventHandler
27 | * @see jakarta.xml.bind.ValidationEvent
28 | * @see jakarta.xml.bind.ValidationEventLocator
29 | * @since 1.6, JAXB 1.0
30 | */
31 | public class PrintConversionEventImpl
32 | extends ValidationEventImpl
33 | implements PrintConversionEvent {
34 |
35 | /**
36 | * Create a new PrintConversionEventImpl.
37 | *
38 | * @param _severity The severity value for this event. Must be one of
39 | * ValidationEvent.WARNING, ValidationEvent.ERROR, or
40 | * ValidationEvent.FATAL_ERROR
41 | * @param _message The text message for this event - may be null.
42 | * @param _locator The locator object for this event - may be null.
43 | * @throws IllegalArgumentException if an illegal severity field is supplied
44 | */
45 | public PrintConversionEventImpl( int _severity, String _message,
46 | ValidationEventLocator _locator) {
47 |
48 | super(_severity, _message, _locator);
49 | }
50 |
51 | /**
52 | * Create a new PrintConversionEventImpl.
53 | *
54 | * @param _severity The severity value for this event. Must be one of
55 | * ValidationEvent.WARNING, ValidationEvent.ERROR, or
56 | * ValidationEvent.FATAL_ERROR
57 | * @param _message The text message for this event - may be null.
58 | * @param _locator The locator object for this event - may be null.
59 | * @param _linkedException An optional linked exception that may provide
60 | * additional information about the event - may be null.
61 | * @throws IllegalArgumentException if an illegal severity field is supplied
62 | */
63 | public PrintConversionEventImpl( int _severity, String _message,
64 | ValidationEventLocator _locator,
65 | Throwable _linkedException) {
66 |
67 | super(_severity, _message, _locator, _linkedException);
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/helpers/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2021 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | /**
12 | * Jakarta XML Binding Provider Use Only: Provides partial default implementations for
13 | * some of the jakarta.xml.bind
interfaces.
14 | *
15 | * Package Specification
23 | *
24 | *
25 | *
27 | *
28 | * Related Documentation
29 | *
33 | *
35 | *
36 | * @see Jakarta XML Binding Website
37 | */
38 | package jakarta.xml.bind.helpers;
39 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2021 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | /**
12 | * Provides a runtime binding framework for client applications including
13 | * unmarshalling, marshalling, and validation capabilities.
14 | * JAXBContext
is the client-entry point to the runtime binding
16 | * framework.
17 | * Package Specification
21 | *
22 | *
24 | * Related Documentation
25 | * For overviews, tutorials, examples, guides, and tool documentation,
26 | * please see:
27 | *
28 | *
30 | *
31 | * @see Jakarta XML Binding Website
32 | */
33 | package jakarta.xml.bind;
34 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/util/Messages.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2021 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.util;
12 |
13 | import java.text.MessageFormat;
14 | import java.util.ResourceBundle;
15 |
16 | /**
17 | * Formats error messages.
18 | */
19 | class Messages
20 | {
21 | static String format( String property ) {
22 | return format( property, null );
23 | }
24 |
25 | static String format( String property, Object arg1 ) {
26 | return format( property, new Object[]{arg1} );
27 | }
28 |
29 | static String format( String property, Object arg1, Object arg2 ) {
30 | return format( property, new Object[]{arg1,arg2} );
31 | }
32 |
33 | static String format( String property, Object arg1, Object arg2, Object arg3 ) {
34 | return format( property, new Object[]{arg1,arg2,arg3} );
35 | }
36 |
37 | // add more if necessary.
38 |
39 | /** Loads a string resource and formats it with specified arguments. */
40 | static String format( String property, Object[] args ) {
41 | String text = ResourceBundle.getBundle(Messages.class.getName()).getString(property);
42 | return MessageFormat.format(text,args);
43 | }
44 |
45 | //
46 | //
47 | // Message resources
48 | //
49 | //
50 | static final String UNRECOGNIZED_SEVERITY = // 1 arg
51 | "ValidationEventCollector.UnrecognizedSeverity";
52 |
53 | static final String RESULT_NULL_CONTEXT = // 0 args
54 | "JAXBResult.NullContext";
55 |
56 | static final String RESULT_NULL_UNMARSHALLER = // 0 arg
57 | "JAXBResult.NullUnmarshaller";
58 |
59 | static final String SOURCE_NULL_CONTEXT = // 0 args
60 | "JAXBSource.NullContext";
61 |
62 | static final String SOURCE_NULL_CONTENT = // 0 arg
63 | "JAXBSource.NullContent";
64 |
65 | static final String SOURCE_NULL_MARSHALLER = // 0 arg
66 | "JAXBSource.NullMarshaller";
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/api/src/main/java/jakarta/xml/bind/util/ValidationEventCollector.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2024 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | package jakarta.xml.bind.util;
12 |
13 | import jakarta.xml.bind.ValidationEvent;
14 | import jakarta.xml.bind.ValidationEventHandler;
15 | import java.util.ArrayList;
16 | import java.util.List;
17 |
18 | /**
19 | * {@link jakarta.xml.bind.ValidationEventHandler ValidationEventHandler}
20 | * implementation that collects all events.
21 | *
22 | *
29 | * @see jakarta.xml.bind.ValidationEventHandler
30 | * @see jakarta.xml.bind.ValidationEvent
31 | * @see jakarta.xml.bind.ValidationEventLocator
32 | * @since 1.6, JAXB 1.0
33 | */
34 | public class ValidationEventCollector implements ValidationEventHandler
35 | {
36 | private final ListPackage Specification
18 | *
19 | *
20 | *
22 | *
23 | * Related Documentation
24 | *
28 | *
30 | *
31 | * @see Jakarta XML Binding Website
32 | */
33 | package jakarta.xml.bind.util;
34 |
--------------------------------------------------------------------------------
/api/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2021 Oracle and/or its affiliates. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
6 | * http://www.eclipse.org/org/documents/edl-v10.php.
7 | *
8 | * SPDX-License-Identifier: BSD-3-Clause
9 | */
10 |
11 | /**
12 | * Jakarta XML Binding API.
13 | *
14 | * Eclipse Foundation Specification License - v1.0
7 |
19 |
27 |
28 | Disclaimers
50 |
51 | Eclipse Foundation Specification License - v1.0
7 |
19 |
27 |
28 | Disclaimers
50 |
51 |