[
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: bug\nassignees: ''\n\n---\n\n**Describe the bug**\nA clear and concise description of what the bug is. If there is an Exception, please include the full stack trace.\n\n**To Reproduce**\nSteps to reproduce the bug\n\n**Expected behavior**\nA clear and concise description of what you expected to happen.\n\n**System information:**\n - OS: [e.g. Linux, Windows, Mac]\n - Java Version: [e.g. 8, 11]\n - Yasson Version: [e.g. 1.0.5]\n\n**Additional context**\nAdd any other context about the problem here.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: enhancement\nassignees: ''\n\n---\n\n**Is your feature request related to a problem? Please describe.**\nA clear and concise description of what the problem is. Ex. I'm always frustrated when [...]\n\n**Describe the solution you'd like**\nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**\nA clear and concise description of any alternative solutions or features you've considered.\n\n**Additional context**\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/other-issue.md",
    "content": "---\nname: Other issue\nabout: Not a bug or a feature request\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "version: 2\nupdates:\n  - package-ecosystem: github-actions\n    directory: /\n    schedule:\n      interval: daily\n\n# TODO - add maven dependabot if community agrees it's useful"
  },
  {
    "path": ".github/workflows/maven.yml",
    "content": "#\n# Copyright (c) 2021, 2026 Oracle and/or its affiliates. All rights reserved.\n#\n# This program and the accompanying materials are made available under the\n# terms of the Eclipse Public License v. 2.0 which is available at\n# http://www.eclipse.org/legal/epl-2.0,\n# or the Eclipse Distribution License v. 1.0 which is available at\n# http://www.eclipse.org/org/documents/edl-v10.php.\n#\n# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n#\n\nname: Yasson\n\non:\n  push:\n    branches:\n      - 'main'\n      - '*-RELEASE'\n  pull_request:\n    branches:\n      - 'main'\n      - '*-RELEASE'\n\njobs:\n  build:\n    name: Test on JDK ${{ matrix.java_version }}\n    runs-on: ubuntu-latest\n\n    strategy:\n      matrix:\n        java_version: [ 11, 17, 21 ]\n\n    steps:\n      - name: Checkout for build\n        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2\n        with:\n          fetch-depth: 0\n      - name: Set up compile JDK\n        uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0\n        with: #Compile java needs to be the highest to ensure proper compilation of the multi-release jar\n          distribution: 'temurin'\n          java-version: 17\n          cache: 'maven'\n      - name: Copyright\n        run: bash etc/copyright.sh\n      - name: Checkstyle\n        run: mvn -B checkstyle:checkstyle\n      - name: Yasson install\n        run: mvn -U -C clean install -DskipTests\n      - name: Yasson tests\n        run: mvn -U -B -C -Dmaven.javadoc.skip=true verify\n      - name: JSONB-API TCK\n        run: cd yasson-tck && mvn -U -B test -DargLine=\"-Djava.locale.providers=COMPAT\"\n"
  },
  {
    "path": ".gitignore",
    "content": "/target/\n/target-tck/\n.classpath\n.project\n.idea/\n.settings/\n/.DS_Store\nbin/\n.envrc\n.vscode/\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing to Eclipse Yasson\n\nThanks for your interest in this project.\n\n## Project description\n\nEclipse Yasson is a Java framework which provides a standard binding layer\nbetween Java classes and JSON documents. This is similar to what JAXB is doing\nin the XML world. Yasson is an official reference implementation of JSON Binding\n(JSR-367).\n\n* https://projects.eclipse.org/projects/ee4j.yasson\n\n## Developer resources\n\nInformation regarding source code management, builds, coding standards, and\nmore.\n\n* https://projects.eclipse.org/projects/ee4j.yasson/developer\n\nThe project maintains the following source code repositories\n\n* https://github.com/eclipse/yasson\n* https://github.com/eclipse-ee4j/yasson\n\n## Eclipse Contributor Agreement\n\nBefore your contribution can be accepted by the project team contributors must\nelectronically sign the Eclipse Contributor Agreement (ECA).\n\n* http://www.eclipse.org/legal/ECA.php\n\nCommits that are provided by non-committers must have a Signed-off-by field in\nthe footer indicating that the author is aware of the terms by which the\ncontribution has been provided to the project. The non-committer must\nadditionally have an Eclipse Foundation account and must have a signed Eclipse\nContributor Agreement (ECA) on file.\n\nFor more information, please see the Eclipse Committer Handbook:\nhttps://www.eclipse.org/projects/handbook/#resources-commit\n\n## Contact\n\nContact the project developers via the project's \"dev\" list.\n\n* https://dev.eclipse.org/mailman/listinfo/yasson-dev"
  },
  {
    "path": "LICENSE.md",
    "content": "# Eclipse Public License - v 2.0\n\n    THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (“AGREEMENT”). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.\n    1. DEFINITIONS\n    \n    “Contribution” means:\n    \n        a) in the case of the initial Contributor, the initial content Distributed under this Agreement, and\n        b) in the case of each subsequent Contributor:\n            i) changes to the Program, and\n            ii) additions to the Program;\n        where such changes and/or additions to the Program originate from and are Distributed by that particular Contributor. A Contribution “originates” from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include changes or additions to the Program that are not Modified Works.\n    \n    “Contributor” means any person or entity that Distributes the Program.\n    \n    “Licensed Patents” mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.\n    \n    “Program” means the Contributions Distributed in accordance with this Agreement.\n    \n    “Recipient” means anyone who receives the Program under this Agreement or any Secondary License (as applicable), including Contributors.\n    \n    “Derivative Works” shall mean any work, whether in Source Code or other form, that is based on (or derived from) the Program and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship.\n    \n    “Modified Works” shall mean any work in Source Code or other form that results from an addition to, deletion from, or modification of the contents of the Program, including, for purposes of clarity any new file in Source Code form that contains any contents of the Program. Modified Works shall not include works that contain only declarations, interfaces, types, classes, structures, or files of the Program solely in each case in order to link to, bind by name, or subclass the Program or Modified Works thereof.\n    \n    “Distribute” means the acts of a) distributing or b) making available in any manner that enables the transfer of a copy.\n    \n    “Source Code” means the form of a Program preferred for making modifications, including but not limited to software source code, documentation source, and configuration files.\n    \n    “Secondary License” means either the GNU General Public License, Version 2.0, or any later versions of that license, including any exceptions or additional permissions as identified by the initial Contributor.\n    2. GRANT OF RIGHTS\n    \n        a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, Distribute and sublicense the Contribution of such Contributor, if any, and such Derivative Works.\n        b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in Source Code or other form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.\n        c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to Distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.\n        d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.\n        e) Notwithstanding the terms of any Secondary License, no Contributor makes additional grants to any Recipient (other than those set forth in this Agreement) as a result of such Recipient's receipt of the Program under the terms of a Secondary License (if permitted under the terms of Section 3).\n    \n    3. REQUIREMENTS\n    \n    3.1 If a Contributor Distributes the Program in any form, then:\n    \n        a) the Program must also be made available as Source Code, in accordance with section 3.2, and the Contributor must accompany the Program with a statement that the Source Code for the Program is available under this Agreement, and informs Recipients how to obtain it in a reasonable manner on or through a medium customarily used for software exchange; and\n        b) the Contributor may Distribute the Program under a license different than this Agreement, provided that such license:\n            i) effectively disclaims on behalf of all other Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;\n            ii) effectively excludes on behalf of all other Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;\n            iii) does not attempt to limit or alter the recipients' rights in the Source Code under section 3.2; and\n            iv) requires any subsequent distribution of the Program by any party to be under a license that satisfies the requirements of this section 3.\n    \n    3.2 When the Program is Distributed as Source Code:\n    \n        a) it must be made available under this Agreement, or if the Program (i) is combined with other material in a separate file or files made available under a Secondary License, and (ii) the initial Contributor attached to the Source Code the notice described in Exhibit A of this Agreement, then the Program may be made available under the terms of such Secondary Licenses, and\n        b) a copy of this Agreement must be included with each copy of the Program.\n    \n    3.3 Contributors may not remove or alter any copyright, patent, trademark, attribution notices, disclaimers of warranty, or limitations of liability (‘notices’) contained within the Program from any copy of the Program which they Distribute, provided that Contributors may add their own appropriate notices.\n    4. COMMERCIAL DISTRIBUTION\n    \n    Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor (“Commercial Contributor”) hereby agrees to defend and indemnify every other Contributor (“Indemnified Contributor”) against any losses, damages and costs (collectively “Losses”) arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.\n    \n    For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.\n    5. NO WARRANTY\n    \n    EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.\n    6. DISCLAIMER OF LIABILITY\n    \n    EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\n    7. GENERAL\n    \n    If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.\n    \n    If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.\n    \n    All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.\n    \n    Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be Distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to Distribute the Program (including its Contributions) under the new version.\n    \n    Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. Nothing in this Agreement is intended to be enforceable by any entity that is not a Contributor or Recipient. No third-party beneficiary rights are created under this Agreement.\n    Exhibit A – Form of Secondary Licenses Notice\n    \n    “This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), version(s), and exceptions or additional permissions here}.”\n    \n        Simply including a copy of this Agreement, including this Exhibit A is not sufficient to license the Source Code under Secondary Licenses.\n    \n        If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice.\n    \n        You may add additional accurate notices of copyright ownership.\n\n\n# Eclipse Distribution License - v 1.0\n\n    Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors.\n\n    All rights reserved.\n\n    Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n    Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n    Neither the name of the Eclipse Foundation, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
  },
  {
    "path": "NOTICE.md",
    "content": "# Notices for Eclipse Yasson\n\nThis content is produced and maintained by the Eclipse Yasson project.\n\n* Project home: https://projects.eclipse.org/projects/ee4j.yasson\n\n## Trademarks\n\nEclipse Yasson is a trademark of the Eclipse Foundation.\n\n## Copyright\n\nAll content is the property of the respective authors or their employers. For\nmore information regarding authorship of content, please consult the listed\nsource code repository logs.\n\n## Declared Project Licenses\n\nThis program and the accompanying materials are made available under the terms\nof the Eclipse Public License v. 2.0 which is available at\nhttp://www.eclipse.org/legal/epl-v20.html, or the Eclipse Distribution License\nv. 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php.\n\nSPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n\n## Source Code\n\nThe project maintains the following source code repositories:\n\n* https://github.com/eclipse/yasson\n* https://github.com/eclipse-ee4j/yasson\n\n## Third-party Content\n\ncdi-api 2.0 (JSR 365: Contexts and Dependency Injection for Java (2.0)\n\n\n## Cryptography\n\nContent may contain encryption software. The country in which you are currently\nmay have restrictions on the import, possession, and use, and/or re-export to\nanother country, of encryption software. BEFORE using any encryption software,\nplease check the country's laws, regulations and policies concerning the import,\npossession, or use, and re-export of encryption software, to see if this is\npermitted."
  },
  {
    "path": "README.md",
    "content": "# Eclipse Yasson\n\n[![Maven Central](https://img.shields.io/maven-central/v/org.eclipse/yasson.svg?label=Maven%20Central)](https://mvnrepository.com/artifact/org.eclipse/yasson)\n<!-- TODO reenable once snapshots can be browsed via https://central.sonatype.com/service/rest/repository/browse/maven-snapshots\n[![Jakarta Staging (Snapshots)](https://img.shields.io/nexus/s/https/jakarta.oss.sonatype.org/org.eclipse/yasson.svg)](https://jakarta.oss.sonatype.org/content/repositories/staging/org/eclipse/yasson/)\n-->\n[![Gitter](https://badges.gitter.im/eclipse/yasson.svg)](https://gitter.im/eclipse/yasson)\n[![Javadocs](https://www.javadoc.io/badge/org.eclipse/yasson.svg)](https://www.javadoc.io/doc/org.eclipse/yasson)\n[![Build Status](https://github.com/eclipse-ee4j/yasson/actions/workflows/maven.yml/badge.svg?branch=main)](https://github.com/eclipse-ee4j/yasson/actions/workflows/maven.yml?branch=main)\n[![License](https://img.shields.io/badge/License-EPL%202.0-green.svg)](https://opensource.org/licenses/EPL-2.0)\n\nYasson is a Java framework which provides a standard binding layer between Java classes and JSON documents. This is similar to what JAXB is doing in the XML world. Yasson is an official reference implementation of JSON Binding ([JSR-367](https://jcp.org/en/jsr/detail?id=367)).\n\nIt defines a **default mapping** algorithm for converting existing Java classes to JSON suitable for the most cases:\n\n```java\nJsonb jsonb = JsonbBuilder.create();\nString result = jsonb.toJson(someObject);\n```\n\nFor whom it's not enough it provides rich customization abilities through a set of **annotations** and rich **programmatic API**: \n\n```java\n// Create custom configuration\nJsonbConfig config = new JsonbConfig()\n  .withNullValues(true)\n  .withFormatting(true);\n\n// Create Jsonb with custom configuration\nJsonb jsonb = JsonbBuilder.create(config);\n\n// Use it!\nString result = jsonb.toJson(someObject);\n```\n\n## Questions?\n\nSomething not working right? Have an idea for an enhancement? Get in touch with the Yasson community in the following ways:\n\n- [Gitter](https://gitter.im/eclipse/yasson): a free instant-messaging platform (similar to Slack) that anyone can join.\n- [Stackoverflow](https://stackoverflow.com/questions/tagged/yasson): As a question tagged `[jsonb-api]` and `[yasson]`\n- [Github Issues](https://github.com/eclipse-ee4j/yasson/issues/new): Open issues for enhancement ideas or bug reports\n\n## Licenses\n- [Eclipse Distribution License 1.0 (BSD)](https://projects.eclipse.org/content/eclipse-distribution-license-1.0-bsd)\n- [Eclipse Public License 2.0](https://projects.eclipse.org/content/eclipse-public-license-2.0)\n\n## Links\n- Yasson home page: https://projects.eclipse.org/projects/ee4j.yasson\n- JSON-B official web site: https://jakartaee.github.io/jsonb-api/\n- JSON-B API & spec project: https://github.com/jakartaee/jsonb-api\n- JSR-367 page on JCP site: https://jcp.org/en/jsr/detail?id=367\n"
  },
  {
    "path": "etc/checkstyle-suppressions.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n\n    Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.\n\n    This program and the accompanying materials are made available under the\n    terms of the Eclipse Public License v. 2.0 which is available at\n    http://www.eclipse.org/legal/epl-2.0,\n    or the Eclipse Distribution License v. 1.0 which is available at\n    http://www.eclipse.org/org/documents/edl-v10.php.\n\n    SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n\n-->\n\n<!DOCTYPE suppressions PUBLIC\n        \"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN\"\n        \"https://checkstyle.org/dtds/suppressions_1_2.dtd\">\n\n<suppressions>\n    <!-- I was not able to properly set import ordering for static imports -->\n    <suppress checks=\"ImportOrder\" message=\"Extra separation in import group before\" />\n</suppressions>\n\n"
  },
  {
    "path": "etc/checkstyle.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n\n    Copyright (c) 2019, 2024 Oracle and/or its affiliates. All rights reserved.\n\n    This program and the accompanying materials are made available under the\n    terms of the Eclipse Public License v. 2.0 which is available at\n    http://www.eclipse.org/legal/epl-2.0,\n    or the Eclipse Distribution License v. 1.0 which is available at\n    http://www.eclipse.org/org/documents/edl-v10.php.\n\n    SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n\n-->\n\n<!DOCTYPE module PUBLIC \"-//Puppy Crawl//DTD Check Configuration 1.3//EN\" \"http://www.puppycrawl.com/dtds/configuration_1_3.dtd\">\n<!--\n    This file is based on maven-checkstyle-plugin config/sun_checks.xml file.\n    Checkstyle configuration that checks the coding conventions based on:\n      - the Java Language Specification at\n        http://java.sun.com/docs/books/jls/second_edition/html/index.html\n      - the Sun Code Conventions at http://java.sun.com/docs/codeconv/\n      - the Javadoc guidelines at\n        http://java.sun.com/j2se/javadoc/writingdoccomments/index.html\n      - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html\n      - some custom relaxations of the rules above & best practices\n    Checkstyle is very configurable. Be sure to read the documentation at\n    http://checkstyle.sf.net (or in your downloaded distribution).\n    Most Checks are configurable, be sure to consult the documentation.\n    To completely disable a check, just comment it out or delete it from the file.\n    Finally, it is worth reading the documentation.\n-->\n\n<module name=\"Checker\">\n\n    <!-- exclude module-info.java check - checkstyle can't process it -->\n    <module name=\"BeforeExecutionExclusionFileFilter\">\n        <property name=\"fileNamePattern\" value=\"module\\-info\\.java$\"/>\n    </module>\n\n    <!--\n        If you set the basedir property below, then all reported file\n        names will be relative to the specified directory. See\n        http://checkstyle.sourceforge.net/5.x/config.html#Checker\n        <property name=\"basedir\" value=\"${basedir}\"/>\n    -->\n    <property name=\"charset\" value=\"UTF-8\"/>\n\n    <!-- Checks that each Java package has a Javadoc file used for commenting. -->\n    <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage       -->\n<!--    <module name=\"JavadocPackage\" />-->\n\n    <!-- Checks to see if a file contains a tab character. -->\n    <module name=\"FileTabCharacter\">\n        <property name=\"eachLine\" value=\"true\"/>\n    </module>\n\n    <!--\n     Making sure we do not have @author tags in javadocs\n     There is a list of developers in pom.xml that is sufficient for our needs.\n     See https://github.com/checkstyle/checkstyle/issues/5339\n    -->\n    <module name=\"RegexpSingleline\">\n        <!-- The '.' in id is needed, otherwise ArrayIndexOutOfBounds happens -->\n        <property name=\"id\" value=\"Javadoc.javadocNoAuthor\"/>\n        <property name=\"format\" value=\"^\\s*\\*\\s*@author\"/>\n        <property name=\"minimum\" value=\"0\"/>\n        <property name=\"maximum\" value=\"0\"/>\n        <property name=\"message\" value=\"Javadoc has illegal ''author'' tag.\"/>\n        <property name=\"fileExtensions\" value=\"java\"/>\n    </module>\n\n    <!-- Checks that property files contain the same keys.         -->\n    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->\n    <module name=\"Translation\"/>\n\n    <module name=\"FileLength\"/>\n\n    <module name=\"SuppressWarningsFilter\"/>\n    <module name=\"TreeWalker\">\n        <module name=\"SuppressionCommentFilter\">\n            <property name=\"offCommentFormat\" value=\"CHECKSTYLE.OFF\\: ([\\w\\|]+)\"/>\n            <property name=\"onCommentFormat\" value=\"CHECKSTYLE.ON\\: ([\\w\\|]+)\"/>\n            <property name=\"checkFormat\" value=\"$1\"/>\n        </module>\n        <module name=\"SuppressWarningsHolder\"/>\n\n        <!-- Checks for Javadoc comments.                     -->\n        <!-- See http://checkstyle.sf.net/config_javadoc.html -->\n        <module name=\"JavadocMethod\">\n            <property name=\"accessModifiers\" value=\"protected\"/>\n            <property name=\"allowMissingReturnTag\" value=\"true\"/>\n            <property name=\"allowMissingParamTags\" value=\"true\"/>\n        </module>\n        <module name=\"JavadocType\">\n            <property name=\"scope\" value=\"protected\"/>\n        </module>\n        <module name=\"JavadocVariable\">\n            <property name=\"scope\" value=\"protected\"/>\n        </module>\n        <module name=\"JavadocStyle\"/>\n\n        <!-- Checks for Naming Conventions.                  -->\n        <!-- See http://checkstyle.sf.net/config_naming.html -->\n        <module name=\"ConstantName\"/>\n        <module name=\"LocalFinalVariableName\"/>\n        <module name=\"LocalVariableName\"/>\n        <module name=\"MemberName\"/>\n        <module name=\"MethodName\"/>\n        <module name=\"PackageName\"/>\n        <module name=\"ParameterName\"/>\n        <module name=\"StaticVariableName\"/>\n        <module name=\"TypeName\"/>\n\n        <!-- Checks for imports                              -->\n        <!-- See http://checkstyle.sf.net/config_import.html -->\n        <module name=\"AvoidStarImport\"/>\n        <module name=\"UnusedImports\"/>\n        <module name=\"IllegalImport\"/> <!-- defaults to sun.* packages -->\n        <module name=\"RedundantImport\"/>\n        <module name=\"ImportOrder\">\n            <property name=\"groups\" value=\"java, javax, jakarta, org.eclipse.yasson\"/>\n            <property name=\"ordered\" value=\"true\"/>\n            <property name=\"separated\" value=\"true\"/>\n            <property name=\"option\" value=\"bottom\"/>\n        </module>\n\n        <!-- Checks for blocks. You know, those {}'s         -->\n        <!-- See http://checkstyle.sf.net/config_blocks.html -->\n        <module name=\"AvoidNestedBlocks\"/>\n        <module name=\"EmptyBlock\">\n            <property name=\"option\" value=\"TEXT\"/>\n            <property name=\"tokens\" value=\"LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH\"/>\n        </module>\n        <module name=\"NeedBraces\">\n            <property name=\"allowSingleLineStatement\" value=\"true\"/>\n        </module>\n        <module name=\"LeftCurly\"/>\n        <module name=\"RightCurly\"/>\n        <module name=\"RightCurly\">\n            <property name=\"option\" value=\"alone\"/>\n            <property name=\"tokens\"\n                    value=\"CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, INSTANCE_INIT\"/>\n        </module>\n\n        <!-- Indentation -->\n        <property name=\"tabWidth\" value=\"4\"/>\n\n        <!-- Wrapping Lines -->\n        <module name=\"NoLineWrap\"/>\n        <module name=\"SeparatorWrap\">\n            <property name=\"tokens\" value=\"DOT\"/>\n            <property name=\"option\" value=\"nl\"/>\n        </module>\n        <module name=\"SeparatorWrap\">\n            <property name=\"tokens\" value=\"COMMA\"/>\n            <property name=\"option\" value=\"EOL\"/>\n        </module>\n\n        <!-- Several variable declaration on one line: int i, p; -->\n        <module name=\"MultipleVariableDeclarations\"/>\n\n        <module name=\"OuterTypeFilename\"/>\n        <module name=\"OneTopLevelClass\"/>\n\n        <!-- Checks for whitespace                               -->\n        <!-- See http://checkstyle.sf.net/config_whitespace.html -->\n        <module name=\"OperatorWrap\"/>\n        <module name=\"WhitespaceAfter\"/>\n        <module name=\"MethodParamPad\"/>\n        <module name=\"NoWhitespaceAfter\"/>\n        <module name=\"NoWhitespaceBefore\"/>\n        <module name=\"ParenPad\"/>\n        <module name=\"TypecastParenPad\"/>\n        <module name=\"WhitespaceAfter\"/>\n        <module name=\"WhitespaceAround\">\n            <!-- Removed static initializer issues: RCURLY, SLIST -->\n            <property name=\"tokens\"\n                    value=\"ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV,\n                            DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO,\n                            LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH,\n                            LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN,\n                            NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, SL, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN,\n                            TYPE_EXTENSION_AND\"/>\n            <property name=\"allowEmptyConstructors\" value=\"true\"/>\n            <property name=\"allowEmptyMethods\" value=\"true\"/>\n            <property name=\"allowEmptyTypes\" value=\"true\"/>\n            <property name=\"allowEmptyLoops\" value=\"true\"/>\n            <message key=\"ws.notFollowed\"\n                    value=\"WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)\"/>\n            <message key=\"ws.notPreceded\"\n                    value=\"WhitespaceAround: ''{0}'' is not preceded with whitespace.\"/>\n        </module>\n\n        <module name=\"GenericWhitespace\">\n            <message key=\"ws.followed\"\n                    value=\"GenericWhitespace ''{0}'' is followed by whitespace.\"/>\n            <message key=\"ws.preceded\"\n                    value=\"GenericWhitespace ''{0}'' is preceded with whitespace.\"/>\n            <message key=\"ws.illegalFollow\"\n                    value=\"GenericWhitespace ''{0}'' should followed by whitespace.\"/>\n            <message key=\"ws.notPreceded\"\n                    value=\"GenericWhitespace ''{0}'' is not preceded with whitespace.\"/>\n        </module>\n\n        <!-- Modifier Checks                                    -->\n        <!-- See http://checkstyle.sf.net/config_modifiers.html -->\n        <module name=\"ModifierOrder\"/>\n        <module name=\"RedundantModifier\"/>\n\n        <!-- Checks for common coding problems               -->\n        <!-- See http://checkstyle.sf.net/config_coding.html -->\n        <module name=\"EmptyStatement\"/>\n        <module name=\"EqualsHashCode\"/>\n        <module name=\"IllegalInstantiation\"/>\n        <module name=\"InnerAssignment\"/>\n        <module name=\"MissingSwitchDefault\"/>\n\n        <module name=\"SimplifyBooleanExpression\"/>\n        <module name=\"SimplifyBooleanReturn\"/>\n\n        <!-- Checks for class design                         -->\n        <!-- See http://checkstyle.sf.net/config_design.html -->\n        <module name=\"HideUtilityClassConstructor\"/>\n        <module name=\"InterfaceIsType\"/>\n        <module name=\"VisibilityModifier\">\n            <property name=\"packageAllowed\" value=\"true\"/>\n        </module>\n        <module name=\"ThrowsCount\">\n            <property name=\"max\" value=\"3\"/>\n        </module>\n\n        <!-- Miscellaneous other checks.                   -->\n        <!-- See http://checkstyle.sf.net/config_misc.html -->\n        <module name=\"ArrayTypeStyle\"/>\n        <module name=\"TodoComment\"/>\n        <module name=\"UpperEll\"/>\n\n        <module name=\"OneStatementPerLine\"/>\n<!--        <module name=\"FallThrough\"/>-->\n\n        <module name=\"NoFinalizer\"/>\n    </module>\n</module>\n"
  },
  {
    "path": "etc/copyright-exclude.txt",
    "content": ".iml\n.apt\n.args\n.bundle\n.class\n.ddl\n.exe\n.gif\n.gitignore\n.ico\n.jar\n.jks\n.jpg\n.json\n.mm\n.ods\n.png\n.svg\n.war\n.zip\n.dat\n.md\n.p12\n.txt\n.mf\n.pem\n.p8\n.pkcs8.pem\n.p12\n.bin\n.vm\n.policy\n"
  },
  {
    "path": "etc/copyright.sh",
    "content": "#!/bin/bash -x\n#\n# Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.\n#\n# This program and the accompanying materials are made available under the\n# terms of the Eclipse Public License v. 2.0 which is available at\n# http://www.eclipse.org/legal/epl-2.0,\n# or the Eclipse Distribution License v. 1.0 which is available at\n# http://www.eclipse.org/org/documents/edl-v10.php.\n#\n# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n#\n\ndie(){ echo \"${1}\" ; exit 1 ;}\n\nreadonly RESULT_FILE=\"target/copyright-check.txt\"\nmkdir target\n\nmvn -q validate -Pcopyright \\\n        > ${RESULT_FILE} || (cat ${RESULT_FILE}; die \"Error running the Maven command\")\n\ngrep -i \"copyright\" ${RESULT_FILE} \\\n    && die \"COPYRIGHT ERROR\" || echo \"COPYRIGHT OK\"\n"
  },
  {
    "path": "etc/copyright.txt",
    "content": "/*\n * Copyright (c) YYYY Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */"
  },
  {
    "path": "etc/delivery-checks.sh",
    "content": "#!/bin/bash\n#\n# Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.\n#\n# This program and the accompanying materials are made available under the\n# terms of the Eclipse Public License v. 2.0 which is available at\n# http://www.eclipse.org/legal/epl-2.0,\n# or the Eclipse Distribution License v. 1.0 which is available at\n# http://www.eclipse.org/org/documents/edl-v10.php.\n#\n# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n#\n\nmvn checkstyle:checkstyle && \\\netc/copyright.sh && \\\necho \"Completed normally\"\n\n"
  },
  {
    "path": "pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n\n    Copyright (c) 2016, 2026 Oracle and/or its affiliates. All rights reserved.\n\n    This program and the accompanying materials are made available under the\n    terms of the Eclipse Public License v. 2.0 which is available at\n    http://www.eclipse.org/legal/epl-2.0,\n    or the Eclipse Distribution License v. 1.0 which is available at\n    http://www.eclipse.org/org/documents/edl-v10.php.\n\n    SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n\n-->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n        xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.eclipse.ee4j</groupId>\n        <artifactId>project</artifactId>\n        <version>2.0.2</version>\n    </parent>\n\n    <groupId>org.eclipse</groupId>\n    <artifactId>yasson</artifactId>\n    <version>3.0.5-SNAPSHOT</version>\n    <packaging>jar</packaging>\n    <name>Yasson</name>\n\n    <description>Eclipse Yasson. Reference implementation of JSR-367 (JSON-B).</description>\n    <url>https://projects.eclipse.org/projects/ee4j.yasson</url>\n\n    <properties>\n        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n        <maven.compiler.release>11</maven.compiler.release>\n        <maven.compiler.testRelease>${maven.compiler.release}</maven.compiler.testRelease>\n        <nexus.staging.repository>yasson-maven2-staging</nexus.staging.repository>\n\n        <!--Dependencies-->\n        <hamcrest.version>2.2</hamcrest.version>\n        <jakarta.annotation-api.version>3.0.0</jakarta.annotation-api.version>\n        <jakarta.el-api.version>6.0.0</jakarta.el-api.version>\n        <jakarta.enterprise.cdi-api.version>4.1.0</jakarta.enterprise.cdi-api.version>\n        <jakarta.interceptor-api.version>2.2.0</jakarta.interceptor-api.version>\n        <jakarta.json.bind.version>3.0.1</jakarta.json.bind.version>\n        <jakarta.json.version>2.1.3</jakarta.json.version>\n        <jakarta.parson.version>1.1.7</jakarta.parson.version>\n        <junit-jupiter.version>5.10.2</junit-jupiter.version>\n        <weld-se-core.version>6.0.0.Beta1</weld-se-core.version>\n\n        <!--Plugins-->\n        <build-helper-maven-plugin.version>3.6.0</build-helper-maven-plugin.version>\n        <buildnumber-maven-plugin.version>3.2.0</buildnumber-maven-plugin.version>\n        <spotbugs-maven-plugin.version>4.8.5.0</spotbugs-maven-plugin.version>\n        <glassfish-copyright-maven-plugin.version>2.4</glassfish-copyright-maven-plugin.version>\n        <maven-bundle-plugin.version>5.1.9</maven-bundle-plugin.version>\n        <maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>\n        <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>\n        <maven-enforcer-plugin.version>3.4.1</maven-enforcer-plugin.version>\n        <maven-jar-plugin.version>3.4.1</maven-jar-plugin.version>\n        <maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>\n        <maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>\n    </properties>\n\n    <dependencyManagement>\n        <dependencies>\n            <dependency>\n                <groupId>jakarta.enterprise</groupId>\n                <artifactId>jakarta.enterprise.cdi-api</artifactId>\n                <version>${jakarta.enterprise.cdi-api.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.el</groupId>\n                <artifactId>jakarta.el-api</artifactId>\n                <version>${jakarta.el-api.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.interceptor</groupId>\n                <artifactId>jakarta.interceptor-api</artifactId>\n                <version>${jakarta.interceptor-api.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.annotation</groupId>\n                <artifactId>jakarta.annotation-api</artifactId>\n                <version>${jakarta.annotation-api.version}</version>\n            </dependency>\n        </dependencies>\n    </dependencyManagement>\n\n    <dependencies>\n        <!-- Compile dependencies -->\n        <dependency>\n            <groupId>jakarta.json.bind</groupId>\n            <artifactId>jakarta.json.bind-api</artifactId>\n            <version>${jakarta.json.bind.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.json</groupId>\n            <artifactId>jakarta.json-api</artifactId>\n            <version>${jakarta.json.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.eclipse.parsson</groupId>\n            <artifactId>parsson</artifactId>\n            <version>${jakarta.parson.version}</version>\n        </dependency>\n        <!-- Test/Provided dependencies -->\n        <dependency>\n            <groupId>jakarta.enterprise</groupId>\n            <artifactId>jakarta.enterprise.cdi-api</artifactId>\n            <optional>true</optional>\n            <scope>provided</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.jboss.weld.se</groupId>\n            <artifactId>weld-se-core</artifactId>\n            <version>${weld-se-core.version}</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.junit.jupiter</groupId>\n            <artifactId>junit-jupiter-api</artifactId>\n            <version>${junit-jupiter.version}</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.junit.jupiter</groupId>\n            <artifactId>junit-jupiter-engine</artifactId>\n            <version>${junit-jupiter.version}</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.hamcrest</groupId>\n            <artifactId>hamcrest</artifactId>\n            <version>${hamcrest.version}</version>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n\n    <organization>\n        <name>Oracle Corporation</name>\n        <url>http://www.oracle.com/</url>\n    </organization>\n\n    <issueManagement>\n        <system>github</system>\n        <url>https://github.com/eclipse-ee4j/yasson/issues</url>\n    </issueManagement>\n\n    <mailingLists>\n        <mailingList>\n            <name>Yasson mailing list</name>\n            <post>yasson-dev@eclipse.org</post>\n            <subscribe>https://dev.eclipse.org/mailman/listinfo/yasson-dev</subscribe>\n            <unsubscribe>https://dev.eclipse.org/mailman/listinfo/yasson-dev</unsubscribe>\n            <archive>https://dev.eclipse.org/mhonarc/lists/yasson-dev/</archive>\n        </mailingList>\n    </mailingLists>\n\n    <licenses>\n        <license>\n            <name>Eclipse Public License v. 2.0</name>\n            <url>http://www.eclipse.org/legal/epl-v20.html</url>\n            <distribution>repo</distribution>\n            <comments>Standard Eclipse License</comments>\n        </license>\n        <license>\n            <name>Eclipse Distribution License v. 1.0</name>\n            <url>http://www.eclipse.org/org/documents/edl-v10.php</url>\n            <distribution>repo</distribution>\n            <comments>Standard Eclipse Distribution License</comments>\n        </license>\n    </licenses>\n\n    <scm>\n        <connection>scm:git:ssh://git@github.com/eclipse-ee4j/yasson.git</connection>\n        <developerConnection>scm:git:ssh://git@github.com/eclipse-ee4j/yasson.git</developerConnection>\n        <url>https://github.com/eclipse-ee4j/yasson.git</url>\n        <tag>HEAD</tag>\n    </scm>\n\n    <developers>\n        <developer>\n            <email>dmitry.kornilov@oracle.com</email>\n            <id>maiden168</id>\n            <name>Dmitry Kornilov</name>\n            <organization>Oracle</organization>\n            <roles>\n                <role>JSON Binding 1.0 Spec Lead</role>\n            </roles>\n            <timezone>CET</timezone>\n        </developer>\n        <developer>\n            <email>roman.grigoriadi@oracle.com</email>\n            <id>roman.grigoriadi</id>\n            <name>Roman Grigoriadi</name>\n            <organization>Oracle</organization>\n            <roles>\n                <role>JSON Binding 1.0 Developer</role>\n            </roles>\n            <timezone>CET</timezone>\n        </developer>\n        <developer>\n            <email>david.k.kral@oracle.com</email>\n            <id>david.kral</id>\n            <name>David Kral</name>\n            <organization>Oracle</organization>\n            <roles>\n                <role>JSON Binding 1.0 Developer</role>\n            </roles>\n            <timezone>CET</timezone>\n        </developer>\n        <developer>\n            <email>andy.guibert@gmail.com</email>\n            <id>aguibert</id>\n            <name>Andy Guibert</name>\n            <organization>IBM</organization>\n            <roles>\n                <role>JSON Binding 1.0 Developer</role>\n            </roles>\n            <timezone>CST</timezone>\n        </developer>\n    </developers>\n\n    <profiles>\n        <profile>\n            <id>checkstyle</id>\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-checkstyle-plugin</artifactId>\n                        <executions>\n                            <execution>\n                                <id>run-checkstyle</id>\n                                <goals>\n                                    <goal>check</goal>\n                                </goals>\n                                <phase>validate</phase>\n                            </execution>\n                        </executions>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n        <profile>\n            <id>spotbugs</id>\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>com.github.spotbugs</groupId>\n                        <artifactId>spotbugs-maven-plugin</artifactId>\n                        <version>${spotbugs-maven-plugin.version}</version>\n                        <configuration>\n                            <threshold>Low</threshold>\n                        </configuration>\n                        <executions>\n                            <execution>\n                                <id>analyze-compile</id>\n                                <phase>compile</phase>\n                                <goals>\n                                    <goal>check</goal>\n                                </goals>\n                            </execution>\n                        </executions>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n        <profile>\n            <id>copyright</id>\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.glassfish.copyright</groupId>\n                        <artifactId>glassfish-copyright-maven-plugin</artifactId>\n                        <configuration>\n                            <!-- Ignore the year to comply with Eclipse Foundation. -->\n                            <ignoreYear>true</ignoreYear>\n                        </configuration>\n                        <executions>\n                            <!--Copyright goal does not fail when copyright is not properly updated,\n                                but prints out which file has incorrect copyright.-->\n                            <execution>\n                                <id>print-copyright</id>\n                                <goals>\n                                    <goal>copyright</goal>\n                                </goals>\n                                <phase>validate</phase>\n                            </execution>\n                            <!--Check goal does not print out incorrect copyright files, but fails when there are errors.-->\n                            <execution>\n                                <id>check-copyright</id>\n                                <goals>\n                                    <goal>check</goal>\n                                </goals>\n                                <phase>validate</phase>\n                            </execution>\n                        </executions>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n        <profile>\n            <id>jdk16</id>\n            <activation>\n                <jdk>[16,)</jdk>\n            </activation>\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-compiler-plugin</artifactId>\n                        <executions>\n                            <execution>\n                                <id>default-testCompile</id>\n                                <configuration>\n                                    <release>16</release>\n                                    <testRelease>16</testRelease>\n                                    <compileSourceRoots>\n                                        <compileSourceRoot>${project.basedir}/src/test/java</compileSourceRoot>\n                                        <compileSourceRoot>${project.basedir}/src/test/java16</compileSourceRoot>\n                                    </compileSourceRoots>\n                                </configuration>\n                            </execution>\n                        </executions>\n                    </plugin>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-failsafe-plugin</artifactId>\n                        <executions>\n                            <execution>\n                                <goals>\n                                    <goal>integration-test</goal>\n                                    <goal>verify</goal>\n                                </goals>\n                            </execution>\n                        </executions>\n                        <configuration>\n                            <includes>\n                                <include>**/RecordTest.java</include>\n                            </includes>\n                        </configuration>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n    </profiles>\n\n    <build>\n        <finalName>${project.artifactId}</finalName>\n        <pluginManagement>\n            <plugins>\n                <plugin>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <artifactId>maven-compiler-plugin</artifactId>\n                    <version>${maven-compiler-plugin.version}</version>\n                    <!-- defaults for compile and testCompile -->\n                    <executions>\n                        <execution>\n                            <id>default-compile</id>\n                            <goals>\n                                <goal>compile</goal>\n                            </goals>\n                            <configuration>\n                                <release>11</release>\n                                <source>11</source>\n                                <target>11</target>\n                            </configuration>\n                        </execution>\n                        <execution>\n                            <id>default-testCompile</id>\n                            <configuration>\n                                <release>11</release>\n                            </configuration>\n                        </execution>\n                        <execution>\n                            <id>multi-release-compile-16</id>\n                            <goals>\n                                <goal>compile</goal>\n                            </goals>\n                            <configuration>\n                                <release>16</release>\n                                <compileSourceRoots>\n                                    <compileSourceRoot>${project.basedir}/src/main/java16</compileSourceRoot>\n                                </compileSourceRoots>\n                                <multiReleaseOutput>true</multiReleaseOutput>\n                            </configuration>\n                        </execution>\n                    </executions>\n                    <configuration>\n                        <compilerArgs>\n                            <arg>-Xlint:all</arg>\n                        </compilerArgs>\n                    </configuration>\n                </plugin>\n                <plugin>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <artifactId>maven-jar-plugin</artifactId>\n                    <version>${maven-jar-plugin.version}</version>\n                    <configuration>\n                        <archive>\n                            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>\n                            <manifestEntries>\n                                <Multi-Release>true</Multi-Release>\n                            </manifestEntries>\n                        </archive>\n                    </configuration>\n                </plugin>\n                <plugin>\n                    <!-- This plugin generates the buildNumber property used in maven-bundle-plugin -->\n                    <groupId>org.codehaus.mojo</groupId>\n                    <artifactId>buildnumber-maven-plugin</artifactId>\n                    <version>${buildnumber-maven-plugin.version}</version>\n                    <configuration>\n                        <format>{0,date,MM/dd/yyyy hh:mm aa}</format>\n                        <items>\n                            <item>timestamp</item>\n                        </items>\n                    </configuration>\n                    <executions>\n                        <execution>\n                            <phase>validate</phase>\n                            <goals>\n                                <goal>create</goal>\n                            </goals>\n                        </execution>\n                    </executions>\n                </plugin>\n                <plugin>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <artifactId>maven-javadoc-plugin</artifactId>\n                    <version>${maven-javadoc-plugin.version}</version>\n                    <configuration>\n                        <bottom><![CDATA[Copyright &#169; 2017, 2024 Oracle Corporation. All rights reserved.<br>]]></bottom>\n                    </configuration>\n                </plugin>\n                <plugin>\n                    <groupId>org.apache.felix</groupId>\n                    <artifactId>maven-bundle-plugin</artifactId>\n                    <version>${maven-bundle-plugin.version}</version>\n                    <executions>\n                        <execution>\n                            <id>osgi-bundle</id>\n                            <phase>prepare-package</phase>\n                            <goals>\n                                <goal>manifest</goal>\n                            </goals>\n                            <configuration>\n                                <niceManifest>true</niceManifest>\n                                <instructions>\n                                    <Bundle-Name>${project.name}</Bundle-Name>\n                                    <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>\n                                    <Bundle-Version>${project.version}</Bundle-Version>\n                                    <Export-Package>org.eclipse.yasson;version=${project.version}</Export-Package>\n                                    <Private-Package>org.eclipse.yasson.*;version=${project.version}</Private-Package>\n                                    <Multi-Release>true</Multi-Release>\n                                    <Import-Package>\n                                        jakarta.enterprise.context.spi;version=!;resolution:=\"optional\",\n                                        jakarta.enterprise.inject.spi;version=!;resolution:=\"optional\",\n                                        javax.naming;resolution:=\"optional\",\n                                        java.beans;resolution:=\"optional\",\n                                        *\n                                    </Import-Package>\n                                    <Require-Capability>osgi.ee;filter:=\"(&amp;(osgi.ee=JavaSE)(version=11))\"</Require-Capability>\n                                </instructions>\n                            </configuration>\n                        </execution>\n                    </executions>\n                </plugin>\n                <plugin>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <artifactId>maven-surefire-plugin</artifactId>\n                    <version>${maven-surefire-plugin.version}</version>\n                    <executions>\n                        <execution>\n                            <id>default-test</id>\n                            <phase>test</phase>\n                            <goals>\n                                <goal>test</goal>\n                            </goals>\n                            <configuration>\n<!--                                <testFailureIgnore>true</testFailureIgnore>-->\n                                <trimStackTrace>false</trimStackTrace>\n                                <excludes>\n                                    <exclude>**/JavaxNamingExcludedTest.java</exclude>\n                                    <exclude>**/AnnotationIntrospectorWithoutOptionalModulesTest.java</exclude>\n                                    <exclude>**/*Record*</exclude>\n                                </excludes>\n                                <argLine>\n                                    <!--Remove when CDI is updated to support modules\n                                    (Yasson does read CDI which is on CP, CDI access yasson's classes with reflection)\n                                    -->\n                                    --add-reads org.eclipse.yasson=ALL-UNNAMED --add-opens org.eclipse.yasson/org.eclipse.yasson.internal.cdi=ALL-UNNAMED\n\n                                    --add-exports org.eclipse.yasson/org.eclipse.yasson.internal.cdi=java.naming\n                                </argLine>\n                            </configuration>\n                        </execution>\n                        <execution>\n                            <id>optional-modules-excluded</id>\n                            <phase>test</phase>\n                            <goals>\n                                <goal>test</goal>\n                            </goals>\n                            <configuration>\n                                <argLine>\n                                    <!--java.management is required by Maven's ForkedBooter-->\n                                    --limit-modules java.base,java.logging,java.sql,jakarta.json.bind,jakarta.json,java.management,jdk.localedata,org.eclipse.parsson,org.eclipse.yasson\n                                </argLine>\n                                <includes>\n                                    <include>**/JavaxNamingExcludedTest.class</include>\n                                    <include>**/AnnotationIntrospectorWithoutOptionalModulesTest.class</include>\n                                </includes>\n                            </configuration>\n                        </execution>\n                    </executions>\n                </plugin>\n                <plugin>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <artifactId>maven-enforcer-plugin</artifactId>\n                    <version>${maven-enforcer-plugin.version}</version>\n                    <executions>\n                        <execution>\n                            <id>enforce-versions</id>\n                            <goals>\n                                <goal>enforce</goal>\n                            </goals>\n                        </execution>\n                    </executions>\n                    <configuration>\n                        <rules>\n                            <requireJavaVersion>\n                                <version>[11,)</version>\n                            </requireJavaVersion>\n                            <requireMavenVersion>\n                                <version>[3.6.0,)</version>\n                            </requireMavenVersion>\n                            <DependencyConvergence/>\n                        </rules>\n                    </configuration>\n                </plugin>\n                <plugin>\n                    <groupId>org.codehaus.mojo</groupId>\n                    <artifactId>build-helper-maven-plugin</artifactId>\n                    <version>${build-helper-maven-plugin.version}</version>\n                    <executions>\n                        <execution>\n                            <id>add-resource</id>\n                            <phase>generate-resources</phase>\n                            <goals>\n                                <goal>add-resource</goal>\n                            </goals>\n                            <configuration>\n                                <resources>\n                                    <resource>\n                                        <directory>${basedir}</directory>\n                                        <targetPath>META-INF</targetPath>\n                                        <includes>\n                                            <include>LICENSE.md</include>\n                                            <include>NOTICE.md</include>\n                                        </includes>\n                                    </resource>\n                                </resources>\n                            </configuration>\n                        </execution>\n                    </executions>\n                </plugin>\n                <plugin>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <artifactId>maven-checkstyle-plugin</artifactId>\n                    <version>${maven-checkstyle-plugin.version}</version>\n                    <configuration>\n                        <configLocation>etc/checkstyle.xml</configLocation>\n                        <suppressionsLocation>etc/checkstyle-suppressions.xml</suppressionsLocation>\n                        <consoleOutput>true</consoleOutput>\n                        <failsOnError>true</failsOnError>\n                        <linkXRef>false</linkXRef>\n                    </configuration>\n                </plugin>\n                <plugin>\n                    <groupId>org.glassfish.copyright</groupId>\n                    <artifactId>glassfish-copyright-maven-plugin</artifactId>\n                    <version>${glassfish-copyright-maven-plugin.version}</version>\n                    <configuration>\n                        <templateFile>etc/copyright.txt</templateFile>\n                        <excludeFile>etc/copyright-exclude.txt</excludeFile>\n                        <scm>git</scm>\n                        <debug>false</debug>\n                        <scmOnly>true</scmOnly>\n                        <warn>true</warn>\n                        <ignoreYear>false</ignoreYear>\n                        <preserveCopyrights>true</preserveCopyrights>\n                    </configuration>\n                </plugin>\n            </plugins>\n        </pluginManagement>\n        <plugins>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-compiler-plugin</artifactId>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-jar-plugin</artifactId>\n            </plugin>\n            <plugin>\n                <groupId>org.codehaus.mojo</groupId>\n                <artifactId>buildnumber-maven-plugin</artifactId>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-dependency-plugin</artifactId>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-javadoc-plugin</artifactId>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-source-plugin</artifactId>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-enforcer-plugin</artifactId>\n            </plugin>\n            <plugin>\n                <groupId>org.codehaus.mojo</groupId>\n                <artifactId>build-helper-maven-plugin</artifactId>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.felix</groupId>\n                <artifactId>maven-bundle-plugin</artifactId>\n            </plugin>\n        </plugins>\n    </build>\n</project>\n"
  },
  {
    "path": "src/main/java/module-info.java",
    "content": "/*\n * Copyright (c) 2017, 2024 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\n/**\n * Yasson, the implementation of the Jakarta JSON Binding.\n */\nmodule org.eclipse.yasson {\n    requires jakarta.json;\n    requires jakarta.json.bind;\n    requires java.logging;\n    requires static java.xml;\n    requires static java.naming;\n    requires static java.sql;\n    requires static java.desktop;\n    requires static jakarta.cdi;\n\n    exports org.eclipse.yasson;\n    exports org.eclipse.yasson.spi;\n    provides jakarta.json.bind.spi.JsonbProvider with org.eclipse.yasson.JsonBindingProvider;\n    uses org.eclipse.yasson.spi.JsonbComponentInstanceCreator;\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/FieldAccessStrategy.java",
    "content": "/*\n * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\n\nimport jakarta.json.bind.config.PropertyVisibilityStrategy;\n\n/**\n * <p>Strategy that can be used to force always using fields instead of getters setters for getting / setting value.</p>\n * <p>Suggested approach is to use default visibility strategy, which will use public getters / setters, or field\n * if it is public.</p>\n *\n * <p>Please consider, that forcing accessing fields will in most cases (when field is not public)\n * result in calling {@link Field#setAccessible(boolean)} to break into clients code.\n * This may cause problems if client code is loaded as JPMS (Java Platform Module System) module, as OSGi module or\n * when SecurityManager is turned on.</p>\n */\npublic class FieldAccessStrategy implements PropertyVisibilityStrategy {\n    @Override\n    public boolean isVisible(Field field) {\n        return true;\n    }\n\n    @Override\n    public boolean isVisible(Method method) {\n        return false;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/ImplementationClass.java",
    "content": "/*\n * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Marks an interface with implementation class, which should be used for deserialiation.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.FIELD, ElementType.METHOD})\npublic @interface ImplementationClass {\n\n    /**\n     * Class, which will be used as implementation for annotated member.\n     *\n     * @return Serializaer to use.\n     */\n    Class<?> value();\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/JsonBindingProvider.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson;\n\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.spi.JsonbProvider;\n\nimport org.eclipse.yasson.internal.JsonBindingBuilder;\n\n/**\n * JsonbProvider implementation.\n */\npublic class JsonBindingProvider extends JsonbProvider {\n\n    @Override\n    public JsonbBuilder create() {\n        return new JsonBindingBuilder();\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/YassonConfig.java",
    "content": "/*\n * Copyright (c) 2019, 2022 IBM and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson;\n\nimport java.util.Map;\n\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.serializer.JsonbSerializer;\n\n/**\n * Custom properties for configuring Yasson outside of the specification {@link jakarta.json.bind.JsonbConfig} scope.\n */\npublic class YassonConfig extends JsonbConfig {\n    \n    /**\n     * @see #withFailOnUnknownProperties(boolean)\n     */\n    public static final String FAIL_ON_UNKNOWN_PROPERTIES = \"jsonb.fail-on-unknown-properties\";\n\n    /**\n     * @see #withUserTypeMapping(java.util.Map)\n     */\n    public static final String USER_TYPE_MAPPING = \"jsonb.user-type-mapping\";\n    \n    /**\n     * @see #withZeroTimeParseDefaulting(boolean)\n     */\n    public static final String ZERO_TIME_PARSE_DEFAULTING = \"jsonb.zero-time-defaulting\";\n\n    /**\n     * @see #withNullRootSerializer(jakarta.json.bind.serializer.JsonbSerializer)\n     */\n    public static final String NULL_ROOT_SERIALIZER = \"yasson.null-root-serializer\";\n\n    /**\n     * @see #withEagerParsing(Class...)\n     */\n    public static final String EAGER_PARSE_CLASSES = \"yasson.eager-parse-classes\";\n\n    /**\n     * @see #withForceMapArraySerializerForNullKeys(boolean)\n     */\n    public static final String FORCE_MAP_ARRAY_SERIALIZER_FOR_NULL_KEYS = \"yasson.force-map-array-serializer-for-null-keys\";\n\n    /**\n     * @see #withTimeInMillisAsAString(boolean)\n     */\n    public static final String DATE_TIME_IN_MILLIS_AS_A_STRING = \"yasson.time-in-millis-as-a-string\";\n\n    /**\n     * Property used to specify behaviour on deserialization when JSON document contains properties\n     * which doesn't exist in the target class. Default value is 'false'.\n     * @param failOnUnknownProperties Whether or not to fail if unknown properties are encountered\n     * @return This YassonConfig instance\n     */\n    public YassonConfig withFailOnUnknownProperties(boolean failOnUnknownProperties) {\n        setProperty(FAIL_ON_UNKNOWN_PROPERTIES, failOnUnknownProperties);\n        return this;\n    }\n    \n    /**\n     * User type mapping for map interface to implementation classes.\n     * @param mapping A map of interface to implementation class mappings\n     * @return This YassonConfig instance\n     */\n    public YassonConfig withUserTypeMapping(Map<Class<?>, Class<?>> mapping) {\n        setProperty(USER_TYPE_MAPPING, mapping);\n        return this;\n    }\n    \n    /**\n     * <p>Makes parsing dates defaulting to zero hour, minute and second.\n     * This will made available to parse patterns like yyyy.MM.dd to\n     * {@link java.util.Date}, {@link java.util.Calendar}, {@link java.time.Instant} {@link java.time.LocalDate}\n     * or even {@link java.time.ZonedDateTime}.\n     * <p>If time zone is not set in the pattern then UTC time zone is used.\n     * So for example json value 2018.01.01 becomes 2018.01.01 00:00:00 UTC when parsed\n     * to instant {@link java.time.Instant} or {@link java.time.ZonedDateTime}.\n     * @param defaultZeroHour Whether or not to default parsing dates to the zero hour\n     * @return This YassonConfig instance\n     */\n    public YassonConfig withZeroTimeParseDefaulting(boolean defaultZeroHour) {\n        setProperty(ZERO_TIME_PARSE_DEFAULTING, defaultZeroHour);\n        return this;\n    }\n    \n    /**\n     * Serializer to use when object provided to {@link jakarta.json.bind.Jsonb#toJson(Object)} is {@code null} or an empty\n     * Optional. Must be instance of {@link jakarta.json.bind.serializer.JsonbSerializer}{@code <Object>}. Its obj value\n     * will be respective parameter.\n     * @param nullSerializer JsonbSerializer instance to use for serializing null root values\n     * @return This YassonConfig instance\n     */\n    public YassonConfig withNullRootSerializer(JsonbSerializer<?> nullSerializer) {\n        setProperty(NULL_ROOT_SERIALIZER, nullSerializer);\n        return this;\n    }\n    \n    /**\n     * @param classes A list of classes to eagerly parse upon creation of the Jsonb instance used with this configuration. \n     * @return This YassonConfig instance\n     */\n    public YassonConfig withEagerParsing(Class<?>... classes) {\n        setProperty(EAGER_PARSE_CLASSES, classes);\n        return this;\n    }\n\n    /**\n     * Property needed to make MapToEntriesArraySerializer the serializer used\n     * when a null key is found in the map. Default value is false.\n     * @param value true to force the use of the MapToEntriesArraySerializer if\n     *              a null key is detected in the map, false to work as before\n     * @return This YassonConfig instance\n     */\n    public YassonConfig withForceMapArraySerializerForNullKeys(boolean value) {\n        setProperty(FORCE_MAP_ARRAY_SERIALIZER_FOR_NULL_KEYS, value);\n        return this;\n    }\n\n    /**\n     * It is required to handle time millisecond format as a number. See\n     * {@link jakarta.json.bind.annotation.JsonbDateFormat#TIME_IN_MILLIS}. It is possible to override this and force\n     * Yasson to handle it as a String, by using this method.\n     *\n     * @param value whether to treat dates formatted by {@link jakarta.json.bind.annotation.JsonbDateFormat#TIME_IN_MILLIS}\n     *              as a String. Default value is {@code false}.\n     * @return This YassonConfig instance\n     * @since 3.0.0\n     */\n    public YassonConfig withTimeInMillisAsAString(boolean value) {\n        setProperty(DATE_TIME_IN_MILLIS_AS_A_STRING, value);\n        return this;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/YassonJsonb.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson;\n\nimport java.lang.reflect.Type;\n\nimport jakarta.json.JsonStructure;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonGenerator;\nimport jakarta.json.stream.JsonParser;\n\n/**\n * Adds methods to Jsonb that are operating directly with {@link JsonGenerator} or {@link JsonParser} types.\n * <p>\n * {@link jakarta.json.spi.JsonProvider} operates on top of the\n * {@link java.io.InputStream} / {@link java.io.OutputStream} or {@link java.io.Reader} / {@link java.io.Writer}\n * and creates generator / parser instances during runtime.\n * </p>\n * <p>\n * This interface accepts instantiated generators and parsers with different input / output sources.\n * </p>\n */\npublic interface YassonJsonb extends jakarta.json.bind.Jsonb {\n\n    /**\n     * Reads in a JSON data with a specified {@link JsonParser} and return the\n     * resulting content tree. Provided json parser must be fully initialized,\n     * no further configurations will be applied.\n     *\n     * @param jsonParser The json parser instance to be used to read JSON data.\n     * @param type       Type of the content tree's root object.\n     * @param <T>        Type of the content tree's root object.\n     * @return the newly created root object of the java content tree\n     * @throws JsonbException       If any unexpected error(s) occur(s) during deserialization.\n     */\n    <T> T fromJson(JsonParser jsonParser, Class<T> type) throws JsonbException;\n\n    /**\n     * Reads in a JSON data with a specified {@link JsonParser} and return the\n     * resulting content tree. Provided json parser must be fully initialized,\n     * no further configurations will be applied.\n     *\n     * @param jsonParser  The json parser instance to be used to read JSON data.\n     * @param runtimeType Runtime type of the content tree's root object.\n     * @param <T>         Type of the content tree's root object.\n     * @return the newly created root object of the java content tree\n     * @throws JsonbException       If any unexpected error(s) occur(s) during deserialization.\n     */\n    <T> T fromJson(JsonParser jsonParser, Type runtimeType) throws JsonbException;\n\n    /**\n     * Reads a {@link JsonStructure} and and converts it into\n     * resulting java content tree.\n     *\n     * @param jsonStructure {@link JsonStructure} to be used as a source for conversion.\n     * @param type          Type of the content tree's root object.\n     * @param <T>           Type of the content tree's root object.\n     * @return the newly created root object of the java content tree\n     * @throws JsonbException       If any unexpected error(s) occur(s) during conversion.\n     */\n    <T> T fromJsonStructure(JsonStructure jsonStructure, Class<T> type) throws JsonbException;\n\n    /**\n     * Reads a {@link JsonStructure} and and converts it into\n     * resulting java content tree.\n     *\n     * @param jsonStructure {@link JsonStructure} to be used as a source for conversion.\n     * @param runtimeType   Runtime type of the content tree's root object.\n     * @param <T>           Type of the content tree's root object.\n     * @return the newly created root object of the java content tree\n     * @throws JsonbException       If any unexpected error(s) occur(s) during deserialization.\n     */\n    <T> T fromJsonStructure(JsonStructure jsonStructure, Type runtimeType) throws JsonbException;\n\n    /**\n     * Writes the object content tree with a specified {@link JsonGenerator}.\n     * Provided json generator must be fully initialized, no further configurations are applied.\n     *\n     * @param object        The object content tree to be serialized.\n     * @param jsonGenerator The json generator to write JSON data. The generator is not closed\n     *                      on a completion for further interaction.\n     * @throws JsonbException       If any unexpected problem occurs during the\n     *                              serialization.\n     * @since JSON Binding 1.0\n     */\n    void toJson(Object object, JsonGenerator jsonGenerator) throws JsonbException;\n\n    /**\n     * Writes the object content tree with a specified {@link JsonGenerator}.\n     * Provided json generator must be fully initialized, no further configurations are applied.\n     *\n     * @param object        The object content tree to be serialized.\n     * @param runtimeType   Runtime type of the content tree's root object.\n     * @param jsonGenerator The json generator to write JSON data. The generator is not closed\n     *                      on a completion for further interaction.\n     * @throws JsonbException       If any unexpected problem occurs during the\n     *                              serialization.\n     * @since JSON Binding 1.0\n     */\n    void toJson(Object object, Type runtimeType, JsonGenerator jsonGenerator) throws JsonbException;\n\n    /**\n     * Serializes the object content tree to a {@link jakarta.json.JsonStructure}.\n     *\n     * @param object The object content tree to be serialized.\n     * @return The {@link JsonStructure} serialized from java content tree.\n     * @throws JsonbException       If any unexpected problem occurs during the\n     *                              serialization.\n     * @since JSON Binding 1.0\n     */\n    JsonStructure toJsonStructure(Object object) throws JsonbException;\n\n    /**\n     * Serializes the object content tree to a {@link jakarta.json.JsonStructure}.\n     *\n     * @param object      The object content tree to be serialized.\n     * @param runtimeType Runtime type of the content tree's root object.\n     * @return The {@link JsonStructure} serialized from java content tree.\n     * @throws JsonbException       If any unexpected problem occurs during the\n     *                              serialization.\n     * @since JSON Binding 1.0\n     */\n    JsonStructure toJsonStructure(Object object, Type runtimeType) throws JsonbException;\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/YassonProperties.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n * Copyright (c) 2019, 2020 Payara Foundation and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson;\n\n/**\n * @deprecated Use {@link YassonConfig} instead\n */\n@Deprecated\npublic class YassonProperties {\n\n    private YassonProperties() {\n        throw new IllegalStateException(\"Util classes cannot be instantiated.\");\n    }\n\n    /**\n     * @deprecated\n     * @see YassonConfig#withFailOnUnknownProperties(boolean)\n     */\n    public static final String FAIL_ON_UNKNOWN_PROPERTIES = YassonConfig.FAIL_ON_UNKNOWN_PROPERTIES;\n\n    /**\n     * @deprecated\n     * @see YassonConfig#withUserTypeMapping(java.util.Map)\n     */\n    public static final String USER_TYPE_MAPPING = YassonConfig.USER_TYPE_MAPPING;\n    \n    /**\n     * @deprecated\n     * @see YassonConfig#withZeroTimeParseDefaulting(boolean)\n     */\n    public static final String ZERO_TIME_PARSE_DEFAULTING = YassonConfig.ZERO_TIME_PARSE_DEFAULTING;\n\n    /**\n     * @deprecated\n     * @see YassonConfig#withNullRootSerializer(jakarta.json.bind.serializer.JsonbSerializer)\n     */\n    public static final String NULL_ROOT_SERIALIZER = YassonConfig.NULL_ROOT_SERIALIZER;\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/AnnotationFinder.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.InvocationTargetException;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.logging.Logger;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Finds an annotation including inherited annotations (e.g. meta-annotations).\n */\nclass AnnotationFinder {\n\n    private static final String CONSTRUCTOR_PROPERTIES_ANNOTATION = \"java.beans.ConstructorProperties\";\n    private static final Logger LOGGER = Logger.getLogger(AnnotationFinder.class.getName());\n\n    private final String annotationClassName;\n    private final Class<? extends Annotation> annotationClass; // may be null\n\n    /**\n     * Gets the {@link AnnotationFinder} for the given Annotation-Type.\n     *\n     * @param annotation {@link Class}, that is a sub-type of {@link Annotation}\n     * @return {@link AnnotationFinder}\n     */\n    public static AnnotationFinder findAnnotation(Class<?> annotation) {\n        return findAnnotationByName(annotation.getName());\n    }\n\n    /**\n     * Gets the {@link AnnotationFinder} for the given Annotation-Type Name.\n     *\n     * @param annotationClassName {@link String}, that is a sub-type of {@link Annotation}\n     * @return {@link AnnotationFinder}\n     */\n    public static AnnotationFinder findAnnotationByName(String annotationClassName) {\n        return new AnnotationFinder(annotationClassName, getOptionalAnnotationClass(annotationClassName));\n    }\n\n    /**\n     * Gets the {@link AnnotationFinder} for @ConstructorProperties-Annotation.\n     *\n     * @return {@link AnnotationFinder}\n     */\n    public static AnnotationFinder findConstructorProperties() {\n        return findAnnotationByName(CONSTRUCTOR_PROPERTIES_ANNOTATION);\n    }\n\n    private AnnotationFinder(String annotationClassName, Class<? extends Annotation> annotationClass) {\n        this.annotationClassName = annotationClassName;\n        this.annotationClass = annotationClass;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public <T extends Annotation> T in(Annotation[] annotations) {\n        if (annotationClass == null) {\n            return null;\n        }\n        return (T) findAnnotation(annotations, annotationClass, new HashSet<>());\n    }\n\n    /**\n     * Looks for the annotation {@link #in(Annotation[])} <br>\n     * and executes the \"value\" Method of it dynamically.\n     *\n     * @param annotations - Array of {@link Annotation}n.\n     * @return {@link Object}\n     */\n    public Object valueIn(Annotation[] annotations) {\n        return invocateValueMethod(in(annotations));\n    }\n\n    private Object invocateValueMethod(Annotation annotation) {\n        if (annotation == null) {\n            return null;\n        }\n        try {\n            return annotation.annotationType().getMethod(\"value\").invoke(annotation);\n        } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {\n            String message = Messages\n                    .getMessage(MessageKeys.MISSING_VALUE_PROPERTY_IN_ANNOTATION, annotation.annotationType().getName());\n            LOGGER.finest(message);\n            return null;\n        }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private static <T extends Annotation> Class<T> getOptionalAnnotationClass(String classname) {\n        try {\n            return (Class<T>) Class.forName(classname);\n        } catch (ClassNotFoundException e) {\n            String message = Messages.getMessage(MessageKeys.ANNOTATION_NOT_AVAILABLE, classname);\n            LOGGER.finest(message);\n            return null;\n        }\n    }\n\n    /**\n     * Searches for annotation, collects processed, to avoid StackOverflow.\n     */\n    // \"static\" to use it in a hybrid procedural and object oriented manner.\n    @SuppressWarnings(\"unchecked\")\n    public static <T extends Annotation> T findAnnotation(Annotation[] declaredAnnotations,\n                                                          Class<T> annotationClass,\n                                                          Set<Annotation> processed) {\n        for (Annotation candidate : declaredAnnotations) {\n            final Class<? extends Annotation> annType = candidate.annotationType();\n            if (annType.equals(annotationClass)) {\n                return (T) candidate;\n            }\n            processed.add(candidate);\n            final List<Annotation> inheritedAnnotations = new ArrayList<>(Arrays.asList(annType.getDeclaredAnnotations()));\n            inheritedAnnotations.removeAll(processed);\n            if (inheritedAnnotations.size() > 0) {\n                final T inherited = findAnnotation(inheritedAnnotations.toArray(new Annotation[inheritedAnnotations.size()]),\n                                                   annotationClass,\n                                                   processed);\n                if (inherited != null) {\n                    return inherited;\n                }\n            }\n        }\n        return null;\n    }\n\n    @Override\n    public String toString() {\n        return \"AnnotationFinder [annotationClassName=\" + annotationClassName + \", annotationClass=\" + annotationClass + \"]\";\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/AnnotationIntrospector.java",
    "content": "/*\n * Copyright (c) 2016, 2023 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Executable;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Modifier;\nimport java.lang.reflect.Parameter;\nimport java.security.AccessController;\nimport java.security.PrivilegedAction;\nimport java.time.format.DateTimeFormatter;\nimport java.time.format.DateTimeFormatterBuilder;\nimport java.time.temporal.ChronoField;\nimport java.time.temporal.TemporalAccessor;\nimport java.util.Arrays;\nimport java.util.Calendar;\nimport java.util.Date;\nimport java.util.EnumSet;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedHashSet;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.ListIterator;\nimport java.util.Locale;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.Optional;\nimport java.util.OptionalDouble;\nimport java.util.OptionalInt;\nimport java.util.OptionalLong;\nimport java.util.Queue;\nimport java.util.Set;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.adapter.JsonbAdapter;\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport jakarta.json.bind.annotation.JsonbNillable;\nimport jakarta.json.bind.annotation.JsonbNumberFormat;\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.annotation.JsonbPropertyOrder;\nimport jakarta.json.bind.annotation.JsonbSubtype;\nimport jakarta.json.bind.annotation.JsonbTransient;\nimport jakarta.json.bind.annotation.JsonbTypeAdapter;\nimport jakarta.json.bind.annotation.JsonbTypeDeserializer;\nimport jakarta.json.bind.annotation.JsonbTypeInfo;\nimport jakarta.json.bind.annotation.JsonbTypeSerializer;\nimport jakarta.json.bind.annotation.JsonbVisibility;\nimport jakarta.json.bind.config.PropertyNamingStrategy;\nimport jakarta.json.bind.config.PropertyVisibilityStrategy;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.bind.serializer.JsonbSerializer;\n\nimport org.eclipse.yasson.ImplementationClass;\nimport org.eclipse.yasson.internal.components.AdapterBinding;\nimport org.eclipse.yasson.internal.components.DeserializerBinding;\nimport org.eclipse.yasson.internal.components.SerializerBinding;\nimport org.eclipse.yasson.internal.model.AnnotationTarget;\nimport org.eclipse.yasson.internal.model.CreatorModel;\nimport org.eclipse.yasson.internal.model.JsonbAnnotatedElement;\nimport org.eclipse.yasson.internal.model.JsonbAnnotatedElement.AnnotationWrapper;\nimport org.eclipse.yasson.internal.model.JsonbCreator;\nimport org.eclipse.yasson.internal.model.Property;\nimport org.eclipse.yasson.internal.model.customization.ClassCustomization;\nimport org.eclipse.yasson.internal.model.customization.TypeInheritanceConfiguration;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Introspects configuration on classes and their properties by reading annotations.\n */\npublic class AnnotationIntrospector {\n\n    //    private static final Set<Class<?>> OPTIONALS = Set.of(Optional.class,\n    //                                                          OptionalInt.class,\n    //                                                          OptionalLong.class,\n    //                                                          OptionalDouble.class);\n\n    private final JsonbContext jsonbContext;\n    private final ConstructorPropertiesAnnotationIntrospector constructorPropertiesIntrospector;\n\n    private static final Set<Class<? extends Annotation>> REPEATABLE = Set.of(JsonbTypeInfo.class);\n\n    /**\n     * Annotations to report exception when used in combination with {@link JsonbTransient}.\n     */\n    private static final List<Class<? extends Annotation>> TRANSIENT_INCOMPATIBLE =\n            Arrays.asList(JsonbDateFormat.class, JsonbNumberFormat.class, JsonbProperty.class,\n                          JsonbTypeAdapter.class, JsonbTypeSerializer.class, JsonbTypeDeserializer.class);\n\n    /**\n     * Creates annotation introspecting component passing {@link JsonbContext} inside.\n     *\n     * @param jsonbContext mandatory\n     */\n    public AnnotationIntrospector(JsonbContext jsonbContext) {\n        Objects.requireNonNull(jsonbContext);\n        this.jsonbContext = jsonbContext;\n        this.constructorPropertiesIntrospector = ConstructorPropertiesAnnotationIntrospector.forContext(jsonbContext);\n    }\n\n    /**\n     * Gets a name of property for JSON marshalling.\n     * Can be different writeName for same property.\n     *\n     * @param property property representation - field, getter, setter (not null)\n     * @return read name\n     */\n    public String getJsonbPropertyJsonWriteName(Property property) {\n        Objects.requireNonNull(property);\n        return getJsonbPropertyCustomizedName(property, property.getGetterElement());\n    }\n\n    /**\n     * Gets a name of property for JSON unmarshalling.\n     * Can be different from writeName for same property.\n     *\n     * @param property property representation - field, getter, setter (not null)\n     * @return write name\n     */\n    public String getJsonbPropertyJsonReadName(Property property) {\n        Objects.requireNonNull(property);\n        return getJsonbPropertyCustomizedName(property, property.getSetterElement());\n    }\n\n    private String getJsonbPropertyCustomizedName(Property property, JsonbAnnotatedElement<Method> methodElement) {\n        JsonbProperty methodAnnotation = getMethodAnnotation(JsonbProperty.class, methodElement);\n        if (methodAnnotation != null && !methodAnnotation.value().isEmpty()) {\n            return methodAnnotation.value();\n        }\n        //in case of property name getter/setter override field value\n        JsonbProperty fieldAnnotation = getFieldAnnotation(JsonbProperty.class, property.getFieldElement());\n        if (fieldAnnotation != null && !fieldAnnotation.value().isEmpty()) {\n            return fieldAnnotation.value();\n        }\n\n        return null;\n    }\n\n    /**\n     * Searches for JsonbCreator annotation on constructors and static methods.\n     *\n     * @param clazz                  class to search\n     * @param propertyNamingStrategy The naming strategy to use for the ${@code JsonbConstructor} annotation,\n     *                               if set and no {@code JsonbProperty} annotations are present.\n     * @return JsonbCreator metadata object\n     */\n    public JsonbCreator getCreator(Class<?> clazz, PropertyNamingStrategy propertyNamingStrategy) {\n        JsonbCreator jsonbCreator = null;\n        Constructor<?>[] declaredConstructors =\n                AccessController.doPrivileged((PrivilegedAction<Constructor<?>[]>) clazz::getDeclaredConstructors);\n\n        for (Constructor<?> constructor : declaredConstructors) {\n            final jakarta.json.bind.annotation.JsonbCreator annot = findAnnotation(constructor.getDeclaredAnnotations(),\n                                                                                   jakarta.json.bind.annotation.JsonbCreator.class);\n            if (annot != null) {\n                jsonbCreator = createJsonbCreator(constructor, jsonbCreator, clazz, propertyNamingStrategy);\n            }\n        }\n\n        Method[] declaredMethods =\n                AccessController.doPrivileged((PrivilegedAction<Method[]>) clazz::getDeclaredMethods);\n        for (Method method : declaredMethods) {\n            final jakarta.json.bind.annotation.JsonbCreator annot = findAnnotation(method.getDeclaredAnnotations(),\n                                                                                   jakarta.json.bind.annotation.JsonbCreator.class);\n            if (annot != null && Modifier.isStatic(method.getModifiers())) {\n                if (!clazz.equals(method.getReturnType())) {\n                    throw new JsonbException(Messages.getMessage(MessageKeys.INCOMPATIBLE_FACTORY_CREATOR_RETURN_TYPE,\n                                                                 method,\n                                                                 clazz));\n                }\n                jsonbCreator = createJsonbCreator(method, jsonbCreator, clazz, propertyNamingStrategy);\n            }\n        }\n        if (jsonbCreator == null) {\n            jsonbCreator = ClassMultiReleaseExtension.findCreator(clazz, declaredConstructors, this, propertyNamingStrategy);\n            if (jsonbCreator == null) {\n                jsonbCreator = constructorPropertiesIntrospector.getCreator(declaredConstructors);\n            }\n        }\n        return jsonbCreator;\n    }\n\n    JsonbCreator createJsonbCreator(Executable executable, JsonbCreator existing, Class<?> clazz, PropertyNamingStrategy propertyNamingStrategy) {\n        if (existing != null) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.MULTIPLE_JSONB_CREATORS, clazz));\n        }\n\n        final Parameter[] parameters = executable.getParameters();\n\n        CreatorModel[] creatorModels = new CreatorModel[parameters.length];\n        for (int i = 0; i < parameters.length; i++) {\n            final Parameter parameter = parameters[i];\n            final JsonbProperty jsonbPropertyAnnotation = parameter.getAnnotation(JsonbProperty.class);\n            if (jsonbPropertyAnnotation != null && !jsonbPropertyAnnotation.value().isEmpty()) {\n                creatorModels[i] = new CreatorModel(jsonbPropertyAnnotation.value(), parameter, executable, jsonbContext);\n            } else {\n                final String translatedParameterName = propertyNamingStrategy.translateName(parameter.getName());\n                creatorModels[i] = new CreatorModel(translatedParameterName, parameter, executable, jsonbContext);\n            }\n        }\n\n        return new JsonbCreator(executable, creatorModels);\n    }\n\n    /**\n     * Checks for {@link JsonbAdapter} on a property.\n     *\n     * @param property property not null\n     * @return components info\n     */\n    public AdapterBinding getAdapterBinding(Property property) {\n        Objects.requireNonNull(property);\n        JsonbTypeAdapter adapterAnnotation = getAnnotationFromProperty(JsonbTypeAdapter.class, property)\n                .orElseGet(() -> getAnnotationFromPropertyType(property, JsonbTypeAdapter.class));\n        if (adapterAnnotation == null) {\n            return null;\n        }\n\n        return getAdapterBindingFromAnnotation(adapterAnnotation, ReflectionUtils.getOptionalRawType(property.getPropertyType()));\n    }\n\n    /**\n     * Checks for {@link JsonbAdapter} on a type.\n     *\n     * @param clsElement type not null\n     * @return components info\n     */\n    public AdapterBinding getAdapterBinding(JsonbAnnotatedElement<Class<?>> clsElement) {\n        Objects.requireNonNull(clsElement);\n\n        JsonbTypeAdapter adapterAnnotation = clsElement.getElement().getAnnotation(JsonbTypeAdapter.class);\n        if (adapterAnnotation == null) {\n            return null;\n        }\n\n        return getAdapterBindingFromAnnotation(adapterAnnotation, Optional.ofNullable(clsElement.getElement()));\n    }\n\n    private AdapterBinding getAdapterBindingFromAnnotation(JsonbTypeAdapter adapterAnnotation, Optional<Class<?>> expectedClass) {\n        final Class<? extends JsonbAdapter> adapterClass = adapterAnnotation.value();\n        final AdapterBinding adapterBinding = jsonbContext.getComponentMatcher().introspectAdapterBinding(adapterClass, null);\n\n        if (expectedClass.isPresent() && !(\n                ReflectionUtils.getRawType(adapterBinding.getBindingType()).isAssignableFrom(expectedClass.get()))) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.ADAPTER_INCOMPATIBLE,\n                                                         adapterBinding.getBindingType(),\n                                                         expectedClass.get()));\n        }\n        return adapterBinding;\n    }\n\n    /**\n     * Checks for {@link JsonbDeserializer} on a property.\n     *\n     * @param property property not null\n     * @return components info\n     */\n    public DeserializerBinding getDeserializerBinding(Property property) {\n        Objects.requireNonNull(property);\n        JsonbTypeDeserializer deserializerAnnotation = getAnnotationFromProperty(JsonbTypeDeserializer.class, property)\n                .orElseGet(() -> getAnnotationFromPropertyType(property, JsonbTypeDeserializer.class));\n        if (deserializerAnnotation == null) {\n            return null;\n        }\n\n        final Class<? extends JsonbDeserializer> deserializerClass = deserializerAnnotation.value();\n        return jsonbContext.getComponentMatcher().introspectDeserializerBinding(deserializerClass, null);\n    }\n\n    /**\n     * Checks for {@link JsonbDeserializer} on a {@link Parameter}.\n     *\n     * @param parameter parameter not null\n     * @return components info\n     */\n    public DeserializerBinding<?> getDeserializerBinding(Parameter parameter) {\n        Objects.requireNonNull(parameter);\n        JsonbTypeDeserializer deserializerAnnotation =\n                Optional.ofNullable(parameter.getDeclaredAnnotation(JsonbTypeDeserializer.class))\n                        .orElseGet(() -> getAnnotationFromParameterType(parameter, JsonbTypeDeserializer.class));\n        if (deserializerAnnotation == null) {\n            return null;\n        }\n\n        final Class<? extends JsonbDeserializer> deserializerClass = deserializerAnnotation.value();\n        return jsonbContext.getComponentMatcher().introspectDeserializerBinding(deserializerClass, null);\n    }\n\n    /**\n     * Checks for {@link JsonbAdapter} on a {@link Parameter}.\n     *\n     * @param parameter parameter not null\n     * @return components info\n     */\n    public AdapterBinding getAdapterBinding(Parameter parameter) {\n        Objects.requireNonNull(parameter);\n        JsonbTypeAdapter adapter =\n                Optional.ofNullable(parameter.getDeclaredAnnotation(JsonbTypeAdapter.class))\n                        .orElseGet(() -> getAnnotationFromParameterType(parameter, JsonbTypeAdapter.class));\n        if (adapter == null) {\n            return null;\n        }\n\n        return getAdapterBindingFromAnnotation(adapter, ReflectionUtils.getOptionalRawType(parameter.getParameterizedType()));\n    }\n\n    private <T extends Annotation> T getAnnotationFromParameterType(Parameter parameter, Class<T> annotationClass) {\n        final Optional<Class<?>> optionalRawType = ReflectionUtils.getOptionalRawType(parameter.getParameterizedType());\n        //will not work for type variable properties, which are bound to class that is annotated.\n        return optionalRawType.map(aClass -> findAnnotation(collectAnnotations(aClass).getAnnotations(), annotationClass))\n                .orElse(null);\n    }\n\n    /**\n     * Checks for {@link JsonbDeserializer} on a type.\n     *\n     * @param clsElement type not null\n     * @return components info\n     */\n    public DeserializerBinding getDeserializerBinding(JsonbAnnotatedElement<Class<?>> clsElement) {\n        Objects.requireNonNull(clsElement);\n        JsonbTypeDeserializer deserializerAnnotation = clsElement.getElement().getAnnotation(JsonbTypeDeserializer.class);\n        if (deserializerAnnotation == null) {\n            return null;\n        }\n\n        final Class<? extends JsonbDeserializer> deserializerClass = deserializerAnnotation.value();\n        return jsonbContext.getComponentMatcher().introspectDeserializerBinding(deserializerClass, null);\n    }\n\n    /**\n     * Checks for {@link JsonbSerializer} on a property.\n     *\n     * @param property property not null\n     * @return components info\n     */\n    public SerializerBinding getSerializerBinding(Property property) {\n        Objects.requireNonNull(property);\n        JsonbTypeSerializer serializerAnnotation = getAnnotationFromProperty(JsonbTypeSerializer.class, property)\n                .orElseGet(() -> getAnnotationFromPropertyType(property, JsonbTypeSerializer.class));\n        if (serializerAnnotation == null) {\n            return null;\n        }\n\n        final Class<? extends JsonbSerializer> serializerClass = serializerAnnotation.value();\n        return jsonbContext.getComponentMatcher().introspectSerializerBinding(serializerClass, null);\n\n    }\n\n    /**\n     * Checks for {@link JsonbSerializer} on a type.\n     *\n     * @param clsElement type not null\n     * @return components info\n     */\n    public SerializerBinding getSerializerBinding(JsonbAnnotatedElement<Class<?>> clsElement) {\n        Objects.requireNonNull(clsElement);\n        JsonbTypeSerializer serializerAnnotation = clsElement.getElement().getAnnotation(JsonbTypeSerializer.class);\n        if (serializerAnnotation == null) {\n            return null;\n        }\n\n        final Class<? extends JsonbSerializer> serializerClass = serializerAnnotation.value();\n        return jsonbContext.getComponentMatcher().introspectSerializerBinding(serializerClass, null);\n    }\n\n    private <T extends Annotation> T getAnnotationFromPropertyType(Property property, Class<T> annotationClass) {\n        final Optional<Class<?>> optionalRawType = ReflectionUtils.getOptionalRawType(property.getPropertyType());\n        if (!optionalRawType.isPresent()) {\n            //will not work for type variable properties, which are bound to class that is annotated.\n            return null;\n        }\n        return findAnnotation(collectAnnotations(optionalRawType.get()).getAnnotations(), annotationClass);\n    }\n\n    /**\n     * Checks if property is nillable.\n     * Looks for {@link JsonbProperty} nillable attribute only.\n     * JsonbNillable is checked only for ClassModels.\n     *\n     * @param property property to search in, not null\n     * @return True if property should be serialized when null.\n     */\n    public Optional<Boolean> isPropertyNillable(Property property) {\n        Objects.requireNonNull(property);\n\n        Optional<JsonbNillable> nillable = getAnnotationFromProperty(JsonbNillable.class, property);\n        if (nillable.isPresent()) {\n            return nillable.map(JsonbNillable::value);\n        }\n        final Optional<JsonbProperty> jsonbProperty = getAnnotationFromProperty(JsonbProperty.class, property);\n        return jsonbProperty.map(JsonbProperty::nillable);\n\n    }\n\n    /**\n     * Checks for JsonbNillable annotation on a class, its superclasses and interfaces.\n     *\n     * @param clazzElement class to search JsonbNillable in.\n     * @return true if found\n     */\n    public boolean isClassNillable(JsonbAnnotatedElement<Class<?>> clazzElement) {\n        final JsonbNillable jsonbNillable = findAnnotation(clazzElement.getAnnotations(), JsonbNillable.class);\n        if (jsonbNillable != null) {\n            return jsonbNillable.value();\n        }\n        Class<?> clazz = clazzElement.getElement();\n        if (clazz == Optional.class\n                || clazz == OptionalDouble.class\n                || clazz == OptionalInt.class\n                || clazz == OptionalLong.class) {\n            return true;\n        }\n        return jsonbContext.getConfigProperties().getConfigNullable();\n    }\n\n    /**\n     * Checks for {@link JsonbPropertyOrder} annotation.\n     *\n     * @param clazzElement class to search on\n     * @return ordered properties names or null if not found\n     */\n    public String[] getPropertyOrder(JsonbAnnotatedElement<Class<?>> clazzElement) {\n        final JsonbPropertyOrder jsonbPropertyOrder = clazzElement.getElement().getAnnotation(JsonbPropertyOrder.class);\n        return jsonbPropertyOrder != null ? jsonbPropertyOrder.value() : null;\n    }\n\n    /**\n     * Checks if property is annotated transient. If JsonbTransient annotation is present on field getter or setter, and other\n     * annotation is present\n     * on either of it, JsonbException is thrown with message describing collision.\n     *\n     * @param property The property to inspect if there is any {@link JsonbTransient} annotation defined for it\n     * @return Set of {@link AnnotationTarget}s specifying in which scope the {@link JsonbTransient} is applied\n     */\n    public EnumSet<AnnotationTarget> getJsonbTransientCategorized(Property property) {\n        Objects.requireNonNull(property);\n        EnumSet<AnnotationTarget> transientTarget = EnumSet.noneOf(AnnotationTarget.class);\n        Map<AnnotationTarget, JsonbTransient> annotationFromPropertyCategorized = getAnnotationFromPropertyCategorized(\n                JsonbTransient.class,\n                property);\n        if (annotationFromPropertyCategorized.size() > 0) {\n            transientTarget.addAll(annotationFromPropertyCategorized.keySet());\n            return transientTarget;\n        }\n\n        return transientTarget;\n    }\n\n    /**\n     * Search {@link JsonbDateFormat} on property, if not found looks at annotations declared on property type class.\n     *\n     * @param property Property to search on.\n     * @return Map of {@link JsonbDateFormatter} instances categorized by their scopes (class, property, getter or setter). If\n     * there is no date\n     * formatter specified for given property, an empty map would be returned\n     */\n    public Map<AnnotationTarget, JsonbDateFormatter> getJsonbDateFormatCategorized(Property property) {\n        Objects.requireNonNull(property);\n\n        Map<AnnotationTarget, JsonbDateFormatter> result = new HashMap<>();\n        Map<AnnotationTarget, JsonbDateFormat> annotationFromPropertyCategorized = getAnnotationFromPropertyCategorized(\n                JsonbDateFormat.class,\n                property);\n        if (annotationFromPropertyCategorized.size() != 0) {\n            annotationFromPropertyCategorized.forEach((key, annotation) -> result\n                    .put(key, createJsonbDateFormatter(annotation.value(), annotation.locale(), property)));\n        }\n\n        // No date format on property, try class level\n        // if property is not TypeVariable and its class is not date skip it\n        final Optional<Class<?>> propertyRawTypeOptional = ReflectionUtils.getOptionalRawType(property.getPropertyType());\n        if (propertyRawTypeOptional.isPresent()) {\n            Class<?> rawType = propertyRawTypeOptional.get();\n            if (!(\n                    Date.class.isAssignableFrom(rawType) || Calendar.class.isAssignableFrom(rawType)\n                            || TemporalAccessor.class.isAssignableFrom(rawType))) {\n                return new HashMap<>();\n            }\n        }\n\n        JsonbDateFormat classLevelDateFormatter = findAnnotation(property.getDeclaringClassElement().getAnnotations(),\n                                                                 JsonbDateFormat.class);\n        if (classLevelDateFormatter != null) {\n            result.put(AnnotationTarget.CLASS,\n                       createJsonbDateFormatter(classLevelDateFormatter.value(), classLevelDateFormatter.locale(), property));\n        }\n\n        return result;\n    }\n\n    /**\n     * Search for {@link JsonbDateFormat} annotation on java class and construct {@link JsonbDateFormatter}.\n     * If not found looks at annotations declared on property type class.\n     *\n     * @param clazzElement class to search not null\n     * @return formatter to use\n     */\n    public JsonbDateFormatter getJsonbDateFormat(JsonbAnnotatedElement<Class<?>> clazzElement) {\n        Objects.requireNonNull(clazzElement);\n        final JsonbDateFormat format = findAnnotation(clazzElement.getAnnotations(), JsonbDateFormat.class);\n        if (format == null) {\n            return jsonbContext.getConfigProperties().getConfigDateFormatter();\n        }\n        return new JsonbDateFormatter(format.value(), format.locale());\n    }\n\n    /**\n     * Search for {@link JsonbNumberFormat} annotation on java class.\n     *\n     * @param clazzElement class to search not null\n     * @return formatter to use\n     */\n    public JsonbNumberFormatter getJsonbNumberFormat(JsonbAnnotatedElement<Class<?>> clazzElement) {\n        final JsonbNumberFormat formatAnnotation = findAnnotation(clazzElement.getAnnotations(), JsonbNumberFormat.class);\n        if (formatAnnotation == null) {\n            return null;\n        }\n        return new JsonbNumberFormatter(formatAnnotation.value(), formatAnnotation.locale());\n    }\n\n    /**\n     * Search {@link JsonbNumberFormat} on property, if not found looks at annotations declared on property type class.\n     *\n     * @param property Property to search on.\n     * @return Map of {@link JsonbNumberFormatter} instances categorized by their scopes (class, property, getter or setter).\n     * If there is no number\n     * formatter specified for given property, an empty map would be returned\n     */\n    public Map<AnnotationTarget, JsonbNumberFormatter> getJsonNumberFormatter(Property property) {\n        Map<AnnotationTarget, JsonbNumberFormatter> result = new HashMap<>();\n        Map<AnnotationTarget, JsonbNumberFormat> annotationFromPropertyCategorized = getAnnotationFromPropertyCategorized(\n                JsonbNumberFormat.class,\n                property);\n        //        if (annotationFromPropertyCategorized.size() == 0) {\n        //            final Optional<Class<?>> propertyRawTypeOptional = ReflectionUtils.getOptionalRawType(property\n        //            .getPropertyType());\n        //            if (propertyRawTypeOptional.isPresent()) {\n        //                Class<?> rawType = propertyRawTypeOptional.get();\n        //                if (!Number.class.isAssignableFrom(rawType)) {\n        //                    return new HashMap<>();\n        //                }\n        //            }\n        //        } else {\n        //            annotationFromPropertyCategorized.forEach((key, annotation) -> result\n        //                    .put(key, new JsonbNumberFormatter(annotation.value(), annotation.locale())));\n        //        }\n        annotationFromPropertyCategorized.forEach((key, annotation) -> result\n                .put(key, new JsonbNumberFormatter(annotation.value(), annotation.locale())));\n\n        JsonbNumberFormat classLevelNumberFormatter = findAnnotation(property.getDeclaringClassElement().getAnnotations(),\n                                                                     JsonbNumberFormat.class);\n        if (classLevelNumberFormatter != null) {\n            result.put(AnnotationTarget.CLASS,\n                       new JsonbNumberFormatter(classLevelNumberFormatter.value(), classLevelNumberFormatter.locale()));\n        }\n\n        return result;\n    }\n\n    /**\n     * Returns {@link JsonbNumberFormatter} instance if {@link JsonbNumberFormat} annotation is present.\n     *\n     * @param param annotated method parameter\n     * @return formatter instance if {@link JsonbNumberFormat} is present otherwise null\n     */\n    public JsonbNumberFormatter getConstructorNumberFormatter(JsonbAnnotatedElement<Parameter> param) {\n        return param.getAnnotation(JsonbNumberFormat.class)\n                .map(annotation -> new JsonbNumberFormatter(annotation.value(), annotation.locale()))\n                .orElse(null);\n    }\n\n    /**\n     * Returns {@link JsonbDateFormatter} instance if {@link JsonbDateFormat} annotation is present.\n     *\n     * @param param annotated method parameter\n     * @return formatter instance if {@link JsonbDateFormat} is present otherwise null\n     */\n    public JsonbDateFormatter getConstructorDateFormatter(JsonbAnnotatedElement<Parameter> param) {\n        return param.getAnnotation(JsonbDateFormat.class)\n                .map(annotation -> new JsonbDateFormatter(DateTimeFormatter.ofPattern(annotation.value(),\n                                                                                      Locale.forLanguageTag(annotation.locale())),\n                                                          annotation.value(), annotation.locale()))\n                .orElse(null);\n    }\n\n    /**\n     * Creates {@link JsonbDateFormatter} caches formatter instance if possible.\n     * For DEFAULT_FORMAT appropriate singleton instances from java.time.format.DateTimeFormatter\n     * are used in date converters.\n     */\n    private JsonbDateFormatter createJsonbDateFormatter(String format, String locale, Property property) {\n        if (JsonbDateFormat.TIME_IN_MILLIS.equals(format) || JsonbDateFormat.DEFAULT_FORMAT.equals(format)) {\n            //for epochMillis formatter is not used, for default format singleton instances of DateTimeFormatter\n            //are used in the converters\n            return new JsonbDateFormatter(format, locale);\n        }\n\n        final Optional<Class<?>> optionalRawType = ReflectionUtils.getOptionalRawType(property.getPropertyType());\n        final Class<?> propertyRawType = optionalRawType.orElse(null);\n\n        if (propertyRawType != null\n                && !TemporalAccessor.class.isAssignableFrom(propertyRawType)\n                && !Date.class.isAssignableFrom(propertyRawType)\n                && !Calendar.class.isAssignableFrom(propertyRawType)) {\n            throw new IllegalStateException(Messages.getMessage(MessageKeys.UNSUPPORTED_DATE_TYPE, propertyRawType));\n        }\n\n        DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();\n        builder.appendPattern(format);\n        if (jsonbContext.getConfigProperties().isZeroTimeDefaulting()) {\n            builder.parseDefaulting(ChronoField.SECOND_OF_MINUTE, 0);\n            builder.parseDefaulting(ChronoField.MINUTE_OF_HOUR, 0);\n            builder.parseDefaulting(ChronoField.HOUR_OF_DAY, 0);\n        }\n        DateTimeFormatter dateTimeFormatter = builder.toFormatter(Locale.forLanguageTag(locale));\n        return new JsonbDateFormatter(dateTimeFormatter, format, locale);\n    }\n\n    /**\n     * Get a @JsonbVisibility annotation from a class or its package.\n     *\n     * @param clazz Class to lookup annotation\n     * @return Instantiated PropertyVisibilityStrategy if annotation is present\n     */\n    public PropertyVisibilityStrategy getPropertyVisibilityStrategy(Class<?> clazz) {\n        JsonbVisibility visibilityAnnotation = findAnnotation(clazz.getDeclaredAnnotations(), JsonbVisibility.class);\n        if ((visibilityAnnotation == null) && (clazz.getPackage() != null)) {\n            visibilityAnnotation = findAnnotation(clazz.getPackage().getDeclaredAnnotations(), JsonbVisibility.class);\n        }\n        if (visibilityAnnotation != null) {\n            return ReflectionUtils.createNoArgConstructorInstance(\n                    ReflectionUtils.getDefaultConstructor(visibilityAnnotation.value(), true));\n        }\n        return jsonbContext.getConfigProperties().getPropertyVisibilityStrategy();\n    }\n\n    /**\n     * Gets an annotation from first resolved annotation in a property in this order:\n     * <p>1. Field, 2. Getter, 3 Setter.</p>\n     * First found overrides other.\n     *\n     * @param annotationClass Annotation class to search for\n     * @param property        property to search in\n     * @param <T>             Annotation type\n     * @return Annotation if found, null otherwise\n     */\n    private <T extends Annotation> Optional<T> getAnnotationFromProperty(Class<T> annotationClass, Property property) {\n        T fieldAnnotation = getFieldAnnotation(annotationClass, property.getFieldElement());\n        if (fieldAnnotation != null) {\n            return Optional.of(fieldAnnotation);\n        }\n\n        T getterAnnotation = getMethodAnnotation(annotationClass, property.getGetterElement());\n        if (getterAnnotation != null) {\n            return Optional.of(getterAnnotation);\n        }\n\n        T setterAnnotation = getMethodAnnotation(annotationClass, property.getSetterElement());\n        if (setterAnnotation != null) {\n            return Optional.of(setterAnnotation);\n        }\n\n        return Optional.empty();\n    }\n\n    /**\n     * An override of {@link #getAnnotationFromProperty(Class, Property)} in which it returns the results as a map so that the\n     * caller can decide which\n     * one to be used for read/write operation. Some annotations should have different behaviours based on the scope that\n     * they're applied on.\n     *\n     * @param annotationClass The annotation class to search\n     * @param property        The property to search in\n     * @param <T>             Annotation type\n     * @return A map of all occurrences of requested annotation for given property. Caller can determine based on\n     * {@link AnnotationTarget} that given\n     * annotation is specified on what level (Class, Property, Getter or Setter). If no annotation found for given property, an\n     * empty map would be\n     * returned\n     */\n    private <T extends Annotation> Map<AnnotationTarget, T> getAnnotationFromPropertyCategorized(Class<T> annotationClass,\n                                                                                                 Property property) {\n        Map<AnnotationTarget, T> result = new HashMap<>();\n        T fieldAnnotation = getFieldAnnotation(annotationClass, property.getFieldElement());\n        if (fieldAnnotation != null) {\n            result.put(AnnotationTarget.PROPERTY, fieldAnnotation);\n        }\n\n        T getterAnnotation = getMethodAnnotation(annotationClass, property.getGetterElement());\n        if (getterAnnotation != null) {\n            result.put(AnnotationTarget.GETTER, getterAnnotation);\n        }\n\n        T setterAnnotation = getMethodAnnotation(annotationClass, property.getSetterElement());\n        if (setterAnnotation != null) {\n            result.put(AnnotationTarget.SETTER, setterAnnotation);\n        }\n\n        return result;\n    }\n\n    private <T extends Annotation> T getFieldAnnotation(Class<T> annotationClass, JsonbAnnotatedElement<Field> fieldElement) {\n        if (fieldElement == null) {\n            return null;\n        }\n        return findAnnotation(fieldElement.getAnnotations(), annotationClass);\n    }\n\n    private <T extends Annotation> T findAnnotation(Annotation[] declaredAnnotations, Class<T> annotationClass) {\n        return AnnotationFinder.findAnnotation(declaredAnnotations, annotationClass, new HashSet<>());\n    }\n\n    /**\n     * Finds annotations incompatible with {@link JsonbTransient} annotation.\n     *\n     * @param target target to check\n     */\n    public void checkTransientIncompatible(JsonbAnnotatedElement<?> target) {\n        if (target == null) {\n            return;\n        }\n\n        for (Class<? extends Annotation> ann : TRANSIENT_INCOMPATIBLE) {\n            Annotation annotation = findAnnotation(target.getAnnotations(), ann);\n            if (annotation != null) {\n                throw new JsonbException(Messages.getMessage(MessageKeys.JSONB_TRANSIENT_WITH_OTHER_ANNOTATIONS));\n            }\n        }\n    }\n\n    private <T extends Annotation> T getMethodAnnotation(Class<T> annotationClass, JsonbAnnotatedElement<Method> methodElement) {\n        if (methodElement == null) {\n            return null;\n        }\n        return findAnnotation(methodElement.getAnnotations(), annotationClass);\n    }\n\n    private <T extends Annotation> void collectFromInterfaces(Class<T> annotationClass,\n                                                              Class<?> clazz,\n                                                              Map<Class<?>, T> collectedAnnotations) {\n\n        for (Class<?> interfaceClass : clazz.getInterfaces()) {\n            T annotation = findAnnotation(interfaceClass.getDeclaredAnnotations(), annotationClass);\n            if (annotation != null) {\n                collectedAnnotations.put(interfaceClass, annotation);\n            }\n            collectFromInterfaces(annotationClass, interfaceClass, collectedAnnotations);\n        }\n    }\n\n    /**\n     * Get class interfaces recursively.\n     *\n     * @param cls Class to process.\n     * @return A list of all class interfaces.\n     */\n    public Set<Class<?>> collectInterfaces(Class<?> cls) {\n        Set<Class<?>> collected = new LinkedHashSet<>();\n        Queue<Class<?>> toScan = new LinkedList<>(Arrays.asList(cls.getInterfaces()));\n        Class<?> nextIfc;\n        while ((nextIfc = toScan.poll()) != null) {\n            collected.add(nextIfc);\n            toScan.addAll(Arrays.asList(nextIfc.getInterfaces()));\n        }\n        return collected;\n    }\n\n    /**\n     * Processes customizations.\n     *\n     * @param clsElement             Element to process.\n     * @param propertyNamingStrategy The naming strategy to use for the ${@code JsonbConstructor} annotation,\n     *                               if set and no {@code JsonbProperty} annotations are present.\n     * @return Populated {@link ClassCustomization} instance.\n     */\n    public ClassCustomization introspectCustomization(JsonbAnnotatedElement<Class<?>> clsElement,\n                                                      ClassCustomization parentCustomization,\n                                                      PropertyNamingStrategy propertyNamingStrategy) {\n        return ClassCustomization.builder()\n                .nillable(isClassNillable(clsElement))\n                .dateTimeFormatter(getJsonbDateFormat(clsElement))\n                .numberFormatter(getJsonbNumberFormat(clsElement))\n                .creator(getCreator(clsElement.getElement(), propertyNamingStrategy))\n                .propertyOrder(getPropertyOrder(clsElement))\n                .adapterBinding(getAdapterBinding(clsElement))\n                .serializerBinding(getSerializerBinding(clsElement))\n                .deserializerBinding(getDeserializerBinding(clsElement))\n                .propertyVisibilityStrategy(getPropertyVisibilityStrategy(clsElement.getElement()))\n                .polymorphismConfig(getPolymorphismConfig(clsElement, parentCustomization))\n                .build();\n    }\n\n    private TypeInheritanceConfiguration getPolymorphismConfig(JsonbAnnotatedElement<Class<?>> clsElement,\n                                                               ClassCustomization parentCustomization) {\n        TypeInheritanceConfiguration parentPolyConfig = parentCustomization.getPolymorphismConfig();\n\n        LinkedList<AnnotationWrapper<?>> annotations = clsElement.getAnnotations(JsonbTypeInfo.class);\n\n        if (parentPolyConfig != null) {\n            if (annotations.size() == 1 && annotations.getFirst().isInherited()) {\n                throw new JsonbException(\"Cannot process type information from multiple sources! Sources: \"\n                                                 + parentPolyConfig.getDefinedType().getName() + \" and \"\n                                                 + annotations.getFirst());\n            } else if (annotations.size() > 1) {\n                throw new JsonbException(\"Cannot process type information from multiple sources! Sources: \" + annotations);\n            } else if (annotations.isEmpty()) {\n                return TypeInheritanceConfiguration.builder().of(parentPolyConfig)\n                        .inherited(true)\n                        .build();\n            }\n        }\n        ListIterator<AnnotationWrapper<?>> listIterator = annotations.listIterator(annotations.size());\n        while (listIterator.hasPrevious()) {\n            AnnotationWrapper<?> annotationWrapper = listIterator.previous();\n            JsonbTypeInfo annotation = (JsonbTypeInfo) annotationWrapper.getAnnotation();\n            TypeInheritanceConfiguration.Builder builder = TypeInheritanceConfiguration.builder();\n            builder.fieldName(annotation.key())\n                    .inherited(annotationWrapper.isInherited())\n                    .parentConfig(parentPolyConfig)\n                    .definedType(annotationWrapper.getDefinedType());\n            for (JsonbSubtype subType : annotation.value()) {\n                if (!annotationWrapper.getDefinedType().isAssignableFrom(subType.type())) {\n                    throw new JsonbException(\"Defined alias type has to be child of the current type. JsonbSubType on the \"\n                                                     + annotationWrapper.getDefinedType().getName()\n                                                     + \" defines incorrect alias \"\n                                                     + subType);\n                }\n                builder.alias(subType.type(), subType.alias());\n            }\n            parentPolyConfig = builder.build();\n        }\n\n        checkDuplicityPolymorphicPropertyNames(parentPolyConfig);\n\n        return parentPolyConfig;\n    }\n\n    private void checkDuplicityPolymorphicPropertyNames(TypeInheritanceConfiguration typeInheritanceConfiguration) {\n        if (typeInheritanceConfiguration == null) {\n            return;\n        }\n        Map<String, TypeInheritanceConfiguration> keyNames = new HashMap<>();\n        TypeInheritanceConfiguration current = typeInheritanceConfiguration;\n        while (current != null) {\n            String fieldName = current.getFieldName();\n            if (keyNames.containsKey(fieldName)) {\n                TypeInheritanceConfiguration conflicting = keyNames.get(fieldName);\n                throw new JsonbException(\"One polymorphic chain cannot have two conflicting property names. \"\n                                                 + \"Polymorphic type defined on the type \"\n                                                 + conflicting.getDefinedType().getName() + \" and \"\n                                                 + current.getDefinedType().getName() + \" have conflicting property name\");\n            }\n            keyNames.put(fieldName, current);\n            current = current.getParentConfig();\n        }\n    }\n\n    /**\n     * Returns class if {@link ImplementationClass} annotation is present.\n     *\n     * @param property annotated property\n     * @return Class if {@link ImplementationClass} is present otherwise null\n     */\n    public Class<?> getImplementationClass(Property property) {\n        Optional<ImplementationClass> annotationFromProperty = getAnnotationFromProperty(ImplementationClass.class, property);\n        return annotationFromProperty.<Class<?>>map(ImplementationClass::value).orElse(null);\n    }\n\n    /**\n     * Collect annotations of given class, its interfaces and the package.\n     *\n     * @param clazz Class to process.\n     * @return Element with class and annotations.\n     */\n    public JsonbAnnotatedElement<Class<?>> collectAnnotations(Class<?> clazz) {\n        JsonbAnnotatedElement<Class<?>> classElement = new JsonbAnnotatedElement<>(clazz);\n\n        if (BuiltInTypes.isKnownType(clazz)) {\n            return classElement;\n        }\n\n        Map<Class<? extends Annotation>, LinkedList<AnnotationWrapper<?>>> interfaceAnnotations\n                = collectInterfaceAnnotations(clazz, clazz);\n        for (LinkedList<AnnotationWrapper<?>> wrappers : interfaceAnnotations.values()) {\n            for (AnnotationWrapper<?> wrapper : wrappers) {\n                if (classElement.getAnnotation(wrapper.getAnnotation().annotationType()).isEmpty()\n                        || REPEATABLE.contains(wrapper.getAnnotation().annotationType())) {\n                    classElement.putAnnotationWrapper(wrapper);\n                }\n            }\n        }\n\n        if (!clazz.isPrimitive() && !clazz.isArray() && (clazz.getPackage() != null)) {\n            addIfNotPresent(classElement, null, clazz.getPackage().getAnnotations());\n        }\n        return classElement;\n    }\n\n    private Map<Class<? extends Annotation>, LinkedList<AnnotationWrapper<?>>> collectInterfaceAnnotations(Class<?> currentInterf,\n                                                                                                           Class<?> processed) {\n        Map<Class<? extends Annotation>, LinkedList<AnnotationWrapper<?>>> map = new HashMap<>();\n        if (!currentInterf.equals(processed)) {\n            for (Annotation annotation : currentInterf.getDeclaredAnnotations()) {\n                map.computeIfAbsent(annotation.annotationType(), aClass -> new LinkedList<>())\n                        .add(new AnnotationWrapper<>(annotation, true, currentInterf));\n            }\n        }\n\n        Map<Class<? extends Annotation>, LinkedList<AnnotationWrapper<?>>> parents = new HashMap<>();\n        for (Class<?> parentInterf : currentInterf.getInterfaces()) {\n            Map<Class<? extends Annotation>, LinkedList<AnnotationWrapper<?>>> current = collectInterfaceAnnotations(parentInterf,\n                                                                                                                     processed);\n            current.entrySet().stream()\n                    .filter(entry -> !parents.containsKey(entry.getKey()) || REPEATABLE.contains(entry.getKey()))\n                    .peek(entry -> {\n                        if (parents.containsKey(entry.getKey())) {\n                            throw new JsonbException(\"Cannot process annotation \" + entry.getKey().getName() + \" from multiple \"\n                                                             + \"parallel sources\");\n                        }\n                    })\n                    .forEach(entry -> {\n                        parents.computeIfAbsent(entry.getKey(), aClass -> new LinkedList<>()).addAll(entry.getValue());\n                        map.computeIfAbsent(entry.getKey(), aClass -> new LinkedList<>()).addAll(entry.getValue());\n                    });\n        }\n        return map;\n    }\n\n    //    private void collectParentInterfaceAnnotations(Class<?> currentInterf,\n    //                                                   Map<Class<? extends Annotation>, LinkedList<Annotation>> overall) {\n    //        Map<Class<? extends Annotation>, LinkedList<Annotation>> parents = new HashMap<>();\n    //        for (Class<?> parentInterf : currentInterf.getInterfaces()) {\n    //            collectParentInterfaceAnnotations(parentInterf, );\n    //            current.entrySet().stream()\n    //                    .filter(entry -> parents.containsKey(entry.getKey()) || REPEATABLE.contains(entry.getKey()))\n    //                    .peek(entry -> {\n    //                        if (parents.containsKey(entry.getKey())) {\n    //                            throw new JsonbException(\"CHANGE THIS EXCEPTION\");\n    //                        }\n    //                    })\n    //                    .forEach(entry -> {\n    //                        parents.computeIfAbsent(entry.getKey(), aClass -> new LinkedList<>()).addAll(entry.getValue());\n    //                        map.computeIfAbsent(entry.getKey(), aClass -> new LinkedList<>()).addAll(entry.getValue());\n    //                    });\n    //        }\n    //        if (currentInterf.isInterface()) {\n    //            for (Annotation annotation : currentInterf.getDeclaredAnnotations()) {\n    //                map.computeIfAbsent(annotation.annotationType(), aClass -> new LinkedList<>()).add(annotation);\n    //            }\n    //        }\n    //        return map;\n    //    }\n\n    private void addIfNotPresent(JsonbAnnotatedElement<?> element, Class<?> definedType, Annotation... annotations) {\n        for (Annotation annotation : annotations) {\n            if (element.getAnnotation(annotation.annotationType()).isEmpty()\n                    || REPEATABLE.contains(annotation.annotationType())) {\n                element.putAnnotation(annotation, true, definedType);\n            }\n        }\n    }\n\n    public boolean requiredParameters(Executable executable, JsonbAnnotatedElement<Parameter> annotated) {\n        return jsonbContext.getConfigProperties().hasRequiredCreatorParameters();\n        //        if (OPTIONALS.contains(annotated.getElement().getType())) {\n        //            return false;\n        //        }\n        //        return annotated.getAnnotation(JsonbRequired.class)\n        //                .or(() -> Optional.ofNullable(executable.getAnnotation(JsonbRequired.class)))\n        //                .map(JsonbRequired::value)\n        //                .orElseGet(() -> jsonbContext.getConfigProperties().hasRequiredCreatorParameters());\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/BuiltInTypes.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.net.URI;\nimport java.net.URL;\nimport java.nio.file.Path;\nimport java.time.Duration;\nimport java.time.Instant;\nimport java.time.LocalDate;\nimport java.time.LocalDateTime;\nimport java.time.LocalTime;\nimport java.time.OffsetDateTime;\nimport java.time.OffsetTime;\nimport java.time.Period;\nimport java.time.ZoneId;\nimport java.time.ZoneOffset;\nimport java.time.ZonedDateTime;\nimport java.util.Calendar;\nimport java.util.Collection;\nimport java.util.Date;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.OptionalDouble;\nimport java.util.OptionalInt;\nimport java.util.OptionalLong;\nimport java.util.Set;\nimport java.util.TimeZone;\nimport java.util.UUID;\n\nimport javax.xml.datatype.XMLGregorianCalendar;\n\nimport jakarta.json.JsonValue;\n\n/**\n * Types which are supported by the Yasson by default.\n */\npublic class BuiltInTypes {\n\n    private static final Set<Class<?>> BUILD_IN_SUPPORT;\n\n    static {\n        Set<Class<?>> buildInTypes = new HashSet<>();\n        buildInTypes.add(Byte.class);\n        buildInTypes.add(Byte.TYPE);\n        buildInTypes.add(BigDecimal.class);\n        buildInTypes.add(BigInteger.class);\n        buildInTypes.add(Boolean.class);\n        buildInTypes.add(Boolean.TYPE);\n        buildInTypes.add(Calendar.class);\n        buildInTypes.add(Character.class);\n        buildInTypes.add(Character.TYPE);\n        buildInTypes.add(Date.class);\n        buildInTypes.add(Double.class);\n        buildInTypes.add(Double.TYPE);\n        buildInTypes.add(Duration.class);\n        buildInTypes.add(Float.class);\n        buildInTypes.add(Float.TYPE);\n        buildInTypes.add(Integer.class);\n        buildInTypes.add(Integer.TYPE);\n        buildInTypes.add(Instant.class);\n        buildInTypes.add(LocalDateTime.class);\n        buildInTypes.add(LocalDate.class);\n        buildInTypes.add(LocalTime.class);\n        buildInTypes.add(Long.class);\n        buildInTypes.add(Long.TYPE);\n        buildInTypes.add(Number.class);\n        buildInTypes.add(OffsetDateTime.class);\n        buildInTypes.add(OffsetTime.class);\n        buildInTypes.add(OptionalDouble.class);\n        buildInTypes.add(OptionalInt.class);\n        buildInTypes.add(OptionalLong.class);\n        buildInTypes.add(Path.class);\n        buildInTypes.add(Period.class);\n        buildInTypes.add(Short.class);\n        buildInTypes.add(Short.TYPE);\n        buildInTypes.add(String.class);\n        buildInTypes.add(TimeZone.class);\n        buildInTypes.add(URI.class);\n        buildInTypes.add(URL.class);\n        buildInTypes.add(UUID.class);\n        if (isClassAvailable(\"javax.xml.datatype.XMLGregorianCalendar\")) {\n            buildInTypes.add(XMLGregorianCalendar.class);\n        }\n        buildInTypes.add(ZonedDateTime.class);\n        buildInTypes.add(ZoneId.class);\n        buildInTypes.add(ZoneOffset.class);\n        if (isClassAvailable(\"java.sql.Date\")) {\n            buildInTypes.add(java.sql.Date.class);\n            buildInTypes.add(java.sql.Timestamp.class);\n        }\n        BUILD_IN_SUPPORT = Set.copyOf(buildInTypes);\n    }\n\n    private BuiltInTypes() {\n        throw new IllegalStateException(\"Util class cannot be instantiated\");\n    }\n\n    /**\n     * Check whether the class is available.\n     *\n     * @param className name of the checked class\n     * @return true if available, otherwise false\n     */\n    public static boolean isClassAvailable(String className) {\n        try {\n            Class.forName(className);\n            return true;\n        } catch (ClassNotFoundException | LinkageError e) {\n            return false;\n        }\n    }\n\n    /**\n     * Whether the type is a supported type by default.\n     *\n     * @param clazz type to check\n     * @return whether is supported\n     */\n    public static boolean isKnownType(Class<?> clazz) {\n        boolean knownContainerValueType = Collection.class.isAssignableFrom(clazz)\n                || Map.class.isAssignableFrom(clazz)\n                || JsonValue.class.isAssignableFrom(clazz)\n                || Optional.class.isAssignableFrom(clazz)\n                || clazz.isArray();\n\n        return knownContainerValueType || findIfClassIsSupported(clazz);\n    }\n\n    private static boolean findIfClassIsSupported(Class<?> clazz) {\n        Class<?> current = clazz;\n        do {\n            if (BUILD_IN_SUPPORT.contains(current)) {\n                return true;\n            }\n            current = current.getSuperclass();\n        } while (current != null);\n        return false;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/ClassMultiReleaseExtension.java",
    "content": "/*\n * Copyright (c) 2021, 2024 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Method;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.config.PropertyNamingStrategy;\n\nimport org.eclipse.yasson.internal.model.JsonbCreator;\nimport org.eclipse.yasson.internal.model.Property;\n\n/**\n * Search for instance creator from other sources.\n * Mainly intended to add extensibility for different java versions and new features.\n */\npublic class ClassMultiReleaseExtension {\n\n    private ClassMultiReleaseExtension() {\n        throw new IllegalStateException(\"This class cannot be instantiated\");\n    }\n\n    static boolean shouldTransformToPropertyName(Method method) {\n        return true;\n    }\n\n    static boolean isSpecialAccessorMethod(Method method, Map<String, Property> classProperties) {\n        return false;\n    }\n\n    static JsonbCreator findCreator(Class<?> clazz,\n                                    Constructor<?>[] declaredConstructors,\n                                    AnnotationIntrospector introspector,\n                                    PropertyNamingStrategy propertyNamingStrategy) {\n        return null;\n    }\n\n    public static boolean isRecord(Class<?> clazz) {\n        return false;\n    }\n\n    public static Optional<JsonbException> exceptionToThrow(Class<?> clazz) {\n        return Optional.empty();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/ClassParser.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Modifier;\nimport java.security.AccessController;\nimport java.security.PrivilegedAction;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.stream.Collectors;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.config.PropertyVisibilityStrategy;\n\nimport org.eclipse.yasson.internal.model.ClassModel;\nimport org.eclipse.yasson.internal.model.CreatorModel;\nimport org.eclipse.yasson.internal.model.JsonbAnnotatedElement;\nimport org.eclipse.yasson.internal.model.JsonbCreator;\nimport org.eclipse.yasson.internal.model.Property;\nimport org.eclipse.yasson.internal.model.PropertyModel;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Created a class internal model.\n */\nclass ClassParser {\n\n    private static final String IS_PREFIX = \"is\";\n\n    private static final String GET_PREFIX = \"get\";\n\n    private static final String SET_PREFIX = \"set\";\n\n    private final JsonbContext jsonbContext;\n\n    ClassParser(JsonbContext jsonbContext) {\n        this.jsonbContext = jsonbContext;\n    }\n\n    /**\n     * Parse class fields and getters setters. Merge to java bean like properties.\n     */\n    void parseProperties(ClassModel classModel, JsonbAnnotatedElement<Class<?>> classElement) {\n        final Map<String, Property> classProperties = new HashMap<>();\n        parseFields(classElement, classProperties);\n        parseClassAndInterfaceMethods(classElement, classProperties);\n\n        //add sorted properties from parent, if they are not overridden in current class\n        //parent properties are by default first by alphabet, than properties from a subclass\n        final List<PropertyModel> sortedParentProperties = getSortedParentProperties(classModel, classElement, classProperties);\n\n        List<PropertyModel> classPropertyModels = classProperties.values().stream()\n                .map(property -> new PropertyModel(classModel, property, jsonbContext))\n                .collect(Collectors.toList());\n\n        //check for collision on same property read name\n        List<PropertyModel> unsortedMerged = new ArrayList<>(sortedParentProperties.size() + classPropertyModels.size());\n        unsortedMerged.addAll(sortedParentProperties);\n        unsortedMerged.addAll(classPropertyModels);\n        checkPropertyNameClash(unsortedMerged, classModel.getType());\n\n        mergePropertyModels(classPropertyModels);\n\n        List<PropertyModel> sortedPropertyModels = new ArrayList<>(sortedParentProperties.size() + classPropertyModels.size());\n        sortedPropertyModels.addAll(sortedParentProperties);\n        sortedPropertyModels.addAll(jsonbContext.getConfigProperties().getPropertyOrdering()\n                                            .orderProperties(classPropertyModels, classModel));\n\n        //reference property to creator parameter by name to merge configuration in runtime\n        JsonbCreator creator = classModel.getClassCustomization().getCreator();\n        if (creator != null) {\n            sortedPropertyModels.forEach(propertyModel -> {\n                for (CreatorModel creatorModel : creator.getParams()) {\n                    if (creatorModel.getName().equals(propertyModel.getPropertyName())) {\n                        creatorModel.getCustomization().setPropertyModel(propertyModel);\n                    }\n                }\n            });\n        }\n\n        classModel.setProperties(sortedPropertyModels);\n\n    }\n\n    private static void mergePropertyModels(List<PropertyModel> unsortedMerged) {\n        PropertyModel[] clone = unsortedMerged.toArray(new PropertyModel[0]);\n        for (int i = 0; i < clone.length; i++) {\n            for (int j = i + 1; j < clone.length; j++) {\n                PropertyModel firstPropertyModel = clone[i];\n                PropertyModel secondPropertyModel = clone[j];\n                if (firstPropertyModel.equals(secondPropertyModel)) {\n                    // Need to merge two properties\n                    unsortedMerged.remove(firstPropertyModel);\n                    unsortedMerged.remove(secondPropertyModel);\n                    if (!firstPropertyModel.isReadable() && !firstPropertyModel.isWritable()) {\n                        unsortedMerged.add(secondPropertyModel);\n                    } else if (!secondPropertyModel.isReadable() && !secondPropertyModel.isWritable()) {\n                        unsortedMerged.add(firstPropertyModel);\n                    } else {\n                        unsortedMerged.add(new PropertyModel(firstPropertyModel, secondPropertyModel));\n                    }\n                }\n            }\n        }\n    }\n\n    private void parseClassAndInterfaceMethods(JsonbAnnotatedElement<Class<?>> classElement,\n                                               Map<String, Property> classProperties) {\n        Class<?> concreteClass = classElement.getElement();\n        parseMethods(concreteClass, classElement, classProperties);\n        for (Class<?> ifc : jsonbContext.getAnnotationIntrospector().collectInterfaces(concreteClass)) {\n            parseIfaceMethodAnnotations(ifc, classElement, classProperties);\n        }\n    }\n\n    private void parseIfaceMethodAnnotations(Class<?> ifc,\n                                             JsonbAnnotatedElement<Class<?>> classElement,\n                                             Map<String, Property> classProperties) {\n        Method[] declaredMethods = AccessController.doPrivileged((PrivilegedAction<Method[]>) ifc::getDeclaredMethods);\n        for (Method method : declaredMethods) {\n            final String methodName = method.getName();\n            if (!isPropertyMethod(method)) {\n                continue;\n            }\n            String propertyName = toPropertyMethod(methodName);\n\n            Property property = classProperties.get(propertyName);\n\n            if (method.isDefault()) {\n                // Interface provides default implementation\n                if (property == null) {\n                    // the property does not yet exists : create it from scratch\n                    property = registerMethod(propertyName, method, classElement, classProperties);\n                } else {\n                    // property already exists, take care not overriding already parsed implementation\n                    if (isSetter(method)) {\n                        if (property.getSetter() == null) {\n                            property.setSetter(method);\n                        }\n                    } else {\n                        if (property.getGetter() == null) {\n                            property.setGetter(method);\n                        }\n                    }\n                }\n            }\n\n            if (property == null) {\n                //May happen for classes which both extend a class with some method and implement interface with same method.\n                continue;\n            }\n            JsonbAnnotatedElement<Method> methodElement = isGetter(method)\n                    ? property.getGetterElement() : property.getSetterElement();\n            //Only push iface annotations if not overridden on impl classes\n            for (Annotation ann : method.getDeclaredAnnotations()) {\n                if (methodElement.getAnnotation(ann.annotationType()).isEmpty()) {\n                    methodElement.putAnnotation(ann, true, null);\n                }\n            }\n        }\n    }\n\n    private Property registerMethod(String propertyName,\n                                    Method method,\n                                    JsonbAnnotatedElement<Class<?>> classElement,\n                                    Map<String, Property> classProperties) {\n        Property property = classProperties.computeIfAbsent(propertyName, n -> new Property(n, classElement));\n        if (isSetter(method)) {\n            property.setSetter(method);\n        } else {\n            property.setGetter(method);\n        }\n\n        return property;\n    }\n\n    private void parseMethods(Class<?> clazz,\n                              JsonbAnnotatedElement<Class<?>> classElement,\n                              Map<String, Property> classProperties) {\n        Method[] declaredMethods = AccessController.doPrivileged((PrivilegedAction<Method[]>) clazz::getDeclaredMethods);\n        for (Method method : declaredMethods) {\n            String name = method.getName();\n            //isBridge method filters out methods inherited from interfaces\n            boolean isAccessorMethod = ClassMultiReleaseExtension.isSpecialAccessorMethod(method, classProperties)\n                    || isPropertyMethod(method);\n            if (!isAccessorMethod || method.isBridge() || isSpecialCaseMethod(clazz, method)) {\n                continue;\n            }\n            final String propertyName = ClassMultiReleaseExtension.shouldTransformToPropertyName(method)\n                    ? toPropertyMethod(name)\n                    : name;\n\n            registerMethod(propertyName, method, classElement, classProperties);\n        }\n    }\n\n    /**\n     * Filter out certain methods that get forcibly added to some classes.\n     * For example the public groovy.lang.MetaClass X.getMetaClass() method from Groovy classes\n     */\n    private static boolean isSpecialCaseMethod(Class<?> clazz, Method m) {\n        if (!Modifier.isPublic(m.getModifiers()) || Modifier.isStatic(m.getModifiers()) || m.isSynthetic()) {\n            return false;\n        }\n        // Groovy objects will have public groovy.lang.MetaClass X.getMetaClass()\n        // which causes an infinite loop in serialization\n        if (m.getName().equals(\"getMetaClass\")\n                && m.getReturnType().getCanonicalName().equals(\"groovy.lang.MetaClass\")) {\n            return true;\n        }\n        // WELD proxy objects will have 'public org.jboss.weld\n        if (m.getName().equals(\"getMetadata\")\n                && m.getReturnType().getCanonicalName().equals(\"org.jboss.weld.proxy.WeldClientProxy$Metadata\")) {\n            return true;\n        }\n        return false;\n    }\n\n    private static boolean isGetter(Method m) {\n        return (m.getName().startsWith(GET_PREFIX) || m.getName().startsWith(IS_PREFIX)) && m.getParameterCount() == 0;\n    }\n\n    private static boolean isSetter(Method m) {\n        return m.getName().startsWith(SET_PREFIX) && m.getParameterCount() == 1;\n    }\n\n    private static String toPropertyMethod(String name) {\n        return lowerFirstLetter(name.substring(name.startsWith(IS_PREFIX) ? 2 : 3));\n    }\n\n    private static String lowerFirstLetter(String name) {\n        Objects.requireNonNull(name);\n        if (name.length() == 0) {\n            //methods named get() or set()\n            return name;\n        }\n        if (name.length() > 1\n                && Character.isUpperCase(name.charAt(1))\n                && Character.isUpperCase(name.charAt(0))) {\n            return name;\n        }\n        char[] chars = name.toCharArray();\n        chars[0] = Character.toLowerCase(chars[0]);\n        return new String(chars);\n    }\n\n    private static boolean isPropertyMethod(Method m) {\n        return isGetter(m) || isSetter(m);\n    }\n\n    private static void parseFields(JsonbAnnotatedElement<Class<?>> classElement, Map<String, Property> classProperties) {\n        Field[] declaredFields = AccessController.doPrivileged(\n                (PrivilegedAction<Field[]>) () -> classElement.getElement().getDeclaredFields());\n        for (Field field : declaredFields) {\n            final String name = field.getName();\n            if (field.isSynthetic()) {\n                continue;\n            }\n            final Property property = new Property(name, classElement);\n            property.setField(field);\n            classProperties.put(name, property);\n        }\n    }\n\n    private static void checkPropertyNameClash(List<PropertyModel> collectedProperties, Class<?> cls) {\n        final List<PropertyModel> checkedProperties = new ArrayList<>();\n        for (PropertyModel collectedPropertyModel : collectedProperties) {\n            for (PropertyModel checkedPropertyModel : checkedProperties) {\n                if ((checkedPropertyModel.getReadName().equals(collectedPropertyModel.getReadName())\n                        && checkedPropertyModel.isReadable() //\n                        && collectedPropertyModel.isReadable())\n                        || (checkedPropertyModel.getWriteName().equals(collectedPropertyModel.getWriteName())\n                                && checkedPropertyModel.isWritable() //\n                                && collectedPropertyModel.isWritable())) {\n                    throw new JsonbException(\n                            Messages.getMessage(MessageKeys.PROPERTY_NAME_CLASH, checkedPropertyModel.getPropertyName(),\n                                    collectedPropertyModel.getPropertyName(), cls.getName()));\n                }\n            }\n            checkedProperties.add(collectedPropertyModel);\n        }\n    }\n\n    /**\n     * Merges current class properties with parent class properties.\n     * If javabean property is declared in more than one inheritance levels,\n     * merge field, getters and setters of that property.\n     * <p>\n     * For example BaseClass contains field foo and getter getFoo. In BaseExtensions there is a setter setFoo.\n     * All three will be merged for BaseExtension.\n     * <p>\n     * Such property is sorted based on where its getter or field is located.\n     */\n    private List<PropertyModel> getSortedParentProperties(ClassModel classModel,\n                                                          JsonbAnnotatedElement<Class<?>> classElement,\n                                                          Map<String, Property> classProperties) {\n        List<PropertyModel> sortedProperties = new ArrayList<>();\n        //Pull properties from parent\n        if (classModel.getParentClassModel() != null) {\n            for (PropertyModel parentProp : classModel.getParentClassModel().getSortedProperties()) {\n                final Property current = classProperties.get(parentProp.getPropertyName());\n                //don't replace overridden properties\n                if (current == null) {\n                    sortedProperties.add(parentProp);\n                } else {\n                    //merge\n                    final Property merged = mergeProperty(current, parentProp, classElement);\n                    PropertyVisibilityStrategy propertyVisibilityStrategy = classModel.getClassCustomization()\n                            .getPropertyVisibilityStrategy();\n\n                    if (PropertyModel.isPropertyReadable(current.getField(), current.getGetter(), propertyVisibilityStrategy)) {\n                        classProperties.replace(current.getName(), merged);\n                    } else {\n                        sortedProperties.add(new PropertyModel(classModel, merged, jsonbContext));\n                        classProperties.remove(current.getName());\n                    }\n\n                }\n            }\n        }\n        return sortedProperties;\n    }\n\n    /**\n     * Select the correct method to use. The correct method is the most specific\n     * method which is not a default one:\n     * <ul>\n     * <li> if current is not defined, returns parent;</li>\n     * <li> if parent is not defined, returns current;</li>\n     * <li> if current is a default method and parent is not, returns parent;</li>\n     * <ul>\n     * <li><i>By definition, it is not possible to make a choice betweentwo default\n     * methods. <br/>Here, the most specific is selected, but a concrete\n     * implementation MUST eventually be provided as the source code won't even\n     * compile if such a method does not exist</i></li>\n     * </ul>\n     * <li> returns current otherwise</li>\n     * </ul>\n     *\n     * @param current current 'child' implementation\n     * @param parent  parent implementation\n     * @return effective method to register as getter or setter\n     */\n    private static Method selectMostSpecificNonDefaultMethod(Method current, Method parent) {\n        return (\n                current != null ? (\n                        parent != null && current.isDefault()\n                                && !parent.isDefault() ? parent : current) : parent);\n    }\n\n    private static Property mergeProperty(Property current,\n                                          PropertyModel parentProp,\n                                          JsonbAnnotatedElement<Class<?>> classElement) {\n        Field field = current.getField() != null\n                ? current.getField() : parentProp.getField();\n        Method getter = selectMostSpecificNonDefaultMethod(current.getGetter(),\n                                                           parentProp.getGetter());\n        Method setter = selectMostSpecificNonDefaultMethod(current.getSetter(),\n                                                           parentProp.getSetter());\n\n        Property merged = new Property(parentProp.getPropertyName(), classElement);\n        if (field != null) {\n            merged.setField(field);\n        }\n        if (getter != null) {\n            merged.setGetter(getter);\n        }\n        if (setter != null) {\n            merged.setSetter(setter);\n        }\n        return merged;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/ComponentMatcher.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.lang.reflect.TypeVariable;\nimport java.util.LinkedList;\nimport java.util.Objects;\nimport java.util.Optional;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentMap;\nimport java.util.function.Function;\n\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.adapter.JsonbAdapter;\nimport jakarta.json.bind.annotation.JsonbTypeSerializer;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.bind.serializer.JsonbSerializer;\n\nimport org.eclipse.yasson.internal.components.AbstractComponentBinding;\nimport org.eclipse.yasson.internal.components.AdapterBinding;\nimport org.eclipse.yasson.internal.components.ComponentBindings;\nimport org.eclipse.yasson.internal.components.DeserializerBinding;\nimport org.eclipse.yasson.internal.components.SerializerBinding;\nimport org.eclipse.yasson.internal.model.customization.ComponentBoundCustomization;\n\n/**\n * Searches for a registered components or Serializer for a given type.\n */\npublic class ComponentMatcher {\n\n    private final JsonbContext jsonbContext;\n\n    /**\n     * Flag for searching for generic serializers and adapters in runtime.\n     */\n    private volatile boolean genericComponents;\n\n    private final ConcurrentMap<Type, ComponentBindings> userComponents;\n\n    /**\n     * Create component matcher.\n     *\n     * @param context mandatory\n     */\n    ComponentMatcher(JsonbContext context) {\n        Objects.requireNonNull(context);\n        this.jsonbContext = context;\n        userComponents = new ConcurrentHashMap<>();\n        init();\n    }\n\n    /**\n     * Called during context creation, introspecting user components provided with JsonbConfig.\n     */\n    void init() {\n        final JsonbSerializer<?>[] serializers = (JsonbSerializer<?>[]) jsonbContext.getConfig()\n                .getProperty(JsonbConfig.SERIALIZERS).orElseGet(() -> new JsonbSerializer<?>[] {});\n        for (JsonbSerializer<?> serializer : serializers) {\n            SerializerBinding<?> serializerBinding = introspectSerializerBinding(serializer.getClass(), serializer);\n            addSerializer(serializerBinding.getBindingType(), serializerBinding);\n        }\n        final JsonbDeserializer<?>[] deserializers = (JsonbDeserializer<?>[]) jsonbContext.getConfig()\n                .getProperty(JsonbConfig.DESERIALIZERS).orElseGet(() -> new JsonbDeserializer<?>[] {});\n        for (JsonbDeserializer<?> deserializer : deserializers) {\n            DeserializerBinding<?> deserializerBinding = introspectDeserializerBinding(deserializer.getClass(), deserializer);\n            addDeserializer(deserializerBinding.getBindingType(), deserializerBinding);\n        }\n\n        final JsonbAdapter<?, ?>[] adapters = (JsonbAdapter<?, ?>[]) jsonbContext.getConfig().getProperty(JsonbConfig.ADAPTERS)\n                .orElseGet(() -> new JsonbAdapter<?, ?>[] {});\n        for (JsonbAdapter<?, ?> adapter : adapters) {\n            AdapterBinding adapterBinding = introspectAdapterBinding(adapter.getClass(), adapter);\n            addAdapter(adapterBinding.getBindingType(), adapterBinding);\n        }\n    }\n\n    private ComponentBindings getBindingInfo(Type type) {\n        return userComponents\n                .compute(type, (type1, bindingInfo) -> bindingInfo != null ? bindingInfo : new ComponentBindings(type1));\n    }\n\n    private void addSerializer(Type bindingType, SerializerBinding<?> serializer) {\n        userComponents.computeIfPresent(bindingType, (type, bindings) -> {\n            if (bindings.getSerializer() != null) {\n                return bindings;\n            }\n            registerGeneric(bindingType);\n            return new ComponentBindings(bindingType, serializer, bindings.getDeserializer(), bindings.getAdapterInfo());\n        });\n    }\n\n    private void addDeserializer(Type bindingType, DeserializerBinding<?> deserializer) {\n        userComponents.computeIfPresent(bindingType, (type, bindings) -> {\n            if (bindings.getDeserializer() != null) {\n                return bindings;\n            }\n            registerGeneric(bindingType);\n            return new ComponentBindings(bindingType, bindings.getSerializer(), deserializer, bindings.getAdapterInfo());\n        });\n    }\n\n    private void addAdapter(Type bindingType, AdapterBinding adapter) {\n        userComponents.computeIfPresent(bindingType, (type, bindings) -> {\n            if (bindings.getAdapterInfo() != null) {\n                return bindings;\n            }\n            registerGeneric(bindingType);\n            return new ComponentBindings(bindingType, bindings.getSerializer(), bindings.getDeserializer(), adapter);\n        });\n    }\n\n    /**\n     * If type is not parametrized runtime component resolution doesn't has to happen.\n     *\n     * @param bindingType component binding type\n     */\n    private void registerGeneric(Type bindingType) {\n        if (bindingType instanceof ParameterizedType && !genericComponents) {\n            genericComponents = true;\n        }\n    }\n\n    /**\n     * Lookup serializer binding for a given property runtime type.\n     *\n     * @param propertyRuntimeType runtime type of a property\n     * @param customization       with component info\n     * @return serializer optional\n     */\n    public Optional<SerializerBinding<?>> getSerializerBinding(Type propertyRuntimeType,\n                                                               ComponentBoundCustomization customization) {\n\n        if (customization == null || customization.getSerializerBinding() == null) {\n            return searchComponentBinding(propertyRuntimeType, ComponentBindings::getSerializer, this::getAnnotationBasedSerializer);\n        }\n        final SerializerBinding<?> binding = customization.getSerializerBinding();\n\n        // If the binding type exactly matches the runtime type, use it (optimization)\n        if (binding.getBindingType().equals(propertyRuntimeType)) {\n            return Optional.of(binding);\n        }\n\n        // Special handling for Object type: search for more specific serializers based on runtime type\n        // This allows annotation-based or config-based serializers on concrete types to be found\n        // when the property is declared as Object but has a specific runtime type\n        if (Object.class.equals(binding.getBindingType())) {\n            final Optional<SerializerBinding<?>> moreSpecific = searchComponentBinding(propertyRuntimeType,\n                ComponentBindings::getSerializer, this::getAnnotationBasedSerializer);\n            if (moreSpecific.isPresent()) {\n                return moreSpecific;\n            }\n        }\n\n        // Use the customization binding (user explicitly configured it for this property)\n        return Optional.of(binding);\n    }\n\n    /**\n     * Lookup deserializer binding for a given property runtime type.\n     *\n     * @param propertyRuntimeType runtime type of a property\n     * @param customization       customization with component info\n     * @return serializer optional\n     */\n    public Optional<DeserializerBinding<?>> getDeserializerBinding(Type propertyRuntimeType,\n                                                                   ComponentBoundCustomization customization) {\n        if (customization == null || customization.getDeserializerBinding() == null) {\n            return searchComponentBinding(propertyRuntimeType, ComponentBindings::getDeserializer);\n        }\n        return Optional.of(customization.getDeserializerBinding());\n    }\n\n    /**\n     * Get components from property model (if declared by annotation and runtime type matches),\n     * or return components searched by runtime type.\n     *\n     * @param propertyRuntimeType runtime type not null\n     * @param customization       customization with component info\n     * @return components info if present\n     */\n    public Optional<AdapterBinding> getSerializeAdapterBinding(Type propertyRuntimeType,\n                                                               ComponentBoundCustomization customization) {\n        if (customization == null || customization.getSerializeAdapterBinding() == null) {\n            return searchComponentBinding(propertyRuntimeType, ComponentBindings::getAdapterInfo);\n        }\n        // Check if the customization's adapter binding matches the runtime type\n        AdapterBinding binding = customization.getSerializeAdapterBinding();\n        if (matches(propertyRuntimeType, binding.getBindingType())) {\n            return Optional.of(binding);\n        }\n        // The annotation-based adapter doesn't match the runtime type,\n        // fall through to search for a better match based on runtime type\n        return searchComponentBinding(propertyRuntimeType, ComponentBindings::getAdapterInfo);\n    }\n\n    /**\n     * Get components from property model (if declared by annotation and runtime type matches),\n     * or return components searched by runtime type.\n     *\n     * @param propertyRuntimeType runtime type not null\n     * @param customization       customization with component info\n     * @return components info if present\n     */\n    public Optional<AdapterBinding> getDeserializeAdapterBinding(Type propertyRuntimeType,\n                                                                 ComponentBoundCustomization customization) {\n        if (customization == null || customization.getDeserializeAdapterBinding() == null) {\n            return searchComponentBinding(propertyRuntimeType, ComponentBindings::getAdapterInfo);\n        }\n        return Optional.of(customization.getDeserializeAdapterBinding());\n    }\n\n    /**\n     * Search for a component binding for the given runtime type.\n     *\n     * @param runtimeType         The runtime type to find a component for\n     * @param supplier            Function to extract the desired component from ComponentBindings\n     * @param annotationDiscovery Optional function for runtime annotation discovery (null if not applicable)\n     * @param <T>                 The type of component binding to search for\n     * @return Optional containing the component binding if found\n     */\n    private <T extends AbstractComponentBinding> Optional<T> searchComponentBinding(\n            Type runtimeType,\n            Function<ComponentBindings, T> supplier,\n            Function<Class<?>, Optional<T>> annotationDiscovery) {\n        // First check if there is an exact match\n        ComponentBindings binding = userComponents.get(runtimeType);\n        if (binding != null) {\n            Optional<T> match = getMatchingBinding(runtimeType, binding, supplier);\n            if (match.isPresent()) {\n               return match;\n            }\n        }\n        \n        Optional<Class<?>> runtimeClass = ReflectionUtils.getOptionalRawType(runtimeType);\n        if (runtimeClass.isPresent()) {\n            // Check for annotation-based component on the runtime type itself\n            // Currently only used for @JsonbTypeSerializer during serialization\n            if (annotationDiscovery != null) {\n                Optional<T> annotationBased = annotationDiscovery.apply(runtimeClass.get());\n                if (annotationBased.isPresent()) {\n                    return annotationBased;\n                }\n            }\n\n            // Check if any interfaces have a match\n            for (Class<?> ifc : runtimeClass.get().getInterfaces()) {\n                ComponentBindings ifcBinding = userComponents.get(ifc);\n                if (ifcBinding != null) {\n                  Optional<T> match = getMatchingBinding(ifc, ifcBinding, supplier);\n                  if (match.isPresent()) {\n                      return match;\n                  }\n                }\n            }\n            \n            // check if the superclass has a match\n            Class<?> superClass = runtimeClass.get().getSuperclass();\n            if (superClass != null && superClass != Object.class) {\n                Optional<T> superBinding = searchComponentBinding(superClass, supplier, annotationDiscovery);\n                if (superBinding.isPresent()) {\n                    return superBinding;\n                }\n            }\n        }\n        \n        return Optional.empty();\n    }\n\n    // Convenience overload for components without annotation discovery (deserializers, adapters)\n    private <T extends AbstractComponentBinding> Optional<T> searchComponentBinding(\n            final Type runtimeType,\n            final Function<ComponentBindings, T> supplier) {\n        return searchComponentBinding(runtimeType, supplier, null);\n    }\n\n    /**\n     * Discovers and caches a serializer defined by @JsonbTypeSerializer annotation on a runtime type.\n     *\n     * <p>This method performs <strong>runtime</strong> annotation discovery during serialization,\n     * which is distinct from the build-time annotation introspection performed by AnnotationIntrospector.\n     * It is invoked when serializing a property where the runtime type is more specific than the\n     * declared type (e.g., a property declared as {@code Object} containing an instance of a class\n     * annotated with @JsonbTypeSerializer).</p>\n     *\n     * <p>Note: Only @JsonbTypeSerializer is checked, not @JsonbTypeAdapter or @JsonbTypeDeserializer,\n     * because:</p>\n     * <ul>\n     *   <li>Serializers are unidirectional (serialization only), so runtime discovery is complete</li>\n     *   <li>Deserializers don't apply - we lack runtime type information during deserialization</li>\n     *   <li>Adapters are bidirectional - discovering them only at runtime during serialization\n     *       would be incomplete since they couldn't be discovered during deserialization</li>\n     * </ul>\n     *\n     * @param clazz The runtime class to check for @JsonbTypeSerializer annotation\n     * @return SerializerBinding if annotation is present and successfully introspected, empty otherwise\n     */\n    private Optional<SerializerBinding<?>> getAnnotationBasedSerializer(final Class<?> clazz) {\n        // Check if the class has a @JsonbTypeSerializer annotation\n        final JsonbTypeSerializer annotation = clazz.getAnnotation(JsonbTypeSerializer.class);\n        if (annotation == null) {\n            return Optional.empty();\n        }\n\n        // Thread-safe get-or-create using compute\n       final SerializerBinding<?> binding = userComponents.compute(clazz, (type, bindings) -> {\n            // If already cached, return as-is\n            if (bindings != null && bindings.getSerializer() != null) {\n                return bindings;\n            }\n\n            // Create new serializer binding\n            final Class<? extends JsonbSerializer> serializerClass = annotation.value();\n            final JsonbSerializer<?> serializer = jsonbContext.getComponentInstanceCreator().getOrCreateComponent(serializerClass);\n            final SerializerBinding<?> newBinding = new SerializerBinding<>(clazz, serializer);\n\n            // Create or update ComponentBindings\n            if (bindings == null) {\n                return new ComponentBindings(clazz, newBinding, null, null);\n            }\n            return new ComponentBindings(clazz, newBinding, bindings.getDeserializer(), bindings.getAdapterInfo());\n        }).getSerializer();\n\n        return Optional.ofNullable(binding);\n    }\n\n    private <T> Optional<T> getMatchingBinding(Type runtimeType, ComponentBindings binding, Function<ComponentBindings, T> supplier) {\n        final T component = supplier.apply(binding);\n        if (component != null && matches(runtimeType, binding.getBindingType())) {\n            return Optional.of(component);\n        }\n        return Optional.empty();\n    }\n\n    private boolean matches(Type runtimeType, Type componentBindingType) {\n        if (componentBindingType.equals(runtimeType)) {\n            return true;\n        }\n\n        if (componentBindingType instanceof Class && runtimeType instanceof Class) {\n            return ((Class<?>) componentBindingType).isAssignableFrom((Class<?>) runtimeType);\n        }\n\n        //don't try to runtime generic scan if not needed\n        if (!genericComponents) {\n            return false;\n        }\n\n        return runtimeType instanceof ParameterizedType && componentBindingType instanceof ParameterizedType\n                && ReflectionUtils.getRawType(componentBindingType).isAssignableFrom(ReflectionUtils.getRawType(runtimeType))\n                && matchTypeArguments((ParameterizedType) runtimeType, (ParameterizedType) componentBindingType);\n    }\n\n    /**\n     * If runtimeType to adapt is a ParametrizedType, check all type args to match against components args.\n     */\n    private boolean matchTypeArguments(ParameterizedType requiredType, ParameterizedType componentBound) {\n        final Type[] requiredTypeArguments = requiredType.getActualTypeArguments();\n        final Type[] adapterBoundTypeArguments = componentBound.getActualTypeArguments();\n        if (requiredTypeArguments.length != adapterBoundTypeArguments.length) {\n            return false;\n        }\n        for (int i = 0; i < requiredTypeArguments.length; i++) {\n            Type adapterTypeArgument = adapterBoundTypeArguments[i];\n            if (!requiredTypeArguments[i].equals(adapterTypeArgument)) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /**\n     * Introspect components generic information and put resolved types into metadata wrapper.\n     *\n     * @param adapterClass class of an components\n     * @param instance     components instance\n     * @return introspected info with resolved typevar types.\n     */\n    AdapterBinding introspectAdapterBinding(Class<? extends JsonbAdapter> adapterClass, JsonbAdapter instance) {\n        final ParameterizedType adapterRuntimeType = ReflectionUtils.findParameterizedType(adapterClass, JsonbAdapter.class);\n        final Type[] adapterTypeArguments = adapterRuntimeType.getActualTypeArguments();\n        Type adaptFromType = resolveTypeArg(adapterTypeArguments[0], adapterClass);\n        Type adaptToType = resolveTypeArg(adapterTypeArguments[1], adapterClass);\n        final ComponentBindings componentBindings = getBindingInfo(adaptFromType);\n        if (componentBindings.getAdapterInfo() != null && componentBindings.getAdapterInfo().getAdapter().getClass()\n                .equals(adapterClass)) {\n            return componentBindings.getAdapterInfo();\n        }\n        JsonbAdapter newAdapter = instance != null\n                ? instance\n                : jsonbContext.getComponentInstanceCreator().getOrCreateComponent(adapterClass);\n        return new AdapterBinding(adaptFromType, adaptToType, newAdapter);\n    }\n\n    /**\n     * If an instance of deserializerClass is present in context and is bound for same type, return that instance.\n     * Otherwise create new instance and set it to context.\n     *\n     * @param deserializerClass class of deserializer\n     * @param instance          instance to use if not cached already\n     * @return wrapper used in property models\n     */\n    @SuppressWarnings(\"unchecked\")\n    DeserializerBinding introspectDeserializerBinding(Class<? extends JsonbDeserializer> deserializerClass,\n                                                      JsonbDeserializer instance) {\n        final ParameterizedType deserializerRuntimeType = ReflectionUtils\n                .findParameterizedType(deserializerClass, JsonbDeserializer.class);\n        Type deserializerBindingType = resolveTypeArg(deserializerRuntimeType.getActualTypeArguments()[0], deserializerClass);\n        final ComponentBindings componentBindings = getBindingInfo(deserializerBindingType);\n        if (componentBindings.getDeserializer() != null && componentBindings.getDeserializer().getClass()\n                .equals(deserializerClass)) {\n            return componentBindings.getDeserializer();\n        } else {\n            JsonbDeserializer deserializer = instance != null ? instance : jsonbContext.getComponentInstanceCreator()\n                    .getOrCreateComponent(deserializerClass);\n            return new DeserializerBinding(deserializerBindingType, deserializer);\n        }\n    }\n\n    /**\n     * If an instance of serializerClass is present in context and is bound for same type, return that instance.\n     * Otherwise create new instance and set it to context.\n     *\n     * @param serializerClass class of deserializer\n     * @param instance        instance to use if not cached\n     * @return wrapper used in property models\n     */\n    @SuppressWarnings(\"unchecked\")\n    SerializerBinding introspectSerializerBinding(Class<? extends JsonbSerializer> serializerClass, JsonbSerializer instance) {\n        final ParameterizedType serializerRuntimeType = ReflectionUtils\n                .findParameterizedType(serializerClass, JsonbSerializer.class);\n        Type serBindingType = resolveTypeArg(serializerRuntimeType.getActualTypeArguments()[0], serializerClass);\n        final ComponentBindings componentBindings = getBindingInfo(serBindingType);\n        if (componentBindings.getSerializer() != null && componentBindings.getSerializer().getClass().equals(serializerClass)) {\n            return componentBindings.getSerializer();\n        } else {\n            JsonbSerializer serializer = instance != null ? instance : jsonbContext.getComponentInstanceCreator()\n                    .getOrCreateComponent(serializerClass);\n            return new SerializerBinding(serBindingType, serializer);\n        }\n\n    }\n\n    private Type resolveTypeArg(Type adapterTypeArg, Type adapterType) {\n        if (adapterTypeArg instanceof ParameterizedType) {\n            return ReflectionUtils.resolveTypeArguments((ParameterizedType) adapterTypeArg, adapterType);\n        } else if (adapterTypeArg instanceof TypeVariable) {\n            LinkedList<Type> chain = new LinkedList<>();\n            chain.add(adapterType);\n            return ReflectionUtils.resolveItemVariableType(chain, (TypeVariable<?>) adapterTypeArg, true);\n        } else {\n            return adapterTypeArg;\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/ConstructorPropertiesAnnotationIntrospector.java",
    "content": "/*\n * Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Executable;\nimport java.lang.reflect.Modifier;\nimport java.lang.reflect.Parameter;\nimport java.util.Arrays;\nimport java.util.logging.Logger;\n\nimport org.eclipse.yasson.internal.model.CreatorModel;\nimport org.eclipse.yasson.internal.model.JsonbCreator;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\nclass ConstructorPropertiesAnnotationIntrospector {\n\n    private static final Logger LOG = Logger.getLogger(ConstructorPropertiesAnnotationIntrospector.class.getName());\n\n    private final JsonbContext jsonbContext;\n    private final AnnotationFinder constructorProperties;\n\n    public static ConstructorPropertiesAnnotationIntrospector forContext(JsonbContext jsonbContext) {\n        return new ConstructorPropertiesAnnotationIntrospector(jsonbContext, AnnotationFinder.findConstructorProperties());\n    }\n\n    /**\n     * Only for testing and internal purposes.\n     * <p>\n     * Please use static factory methods e.g. {@link #forContext(JsonbContext)}.\n     *\n     * @param context          {@link JsonbContext}\n     * @param annotationFinder {@link AnnotationFinder}\n     */\n    protected ConstructorPropertiesAnnotationIntrospector(JsonbContext context, AnnotationFinder annotationFinder) {\n        this.jsonbContext = context;\n        this.constructorProperties = annotationFinder;\n    }\n\n    public JsonbCreator getCreator(Constructor<?>[] constructors) {\n        JsonbCreator jsonbCreator = null;\n\n        for (Constructor<?> constructor : constructors) {\n            Object properties = constructorProperties.valueIn(constructor.getDeclaredAnnotations());\n            if (!(properties instanceof String[])) {\n                continue;\n            }\n            if (!Modifier.isPublic(constructor.getModifiers())) {\n                String declaringClass = constructor.getDeclaringClass().getName();\n                String message = \"The constructor of {0} annotated with @ConstructorProperties {1} is not accessible and will \"\n                        + \"be ignored.\";\n                LOG.finest(String.format(message, declaringClass, Arrays.toString((String[]) properties)));\n                continue;\n            }\n            if (jsonbCreator != null) {\n                // don't fail in this case, because it is perfectly allowed to have more than one\n                // @ConstructorProperties-Annotation in general.\n                // It is just undefined, which constructor to choose for JSON in this case.\n                // The behavior should be the same (null), as if there is no ConstructorProperties-Annotation at all.\n                LOG.warning(Messages.getMessage(MessageKeys.MULTIPLE_CONSTRUCTOR_PROPERTIES_CREATORS,\n                                                constructor.getDeclaringClass().getName()));\n                return null;\n            }\n            jsonbCreator = createJsonbCreator(constructor, (String[]) properties);\n        }\n        return jsonbCreator;\n    }\n\n    private JsonbCreator createJsonbCreator(Executable executable, String[] properties) {\n        final Parameter[] parameters = executable.getParameters();\n\n        CreatorModel[] creatorModels = new CreatorModel[parameters.length];\n        for (int i = 0; i < parameters.length; i++) {\n            final Parameter parameter = parameters[i];\n            creatorModels[i] = new CreatorModel(properties[i], parameter, executable, jsonbContext);\n        }\n        return new JsonbCreator(executable, creatorModels);\n    }\n\n    @Override\n    public String toString() {\n        return \"ConstructorPropertiesAnnotationIntrospector [jsonbContext=\" + jsonbContext + \", constructorProperties=\" + constructorProperties + \"]\";\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/DeserializationContextImpl.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.lang.reflect.Type;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.deserializer.ModelDeserializer;\nimport org.eclipse.yasson.internal.model.customization.ClassCustomization;\nimport org.eclipse.yasson.internal.model.customization.Customization;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Deserialization context implementation.\n */\npublic class DeserializationContextImpl extends ProcessingContext implements DeserializationContext {\n    private final List<Runnable> delayedSetters = new ArrayList<>();\n    private JsonParser.Event lastValueEvent;\n    private Customization customization = ClassCustomization.empty();\n    private Object instance;\n\n    /**\n     * Parent instance for marshaller and unmarshaller.\n     *\n     * @param jsonbContext context of Jsonb\n     */\n    public DeserializationContextImpl(JsonbContext jsonbContext) {\n        super(jsonbContext);\n    }\n\n    /**\n     * Create new instance based on previous context.\n     *\n     * @param context previous deserialization context\n     */\n    public DeserializationContextImpl(DeserializationContextImpl context) {\n        super(context.getJsonbContext());\n        this.lastValueEvent = context.lastValueEvent;\n    }\n\n    /**\n     * Return instance of currently deserialized type.\n     *\n     * @return null if instance has not been created yet\n     */\n    public Object getInstance() {\n        return instance;\n    }\n\n    /**\n     * Set currently deserialized type instance.\n     *\n     * @param instance deserialized type instance\n     */\n    public void setInstance(Object instance) {\n        this.instance = instance;\n    }\n\n    /**\n     * Return the list of deferred deserializers.\n     *\n     * @return list of deferred deserializers\n     */\n    public List<Runnable> getDeferredDeserializers() {\n        return delayedSetters;\n    }\n\n    /**\n     * Return last obtained {@link JsonParser.Event} event.\n     *\n     * @return last obtained event\n     */\n    public JsonParser.Event getLastValueEvent() {\n        return lastValueEvent;\n    }\n\n    /**\n     * Set last obtained {@link JsonParser.Event} event.\n     *\n     * @param lastValueEvent last obtained event\n     */\n    public void setLastValueEvent(JsonParser.Event lastValueEvent) {\n        this.lastValueEvent = lastValueEvent;\n    }\n\n    /**\n     * Return customization used by currently processed user defined deserializer.\n     *\n     * @return currently used customization\n     */\n    public Customization getCustomization() {\n        return customization;\n    }\n\n    /**\n     * Set customization used by currently processed user defined deserializer.\n     *\n     * @param customization currently used customization\n     */\n    public void setCustomization(Customization customization) {\n        this.customization = customization;\n    }\n\n    @Override\n    public <T> T deserialize(Class<T> clazz, JsonParser parser) {\n        return deserializeItem(clazz, parser);\n    }\n\n    @Override\n    public <T> T deserialize(Type type, JsonParser parser) {\n        return deserializeItem(type, parser);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private <T> T deserializeItem(Type type, JsonParser parser) {\n        try {\n            if (lastValueEvent == null) {\n                lastValueEvent = parser.next();\n                checkState();\n            }\n            ModelDeserializer<JsonParser> modelDeserializer = getJsonbContext().getChainModelCreator().deserializerChain(type);\n            return (T) modelDeserializer.deserialize(parser, this);\n        } catch (JsonbException e) {\n            throw e;\n        } catch (RuntimeException e) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.INTERNAL_ERROR, e.getMessage()), e);\n        }\n    }\n\n    private void checkState() {\n        if (lastValueEvent == JsonParser.Event.KEY_NAME) {\n            throw new JsonbException(\"JsonParser has incorrect position as the first event: KEY_NAME\");\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/InstanceCreator.java",
    "content": "/*\n * Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.lang.reflect.Constructor;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.Map;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\nimport java.util.function.Supplier;\n\n/**\n * Creates instances for known types, caches constructors of unknown.\n * (Constructors of parsed types are stored in {@link org.eclipse.yasson.internal.model.ClassModel}).\n */\npublic class InstanceCreator {\n\n    private static final Map<Class<?>, Supplier<?>> CREATORS = new HashMap<>();\n\n    static {\n        CREATORS.put(ArrayList.class, ArrayList::new);\n        CREATORS.put(LinkedList.class, LinkedList::new);\n        CREATORS.put(HashSet.class, HashSet::new);\n        CREATORS.put(TreeSet.class, TreeSet::new);\n        CREATORS.put(HashMap.class, HashMap::new);\n        CREATORS.put(TreeMap.class, TreeMap::new);\n    }\n\n    private InstanceCreator() {\n        throw new IllegalStateException(\"This class should never be instantiated\");\n    }\n\n    /**\n     * Create an instance of the given class with its default constructor.\n     *\n     * @param tClass class to create instance\n     * @param <T>    Type of the class/instance\n     * @return crated instance\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <T> T createInstance(Class<T> tClass) {\n        Supplier<T> creator = (Supplier<T>) CREATORS.get(tClass);\n        //No worries for race conditions here, instance may be replaced during first attempt.\n        if (creator == null) {\n            Constructor<T> constructor = ReflectionUtils.getDefaultConstructor(tClass, true);\n            creator = () -> ReflectionUtils.createNoArgConstructorInstance(constructor);\n            CREATORS.put(tClass, creator);\n        }\n\n        return creator.get();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/JsonBinding.java",
    "content": "/*\n * Copyright (c) 2016, 2025 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.io.FilterWriter;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.Reader;\nimport java.io.StringReader;\nimport java.io.StringWriter;\nimport java.io.Writer;\nimport java.lang.reflect.Type;\nimport java.nio.charset.Charset;\nimport java.util.Map;\nimport java.util.Set;\n\nimport jakarta.json.JsonStructure;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.spi.JsonProvider;\nimport jakarta.json.stream.JsonGenerator;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.YassonJsonb;\nimport org.eclipse.yasson.internal.jsonstructure.JsonGeneratorToStructureAdapter;\nimport org.eclipse.yasson.internal.jsonstructure.JsonStructureToParserAdapter;\n\n/**\n * Implementation of Jsonb interface.\n */\npublic class JsonBinding implements YassonJsonb {\n\n    private final JsonbContext jsonbContext;\n\n    JsonBinding(JsonBindingBuilder builder) {\n        this.jsonbContext = new JsonbContext(builder.getConfig(), builder.getProvider().orElseGet(JsonProvider::provider));\n        Set<Class<?>> eagerInitClasses = this.jsonbContext.getConfigProperties().getEagerInitClasses();\n        for (Class<?> eagerInitClass : eagerInitClasses) {\n            // Eagerly initialize requested ClassModels and Serializers\n            jsonbContext.getChainModelCreator().deserializerChain(eagerInitClass);\n            jsonbContext.getSerializationModelCreator().serializerChain(eagerInitClass, true, true);\n        }\n    }\n\n    private <T> T deserialize(final Type type, final JsonParser parser, final DeserializationContextImpl unmarshaller) {\n        return unmarshaller.deserialize(type, parser);\n    }\n\n    @Override\n    public <T> T fromJson(String str, Class<T> type) throws JsonbException {\n        try (JsonParser parser = jsonbContext.getJsonProvider().createParser(new StringReader(str))) {\n            final DeserializationContextImpl unmarshaller = new DeserializationContextImpl(jsonbContext);\n            return deserialize(type, parser, unmarshaller);\n        }\n    }\n\n    @Override\n    public <T> T fromJson(String str, Type type) throws JsonbException {\n        try (JsonParser parser = jsonbContext.getJsonProvider().createParser(new StringReader(str))) {\n            DeserializationContextImpl unmarshaller = new DeserializationContextImpl(jsonbContext);\n            return deserialize(type, parser, unmarshaller);\n        }\n    }\n\n    @Override\n    public <T> T fromJson(Reader reader, Class<T> type) throws JsonbException {\n        try (JsonParser parser = jsonbContext.getJsonProvider().createParser(reader)) {\n            DeserializationContextImpl unmarshaller = new DeserializationContextImpl(jsonbContext);\n            return deserialize(type, parser, unmarshaller);\n        }\n    }\n\n    @Override\n    public <T> T fromJson(Reader reader, Type type) throws JsonbException {\n        try (JsonParser parser = jsonbContext.getJsonProvider().createParser(reader)) {\n            DeserializationContextImpl unmarshaller = new DeserializationContextImpl(jsonbContext);\n            return deserialize(type, parser, unmarshaller);\n        }\n    }\n\n    @Override\n    public <T> T fromJson(InputStream stream, Class<T> clazz) throws JsonbException {\n        DeserializationContextImpl unmarshaller = new DeserializationContextImpl(jsonbContext);\n        try (JsonParser parser = inputStreamParser(stream)) {\n            return deserialize(clazz, parser, unmarshaller);\n        }\n    }\n\n    @Override\n    public <T> T fromJson(InputStream stream, Type type) throws JsonbException {\n        DeserializationContextImpl unmarshaller = new DeserializationContextImpl(jsonbContext);\n        try (JsonParser parser = inputStreamParser(stream)) {\n            return deserialize(type, parser, unmarshaller);\n        }\n    }\n\n    @Override\n    public <T> T fromJsonStructure(JsonStructure jsonStructure, Class<T> type) throws JsonbException {\n        try (JsonParser parser = new JsonStructureToParserAdapter(jsonStructure)) {\n            return deserialize(type, parser, new DeserializationContextImpl(jsonbContext));\n        }\n    }\n\n    @Override\n    public <T> T fromJsonStructure(JsonStructure jsonStructure, Type runtimeType) throws JsonbException {\n        try (JsonParser parser = new JsonStructureToParserAdapter(jsonStructure)) {\n            return deserialize(runtimeType, parser, new DeserializationContextImpl(jsonbContext));\n        }\n    }\n\n    private JsonParser inputStreamParser(InputStream stream) {\n        return jsonbContext.getJsonParserFactory()\n                .createParser(stream,\n                              Charset.forName((String) jsonbContext.getConfig()\n                                      .getProperty(JsonbConfig.ENCODING).orElse(\"UTF-8\")));\n    }\n\n    @Override\n    public String toJson(Object object) throws JsonbException {\n        StringWriter writer = new StringWriter();\n        try (JsonGenerator generator = writerGenerator(writer)) {\n            new SerializationContextImpl(jsonbContext).marshall(object, generator);\n        }\n        return writer.toString();\n    }\n\n    @Override\n    public String toJson(Object object, Type type) throws JsonbException {\n        StringWriter writer = new StringWriter();\n        try (JsonGenerator generator = writerGenerator(writer)) {\n            new SerializationContextImpl(jsonbContext, type).marshall(object, generator);\n        }\n        return writer.toString();\n    }\n\n    @Override\n    public void toJson(Object object, Writer writer) throws JsonbException {\n        final SerializationContextImpl marshaller = new SerializationContextImpl(jsonbContext);\n        try (JsonGenerator generator = writerGenerator(new CloseSuppressingWriter(writer))) {\n            marshaller.marshallWithoutClose(object, generator);\n        }\n    }\n\n    @Override\n    public void toJson(Object object, Type type, Writer writer) throws JsonbException {\n        final SerializationContextImpl marshaller = new SerializationContextImpl(jsonbContext, type);\n        try (JsonGenerator generator = writerGenerator(new CloseSuppressingWriter(writer))) {\n            marshaller.marshallWithoutClose(object, generator);\n        }\n    }\n\n    private JsonGenerator writerGenerator(Writer writer) {\n        Map<String, ?> factoryProperties = jsonbContext.createJsonpProperties(jsonbContext.getConfig());\n        if (factoryProperties.isEmpty()) {\n            return jsonbContext.getJsonProvider().createGenerator(writer);\n        }\n        return jsonbContext.getJsonProvider().createGeneratorFactory(factoryProperties).createGenerator(writer);\n    }\n\n    @Override\n    public void toJson(Object object, OutputStream stream) throws JsonbException {\n        final SerializationContextImpl marshaller = new SerializationContextImpl(jsonbContext);\n        try (JsonGenerator generator = streamGenerator(stream)) {\n            marshaller.marshall(object, generator);\n        }\n    }\n\n    @Override\n    public void toJson(Object object, Type type, OutputStream stream) throws JsonbException {\n        final SerializationContextImpl marshaller = new SerializationContextImpl(jsonbContext, type);\n        try (JsonGenerator generator = streamGenerator(stream)) {\n            marshaller.marshall(object, generator);\n        }\n    }\n\n    @Override\n    public <T> T fromJson(JsonParser jsonParser, Class<T> type) throws JsonbException {\n        DeserializationContextImpl unmarshaller = new DeserializationContextImpl(jsonbContext);\n        return unmarshaller.deserialize(type, jsonParser);\n    }\n\n    @Override\n    public <T> T fromJson(JsonParser jsonParser, Type runtimeType) throws JsonbException {\n        DeserializationContextImpl unmarshaller = new DeserializationContextImpl(jsonbContext);\n        return unmarshaller.deserialize(runtimeType, jsonParser);\n    }\n\n    @Override\n    public void toJson(Object object, JsonGenerator jsonGenerator) throws JsonbException {\n        final SerializationContextImpl marshaller = new SerializationContextImpl(jsonbContext);\n        marshaller.marshallWithoutClose(object, jsonGenerator);\n    }\n\n    @Override\n    public void toJson(Object object, Type runtimeType, JsonGenerator jsonGenerator) throws JsonbException {\n        final SerializationContextImpl marshaller = new SerializationContextImpl(jsonbContext, runtimeType);\n        marshaller.marshallWithoutClose(object, jsonGenerator);\n    }\n\n    @Override\n    public JsonStructure toJsonStructure(Object object) throws JsonbException {\n        JsonGeneratorToStructureAdapter structureGenerator = new JsonGeneratorToStructureAdapter(jsonbContext.getJsonProvider());\n        final SerializationContextImpl marshaller = new SerializationContextImpl(jsonbContext);\n        marshaller.marshall(object, structureGenerator);\n        return structureGenerator.getRootStructure();\n    }\n\n    @Override\n    public JsonStructure toJsonStructure(Object object, Type runtimeType) throws JsonbException {\n        JsonGeneratorToStructureAdapter structureGenerator = new JsonGeneratorToStructureAdapter(jsonbContext.getJsonProvider());\n        final SerializationContextImpl marshaller = new SerializationContextImpl(jsonbContext, runtimeType);\n        marshaller.marshall(object, structureGenerator);\n        return structureGenerator.getRootStructure();\n    }\n\n    private JsonGenerator streamGenerator(OutputStream stream) {\n        Map<String, ?> factoryProperties = jsonbContext.createJsonpProperties(jsonbContext.getConfig());\n        final String encoding = (String) jsonbContext.getConfig().getProperty(JsonbConfig.ENCODING).orElse(\"UTF-8\");\n        return jsonbContext.getJsonProvider().createGeneratorFactory(factoryProperties)\n                .createGenerator(stream, Charset.forName(encoding));\n    }\n\n    @Override\n    public void close() throws Exception {\n        jsonbContext.getComponentInstanceCreator().close();\n    }\n\n    private static class CloseSuppressingWriter extends FilterWriter {\n\n        protected CloseSuppressingWriter(final Writer in) {\n            super(in);\n        }\n\n        @Override\n        public void close() {\n            // do not close\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/JsonBindingBuilder.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.util.Optional;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.spi.JsonProvider;\n\n/**\n * JsonbBuilder implementation.\n */\npublic class JsonBindingBuilder implements JsonbBuilder {\n    private JsonbConfig config = new JsonbConfig();\n    private JsonProvider provider = null;\n\n    @Override\n    public JsonbBuilder withConfig(JsonbConfig config) {\n        this.config = config;\n        return this;\n    }\n\n    @Override\n    public JsonbBuilder withProvider(JsonProvider jsonpProvider) {\n        this.provider = jsonpProvider;\n        return this;\n    }\n\n    /**\n     * Gets configuration.\n     *\n     * @return configuration.\n     */\n    public JsonbConfig getConfig() {\n        return config;\n    }\n\n    /**\n     * Gets provider.\n     *\n     * @return Provider.\n     */\n    public Optional<JsonProvider> getProvider() {\n        return Optional.ofNullable(provider);\n    }\n\n    @Override\n    public Jsonb build() {\n        return new JsonBinding(this);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/JsonbConfigProperties.java",
    "content": "/*\n * Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved.\n * Copyright (c) 2019, 2020 Payara Foundation and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.security.AccessController;\nimport java.security.PrivilegedAction;\nimport java.time.format.DateTimeFormatterBuilder;\nimport java.time.temporal.ChronoField;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Locale;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.Optional;\nimport java.util.Set;\nimport java.util.TreeMap;\nimport java.util.function.Consumer;\n\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport jakarta.json.bind.config.BinaryDataStrategy;\nimport jakarta.json.bind.config.PropertyNamingStrategy;\nimport jakarta.json.bind.config.PropertyOrderStrategy;\nimport jakarta.json.bind.config.PropertyVisibilityStrategy;\nimport jakarta.json.bind.serializer.JsonbSerializer;\n\nimport org.eclipse.yasson.YassonConfig;\nimport org.eclipse.yasson.internal.model.PropertyModel;\nimport org.eclipse.yasson.internal.model.ReverseTreeMap;\nimport org.eclipse.yasson.internal.model.customization.PropertyOrdering;\nimport org.eclipse.yasson.internal.model.customization.StrategiesProvider;\nimport org.eclipse.yasson.internal.model.customization.VisibilityStrategiesProvider;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Resolved properties from JSONB config.\n */\n@SuppressWarnings(\"rawtypes\")\npublic class JsonbConfigProperties {\n\n    private static final Map<String, Class<? extends Map>> PROPERTY_ORDER_STRATEGY_MAPS =\n            Map.of(PropertyOrderStrategy.LEXICOGRAPHICAL, TreeMap.class,\n                   PropertyOrderStrategy.REVERSE, ReverseTreeMap.class,\n                   PropertyOrderStrategy.ANY, HashMap.class);\n\n    private final JsonbConfig jsonbConfig;\n    private final PropertyVisibilityStrategy propertyVisibilityStrategy;\n    private final PropertyNamingStrategy propertyNamingStrategy;\n    private final PropertyOrdering propertyOrdering;\n    private final JsonbDateFormatter dateFormatter;\n    private final Locale locale;\n    private final String binaryDataStrategy;\n    private final boolean nullable;\n    private final boolean failOnUnknownProperties;\n    private final boolean strictIJson;\n    private final boolean zeroTimeDefaulting;\n    private final boolean requiredCreatorParameters;\n    private final boolean dateInMillisecondsAsString;\n    private final Map<Class<?>, Class<?>> userTypeMapping;\n    private final Class<?> defaultMapImplType;\n    private final JsonbSerializer<Object> nullSerializer;\n    private final Set<Class<?>> eagerInitClasses;\n    private final boolean forceMapArraySerializerForNullKeys;\n\n    /**\n     * Creates new resolved JSONB config.\n     *\n     * @param jsonbConfig jsonb config\n     */\n    public JsonbConfigProperties(JsonbConfig jsonbConfig) {\n        this.jsonbConfig = jsonbConfig;\n        this.binaryDataStrategy = initBinaryDataStrategy();\n        this.propertyNamingStrategy = initPropertyNamingStrategy();\n        this.propertyVisibilityStrategy = initPropertyVisibilityStrategy();\n        this.propertyOrdering = new PropertyOrdering(initOrderStrategy());\n        this.locale = initConfigLocale();\n        this.dateFormatter = initDateFormatter(this.locale);\n        this.nullable = initConfigNullable();\n        this.failOnUnknownProperties = initConfigFailOnUnknownProperties();\n        this.strictIJson = initStrictJson();\n        this.userTypeMapping = initUserTypeMapping();\n        this.zeroTimeDefaulting = initZeroTimeDefaultingForJavaTime();\n        this.defaultMapImplType = initDefaultMapImplType();\n        this.nullSerializer = initNullSerializer();\n        this.eagerInitClasses = initEagerInitClasses();\n        this.requiredCreatorParameters = initRequiredCreatorParameters();\n        this.forceMapArraySerializerForNullKeys = initForceMapArraySerializerForNullKeys();\n        this.dateInMillisecondsAsString = initDateInMillisecondsAsString();\n    }\n\n    private Class<? extends Map> initDefaultMapImplType() {\n        //We need to get PropertyOrderStrategy again. This time, if was not set, use ANY to get proper map implementation.\n        //This is intentional!\n        String propertyOrder = getConfigProperty(JsonbConfig.PROPERTY_ORDER_STRATEGY, String.class, PropertyOrderStrategy.ANY);\n        return PROPERTY_ORDER_STRATEGY_MAPS.getOrDefault(propertyOrder, HashMap.class);\n    }\n\n    private boolean initZeroTimeDefaultingForJavaTime() {\n        return getConfigProperty(YassonConfig.ZERO_TIME_PARSE_DEFAULTING, Boolean.class, false);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private Map<Class<?>, Class<?>> initUserTypeMapping() {\n        return getConfigProperty(YassonConfig.USER_TYPE_MAPPING, Map.class, Collections.emptyMap());\n    }\n\n    private JsonbDateFormatter initDateFormatter(Locale locale) {\n        final String dateFormat = getGlobalConfigJsonbDateFormat();\n        if (JsonbDateFormat.DEFAULT_FORMAT.equals(dateFormat) || JsonbDateFormat.TIME_IN_MILLIS.equals(dateFormat)) {\n            return new JsonbDateFormatter(dateFormat, locale.toLanguageTag());\n        }\n        DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder().appendPattern(dateFormat);\n        if (isZeroTimeDefaulting()) {\n            builder.parseDefaulting(ChronoField.SECOND_OF_MINUTE, 0);\n            builder.parseDefaulting(ChronoField.MINUTE_OF_HOUR, 0);\n            builder.parseDefaulting(ChronoField.HOUR_OF_DAY, 0);\n        }\n        return new JsonbDateFormatter(builder.toFormatter(locale), dateFormat, locale.toLanguageTag());\n    }\n\n    private String getGlobalConfigJsonbDateFormat() {\n        return getConfigProperty(JsonbConfig.DATE_FORMAT, String.class, JsonbDateFormat.DEFAULT_FORMAT);\n    }\n\n    private Consumer<List<PropertyModel>> initOrderStrategy() {\n        return StrategiesProvider.getOrderingFunction(getPropertyOrderStrategy());\n    }\n\n    private String getPropertyOrderStrategy() {\n        return getConfigProperty(JsonbConfig.PROPERTY_ORDER_STRATEGY, String.class, PropertyOrderStrategy.LEXICOGRAPHICAL);\n    }\n\n    private PropertyNamingStrategy initPropertyNamingStrategy() {\n        final Optional<Object> property = jsonbConfig.getProperty(JsonbConfig.PROPERTY_NAMING_STRATEGY);\n        if (property.isEmpty()) {\n            return StrategiesProvider.getPropertyNamingStrategy(PropertyNamingStrategy.IDENTITY);\n        }\n        Object propertyNamingStrategy = property.get();\n        if (propertyNamingStrategy instanceof String) {\n            return StrategiesProvider.getPropertyNamingStrategy((String) propertyNamingStrategy);\n        } else if (!(propertyNamingStrategy instanceof PropertyNamingStrategy)) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.PROPERTY_NAMING_STRATEGY_INVALID));\n        }\n        return (PropertyNamingStrategy) property.get();\n    }\n\n    private PropertyVisibilityStrategy initPropertyVisibilityStrategy() {\n        final Optional<Object> property = jsonbConfig.getProperty(JsonbConfig.PROPERTY_VISIBILITY_STRATEGY);\n        if (property.isEmpty()) {\n            return null;\n        }\n        final Object propertyVisibilityStrategy = property.get();\n        if (propertyVisibilityStrategy instanceof String) {\n            return VisibilityStrategiesProvider.getStrategy((String) propertyVisibilityStrategy);\n        } else if (!(propertyVisibilityStrategy instanceof PropertyVisibilityStrategy)) {\n            throw new JsonbException(\"JsonbConfig.PROPERTY_VISIBILITY_STRATEGY must be instance of \" + PropertyVisibilityStrategy.class);\n        }\n        return (PropertyVisibilityStrategy) propertyVisibilityStrategy;\n    }\n\n    private String initBinaryDataStrategy() {\n        if (getConfigProperty(JsonbConfig.STRICT_IJSON, Boolean.class, false)) {\n            return BinaryDataStrategy.BASE_64_URL;\n        }\n        return getConfigProperty(JsonbConfig.BINARY_DATA_STRATEGY, String.class, BinaryDataStrategy.BYTE);\n    }\n\n    private boolean initConfigNullable() {\n        return getConfigProperty(JsonbConfig.NULL_VALUES, Boolean.class, false);\n    }\n\n    private boolean initConfigFailOnUnknownProperties() {\n        return getConfigProperty(YassonConfig.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.class, false);\n    }\n\n    private boolean initRequiredCreatorParameters() {\n        String sysProp = AccessController.doPrivileged((PrivilegedAction<String>)\n                () -> System.getProperty(JsonbConfig.CREATOR_PARAMETERS_REQUIRED));\n\n        if (sysProp != null) {\n            return Boolean.parseBoolean(sysProp);\n        }\n        return getConfigProperty(JsonbConfig.CREATOR_PARAMETERS_REQUIRED, Boolean.class, false);\n    }\n\n    private boolean initDateInMillisecondsAsString() {\n        String sysProp = AccessController.doPrivileged((PrivilegedAction<String>)\n                () -> System.getProperty(YassonConfig.DATE_TIME_IN_MILLIS_AS_A_STRING));\n\n        if (sysProp != null) {\n            return Boolean.parseBoolean(sysProp);\n        }\n        return getConfigProperty(YassonConfig.DATE_TIME_IN_MILLIS_AS_A_STRING, Boolean.class, false);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private JsonbSerializer<Object> initNullSerializer() {\n        return jsonbConfig.getProperty(YassonConfig.NULL_ROOT_SERIALIZER)\n                .map(o -> {\n                    if (!(o instanceof JsonbSerializer)) {\n                        throw new JsonbException(\"YassonConfig.NULL_ROOT_SERIALIZER must be instance of \" + JsonbSerializer.class\n                                                         + \"<Object>\");\n                    }\n                    return (JsonbSerializer<Object>) o;\n                }).orElse(null);\n    }\n\n    private Set<Class<?>> initEagerInitClasses() {\n        Optional<Object> property = jsonbConfig.getProperty(YassonConfig.EAGER_PARSE_CLASSES);\n        if (property.isEmpty()) {\n            return Collections.emptySet();\n        }\n        Object eagerInitClasses = property.get();\n        if (!(eagerInitClasses instanceof Class<?>[])) {\n            throw new JsonbException(\"YassonConfig.EAGER_PARSE_CLASSES must be instance of Class<?>[]\");\n        }\n        return new HashSet<>(Arrays.asList((Class<?>[]) eagerInitClasses));\n    }\n\n    private boolean initForceMapArraySerializerForNullKeys() {\n        return getConfigProperty(YassonConfig.FORCE_MAP_ARRAY_SERIALIZER_FOR_NULL_KEYS, Boolean.class, false);\n    }\n\n    /**\n     * Gets nullable from {@link JsonbConfig}.\n     * If true null values are serialized to json.\n     *\n     * @return Configured nullable\n     */\n    public boolean getConfigNullable() {\n        return nullable;\n    }\n\n    /**\n     * Gets unknown properties flag from {@link JsonbConfig}.\n     * If false, {@link JsonbException} is not thrown for deserialization, when json key\n     * cannot be mapped to class property.\n     *\n     * @return {@link JsonbException} is risen on unknown property. Default is true even if\n     * not set in json config.\n     */\n    public boolean getConfigFailOnUnknownProperties() {\n        return failOnUnknownProperties;\n    }\n\n    private <T> T getConfigProperty(String propertyName, Class<T> propertyType, T defaultValue) {\n        Objects.requireNonNull(defaultValue, \"Default value cannot be null\");\n        return jsonbConfig.getProperty(propertyName)\n                .or(() -> Optional.of(defaultValue))\n                .filter(propertyType::isInstance)\n                .map(propertyType::cast)\n                .orElseThrow(() -> new JsonbException(Messages.getMessage(MessageKeys.JSONB_CONFIG_PROPERTY_INVALID_TYPE,\n                                                                          propertyName,\n                                                                          propertyType.getSimpleName())));\n    }\n\n    /**\n     * Checks for binary data strategy to use.\n     *\n     * @return Binary data strategy.\n     */\n    public String getBinaryDataStrategy() {\n        return binaryDataStrategy;\n    }\n\n    /**\n     * Converts string locale to {@link Locale}.\n     *\n     * @param locale Locale to convert.\n     * @return {@link Locale} instance.\n     */\n    public Locale getLocale(String locale) {\n        if (locale.equals(JsonbDateFormat.DEFAULT_LOCALE)) {\n            return this.locale;\n        }\n        return Locale.forLanguageTag(locale);\n    }\n\n    /**\n     * Gets locale from {@link JsonbConfig}.\n     *\n     * @return Configured locale.\n     */\n    private Locale initConfigLocale() {\n        return getConfigProperty(JsonbConfig.LOCALE, Locale.class, Locale.getDefault());\n    }\n\n    private boolean initStrictJson() {\n        return getConfigProperty(JsonbConfig.STRICT_IJSON, Boolean.class, false);\n    }\n\n    /**\n     * Gets property visibility strategy.\n     *\n     * @return Property visibility strategy.\n     */\n    public PropertyVisibilityStrategy getPropertyVisibilityStrategy() {\n        return propertyVisibilityStrategy;\n    }\n\n    /**\n     * Gets property naming strategy.\n     *\n     * @return Property naming strategy.\n     */\n    public PropertyNamingStrategy getPropertyNamingStrategy() {\n        return propertyNamingStrategy;\n    }\n\n    /**\n     * Gets instantiated shared config date formatter.\n     *\n     * @return Date formatter.\n     */\n    public JsonbDateFormatter getConfigDateFormatter() {\n        return dateFormatter;\n    }\n\n    /**\n     * Gets property ordering component.\n     *\n     * @return Component for ordering properties.\n     */\n    public PropertyOrdering getPropertyOrdering() {\n        return propertyOrdering;\n    }\n\n    /**\n     * If strict IJSON patterns should be used.\n     *\n     * @return if IJSON is enabled\n     */\n    public boolean isStrictIJson() {\n        return strictIJson;\n    }\n\n    /**\n     * User type mapping for map interface to implementation classes.\n     *\n     * @return User type mapping.\n     */\n    public Map<Class<?>, Class<?>> getUserTypeMapping() {\n        return userTypeMapping;\n    }\n\n    /**\n     * <p>Makes parsing dates defaulting to zero hour, minute and second.\n     * This will made available to parse patterns like yyyy.MM.dd to\n     * {@link java.util.Date}, {@link java.util.Calendar}, {@link java.time.Instant} {@link java.time.LocalDate}\n     * or even {@link java.time.ZonedDateTime}.\n     * <p>If time zone is not set in the pattern than UTC time zone is used.\n     * So for example json value 2018.01.01 becomes 2018.01.01 00:00:00 UTC when parsed\n     * to instant {@link java.time.Instant}.\n     *\n     * @return true if time should be defaulted to zero.\n     */\n    public boolean isZeroTimeDefaulting() {\n        return zeroTimeDefaulting;\n    }\n\n    /**\n     * Default {@link java.util.Map} implementation to use, based on order strategy.\n     *\n     * @return map impl type\n     */\n    public Class<?> getDefaultMapImplType() {\n        return defaultMapImplType;\n    }\n\n    public JsonbSerializer<Object> getNullSerializer() {\n        return nullSerializer;\n    }\n\n    public boolean hasRequiredCreatorParameters() {\n        return requiredCreatorParameters;\n    }\n\n    public Set<Class<?>> getEagerInitClasses() {\n        return eagerInitClasses;\n    }\n\n    /**\n     * Whether the MapToEntriesArraySerializer is selected when a null key\n     * is detected in a map.\n     *\n     * @return false or true\n     */\n    public boolean isForceMapArraySerializerForNullKeys() {\n        return forceMapArraySerializerForNullKeys;\n    }\n\n    public boolean isDateInMillisecondsAsString() {\n        return dateInMillisecondsAsString;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/JsonbContext.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.security.AccessController;\nimport java.security.PrivilegedAction;\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.Optional;\nimport java.util.ServiceLoader;\nimport java.util.logging.Logger;\n\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.spi.JsonProvider;\nimport jakarta.json.stream.JsonGenerator;\nimport jakarta.json.stream.JsonParserFactory;\n\nimport org.eclipse.yasson.internal.components.JsonbComponentInstanceCreatorFactory;\nimport org.eclipse.yasson.internal.deserializer.DeserializationModelCreator;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\nimport org.eclipse.yasson.internal.serializer.SerializationModelCreator;\nimport org.eclipse.yasson.spi.JsonbComponentInstanceCreator;\n\n/**\n * Jsonb context holding central components and configuration of jsonb runtime. Scoped to instance of Jsonb runtime.\n */\npublic class JsonbContext {\n\n    private static final Logger LOGGER = Logger.getLogger(JsonbContext.class.getName());\n\n    private final JsonbConfig jsonbConfig;\n\n    private final MappingContext mappingContext;\n\n    private final DeserializationModelCreator deserializationModelCreator;\n\n    private final SerializationModelCreator serializationModelCreator;\n\n    private final JsonbComponentInstanceCreator componentInstanceCreator;\n\n    private final JsonProvider jsonProvider;\n\n    private final JsonParserFactory jsonParserFactory;\n\n    private final ComponentMatcher componentMatcher;\n\n    private final AnnotationIntrospector annotationIntrospector;\n\n    private final JsonbConfigProperties configProperties;\n\n    /**\n     * Creates and initialize context.\n     *\n     * @param jsonbConfig  jsonb jsonbConfig not null\n     * @param jsonProvider provider of JSONP\n     */\n    public JsonbContext(JsonbConfig jsonbConfig, JsonProvider jsonProvider) {\n        Objects.requireNonNull(jsonbConfig);\n        this.jsonbConfig = jsonbConfig;\n        this.mappingContext = new MappingContext(this);\n        this.componentInstanceCreator = initComponentInstanceCreator();\n        this.componentMatcher = new ComponentMatcher(this);\n        this.annotationIntrospector = new AnnotationIntrospector(this);\n        this.jsonProvider = jsonProvider;\n        this.jsonParserFactory = initJsonParserFactory();\n        this.configProperties = new JsonbConfigProperties(jsonbConfig);\n        this.deserializationModelCreator = new DeserializationModelCreator(this);\n        this.serializationModelCreator = new SerializationModelCreator(this);\n    }\n\n    /**\n     * Gets {@link JsonbConfig}.\n     *\n     * @return Configuration.\n     */\n    public JsonbConfig getConfig() {\n        return jsonbConfig;\n    }\n\n    /**\n     * Gets mapping context.\n     *\n     * @return Mapping context.\n     */\n    public MappingContext getMappingContext() {\n        return mappingContext;\n    }\n\n    /**\n     * Get chain model creator.\n     *\n     * @return chain model creator\n     */\n    public DeserializationModelCreator getChainModelCreator() {\n        return deserializationModelCreator;\n    }\n\n    /**\n     * Get serialization model creator.\n     *\n     * @return serialization model creator\n     */\n    public SerializationModelCreator getSerializationModelCreator() {\n        return serializationModelCreator;\n    }\n\n    /**\n     * Gets JSONP provider.\n     *\n     * @return JSONP provider.\n     */\n    public JsonProvider getJsonProvider() {\n        return jsonProvider;\n    }\n\n    /**\n     * Implementation creating instances of user components used by JSONB, such as adapters and strategies.\n     *\n     * @return Instance creator.\n     */\n    public JsonbComponentInstanceCreator getComponentInstanceCreator() {\n        return componentInstanceCreator;\n    }\n\n    /**\n     * Component matcher for lookup of (de)serializers and adapters.\n     *\n     * @return Component matcher.\n     */\n    public ComponentMatcher getComponentMatcher() {\n        return componentMatcher;\n    }\n\n    /**\n     * Gets component for annotation parsing.\n     *\n     * @return Annotation introspector.\n     */\n    public AnnotationIntrospector getAnnotationIntrospector() {\n        return annotationIntrospector;\n    }\n\n    public JsonbConfigProperties getConfigProperties() {\n        return configProperties;\n    }\n\n    public JsonParserFactory getJsonParserFactory() {\n        return jsonParserFactory;\n    }\n\n    private JsonParserFactory initJsonParserFactory() {\n        return jsonProvider.createParserFactory(createJsonpProperties(jsonbConfig));\n    }\n\n    /**\n     * Propagates properties from JsonbConfig to JSONP generator / parser factories.\n     *\n     * @param jsonbConfig jsonb config\n     * @return properties for JSONP generator / parser\n     */\n    protected Map<String, ?> createJsonpProperties(JsonbConfig jsonbConfig) {\n        //JSONP 1.0 actually ignores the value, just checks the key is present. Only set if JsonbConfig.FORMATTING is true.\n        final Optional<Object> property = jsonbConfig.getProperty(JsonbConfig.FORMATTING);\n        final Map<String, Object> factoryProperties = new HashMap<>();\n        if (property.isPresent()) {\n            final Object value = property.get();\n            if (!(value instanceof Boolean)) {\n                throw new JsonbException(Messages.getMessage(MessageKeys.JSONB_CONFIG_FORMATTING_ILLEGAL_VALUE));\n            }\n            if ((Boolean) value) {\n                factoryProperties.put(JsonGenerator.PRETTY_PRINTING, Boolean.TRUE);\n            }\n            return factoryProperties;\n        }\n        return factoryProperties;\n    }\n\n    private JsonbComponentInstanceCreator initComponentInstanceCreator() {\n        ServiceLoader<JsonbComponentInstanceCreator> loader = AccessController\n                .doPrivileged((PrivilegedAction<ServiceLoader<JsonbComponentInstanceCreator>>) () -> ServiceLoader\n                        .load(JsonbComponentInstanceCreator.class));\n        List<JsonbComponentInstanceCreator> creators = new ArrayList<>();\n        for (JsonbComponentInstanceCreator creator : loader) {\n            creators.add(creator);\n        }\n        if (creators.isEmpty()) {\n            // No service provider found - use the defaults\n            return JsonbComponentInstanceCreatorFactory.getComponentInstanceCreator();\n        }\n        creators.sort(Comparator.comparingInt(JsonbComponentInstanceCreator::getPriority).reversed());\n        JsonbComponentInstanceCreator creator = creators.get(0);\n        LOGGER.finest(\"Component instance creator:\" + creator.getClass());\n        return creator;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/JsonbDateFormatter.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.time.format.DateTimeFormatter;\nimport java.time.format.DateTimeFormatterBuilder;\nimport java.util.Locale;\nimport java.util.Objects;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\n\nimport static java.time.temporal.ChronoField.HOUR_OF_DAY;\nimport static java.time.temporal.ChronoField.MINUTE_OF_HOUR;\nimport static java.time.temporal.ChronoField.SECOND_OF_MINUTE;\n\n/**\n * Formatter wrapper for different types of dates.\n */\npublic class JsonbDateFormatter {\n\n    private static final JsonbDateFormatter DEFAULT = new JsonbDateFormatter(JsonbDateFormat.DEFAULT_FORMAT,\n                                                                             Locale.getDefault().toLanguageTag());\n\n    /**\n     * Default I-JSON date time formatter.\n     */\n    public static final DateTimeFormatter IJSON_DATE_FORMATTER = new DateTimeFormatterBuilder()\n            .parseCaseInsensitive()\n            .append(DateTimeFormatter.ISO_LOCAL_DATE)\n            .appendLiteral('T')\n            .appendValue(HOUR_OF_DAY, 2)\n            .appendLiteral(':')\n            .appendValue(MINUTE_OF_HOUR, 2)\n            .appendLiteral(':')\n            .appendValue(SECOND_OF_MINUTE, 2)\n            .appendLiteral('Z')\n            .appendOffset(\"+HH:MM\", \"+00:00\")\n            .toFormatter();\n\n    private final DateTimeFormatter dateTimeFormatter;\n    private final String format;\n    private final String locale;\n\n    /**\n     * Creates an instance with cached {@link DateTimeFormatter}, format and locale.\n     *\n     * @param dateTimeFormatter Reused time formatter.\n     * @param format            Format in string.\n     * @param locale            Locale in string.\n     */\n    public JsonbDateFormatter(DateTimeFormatter dateTimeFormatter, String format, String locale) {\n        this.dateTimeFormatter = dateTimeFormatter;\n        this.format = format;\n        this.locale = locale;\n    }\n\n    /**\n     * Creates an instance with format string and locale.\n     * Formatter will be created on every formatting / parsing operation.\n     *\n     * @param format Formatter format.\n     * @param locale Locale in string.\n     */\n    public JsonbDateFormatter(String format, String locale) {\n        this.format = format;\n        this.locale = locale;\n        this.dateTimeFormatter = null;\n    }\n\n    /**\n     * Creates an instance with cached instance of {@link DateTimeFormatter}.\n     *\n     * @return Formatter instance.\n     */\n    public DateTimeFormatter getDateTimeFormatter() {\n        return dateTimeFormatter;\n    }\n\n    /**\n     * Format string to be used either by formatter.\n     * Needed for formatting {@link java.util.Date} with {@link java.text.SimpleDateFormat},\n     * which is not threadsafe.\n     *\n     * @return Format.\n     */\n    public String getFormat() {\n        return format;\n    }\n\n    /**\n     * Locale to use with formatter.\n     *\n     * @return Locale.\n     */\n    public String getLocale() {\n        return locale;\n    }\n\n    public static JsonbDateFormatter getDefault() {\n        return DEFAULT;\n    }\n\n    public boolean isDefault() {\n        return JsonbDateFormat.DEFAULT_FORMAT.equals(format);\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        JsonbDateFormatter that = (JsonbDateFormatter) o;\n        return Objects.equals(format, that.format)\n                && Objects.equals(locale, that.locale)\n                && Objects.equals(dateTimeFormatter, that.dateTimeFormatter);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(dateTimeFormatter, format, locale);\n    }\n\n    @Override\n    public String toString() {\n        return \"JsonbDateFormatter{\"\n                + \"dateTimeFormatter=\" + dateTimeFormatter\n                + \", format='\" + format + '\\''\n                + \", locale='\" + locale + '\\''\n                + '}';\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/JsonbNumberFormatter.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.util.Objects;\n\n/**\n * Formatter for numbers.\n */\npublic class JsonbNumberFormatter {\n\n    private final String format;\n\n    private final String locale;\n\n    /**\n     * Construct with format string and locale.\n     *\n     * @param format formatter format\n     * @param locale locale\n     */\n    public JsonbNumberFormatter(String format, String locale) {\n        this.format = format;\n        this.locale = locale;\n    }\n\n    /**\n     * Format string to be used either by formatter.\n     *\n     * @return format\n     */\n    public String getFormat() {\n        return format;\n    }\n\n    /**\n     * Locale to use with formatter.\n     *\n     * @return locale\n     */\n    public String getLocale() {\n        return locale;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        JsonbNumberFormatter that = (JsonbNumberFormatter) o;\n        return Objects.equals(format, that.format)\n                && Objects.equals(locale, that.locale);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(format, locale);\n    }\n\n    @Override\n    public String toString() {\n        return \"JsonbNumberFormatter{\"\n                + \"format='\" + format + '\\''\n                + \", locale='\" + locale + '\\''\n                + '}';\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/MappingContext.java",
    "content": "/*\n * Copyright (c) 2015, 2023 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.util.ArrayDeque;\nimport java.util.Deque;\nimport java.util.Objects;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.function.Function;\n\nimport org.eclipse.yasson.internal.model.ClassModel;\nimport org.eclipse.yasson.internal.model.JsonbAnnotatedElement;\nimport org.eclipse.yasson.internal.model.customization.ClassCustomization;\n\n/**\n * JSONB mappingContext. Created once per {@link jakarta.json.bind.Jsonb} instance. Represents a global scope.\n * Holds internal model.\n *\n * Thread safe.\n */\npublic class MappingContext {\n    private final JsonbContext jsonbContext;\n\n    private final ConcurrentHashMap<Class<?>, ClassModel> classes = new ConcurrentHashMap<>();\n\n    private final ClassParser classParser;\n\n    /**\n     * Create mapping context which is scoped to jsonb runtime.\n     *\n     * @param jsonbContext Context. Required.\n     */\n    public MappingContext(JsonbContext jsonbContext) {\n        Objects.requireNonNull(jsonbContext);\n        this.jsonbContext = jsonbContext;\n        this.classParser = new ClassParser(jsonbContext);\n    }\n\n    /**\n     * Searches for class model for given class. Returns the existing instance. Creates a new instance if\n     * it doesn't exist.\n     *\n     * @param clazz Class to search by or parse, not null.\n     * @return {@link ClassModel} for given class.\n     */\n    public ClassModel getOrCreateClassModel(Class<?> clazz) {\n        ClassModel classModel = classes.get(clazz);\n        if (classModel != null) {\n            return classModel;\n        }\n\n        Deque<Class<?>> newClassModels = new ArrayDeque<>();\n        for (Class<?> classToParse = clazz; classToParse != Object.class; classToParse = classToParse.getSuperclass()) {\n            if (classToParse == null) {\n                break;\n            }\n            newClassModels.push(classToParse);\n        }\n        if (clazz == Object.class) {\n            return classes.computeIfAbsent(clazz, (c) -> new ClassModel(c, ClassCustomization.empty(), null, null));\n        }\n\n        ClassModel parentClassModel = null;\n        while (!newClassModels.isEmpty()) {\n            Class<?> toParse = newClassModels.pop();\n            parentClassModel = classes\n                    .computeIfAbsent(toParse, createParseClassModelFunction(parentClassModel, classParser, jsonbContext));\n        }\n        return classes.get(clazz);\n    }\n\n    private static Function<Class<?>, ClassModel> createParseClassModelFunction(ClassModel parentClassModel,\n                                                                                ClassParser classParser,\n                                                                                JsonbContext jsonbContext) {\n        return aClass -> {\n            JsonbAnnotatedElement<Class<?>> clsElement = jsonbContext.getAnnotationIntrospector().collectAnnotations(aClass);\n            ClassCustomization customization = jsonbContext.getAnnotationIntrospector()\n                    .introspectCustomization(clsElement,\n                                             parentClassModel == null\n                                                     ? ClassCustomization.empty()\n                                                     : parentClassModel.getClassCustomization(),\n                                             jsonbContext.getConfigProperties().getPropertyNamingStrategy());\n            //            PolymorphismSupport configPolymorphism = jsonbContext.getConfigProperties().getPolymorphismSupport();\n//            if (configPolymorphism != null) {\n//                customization = mergeConfigAndAnnotationPolymorphism(configPolymorphism,\n//                                                                     configPolymorphism.getClassPolymorphism(aClass),\n//                                                                     customization,\n//                                                                     aClass);\n//            }\n            ClassModel newClassModel = new ClassModel(aClass,\n                                                      customization,\n                                                      parentClassModel,\n                                                      jsonbContext.getConfigProperties().getPropertyNamingStrategy());\n            if (!BuiltInTypes.isKnownType(aClass)) {\n                classParser.parseProperties(newClassModel, clsElement);\n            }\n            return newClassModel;\n        };\n    }\n\n//    private static ClassCustomization mergeConfigAndAnnotationPolymorphism(PolymorphismSupport generalPolymorphism,\n//                                                                           Optional<Polymorphism> maybeClassPolymorphism,\n//                                                                           ClassCustomization customization,\n//                                                                           Class<?> aClass) {\n//        PolymorphismConfig polymorphismConfig = customization.getPolymorphismConfig();\n//        PolymorphismConfig.Builder polyConfigBuilder;\n//        if (polymorphismConfig != null) {\n//            polyConfigBuilder = PolymorphismConfig.builder().of(polymorphismConfig);\n//        } else {\n//            polyConfigBuilder = PolymorphismConfig.builder();\n//            maybeClassPolymorphism.ifPresent(classPolymorphism -> polyConfigBuilder\n//                    .inherited(!classPolymorphism.getBoundClass().equals(aClass)));\n//        }\n//        generalPolymorphism.getKeyName().filter(s -> !s.isEmpty()).ifPresent(polyConfigBuilder::fieldName);\n//        generalPolymorphism.useClassNames().ifPresent(polyConfigBuilder::useClassNames);\n//        polyConfigBuilder.whitelistedPackages(generalPolymorphism.getWhitelistedPackages());\n//\n//        maybeClassPolymorphism.ifPresent(classPolymorphism -> {\n//            classPolymorphism.getKeyName().filter(s -> !s.isEmpty()).ifPresent(polyConfigBuilder::fieldName);\n//            classPolymorphism.useClassNames().ifPresent(polyConfigBuilder::useClassNames);\n//            classPolymorphism.getFormat().ifPresent(polyConfigBuilder::format);\n//            classPolymorphism.getAliases().forEach(polyConfigBuilder::alias);\n//            polyConfigBuilder.whitelistedPackages(classPolymorphism.getWhitelistedPackages());\n//        });\n//        PolymorphismConfig polyConfigMerged = polyConfigBuilder.build();\n//        if (polyConfigMerged.getFieldName() == null || polyConfigMerged.getFieldName().isEmpty()) {\n//            throw new JsonbException(\"Polymorphism type field name cannot be null or empty: \" + aClass);\n//        }\n//        return ClassCustomization.builder()\n//                .of(customization)\n//                .polymorphismConfig(polyConfigMerged)\n//                .build();\n//    }\n\n    /**\n     * Search for class model, without parsing if not found.\n     *\n     * @param clazz Class to search by or parse, not null.\n     * @return Model of a class if found.\n     */\n    public ClassModel getClassModel(Class<?> clazz) {\n        return classes.get(clazz);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/ProcessingContext.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\n/**\n * Jsonb processing (serializing/deserializing) context.\n * Instance is thread bound (in contrast to {@link JsonbContext}.\n */\npublic abstract class ProcessingContext {\n\n    private final JsonbContext jsonbContext;\n\n    /**\n     * Used to avoid StackOverflowError, when adapted / serialized object\n     * contains instance of its type inside it or when object has recursive reference.\n     */\n    private final Set<Object> currentlyProcessedObjects = new HashSet<>();\n\n    /**\n     * Parent for marshaller and unmarshaller.\n     *\n     * @param jsonbContext context of Jsonb\n     */\n    public ProcessingContext(JsonbContext jsonbContext) {\n        this.jsonbContext = jsonbContext;\n    }\n\n    /**\n     * Jsonb context.\n     *\n     * @return jsonb context\n     */\n    public JsonbContext getJsonbContext() {\n        return jsonbContext;\n    }\n\n    /**\n     * Mapping context.\n     *\n     * @return mapping context\n     */\n    public MappingContext getMappingContext() {\n        return getJsonbContext().getMappingContext();\n    }\n\n    /**\n     * Adds currently processed object to the {@link Set}.\n     *\n     * @param object processed object\n     * @return if object was added\n     */\n    public boolean addProcessedObject(Object object) {\n        return this.currentlyProcessedObjects.add(object);\n    }\n\n    /**\n     * Removes processed object from the {@link Set}.\n     *\n     * @param object processed object\n     * @return if object was removed\n     */\n    public boolean removeProcessedObject(Object object) {\n        return currentlyProcessedObjects.remove(object);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/ReflectionUtils.java",
    "content": "/*\n * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.GenericArrayType;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Modifier;\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.lang.reflect.TypeVariable;\nimport java.lang.reflect.WildcardType;\nimport java.security.AccessController;\nimport java.security.PrivilegedAction;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.Optional;\nimport java.util.logging.Logger;\n\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Utility class for resolution of generics during unmarshalling.\n */\npublic class ReflectionUtils {\n\n    private static final Logger LOGGER = Logger.getLogger(ReflectionUtils.class.getName());\n\n    private ReflectionUtils() {\n        throw new IllegalStateException(\"Utility classes should not be instantiated.\");\n    }\n\n    /**\n     * Get raw type by type.\n     * Only for ParametrizedTypes, GenericArrayTypes and Classes.\n     *\n     * Empty optional is returned if raw type cannot be resolved.\n     *\n     * @param type Type to get class information from, not null.\n     * @return Class of a type.\n     */\n    public static Optional<Class<?>> getOptionalRawType(Type type) {\n        if (type instanceof Class) {\n            return Optional.of((Class<?>) type);\n        } else if (type instanceof ParameterizedType) {\n            return Optional.of((Class<?>) ((ParameterizedType) type).getRawType());\n        } else if (type instanceof GenericArrayType) {\n            return Optional.of(((GenericArrayType) type).getClass());\n        } else if (type instanceof TypeVariable) {\n            TypeVariable<?> typeVariable = TypeVariable.class.cast(type);\n            if (Objects.nonNull(typeVariable.getBounds())) {\n                Optional<Class<?>> specializedClass = Optional.empty();\n                for (Type bound : typeVariable.getBounds()) {\n                    Optional<Class<?>> boundRawType = getOptionalRawType(bound);\n                    if (boundRawType.isPresent() && !Object.class.equals(boundRawType.get())) {\n                        if (!specializedClass.isPresent() || specializedClass.get().isAssignableFrom(boundRawType.get())) {\n                            specializedClass = Optional.of(boundRawType.get());\n                        }\n                    }\n                }\n                return specializedClass;\n            }\n        }\n        return Optional.empty();\n    }\n\n    /**\n     * Get raw type by type.\n     * Resolves only ParametrizedTypes, GenericArrayTypes and Classes.\n     *\n     * Exception is thrown if raw type cannot be resolved.\n     *\n     * @param type Type to get class information from, not null.\n     * @return Class of a raw type.\n     */\n    public static Class<?> getRawType(Type type) {\n        return getOptionalRawType(type)\n                .orElseThrow(() -> new JsonbException(Messages.getMessage(MessageKeys.TYPE_RESOLUTION_ERROR, type)));\n    }\n\n    /**\n     * Get a raw type of any type.\n     * If type is a {@link TypeVariable} recursively search type chain for resolution of typevar.\n     * If type is a {@link WildcardType} find most specific upper / lower bound, which can be used. If most specific\n     * bound is a {@link TypeVariable}, perform typevar resolution.\n     *\n     * @param chain hierarchy of all wrapping types.\n     * @param type  type to resolve, typically field type or generic bound, not null.\n     * @return resolved raw class\n     */\n    public static Class<?> resolveRawType(List<Type> chain, Type type) {\n        if (type instanceof Class) {\n            return (Class<?>) type;\n        } else if (type instanceof ParameterizedType) {\n            return (Class<?>) ((ParameterizedType) type).getRawType();\n        } else {\n            return getRawType(resolveType(chain, type));\n        }\n    }\n\n    /**\n     * Resolve a type by chain.\n     * If type is a {@link TypeVariable} recursively search type chain for resolution of typevar.\n     * If type is a {@link WildcardType} find most specific upper / lower bound, which can be used. If most specific\n     * bound is a {@link TypeVariable}, perform typevar resolution.\n     *\n     * @param chain hierarchy of all wrapping types.\n     * @param type  type to resolve, typically field type or generic bound, not null.\n     * @return resolved type\n     */\n    public static Type resolveType(List<Type> chain, Type type) {\n        return resolveType(chain, type, true);\n    }\n\n    private static Type resolveType(List<Type> chain, Type type, boolean warn) {\n        Type toResolve = type;\n        if (type instanceof GenericArrayType) {\n            toResolve = ((GenericArrayType) type).getGenericComponentType();\n            Type resolved = resolveType(chain, toResolve);\n            return new GenericArrayTypeImpl(resolved);\n        }\n        if (toResolve instanceof WildcardType) {\n            return resolveMostSpecificBound(chain, (WildcardType) toResolve, warn);\n        } else if (toResolve instanceof TypeVariable) {\n            return resolveItemVariableType(chain, (TypeVariable<?>) toResolve, warn);\n        } else if (toResolve instanceof ParameterizedType) {\n            return resolveTypeArguments((ParameterizedType) toResolve, chain.get(chain.size() - 1));\n        }\n        return type;\n    }\n\n    /**\n     * Resolves type by item information and wraps it with {@link Optional}.\n     *\n     * @param chain hierarchy of all wrapping types.\n     * @param type  type\n     * @return resolved type wrapped with Optional\n     */\n    public static Optional<Type> resolveOptionalType(List<Type> chain, Type type) {\n        try {\n            return Optional.of(resolveType(chain, type, false));\n        } catch (RuntimeException e) {\n            return Optional.empty();\n        }\n    }\n\n    /**\n     * Resolve a bounded type variable type by its wrapper types.\n     * Resolution could be done only if a compile time generic information is provided, either:\n     * by generic field or subclass of a generic class.\n     *\n     * @param chain        chain to search \"runtime\" generic type of a TypeVariable.\n     * @param typeVariable type to search in chain for, not null.\n     * @param warn         whether or not to log a warning message when bounds are not found\n     * @return Type of a generic \"runtime\" bound, not null.\n     */\n    public static Type resolveItemVariableType(List<Type> chain, TypeVariable<?> typeVariable, boolean warn) {\n//        if (chain == null) {\n//        Optional<Class<?>> optionalRawType = getOptionalRawType(typeVariable);\n//        if (optionalRawType.isPresent()) {\n//            return optionalRawType.get();\n//        }\n\n        //            //Bound not found, treat it as an Object.class\n//            if (warn) {\n//                LOGGER.warning(Messages.getMessage(MessageKeys.GENERIC_BOUND_NOT_FOUND,\n//                                                   typeVariable,\n//                                                   typeVariable.getGenericDeclaration()));\n//            }\n//            return Object.class;\n//        }\n        Type returnType = typeVariable;\n        for (int i = chain.size() - 1; i >= 0; i--) {\n            Type type = chain.get(i);\n            Type tmp = new VariableTypeInheritanceSearch().searchParametrizedType(type, (TypeVariable<?>) returnType);\n            if (tmp != null) {\n                returnType = tmp;\n            }\n            // If the type is a WildcardType we need to resolve the most specific type\n            if (returnType instanceof WildcardType) {\n                return resolveMostSpecificBound(chain, (WildcardType) returnType, warn);\n            }\n            if (!(returnType instanceof TypeVariable)) {\n                break;\n            }\n        }\n        if (returnType instanceof TypeVariable) {\n            //            throw new JsonbException(\"Could not resolve: \" + unresolvedType);\n            return Object.class;\n        }\n        return returnType;\n\n//        //Embedded items doesn't hold information about variable types\n//        if (chain instanceof EmbeddedItem) {\n//            return resolveItemVariableType(chain.getWrapper(), typeVariable, warn);\n//        }\n//\n//        ParameterizedType wrapperParameterizedType = findParameterizedSuperclass(chain.getRuntimeType());\n//\n//        VariableTypeInheritanceSearch search = new VariableTypeInheritanceSearch();\n//        Type foundType = search.searchParametrizedType(wrapperParameterizedType, typeVariable);\n//        if (foundType != null) {\n//            if (foundType instanceof TypeVariable) {\n//                return resolveItemVariableType(chain.getWrapper(), (TypeVariable<?>) foundType, warn);\n//            }\n//            return foundType;\n//        }\n//\n//        return resolveItemVariableType(chain.getWrapper(), typeVariable, warn);\n    }\n\n    /**\n     * Resolves {@link TypeVariable} arguments of generic types.\n     *\n     * @param typeToResolve type to resolve\n     * @param typeToSearch  type to search\n     * @return resolved type\n     */\n    public static Type resolveTypeArguments(ParameterizedType typeToResolve, Type typeToSearch) {\n        final Type[] unresolvedArgs = typeToResolve.getActualTypeArguments();\n        Type[] resolvedArgs = new Type[unresolvedArgs.length];\n        for (int i = 0; i < unresolvedArgs.length; i++) {\n            Type unresolvedArg = unresolvedArgs[i];\n            if (!(unresolvedArg instanceof TypeVariable) && !(unresolvedArg instanceof GenericArrayType)) {\n                resolvedArgs[i] = unresolvedArg;\n            } else {\n                Type variableType = unresolvedArg;\n                if (variableType instanceof GenericArrayType) {\n                    variableType = ((GenericArrayType) variableType).getGenericComponentType();\n                }\n                resolvedArgs[i] = new VariableTypeInheritanceSearch()\n                        .searchParametrizedType(typeToSearch, (TypeVariable<?>) variableType);\n                \n                if (resolvedArgs[i] == null) {\n                    Type[] bounds = ((TypeVariable<?>) variableType).getBounds();\n                    if (Objects.nonNull(bounds) && bounds.length > 0) {\n                        resolvedArgs[i] = bounds[0];\n                    }\n                }\n                \n                if (resolvedArgs[i] == null || resolvedArgs[i].equals(typeToResolve)) {\n                    if (typeToSearch instanceof Class) {\n                        return Object.class;\n                    }\n                    //No generic information available\n                    throw new IllegalStateException(Messages.getMessage(MessageKeys.GENERIC_BOUND_NOT_FOUND,\n                                                                        variableType,\n                                                                        typeToSearch));\n                }\n            }\n            if (resolvedArgs[i] instanceof ParameterizedType) {\n                resolvedArgs[i] = resolveTypeArguments((ParameterizedType) resolvedArgs[i], typeToSearch);\n            } else if (unresolvedArg instanceof GenericArrayType) {\n                resolvedArgs[i] = new GenericArrayTypeImpl(resolvedArgs[i]);\n            }\n        }\n        return Arrays.equals(resolvedArgs, unresolvedArgs)\n                ? typeToResolve\n                : new ResolvedParameterizedType(typeToResolve, resolvedArgs);\n    }\n\n    /**\n     * Create instance with constructor.\n     *\n     * @param constructor const not null\n     * @param <T>         type of instance\n     * @return instance\n     */\n    public static <T> T createNoArgConstructorInstance(Constructor<T> constructor) {\n        Objects.requireNonNull(constructor);\n        try {\n            return constructor.newInstance();\n        } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {\n            throw new JsonbException(\"Can't create instance\", e);\n        }\n    }\n\n    /**\n     * Get default no argument constructor of the class.\n     *\n     * @param clazz    Class to get constructor from\n     * @param <T>      Class generic type\n     * @param required if true, throws an exception if the default constructor is missing.\n     *                 If false, returns null in that case\n     * @return the constructor of the class, or null. Depending on required.\n     */\n    public static <T> Constructor<T> getDefaultConstructor(Class<T> clazz, boolean required) {\n        Objects.requireNonNull(clazz);\n        return AccessController.doPrivileged((PrivilegedAction<Constructor<T>>) () -> {\n            try {\n                final Constructor<T> declaredConstructor = clazz.getDeclaredConstructor();\n                if (declaredConstructor.getModifiers() == Modifier.PROTECTED) {\n                    declaredConstructor.setAccessible(true);\n                }\n                return declaredConstructor;\n            } catch (NoSuchMethodException | RuntimeException e) {\n                if (required) {\n                    throw new JsonbException(Messages.getMessage(MessageKeys.NO_DEFAULT_CONSTRUCTOR, clazz), e);\n                }\n                return null;\n            }\n        });\n    }\n\n    /**\n     * For generic adapters like:\n     * <p>\n     * {@code\n     * interface ContainerAdapter<T> extends JsonbAdapter<Box<T>, Crate<T>>...;\n     * class IntegerBoxToCrateAdapter implements ContainerAdapter<Integer>...;\n     * }\n     * </p>\n     * We need to find a JsonbAdapter class which will hold basic generic type arguments,\n     * and resolve them if they are TypeVariables from there.\n     *\n     * @param classToSearch          class to resolve parameterized interface\n     * @param parameterizedInterface interface to search\n     * @return type of JsonbAdapter\n     */\n    public static ParameterizedType findParameterizedType(Class<?> classToSearch, Class<?> parameterizedInterface) {\n        Class current = classToSearch;\n        while (current != Object.class) {\n            for (Type currentInterface : current.getGenericInterfaces()) {\n                if (currentInterface instanceof ParameterizedType\n                        && parameterizedInterface.isAssignableFrom(\n                        ReflectionUtils.getRawType(((ParameterizedType) currentInterface).getRawType()))) {\n                    return (ParameterizedType) currentInterface;\n                }\n            }\n            current = current.getSuperclass();\n        }\n        throw new JsonbException(Messages.getMessage(MessageKeys.NON_PARAMETRIZED_TYPE, parameterizedInterface));\n    }\n\n    /**\n     * Check if type needs resolution. If type is a class or a parametrized type with all type arguments as classes\n     * than it is considered resolved. If any of types is type variable or wildcard type is not resolved.\n     *\n     * @param type Type to check.\n     * @return True if resolved\n     */\n    public static boolean isResolvedType(Type type) {\n        if (type instanceof ParameterizedType) {\n            for (Type typeArg : ((ParameterizedType) type).getActualTypeArguments()) {\n                if (!isResolvedType(typeArg)) {\n                    return false;\n                }\n            }\n            return true;\n        }\n        return type instanceof Class<?>;\n    }\n\n    private static ParameterizedType findParameterizedSuperclass(Type type) {\n        if (type == null || type instanceof ParameterizedType) {\n            return (ParameterizedType) type;\n        }\n        if (!(type instanceof Class)) {\n            throw new JsonbException(\"Can't resolve ParameterizedType superclass for: \" + type);\n        }\n        return findParameterizedSuperclass(((Class) type).getGenericSuperclass());\n    }\n\n    /**\n     * Resolves a wildcard most specific upper or lower bound.\n     *\n     * @param chain         Type.\n     * @param wildcardType Wildcard type.\n     * @return The most specific type.\n     */\n    private static Type resolveMostSpecificBound(List<Type> chain, WildcardType wildcardType, boolean warn) {\n        Class<?> result = Object.class;\n        for (Type upperBound : wildcardType.getUpperBounds()) {\n            result = getMostSpecificBound(chain, result, upperBound, warn);\n        }\n        for (Type lowerBound : wildcardType.getLowerBounds()) {\n            result = getMostSpecificBound(chain, result, lowerBound, warn);\n        }\n        return result;\n    }\n\n    private static Class<?> getMostSpecificBound(List<Type> chain, Class<?> result, Type bound, boolean warn) {\n        if (bound == Object.class) {\n            return result;\n        }\n        //if bound is type variable search recursively for wrapper generic expansion\n        Type resolvedBoundType = bound instanceof TypeVariable ? resolveType(chain, bound, warn) : bound;\n        Class<?> boundRawType = getRawType(resolvedBoundType);\n        //resolved class is a subclass of a result candidate\n        if (result.isAssignableFrom(boundRawType)) {\n            result = boundRawType;\n        }\n        return result;\n    }\n\n    public static final class GenericArrayTypeImpl implements GenericArrayType {\n        private final Type genericComponentType;\n\n        // private constructor enforces use of static factory\n        private GenericArrayTypeImpl(Type ct) {\n            genericComponentType = ct;\n        }\n\n        /**\n         * Returns a {@code Type} object representing the component type\n         * of this array.\n         *\n         * @return a {@code Type} object representing the component type\n         *     of this array\n         * @since 1.5\n         */\n        public Type getGenericComponentType() {\n            return genericComponentType; // return cached component type\n        }\n\n        public String toString() {\n            return getGenericComponentType().getTypeName() + \"[]\";\n        }\n\n        @Override\n        public boolean equals(Object o) {\n            if (o instanceof GenericArrayType) {\n                GenericArrayType that = (GenericArrayType) o;\n\n                return Objects.equals(genericComponentType, that.getGenericComponentType());\n            } else {\n                return false;\n            }\n        }\n\n        @Override\n        public int hashCode() {\n            return Objects.hashCode(genericComponentType);\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/ResolvedParameterizedType.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.util.Arrays;\nimport java.util.Objects;\n\n/**\n * {@link ParameterizedType} implementation containing array of resolved TypeVariable type args.\n */\nclass ResolvedParameterizedType implements ParameterizedType {\n\n    /**\n     * Original parameterized type.\n     */\n    private final ParameterizedType original;\n\n    /**\n     * Resolved args by runtime type.\n     */\n    private final Type[] resolvedTypeArgs;\n\n    /**\n     * Creates a new instance.\n     *\n     * @param original         Original type.\n     * @param resolvedTypeArgs Resolved type arguments.\n     */\n    ResolvedParameterizedType(ParameterizedType original, Type[] resolvedTypeArgs) {\n        this.original = original;\n        this.resolvedTypeArgs = resolvedTypeArgs;\n    }\n\n    /**\n     * Type arguments with resolved TypeVariables.\n     *\n     * @return type args\n     */\n    @Override\n    public Type[] getActualTypeArguments() {\n        return resolvedTypeArgs;\n    }\n\n    @Override\n    public Type getRawType() {\n        return original.getRawType();\n    }\n\n    @Override\n    public Type getOwnerType() {\n        return original.getOwnerType();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder sb = new StringBuilder();\n        sb.append(original.toString());\n        if (resolvedTypeArgs != null && resolvedTypeArgs.length > 0) {\n            sb.append(\" resolved arguments: [\");\n            for (Type typeArg : resolvedTypeArgs) {\n                sb.append(typeArg);\n            }\n            sb.append(\"]\");\n        }\n        return sb.toString();\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || !(o instanceof ParameterizedType)) {\n            return false;\n        }\n        final ParameterizedType that = (ParameterizedType) o;\n        return this.getRawType().equals(that.getRawType())\n                && Objects.equals(this.getOwnerType(), that.getOwnerType())\n                && Arrays.equals(resolvedTypeArgs, that.getActualTypeArguments());\n    }\n\n    @Override\n    public int hashCode() {\n        return Arrays.hashCode(resolvedTypeArgs)\n                ^ (getOwnerType() == null ? 0 : getOwnerType().hashCode())\n                ^ (getRawType() == null ? 0 : getRawType().hashCode());\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/SerializationContextImpl.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n * Copyright (c) 2019, 2020 Payara Foundation and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.lang.reflect.Type;\nimport java.util.HashSet;\nimport java.util.Objects;\nimport java.util.Set;\nimport java.util.logging.Logger;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerationException;\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\nimport org.eclipse.yasson.internal.serializer.ModelSerializer;\n\n/**\n * JSONB marshaller. Created each time marshalling operation called.\n */\npublic class SerializationContextImpl extends ProcessingContext implements SerializationContext {\n\n    private static final Logger LOGGER = Logger.getLogger(SerializationContextImpl.class.getName());\n\n    /**\n     * Used to avoid StackOverflowError, when adapted / serialized object\n     * contains instance of its type inside it or when object has recursive reference.\n     */\n    private final Set<Object> currentlyProcessedObjects = new HashSet<>();\n\n    private final Type runtimeType;\n    private String key = null;\n    private boolean containerWithNulls = true;\n    private boolean root = true;\n\n    /**\n     * Creates Marshaller for generation to String.\n     *\n     * @param jsonbContext    Current context.\n     * @param rootRuntimeType Type of root object.\n     */\n    public SerializationContextImpl(JsonbContext jsonbContext, Type rootRuntimeType) {\n        super(jsonbContext);\n        this.runtimeType = rootRuntimeType;\n    }\n\n    /**\n     * Creates Marshaller for generation to String.\n     *\n     * @param jsonbContext Current context.\n     */\n    public SerializationContextImpl(JsonbContext jsonbContext) {\n        this(jsonbContext, null);\n    }\n\n    /**\n     * Set new current property key name.\n     *\n     * @param key key name\n     */\n    public void setKey(String key) {\n        this.key = key;\n    }\n\n    /**\n     * Current property key name.\n     *\n     * @return current property key name\n     */\n    public String getKey() {\n        return key;\n    }\n\n    /**\n     * Serialized value is a root value.\n     *\n     * @return is root value\n     */\n    public boolean isRoot() {\n        return root;\n    }\n\n    /**\n     * Set whether serialized value is root value.\n     *\n     * @param root is root value\n     */\n    public void setRoot(boolean root) {\n        this.root = root;\n    }\n\n    /**\n     * Value from this property is only used in {@link org.eclipse.yasson.internal.serializer.NullSerializer}.\n     * It should not be used anywhere else.\n     *\n     * @return if container supports nulls\n     */\n    public boolean isContainerWithNulls() {\n        return containerWithNulls;\n    }\n\n    /**\n     * Set if container supports null values.\n     *\n     * @param writeNulls should write nulls in container\n     */\n    public void setContainerWithNulls(boolean writeNulls) {\n        this.containerWithNulls = writeNulls;\n    }\n\n    /**\n     * Marshals given object to provided Writer or OutputStream.\n     *\n     * @param object        object to marshall\n     * @param jsonGenerator generator to use\n     * @param close         if generator should be closed\n     */\n    public void marshall(Object object, JsonGenerator jsonGenerator, boolean close) {\n        try {\n            serializeObject(object, jsonGenerator);\n        } catch (JsonbException e) {\n            throw e;\n        } catch (RuntimeException e) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.INTERNAL_ERROR, e.getMessage()), e);\n        } finally {\n            try {\n                if (close) {\n                    jsonGenerator.close();\n                } else {\n                    jsonGenerator.flush();\n                }\n            } catch (JsonGenerationException jge) {\n                LOGGER.severe(jge.getMessage());\n            }\n        }\n    }\n\n    /**\n     * Marshals given object to provided Writer or OutputStream.\n     * Closes the generator on completion.\n     *\n     * @param object        object to marshall\n     * @param jsonGenerator generator to use\n     */\n    public void marshall(Object object, JsonGenerator jsonGenerator) {\n        marshall(object, jsonGenerator, true);\n    }\n\n    /**\n     * Marshals given object to provided Writer or OutputStream.\n     * Leaves generator open for further interaction after completion.\n     *\n     * @param object        object to marshall\n     * @param jsonGenerator generator to use\n     */\n    public void marshallWithoutClose(Object object, JsonGenerator jsonGenerator) {\n        marshall(object, jsonGenerator, false);\n    }\n\n    @Override\n    public <T> void serialize(String key, T object, JsonGenerator generator) {\n        Objects.requireNonNull(key);\n        Objects.requireNonNull(object);\n        setKey(key);\n        serializeObject(object, generator);\n    }\n\n    @Override\n    public <T> void serialize(T object, JsonGenerator generator) {\n        Objects.requireNonNull(object);\n        serializeObject(object, generator);\n    }\n\n    /**\n     * Serializes root element.\n     *\n     * @param <T>       Root type\n     * @param root      Root.\n     * @param generator JSON generator.\n     */\n    public <T> void serializeObject(T root, JsonGenerator generator) {\n        Type type = determineSerializationType(root);\n        final ModelSerializer rootSerializer = getRootSerializer(type);\n        rootSerializer.serialize(root, generator, this);\n    }\n\n    private <T> Type determineSerializationType(T root) {\n        if (isRoot() && runtimeType != null) {\n            return runtimeType;\n        }\n        return root == null ? Object.class : root.getClass();\n    }\n\n    public ModelSerializer getRootSerializer(Type type) {\n        return getJsonbContext().getSerializationModelCreator().serializerChain(type, true, true);\n    }\n\n    /**\n     * Adds currently processed object to the {@link Set}.\n     *\n     * @param object processed object\n     * @return if object was added\n     */\n    public boolean addProcessedObject(Object object) {\n        return this.currentlyProcessedObjects.add(object);\n    }\n\n    /**\n     * Removes processed object from the {@link Set}.\n     *\n     * @param object processed object\n     * @return if object was removed\n     */\n    public boolean removeProcessedObject(Object object) {\n        return currentlyProcessedObjects.remove(object);\n    }\n\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/VariableTypeInheritanceSearch.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.lang.reflect.TypeVariable;\nimport java.util.ArrayDeque;\nimport java.util.Deque;\n\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Search for type variable in inheritance hierarchy and resolve if possible.\n */\nclass VariableTypeInheritanceSearch {\n\n    private final Deque<ParameterizedType> parameterizedSubclasses = new ArrayDeque<>();\n\n    /**\n     * Searches the hierarchy of classes to resolve a type variable. If typevar resolved value is another typevar redirection\n     * (propagated from wrapping class),\n     * this typevar is returned.\n     *\n     * <pre>\n     *\n     * Example 1: typevar is resolved\n     *\n     *\n     * class GenericClass &lt;T&gt; {\n     *     private T genericField;\n     * }\n     * class ConcreteClass extends GenericClass&lt;MyPojo&gt; {\n     *     //...\n     * }\n     *\n     * In above case when ConcreteClass type is passed as runtime type and &lt;T&gt; as type variable, T is resolved to MyPojo.\n     * </pre>\n     *\n     *\n     * <pre>\n     * Example 2: typevar is resolved to another propagated typevar\n     *\n     *\n     * class WrapperGenericClass&lt;X&gt; {\n     *     private GenericClass&lt;X&gt; propagatedGenericField\n     * }\n     *\n     * class AnotherClass extends WrapperGenericClass&lt;MyPojo&gt; {\n     * }\n     *\n     *\n     * In second case when GenericClass {@link ParameterizedType} is passed as runtime type and &lt;T&gt; as type variable,\n     * T is resolved to propagated &lt;X&gt; by WrapperGenericClass.\n     *\n     * Resolution on &lt;X&gt; must be performed thereafter with AnotherClass runtime type.\n     * </pre>\n     *\n     * @param typeToSearch runtime type to search for typevar in, not null\n     * @param typeVar      type variable to resolve, not null\n     * @return resolved runtime type, or type variable\n     */\n    Type searchParametrizedType(Type typeToSearch, TypeVariable<?> typeVar) {\n        ParameterizedType parameterizedType = findParameterizedSuperclass(typeToSearch);\n        if (parameterizedType == null) {\n            return null;\n        }\n        Type matchedGenericType = searchRuntimeTypeArgument(parameterizedType, typeVar);\n        if (matchedGenericType != null) {\n            return matchedGenericType;\n        }\n        parameterizedSubclasses.push(parameterizedType);\n        return searchParametrizedType(((Class) parameterizedType.getRawType()).getGenericSuperclass(), typeVar);\n    }\n\n    private Type checkSubclassRuntimeInfo(TypeVariable typeVar) {\n        if (parameterizedSubclasses.size() == 0) {\n            return typeVar;\n        }\n        ParameterizedType parametrizedSubclass = parameterizedSubclasses.pop();\n        return searchRuntimeTypeArgument(parametrizedSubclass, typeVar);\n    }\n\n    private Type searchRuntimeTypeArgument(ParameterizedType runtimeType, TypeVariable<?> typeVar) {\n        if (ReflectionUtils.getRawType(runtimeType) != typeVar.getGenericDeclaration()) {\n            return null;\n        }\n        TypeVariable[] bounds = typeVar.getGenericDeclaration().getTypeParameters();\n        for (int i = 0; i < bounds.length; i++) {\n            if (bounds[i].equals(typeVar)) {\n                Type matchedGenericType = runtimeType.getActualTypeArguments()[i];\n                //Propagated generic types to another generic classes\n                if (matchedGenericType instanceof TypeVariable<?>) {\n                    return checkSubclassRuntimeInfo((TypeVariable) matchedGenericType);\n                }\n                //found runtime matchedGenericType\n                return matchedGenericType;\n            }\n        }\n        return null;\n    }\n\n    private static ParameterizedType findParameterizedSuperclass(Type type) {\n        if (type == null || type instanceof ParameterizedType) {\n            return (ParameterizedType) type;\n        }\n        if (!(type instanceof Class)) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.RESOLVE_PARAMETRIZED_TYPE, type));\n        }\n        return findParameterizedSuperclass(((Class) type).getGenericSuperclass());\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/components/AbstractComponentBinding.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.components;\n\nimport java.lang.reflect.Type;\nimport java.util.Objects;\n\n/**\n * Wrapper for user components, components, (de)serializer.\n * Contains resolved binding type an component.\n */\npublic abstract class AbstractComponentBinding {\n\n    private final Type bindingType;\n\n    /**\n     * Creates info.\n     *\n     * @param bindingType type to which component is bound.\n     */\n    public AbstractComponentBinding(Type bindingType) {\n        Objects.requireNonNull(bindingType);\n        this.bindingType = bindingType;\n    }\n\n    /**\n     * Resolved binding type of a component.\n     *\n     * @return binding type\n     */\n    public Type getBindingType() {\n        return bindingType;\n    }\n\n    /**\n     * Class of user component.\n     *\n     * @return component class\n     */\n    public abstract Class<?> getComponentClass();\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/components/AdapterBinding.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.components;\n\nimport java.lang.reflect.Type;\nimport java.util.Objects;\n\nimport jakarta.json.bind.adapter.JsonbAdapter;\n\n/**\n * Wrapper for JsonbAdapter generic information and an components itself.\n */\npublic class AdapterBinding extends AbstractComponentBinding {\n\n    private final Type toType;\n\n    private final JsonbAdapter<?, ?> adapter;\n\n    /**\n     * Adapter info with type to \"adapt from\", type to \"adapt to\" and an components itself.\n     *\n     * @param fromType from not null\n     * @param toType   to not null\n     * @param adapter  components not null\n     */\n    public AdapterBinding(Type fromType, Type toType, JsonbAdapter<?, ?> adapter) {\n        super(fromType);\n        Objects.requireNonNull(toType);\n        Objects.requireNonNull(adapter);\n        this.toType = toType;\n        this.adapter = adapter;\n    }\n\n    /**\n     * Represents a type to which to adapt into.\n     *\n     * During marshalling object property is adapted to this type and result is marshalled.\n     * During unmarshalling object is unmarshalled into this type first, than converted to field type and set.\n     *\n     * @return Type from which to adapt\n     */\n    public Type getToType() {\n        return toType;\n    }\n\n    /**\n     * Get actual components to adapt object value.\n     *\n     * @return components\n     */\n    public JsonbAdapter<?, ?> getAdapter() {\n        return adapter;\n    }\n\n    @Override\n    public Class<?> getComponentClass() {\n        return adapter.getClass();\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/components/BeanManagerInstanceCreator.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.components;\n\nimport java.io.IOException;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentMap;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InjectionTarget;\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.internal.JsonBinding;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\nimport org.eclipse.yasson.spi.JsonbComponentInstanceCreator;\n\n/**\n * CDI instance manager.\n * Instances are created and stored per instance of {@link JsonBinding}.\n * Calling close on JsonBinding, cleans up Jsonb CDI instances and in case of \"dependant\" scope its dependencies.\n *\n * CDI API dependency is optional, this class is never referenced / loaded if CDI API is not resolvable.\n */\npublic class BeanManagerInstanceCreator implements JsonbComponentInstanceCreator {\n\n    private final BeanManager beanManager;\n\n    private final ConcurrentMap<Class<?>, CDIManagedBean<?>> injectionTargets = new ConcurrentHashMap<>();\n\n    /**\n     * Creates a new instance.\n     *\n     * @param beanManager Bean manager.\n     */\n    public BeanManagerInstanceCreator(Object beanManager) {\n        if (!(beanManager instanceof BeanManager)) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.INTERNAL_ERROR,\n                                                         \"beanManager instance should be of type '\" + BeanManager.class + \"'\"));\n        }\n        this.beanManager = (BeanManager) beanManager;\n    }\n\n    /**\n     * Creates an instance of the CDI managed bean.\n     * Calls CDI API to inject into the bean.\n     *\n     * @param componentClass bean class to be instantiated.\n     * @return New instance of bean class with injected content.\n     */\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public <T> T getOrCreateComponent(Class<T> componentClass) {\n        return (T) injectionTargets.computeIfAbsent(componentClass, clazz -> {\n            final AnnotatedType<T> aType = beanManager.createAnnotatedType(componentClass);\n            final InjectionTarget<T> injectionTarget = beanManager.getInjectionTargetFactory(aType)\n                    .createInjectionTarget(null);\n            CreationalContext<T> creationalContext = beanManager.createCreationalContext(null);\n            final T beanInstance = injectionTarget.produce(creationalContext);\n            injectionTarget.inject(beanInstance, creationalContext);\n            injectionTarget.postConstruct(beanInstance);\n            return new CDIManagedBean(beanInstance, injectionTarget, creationalContext);\n        }).getInstance();\n    }\n\n    @Override\n    public void close() throws IOException {\n        injectionTargets.forEach((clazz, target) -> cleanupBean(target));\n        injectionTargets.clear();\n    }\n\n    private <T> void cleanupBean(CDIManagedBean<T> bean) {\n        bean.getInjectionTarget().preDestroy(bean.getInstance());\n        bean.getInjectionTarget().dispose(bean.getInstance());\n        bean.getCreationalContext().release();\n    }\n\n    /**\n     * Holder for bean instance and its injection target.\n     */\n    private static final class CDIManagedBean<T> {\n        private final T instance;\n        private final InjectionTarget<T> injectionTarget;\n        private final CreationalContext<T> creationalContext;\n\n        CDIManagedBean(T instance, InjectionTarget<T> injectionTarget, CreationalContext<T> creationalContext) {\n            this.instance = instance;\n            this.injectionTarget = injectionTarget;\n            this.creationalContext = creationalContext;\n        }\n\n        /**\n         * @return CDI InjectionTarget\n         */\n        private InjectionTarget<T> getInjectionTarget() {\n            return injectionTarget;\n        }\n\n        /**\n         * @return managed instance of a bean\n         */\n        private T getInstance() {\n            return instance;\n        }\n\n        /**\n         * @return creational context\n         */\n        private CreationalContext<T> getCreationalContext() {\n            return creationalContext;\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/components/ComponentBindings.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.components;\n\nimport java.lang.reflect.Type;\n\n/**\n * Wrapper holding singleton instances of user defined components - Adapters, (De)Serializers.\n */\npublic class ComponentBindings {\n\n    private final Type bindingType;\n\n    private final SerializerBinding serializer;\n\n    private final DeserializerBinding deserializer;\n\n    private final AdapterBinding adapterInfo;\n\n    /**\n     * Construct empty bindings for a given type.\n     *\n     * @param bindingType type components are bound to\n     */\n    public ComponentBindings(Type bindingType) {\n        this(bindingType, null, null, null);\n    }\n\n    /**\n     * Creates an instance and populates it with bindings for a given type.\n     *\n     * @param bindingType  Type components are bound to.\n     * @param serializer   Serializer.\n     * @param deserializer Deserializer.\n     * @param adapter      Adapter.\n     */\n    public ComponentBindings(Type bindingType,\n                             SerializerBinding serializer,\n                             DeserializerBinding deserializer,\n                             AdapterBinding adapter) {\n        this.bindingType = bindingType;\n        this.serializer = serializer;\n        this.deserializer = deserializer;\n        this.adapterInfo = adapter;\n    }\n\n    /**\n     * Type to which components are bound.\n     *\n     * @return Bound type.\n     */\n    public Type getBindingType() {\n        return bindingType;\n    }\n\n    /**\n     * Serializer if any.\n     *\n     * @return serializer\n     */\n    public SerializerBinding getSerializer() {\n        return serializer;\n    }\n\n    /**\n     * Deserializer if any.\n     *\n     * @return deserializer\n     */\n    public DeserializerBinding getDeserializer() {\n        return deserializer;\n    }\n\n    /**\n     * Adapter info if any.\n     *\n     * @return adapterInfo\n     */\n    public AdapterBinding getAdapterInfo() {\n        return adapterInfo;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/components/DefaultConstructorCreator.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.components;\n\nimport java.io.IOException;\n\nimport org.eclipse.yasson.internal.InstanceCreator;\nimport org.eclipse.yasson.spi.JsonbComponentInstanceCreator;\n\n/**\n * Creates components instance with default constructor.\n */\npublic class DefaultConstructorCreator implements JsonbComponentInstanceCreator {\n\n    @Override\n    public <T> T getOrCreateComponent(Class<T> componentClass) {\n        return InstanceCreator.createInstance(componentClass);\n    }\n\n    @Override\n    public void close() throws IOException {\n\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/components/DeserializerBinding.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.components;\n\nimport java.lang.reflect.Type;\n\nimport jakarta.json.bind.serializer.JsonbDeserializer;\n\n/**\n * Component containing deserializer.\n *\n * @param <T> type of contained deserializer\n */\npublic class DeserializerBinding<T> extends AbstractComponentBinding {\n\n    private final JsonbDeserializer<T> jsonbDeserializer;\n\n    /**\n     * Creates a new instance.\n     *\n     * @param bindingType       Binding type.\n     * @param jsonbDeserializer Deserializer.\n     */\n    public DeserializerBinding(Type bindingType, JsonbDeserializer<T> jsonbDeserializer) {\n        super(bindingType);\n        this.jsonbDeserializer = jsonbDeserializer;\n    }\n\n    /**\n     * Gets deserializer if any.\n     *\n     * @return Deserializer.\n     */\n    public JsonbDeserializer<T> getJsonbDeserializer() {\n        return jsonbDeserializer;\n    }\n\n    @Override\n    public Class<?> getComponentClass() {\n        return jsonbDeserializer.getClass();\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/components/JsonbComponentInstanceCreatorFactory.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.components;\n\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Method;\nimport java.security.AccessController;\nimport java.security.PrivilegedAction;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\nimport org.eclipse.yasson.spi.JsonbComponentInstanceCreator;\n\n/**\n * Factory method for default Jsonb component instance creators.\n */\npublic class JsonbComponentInstanceCreatorFactory {\n\n    private static final Logger LOGGER = Logger.getLogger(JsonbComponentInstanceCreator.class.getName());\n\n    private JsonbComponentInstanceCreatorFactory() {\n        throw new IllegalStateException(\"This class should never be instantiated\");\n    }\n\n    /**\n     * JNDI bean manager name.\n     */\n    public static final String BEAN_MANAGER_NAME = \"java:comp/BeanManager\";\n\n    /**\n     * Initial context class.\n     */\n    public static final String INITIAL_CONTEXT_CLASS = \"javax.naming.InitialContext\";\n    private static final String CDI_SPI_CLASS = \"jakarta.enterprise.inject.spi.CDI\";\n\n    /**\n     * First check a CDI provider, if available use those.\n     * Try to lookup in a JNDI if no provider is registered.\n     * If one of the above is found {@link BeanManagerInstanceCreator} is returned,\n     * or {@link DefaultConstructorCreator} otherwise.\n     *\n     * @return Component instance creator, either CDI or default constructor.\n     */\n    public static JsonbComponentInstanceCreator getComponentInstanceCreator() {\n        Object beanManager = getCdiBeanManager();\n        if (beanManager == null) {\n            beanManager = getJndiBeanManager();\n        }\n        if (beanManager == null) {\n            LOGGER.finest(Messages.getMessage(MessageKeys.BEAN_MANAGER_NOT_FOUND_USING_DEFAULT));\n            return new DefaultConstructorCreator();\n        }\n        return new BeanManagerInstanceCreator(beanManager);\n    }\n\n    /**\n     * Get bean manager with CDI api.\n     *\n     * @return bean manager instance or null if CDI API dependency is not available.\n     */\n    private static Object getCdiBeanManager() {\n        return AccessController.doPrivileged((PrivilegedAction<Object>) () -> {\n            try {\n                return getBeanManager(() -> {\n                    Class<?> cdiClass = Class.forName(CDI_SPI_CLASS);\n                    Method current = cdiClass.getMethod(\"current\");\n                    Method getBeanManager = cdiClass.getMethod(\"getBeanManager\");\n                    Object cdiObject = current.invoke(cdiClass);\n                    if (cdiObject == null) {\n                        return null;\n                    }\n                    return getBeanManager.invoke(cdiObject);\n                });\n            } catch (ClassNotFoundException e) {\n                LOGGER.finest(Messages.getMessage(MessageKeys.NO_CDI_API_PROVIDER, CDI_SPI_CLASS));\n                return null;\n            }\n        });\n    }\n\n    /**\n     * Get bean manager from JNDI context.\n     *\n     * @return bean manager instance or null if javax.naming is not available.\n     */\n    private static Object getJndiBeanManager() {\n        return AccessController.doPrivileged((PrivilegedAction<Object>) () -> {\n            try {\n                return getBeanManager(() -> {\n                    Class<?> initialContextClass = Class.forName(INITIAL_CONTEXT_CLASS);\n                    Method lookupMethod = initialContextClass.getMethod(\"lookup\", String.class);\n                    Constructor<?> initialContextConstructor = initialContextClass.getConstructor();\n                    Object initialContextObject = initialContextConstructor.newInstance();\n                    return lookupMethod.invoke(initialContextObject, BEAN_MANAGER_NAME);\n                });\n            } catch (ClassNotFoundException e) {\n                LOGGER.finest(Messages.getMessage(MessageKeys.NO_JNDI_ENVIRONMENT, INITIAL_CONTEXT_CLASS));\n                return null;\n            }\n        });\n    }\n\n    /**\n     * Handles common invocation exceptions for getting bean manager reflectively.\n     *\n     * @return bean manager instance or null if javax.naming is not available or insufficient permissions.\n     */\n    private static Object getBeanManager(BeanManagerProvider command) throws ClassNotFoundException {\n        try {\n            return command.provide();\n        } catch (NoSuchMethodException | InstantiationException e) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.INTERNAL_ERROR, e.getMessage()), e);\n        } catch (IllegalAccessException e) {\n            //insufficient permissions for reflective invocation, don't fail in this case\n            LOGGER.warning(e.getMessage());\n            LOGGER.warning(Messages.getMessage(MessageKeys.ILLEGAL_ACCESS, \"lookup CDI bean manager\"));\n            return null;\n        } catch (ClassNotFoundException e) {\n            throw e;\n        } catch (ReflectiveOperationException e) {\n            //likely no CDI container is running or bean manager JNDI lookup fails.\n            LOGGER.log(Level.FINEST, Messages.getMessage(MessageKeys.NO_CDI_ENVIRONMENT), e);\n            return null;\n        }\n    }\n\n    /**\n     * Provides CDI bean manager instance, declares all exceptions thrown with reflective calls.\n     */\n    private interface BeanManagerProvider {\n        Object provide() throws ReflectiveOperationException;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/components/SerializerBinding.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.components;\n\nimport java.lang.reflect.Type;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\n\n/**\n * Binding for user Serializer component.\n *\n * @param <T> type of jsonb serializer\n */\npublic class SerializerBinding<T> extends AbstractComponentBinding {\n\n    private final JsonbSerializer<T> jsonbSerializer;\n\n    /**\n     * Creates a new instance.\n     *\n     * @param bindingType     Generic type argument of serializer. Not null.\n     * @param jsonbSerializer Serializer. Can be null.\n     */\n    public SerializerBinding(Type bindingType, JsonbSerializer<T> jsonbSerializer) {\n        super(bindingType);\n        this.jsonbSerializer = jsonbSerializer;\n    }\n\n    /**\n     * Returns a serializer if any.\n     *\n     * @return Serializer.\n     */\n    public JsonbSerializer<T> getJsonbSerializer() {\n        return jsonbSerializer;\n    }\n\n    /**\n     * Class of user component.\n     *\n     * @return Component class.\n     */\n    @Override\n    public Class<?> getComponentClass() {\n        return jsonbSerializer.getClass();\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/AdapterDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.adapter.JsonbAdapter;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.components.AdapterBinding;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * User defined type adapter executor.\n */\nclass AdapterDeserializer implements ModelDeserializer<Object> {\n\n    private final JsonbAdapter<Object, Object> adapter;\n    private final AdapterBinding adapterBinding;\n    private final ModelDeserializer<Object> delegate;\n\n    @SuppressWarnings(\"unchecked\")\n    AdapterDeserializer(AdapterBinding adapterBinding,\n                        ModelDeserializer<Object> delegate) {\n        this.adapterBinding = adapterBinding;\n        this.adapter = (JsonbAdapter<Object, Object>) adapterBinding.getAdapter();\n        this.delegate = delegate;\n    }\n\n    @Override\n    public Object deserialize(Object value, DeserializationContextImpl context) {\n        try {\n            return delegate.deserialize(adapter.adaptFromJson(value), context);\n        } catch (Exception e) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.ADAPTER_EXCEPTION,\n                                                         adapterBinding.getBindingType(),\n                                                         adapterBinding.getToType(),\n                                                         adapterBinding.getAdapter().getClass()), e);\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/ArrayDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Array container deserializer.\n */\nclass ArrayDeserializer implements ModelDeserializer<JsonParser> {\n\n    private final ModelDeserializer<JsonParser> delegate;\n\n    ArrayDeserializer(ModelDeserializer<JsonParser> delegate) {\n        this.delegate = delegate;\n    }\n\n    @Override\n    public Object deserialize(JsonParser parser, DeserializationContextImpl context) {\n        Collection<Object> collection = new ArrayList<>();\n        while (parser.hasNext()) {\n            final JsonParser.Event next = parser.next();\n            context.setLastValueEvent(next);\n            switch (next) {\n            case START_OBJECT:\n            case START_ARRAY:\n            case VALUE_STRING:\n            case VALUE_TRUE:\n            case VALUE_FALSE:\n            case VALUE_NUMBER:\n            case VALUE_NULL:\n                DeserializationContextImpl newContext = new DeserializationContextImpl(context);\n                collection.add(delegate.deserialize(parser, newContext));\n                break;\n            case END_ARRAY:\n                return collection;\n            default:\n                throw new JsonbException(\"Unexpected state: \" + next);\n            }\n        }\n        return collection;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/ArrayInstanceCreator.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.lang.reflect.Array;\nimport java.util.Base64;\nimport java.util.Collection;\nimport java.util.Map;\nimport java.util.function.Function;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.config.BinaryDataStrategy;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Creator of the array instance based upon the array type.\n */\nabstract class ArrayInstanceCreator implements ModelDeserializer<JsonParser> {\n\n    private static final Map<Class<?>, Function<ModelDeserializer<JsonParser>, ArrayInstanceCreator>> CACHE;\n\n    static {\n        CACHE = Map.of(boolean[].class, BooleanArrayCreator::new,\n                       byte[].class, ByteArrayCreator::new,\n                       char[].class, CharArrayCreator::new,\n                       double[].class, DoubleArrayCreator::new,\n                       float[].class, FloatArrayCreator::new,\n                       int[].class, IntegerArrayCreator::new,\n                       long[].class, LongArrayCreator::new,\n                       short[].class, ShortArrayCreator::new);\n    }\n\n    private final ModelDeserializer<JsonParser> delegate;\n\n    private ArrayInstanceCreator(ModelDeserializer<JsonParser> delegate) {\n        this.delegate = delegate;\n    }\n\n    static ArrayInstanceCreator create(Class<?> arrayType, Class<?> componentClass, ModelDeserializer<JsonParser> delegate) {\n        if (CACHE.containsKey(arrayType)) {\n            return CACHE.get(arrayType).apply(delegate);\n        }\n        return new ObjectArrayCreator(delegate, componentClass);\n    }\n\n    static ModelDeserializer<JsonParser> createBase64Deserializer(String strategy,\n                                                                  ModelDeserializer<JsonParser> delegate) {\n        return new Base64ByteArray(strategy, delegate);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        Collection<Object> collection = (Collection<Object>) delegate.deserialize(value, context);\n        return resolveArrayInstance(collection);\n    }\n\n    protected abstract Object resolveArrayInstance(Collection<Object> collection);\n\n    private static final class IntegerArrayCreator extends ArrayInstanceCreator {\n\n        private IntegerArrayCreator(ModelDeserializer<JsonParser> delegate) {\n            super(delegate);\n        }\n\n        @Override\n        protected Object resolveArrayInstance(Collection<Object> collection) {\n            int[] intArray = new int[collection.size()];\n            int i = 0;\n            for (Object obj : collection) {\n                intArray[i] = (int) obj;\n                i++;\n            }\n            return intArray;\n        }\n\n    }\n\n    private static final class ByteArrayCreator extends ArrayInstanceCreator {\n\n        private ByteArrayCreator(ModelDeserializer<JsonParser> delegate) {\n            super(delegate);\n        }\n\n        @Override\n        protected Object resolveArrayInstance(Collection<Object> collection) {\n            byte[] byteArray = new byte[collection.size()];\n            int i = 0;\n            for (Object obj : collection) {\n                byteArray[i] = (byte) obj;\n                i++;\n            }\n            return byteArray;\n        }\n\n    }\n\n    private static final class ShortArrayCreator extends ArrayInstanceCreator {\n\n        private ShortArrayCreator(ModelDeserializer<JsonParser> delegate) {\n            super(delegate);\n        }\n\n        @Override\n        protected Object resolveArrayInstance(Collection<Object> collection) {\n            short[] shortArray = new short[collection.size()];\n            int i = 0;\n            for (Object obj : collection) {\n                shortArray[i] = (short) obj;\n                i++;\n            }\n            return shortArray;\n        }\n\n    }\n\n    private static final class LongArrayCreator extends ArrayInstanceCreator {\n\n        private LongArrayCreator(ModelDeserializer<JsonParser> delegate) {\n            super(delegate);\n        }\n\n        @Override\n        protected Object resolveArrayInstance(Collection<Object> collection) {\n            long[] longArray = new long[collection.size()];\n            int i = 0;\n            for (Object obj : collection) {\n                longArray[i] = (long) obj;\n                i++;\n            }\n            return longArray;\n        }\n\n    }\n\n    private static final class FloatArrayCreator extends ArrayInstanceCreator {\n\n        private FloatArrayCreator(ModelDeserializer<JsonParser> delegate) {\n            super(delegate);\n        }\n\n        @Override\n        protected Object resolveArrayInstance(Collection<Object> collection) {\n            float[] floatArray = new float[collection.size()];\n            int i = 0;\n            for (Object obj : collection) {\n                floatArray[i] = (float) obj;\n                i++;\n            }\n            return floatArray;\n        }\n\n    }\n\n    private static final class DoubleArrayCreator extends ArrayInstanceCreator {\n\n        private DoubleArrayCreator(ModelDeserializer<JsonParser> delegate) {\n            super(delegate);\n        }\n\n        @Override\n        protected Object resolveArrayInstance(Collection<Object> collection) {\n            double[] doubleArray = new double[collection.size()];\n            int i = 0;\n            for (Object obj : collection) {\n                doubleArray[i] = (double) obj;\n                i++;\n            }\n            return doubleArray;\n        }\n\n    }\n\n    private static final class BooleanArrayCreator extends ArrayInstanceCreator {\n\n        private BooleanArrayCreator(ModelDeserializer<JsonParser> delegate) {\n            super(delegate);\n        }\n\n        @Override\n        protected Object resolveArrayInstance(Collection<Object> collection) {\n            boolean[] booleanArray = new boolean[collection.size()];\n            int i = 0;\n            for (Object obj : collection) {\n                booleanArray[i] = (boolean) obj;\n                i++;\n            }\n            return booleanArray;\n        }\n\n    }\n\n    private static final class CharArrayCreator extends ArrayInstanceCreator {\n\n        private CharArrayCreator(ModelDeserializer<JsonParser> delegate) {\n            super(delegate);\n        }\n\n        @Override\n        protected Object resolveArrayInstance(Collection<Object> collection) {\n            char[] charArray = new char[collection.size()];\n            int i = 0;\n            for (Object obj : collection) {\n                charArray[i] = (char) obj;\n                i++;\n            }\n            return charArray;\n        }\n\n    }\n\n    private static final class ObjectArrayCreator extends ArrayInstanceCreator {\n\n        private final Class<?> componentClass;\n\n        private ObjectArrayCreator(ModelDeserializer<JsonParser> delegate, Class<?> componentClass) {\n            super(delegate);\n            this.componentClass = componentClass;\n        }\n\n        @Override\n        protected Object resolveArrayInstance(Collection<Object> collection) {\n            Object[] objectArray = (Object[]) Array.newInstance(componentClass, collection.size());\n            int i = 0;\n            for (Object obj : collection) {\n                objectArray[i] = obj;\n                i++;\n            }\n            return objectArray;\n        }\n\n    }\n\n    private static final class Base64ByteArray implements ModelDeserializer<JsonParser> {\n\n        private final Base64.Decoder decoder;\n        private final ModelDeserializer<JsonParser> delegate;\n\n        private Base64ByteArray(String strategy,\n                                ModelDeserializer<JsonParser> delegate) {\n            this.decoder = getDecoder(strategy);\n            this.delegate = delegate;\n        }\n\n        public Base64.Decoder getDecoder(String strategy) {\n            switch (strategy) {\n            case BinaryDataStrategy.BASE_64:\n                return Base64.getDecoder();\n            case BinaryDataStrategy.BASE_64_URL:\n                return Base64.getUrlDecoder();\n            default:\n                throw new JsonbException(Messages.getMessage(MessageKeys.INTERNAL_ERROR, \"Invalid strategy: \" + strategy));\n            }\n        }\n\n        @Override\n        public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n            return decoder.decode((String) delegate.deserialize(value, context));\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/CollectionDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.util.Collection;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Collection container deserializer.\n */\nclass CollectionDeserializer implements ModelDeserializer<JsonParser> {\n\n    private final ModelDeserializer<JsonParser> delegate;\n\n    CollectionDeserializer(ModelDeserializer<JsonParser> delegate) {\n        this.delegate = delegate;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public Object deserialize(JsonParser parser, DeserializationContextImpl context) {\n        Collection<Object> collection = (Collection<Object>) context.getInstance();\n        while (parser.hasNext()) {\n            final JsonParser.Event next = parser.next();\n            context.setLastValueEvent(next);\n            switch (next) {\n            case VALUE_NULL:\n            case START_OBJECT:\n            case START_ARRAY:\n            case VALUE_STRING:\n            case VALUE_TRUE:\n            case VALUE_FALSE:\n            case VALUE_NUMBER:\n                DeserializationContextImpl newContext = new DeserializationContextImpl(context);\n                collection.add(delegate.deserialize(parser, newContext));\n                break;\n            case END_ARRAY:\n                return collection;\n            default:\n                throw new JsonbException(\"Unexpected state: \" + next);\n            }\n        }\n        return collection;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/CollectionInstanceCreator.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.EnumSet;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Queue;\nimport java.util.Set;\nimport java.util.SortedSet;\nimport java.util.TreeSet;\n\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.InstanceCreator;\nimport org.eclipse.yasson.internal.ReflectionUtils;\n\n/**\n * Collection instance creator.\n */\nclass CollectionInstanceCreator implements ModelDeserializer<JsonParser> {\n\n    private final CollectionDeserializer delegate;\n    private final Type type;\n    private final Class<?> clazz;\n    private final boolean isEnumSet;\n\n    CollectionInstanceCreator(CollectionDeserializer delegate, Type type) {\n        this.delegate = delegate;\n        this.clazz = implementationClass(ReflectionUtils.getRawType(type));\n        this.isEnumSet = EnumSet.class.isAssignableFrom(clazz);\n        this.type = isEnumSet ? ((ParameterizedType) type).getActualTypeArguments()[0] : type;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        Object instance;\n        if (isEnumSet) {\n            instance = EnumSet.noneOf((Class<Enum>) type);\n        } else {\n            instance = InstanceCreator.createInstance(clazz);\n        }\n        context.setInstance(instance);\n        return delegate.deserialize(value, context);\n    }\n\n    private Class<?> implementationClass(Class<?> type) {\n        if (type.isInterface()) {\n            return createInterfaceInstance(type);\n        }\n        return type;\n    }\n\n    private Class<?> createInterfaceInstance(Class<?> ifcType) {\n        if (List.class.isAssignableFrom(ifcType)) {\n            return ArrayList.class;\n        }\n        if (Set.class.isAssignableFrom(ifcType)) {\n            if (SortedSet.class.isAssignableFrom(ifcType)) {\n                return TreeSet.class;\n            }\n            return HashSet.class;\n        }\n        if (Queue.class.isAssignableFrom(ifcType)) {\n            return ArrayDeque.class;\n        }\n        if (Collection.class == ifcType) {\n            return ArrayList.class;\n        }\n        return ifcType;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/ContextSwitcher.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer which creates new deserialization context and invokes delegate with it.\n */\nclass ContextSwitcher implements ModelDeserializer<JsonParser> {\n\n    private final ModelDeserializer<Object> delegate;\n    private final ModelDeserializer<JsonParser> modelDeserializer;\n\n    ContextSwitcher(ModelDeserializer<Object> delegate,\n                    ModelDeserializer<JsonParser> modelDeserializer) {\n        this.delegate = delegate;\n        this.modelDeserializer = modelDeserializer;\n    }\n\n    @Override\n    public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        DeserializationContextImpl ctx = new DeserializationContextImpl(context);\n        Object returnedValue = delegate.deserialize(modelDeserializer.deserialize(value, ctx), context);\n        context.setLastValueEvent(ctx.getLastValueEvent());\n        return returnedValue;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/CyclicReferenceDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.lang.reflect.Type;\n\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserialization solution for cyclic references.\n */\nclass CyclicReferenceDeserializer implements ModelDeserializer<JsonParser> {\n\n    private final Type type;\n    private ModelDeserializer<JsonParser> delegate;\n\n    CyclicReferenceDeserializer(Type type) {\n        this.type = type;\n    }\n\n    @Override\n    public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        if (delegate == null) {\n            delegate = context.getJsonbContext().getChainModelCreator().deserializerChain(type);\n        }\n        return delegate.deserialize(value, context);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/DefaultObjectInstanceCreator.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.lang.reflect.Constructor;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.ClassMultiReleaseExtension;\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.ReflectionUtils;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Creator of the class instance with the default constructor.\n */\nclass DefaultObjectInstanceCreator implements ModelDeserializer<JsonParser> {\n\n    private final ModelDeserializer<JsonParser> delegate;\n    private final Constructor<?> defaultConstructor;\n    private final JsonbException exception;\n\n    DefaultObjectInstanceCreator(ModelDeserializer<JsonParser> delegate,\n                                 Class<?> clazz,\n                                 Constructor<?> defaultConstructor) {\n        this.delegate = delegate;\n        this.defaultConstructor = defaultConstructor;\n        if (clazz.isInterface()) {\n            this.exception = new JsonbException(Messages.getMessage(MessageKeys.INFER_TYPE_FOR_UNMARSHALL, clazz.getName()));\n        } else if (defaultConstructor == null) {\n            this.exception = ClassMultiReleaseExtension.exceptionToThrow(clazz)\n                    .orElse(new JsonbException(Messages.getMessage(MessageKeys.NO_DEFAULT_CONSTRUCTOR, clazz)));\n        } else {\n            this.exception = null;\n        }\n    }\n\n    @Override\n    public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        if (exception != null) {\n            throw exception;\n        }\n        Object instance = ReflectionUtils.createNoArgConstructorInstance(defaultConstructor);\n        context.setInstance(instance);\n        return delegate.deserialize(value, context);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/DeferredDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deferred deserializer used for postponed value setting. Such as when {@link jakarta.json.bind.annotation.JsonbCreator}\n * is used.\n */\nclass DeferredDeserializer implements ModelDeserializer<Object> {\n\n    private final ModelDeserializer<Object> delegate;\n\n    DeferredDeserializer(ModelDeserializer<Object> delegate) {\n        this.delegate = delegate;\n    }\n\n    @Override\n    public Object deserialize(Object value, DeserializationContextImpl context) {\n        context.getDeferredDeserializers().add(() -> delegate.deserialize(value, context));\n        return value;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/DeserializationModelCreator.java",
    "content": "/*\n * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.lang.reflect.GenericArrayType;\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedHashMap;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.Optional;\nimport java.util.OptionalDouble;\nimport java.util.OptionalInt;\nimport java.util.OptionalLong;\nimport java.util.Set;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.function.Function;\nimport java.util.stream.Collectors;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.config.BinaryDataStrategy;\nimport jakarta.json.bind.config.PropertyNamingStrategy;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.JsonbConfigProperties;\nimport org.eclipse.yasson.internal.JsonbContext;\nimport org.eclipse.yasson.internal.JsonbDateFormatter;\nimport org.eclipse.yasson.internal.JsonbNumberFormatter;\nimport org.eclipse.yasson.internal.ReflectionUtils;\nimport org.eclipse.yasson.internal.components.AdapterBinding;\nimport org.eclipse.yasson.internal.components.DeserializerBinding;\nimport org.eclipse.yasson.internal.deserializer.types.TypeDeserializers;\nimport org.eclipse.yasson.internal.model.ClassModel;\nimport org.eclipse.yasson.internal.model.CreatorModel;\nimport org.eclipse.yasson.internal.model.JsonbCreator;\nimport org.eclipse.yasson.internal.model.PropertyModel;\nimport org.eclipse.yasson.internal.model.customization.ClassCustomization;\nimport org.eclipse.yasson.internal.model.customization.ComponentBoundCustomization;\nimport org.eclipse.yasson.internal.model.customization.Customization;\nimport org.eclipse.yasson.internal.model.customization.PropertyCustomization;\nimport org.eclipse.yasson.internal.model.customization.TypeInheritanceConfiguration;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\nimport static jakarta.json.bind.JsonbConfig.PROPERTY_NAMING_STRATEGY;\nimport static jakarta.json.stream.JsonParser.Event;\n\n/**\n * Creator of the deserialization models for deserialized types.\n * <br>\n * This class servers also as a cache for all previously created model deserializers.\n */\npublic class DeserializationModelCreator {\n\n    private static final ModelDeserializer<Object> NULL_PROVIDER = (value, context) -> null;\n    private static final Map<Class<?>, ModelDeserializer<Object>> DEFAULT_CREATOR_VALUES;\n    private static final Set<JsonParser.Event> MAP_KEY_EVENTS = new HashSet<>();\n\n    static {\n        MAP_KEY_EVENTS.add(Event.KEY_NAME);\n        MAP_KEY_EVENTS.addAll(PositionChecker.Checker.VALUES.getEvents());\n\n        Map<Class<?>, ModelDeserializer<Object>> tmpValuesMap = new HashMap<>();\n\n        tmpValuesMap.put(byte.class, (value, context) -> (byte) 0);\n        tmpValuesMap.put(short.class, (value, context) -> (short) 0);\n        tmpValuesMap.put(int.class, (value, context) -> 0);\n        tmpValuesMap.put(long.class, (value, context) -> 0L);\n        tmpValuesMap.put(float.class, (value, context) -> 0.0F);\n        tmpValuesMap.put(double.class, (value, context) -> 0.0);\n        tmpValuesMap.put(char.class, (value, context) -> '\\u0000');\n        tmpValuesMap.put(boolean.class, (value, context) -> false);\n        tmpValuesMap.put(Optional.class, (value, context) -> Optional.empty());\n        tmpValuesMap.put(OptionalInt.class, (value, context) -> OptionalInt.empty());\n        tmpValuesMap.put(OptionalLong.class, (value, context) -> OptionalLong.empty());\n        tmpValuesMap.put(OptionalDouble.class, (value, context) -> OptionalDouble.empty());\n\n        DEFAULT_CREATOR_VALUES = Map.copyOf(tmpValuesMap);\n    }\n\n    private final Map<CachedItem, ModelDeserializer<JsonParser>> models = new ConcurrentHashMap<>();\n\n    private final JsonbContext jsonbContext;\n    private final Map<Class<?>, Class<?>> userTypeMapping;\n\n    /**\n     * Create new instance.\n     *\n     * @param jsonbContext jsonb context\n     */\n    public DeserializationModelCreator(JsonbContext jsonbContext) {\n        this.jsonbContext = jsonbContext;\n        this.userTypeMapping = jsonbContext.getConfigProperties().getUserTypeMapping();\n    }\n\n    /**\n     * Starts deserializer creation process.\n     *\n     * @param type type the deserializer is created for\n     * @return created deserializer\n     */\n    public ModelDeserializer<JsonParser> deserializerChain(Type type) {\n        LinkedList<Type> chain = new LinkedList<>();\n        ClassModel classModel = jsonbContext.getMappingContext().getOrCreateClassModel(ReflectionUtils.getRawType(type));\n        return deserializerChain(chain, type, classModel.getClassCustomization(), classModel);\n    }\n\n    private ModelDeserializer<JsonParser> deserializerChain(LinkedList<Type> chain,\n                                                            Type type,\n                                                            Customization propertyCustomization,\n                                                            ClassModel classModel) {\n        if (chain.contains(type)) {\n            return new CyclicReferenceDeserializer(type);\n        }\n        try {\n            chain.add(type);\n            return deserializerChainInternal(chain, type, propertyCustomization, classModel);\n        } finally {\n            chain.removeLast();\n        }\n    }\n\n    private ModelDeserializer<JsonParser> deserializerChainInternal(LinkedList<Type> chain,\n                                                                    Type type,\n                                                                    Customization propertyCustomization,\n                                                                    ClassModel classModel) {\n        Class<?> rawType = classModel.getType();\n        CachedItem cachedItem = createCachedItem(type, propertyCustomization);\n        if (models.containsKey(cachedItem)) {\n            return models.get(cachedItem);\n        } else if (userTypeMapping.containsKey(rawType)) {\n            Class<?> userTypeRaw = userTypeMapping.get(rawType);\n            ModelDeserializer<JsonParser> deserializer = deserializerChain(userTypeRaw);\n            models.put(cachedItem, deserializer);\n            return deserializer;\n        }\n        Optional<AdapterBinding> adapterBinding = adapterBinding(type, (ComponentBoundCustomization) propertyCustomization);\n        if (adapterBinding.isPresent()) {\n            AdapterBinding adapter = adapterBinding.get();\n            Class<?> toType = ReflectionUtils.getRawType(adapter.getToType());\n            ClassModel targetModel = jsonbContext.getMappingContext().getOrCreateClassModel(toType);\n            ModelDeserializer<JsonParser> typeDeserializer = typeDeserializer(toType,\n                                                                              targetModel.getClassCustomization(),\n                                                                              JustReturn.instance());\n            if (typeDeserializer == null) {\n                typeDeserializer = deserializerChain(adapter.getToType());\n            }\n            ModelDeserializer<JsonParser> targetAdapterModel = typeDeserializer;\n            AdapterDeserializer adapterDeserializer = new AdapterDeserializer(adapter, JustReturn.instance());\n            ModelDeserializer<JsonParser> adapterDeser = (parser, context) -> {\n                Object fromJson = targetAdapterModel.deserialize(parser, context);\n                return adapterDeserializer.deserialize(fromJson, context);\n            };\n            models.put(cachedItem, adapterDeser);\n            return adapterDeser;\n        }\n        ModelDeserializer<JsonParser> typeDeserializer = typeDeserializer(rawType,\n                                                                          propertyCustomization,\n                                                                          JustReturn.instance());\n        if (typeDeserializer != null) {\n            models.put(cachedItem, typeDeserializer);\n            return typeDeserializer;\n        }\n        if (Collection.class.isAssignableFrom(rawType)) {\n            return createCollectionDeserializer(cachedItem, rawType, chain);\n        } else if (Map.class.isAssignableFrom(rawType)) {\n            return createMapDeserializer(cachedItem, rawType, chain);\n        } else if (rawType.isArray()) {\n            return createArrayDeserializer(cachedItem, rawType, chain);\n        } else if (type instanceof GenericArrayType) {\n            return createGenericArray(cachedItem, rawType, chain);\n        } else if (Optional.class.isAssignableFrom(rawType)) {\n            return createOptionalDeserializer(chain, type, cachedItem);\n        } else {\n            return createObjectDeserializer(chain, type, propertyCustomization, classModel, rawType, cachedItem);\n        }\n    }\n\n    private ModelDeserializer<JsonParser> createObjectDeserializer(LinkedList<Type> chain,\n                                                                   Type type,\n                                                                   Customization propertyCustomization,\n                                                                   ClassModel classModel,\n                                                                   Class<?> rawType,\n                                                                   CachedItem cachedItem) {\n        ClassCustomization classCustomization = classModel.getClassCustomization();\n        Optional<DeserializerBinding<?>> deserializerBinding = userDeserializer(type,\n                                                                                (ComponentBoundCustomization) propertyCustomization);\n        if (deserializerBinding.isPresent()) {\n            UserDefinedDeserializer user = new UserDefinedDeserializer(deserializerBinding.get().getJsonbDeserializer(),\n                                                                       JustReturn.instance(), type, classCustomization);\n            models.put(cachedItem, user);\n            return user;\n        }\n        JsonbCreator creator = classCustomization.getCreator();\n        boolean hasCreator = creator != null;\n        List<String> params = hasCreator ? creatorParamsList(creator) : Collections.emptyList();\n        Function<String, String> renamer = propertyRenamer();\n        Map<String, ModelDeserializer<JsonParser>> processors = new LinkedHashMap<>();\n        Map<String, ModelDeserializer<Object>> defaultCreatorValues = new HashMap<>();\n        for (PropertyModel propertyModel : classModel.getSortedProperties()) {\n            if (!propertyModel.isWritable() || params.contains(propertyModel.getReadName())) {\n                continue;\n            }\n            ModelDeserializer<JsonParser> modelDeserializer = memberTypeProcessor(chain, propertyModel, hasCreator);\n            processors.put(renamer.apply(propertyModel.getReadName()), modelDeserializer);\n        }\n        for (String s : params) {\n            CreatorModel creatorModel = creator.findByName(s);\n            ModelDeserializer<JsonParser> modelDeserializer = typeProcessor(chain,\n                                                                            creatorModel.getType(),\n                                                                            creatorModel.getCustomization(),\n                                                                            JustReturn.instance());\n            String parameterName = renamer.apply(creatorModel.getName());\n            processors.put(parameterName, modelDeserializer);\n            if (creatorModel.getCustomization().isRequired()) {\n                defaultCreatorValues.put(parameterName, new RequiredCreatorParameter(parameterName));\n            } else {\n                Class<?> rawParamType = ReflectionUtils.getOptionalRawType(creatorModel.getType()).orElse(Object.class);\n                defaultCreatorValues.put(parameterName, DEFAULT_CREATOR_VALUES.getOrDefault(rawParamType, NULL_PROVIDER));\n            }\n        }\n        ModelDeserializer<JsonParser> instanceCreator;\n        TypeInheritanceConfiguration typeInheritanceConfiguration = classCustomization.getPolymorphismConfig();\n        Set<String> ignoredProperties = collectIgnoredProperties(typeInheritanceConfiguration);\n        boolean failOnUnknownProperties = jsonbContext.getConfigProperties().getConfigFailOnUnknownProperties();\n        if (hasCreator) {\n            instanceCreator = new JsonbCreatorDeserializer(processors, defaultCreatorValues, creator, rawType, renamer,\n                                                           failOnUnknownProperties, ignoredProperties);\n        } else {\n            ModelDeserializer<JsonParser> typeWrapper = new ObjectDeserializer(processors, renamer, rawType,\n                                                                               failOnUnknownProperties, ignoredProperties);\n            instanceCreator = new DefaultObjectInstanceCreator(typeWrapper, rawType,\n                                                               classModel.getDefaultConstructor());\n        }\n        PositionChecker positionChecker = new PositionChecker(instanceCreator, rawType, Event.START_OBJECT);\n        if (typeInheritanceConfiguration != null && !typeInheritanceConfiguration.isInherited()) {\n            instanceCreator = new InheritanceInstanceCreator(rawType, this, typeInheritanceConfiguration, positionChecker);\n            positionChecker = new PositionChecker(instanceCreator, rawType, Event.START_OBJECT);\n        }\n        ModelDeserializer<JsonParser> nullChecker = new NullCheckDeserializer(positionChecker, JustReturn.instance());\n        models.put(cachedItem, nullChecker);\n        return nullChecker;\n    }\n\n    private ModelDeserializer<JsonParser> createCollectionDeserializer(CachedItem cachedItem,\n                                                                       Class<?> rawType,\n                                                                       LinkedList<Type> chain) {\n        Type type = cachedItem.type;\n        Type colType = type instanceof ParameterizedType\n                ? ((ParameterizedType) type).getActualTypeArguments()[0]\n                : Object.class;\n        colType = ReflectionUtils.resolveType(chain, colType);\n        ClassModel classModel = jsonbContext.getMappingContext().getOrCreateClassModel(ReflectionUtils.getRawType(colType));\n        ModelDeserializer<JsonParser> typeProcessor = typeProcessor(chain,\n                                                                    colType,\n                                                                    classModel.getClassCustomization(),\n                                                                    JustReturn.instance());\n        CollectionDeserializer collectionDeserializer = new CollectionDeserializer(typeProcessor);\n        CollectionInstanceCreator instanceDeserializer = new CollectionInstanceCreator(collectionDeserializer, type);\n        PositionChecker positionChecker = new PositionChecker(instanceDeserializer, rawType, Event.START_ARRAY);\n        NullCheckDeserializer nullChecker = new NullCheckDeserializer(positionChecker, JustReturn.instance());\n        models.put(cachedItem, nullChecker);\n        return nullChecker;\n    }\n\n    private ModelDeserializer<JsonParser> createMapDeserializer(CachedItem cachedItem,\n                                                                Class<?> rawType,\n                                                                LinkedList<Type> chain) {\n        Type type = cachedItem.type;\n        Type keyType = type instanceof ParameterizedType\n                ? ((ParameterizedType) type).getActualTypeArguments()[0]\n                : Object.class;\n        Type valueType = type instanceof ParameterizedType\n                ? ((ParameterizedType) type).getActualTypeArguments()[1]\n                : Object.class;\n        ModelDeserializer<JsonParser> keyProcessor = typeProcessor(chain,\n                                                                   keyType,\n                                                                   ClassCustomization.empty(),\n                                                                   JustReturn.instance(),\n                                                                   MAP_KEY_EVENTS);\n        ClassModel valueClassModel = jsonbContext.getMappingContext().getOrCreateClassModel(ReflectionUtils.resolveRawType(chain, valueType));\n        ModelDeserializer<JsonParser> valueProcessor = typeProcessor(chain,\n                                                                     valueType,\n                                                                     valueClassModel.getClassCustomization(),\n                                                                     JustReturn.instance());\n\n        MapDeserializer mapDeserializer = new MapDeserializer(keyProcessor, valueProcessor);\n        MapInstanceCreator mapInstanceCreator = new MapInstanceCreator(mapDeserializer,\n                                                                       jsonbContext.getConfigProperties(),\n                                                                       rawType);\n        PositionChecker positionChecker = new PositionChecker(mapInstanceCreator, rawType, PositionChecker.Checker.CONTAINER);\n        NullCheckDeserializer nullChecker = new NullCheckDeserializer(positionChecker, JustReturn.instance());\n        models.put(cachedItem, nullChecker);\n        return nullChecker;\n    }\n\n    private ModelDeserializer<JsonParser> createArrayDeserializer(CachedItem cachedItem,\n                                                                  Class<?> rawType,\n                                                                  LinkedList<Type> chain) {\n        JsonbConfigProperties configProperties = jsonbContext.getConfigProperties();\n        if (rawType.equals(byte[].class) && !configProperties.getBinaryDataStrategy().equals(BinaryDataStrategy.BYTE)) {\n            String strategy = configProperties.getBinaryDataStrategy();\n            // Special case for byte[] with base64 encoding - use String's class customization\n            ClassModel stringModel = jsonbContext.getMappingContext().getOrCreateClassModel(String.class);\n            ModelDeserializer<JsonParser> typeProcessor = typeProcessor(chain,\n                                                                        String.class,\n                                                                        stringModel.getClassCustomization(),\n                                                                        JustReturn.instance());\n            ModelDeserializer<JsonParser> base64Deserializer = ArrayInstanceCreator.createBase64Deserializer(strategy,\n                                                                                                             typeProcessor);\n            NullCheckDeserializer nullChecker = new NullCheckDeserializer(base64Deserializer, JustReturn.instance());\n            models.put(cachedItem, nullChecker);\n            return nullChecker;\n        }\n        Class<?> arrayType = rawType.getComponentType();\n        ClassModel classModel = jsonbContext.getMappingContext().getOrCreateClassModel(arrayType);\n        ModelDeserializer<JsonParser> typeProcessor = typeProcessor(chain,\n                                                                    arrayType,\n                                                                    classModel.getClassCustomization(),\n                                                                    JustReturn.instance());\n        return createArrayCommonDeserializer(cachedItem, rawType, arrayType, typeProcessor);\n    }\n\n    private ModelDeserializer<JsonParser> createGenericArray(CachedItem cachedItem,\n                                                             Class<?> rawType,\n                                                             LinkedList<Type> chain) {\n        GenericArrayType type = (GenericArrayType) cachedItem.type;\n        Class<?> component = ReflectionUtils.getRawType(type.getGenericComponentType());\n        ClassModel classModel = jsonbContext.getMappingContext().getOrCreateClassModel(component);\n        ModelDeserializer<JsonParser> typeProcessor = typeProcessor(chain,\n                                                                    type.getGenericComponentType(),\n                                                                    classModel.getClassCustomization(),\n                                                                    JustReturn.instance());\n        return createArrayCommonDeserializer(cachedItem, rawType, component, typeProcessor);\n    }\n\n    private ModelDeserializer<JsonParser> createArrayCommonDeserializer(CachedItem cachedItem,\n                                                                        Class<?> rawType,\n                                                                        Class<?> component,\n                                                                        ModelDeserializer<JsonParser> typeProcessor) {\n        ArrayDeserializer arrayDeserializer = new ArrayDeserializer(typeProcessor);\n        ArrayInstanceCreator arrayInstanceCreator = ArrayInstanceCreator.create(rawType, component, arrayDeserializer);\n        PositionChecker positionChecker = new PositionChecker(arrayInstanceCreator, rawType, Event.START_ARRAY);\n        NullCheckDeserializer nullChecker = new NullCheckDeserializer(positionChecker, JustReturn.instance());\n        models.put(cachedItem, nullChecker);\n        return nullChecker;\n    }\n\n    private OptionalDeserializer createOptionalDeserializer(LinkedList<Type> chain,\n                                                            Type type,\n                                                            CachedItem cachedItem) {\n        Type colType = type instanceof ParameterizedType\n                ? ((ParameterizedType) type).getActualTypeArguments()[0]\n                : Object.class;\n        colType = ReflectionUtils.resolveType(chain, colType);\n        ClassModel classModel = jsonbContext.getMappingContext().getOrCreateClassModel(ReflectionUtils.getRawType(colType));\n        ModelDeserializer<JsonParser> typeProcessor = typeProcessor(chain, colType, classModel.getClassCustomization(), JustReturn.instance());\n        OptionalDeserializer optionalDeserializer = new OptionalDeserializer(typeProcessor, JustReturn.instance());\n        models.put(cachedItem, optionalDeserializer);\n        return optionalDeserializer;\n    }\n\n    private Set<String> collectIgnoredProperties(TypeInheritanceConfiguration typeInheritanceConfiguration) {\n        Set<String> ignoredProperties = new HashSet<>();\n        if (typeInheritanceConfiguration != null) {\n            TypeInheritanceConfiguration current = typeInheritanceConfiguration;\n            while (current != null) {\n                ignoredProperties.add(current.getFieldName());\n                current = current.getParentConfig();\n            }\n        }\n        return ignoredProperties;\n    }\n\n    private Function<String, String> propertyRenamer() {\n        boolean isCaseInsensitive = jsonbContext.getConfig()\n                .getProperty(PROPERTY_NAMING_STRATEGY)\n                .filter(prop -> prop.equals(PropertyNamingStrategy.CASE_INSENSITIVE))\n                .isPresent();\n\n        return isCaseInsensitive\n                ? String::toLowerCase\n                : value -> value;\n    }\n\n    private Optional<AdapterBinding> adapterBinding(Type type, ComponentBoundCustomization classCustomization) {\n        return jsonbContext.getComponentMatcher().getDeserializeAdapterBinding(type, classCustomization);\n    }\n\n    private Optional<DeserializerBinding<?>> userDeserializer(Type type, ComponentBoundCustomization classCustomization) {\n        return jsonbContext.getComponentMatcher().getDeserializerBinding(type, classCustomization);\n    }\n\n    private List<String> creatorParamsList(JsonbCreator creator) {\n        return Arrays.stream(creator.getParams()).map(CreatorModel::getName).collect(Collectors.toList());\n    }\n\n    private ModelDeserializer<JsonParser> memberTypeProcessor(LinkedList<Type> chain,\n                                                              PropertyModel propertyModel,\n                                                              boolean hasCreator) {\n        ModelDeserializer<Object> memberDeserializer;\n        Type type = propertyModel.getPropertyDeserializationType();\n        memberDeserializer = new ValueSetterDeserializer(propertyModel.getSetValueHandle());\n        if (hasCreator) {\n            memberDeserializer = new DeferredDeserializer(memberDeserializer);\n        }\n        return typeProcessor(chain, type, propertyModel.getCustomization(), memberDeserializer);\n    }\n\n    private ModelDeserializer<JsonParser> typeProcessor(LinkedList<Type> chain,\n                                                        Type type,\n                                                        Customization customization,\n                                                        ModelDeserializer<Object> memberDeserializer) {\n        return typeProcessor(chain, type, customization, memberDeserializer, PositionChecker.Checker.VALUES.getEvents());\n    }\n\n    private ModelDeserializer<JsonParser> typeProcessor(LinkedList<Type> chain,\n                                                        Type type,\n                                                        Customization customization,\n                                                        ModelDeserializer<Object> memberDeserializer,\n                                                        Set<Event> events) {\n        Type resolved = ReflectionUtils.resolveType(chain, type);\n        Class<?> rawType = ReflectionUtils.getRawType(resolved);\n        Optional<DeserializerBinding<?>> deserializerBinding = userDeserializer(resolved,\n                                                                                (ComponentBoundCustomization) customization);\n        if (deserializerBinding.isPresent()) {\n            //TODO remove or not? fix for deserializer cycle\n            //            ModelDeserializer<JsonParser> exactType = createNewChain(chain, memberDeserializer, rawType,\n            //            resolved, customization);\n            //            return new UserDefinedDeserializer(deserializerBinding.get().getJsonbDeserializer(),\n            //                                               exactType,\n            //                                               memberDeserializer,\n            //                                               resolved,\n            //                                               customization);\n            return new UserDefinedDeserializer(deserializerBinding.get().getJsonbDeserializer(),\n                                               memberDeserializer,\n                                               resolved,\n                                               customization);\n        }\n        Optional<AdapterBinding> adapterBinding = adapterBinding(resolved, (ComponentBoundCustomization) customization);\n        if (adapterBinding.isPresent()) {\n            AdapterBinding adapter = adapterBinding.get();\n            ModelDeserializer<JsonParser> typeDeserializer = typeDeserializer(ReflectionUtils.getRawType(adapter.getToType()),\n                                                                              customization,\n                                                                              JustReturn.instance(), events);\n            if (typeDeserializer == null) {\n                typeDeserializer = deserializerChain(adapter.getToType());\n            }\n            ModelDeserializer<JsonParser> targetAdapterModel = typeDeserializer;\n\n            AdapterDeserializer adapterDeserializer = new AdapterDeserializer(adapter, memberDeserializer);\n            return (parser, context) -> {\n                DeserializationContextImpl newContext = new DeserializationContextImpl(context);\n                Object fromJson = targetAdapterModel.deserialize(parser, newContext);\n                return adapterDeserializer.deserialize(fromJson, context);\n            };\n        }\n        ModelDeserializer<JsonParser> typeDeserializer = typeDeserializer(rawType, customization, memberDeserializer, events);\n        if (typeDeserializer == null) {\n            Class<?> implClass = resolveImplClass(rawType, customization);\n            return createNewChain(chain, memberDeserializer, implClass, resolved, customization);\n        }\n        return typeDeserializer;\n    }\n\n    private ModelDeserializer<JsonParser> createNewChain(LinkedList<Type> chain,\n                                                         ModelDeserializer<Object> memberDeserializer,\n                                                         Class<?> rawType,\n                                                         Type type,\n                                                         Customization propertyCustomization) {\n        ClassModel classModel = jsonbContext.getMappingContext().getOrCreateClassModel(rawType);\n        ModelDeserializer<JsonParser> modelDeserializer = deserializerChain(chain, type, propertyCustomization, classModel);\n        return new ContextSwitcher(memberDeserializer, modelDeserializer);\n    }\n\n    private ModelDeserializer<JsonParser> typeDeserializer(Class<?> rawType,\n                                                           Customization customization,\n                                                           ModelDeserializer<Object> delegate) {\n        return typeDeserializer(rawType, customization, delegate, PositionChecker.Checker.VALUES.getEvents());\n    }\n\n    private ModelDeserializer<JsonParser> typeDeserializer(Class<?> rawType,\n                                                           Customization customization,\n                                                           ModelDeserializer<Object> delegate,\n                                                           Set<JsonParser.Event> events) {\n        return TypeDeserializers\n                .getTypeDeserializer(rawType, customization, jsonbContext.getConfigProperties(), delegate, events);\n    }\n\n    private Class<?> resolveImplClass(Class<?> rawType, Customization customization) {\n        if (rawType.isInterface()) {\n            Class<?> implementationClass = null;\n            //annotation\n            if (customization instanceof PropertyCustomization) {\n                implementationClass = ((PropertyCustomization) customization).getImplementationClass();\n            }\n            //JsonbConfig\n            if (implementationClass == null) {\n                implementationClass = jsonbContext.getConfigProperties().getUserTypeMapping().get(rawType);\n            }\n            if (implementationClass != null) {\n                if (!rawType.isAssignableFrom(implementationClass)) {\n                    throw new JsonbException(Messages.getMessage(MessageKeys.IMPL_CLASS_INCOMPATIBLE,\n                                                                 implementationClass,\n                                                                 rawType));\n                }\n                return implementationClass;\n            }\n        }\n        return rawType;\n    }\n\n    private CachedItem createCachedItem(Type type, Customization customization) {\n        return new CachedItem(type, customization.getDeserializeNumberFormatter(), customization.getDeserializeDateFormatter());\n    }\n\n    private static final class CachedItem {\n\n        private final Type type;\n        private final JsonbNumberFormatter numberFormatter;\n        private final JsonbDateFormatter dateFormatter;\n\n        CachedItem(Type type, JsonbNumberFormatter numberFormatter, JsonbDateFormatter dateFormatter) {\n            this.type = type;\n            this.numberFormatter = numberFormatter;\n            this.dateFormatter = dateFormatter;\n        }\n\n        @Override\n        public boolean equals(Object o) {\n            if (this == o) {\n                return true;\n            }\n            if (o == null || getClass() != o.getClass()) {\n                return false;\n            }\n            CachedItem that = (CachedItem) o;\n            return Objects.equals(type, that.type)\n                    && Objects.equals(numberFormatter, that.numberFormatter)\n                    && Objects.equals(dateFormatter, that.dateFormatter);\n        }\n\n        @Override\n        public int hashCode() {\n            return Objects.hash(type, numberFormatter, dateFormatter);\n        }\n\n        @Override\n        public String toString() {\n            return \"CachedItem{\"\n                    + \"type=\" + type\n                    + \", numberFormatter=\" + numberFormatter\n                    + \", dateFormatter=\" + dateFormatter\n                    + '}';\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/InheritanceInstanceCreator.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\n\nimport jakarta.json.JsonObject;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.jsonstructure.JsonStructureToParserAdapter;\nimport org.eclipse.yasson.internal.model.customization.TypeInheritanceConfiguration;\n\nimport static jakarta.json.stream.JsonParser.Event;\n\n/**\n * Instance creator following the inheritance structure defined by {@link jakarta.json.bind.annotation.JsonbTypeInfo}.\n */\nclass InheritanceInstanceCreator implements ModelDeserializer<JsonParser> {\n\n    private final Class<?> processedType;\n    private final Map<String, Class<?>> resolvedClasses = new ConcurrentHashMap<>();\n    private final DeserializationModelCreator deserializationModelCreator;\n    private final TypeInheritanceConfiguration typeInheritanceConfiguration;\n    private final ModelDeserializer<JsonParser> defaultProcessor;\n\n    InheritanceInstanceCreator(Class<?> processedType,\n                               DeserializationModelCreator deserializationModelCreator,\n                               TypeInheritanceConfiguration typeInheritanceConfiguration,\n                               ModelDeserializer<JsonParser> defaultProcessor) {\n        this.processedType = processedType;\n        this.deserializationModelCreator = deserializationModelCreator;\n        this.typeInheritanceConfiguration = typeInheritanceConfiguration;\n        this.defaultProcessor = defaultProcessor;\n    }\n\n    @Override\n    public Object deserialize(JsonParser parser, DeserializationContextImpl context) {\n        String alias;\n        JsonParser jsonParser;\n        String polymorphismKeyName = typeInheritanceConfiguration.getFieldName();\n        JsonObject object = parser.getObject();\n        alias = object.getString(polymorphismKeyName, null);\n        JsonObject newJsonObject = context.getJsonbContext().getJsonProvider().createObjectBuilder(object)\n                .remove(polymorphismKeyName)\n                .build();\n        jsonParser = new JsonStructureToParserAdapter(newJsonObject);\n        //To get to the first event\n        Event event = jsonParser.next();\n        context.setLastValueEvent(event);\n        Class<?> polymorphicTypeClass;\n        if (alias == null) {\n            return defaultProcessor.deserialize(jsonParser, context);\n        }\n        polymorphicTypeClass = getPolymorphicTypeClass(alias);\n        if (polymorphicTypeClass.equals(processedType)) {\n            return defaultProcessor.deserialize(jsonParser, context);\n        }\n        ModelDeserializer<JsonParser> deserializer = deserializationModelCreator.deserializerChain(polymorphicTypeClass);\n        return deserializer.deserialize(jsonParser, context);\n    }\n\n    @Override\n    public String toString() {\n        return \"Property \" + typeInheritanceConfiguration.getFieldName() + \" polymorphic information handler\";\n    }\n\n    private Class<?> getPolymorphicTypeClass(String alias) {\n        if (resolvedClasses.containsKey(alias)) {\n            return resolvedClasses.get(alias);\n        }\n        for (Map.Entry<Class<?>, String> entry : typeInheritanceConfiguration.getAliases().entrySet()) {\n            if (entry.getValue().equals(alias)) {\n                resolvedClasses.put(alias, entry.getKey());\n                return entry.getKey();\n            }\n        }\n        throw new JsonbException(\"Unknown alias \\\"\" + alias + \"\\\" of the type \" + processedType.getName() + \". Known aliases: \"\n                                         + typeInheritanceConfiguration.getAliases().values());\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/JsonbCreatorDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.function.Function;\nimport java.util.stream.Collectors;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.model.CreatorModel;\nimport org.eclipse.yasson.internal.model.JsonbCreator;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\nimport static org.eclipse.yasson.internal.deserializer.ObjectDeserializer.NOOP;\nimport static org.eclipse.yasson.internal.deserializer.ObjectDeserializer.VALUE_SKIPPERS;\n\n/**\n * Creator of the Object instance with the usage of the {@link JsonbCreator}.\n */\nclass JsonbCreatorDeserializer implements ModelDeserializer<JsonParser> {\n\n    private final Map<String, ModelDeserializer<JsonParser>> propertyDeserializerChains;\n    private final Map<String, ModelDeserializer<Object>> defaultCreatorValues;\n    private final List<String> creatorParams;\n    private final Set<String> ignoredProperties;\n    private final JsonbCreator creator;\n    private final Class<?> clazz;\n    private final Function<String, String> renamer;\n    private final boolean failOnUnknownProperties;\n\n    JsonbCreatorDeserializer(Map<String, ModelDeserializer<JsonParser>> propertyDeserializerChains,\n                             Map<String, ModelDeserializer<Object>> defaultCreatorValues,\n                             JsonbCreator creator,\n                             Class<?> clazz,\n                             Function<String, String> renamer,\n                             boolean failOnUnknownProperties,\n                             Set<String> ignoredProperties) {\n        this.propertyDeserializerChains = propertyDeserializerChains;\n        this.defaultCreatorValues = defaultCreatorValues;\n        this.creatorParams = Arrays.stream(creator.getParams()).map(CreatorModel::getName).collect(Collectors.toList());\n        this.ignoredProperties = Set.copyOf(ignoredProperties);\n        this.creator = creator;\n        this.clazz = clazz;\n        this.renamer = renamer;\n        this.failOnUnknownProperties = failOnUnknownProperties;\n    }\n\n    @Override\n    public Object deserialize(JsonParser parser, DeserializationContextImpl context) {\n        String key = null;\n        Map<String, Object> paramValues = new HashMap<>();\n        while (parser.hasNext()) {\n            final JsonParser.Event next = parser.next();\n            context.setLastValueEvent(next);\n            switch (next) {\n            case KEY_NAME:\n                key = renamer.apply(parser.getString());\n                break;\n            case VALUE_NULL:\n            case START_OBJECT:\n            case START_ARRAY:\n            case VALUE_STRING:\n            case VALUE_NUMBER:\n            case VALUE_FALSE:\n            case VALUE_TRUE:\n                if (propertyDeserializerChains.containsKey(key)) {\n                    try {\n                        Object o = propertyDeserializerChains.get(key).deserialize(parser, context);\n                        if (creatorParams.contains(key)) {\n                            paramValues.put(key, o);\n                        }\n                    } catch (JsonbException e) {\n                        throw new JsonbException(\"Unable to deserialize property '\" + key + \"' because of: \" + e.getMessage(), e);\n                    }\n                } else if (failOnUnknownProperties && !ignoredProperties.contains(key)) {\n                    throw new JsonbException(Messages.getMessage(MessageKeys.UNKNOWN_JSON_PROPERTY, key, clazz));\n                } else {\n                    //We need to skip the corresponding structure if property key was not found\n                    VALUE_SKIPPERS.getOrDefault(next, NOOP).accept(parser);\n                }\n                break;\n            case END_OBJECT:\n                Object[] params = new Object[creatorParams.size()];\n                for (int i = 0; i < creatorParams.size(); i++) {\n                    String param = creatorParams.get(i);\n                    if (paramValues.containsKey(param)) {\n                        params[i] = paramValues.get(param);\n                    } else {\n                        params[i] = defaultCreatorValues.get(param).deserialize(null, context);\n                    }\n                }\n                context.setInstance(creator.call(params, clazz));\n                context.getDeferredDeserializers().forEach(Runnable::run);\n                context.getDeferredDeserializers().clear();\n                return context.getInstance();\n            default:\n                throw new JsonbException(\"Unexpected state: \" + next);\n            }\n        }\n        return context.getInstance();\n    }\n\n    @Override\n    public String toString() {\n        return \"ObjectInstanceCreator{\"\n                + \"parameters=\" + creatorParams\n                + \", clazz=\" + clazz\n                + '}';\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/JustReturn.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Return passed in object value.\n */\npublic final class JustReturn implements ModelDeserializer<Object> {\n\n    private static final JustReturn INSTANCE = new JustReturn();\n\n    private JustReturn() {\n    }\n\n    /**\n     * Return instance.\n     *\n     * @return instance of the class\n     */\n    public static JustReturn instance() {\n        return INSTANCE;\n    }\n\n    @Override\n    public Object deserialize(Object value, DeserializationContextImpl context) {\n        return value;\n    }\n\n    @Override\n    public String toString() {\n        return \"No other operations will be performed\";\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/MapDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.util.Map;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Map container deserializer.\n */\nclass MapDeserializer implements ModelDeserializer<JsonParser> {\n\n    private final ModelDeserializer<JsonParser> keyDelegate;\n    private final ModelDeserializer<JsonParser> valueDelegate;\n\n    MapDeserializer(ModelDeserializer<JsonParser> keyDelegate,\n                    ModelDeserializer<JsonParser> valueDelegate) {\n        this.keyDelegate = keyDelegate;\n        this.valueDelegate = valueDelegate;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public Object deserialize(JsonParser parser, DeserializationContextImpl context) {\n        Map<Object, Object> map = (Map<Object, Object>) context.getInstance();\n        Object key = null;\n        Object keyValue = null;\n        String keyName = null;\n        Mode mode = Mode.NONE;\n        State state = State.NEXT;\n        while (parser.hasNext()) {\n            final JsonParser.Event next = parser.next();\n            context.setLastValueEvent(next);\n            switch (next) {\n            case KEY_NAME:\n                mode = mode == Mode.NONE ? Mode.NORMAL : mode;\n                if (mode == Mode.NORMAL) {\n                    keyValue = deserializeValue(parser, context, keyDelegate);\n                }\n                keyName = parser.getString();\n                break;\n            case START_OBJECT:\n                mode = mode == Mode.NONE ? Mode.OBJECT : mode;\n            case START_ARRAY:\n            case VALUE_STRING:\n            case VALUE_TRUE:\n            case VALUE_FALSE:\n            case VALUE_NUMBER:\n            case VALUE_NULL:\n                if (mode == Mode.OBJECT) {\n                    if (state == State.NEXT) {\n                        state = State.KEY;\n                    } else if (state == State.KEY) {\n                        validateKeyName(keyName, state);\n                        key = deserializeValue(parser, context, keyDelegate);\n                        state = State.VALUE;\n                    } else if (state == State.VALUE) {\n                        validateKeyName(keyName, state);\n                        Object value = deserializeValue(parser, context, valueDelegate);\n                        map.put(key, value);\n                        state = State.DONE;\n                    } else {\n                        throw new JsonbException(\"Only attributes 'key' and 'value' allowed!\");\n                    }\n                } else {\n                    Object value = deserializeValue(parser, context, valueDelegate);\n                    map.put(keyValue, value);\n                }\n                break;\n            case END_OBJECT:\n                state = State.NEXT;\n                if (mode == Mode.OBJECT) {\n                    break;\n                }\n            case END_ARRAY:\n                return map;\n            default:\n                throw new JsonbException(\"Unexpected state: \" + next);\n            }\n        }\n        return map;\n    }\n\n    private void validateKeyName(String keyName, State state) {\n        if (state == State.KEY && !keyName.equals(\"key\")) {\n            throw new JsonbException(\"Attribute name has to be 'key' when representing map entry key. Got: \" + keyName);\n        } else if (state == State.VALUE && !keyName.equals(\"value\")) {\n            throw new JsonbException(\"Attribute name has to be 'value' when representing map entry value. Got: \" + keyName);\n        }\n    }\n\n    private Object deserializeValue(JsonParser parser,\n                                    DeserializationContextImpl context,\n                                    ModelDeserializer<JsonParser> deserializer) {\n        DeserializationContextImpl keyContext = new DeserializationContextImpl(context);\n        return deserializer.deserialize(parser, keyContext);\n    }\n\n    private enum Mode {\n\n        NONE,\n        NORMAL,\n        OBJECT\n\n    }\n\n    private enum State {\n\n        NEXT,\n        VALUE,\n        KEY,\n        DONE\n\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/MapInstanceCreator.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.NavigableMap;\nimport java.util.SortedMap;\nimport java.util.TreeMap;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentMap;\nimport java.util.concurrent.ConcurrentSkipListMap;\n\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.InstanceCreator;\nimport org.eclipse.yasson.internal.JsonbConfigProperties;\n\n/**\n * Map instance creator.\n */\nclass MapInstanceCreator implements ModelDeserializer<JsonParser> {\n\n    private final MapDeserializer delegate;\n    private final JsonbConfigProperties configProperties;\n    private final Class<?> clazz;\n\n    MapInstanceCreator(MapDeserializer delegate,\n                       JsonbConfigProperties configProperties,\n                       Class<?> clazz) {\n        this.delegate = delegate;\n        this.configProperties = configProperties;\n        this.clazz = clazz;\n    }\n\n    @Override\n    public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        Map<?, ?> map = createInstance(clazz);\n        context.setInstance(map);\n        return delegate.deserialize(value, context);\n    }\n\n    private Map<?, ?> createInstance(Class<?> clazz) {\n        return clazz.isInterface()\n                ? getMapImpl(clazz)\n                : (Map<?, ?>) InstanceCreator.createInstance(clazz);\n    }\n\n    private Map<?, ?> getMapImpl(Class<?> ifcType) {\n        if (ConcurrentMap.class.isAssignableFrom(ifcType)) {\n            if (SortedMap.class.isAssignableFrom(ifcType) || NavigableMap.class.isAssignableFrom(ifcType)) {\n                return new ConcurrentSkipListMap<>();\n            } else {\n                return new ConcurrentHashMap<>();\n            }\n        }\n        // SortedMap, NavigableMap\n        if (SortedMap.class.isAssignableFrom(ifcType)) {\n            Class<?> defaultMapImplType = configProperties.getDefaultMapImplType();\n            return SortedMap.class.isAssignableFrom(defaultMapImplType)\n                    ? (Map<?, ?>) InstanceCreator.createInstance(defaultMapImplType)\n                    : new TreeMap<>();\n        }\n        return new HashMap<>();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/ModelDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Type deserializer.\n * <br>\n * All the instances are required to be reusable and without any states\n * stored in the class fields.\n *\n * @param <T> represents the content value this deserializer is using\n */\npublic interface ModelDeserializer<T> {\n\n    /**\n     * Deserialize provided value or delegate deserialization to the next deserializer.\n     *\n     * @param value   value to be deserialized\n     * @param context deserialization context\n     * @return deserialized value\n     */\n    Object deserialize(T value, DeserializationContextImpl context);\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/NullCheckDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Json null value checker.\n * <br>\n * Simple delegate which checks whether the obtained parser value event was\n * {@link JsonParser.Event#VALUE_NULL} or not. If the event has been {@link JsonParser.Event#VALUE_NULL}, null value\n * deserializer will be called. In all other cases non-null deserializer is called.\n */\npublic class NullCheckDeserializer implements ModelDeserializer<JsonParser> {\n\n    private final ModelDeserializer<JsonParser> nonNullDeserializer;\n    private final ModelDeserializer<Object> nullDeserializer;\n\n    /**\n     * Create new instance.\n     *\n     * @param nonNullDeserializer deserializer called when value is not null\n     * @param nullDeserializer    deserializer called when value is null\n     */\n    public NullCheckDeserializer(ModelDeserializer<JsonParser> nonNullDeserializer,\n                                 ModelDeserializer<Object> nullDeserializer) {\n        this.nonNullDeserializer = nonNullDeserializer;\n        this.nullDeserializer = nullDeserializer;\n    }\n\n    @Override\n    public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        if (context.getLastValueEvent() != JsonParser.Event.VALUE_NULL) {\n            return nonNullDeserializer.deserialize(value, context);\n        }\n        return nullDeserializer.deserialize(null, context);\n    }\n\n    @Override\n    public String toString() {\n        return \"Null value check\";\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/ObjectDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2023 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.util.EnumMap;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.function.Consumer;\nimport java.util.function.Function;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Object container deserializer.\n */\nclass ObjectDeserializer implements ModelDeserializer<JsonParser> {\n\n    static final Consumer<JsonParser> NOOP = jsonParser -> {};\n    static final EnumMap<JsonParser.Event, Consumer<JsonParser>> VALUE_SKIPPERS = new EnumMap<>(JsonParser.Event.class);\n\n    static {\n        VALUE_SKIPPERS.put(JsonParser.Event.START_OBJECT, JsonParser::skipObject);\n        VALUE_SKIPPERS.put(JsonParser.Event.START_ARRAY, JsonParser::skipArray);\n    }\n\n    private final Map<String, ModelDeserializer<JsonParser>> propertyDeserializerChains;\n    private final Function<String, String> renamer;\n    private final Class<?> rawClass;\n    private final boolean failOnUnknownProperty;\n    private final Set<String> ignoredProperties;\n\n    ObjectDeserializer(Map<String, ModelDeserializer<JsonParser>> propertyDeserializerChains,\n                       Function<String, String> renamer,\n                       Class<?> rawClass,\n                       boolean failOnUnknownProperty,\n                       Set<String> ignoredProperties) {\n        this.propertyDeserializerChains = Map.copyOf(propertyDeserializerChains);\n        this.renamer = renamer;\n        this.rawClass = rawClass;\n        this.failOnUnknownProperty = failOnUnknownProperty;\n        this.ignoredProperties = Set.copyOf(ignoredProperties);\n    }\n\n    @Override\n    public Object deserialize(JsonParser parser, DeserializationContextImpl context) {\n        String key = null;\n        while (parser.hasNext()) {\n            final JsonParser.Event next = parser.next();\n            context.setLastValueEvent(next);\n            switch (next) {\n            case KEY_NAME:\n                key = renamer.apply(parser.getString());\n                break;\n            case VALUE_NULL:\n            case START_OBJECT:\n            case START_ARRAY:\n            case VALUE_STRING:\n            case VALUE_NUMBER:\n            case VALUE_FALSE:\n            case VALUE_TRUE:\n                if (propertyDeserializerChains.containsKey(key)) {\n                    try {\n                        propertyDeserializerChains.get(key).deserialize(parser, context);\n                    } catch (JsonbException e) {\n                        throw new JsonbException(\"Unable to deserialize property '\" + key + \"' because of: \" + e.getMessage(), e);\n                    }\n                } else if (failOnUnknownProperty && !ignoredProperties.contains(key)) {\n                    throw new JsonbException(Messages.getMessage(MessageKeys.UNKNOWN_JSON_PROPERTY, key, rawClass));\n                } else {\n                    //We need to skip the corresponding structure if property key was not found\n                    VALUE_SKIPPERS.getOrDefault(next, NOOP).accept(parser);\n                }\n                break;\n            case END_ARRAY:\n                break;\n            case END_OBJECT:\n                return context.getInstance();\n            default:\n                throw new JsonbException(\"Unexpected state: \" + next);\n            }\n        }\n        return context.getInstance();\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/OptionalDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.util.Optional;\n\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer of the {@link Optional} types.\n */\nclass OptionalDeserializer implements ModelDeserializer<JsonParser> {\n\n    private final ModelDeserializer<JsonParser> typeDeserializer;\n    private final ModelDeserializer<Object> delegate;\n\n    OptionalDeserializer(ModelDeserializer<JsonParser> typeDeserializer,\n                         ModelDeserializer<Object> delegate) {\n        this.typeDeserializer = typeDeserializer;\n        this.delegate = delegate;\n    }\n\n    @Override\n    public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        Optional<Object> val = Optional.ofNullable(typeDeserializer.deserialize(value, context));\n        return delegate.deserialize(val, context);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/PositionChecker.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.lang.reflect.Type;\nimport java.util.Arrays;\nimport java.util.Map;\nimport java.util.Set;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\nimport static jakarta.json.stream.JsonParser.Event;\n\n/**\n * JSON document position checker.\n * <br>\n * Checks whether json parser is in expected state. If not it will try to skip to the next event, since\n * if user defined components are involved, it is possible to expect incorrect states in terms of the last expected events.\n * If this checker is still not in expected state, an exception is thrown.\n */\npublic class PositionChecker implements ModelDeserializer<JsonParser> {\n\n    private static final Map<Event, Event> CLOSING_EVENTS = Map.of(Event.START_ARRAY, Event.END_ARRAY,\n                                                                   Event.START_OBJECT, Event.END_OBJECT);\n\n    private final Set<Event> expectedEvents;\n    private final ModelDeserializer<JsonParser> delegate;\n    private final Type rType;\n\n    /**\n     * Create new instance.\n     *\n     * @param delegate delegate which is call after the check\n     * @param rType    runtime type\n     * @param checker  bound group of events\n     */\n    public PositionChecker(ModelDeserializer<JsonParser> delegate, Type rType, Checker checker) {\n        this(checker.events, delegate, rType);\n    }\n\n    /**\n     * Create new instance.\n     *\n     * @param delegate delegate which is call after the check\n     * @param rType    runtime type\n     * @param events   customized checked events\n     */\n    public PositionChecker(ModelDeserializer<JsonParser> delegate, Type rType, Event... events) {\n        this(Set.copyOf(Arrays.asList(events)), delegate, rType);\n    }\n\n    private PositionChecker(Set<Event> expectedEvents,\n                            ModelDeserializer<JsonParser> delegate, Type rType) {\n        this.expectedEvents = expectedEvents;\n        this.delegate = delegate;\n        this.rType = rType;\n    }\n\n    @Override\n    public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        Event original = context.getLastValueEvent();\n        Event startEvent = original;\n        if (!expectedEvents.contains(startEvent)) {\n            startEvent = value.next();\n            context.setLastValueEvent(startEvent);\n            if (!expectedEvents.contains(startEvent)) {\n                throw new JsonbException(\"Incorrect position for processing type: \" + rType + \". \"\n                                                 + \"Received event: \" + original + \" \"\n                                                 + \"Allowed: \" + expectedEvents);\n            }\n        }\n        Object o = delegate.deserialize(value, context);\n        if (CLOSING_EVENTS.containsKey(startEvent)\n                && CLOSING_EVENTS.get(startEvent) != context.getLastValueEvent()) {\n            throw new JsonbException(\"Incorrect parser position after processing of the type: \" + rType + \". \"\n                                             + \"Start event: \" + startEvent + \" \"\n                                             + \"After processing event: \" + context.getLastValueEvent());\n        }\n        return o;\n    }\n\n    @Override\n    public String toString() {\n        return \"PositionChecker{\"\n                + \"expectedEvents=\" + expectedEvents\n                + \", runtimeType=\" + rType\n                + '}';\n    }\n\n    /**\n     * Grouped events according to whether it is container or value.\n     */\n    public enum Checker {\n\n        /**\n         * Value bound events.\n         */\n        VALUES(Event.VALUE_FALSE,\n               Event.VALUE_TRUE,\n               Event.VALUE_STRING,\n               Event.VALUE_NUMBER,\n               Event.VALUE_NULL),\n\n        /**\n         * Container bound events.\n         */\n        CONTAINER(Event.START_OBJECT,\n                  Event.START_ARRAY);\n\n        private final Set<Event> events;\n\n        Checker(Event... events) {\n            this.events = Set.of(events);\n        }\n\n        /**\n         * Return events bound to the event group.\n         *\n         * @return set of bound events\n         */\n        public Set<Event> getEvents() {\n            return events;\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/RequiredCreatorParameter.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\nclass RequiredCreatorParameter implements ModelDeserializer<Object> {\n\n    private final String parameterName;\n\n    RequiredCreatorParameter(String parameterName) {\n        this.parameterName = parameterName;\n    }\n\n    @Override\n    public Object deserialize(Object value, DeserializationContextImpl context) {\n        throw new JsonbException(Messages.getMessage(MessageKeys.JSONB_CREATOR_MISSING_PROPERTY, parameterName));\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/UserDefinedDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.lang.reflect.Type;\n\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.model.customization.Customization;\n\n/**\n * Deserializer used to invoke user defined deserializers.\n */\nclass UserDefinedDeserializer implements ModelDeserializer<JsonParser> {\n\n    private final JsonbDeserializer<?> userDefinedDeserializer;\n    private final ModelDeserializer<Object> delegate;\n    private final Type rType;\n    private final Customization customization;\n\n    //TODO remove or not? deserializer cycle\n    //    public UserDefinedDeserializer(JsonbDeserializer<?> userDefinedDeserializer,\n    //                                   ModelDeserializer<JsonParser> exactType,\n    //                                   ModelDeserializer<Object> delegate,\n    //                                   Type rType,\n    //                                   Customization customization) {\n    //        this.userDefinedDeserializer = userDefinedDeserializer;\n    //        this.exactType = exactType;\n    //        this.delegate = delegate;\n    //        this.rType = rType;\n    //        this.customization = customization;\n    //    }\n    UserDefinedDeserializer(JsonbDeserializer<?> userDefinedDeserializer,\n                            ModelDeserializer<Object> delegate,\n                            Type rType,\n                            Customization customization) {\n        this.userDefinedDeserializer = userDefinedDeserializer;\n        this.delegate = delegate;\n        this.rType = rType;\n        this.customization = customization;\n    }\n\n    @Override\n    public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        DeserializationContextImpl newContext = new DeserializationContextImpl(context);\n        newContext.setCustomization(customization);\n        //TODO remove or not? deserializer cycle\n        //        if (context.getUserProcessorChain().contains(userDefinedDeserializer.getClass())) {\n        //            if (context.getLastValueEvent() != JsonParser.Event.START_ARRAY\n        //                    && context.getLastValueEvent() != JsonParser.Event.START_OBJECT) {\n        //                newContext.setDisableNextPositionCheck(true);\n        //            }\n        //            return exactType.deserialize(value, newContext);\n        //        }\n        //        newContext.getUserProcessorChain().add(userDefinedDeserializer.getClass());\n        YassonParser yassonParser = new YassonParser(value, context.getLastValueEvent(), newContext);\n        Object object = userDefinedDeserializer.deserialize(yassonParser, newContext, rType);\n        yassonParser.skipRemaining();\n        context.setLastValueEvent(newContext.getLastValueEvent());\n        return delegate.deserialize(object, context);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/ValueExtractor.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.deserializer.types.TypeDeserializer;\n\n/**\n * Extracts the value out of the {@link JsonParser} based upon the last obtained event.\n */\npublic class ValueExtractor implements ModelDeserializer<JsonParser> {\n\n    private final TypeDeserializer delegate;\n\n    /**\n     * Create new instance.\n     *\n     * @param delegate delegate to accept extracted value\n     */\n    public ValueExtractor(TypeDeserializer delegate) {\n        this.delegate = delegate;\n    }\n\n    @Override\n    public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        JsonParser.Event last = context.getLastValueEvent();\n        switch (last) {\n        case VALUE_TRUE:\n            return delegate.deserialize(Boolean.TRUE, context);\n        case VALUE_FALSE:\n            return delegate.deserialize(Boolean.FALSE, context);\n        case KEY_NAME:\n        case VALUE_STRING:\n            return delegate.deserialize(value.getString(), context);\n        case VALUE_NUMBER:\n            //We don't know for sure how to handle the number value, it can be int, long etc.\n            //Value extraction has to be delegated to the TypeDeserializer\n            return delegate.deserialize(value, context);\n        default:\n            throw new JsonbException(\"Could not extract data. Received event: \" + last);\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/ValueSetterDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.lang.invoke.MethodHandle;\nimport java.util.Objects;\n\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Value setter. Invokes created {@link MethodHandle} to set deserialized value to the instance.\n */\nclass ValueSetterDeserializer implements ModelDeserializer<Object> {\n\n    private final MethodHandle valueSetter;\n\n    ValueSetterDeserializer(MethodHandle valueSetter) {\n        this.valueSetter = Objects.requireNonNull(valueSetter);\n    }\n\n    @Override\n    public Object deserialize(Object value, DeserializationContextImpl context) {\n        Object object = context.getInstance();\n        try {\n            valueSetter.invoke(object, value);\n            return value;\n        } catch (Throwable e) {\n            throw new JsonbException(\"Error setting value on: \" + object, e);\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/YassonParser.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n * Copyright (c) 2026 Contributors to the Eclipse Foundation.\n * \n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer;\n\nimport java.math.BigDecimal;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\nimport java.util.stream.Stream;\n\nimport jakarta.json.JsonArray;\nimport jakarta.json.JsonObject;\nimport jakarta.json.JsonValue;\nimport jakarta.json.stream.JsonLocation;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Yasson {@link YassonParser} parser wrapper.\n * <br>\n * Used for user defined deserializers. Does not allow deserializer to read outside the scope it should be used on.\n */\nclass YassonParser implements JsonParser {\n\n    private final JsonParser delegate;\n    private final DeserializationContextImpl context;\n    private int level;\n\n    YassonParser(JsonParser delegate, Event firstEvent, DeserializationContextImpl context) {\n        this.delegate = delegate;\n        this.context = context;\n        this.level = determineLevelValue(firstEvent);\n    }\n\n    private int determineLevelValue(Event firstEvent) {\n        switch (firstEvent) {\n        case START_ARRAY:\n        case START_OBJECT:\n            return 1; //container start, there will be more events to come\n        default:\n            return 0; //just this single value, do not allow reading more\n        }\n    }\n\n    void skipRemaining() {\n        while (hasNext()) {\n            next();\n        }\n    }\n\n    @Override\n    public boolean hasNext() {\n        if (level < 1) {\n            return false;\n        }\n        return delegate.hasNext();\n    }\n\n    @Override\n    public Event next() {\n        validate();\n        Event next = delegate.next();\n        context.setLastValueEvent(next);\n        switch (next) {\n        case START_OBJECT:\n        case START_ARRAY:\n            level++;\n            break;\n        case END_OBJECT:\n        case END_ARRAY:\n            level--;\n            break;\n        default:\n            //no other changes needed\n        }\n        return next;\n    }\n\n    @Override\n    public Event currentEvent() {\n        return context.getLastValueEvent();\n    }\n    \n    @Override\n    public String getString() {\n        return delegate.getString();\n    }\n\n    @Override\n    public boolean isIntegralNumber() {\n        return delegate.isIntegralNumber();\n    }\n\n    @Override\n    public int getInt() {\n        return delegate.getInt();\n    }\n\n    @Override\n    public long getLong() {\n        return delegate.getLong();\n    }\n\n    @Override\n    public BigDecimal getBigDecimal() {\n        return delegate.getBigDecimal();\n    }\n\n    @Override\n    public JsonLocation getLocation() {\n        return delegate.getLocation();\n    }\n\n    @Override\n    public JsonObject getObject() {\n        validate();\n        level--;\n        JsonObject jsonObject = delegate.getObject();\n        context.setLastValueEvent(Event.END_OBJECT);\n        return jsonObject;\n    }\n\n    @Override\n    public JsonValue getValue() {\n        final Event currentLevel = context.getLastValueEvent();\n        switch (currentLevel) {\n        case START_ARRAY:\n            return getArray();\n        case START_OBJECT:\n            return getObject();\n        default:\n            return delegate.getValue();\n        }\n    }\n\n    @Override\n    public JsonArray getArray() {\n        validate();\n        level--;\n        JsonArray array = delegate.getArray();\n        context.setLastValueEvent(Event.END_ARRAY);\n        return array;\n    }\n\n    @Override\n    public Stream<JsonValue> getArrayStream() {\n        validate();\n        level--;\n        return delegate.getArrayStream();\n    }\n\n    @Override\n    public Stream<Map.Entry<String, JsonValue>> getObjectStream() {\n        validate();\n        level--;\n        return delegate.getObjectStream();\n    }\n\n    @Override\n    public Stream<JsonValue> getValueStream() {\n        validate();\n        level--;\n        return delegate.getValueStream();\n    }\n\n    @Override\n    public void skipArray() {\n        validate();\n        level--;\n        delegate.skipArray();\n    }\n\n    @Override\n    public void skipObject() {\n        validate();\n        level--;\n        delegate.skipObject();\n    }\n\n    @Override\n    public void close() {\n        throw new UnsupportedOperationException();\n    }\n\n    private void validate() {\n        if (level < 1) {\n            throw new NoSuchElementException(\"There are no more elements available!\");\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/AbstractDateDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\nimport java.sql.Date;\nimport java.time.DateTimeException;\nimport java.time.Instant;\nimport java.time.ZoneId;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\nimport java.util.Optional;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.annotation.JsonbDateFormat;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.JsonbConfigProperties;\nimport org.eclipse.yasson.internal.JsonbDateFormatter;\nimport org.eclipse.yasson.internal.deserializer.JustReturn;\nimport org.eclipse.yasson.internal.deserializer.ModelDeserializer;\nimport org.eclipse.yasson.internal.model.customization.Customization;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Base deserializer for all the date related types.\n */\nabstract class AbstractDateDeserializer<T> extends TypeDeserializer {\n\n    static final ZoneId UTC = ZoneId.of(\"UTC\");\n\n    private ModelDeserializer<String> actualDeserializer;\n\n    AbstractDateDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n        this.actualDeserializer = actualDeserializer(builder.getConfigProperties(), builder.getCustomization());\n    }\n\n    AbstractDateDeserializer(Class<Date> clazz) {\n        super(new TypeDeserializerBuilder(clazz, null, null, JustReturn.instance()));\n        this.actualDeserializer = null;\n    }\n\n    private ModelDeserializer<String> actualDeserializer(JsonbConfigProperties properties, Customization customization) {\n        final JsonbDateFormatter formatter = getJsonbDateFormatter(properties, customization);\n        if (JsonbDateFormat.TIME_IN_MILLIS.equals(formatter.getFormat())) {\n            return (value, context) -> fromInstant(Instant.ofEpochMilli(Long.parseLong(value)));\n        } else if (formatter.getDateTimeFormatter() != null) {\n            return (value, context) -> parseWithFormatterInternal(value, formatter.getDateTimeFormatter());\n        } else {\n            DateTimeFormatter configDateTimeFormatter = properties.getConfigDateFormatter().getDateTimeFormatter();\n            if (configDateTimeFormatter != null) {\n                return (value, context) -> parseWithFormatterInternal(value, configDateTimeFormatter);\n            }\n        }\n        if (properties.isStrictIJson()) {\n            return (value, context) -> parseWithFormatterInternal(value, JsonbDateFormatter.IJSON_DATE_FORMATTER);\n        }\n        Locale locale = properties.getLocale(formatter.getLocale());\n        return (value, context) -> {\n            try {\n                return parseDefault(value, locale);\n            } catch (DateTimeException e) {\n                throw new JsonbException(Messages.getMessage(MessageKeys.DATE_PARSE_ERROR, value, getType()), e);\n            }\n        };\n    }\n\n    private JsonbDateFormatter getJsonbDateFormatter(JsonbConfigProperties properties, Customization customization) {\n        return Optional.ofNullable(customization.getDeserializeDateFormatter())\n                .orElse(properties.getConfigDateFormatter());\n    }\n\n    @Override\n    public Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {\n        if (actualDeserializer == null) {\n            actualDeserializer = actualDeserializer(context.getJsonbContext().getConfigProperties(), context.getCustomization());\n        }\n        return actualDeserializer.deserialize(value, context);\n    }\n\n    /**\n     * Construct date object from an instant containing epoch millisecond.\n     * If date object supports zone offset / zone id, system default is used and warning is logged.\n     *\n     * @param instant instant to construct from\n     * @return date object\n     */\n    abstract T fromInstant(Instant instant);\n\n    /**\n     * Parse java.time date object with default formatter.\n     * Different default formatter for each date object type is used.\n     *\n     * @param jsonValue string value to parse from\n     * @param locale    annotated locale or default\n     * @return parsed date object\n     */\n    abstract T parseDefault(String jsonValue, Locale locale);\n\n    /**\n     * Parse java.time date object with provided formatter.\n     *\n     * @param jsonValue string value to parse from\n     * @param formatter a formatter to use\n     * @return parsed date object\n     */\n    abstract T parseWithFormatter(String jsonValue, DateTimeFormatter formatter);\n\n    private T parseWithFormatterInternal(String jsonValue, DateTimeFormatter formatter) {\n        try {\n            return parseWithFormatter(jsonValue, formatter);\n        } catch (DateTimeException e) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.DATE_PARSE_ERROR, jsonValue, getType()), e);\n        }\n    }\n\n    protected DateTimeFormatter getZonedFormatter(DateTimeFormatter formatter) {\n        return formatter.getZone() != null\n                ? formatter\n                : formatter.withZone(UTC);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/AbstractNumberDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\nimport java.text.DecimalFormat;\nimport java.text.DecimalFormatSymbols;\nimport java.text.NumberFormat;\nimport java.text.ParseException;\nimport java.util.Locale;\nimport java.util.function.Function;\n\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.JsonbNumberFormatter;\nimport org.eclipse.yasson.internal.deserializer.ModelDeserializer;\nimport org.eclipse.yasson.internal.model.customization.Customization;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Base deserializer for all the number types.\n */\nabstract class AbstractNumberDeserializer<T extends Number> extends TypeDeserializer {\n\n    private final ModelDeserializer<String> actualDeserializer;\n    private final boolean integerOnly;\n\n    AbstractNumberDeserializer(TypeDeserializerBuilder builder, boolean integerOnly) {\n        super(builder);\n        this.actualDeserializer = actualDeserializer(builder);\n        this.integerOnly = integerOnly;\n    }\n\n    private ModelDeserializer<String> actualDeserializer(TypeDeserializerBuilder builder) {\n        Customization customization = builder.getCustomization();\n        if (customization.getDeserializeNumberFormatter() == null) {\n            return (value, context) -> {\n                try {\n                    return parseNumberValue(value);\n                } catch (NumberFormatException e) {\n                    throw new JsonbException(Messages.getMessage(MessageKeys.DESERIALIZE_VALUE_ERROR, getType()), e);\n                }\n            };\n        }\n\n        final JsonbNumberFormatter numberFormat = customization.getDeserializeNumberFormatter();\n        //consider synchronizing on format instance or per thread cache.\n        Locale locale = builder.getConfigProperties().getLocale(numberFormat.getLocale());\n        final NumberFormat format = NumberFormat.getInstance(locale);\n        ((DecimalFormat) format).applyPattern(numberFormat.getFormat());\n        format.setParseIntegerOnly(integerOnly);\n        Function<String, String> valueChanger = createCompatibilityValueChanger(locale);\n        return (value, context) -> {\n            try {\n                String updated = valueChanger.apply(value);\n                return parseNumberValue(String.valueOf(format.parse(updated)));\n            } catch (ParseException e) {\n                throw new JsonbException(Messages.getMessage(MessageKeys.PARSING_NUMBER, value, numberFormat.getFormat()), e);\n            }\n        };\n    }\n\n    private Function<String, String> createCompatibilityValueChanger(Locale locale) {\n        char beforeJdk13GroupSeparator = '\\u00A0';\n        char frenchGroupingSeparator = DecimalFormatSymbols.getInstance(Locale.FRENCH).getGroupingSeparator();\n        if (locale.getLanguage().equals(Locale.FRENCH.getLanguage()) && beforeJdk13GroupSeparator != frenchGroupingSeparator) {\n            //JDK-8225245\n            return value -> value.replace(beforeJdk13GroupSeparator, frenchGroupingSeparator);\n        }\n        return value -> value;\n    }\n\n    abstract T parseNumberValue(String value);\n\n    @Override\n    Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {\n        return actualDeserializer.deserialize(value, context);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/BigDecimalDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.math.BigDecimal;\n\n/**\n * Deserializer of the {@link BigDecimal} type.\n */\nclass BigDecimalDeserializer extends AbstractNumberDeserializer<BigDecimal> {\n\n    BigDecimalDeserializer(TypeDeserializerBuilder builder) {\n        super(builder, false);\n    }\n\n    @Override\n    BigDecimal parseNumberValue(String value) {\n        return new BigDecimal(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/BigIntegerDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.math.BigInteger;\n\n/**\n * Deserializer of the {@link BigInteger} type.\n */\nclass BigIntegerDeserializer extends AbstractNumberDeserializer<BigInteger> {\n\n    BigIntegerDeserializer(TypeDeserializerBuilder builder) {\n        super(builder, true);\n    }\n\n    @Override\n    BigInteger parseNumberValue(String value) {\n        return new BigInteger(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/BooleanDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer of the {@link Boolean} type.\n */\nclass BooleanDeserializer extends TypeDeserializer {\n\n    BooleanDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    public Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {\n        return Boolean.parseBoolean(value);\n    }\n\n    @Override\n    Object deserializeBooleanValue(boolean value, DeserializationContextImpl context, Type rType) {\n        return value;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/ByteDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\n/**\n * Deserializer of the {@link Byte} type.\n */\nclass ByteDeserializer extends AbstractNumberDeserializer<Byte> {\n\n    ByteDeserializer(TypeDeserializerBuilder builder) {\n        super(builder, true);\n    }\n\n    @Override\n    Byte parseNumberValue(String value) {\n        return Byte.parseByte(value);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/CalendarDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.time.Instant;\nimport java.time.LocalDate;\nimport java.time.LocalTime;\nimport java.time.ZoneId;\nimport java.time.ZonedDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.time.temporal.TemporalAccessor;\nimport java.time.temporal.TemporalQueries;\nimport java.util.Calendar;\nimport java.util.GregorianCalendar;\nimport java.util.Locale;\nimport java.util.TimeZone;\n\n/**\n * Deserializer of the {@link Calendar} type.\n */\nclass CalendarDeserializer extends AbstractDateDeserializer<Calendar> {\n\n    private static final LocalTime ZERO_LOCAL_TIME = LocalTime.parse(\"00:00:00\");\n\n    private final Calendar calendarTemplate;\n\n    CalendarDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n        this.calendarTemplate = new GregorianCalendar();\n        this.calendarTemplate.clear();\n        this.calendarTemplate.setTimeZone(TimeZone.getTimeZone(UTC));\n    }\n\n    @Override\n    Calendar fromInstant(Instant instant) {\n        final Calendar calendar = (Calendar) calendarTemplate.clone();\n        calendar.setTimeInMillis(instant.toEpochMilli());\n        return calendar;\n    }\n\n    @Override\n    Calendar parseDefault(String jsonValue, Locale locale) {\n        DateTimeFormatter formatter = jsonValue.contains(\"T\")\n                ? DateTimeFormatter.ISO_DATE_TIME\n                : DateTimeFormatter.ISO_DATE;\n        return parseWithFormatter(jsonValue, formatter.withLocale(locale));\n    }\n\n    @Override\n    Calendar parseWithFormatter(String jsonValue, DateTimeFormatter formatter) {\n        final TemporalAccessor parsed = formatter.parse(jsonValue);\n        LocalTime time = parsed.query(TemporalQueries.localTime());\n        ZoneId zone = parsed.query(TemporalQueries.zone());\n        if (zone == null) {\n            zone = UTC;\n        }\n        if (time == null) {\n            time = ZERO_LOCAL_TIME;\n        }\n        ZonedDateTime result = LocalDate.from(parsed).atTime(time).atZone(zone);\n        return GregorianCalendar.from(result);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/CharDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer of the {@link Character} type.\n */\nclass CharDeserializer extends TypeDeserializer {\n\n    CharDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {\n        return value.charAt(0);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/DateDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.time.Instant;\nimport java.time.LocalDate;\nimport java.time.LocalDateTime;\nimport java.time.YearMonth;\nimport java.time.ZoneId;\nimport java.time.ZoneOffset;\nimport java.time.ZonedDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.time.temporal.TemporalAccessor;\nimport java.util.Date;\nimport java.util.Locale;\n\n/**\n * Deserializer of the {@link Date} type.\n *\n * <p>\n * For date-only patterns (e.g., \"yyyy-MM-dd\"), this deserializer uses {@link DateTimeFormatter#parseBest} to detect the\n * appropriate temporal type [ZonedDateTime, LocalDateTime, LocalDate, or YearMonth]\n * and creates the Date object at midnight in the specified\n * timezone. When no timezone is specified in the pattern, UTC is used as required by Jakarta JSON Binding specification\n * section 3.5.\n * </p>\n * <p>\n * critical, use {@link java.time.LocalDate} (recommended) or {@link java.sql.Date}.\n * </p>\n */\nclass DateDeserializer extends AbstractDateDeserializer<Date> {\n\n    private static final DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormatter.ISO_DATE_TIME;\n\n    DateDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    Date fromInstant(Instant instant) {\n        return new Date(instant.toEpochMilli());\n    }\n\n    @Override\n    Date parseDefault(String jsonValue, Locale locale) {\n        return parseWithOrWithoutZone(jsonValue, DEFAULT_DATE_TIME_FORMATTER.withLocale(locale));\n    }\n\n    @Override\n    Date parseWithFormatter(String jsonValue, DateTimeFormatter formatter) {\n        return parseWithOrWithoutZone(jsonValue, formatter);\n    }\n\n    private static Date parseWithOrWithoutZone(String jsonValue, DateTimeFormatter formatter) {\n        final TemporalAccessor best = formatter.parseBest(jsonValue,\n                ZonedDateTime::from,\n                LocalDateTime::from,\n                LocalDate::from,\n                YearMonth::from);\n\n        // If no zone provided in string, use the formatter's zone or UTC per the Jakarta JSON Binding specification\n        // section 3.5\n        final ZoneId zone = formatter.getZone() != null ? formatter.getZone() : ZoneOffset.UTC;\n\n        // Determine the type of the best option\n        final Instant instant;\n        if (best instanceof ZonedDateTime) {\n            instant = ((ZonedDateTime) best).toInstant();\n        } else if (best instanceof LocalDateTime) {\n            instant = ((LocalDateTime) best).atZone(zone).toInstant();\n        } else if (best instanceof LocalDate) {\n            instant = LocalDate.from(best).atStartOfDay(zone).toInstant();\n        } else if (best instanceof YearMonth) {\n            instant = ((YearMonth) best).atDay(1).atStartOfDay(zone).toInstant();\n        } else {\n            // Fallback\n            instant = Instant.from(best);\n        }\n        return Date.from(instant);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/DoubleDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\n/**\n * Deserializer of the {@link Double} type.\n */\nclass DoubleDeserializer extends AbstractNumberDeserializer<Double> {\n\n    DoubleDeserializer(TypeDeserializerBuilder builder) {\n        super(builder, false);\n    }\n\n    @Override\n    Double parseNumberValue(String value) {\n        return Double.parseDouble(value);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/DurationDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\nimport java.time.Duration;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer of the {@link Duration} type.\n */\nclass DurationDeserializer extends TypeDeserializer {\n\n    DurationDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    public Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {\n        return Duration.parse(value);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/EnumDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer of the {@link Enum}.\n */\nclass EnumDeserializer extends TypeDeserializer {\n\n    EnumDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {\n        return Enum.valueOf((Class<Enum>) rType, value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/FloatDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\n/**\n * Deserializer of the {@link Float} type.\n */\nclass FloatDeserializer extends AbstractNumberDeserializer<Float> {\n\n    FloatDeserializer(TypeDeserializerBuilder builder) {\n        super(builder, false);\n    }\n\n    @Override\n    Float parseNumberValue(String value) {\n        return Float.parseFloat(value);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/InstantDeserializer.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.time.Instant;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\n/**\n * Deserializer of the {@link Instant} type.\n */\nclass InstantDeserializer extends AbstractDateDeserializer<Instant> {\n\n    private static final DateTimeFormatter DEFAULT_FORMATTER = DateTimeFormatter.ISO_INSTANT.withZone(UTC);\n\n    InstantDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    protected Instant fromInstant(Instant instant) {\n        return instant;\n    }\n\n    @Override\n    protected Instant parseDefault(String jsonValue, Locale locale) {\n        return Instant.from(DEFAULT_FORMATTER.withLocale(locale).parse(jsonValue));\n    }\n\n    @Override\n    protected Instant parseWithFormatter(String jsonValue, DateTimeFormatter formatter) {\n        return Instant.from(getZonedFormatter(formatter).parse(jsonValue));\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/IntegerDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\n\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer of the {@link Integer} type.\n */\nclass IntegerDeserializer extends AbstractNumberDeserializer<Integer> {\n\n    IntegerDeserializer(TypeDeserializerBuilder builder) {\n        super(builder, true);\n    }\n\n    @Override\n    Integer parseNumberValue(String value) {\n        return Integer.parseInt(value);\n    }\n\n    @Override\n    Object deserializeNumberValue(JsonParser value, DeserializationContextImpl context, Type rType) {\n        return value.getInt();\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/JsonValueDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport jakarta.json.JsonValue;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.deserializer.ModelDeserializer;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Deserializer of the {@link JsonValue} type.\n */\nclass JsonValueDeserializer implements ModelDeserializer<JsonParser> {\n\n    private final ModelDeserializer<Object> delegate;\n    private final JsonValue nullValue;\n\n    JsonValueDeserializer(TypeDeserializerBuilder builder, JsonValue nullValue) {\n        this.delegate = builder.getDelegate();\n        this.nullValue = nullValue;\n    }\n\n    @Override\n    public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        JsonParser.Event last = context.getLastValueEvent();\n        return delegate.deserialize(deserializeValue(last, value), context);\n    }\n\n    private JsonValue deserializeValue(JsonParser.Event last, JsonParser parser) {\n        switch (last) {\n        case VALUE_TRUE:\n            return JsonValue.TRUE;\n        case VALUE_FALSE:\n            return JsonValue.FALSE;\n        case VALUE_NULL:\n            return nullValue;\n        case VALUE_STRING:\n        case VALUE_NUMBER:\n            return parser.getValue();\n        case START_OBJECT:\n            return parser.getObject();\n        case START_ARRAY:\n            return parser.getArray();\n        default:\n            throw new JsonbException(Messages.getMessage(MessageKeys.INTERNAL_ERROR, \"Unknown JSON value: \" + last));\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/LocalDateDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.time.Instant;\nimport java.time.LocalDate;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\n/**\n * Deserializer of the {@link LocalDate} type.\n */\nclass LocalDateDeserializer extends AbstractDateDeserializer<LocalDate> {\n\n    LocalDateDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    protected LocalDate fromInstant(Instant instant) {\n        return instant.atZone(UTC).toLocalDate();\n    }\n\n    @Override\n    protected LocalDate parseDefault(String jsonValue, Locale locale) {\n        return LocalDate.parse(jsonValue, DateTimeFormatter.ISO_LOCAL_DATE.withLocale(locale));\n    }\n\n    @Override\n    protected LocalDate parseWithFormatter(String jsonValue, DateTimeFormatter formatter) {\n        return LocalDate.parse(jsonValue, formatter);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/LocalDateTimeDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.time.Instant;\nimport java.time.LocalDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\n/**\n * Deserializer of the {@link LocalDateTime} type.\n */\nclass LocalDateTimeDeserializer extends AbstractDateDeserializer<LocalDateTime> {\n\n    LocalDateTimeDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    protected LocalDateTime fromInstant(Instant instant) {\n        return LocalDateTime.ofInstant(instant, UTC);\n    }\n\n    @Override\n    protected LocalDateTime parseDefault(String jsonValue, Locale locale) {\n        return LocalDateTime.parse(jsonValue, DateTimeFormatter.ISO_LOCAL_DATE_TIME.withLocale(locale));\n    }\n\n    @Override\n    protected LocalDateTime parseWithFormatter(String jsonValue, DateTimeFormatter formatter) {\n        return LocalDateTime.parse(jsonValue, formatter);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/LocalTimeDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.time.Instant;\nimport java.time.LocalTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Deserializer of the {@link LocalTime} type.\n */\nclass LocalTimeDeserializer extends AbstractDateDeserializer<LocalTime> {\n\n    LocalTimeDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    protected LocalTime fromInstant(Instant instant) {\n        throw new JsonbException(Messages.getMessage(MessageKeys.TIME_TO_EPOCH_MILLIS_ERROR, LocalTime.class.getSimpleName()));\n    }\n\n    @Override\n    protected LocalTime parseDefault(String jsonValue, Locale locale) {\n        return LocalTime.parse(jsonValue, DateTimeFormatter.ISO_LOCAL_TIME.withLocale(locale));\n    }\n\n    @Override\n    protected LocalTime parseWithFormatter(String jsonValue, DateTimeFormatter formatter) {\n        return LocalTime.parse(jsonValue, formatter);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/LongDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\n\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer of the {@link Long} type.\n */\nclass LongDeserializer extends AbstractNumberDeserializer<Long> {\n\n    LongDeserializer(TypeDeserializerBuilder builder) {\n        super(builder, true);\n    }\n\n    @Override\n    Long parseNumberValue(String value) {\n        return Long.parseLong(value);\n    }\n\n    @Override\n    Object deserializeNumberValue(JsonParser value, DeserializationContextImpl context, Type rType) {\n        return value.getLong();\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/MonthDayTypeDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.time.Instant;\nimport java.time.MonthDay;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\n/**\n * Deserializer of the {@link MonthDay} type.\n */\nclass MonthDayTypeDeserializer extends AbstractDateDeserializer<MonthDay> {\n\n    private static final DateTimeFormatter DEFAULT_FORMAT = DateTimeFormatter.ofPattern(\"--MM-dd\").withZone(UTC);\n\n    MonthDayTypeDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    protected MonthDay fromInstant(Instant instant) {\n        return MonthDay.from(instant.atZone(UTC));\n    }\n\n    @Override\n    protected MonthDay parseDefault(String jsonValue, Locale locale) {\n        return MonthDay.parse(jsonValue, DEFAULT_FORMAT.withLocale(locale));\n    }\n\n    @Override\n    protected MonthDay parseWithFormatter(String jsonValue, DateTimeFormatter formatter) {\n        return MonthDay.parse(jsonValue, formatter);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/NumberDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\nimport java.math.BigDecimal;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer of the {@link Number} type.\n */\nclass NumberDeserializer extends TypeDeserializer {\n\n    NumberDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {\n        return new BigDecimal(value);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/ObjectTypeDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\nimport java.math.BigDecimal;\nimport java.util.List;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.deserializer.ModelDeserializer;\n\n/**\n * Deserializer of the {@link Object} type.\n */\nclass ObjectTypeDeserializer implements ModelDeserializer<JsonParser> {\n\n    private static final Type LIST = List.class;\n\n    private final ModelDeserializer<Object> delegate;\n    private final Class<?> mapClass;\n\n    ObjectTypeDeserializer(TypeDeserializerBuilder builder) {\n        this.delegate = builder.getDelegate();\n        this.mapClass = builder.getConfigProperties().getDefaultMapImplType();\n    }\n\n    @Override\n    public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        Object toSet;\n        switch (context.getLastValueEvent()) {\n        case VALUE_TRUE:\n            toSet = Boolean.TRUE;\n            break;\n        case VALUE_FALSE:\n            toSet = Boolean.FALSE;\n            break;\n        case VALUE_NUMBER:\n            toSet = new BigDecimal(value.getString());\n            break;\n        case KEY_NAME:\n        case VALUE_STRING:\n            toSet = value.getString();\n            break;\n        case START_OBJECT:\n            DeserializationContextImpl newContext = new DeserializationContextImpl(context);\n            toSet = newContext.deserialize(mapClass, value);\n            break;\n        case START_ARRAY:\n            DeserializationContextImpl newContext1 = new DeserializationContextImpl(context);\n            toSet = newContext1.deserialize(LIST, value);\n            break;\n        default:\n            throw new JsonbException(\"Unexpected event: \" + context.getLastValueEvent());\n        }\n        return delegate.deserialize(toSet, context);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/OffsetDateTimeDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.time.Instant;\nimport java.time.OffsetDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\nimport java.util.logging.Logger;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Deserializer of the {@link OffsetDateTime} type.\n */\nclass OffsetDateTimeDeserializer extends AbstractDateDeserializer<OffsetDateTime> {\n\n    private static final Logger LOGGER = Logger.getLogger(OffsetDateTimeDeserializer.class.getName());\n\n    OffsetDateTimeDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    /**\n     * fromInstant is called only in case {@link jakarta.json.bind.annotation.JsonbDateFormat} is TIME_IN_MILLIS,\n     * which doesn't make much sense for usage with OffsetDateTime.\n     */\n    @Override\n    protected OffsetDateTime fromInstant(Instant instant) {\n        LOGGER.warning(Messages.getMessage(MessageKeys.OFFSET_DATE_TIME_FROM_MILLIS, OffsetDateTime.class.getSimpleName(), UTC));\n        return OffsetDateTime.ofInstant(instant, UTC);\n    }\n\n    @Override\n    protected OffsetDateTime parseDefault(String jsonValue, Locale locale) {\n        return OffsetDateTime.parse(jsonValue, DateTimeFormatter.ISO_OFFSET_DATE_TIME.withLocale(locale));\n    }\n\n    @Override\n    protected OffsetDateTime parseWithFormatter(String jsonValue, DateTimeFormatter formatter) {\n        return OffsetDateTime.parse(jsonValue, formatter);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/OffsetTimeDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.time.Instant;\nimport java.time.OffsetTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Deserializer of the {@link OffsetTime} type.\n */\nclass OffsetTimeDeserializer extends AbstractDateDeserializer<OffsetTime> {\n\n    OffsetTimeDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    protected OffsetTime fromInstant(Instant instant) {\n        throw new JsonbException(Messages.getMessage(MessageKeys.TIME_TO_EPOCH_MILLIS_ERROR, OffsetTime.class.getSimpleName()));\n    }\n\n    @Override\n    protected OffsetTime parseDefault(String jsonValue, Locale locale) {\n        return OffsetTime.parse(jsonValue, DateTimeFormatter.ISO_OFFSET_TIME.withLocale(locale));\n    }\n\n    @Override\n    protected OffsetTime parseWithFormatter(String jsonValue, DateTimeFormatter formatter) {\n        return OffsetTime.parse(jsonValue, formatter);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/OptionalDoubleDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.util.OptionalDouble;\n\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.deserializer.ModelDeserializer;\n\n/**\n * Deserializer of the {@link OptionalDouble} type.\n */\nclass OptionalDoubleDeserializer implements ModelDeserializer<JsonParser> {\n\n    private final ModelDeserializer<JsonParser> extractor;\n    private final ModelDeserializer<Object> nullValueDelegate;\n\n    OptionalDoubleDeserializer(ModelDeserializer<JsonParser> extractor, ModelDeserializer<Object> nullValueDelegate) {\n        this.extractor = extractor;\n        this.nullValueDelegate = nullValueDelegate;\n    }\n\n    @Override\n    public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        if (context.getLastValueEvent() == JsonParser.Event.VALUE_NULL) {\n            return nullValueDelegate.deserialize(OptionalDouble.empty(), context);\n        }\n        OptionalDouble optional = OptionalDouble.of((Double) extractor.deserialize(value, context));\n        return nullValueDelegate.deserialize(optional, context);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/OptionalIntDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.util.OptionalInt;\n\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.deserializer.ModelDeserializer;\n\n/**\n * Deserializer of the {@link OptionalInt} type.\n */\nclass OptionalIntDeserializer implements ModelDeserializer<JsonParser> {\n\n    private final ModelDeserializer<JsonParser> extractor;\n    private final ModelDeserializer<Object> delegate;\n\n    OptionalIntDeserializer(ModelDeserializer<JsonParser> extractor, ModelDeserializer<Object> delegate) {\n        this.extractor = extractor;\n        this.delegate = delegate;\n    }\n\n    @Override\n    public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        if (context.getLastValueEvent() == JsonParser.Event.VALUE_NULL) {\n            return delegate.deserialize(OptionalInt.empty(), context);\n        }\n        OptionalInt optional = OptionalInt.of((Integer) extractor.deserialize(value, context));\n        return delegate.deserialize(optional, context);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/OptionalLongDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.util.OptionalLong;\n\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.deserializer.ModelDeserializer;\n\n/**\n * Deserializer of the {@link OptionalLong} type.\n */\nclass OptionalLongDeserializer implements ModelDeserializer<JsonParser> {\n\n    private final ModelDeserializer<JsonParser> extractor;\n    private final ModelDeserializer<Object> nullValueDelegate;\n\n    OptionalLongDeserializer(ModelDeserializer<JsonParser> extractor, ModelDeserializer<Object> nullValueDelegate) {\n        this.extractor = extractor;\n        this.nullValueDelegate = nullValueDelegate;\n    }\n\n    @Override\n    public Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        if (context.getLastValueEvent() == JsonParser.Event.VALUE_NULL) {\n            return nullValueDelegate.deserialize(OptionalLong.empty(), context);\n        }\n        OptionalLong optional = OptionalLong.of((Long) extractor.deserialize(value, context));\n        return nullValueDelegate.deserialize(optional, context);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/PathDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\nimport java.nio.file.Paths;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer of the {@link java.nio.file.Path} type.\n */\nclass PathDeserializer extends TypeDeserializer {\n\n    PathDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {\n        return Paths.get(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/PeriodDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\nimport java.time.Period;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer of the {@link Period} type.\n */\nclass PeriodDeserializer extends TypeDeserializer {\n\n    PeriodDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {\n        return Period.parse(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/ShortDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\n/**\n * Deserializer of the {@link Short} type.\n */\nclass ShortDeserializer extends AbstractNumberDeserializer<Short> {\n\n    ShortDeserializer(TypeDeserializerBuilder builder) {\n        super(builder, true);\n    }\n\n    @Override\n    Short parseNumberValue(String value) {\n        return Short.parseShort(value);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/SqlDateDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\nimport java.sql.Date;\nimport java.time.Instant;\nimport java.time.LocalDate;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer of the {@link Date} type.\n */\npublic class SqlDateDeserializer extends AbstractDateDeserializer<Date> implements JsonbDeserializer<Date> {\n\n    private static final DateTimeFormatter DEFAULT_FORMATTER = DateTimeFormatter.ISO_DATE.withZone(UTC);\n\n    SqlDateDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    /**\n     * Create new instance.\n     */\n    public SqlDateDeserializer() {\n        super(Date.class);\n    }\n\n    @Override\n    protected Date fromInstant(Instant instant) {\n        return new Date(instant.toEpochMilli());\n    }\n\n    @Override\n    protected Date parseDefault(String jsonValue, Locale locale) {\n        return Date.valueOf(LocalDate.parse(jsonValue, DEFAULT_FORMATTER.withLocale(locale)));\n    }\n\n    @Override\n    protected Date parseWithFormatter(String jsonValue, DateTimeFormatter formatter) {\n        return Date.valueOf(LocalDate.parse(jsonValue, formatter));\n    }\n\n    @Override\n    public Date deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {\n        DeserializationContextImpl context = (DeserializationContextImpl) ctx;\n        return (Date) deserialize(parser.getString(), context);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/SqlTimestampDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.sql.Timestamp;\nimport java.time.Instant;\nimport java.time.LocalDateTime;\nimport java.time.ZoneId;\nimport java.time.format.DateTimeFormatter;\nimport java.time.temporal.TemporalAccessor;\nimport java.util.Locale;\n\n/**\n * Deserializer of the {@link Timestamp} type.\n */\nclass SqlTimestampDeserializer extends AbstractDateDeserializer<Timestamp> {\n\n    private static final DateTimeFormatter DEFAULT_FORMATTER = DateTimeFormatter.ISO_DATE_TIME.withZone(UTC);\n\n    SqlTimestampDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    protected Timestamp fromInstant(Instant instant) {\n        return Timestamp.from(instant);\n    }\n\n    @Override\n    protected Timestamp parseDefault(String jsonValue, Locale locale) {\n        final TemporalAccessor parsed = DEFAULT_FORMATTER.withLocale(locale).parse(jsonValue);\n        return Timestamp.from(getInstant(parsed));\n    }\n\n    @Override\n    protected Timestamp parseWithFormatter(String jsonValue, DateTimeFormatter formatter) {\n        final TemporalAccessor parsed = getZonedFormatter(formatter).parse(jsonValue);\n        return Timestamp.from(getInstant(parsed));\n    }\n\n    private Instant getInstant(TemporalAccessor parsed) {\n        LocalDateTime local = LocalDateTime.from(parsed);\n        return local.atZone(ZoneId.of(\"UTC\")).toInstant();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/StringDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\nimport java.nio.charset.StandardCharsets;\n\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.JsonbConfigProperties;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Deserializer of the {@link String} type.\n */\nclass StringDeserializer extends TypeDeserializer {\n\n    StringDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    public Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {\n        JsonbConfigProperties config = context.getJsonbContext().getConfigProperties();\n        return checkIJson(value, config);\n    }\n\n    private String checkIJson(String value, JsonbConfigProperties config) {\n        if (config.isStrictIJson()) {\n            String newString = new String(value.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);\n            if (!newString.equals(value)) {\n                throw new JsonbException(Messages.getMessage(MessageKeys.UNPAIRED_SURROGATE));\n            }\n        }\n        return value;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/TimeZoneDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\nimport java.time.LocalDateTime;\nimport java.time.ZoneId;\nimport java.time.ZonedDateTime;\nimport java.time.zone.ZoneRulesException;\nimport java.util.SimpleTimeZone;\n\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Deserializer of the {@link java.util.TimeZone} type.\n */\nclass TimeZoneDeserializer extends TypeDeserializer {\n\n    TimeZoneDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {\n        try {\n            final ZoneId zoneId = ZoneId.of(value);\n            final ZonedDateTime zonedDateTime = LocalDateTime.now().atZone(zoneId);\n            return new SimpleTimeZone(zonedDateTime.getOffset().getTotalSeconds() * 1000, zoneId.getId());\n        } catch (ZoneRulesException e) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.ZONE_PARSE_ERROR, value), e);\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/TypeDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\n\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\nimport org.eclipse.yasson.internal.deserializer.ModelDeserializer;\n\n/**\n * Base for all type deserializers.\n */\npublic abstract class TypeDeserializer implements ModelDeserializer<String> {\n\n    private final ModelDeserializer<Object> delegate;\n    private final Class<?> clazz;\n\n    TypeDeserializer(TypeDeserializerBuilder builder) {\n        this.delegate = builder.getDelegate();\n        this.clazz = builder.getClazz();\n    }\n\n    @Override\n    public final Object deserialize(String value, DeserializationContextImpl context) {\n        return delegate.deserialize(deserializeStringValue(value, context, clazz), context);\n    }\n\n    public final Object deserialize(boolean value, DeserializationContextImpl context) {\n        return delegate.deserialize(deserializeBooleanValue(value, context, clazz), context);\n    }\n\n    public final Object deserialize(JsonParser value, DeserializationContextImpl context) {\n        return delegate.deserialize(deserializeNumberValue(value, context, clazz), context);\n    }\n\n    abstract Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType);\n\n    Object deserializeBooleanValue(boolean value, DeserializationContextImpl context, Type rType) {\n        return deserializeStringValue(String.valueOf(value), context, rType);\n    }\n\n    Object deserializeNumberValue(JsonParser value, DeserializationContextImpl context, Type rType) {\n        return deserializeStringValue(value.getString(), context, rType);\n    }\n\n    Class<?> getType() {\n        return clazz;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/TypeDeserializerBuilder.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.util.Objects;\n\nimport org.eclipse.yasson.internal.JsonbConfigProperties;\nimport org.eclipse.yasson.internal.deserializer.ModelDeserializer;\nimport org.eclipse.yasson.internal.model.customization.ClassCustomization;\nimport org.eclipse.yasson.internal.model.customization.Customization;\n\nclass TypeDeserializerBuilder {\n\n    private final Class<?> clazz;\n    private final Customization customization;\n    private final JsonbConfigProperties configProperties;\n    private final ModelDeserializer<Object> delegate;\n\n    TypeDeserializerBuilder(Class<?> clazz,\n                            Customization customization,\n                            JsonbConfigProperties configProperties,\n                            ModelDeserializer<Object> delegate) {\n        this.clazz = Objects.requireNonNull(clazz);\n        this.customization = customization == null ? ClassCustomization.empty() : customization;\n        this.configProperties = configProperties;\n        this.delegate = Objects.requireNonNull(delegate);\n    }\n\n    public Class<?> getClazz() {\n        return clazz;\n    }\n\n    public JsonbConfigProperties getConfigProperties() {\n        return configProperties;\n    }\n\n    public ModelDeserializer<Object> getDelegate() {\n        return delegate;\n    }\n\n    public Customization getCustomization() {\n        return customization;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/TypeDeserializers.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.net.URI;\nimport java.net.URL;\nimport java.nio.file.Path;\nimport java.sql.Timestamp;\nimport java.time.Duration;\nimport java.time.Instant;\nimport java.time.LocalDate;\nimport java.time.LocalDateTime;\nimport java.time.LocalTime;\nimport java.time.MonthDay;\nimport java.time.OffsetDateTime;\nimport java.time.OffsetTime;\nimport java.time.Period;\nimport java.time.YearMonth;\nimport java.time.ZoneId;\nimport java.time.ZoneOffset;\nimport java.time.ZonedDateTime;\nimport java.util.Calendar;\nimport java.util.Date;\nimport java.util.GregorianCalendar;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.OptionalDouble;\nimport java.util.OptionalInt;\nimport java.util.OptionalLong;\nimport java.util.Set;\nimport java.util.SimpleTimeZone;\nimport java.util.TimeZone;\nimport java.util.UUID;\nimport java.util.function.Function;\n\nimport javax.xml.datatype.XMLGregorianCalendar;\n\nimport jakarta.json.JsonValue;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.JsonbConfigProperties;\nimport org.eclipse.yasson.internal.deserializer.JustReturn;\nimport org.eclipse.yasson.internal.deserializer.ModelDeserializer;\nimport org.eclipse.yasson.internal.deserializer.NullCheckDeserializer;\nimport org.eclipse.yasson.internal.deserializer.PositionChecker;\nimport org.eclipse.yasson.internal.deserializer.ValueExtractor;\nimport org.eclipse.yasson.internal.model.customization.Customization;\n\nimport static org.eclipse.yasson.internal.BuiltInTypes.isClassAvailable;\n\n/**\n * Specific type deserializers.\n */\npublic class TypeDeserializers {\n\n    private static final Map<Class<?>, Function<TypeDeserializerBuilder, TypeDeserializer>> DESERIALIZERS =\n            new HashMap<>();\n    private static final Map<Class<?>, Class<?>> OPTIONAL_TYPES = new HashMap<>();\n\n    static {\n        DESERIALIZERS.put(BigInteger.class, BigIntegerDeserializer::new);\n        DESERIALIZERS.put(BigDecimal.class, BigDecimalDeserializer::new);\n        DESERIALIZERS.put(Boolean.class, BooleanDeserializer::new);\n        DESERIALIZERS.put(Boolean.TYPE, BooleanDeserializer::new);\n        DESERIALIZERS.put(Byte.class, ByteDeserializer::new);\n        DESERIALIZERS.put(Byte.TYPE, ByteDeserializer::new);\n        DESERIALIZERS.put(Calendar.class, CalendarDeserializer::new);\n        DESERIALIZERS.put(Character.TYPE, CharDeserializer::new);\n        DESERIALIZERS.put(Character.class, CharDeserializer::new);\n        DESERIALIZERS.put(Date.class, DateDeserializer::new);\n        DESERIALIZERS.put(Double.class, DoubleDeserializer::new);\n        DESERIALIZERS.put(Double.TYPE, DoubleDeserializer::new);\n        DESERIALIZERS.put(Duration.class, DurationDeserializer::new);\n        DESERIALIZERS.put(Float.class, FloatDeserializer::new);\n        DESERIALIZERS.put(Float.TYPE, FloatDeserializer::new);\n        DESERIALIZERS.put(GregorianCalendar.class, CalendarDeserializer::new);\n        DESERIALIZERS.put(Instant.class, InstantDeserializer::new);\n        DESERIALIZERS.put(Integer.class, IntegerDeserializer::new);\n        DESERIALIZERS.put(Integer.TYPE, IntegerDeserializer::new);\n        DESERIALIZERS.put(LocalDate.class, LocalDateDeserializer::new);\n        DESERIALIZERS.put(LocalDateTime.class, LocalDateTimeDeserializer::new);\n        DESERIALIZERS.put(LocalTime.class, LocalTimeDeserializer::new);\n        DESERIALIZERS.put(Long.class, LongDeserializer::new);\n        DESERIALIZERS.put(Long.TYPE, LongDeserializer::new);\n        DESERIALIZERS.put(MonthDay.class, MonthDayTypeDeserializer::new);\n        DESERIALIZERS.put(Number.class, NumberDeserializer::new);\n        DESERIALIZERS.put(OffsetDateTime.class, OffsetDateTimeDeserializer::new);\n        DESERIALIZERS.put(OffsetTime.class, OffsetTimeDeserializer::new);\n        DESERIALIZERS.put(Path.class, PathDeserializer::new);\n        DESERIALIZERS.put(Period.class, PeriodDeserializer::new);\n        DESERIALIZERS.put(Short.class, ShortDeserializer::new);\n        DESERIALIZERS.put(Short.TYPE, ShortDeserializer::new);\n        DESERIALIZERS.put(String.class, StringDeserializer::new);\n        DESERIALIZERS.put(SimpleTimeZone.class, TimeZoneDeserializer::new);\n        DESERIALIZERS.put(TimeZone.class, TimeZoneDeserializer::new);\n        DESERIALIZERS.put(URI.class, UriDeserializer::new);\n        DESERIALIZERS.put(URL.class, UrlDeserializer::new);\n        DESERIALIZERS.put(UUID.class, UuidDeserializer::new);\n        if (isClassAvailable(\"javax.xml.datatype.XMLGregorianCalendar\")) {\n            DESERIALIZERS.put(XMLGregorianCalendar.class, XmlGregorianCalendarDeserializer::new);\n        }\n        DESERIALIZERS.put(YearMonth.class, YearMonthTypeDeserializer::new);\n        DESERIALIZERS.put(ZonedDateTime.class, ZonedDateTimeDeserializer::new);\n        DESERIALIZERS.put(ZoneId.class, ZoneIdDeserializer::new);\n        DESERIALIZERS.put(ZoneOffset.class, ZoneOffsetDeserializer::new);\n        if (isClassAvailable(\"java.sql.Date\")) {\n            DESERIALIZERS.put(java.sql.Date.class, SqlDateDeserializer::new);\n            DESERIALIZERS.put(Timestamp.class, SqlTimestampDeserializer::new);\n        }\n\n        OPTIONAL_TYPES.put(OptionalLong.class, Long.class);\n        OPTIONAL_TYPES.put(OptionalInt.class, Integer.class);\n        OPTIONAL_TYPES.put(OptionalDouble.class, Double.class);\n    }\n\n    private TypeDeserializers() {\n        throw new IllegalStateException(\"Utility classes cannot be instantiated\");\n    }\n\n    /**\n     * Return deserializer for the given type.\n     *\n     * @param clazz         type to create deserializer for\n     * @param customization type customization\n     * @param properties    config properties\n     * @param delegate      delegate to be called by the created deserializer\n     * @param events        expected parser events at the beginning when deserializing the type\n     * @return type deserializer\n     */\n    public static ModelDeserializer<JsonParser> getTypeDeserializer(Class<?> clazz,\n                                                                    Customization customization,\n                                                                    JsonbConfigProperties properties,\n                                                                    ModelDeserializer<Object> delegate,\n                                                                    Set<JsonParser.Event> events) {\n        JsonParser.Event[] eventArray = events.toArray(new JsonParser.Event[0]);\n        if (OPTIONAL_TYPES.containsKey(clazz)) {\n            Class<?> optionalType = OPTIONAL_TYPES.get(clazz);\n            TypeDeserializerBuilder builder = new TypeDeserializerBuilder(optionalType,\n                                                                          customization,\n                                                                          properties,\n                                                                          JustReturn.instance());\n            ValueExtractor valueExtractor = new ValueExtractor(DESERIALIZERS.get(optionalType).apply(builder));\n            PositionChecker positionChecker = new PositionChecker(valueExtractor, clazz, eventArray);\n            if (OptionalLong.class.equals(clazz)) {\n                return new OptionalLongDeserializer(positionChecker, delegate);\n            } else if (OptionalInt.class.equals(clazz)) {\n                return new OptionalIntDeserializer(positionChecker, delegate);\n            } else if (OptionalDouble.class.equals(clazz)) {\n                return new OptionalDoubleDeserializer(positionChecker, delegate);\n            } else {\n                throw new JsonbException(\"Unsupported Optional type for deserialization: \" + clazz);\n            }\n        }\n\n        TypeDeserializerBuilder builder = new TypeDeserializerBuilder(clazz, customization, properties, delegate);\n        if (DESERIALIZERS.containsKey(clazz)) {\n            ValueExtractor valueExtractor = new ValueExtractor(DESERIALIZERS.get(clazz).apply(builder));\n            return new NullCheckDeserializer(new PositionChecker(valueExtractor, clazz, eventArray), delegate);\n        }\n\n        if (JsonValue.class.equals(clazz)) {\n            return new JsonValueDeserializer(builder, JsonValue.NULL);\n        } else if (JsonValue.class.isAssignableFrom(clazz)) {\n            return new JsonValueDeserializer(builder, null);\n        }\n        ModelDeserializer<JsonParser> deserializer = assignableCases(builder, eventArray);\n        if (deserializer != null) {\n            return new NullCheckDeserializer(deserializer, delegate);\n        }\n        return null;\n    }\n\n    private static ModelDeserializer<JsonParser> assignableCases(TypeDeserializerBuilder builder,\n                                                                 JsonParser.Event[] checker) {\n        if (Enum.class.isAssignableFrom(builder.getClazz())) {\n            return new PositionChecker(new ValueExtractor(new EnumDeserializer(builder)),\n                                       builder.getClazz(),\n                                       checker);\n        } else if (Object.class.equals(builder.getClazz())) {\n            return new ObjectTypeDeserializer(builder);\n        }\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/UriDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\nimport java.net.URI;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer of the {@link URI} type.\n */\nclass UriDeserializer extends TypeDeserializer {\n\n    UriDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {\n        return URI.create(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/UrlDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer of the {@link URL} type.\n */\nclass UrlDeserializer extends TypeDeserializer {\n\n    UrlDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {\n        URL url = null;\n        try {\n            url = new URL(value);\n        } catch (MalformedURLException e) {\n            e.printStackTrace();\n        }\n        return url;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/UuidDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\nimport java.util.UUID;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer of the {@link UUID} type.\n */\nclass UuidDeserializer extends TypeDeserializer {\n\n    UuidDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {\n        return UUID.fromString(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/XmlGregorianCalendarDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.time.Instant;\nimport java.time.LocalDate;\nimport java.time.LocalTime;\nimport java.time.ZoneId;\nimport java.time.ZonedDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.time.temporal.TemporalAccessor;\nimport java.time.temporal.TemporalQueries;\nimport java.util.Calendar;\nimport java.util.GregorianCalendar;\nimport java.util.Locale;\nimport java.util.TimeZone;\n\nimport javax.xml.datatype.DatatypeConfigurationException;\nimport javax.xml.datatype.DatatypeFactory;\nimport javax.xml.datatype.XMLGregorianCalendar;\n\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Deserializer of the {@link XMLGregorianCalendar} type.\n */\nclass XmlGregorianCalendarDeserializer extends AbstractDateDeserializer<XMLGregorianCalendar> {\n\n    private static final LocalTime ZERO_LOCAL_TIME = LocalTime.parse(\"00:00:00\");\n\n    private final Calendar calendarTemplate;\n    private final DatatypeFactory datatypeFactory;\n\n    XmlGregorianCalendarDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n        this.calendarTemplate = new GregorianCalendar();\n        this.calendarTemplate.clear();\n        this.calendarTemplate.setTimeZone(TimeZone.getTimeZone(UTC));\n        try {\n            this.datatypeFactory = DatatypeFactory.newInstance();\n        } catch (DatatypeConfigurationException e) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.DATATYPE_FACTORY_CREATION_FAILED), e);\n        }\n    }\n\n    @Override\n    protected XMLGregorianCalendar fromInstant(Instant instant) {\n        final GregorianCalendar calendar = (GregorianCalendar) calendarTemplate.clone();\n        calendar.setTimeInMillis(instant.toEpochMilli());\n        return datatypeFactory.newXMLGregorianCalendar(calendar);\n    }\n\n    @Override\n    protected XMLGregorianCalendar parseDefault(String jsonValue, Locale locale) {\n        DateTimeFormatter formatter = jsonValue.contains(\"T\")\n                ? DateTimeFormatter.ISO_DATE_TIME\n                : DateTimeFormatter.ISO_DATE;\n        return parseWithFormatter(jsonValue, formatter.withLocale(locale));\n    }\n\n    @Override\n    protected XMLGregorianCalendar parseWithFormatter(String jsonValue, DateTimeFormatter formatter) {\n        final TemporalAccessor parsed = formatter.parse(jsonValue);\n        LocalTime time = parsed.query(TemporalQueries.localTime());\n        ZoneId zone = parsed.query(TemporalQueries.zone());\n        if (zone == null) {\n            zone = UTC;\n        }\n        if (time == null) {\n            time = ZERO_LOCAL_TIME;\n        }\n        ZonedDateTime result = LocalDate.from(parsed).atTime(time).atZone(zone);\n        return datatypeFactory.newXMLGregorianCalendar(GregorianCalendar.from(result));\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/YearMonthTypeDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.time.Instant;\nimport java.time.YearMonth;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\n/**\n * Deserializer of the {@link YearMonth} type.\n */\nclass YearMonthTypeDeserializer extends AbstractDateDeserializer<YearMonth> {\n\n    private static final DateTimeFormatter DEFAULT_FORMAT = DateTimeFormatter.ofPattern(\"yyyy-MM\").withZone(UTC);\n\n    YearMonthTypeDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    protected YearMonth fromInstant(Instant instant) {\n        return YearMonth.from(instant.atZone(UTC));\n    }\n\n    @Override\n    protected YearMonth parseDefault(String jsonValue, Locale locale) {\n        return YearMonth.parse(jsonValue, DEFAULT_FORMAT.withLocale(locale));\n    }\n\n    @Override\n    protected YearMonth parseWithFormatter(String jsonValue, DateTimeFormatter formatter) {\n        return YearMonth.parse(jsonValue, formatter);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/ZoneIdDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\nimport java.time.ZoneId;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer of the {@link ZoneId} type.\n */\nclass ZoneIdDeserializer extends TypeDeserializer {\n\n    ZoneIdDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {\n        return ZoneId.of(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/ZoneOffsetDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.lang.reflect.Type;\nimport java.time.ZoneOffset;\n\nimport org.eclipse.yasson.internal.DeserializationContextImpl;\n\n/**\n * Deserializer of the {@link ZoneOffset} type.\n */\nclass ZoneOffsetDeserializer extends TypeDeserializer {\n\n    ZoneOffsetDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {\n        return ZoneOffset.of(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/deserializer/types/ZonedDateTimeDeserializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.deserializer.types;\n\nimport java.time.Instant;\nimport java.time.ZonedDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\nimport java.util.logging.Logger;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Deserializer of the {@link ZonedDateTime} type.\n */\nclass ZonedDateTimeDeserializer extends AbstractDateDeserializer<ZonedDateTime> {\n\n    private static final Logger LOGGER = Logger.getLogger(ZonedDateTimeDeserializer.class.getName());\n\n    ZonedDateTimeDeserializer(TypeDeserializerBuilder builder) {\n        super(builder);\n    }\n\n    /**\n     * fromInstant is called only in case {@link jakarta.json.bind.annotation.JsonbDateFormat} is TIME_IN_MILLIS,\n     * which doesn't make much sense for usage with ZonedDateTime.\n     */\n    @Override\n    protected ZonedDateTime fromInstant(Instant instant) {\n        LOGGER.warning(Messages.getMessage(MessageKeys.OFFSET_DATE_TIME_FROM_MILLIS, ZonedDateTime.class.getSimpleName(), UTC));\n        return ZonedDateTime.ofInstant(instant, UTC);\n    }\n\n    @Override\n    protected ZonedDateTime parseDefault(String jsonValue, Locale locale) {\n        return ZonedDateTime.parse(jsonValue, DateTimeFormatter.ISO_ZONED_DATE_TIME.withLocale(locale));\n    }\n\n    @Override\n    protected ZonedDateTime parseWithFormatter(String jsonValue, DateTimeFormatter formatter) {\n        return ZonedDateTime.parse(jsonValue, getZonedFormatter(formatter));\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/jsonstructure/JsonArrayBuilder.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.jsonstructure;\n\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\n\nimport jakarta.json.JsonArray;\nimport jakarta.json.JsonStructure;\nimport jakarta.json.JsonValue;\nimport jakarta.json.spi.JsonProvider;\n\n/**\n * Builds {@link JsonArray}. Delegates to {@link jakarta.json.JsonArrayBuilder}.\n */\nclass JsonArrayBuilder extends JsonStructureBuilder {\n\n    private final jakarta.json.JsonArrayBuilder arrayBuilder;\n\n    /**\n     * Create instance with cached provider.\n     *\n     * @param provider Json provider to create JsonArrayBuilder on.\n     */\n    JsonArrayBuilder(JsonProvider provider) {\n        this.arrayBuilder = provider.createArrayBuilder();\n    }\n\n    @Override\n    JsonArray build() {\n        return arrayBuilder.build();\n    }\n\n    @Override\n    void write(JsonValue value) {\n        arrayBuilder.add(value);\n    }\n\n    @Override\n    void write(String value) {\n        arrayBuilder.add(value);\n    }\n\n    @Override\n    void write(BigDecimal value) {\n        arrayBuilder.add(value);\n    }\n\n    @Override\n    void write(BigInteger value) {\n        arrayBuilder.add(value);\n    }\n\n    @Override\n    void write(int value) {\n        arrayBuilder.add(value);\n    }\n\n    @Override\n    void write(long value) {\n        arrayBuilder.add(value);\n    }\n\n    @Override\n    void write(double value) {\n        arrayBuilder.add(value);\n    }\n\n    @Override\n    void write(boolean value) {\n        arrayBuilder.add(value);\n    }\n\n    @Override\n    void writeNull() {\n        arrayBuilder.addNull();\n    }\n\n    @Override\n    void put(JsonStructure structure) {\n        arrayBuilder.add(structure);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/jsonstructure/JsonArrayIterator.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.jsonstructure;\n\nimport java.util.Iterator;\n\nimport jakarta.json.JsonArray;\nimport jakarta.json.JsonString;\nimport jakarta.json.JsonValue;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Iterates over {@link JsonArray}.\n */\npublic class JsonArrayIterator extends JsonStructureIterator {\n\n    private final Iterator<JsonValue> valueIterator;\n\n    private JsonValue currentValue;\n\n    /**\n     * Creates new array iterator.\n     *\n     * @param jsonArray json array\n     */\n    public JsonArrayIterator(JsonArray jsonArray) {\n        this.valueIterator = jsonArray.iterator();\n    }\n\n    /**\n     * After {@link JsonParser.Event} END_ARRAY is returned from next() iterator is removed from the stack.\n     *\n     * @return always true\n     */\n    @Override\n    public boolean hasNext() {\n        return true;\n    }\n\n    @Override\n    public JsonParser.Event next() {\n        if (valueIterator.hasNext()) {\n            currentValue = valueIterator.next();\n            return getValueEvent(currentValue);\n        }\n        return JsonParser.Event.END_ARRAY;\n    }\n\n    @Override\n    JsonValue getValue() {\n        return currentValue;\n    }\n\n    @Override\n    JsonbException createIncompatibleValueError() {\n        return new JsonbException(Messages.getMessage(MessageKeys.NUMBER_INCOMPATIBLE_VALUE_TYPE_ARRAY,\n                                                      getValue().getValueType()));\n    }\n\n    @Override\n    String getString() {\n        if (currentValue instanceof JsonString) {\n            return ((JsonString) currentValue).getString();\n        }\n        return currentValue.toString();\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/jsonstructure/JsonGeneratorToStructureAdapter.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.jsonstructure;\n\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.ArrayDeque;\nimport java.util.Deque;\n\nimport jakarta.json.JsonStructure;\nimport jakarta.json.JsonValue;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.spi.JsonProvider;\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Adapter for {@link JsonGenerator}, that builds a {@link JsonStructure} content tree instead of JSON text.\n *\n * Yasson and jsonb API components are using {@link JsonGenerator} as its output API.\n * This adapter allows serialization of java content tree into {@link JsonStructure} using same components\n * as when generating JSON text.\n */\npublic class JsonGeneratorToStructureAdapter implements JsonGenerator {\n\n    private final Deque<JsonStructureBuilder> builders;\n\n    private JsonStructure root;\n\n    private final JsonProvider provider;\n\n    /**\n     * Default constructor, jsonp builders are created internally.\n     *\n     * @param provider Cached json provider to create builders on.\n     */\n    public JsonGeneratorToStructureAdapter(JsonProvider provider) {\n        this.builders = new ArrayDeque<>();\n        this.provider = provider;\n    }\n\n    @Override\n    public JsonGenerator writeStartObject() {\n        builders.push(new JsonObjectBuilder(provider));\n        return this;\n    }\n\n    @Override\n    public JsonGenerator writeStartObject(String name) {\n        getJsonObjectBuilder(name).writeKey(name);\n        builders.push(new JsonObjectBuilder(provider));\n        return this;\n    }\n\n    @Override\n    public JsonGenerator writeKey(String name) {\n        getJsonObjectBuilder(name).writeKey(name);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator writeStartArray() {\n        builders.push(new JsonArrayBuilder(provider));\n        return this;\n    }\n\n    @Override\n    public JsonGenerator writeStartArray(String name) {\n        getJsonObjectBuilder(name).writeKey(name);\n        builders.push(new JsonArrayBuilder(provider));\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String name, JsonValue value) {\n        getJsonObjectBuilder(name).write(name, value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String name, String value) {\n        getJsonObjectBuilder(name).write(name, value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String name, BigInteger value) {\n        getJsonObjectBuilder(name).write(name, value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String name, BigDecimal value) {\n        getJsonObjectBuilder(name).write(name, value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String name, int value) {\n        getJsonObjectBuilder(name).write(name, value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String name, long value) {\n        getJsonObjectBuilder(name).write(name, value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String name, double value) {\n        getJsonObjectBuilder(name).write(name, value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String name, boolean value) {\n        getJsonObjectBuilder(name).write(name, value);\n        return this;\n    }\n\n    private JsonObjectBuilder getJsonObjectBuilder(String keyName) {\n        JsonStructureBuilder current = builders.peek();\n        if (!(current instanceof JsonObjectBuilder)) {\n            throw new JsonbException(Messages.getMessage(\n                    MessageKeys.INTERNAL_ERROR, \"Can't write key [\" + keyName + \"] into \" + current.getClass()\n                            + \"because \" + current.getClass() + \" is not an instance of \" + JsonObjectBuilder.class));\n        }\n        return (JsonObjectBuilder) current;\n    }\n\n    @Override\n    public JsonGenerator writeNull(String name) {\n        getJsonObjectBuilder(name).writeNull(name);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator writeEnd() {\n        JsonStructureBuilder builder = builders.pop();\n        JsonStructure structure = builder.build();\n        if (builders.isEmpty()) {\n            this.root = structure;\n        } else {\n            builders.peek().put(structure);\n        }\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(JsonValue value) {\n        builders.peek().write(value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String value) {\n        builders.peek().write(value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(BigDecimal value) {\n        builders.peek().write(value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(BigInteger value) {\n        builders.peek().write(value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(int value) {\n        builders.peek().write(value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(long value) {\n        builders.peek().write(value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(double value) {\n        builders.peek().write(value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(boolean value) {\n        builders.peek().write(value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator writeNull() {\n        builders.peek().writeNull();\n        return this;\n    }\n\n    @Override\n    public void close() {\n        //noop\n    }\n\n    @Override\n    public void flush() {\n        //noop\n    }\n\n    /**\n     * Root structure wrapping all data.\n     *\n     * @return root JsonStructure.\n     */\n    public JsonStructure getRootStructure() {\n        return root;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/jsonstructure/JsonObjectBuilder.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.jsonstructure;\n\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\n\nimport jakarta.json.JsonStructure;\nimport jakarta.json.JsonValue;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.spi.JsonProvider;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Builds {@link jakarta.json.JsonObject} delegates to {@link jakarta.json.JsonObjectBuilder}, caches key when\n * written without a value.\n */\nclass JsonObjectBuilder extends JsonStructureBuilder {\n\n    private final jakarta.json.JsonObjectBuilder builder;\n\n    private String nextKey;\n\n    /**\n     * Create instance with cached provider.\n     *\n     * @param provider Json provider to create JsonObjectBuilder on.\n     */\n    JsonObjectBuilder(JsonProvider provider) {\n        this.builder = provider.createObjectBuilder();\n    }\n\n    @Override\n    JsonStructure build() {\n        return builder.build();\n    }\n\n    @Override\n    void put(JsonStructure structure) {\n        builder.add(getNextKey(), structure);\n    }\n\n    /**\n     * Puts another {@link JsonStructure} into current using provided key.\n     *\n     * @param name      key to put JsonStructure under.\n     * @param structure JsonStructure to put.\n     */\n    void put(String name, JsonStructure structure) {\n        builder.add(name, structure);\n    }\n\n    @Override\n    void write(JsonValue value) {\n        builder.add(getNextKey(), value);\n    }\n\n    @Override\n    void write(String value) {\n        builder.add(getNextKey(), value);\n    }\n\n    @Override\n    void write(BigDecimal value) {\n        builder.add(getNextKey(), value);\n    }\n\n    @Override\n    void write(BigInteger value) {\n        builder.add(getNextKey(), value);\n    }\n\n    @Override\n    void write(int value) {\n        builder.add(getNextKey(), value);\n    }\n\n    @Override\n    void write(long value) {\n        builder.add(getNextKey(), value);\n    }\n\n    @Override\n    void write(double value) {\n        builder.add(getNextKey(), value);\n    }\n\n    @Override\n    void write(boolean value) {\n        builder.add(getNextKey(), value);\n    }\n\n    @Override\n    void writeNull() {\n        builder.addNull(getNextKey());\n    }\n\n    /**\n     * Write a key-value pair into current {@link jakarta.json.JsonObject}.\n     *\n     * @param name  Key name to write value with.\n     * @param value A value to write.\n     */\n    void write(String name, JsonValue value) {\n        builder.add(name, value);\n    }\n\n    /**\n     * Write a key-value pair into current {@link jakarta.json.JsonObject}.\n     *\n     * @param name  Key name to write value with.\n     * @param value A value to write.\n     */\n    void write(String name, String value) {\n        builder.add(name, value);\n    }\n\n    /**\n     * Write a key-value pair into current {@link jakarta.json.JsonObject}.\n     *\n     * @param name  Key name to write value with.\n     * @param value A value to write.\n     */\n    void write(String name, BigDecimal value) {\n        builder.add(name, value);\n    }\n\n    /**\n     * Write a key-value pair into current {@link jakarta.json.JsonObject}.\n     *\n     * @param name  Key name to write value with.\n     * @param value A value to write.\n     */\n    void write(String name, BigInteger value) {\n        builder.add(name, value);\n    }\n\n    /**\n     * Write a key-value pair into current {@link jakarta.json.JsonObject}.\n     *\n     * @param name  Key name to write value with.\n     * @param value A value to write.\n     */\n    void write(String name, int value) {\n        builder.add(name, value);\n    }\n\n    /**\n     * Write a key-value pair into current {@link jakarta.json.JsonObject}.\n     *\n     * @param name  Key name to write value with.\n     * @param value A value to write.\n     */\n    void write(String name, long value) {\n        builder.add(name, value);\n    }\n\n    /**\n     * Write a key-value pair into current {@link jakarta.json.JsonObject}.\n     *\n     * @param name  Key name to write value with.\n     * @param value A value to write.\n     */\n    void write(String name, double value) {\n        builder.add(name, value);\n    }\n\n    /**\n     * Write a key-value pair into current {@link jakarta.json.JsonObject}.\n     *\n     * @param name  Key name to write value with.\n     * @param value A value to write.\n     */\n    void write(String name, boolean value) {\n        builder.add(name, value);\n    }\n\n    /**\n     * Write a null into current {@link jakarta.json.JsonObject} with a given key.\n     *\n     * @param name Key name to write null with.\n     */\n    void writeNull(String name) {\n        builder.addNull(name);\n    }\n\n    /**\n     * Store a key for putting next value into built {@link jakarta.json.JsonObject}.\n     *\n     * @param key Key to store.\n     */\n    void writeKey(String key) {\n        this.nextKey = key;\n    }\n\n    private String getNextKey() {\n        if (nextKey == null) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.INTERNAL_ERROR,\n                                                         \"Can't write a value without key name\"));\n        }\n        String key = nextKey;\n        nextKey = null;\n        return key;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/jsonstructure/JsonObjectIterator.java",
    "content": "/*\n * Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.jsonstructure;\n\nimport java.util.Iterator;\n\nimport jakarta.json.JsonObject;\nimport jakarta.json.JsonValue;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Iterates over {@link JsonObject} managing internal state.\n */\npublic class JsonObjectIterator extends JsonStructureIterator {\n\n    /**\n     * Location pointer.\n     */\n    public enum State {\n        /**\n         * Start of the object.\n         */\n        START,\n        /**\n         * Property key name.\n         */\n        KEY,\n        /**\n         * Property value.\n         */\n        VALUE,\n        /**\n         * End of the object.\n         */\n        END\n    }\n\n    private final JsonObject jsonObject;\n\n    private final Iterator<String> keyIterator;\n\n    private String currentKey;\n\n    private State state = State.START;\n\n    JsonObjectIterator(JsonObject jsonObject) {\n        this.jsonObject = jsonObject;\n        this.keyIterator = jsonObject.keySet().iterator();\n    }\n\n    private void nextKey() {\n        if (!keyIterator.hasNext()) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.INTERNAL_ERROR, \"Object is empty\"));\n        }\n        currentKey = keyIterator.next();\n    }\n\n    @Override\n    public JsonParser.Event next() {\n        switch (state) {\n        case START:\n            if (keyIterator.hasNext()) {\n                nextKey();\n                setState(JsonObjectIterator.State.KEY);\n                return JsonParser.Event.KEY_NAME;\n            } else {\n                setState(State.END);\n                return JsonParser.Event.END_OBJECT;\n            }\n        case KEY:\n            setState(JsonObjectIterator.State.VALUE);\n            JsonValue value = getValue();\n            return getValueEvent(value);\n        case VALUE:\n            if (keyIterator.hasNext()) {\n                nextKey();\n                setState(JsonObjectIterator.State.KEY);\n                return JsonParser.Event.KEY_NAME;\n            }\n            setState(State.END);\n            return JsonParser.Event.END_OBJECT;\n        default:\n            throw new JsonbException(\"Illegal state\");\n        }\n\n    }\n\n    @Override\n    public boolean hasNext() {\n        //From the perspective of JsonParser not finished until END_OBJECT is being read.\n        return state != State.END;\n    }\n\n    /**\n     * {@link JsonValue} for current key.\n     *\n     * @return Current JsonValue.\n     */\n    public JsonValue getValue() {\n        if (state == State.START && currentKey == null) {\n            return jsonObject;\n        }\n        return jsonObject.get(currentKey);\n    }\n\n    @Override\n    String getString() {\n        if (state == JsonObjectIterator.State.KEY) {\n            return currentKey;\n        }\n        return super.getString();\n    }\n\n    @Override\n    JsonbException createIncompatibleValueError() {\n        return new JsonbException(Messages.getMessage(MessageKeys.NUMBER_INCOMPATIBLE_VALUE_TYPE_OBJECT,\n                                                      getValue().getValueType(),\n                                                      currentKey));\n    }\n\n    private void setState(State state) {\n        this.state = state;\n    }\n\n    /**\n     * Current key this iterator is pointing at.\n     *\n     * @return Current key.\n     */\n    public String getKey() {\n        return currentKey;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/jsonstructure/JsonStructureBuilder.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.jsonstructure;\n\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\n\nimport jakarta.json.JsonStructure;\nimport jakarta.json.JsonValue;\n\n/**\n * Grouping interface for {@link jakarta.json.JsonObject} and {@link jakarta.json.JsonArray} generation.\n */\nabstract class JsonStructureBuilder {\n\n    /**\n     * Build and get constructed {@link JsonStructure}.\n     *\n     * @return JsonStructure result.\n     */\n    abstract JsonStructure build();\n\n    /**\n     * Puts another {@link JsonStructure} into current. If current is {@link jakarta.json.JsonObject} than last written\n     * key is used.\n     *\n     * @param structure\n     */\n    abstract void put(JsonStructure structure);\n\n    /**\n     * Write a value into current {@link JsonStructure}. If current is {@link jakarta.json.JsonObject}, last stored key\n     * by {@link JsonObjectBuilder#writeKey(String)} is used.\n     *\n     * @param value A value to write.\n     */\n    abstract void write(JsonValue value);\n\n    /**\n     * Write a value into current {@link JsonStructure}. If current is {@link jakarta.json.JsonObject}, last stored key\n     * by {@link JsonObjectBuilder#writeKey(String)} is used.\n     *\n     * @param value A value to write.\n     */\n    abstract void write(String value);\n\n    /**\n     * Write a value into current {@link JsonStructure}. If current is {@link jakarta.json.JsonObject}, last stored key\n     * by {@link JsonObjectBuilder#writeKey(String)} is used.\n     *\n     * @param value A value to write.\n     */\n    abstract void write(BigDecimal value);\n\n    /**\n     * Write a value into current {@link JsonStructure}. If current is {@link jakarta.json.JsonObject}, last stored key\n     * by {@link JsonObjectBuilder#writeKey(String)} is used.\n     *\n     * @param value A value to write.\n     */\n    abstract void write(BigInteger value);\n\n    /**\n     * Write a value into current {@link JsonStructure}. If current is {@link jakarta.json.JsonObject}, last stored key\n     * by {@link JsonObjectBuilder#writeKey(String)} is used.\n     *\n     * @param value A value to write.\n     */\n    abstract void write(int value);\n\n    /**\n     * Write a value into current {@link JsonStructure}. If current is {@link jakarta.json.JsonObject}, last stored key\n     * by {@link JsonObjectBuilder#writeKey(String)} is used.\n     *\n     * @param value A value to write.\n     */\n    abstract void write(long value);\n\n    /**\n     * Write a value into current {@link JsonStructure}. If current is {@link jakarta.json.JsonObject}, last stored key\n     * by {@link JsonObjectBuilder#writeKey(String)} is used.\n     *\n     * @param value A value to write.\n     */\n    abstract void write(double value);\n\n    /**\n     * Write a value into current {@link JsonStructure}. If current is {@link jakarta.json.JsonObject}, last stored key\n     * by {@link JsonObjectBuilder#writeKey(String)} is used.\n     *\n     * @param value A value to write.\n     */\n    abstract void write(boolean value);\n\n    /**\n     * Write null into current {@link JsonStructure}. If current is {@link jakarta.json.JsonObject}, last stored key\n     * by {@link JsonObjectBuilder#writeKey(String)} is used.\n     */\n    abstract void writeNull();\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/jsonstructure/JsonStructureIterator.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.jsonstructure;\n\nimport java.util.Iterator;\n\nimport jakarta.json.JsonString;\nimport jakarta.json.JsonValue;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Iterates over {@link jakarta.json.JsonStructure}.\n */\nabstract class JsonStructureIterator implements Iterator<JsonParser.Event> {\n\n    /**\n     * Get current {@link JsonValue}, that the parser is pointing on.\n     *\n     * @return JsonValue result.\n     */\n    abstract JsonValue getValue();\n\n    /**\n     * Creates an exception for throwing in case of current value type is not compatible with\n     * called getter return type.\n     *\n     * @return JsonbException with error description.\n     */\n    abstract JsonbException createIncompatibleValueError();\n\n    /**\n     * Check the type of current  {@link JsonValue} and return a string representing a value.\n     *\n     * @return String value for current JsonValue\n     */\n    String getString() {\n        JsonValue value = getValue();\n        if (value instanceof JsonString) {\n            return ((JsonString) value).getString();\n        } else {\n            return value.toString();\n        }\n    }\n\n    /**\n     * Convert {@link JsonValue} type to {@link JsonParser.Event}.\n     *\n     * @param value JsonValue\n     * @return JsonParser event\n     */\n    JsonParser.Event getValueEvent(JsonValue value) {\n        switch (value.getValueType()) {\n        case NUMBER:\n            return JsonParser.Event.VALUE_NUMBER;\n        case STRING:\n        case TRUE:\n        case FALSE:\n            return JsonParser.Event.VALUE_STRING;\n        case OBJECT:\n            return JsonParser.Event.START_OBJECT;\n        case ARRAY:\n            return JsonParser.Event.START_ARRAY;\n        case NULL:\n            return JsonParser.Event.VALUE_NULL;\n        default:\n            throw new JsonbException(Messages.getMessage(MessageKeys.INTERNAL_ERROR,\n                                                         \"unknown json value: \" + value.getValueType()));\n        }\n\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/jsonstructure/JsonStructureToParserAdapter.java",
    "content": "/*\n * Copyright (c) 2019, 2023 Oracle and/or its affiliates. All rights reserved.\n * Copyright (c) 2026 Contributors to the Eclipse Foundation.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.jsonstructure;\n\nimport java.math.BigDecimal;\nimport java.util.ArrayDeque;\nimport java.util.Deque;\n\nimport jakarta.json.JsonArray;\nimport jakarta.json.JsonNumber;\nimport jakarta.json.JsonObject;\nimport jakarta.json.JsonStructure;\nimport jakarta.json.JsonValue;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonLocation;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Adapter for {@link JsonParser}, that reads a {@link JsonStructure} content tree instead of JSON text.\n *\n * Yasson and jsonb API components are using {@link JsonParser} as its input API.\n * This adapter allows deserialization of {@link JsonStructure} into java content tree using same components\n * as when parsing JSON text.\n */\npublic class JsonStructureToParserAdapter implements JsonParser {\n\n    private Deque<JsonStructureIterator> iterators = new ArrayDeque<>();\n\n    private final JsonStructure rootStructure;\n\n    /**\n     * Creates new {@link JsonStructure} parser.\n     *\n     * @param structure json structure\n     */\n    public JsonStructureToParserAdapter(JsonStructure structure) {\n        this.rootStructure = structure;\n    }\n\n    @Override\n    public boolean hasNext() {\n        return iterators.peek().hasNext();\n    }\n\n    @Override\n    public Event next() {\n        if (iterators.isEmpty()) {\n            if (rootStructure instanceof JsonObject) {\n                iterators.push(new JsonObjectIterator((JsonObject) rootStructure));\n                return Event.START_OBJECT;\n            } else if (rootStructure instanceof JsonArray) {\n                iterators.push(new JsonArrayIterator((JsonArray) rootStructure));\n                return Event.START_ARRAY;\n            }\n        }\n        JsonStructureIterator current = iterators.peek();\n        Event next = current.next();\n        if (next == Event.START_OBJECT) {\n            iterators.push(new JsonObjectIterator((JsonObject) current.getValue()));\n        } else if (next == Event.START_ARRAY) {\n            iterators.push(new JsonArrayIterator((JsonArray) current.getValue()));\n        } else if (next == Event.END_OBJECT || next == Event.END_ARRAY) {\n            iterators.pop();\n        }\n        return next;\n    }\n\n    @Override\n    public Event currentEvent() {\n        return iterators.peek().getValueEvent(getValue());\n    }\n    \n    @Override\n    public String getString() {\n        return iterators.peek().getString();\n    }\n\n    @Override\n    public boolean isIntegralNumber() {\n        return getJsonNumberValue().isIntegral();\n    }\n\n    @Override\n    public int getInt() {\n        return getJsonNumberValue().intValueExact();\n    }\n\n    @Override\n    public long getLong() {\n        return getJsonNumberValue().longValueExact();\n    }\n\n    @Override\n    public BigDecimal getBigDecimal() {\n        return getJsonNumberValue().bigDecimalValue();\n    }\n\n    @Override\n    public JsonValue getValue() {\n        return iterators.peek().getValue();\n    }\n\n    @Override\n    public JsonObject getObject() {\n        JsonStructureIterator current = iterators.peek();\n        if (current instanceof JsonObjectIterator) {\n            //Remove child iterator as getObject() method contract says\n            iterators.pop();\n            return current.getValue().asJsonObject();\n        } else {\n            throw new JsonbException(Messages.getMessage(MessageKeys.INTERNAL_ERROR, \"Outside of object context\"));\n        }\n    }\n\n    @Override\n    public JsonArray getArray() {\n        JsonStructureIterator current = iterators.peek();\n        if (current instanceof JsonArrayIterator) {\n            iterators.pop();\n            return getValue().asJsonArray();\n        } else {\n            throw new JsonbException(Messages.getMessage(MessageKeys.INTERNAL_ERROR, \"Outside of array context\"));\n        }\n    }\n    \n    private JsonNumber getJsonNumberValue() {\n        JsonStructureIterator iterator = iterators.peek();\n        JsonValue value = iterator.getValue();\n        if (value.getValueType() != JsonValue.ValueType.NUMBER) {\n            throw iterator.createIncompatibleValueError();\n        }\n        return (JsonNumber) value;\n    }\n    \n    @Override\n    public JsonLocation getLocation() {\n        throw new JsonbException(\"Operation not supported\");\n    }\n\n    @Override\n    public void skipArray() {\n        if (!iterators.isEmpty()) {\n            JsonStructureIterator current = iterators.peek();\n            if (current instanceof JsonArrayIterator) {\n                iterators.pop();\n            }\n        }\n    }\n\n    @Override\n    public void skipObject() {\n        if (!iterators.isEmpty()) {\n            JsonStructureIterator current = iterators.peek();\n            if (current instanceof JsonObjectIterator) {\n                iterators.pop();\n            }\n        }\n    }\n\n    @Override\n    public void close() {\n        //noop\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/AnnotationTarget.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model;\n\nimport org.eclipse.yasson.internal.JsonbNumberFormatter;\n\n/**\n * Represents the place in which a JSON annotation is applied. Some business functionalities are different based on whether\n * annotation (e.g.\n * {@link jakarta.json.bind.annotation.JsonbTransient}, {@link JsonbNumberFormatter}, etc\n * .) is being applied on\n * getter method, setter method or directly on the property.\n */\npublic enum AnnotationTarget {\n    /**\n     * Indicates annotation has been applied on class level.\n     */\n    CLASS,\n\n    /**\n     * Indicates annotation has been applied on property level.\n     */\n    PROPERTY,\n\n    /**\n     * Indicates annotation has been applied on the getter method of the property.\n     */\n    GETTER,\n\n    /**\n     * Indicates annotation has been applied on the setter method of the property.\n     */\n    SETTER\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/ClassModel.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model;\n\nimport java.lang.reflect.Constructor;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.concurrent.atomic.AtomicBoolean;\nimport java.util.stream.Collectors;\n\nimport jakarta.json.bind.config.PropertyNamingStrategy;\n\nimport org.eclipse.yasson.internal.ClassMultiReleaseExtension;\nimport org.eclipse.yasson.internal.ReflectionUtils;\nimport org.eclipse.yasson.internal.model.customization.ClassCustomization;\nimport org.eclipse.yasson.internal.model.customization.StrategiesProvider;\n\n/**\n * A model for Java class.\n */\npublic class ClassModel {\n\n    private final Class<?> clazz;\n\n    private final ClassCustomization classCustomization;\n\n    private final ClassModel parentClassModel;\n\n    private final AtomicBoolean isInitialized = new AtomicBoolean(false);\n\n    private Constructor<?> defaultConstructor;\n\n    /**\n     * A map of all class properties, including properties from superclasses. Used to access by name.\n     */\n    private Map<String, PropertyModel> properties;\n\n    /**\n     * Sorted properties according to sorting strategy. Used for serialization property ordering.\n     */\n    private PropertyModel[] sortedProperties;\n\n    private final PropertyNamingStrategy propertyNamingStrategy;\n\n    /**\n     * Gets a property model by default (non customized) name.\n     *\n     * @param name A name as parsed from field / getter / setter without annotation customizing.\n     * @return Property model.\n     */\n    public PropertyModel getPropertyModel(String name) {\n        return properties.get(name);\n    }\n\n    /**\n     * Create instance of class model.\n     *\n     * @param clazz                  Class to model.\n     * @param customization          Customization of the class parsed from annotations.\n     * @param parentClassModel       Class model of parent class.\n     * @param propertyNamingStrategy Property naming strategy.\n     */\n    public ClassModel(Class<?> clazz,\n                      ClassCustomization customization,\n                      ClassModel parentClassModel,\n                      PropertyNamingStrategy propertyNamingStrategy) {\n        this.clazz = clazz;\n        this.classCustomization = customization;\n        this.parentClassModel = parentClassModel;\n        this.propertyNamingStrategy = propertyNamingStrategy;\n        setProperties(new ArrayList<>());\n    }\n\n    /**\n     * Search for field in this class model and superclasses of its class.\n     *\n     * @param jsonReadName name as it appears in JSON during reading.\n     * @return PropertyModel if found.\n     */\n    public PropertyModel findPropertyModelByJsonReadName(String jsonReadName) {\n        Objects.requireNonNull(jsonReadName);\n        return searchProperty(this, jsonReadName);\n    }\n\n    private PropertyModel searchProperty(ClassModel classModel, String jsonReadName) {\n        //Standard javabean properties without overridden name (most of the cases)\n        final PropertyModel result = classModel.getPropertyModel(jsonReadName);\n        if (result != null && result.getPropertyName().equals(result.getReadName())) {\n            return result;\n        }\n        //Search for overridden name on setter with @JsonbProperty annotation\n        for (PropertyModel propertyModel : properties.values()) {\n            if (equalsReadName(jsonReadName, propertyModel)) {\n                return propertyModel;\n            }\n        }\n        //property not found\n        return null;\n    }\n\n    /**\n     * Check if name is equal according to property strategy.\n     * In case of {@link StrategiesProvider#CASE_INSENSITIVE_STRATEGY} ignore case.\n     * User can provide own strategy implementation, cast to custom interface is not an option.\n     *\n     * @return True if names are equal.\n     */\n    private boolean equalsReadName(String jsonName, PropertyModel propertyModel) {\n        final String propertyReadName = propertyModel.getReadName();\n        if (propertyNamingStrategy == StrategiesProvider.CASE_INSENSITIVE_STRATEGY) {\n            return jsonName.equalsIgnoreCase(propertyReadName);\n        }\n        return jsonName.equals(propertyReadName);\n    }\n\n    /**\n     * Gets type.\n     *\n     * @return Type.\n     */\n    public Class<?> getType() {\n        return clazz;\n    }\n\n    /**\n     * Introspected customization for a class.\n     *\n     * @return Immutable class customization.\n     */\n    public ClassCustomization getClassCustomization() {\n        return classCustomization;\n    }\n\n    /**\n     * Class model of parent class if present.\n     *\n     * @return class model of a parent\n     */\n    public ClassModel getParentClassModel() {\n        return parentClassModel;\n    }\n\n    /**\n     * Get sorted class properties copy, combination of field and its getter / setter, javabeans alike.\n     *\n     * @return sorted class properties.\n     */\n    public PropertyModel[] getSortedProperties() {\n        return sortedProperties;\n    }\n\n    /**\n     * Sets parsed properties of the class.\n     *\n     * @param parsedProperties class properties\n     */\n    public void setProperties(List<PropertyModel> parsedProperties) {\n        sortedProperties = parsedProperties.toArray(new PropertyModel[] {});\n        this.properties = parsedProperties.stream().collect(Collectors.toMap(PropertyModel::getPropertyName, (mod) -> mod));\n    }\n\n    /**\n     * Get class properties copy, combination of field and its getter / setter, javabeans alike.\n     *\n     * @return class properties.\n     */\n    public Map<String, PropertyModel> getProperties() {\n        return Collections.unmodifiableMap(properties);\n    }\n\n    /**\n     * Default no argument constructor of the class used for deserialization.\n     *\n     * @return default constructor\n     */\n    public Constructor<?> getDefaultConstructor() {\n        // Lazy-loads the default constructor to avoid Java 9+ \"Illegal reflective access\" warnings where possible.\n        // Example: Deserialization into Map won't use this constructor, and therefore never needs to call this method.\n        // Note: Null is a valid result and needs to be cached.\n        if (!isInitialized.get()) {\n            if (ClassMultiReleaseExtension.isRecord(clazz)) {\n                //No default constructor should be used in case of records\n                defaultConstructor = null;\n            } else {\n                defaultConstructor = ReflectionUtils.getDefaultConstructor(clazz, false);\n            }\n            isInitialized.set(true);\n        }\n        return defaultConstructor;\n    }\n\n    @Override\n    public String toString() {\n        return \"ClassModel{\"\n                + \"clazz=\" + clazz\n                + '}';\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/CreatorModel.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model;\n\nimport java.lang.reflect.Executable;\nimport java.lang.reflect.Parameter;\nimport java.lang.reflect.Type;\n\nimport org.eclipse.yasson.internal.AnnotationIntrospector;\nimport org.eclipse.yasson.internal.JsonbContext;\nimport org.eclipse.yasson.internal.JsonbDateFormatter;\nimport org.eclipse.yasson.internal.JsonbNumberFormatter;\nimport org.eclipse.yasson.internal.components.AdapterBinding;\nimport org.eclipse.yasson.internal.components.DeserializerBinding;\nimport org.eclipse.yasson.internal.model.customization.CreatorCustomization;\n\n/**\n * Parameter for creator constructor / method model.\n */\npublic class CreatorModel {\n\n    private final String name;\n\n    private final Type type;\n\n    private final CreatorCustomization creatorCustomization;\n\n    /**\n     * Creates a new instance.\n     *  @param name      Parameter name\n     * @param parameter constructor parameter\n     * @param executable creator executable\n     * @param context   jsonb context\n     */\n    public CreatorModel(String name, Parameter parameter, Executable executable, JsonbContext context) {\n        this.name = name;\n        this.type = parameter.getParameterizedType();\n\n        AnnotationIntrospector annotationIntrospector = context.getAnnotationIntrospector();\n\n        JsonbAnnotatedElement<Parameter> annotated = new JsonbAnnotatedElement<>(parameter);\n        boolean required = context.getAnnotationIntrospector().requiredParameters(executable, annotated);\n        JsonbNumberFormatter constructorNumberFormatter = context.getAnnotationIntrospector()\n                .getConstructorNumberFormatter(annotated);\n        JsonbDateFormatter constructorDateFormatter = context.getAnnotationIntrospector().getConstructorDateFormatter(annotated);\n        DeserializerBinding<?> deserializerBinding = annotationIntrospector.getDeserializerBinding(parameter);\n        AdapterBinding adapterBinding = annotationIntrospector.getAdapterBinding(parameter);\n        final JsonbAnnotatedElement<Class<?>> clsElement = annotationIntrospector.collectAnnotations(parameter.getType());\n        deserializerBinding = deserializerBinding == null\n                ? annotationIntrospector.getDeserializerBinding(clsElement)\n                : deserializerBinding;\n        adapterBinding = adapterBinding == null\n                ? annotationIntrospector.getAdapterBinding(clsElement)\n                : adapterBinding;\n        this.creatorCustomization = CreatorCustomization.builder()\n                .adapterBinding(adapterBinding)\n                .deserializerBinding(deserializerBinding)\n                .serializerBinding(annotationIntrospector.getSerializerBinding(clsElement))\n                .numberFormatter(constructorNumberFormatter)\n                .dateFormatter(constructorDateFormatter)\n                .required(required)\n                .build();\n    }\n\n    /**\n     * Gets parameter name.\n     *\n     * @return Parameter name.\n     */\n    public String getName() {\n        return name;\n    }\n\n    public CreatorCustomization getCustomization() {\n        return creatorCustomization;\n    }\n\n    /**\n     * Gets parameter type.\n     *\n     * @return Parameter type.\n     */\n    public Type getType() {\n        return type;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/JsonbAnnotatedElement.java",
    "content": "/*\n * Copyright (c) 2016, 2023 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.AnnotatedElement;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.LinkedList;\nimport java.util.Map;\nimport java.util.Optional;\n\n/**\n * Annotation holder for classes, superclasses, interfaces, fields, getters and setters.\n *\n * @param <T> annotated element\n */\npublic class JsonbAnnotatedElement<T extends AnnotatedElement> {\n\n    private final Map<Class<? extends Annotation>, LinkedList<AnnotationWrapper<?>>> annotations = new HashMap<>(4);\n\n    private final T element;\n\n    /**\n     * Creates a new instance.\n     *\n     * @param element Element.\n     */\n    public JsonbAnnotatedElement(T element) {\n        for (Annotation ann : element.getAnnotations()) {\n            if (element instanceof Class) {\n                putAnnotation(ann, false, (Class<?>) element);\n            } else {\n                putAnnotation(ann, false, null);\n            }\n        }\n\n        this.element = element;\n    }\n\n    /**\n     * Gets element.\n     *\n     * @return Element.\n     */\n    public T getElement() {\n        return element;\n    }\n\n    /**\n     * Get an annotation by type.\n     *\n     * @param <AT>            Type of annotation\n     * @param annotationClass Type of annotation\n     * @return Annotation by passed type\n     */\n    public <AT extends Annotation> Optional<AT> getAnnotation(Class<AT> annotationClass) {\n        return Optional.ofNullable(annotations.get(annotationClass))\n                .map(LinkedList::getFirst)\n                .map(AnnotationWrapper::getAnnotation)\n                .map(annotationClass::cast);\n    }\n\n    public <AT extends Annotation> LinkedList<AnnotationWrapper<?>> getAnnotations(Class<AT> annotationClass) {\n        return annotations.getOrDefault(annotationClass, new LinkedList<>());\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public <AT extends Annotation> AnnotationWrapper<AT> getAnnotationWrapper(Class<AT> annotationClass) {\n        return (AnnotationWrapper<AT>) annotations.get(annotationClass).getFirst();\n    }\n\n    public Annotation[] getAnnotations() {\n        return annotations.values().stream()\n                .flatMap(Collection::stream)\n                .map(AnnotationWrapper::getAnnotation)\n                .toArray(Annotation[]::new);\n    }\n\n    /**\n     * Adds annotation.\n     *\n     * @param annotation Annotation to add.\n     * @param definedType\n     */\n    public void putAnnotation(Annotation annotation, boolean inherited, Class<?> definedType) {\n//        if (annotations.containsKey(annotation.annotationType())) {\n//            throw new JsonbException(Messages.getMessage(MessageKeys.INTERNAL_ERROR,\n//                                                         \"Annotation already present: \" + annotation));\n//        }\n//        annotations.put(annotation.annotationType(), new AnnotationWrapper(annotation, inherited));\n        annotations.computeIfAbsent(annotation.annotationType(), aClass -> new LinkedList<>())\n                        .add(new AnnotationWrapper<Annotation>(annotation, inherited, definedType));\n    }\n\n    public void putAnnotationWrapper(AnnotationWrapper<?> annotationWrapper) {\n        annotations.computeIfAbsent(annotationWrapper.getAnnotation().annotationType(), aClass -> new LinkedList<>())\n                .add(annotationWrapper);\n    }\n\n    public static final class AnnotationWrapper<T extends Annotation> {\n\n        private final T annotation;\n        private final boolean inherited;\n        private final Class<?> definedType;\n\n        public AnnotationWrapper(T annotation, boolean inherited, Class<?> definedType) {\n            this.annotation = annotation;\n            this.inherited = inherited;\n            this.definedType = definedType;\n        }\n\n        public T getAnnotation() {\n            return annotation;\n        }\n\n        public boolean isInherited() {\n            return inherited;\n        }\n\n        public Class<?> getDefinedType() {\n            return definedType;\n        }\n\n        @Override\n        public String toString() {\n            return definedType.getName();\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/JsonbCreator.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model;\n\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Executable;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\n\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Object holding reference to Constructor / Method for custom object creation.\n */\npublic class JsonbCreator {\n\n    private final Executable executable;\n\n    private final CreatorModel[] params;\n\n    /**\n     * Creates a new instance.\n     *\n     * @param executable    Executable.\n     * @param creatorModels Parameters.\n     */\n    public JsonbCreator(Executable executable, CreatorModel[] creatorModels) {\n        this.executable = executable;\n        this.params = creatorModels;\n    }\n\n    /**\n     * Create instance by either constructor or factory method, with provided parameter values and a Class to call on.\n     *\n     * @param params parameters to be passed into constructor / factory method\n     * @param on     class to call onto\n     * @param <T>    Type of class / instance\n     * @return instance\n     */\n    @SuppressWarnings(\"unchecked\")\n    public <T> T call(Object[] params, Class<T> on) {\n        try {\n            if (executable instanceof Constructor) {\n                return ((Constructor<T>) executable).newInstance(params);\n            } else {\n                return (T) ((Method) executable).invoke(on, params);\n            }\n        } catch (IllegalAccessException | InvocationTargetException | InstantiationException e) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.ERROR_CALLING_JSONB_CREATOR, on), e);\n        }\n    }\n\n    /**\n     * True if param name is one of creator params.\n     *\n     * @param paramName Param name to check.\n     * @return True if found.\n     */\n    public boolean contains(String paramName) {\n        return findByName(paramName) != null;\n    }\n\n    /**\n     * Find creator parameter by name.\n     *\n     * @param paramName parameter name as it appear in json document.\n     * @return Creator parameter.\n     */\n    public CreatorModel findByName(String paramName) {\n        for (CreatorModel param : params) {\n            if (param.getName().equals(paramName)) {\n                return param;\n            }\n        }\n        return null;\n    }\n\n    /**\n     * Parameters of this creator.\n     *\n     * @return Parameters.\n     */\n    public CreatorModel[] getParams() {\n        return params;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/ModulesUtil.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model;\n\nimport java.lang.invoke.MethodHandles;\n\nclass ModulesUtil {\n\n    private ModulesUtil() {\n    }\n\n    static MethodHandles.Lookup lookup(){\n        return MethodHandles.publicLookup();\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/Property.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Type;\n\nimport jakarta.json.bind.JsonbException;\n\n/**\n * Property of a class, field, getter and setter methods (javabean alike).\n * Used during class model initialization, than dereferenced.\n */\npublic class Property {\n\n    private final String name;\n\n    private final JsonbAnnotatedElement<Class<?>> declaringClassElement;\n\n    private JsonbAnnotatedElement<Field> fieldElement;\n\n    private JsonbAnnotatedElement<Method> getterElement;\n\n    private JsonbAnnotatedElement<Method> setterElement;\n\n    /**\n     * Create instance of property.\n     *\n     * @param name                not null\n     * @param declaringClassModel Class model for a class declaring property.\n     */\n    public Property(String name, JsonbAnnotatedElement<Class<?>> declaringClassModel) {\n        this.name = name;\n        this.declaringClassElement = declaringClassModel;\n    }\n\n    /**\n     * Name of a property, java bean convention.\n     *\n     * @return name\n     */\n    public String getName() {\n        return name;\n    }\n\n    /**\n     * {@link Field} representing property if any.\n     *\n     * @return field if present\n     */\n    public Field getField() {\n        if (fieldElement == null) {\n            return null;\n        }\n        return fieldElement.getElement();\n    }\n\n    /**\n     * @param field field not null\n     */\n    public void setField(Field field) {\n        this.fieldElement = new JsonbAnnotatedElement<>(field);\n    }\n\n    /**\n     * {@link Method} representing getter of a property if any.\n     *\n     * @return getter if present\n     */\n    public Method getGetter() {\n        if (getterElement == null) {\n            return null;\n        }\n        return getterElement.getElement();\n    }\n\n    /**\n     * @param getter not null\n     */\n    public void setGetter(Method getter) {\n        this.getterElement = new JsonbAnnotatedElement<>(getter);\n    }\n\n    /**\n     * {@link Method} representing setter of a property if any.\n     *\n     * @return setter if present\n     */\n    public Method getSetter() {\n        if (setterElement == null) {\n            return null;\n        }\n        return setterElement.getElement();\n    }\n\n    /**\n     * @param setter setter not null\n     */\n    public void setSetter(Method setter) {\n        this.setterElement = new JsonbAnnotatedElement<>(setter);\n    }\n\n    /**\n     * Class element with annotation under construction for declaring class of this property.\n     * This ClassModel is not fully initialized yet.\n     *\n     * @return ClassModel\n     */\n    public JsonbAnnotatedElement<Class<?>> getDeclaringClassElement() {\n        return declaringClassElement;\n    }\n\n    /**\n     * Extracts type from first not null element:\n     * Field, Getter, Setter.\n     *\n     * @return type of a property\n     */\n    public Type getPropertyType() {\n        if (getField() != null) {\n            return getField().getGenericType();\n        } else if (getGetter() != null) {\n            return getGetterType();\n        } else if (getSetter() != null) {\n            return getSetterType();\n        }\n        throw new JsonbException(\"Empty property: \" + name);\n    }\n\n    Type getGetterType() {\n        if (getGetter() != null) {\n            return getGetter().getGenericReturnType();\n        }\n        return null;\n    }\n\n    Type getSetterType() {\n        Type[] genericParameterTypes = getSetter().getGenericParameterTypes();\n        if (genericParameterTypes.length != 1) {\n            throw new JsonbException(\"Invalid count of arguments for setter: \" + getSetter());\n        }\n        return genericParameterTypes[0];\n    }\n\n    /**\n     * Element with field and its annotations.\n     *\n     * @return field with annotations\n     */\n    public JsonbAnnotatedElement<Field> getFieldElement() {\n        return fieldElement;\n    }\n\n    /**\n     * Element with getter and its annotations.\n     *\n     * @return getter with annotations\n     */\n    public JsonbAnnotatedElement<Method> getGetterElement() {\n        return getterElement;\n    }\n\n    /**\n     * Element with setter and its annotations.\n     *\n     * @return setter with annotations\n     */\n    public JsonbAnnotatedElement<Method> getSetterElement() {\n        return setterElement;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/PropertyModel.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model;\n\nimport java.lang.invoke.MethodHandle;\nimport java.lang.invoke.MethodHandles;\nimport java.lang.reflect.AccessibleObject;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Modifier;\nimport java.lang.reflect.Type;\nimport java.security.AccessController;\nimport java.security.PrivilegedAction;\nimport java.util.EnumSet;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.function.Predicate;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.config.PropertyNamingStrategy;\nimport jakarta.json.bind.config.PropertyVisibilityStrategy;\n\nimport org.eclipse.yasson.internal.AnnotationIntrospector;\nimport org.eclipse.yasson.internal.JsonbContext;\nimport org.eclipse.yasson.internal.JsonbDateFormatter;\nimport org.eclipse.yasson.internal.JsonbNumberFormatter;\nimport org.eclipse.yasson.internal.components.AdapterBinding;\nimport org.eclipse.yasson.internal.components.SerializerBinding;\nimport org.eclipse.yasson.internal.model.customization.PropertyCustomization;\n\n/**\n * A model for class property.\n * Property is JavaBean alike meta information field / getter / setter of a property in class.\n */\npublic final class PropertyModel implements Comparable<PropertyModel> {\n\n    private static final MethodHandles.Lookup LOOKUP = ModulesUtil.lookup();\n\n    /**\n     * Field propertyName as in class by java bean convention.\n     */\n    private final String propertyName;\n\n    /**\n     * Calculated name to be used when reading json document.\n     */\n    private final String readName;\n\n    /**\n     * Calculated name to be used when writing json document.\n     */\n    private final String writeName;\n\n    /**\n     * Field propertyType.\n     */\n    private final Type propertyType;\n\n    /**\n     * Model of the class this field belongs to.\n     */\n    private final ClassModel classModel;\n\n    private final Property property;\n\n    /**\n     * Customization of this property.\n     */\n    private final PropertyCustomization customization;\n\n    private final MethodHandle getValueHandle;\n\n    private final MethodHandle setValueHandle;\n\n    private final Field field;\n\n    private final Method getter;\n\n    private final Method setter;\n\n    private final Type getterMethodType;\n\n    private final Type setterMethodType;\n\n    /**\n     * Create a new PropertyModel that merges two existing PropertyModel that have identical read/write names.\n     * The input PropertyModel objects MUST be equal (a.equals(b) == true)\n     *\n     * @param a a PropertyModel instance to merge\n     * @param b the other PropertyModel instance to merge\n     */\n    public PropertyModel(PropertyModel a, PropertyModel b) {\n        if (!a.equals(b)) {\n            throw new IllegalStateException(\"Property models \" + a + \" and \" + b + \" cannot be merged\");\n        }\n\n        // Initial cloning steps\n        this.classModel = a.classModel;\n        this.propertyName = a.propertyName;\n        this.readName = a.readName;\n        this.writeName = a.writeName;\n        this.propertyType = a.propertyType;\n        this.customization = a.customization;\n\n        // Merging steps\n        this.getterMethodType = a.getterMethodType != null ? a.getterMethodType : b.getterMethodType;\n        this.setterMethodType = a.setterMethodType != null ? a.setterMethodType : b.setterMethodType;\n        this.property = a.property;\n        if (b.property.getField() != null) {\n            this.property.setField(b.property.getField());\n        }\n        if (b.property.getGetter() != null) {\n            this.property.setGetter(b.property.getGetter());\n        }\n        if (b.property.getSetter() != null) {\n            this.property.setSetter(b.property.getSetter());\n        }\n        this.field = property.getField();\n        this.getter = property.getGetter();\n        this.setter = property.getSetter();\n\n        PropertyVisibilityStrategy strategy = classModel.getClassCustomization().getPropertyVisibilityStrategy();\n        this.getValueHandle = createReadHandle(field, getter, isMethodVisible(getter, strategy), strategy);\n        this.setValueHandle = createWriteHandle(field, setter, isMethodVisible(setter, strategy), strategy);\n    }\n\n    /**\n     * Creates an instance.\n     *\n     * @param classModel   Class model of declaring class.\n     * @param property     Property.\n     * @param jsonbContext Context.\n     */\n    public PropertyModel(ClassModel classModel, Property property, JsonbContext jsonbContext) {\n        this.classModel = classModel;\n        this.property = property;\n        this.propertyName = property.getName();\n        this.propertyType = property.getPropertyType();\n        this.field = property.getField();\n        this.getter = property.getGetter();\n        this.setter = property.getSetter();\n\n        PropertyVisibilityStrategy strategy = classModel.getClassCustomization().getPropertyVisibilityStrategy();\n        boolean getterVisible = isMethodVisible(getter, strategy);\n        boolean setterVisible = isMethodVisible(setter, strategy);\n\n        this.getValueHandle = createReadHandle(field, getter, getterVisible, strategy);\n        this.setValueHandle = createWriteHandle(field, setter, setterVisible, strategy);\n        this.getterMethodType = getterVisible ? property.getGetterType() : null;\n        this.setterMethodType = setterVisible ? property.getSetterType() : null;\n        this.customization = introspectCustomization(property, jsonbContext, classModel);\n        this.readName = calculateReadWriteName(customization.getJsonReadName(), propertyName,\n                                               jsonbContext.getConfigProperties().getPropertyNamingStrategy());\n        this.writeName = calculateReadWriteName(customization.getJsonWriteName(), propertyName,\n                                                jsonbContext.getConfigProperties().getPropertyNamingStrategy());\n    }\n\n    /**\n     * Returns which type should be used to deserialization.\n     *\n     * @return deserialization type\n     */\n    public Type getPropertyDeserializationType() {\n        return setterMethodType == null ? propertyType : setterMethodType;\n    }\n\n    /**\n     * Returns which type should be used to serialization.\n     *\n     * @return serialization type\n     */\n    public Type getPropertySerializationType() {\n        return getterMethodType == null ? propertyType : getterMethodType;\n    }\n\n    private SerializerBinding<?> getUserSerializerBinding(Property property, JsonbContext jsonbContext) {\n        final SerializerBinding<?> serializerBinding = jsonbContext.getAnnotationIntrospector().getSerializerBinding(property);\n        if (serializerBinding != null) {\n            return serializerBinding;\n        }\n        return jsonbContext.getComponentMatcher().getSerializerBinding(getPropertySerializationType(), null).orElse(null);\n    }\n\n    private PropertyCustomization introspectCustomization(Property property, JsonbContext jsonbContext, ClassModel classModel) {\n        final AnnotationIntrospector introspector = jsonbContext.getAnnotationIntrospector();\n        final PropertyCustomization.Builder builder = PropertyCustomization.builder();\n        //drop all other annotations for transient properties\n        EnumSet<AnnotationTarget> transientInfo = introspector.getJsonbTransientCategorized(property);\n        ClassModel parent = classModel;\n        // Check parent classes for transient annotations\n        while ((parent = parent.getParentClassModel()) != null) {\n            PropertyModel parentProperty = parent.getPropertyModel(property.getName());\n            if (parentProperty != null) {\n                if (parentProperty.customization.isReadTransient()) {\n                    transientInfo.add(AnnotationTarget.GETTER);\n                }\n                if (parentProperty.customization.isWriteTransient()) {\n                    transientInfo.add(AnnotationTarget.SETTER);\n                }\n            }\n        }\n        if (transientInfo.size() != 0) {\n            builder.readTransient(transientInfo.contains(AnnotationTarget.GETTER));\n            builder.writeTransient(transientInfo.contains(AnnotationTarget.SETTER));\n\n            if (transientInfo.contains(AnnotationTarget.PROPERTY)) {\n                if (!transientInfo.contains(AnnotationTarget.GETTER)) {\n                    builder.readTransient(true);\n                }\n                if (!transientInfo.contains(AnnotationTarget.SETTER)) {\n                    builder.writeTransient(true);\n                }\n            }\n\n            if (builder.readTransient()) {\n                introspector.checkTransientIncompatible(property.getFieldElement());\n                introspector.checkTransientIncompatible(property.getGetterElement());\n            }\n            if (builder.writeTransient()) {\n                introspector.checkTransientIncompatible(property.getFieldElement());\n                introspector.checkTransientIncompatible(property.getSetterElement());\n            }\n        }\n\n        if (!builder.readTransient()) {\n            builder.jsonWriteName(introspector.getJsonbPropertyJsonWriteName(property));\n            builder.nillable(introspector.isPropertyNillable(property).orElse(classModel.getClassCustomization().isNillable()));\n            builder.serializerBinding(getUserSerializerBinding(property, jsonbContext));\n        }\n\n        if (!builder.writeTransient()) {\n            builder.jsonReadName(introspector.getJsonbPropertyJsonReadName(property));\n            builder.deserializerBinding(introspector.getDeserializerBinding(property));\n        }\n\n        final AdapterBinding adapterBinding = jsonbContext.getAnnotationIntrospector().getAdapterBinding(property);\n        if (adapterBinding != null) {\n            builder.serializeAdapter(adapterBinding);\n            builder.deserializeAdapter(adapterBinding);\n        } else {\n            builder.serializeAdapter(jsonbContext.getComponentMatcher()\n                                             .getSerializeAdapterBinding(getPropertySerializationType(), null).orElse(null));\n            builder.deserializeAdapter(jsonbContext.getComponentMatcher()\n                                               .getDeserializeAdapterBinding(getPropertyDeserializationType(), null)\n                                               .orElse(null));\n        }\n\n        introspectDateFormatter(property, introspector, builder, jsonbContext);\n        introspectNumberFormatter(property, introspector, builder);\n        builder.implementationClass(introspector.getImplementationClass(property));\n\n        return builder.build();\n    }\n\n    private static void introspectDateFormatter(Property property,\n                                                AnnotationIntrospector introspector,\n                                                PropertyCustomization.Builder builder,\n                                                JsonbContext jsonbContext) {\n        /*\n         * If @JsonbDateFormat is placed on getter implementation must use this format on serialization.\n         * If @JsonbDateFormat is placed on setter implementation must use this format on deserialization.\n         * If @JsonbDateFormat is placed on field implementation must use this format on serialization and deserialization.\n         *\n         * Priority from high to low is getter / setter > field > class > package > global configuration\n         */\n        Map<AnnotationTarget, JsonbDateFormatter> jsonDateFormatCategorized = introspector\n                .getJsonbDateFormatCategorized(property);\n        final JsonbDateFormatter configDateFormatter = jsonbContext.getConfigProperties().getConfigDateFormatter();\n\n        if (!builder.readTransient()) {\n            final JsonbDateFormatter dateFormatter = getTargetForMostPreciseScope(jsonDateFormatCategorized,\n                                                                                  AnnotationTarget.GETTER,\n                                                                                  AnnotationTarget.PROPERTY,\n                                                                                  AnnotationTarget.CLASS);\n\n            builder.serializeDateFormatter(dateFormatter != null ? dateFormatter : configDateFormatter);\n        }\n\n        if (!builder.writeTransient()) {\n            final JsonbDateFormatter dateFormatter = getTargetForMostPreciseScope(jsonDateFormatCategorized,\n                                                                                  AnnotationTarget.SETTER,\n                                                                                  AnnotationTarget.PROPERTY,\n                                                                                  AnnotationTarget.CLASS);\n\n            builder.deserializeDateFormatter(dateFormatter != null ? dateFormatter : configDateFormatter);\n        }\n    }\n\n    private static void introspectNumberFormatter(Property property,\n                                                  AnnotationIntrospector introspector,\n                                                  PropertyCustomization.Builder builder) {\n        /*\n         * If @JsonbNumberFormat is placed on getter implementation must use this format on serialization.\n         * If @JsonbNumberFormat is placed on setter implementation must use this format on deserialization.\n         * If @JsonbNumberFormat is placed on field implementation must use this format on serialization and deserialization.\n         *\n         * Priority from high to low is getter / setter > field > class > package > global configuration\n         */\n        Map<AnnotationTarget, JsonbNumberFormatter> jsonNumberFormatCategorized = introspector.getJsonNumberFormatter(property);\n\n        if (!builder.readTransient()) {\n            builder.serializeNumberFormatter(getTargetForMostPreciseScope(jsonNumberFormatCategorized,\n                                                                          AnnotationTarget.GETTER,\n                                                                          AnnotationTarget.PROPERTY,\n                                                                          AnnotationTarget.CLASS));\n        }\n\n        if (!builder.writeTransient()) {\n            builder.deserializeNumberFormatter(getTargetForMostPreciseScope(jsonNumberFormatCategorized,\n                                                                            AnnotationTarget.SETTER,\n                                                                            AnnotationTarget.PROPERTY,\n                                                                            AnnotationTarget.CLASS));\n        }\n    }\n\n    /**\n     * Pull result for most significant scope defined by order of annotation targets.\n     *\n     * @param collectedAnnotations all targets\n     * @param targets              ordered target types by scope\n     */\n    private static <T> T getTargetForMostPreciseScope(Map<AnnotationTarget, T> collectedAnnotations,\n                                                      AnnotationTarget... targets) {\n        for (AnnotationTarget target : targets) {\n            final T result = collectedAnnotations.get(target);\n            if (result != null) {\n                return result;\n            }\n        }\n        return null;\n    }\n\n    /**\n     * Gets property's value.\n     *\n     * @param object object to read property from\n     * @return property's value\n     */\n    public Object getValue(Object object) {\n        try {\n            return getValueHandle.invoke(object);\n        } catch (Throwable e) {\n            throw new JsonbException(\"Error getting value on: \" + object, e);\n        }\n    }\n\n    /**\n     * Sets a property.\n     *\n     * If not writable (final, transient, static), ignores property.\n     *\n     * @param object Object to set value in.\n     * @param value  Value to set.\n     */\n    public void setValue(Object object, Object value) {\n        if (!isWritable()) {\n            return;\n        }\n        try {\n            setValueHandle.invoke(object, value);\n        } catch (Throwable e) {\n            throw new JsonbException(\"Error setting value on: \" + object, e);\n        }\n    }\n\n    /**\n     * Property is readable. Based on access policy and java field modifiers.\n     *\n     * @return true if can be serialized to JSON\n     */\n    public boolean isReadable() {\n        return !customization.isReadTransient() && this.getValueHandle != null;\n    }\n\n    /**\n     * Property is writable. Based on access policy and java field modifiers.\n     *\n     * @return true if can be deserialized from JSON\n     */\n    public boolean isWritable() {\n        return !customization.isWriteTransient() && this.setValueHandle != null;\n    }\n\n    /**\n     * Default property name according to Field / Getter / Setter method names.\n     * This name is use for identifying properties, for JSON serialization is used customized name\n     * which may be derived from default name.\n     *\n     * @return default name\n     */\n    public String getPropertyName() {\n        return propertyName;\n    }\n\n    /**\n     * Model of declaring class of this property.\n     *\n     * @return class model\n     */\n    public ClassModel getClassModel() {\n        return classModel;\n    }\n\n    /**\n     * Introspected customization of a property.\n     *\n     * @return immutable property customization\n     */\n    public PropertyCustomization getCustomization() {\n        return customization;\n    }\n\n    @Override\n    public int compareTo(PropertyModel o) {\n        int compare = readName.compareTo(o.readName);\n        return compare == 0 ? writeName.compareTo(o.writeName) : compare;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        PropertyModel other = (PropertyModel) o;\n        return Objects.equals(readName, other.readName)\n                && Objects.equals(writeName, other.writeName);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(readName, writeName);\n    }\n\n    /**\n     * Gets a name of JSON document property to read this property from.\n     *\n     * @return Name of JSON document property.\n     */\n    public String getReadName() {\n        return readName;\n    }\n\n    public String getWriteName() {\n        return writeName;\n    }\n\n    /**\n     * If customized by JsonbPropertyAnnotation, than is used, otherwise use strategy to translate.\n     * Since this is cached for performance reasons strategy has to be consistent\n     * with calculated values for same input.\n     */\n    private static String calculateReadWriteName(String readWriteName, String propertyName, PropertyNamingStrategy strategy) {\n        return readWriteName != null ? readWriteName : strategy.translateName(propertyName);\n    }\n\n    /**\n     * Field of a javabean property.\n     *\n     * @return {@link Field field}\n     */\n    public Field getField() {\n        return field;\n    }\n\n    /**\n     * Setter of a javabean property.\n     *\n     * @return {@link Method getter}\n     */\n    public Method getGetter() {\n        return getter;\n    }\n\n    /**\n     * Getter of a javabean property.\n     *\n     * @return {@link Method setter}\n     */\n    public Method getSetter() {\n        return setter;\n    }\n\n    // Used in ClassParser\n    public static boolean isPropertyReadable(Field field, Method getter, PropertyVisibilityStrategy strategy) {\n        return createReadHandle(field, getter, isMethodVisible(getter, strategy), strategy) != null;\n    }\n\n    private static MethodHandle createReadHandle(Field field,\n                                                 Method getter,\n                                                 boolean getterVisible,\n                                                 PropertyVisibilityStrategy strategy) {\n        boolean fieldReadable = field == null || (field.getModifiers() & (Modifier.TRANSIENT | Modifier.STATIC)) == 0;\n\n        if (fieldReadable) {\n            if (getter != null && getterVisible) {\n                try {\n                    return LOOKUP.unreflect(getter);\n                } catch (Throwable e) {\n                    throw new JsonbException(\"Error accessing getter '\" + getter.getName() + \"' declared in '\" + getter\n                            .getDeclaringClass() + \"'\", e);\n                }\n            }\n            if (isFieldVisible(field, getter, strategy)) {\n                try {\n                    return LOOKUP.unreflectGetter(field);\n                } catch (IllegalAccessException e) {\n                    throw new JsonbException(\"Error accessing field '\" + field.getName() + \"' declared in '\" + field\n                            .getDeclaringClass() + \"'\", e);\n                }\n            }\n        }\n\n        return null;\n    }\n\n    private static MethodHandle createWriteHandle(Field field,\n                                                  Method setter,\n                                                  boolean setterVisible,\n                                                  PropertyVisibilityStrategy strategy) {\n        boolean fieldWritable =\n                field == null || (field.getModifiers() & (Modifier.TRANSIENT | Modifier.STATIC | Modifier.FINAL)) == 0;\n\n        if (fieldWritable) {\n            if (setter != null && setterVisible && !setter.getDeclaringClass().isAnonymousClass()) {\n                try {\n                    return LOOKUP.unreflect(setter);\n                } catch (IllegalAccessException e) {\n                    throw new JsonbException(\"Error accessing setter '\" + setter.getName() + \"' declared in '\" + setter\n                            .getDeclaringClass() + \"'\", e);\n                }\n            }\n            if (isFieldVisible(field, setter, strategy) && !field.getDeclaringClass().isAnonymousClass()) {\n                try {\n                    return LOOKUP.unreflectSetter(field);\n                } catch (IllegalAccessException e) {\n                    throw new JsonbException(\"Error accessing field '\" + field.getName() + \"' declared in '\" + field\n                            .getDeclaringClass() + \"'\", e);\n                }\n            }\n        }\n\n        return null;\n    }\n\n    private static boolean isFieldVisible(Field field, Method method, PropertyVisibilityStrategy strategy) {\n        if (field == null) {\n            return false;\n        }\n        boolean accessible = isVisible(strat -> strat.isVisible(field), method, strategy);\n        //overridden by strategy, or anonymous class (readable by spec)\n        if (accessible && (\n                !Modifier.isPublic(field.getModifiers())\n                        || field.getDeclaringClass().isAnonymousClass()\n                        || isNotPublicAndNonNested(field.getDeclaringClass()))) {\n            overrideAccessible(field);\n        }\n        return accessible;\n    }\n\n    private static boolean isNotPublicAndNonNested(Class<?> declaringClass) {\n        return !declaringClass.isMemberClass() && !Modifier.isPublic(declaringClass.getModifiers());\n    }\n\n    private static boolean isMethodVisible(Method method, PropertyVisibilityStrategy strategy) {\n        if (method == null || Modifier.isStatic(method.getModifiers())) {\n            return false;\n        }\n\n        boolean accessible = isVisible(strat -> strat.isVisible(method), method, strategy);\n        //overridden by strategy, anonymous class, or lambda\n        if (accessible && (\n                !Modifier.isPublic(method.getModifiers()) || method.getDeclaringClass().isAnonymousClass() || method\n                        .getDeclaringClass().isSynthetic())) {\n            overrideAccessible(method);\n        }\n        return accessible;\n    }\n\n    private static void overrideAccessible(AccessibleObject accessibleObject) {\n        AccessController.doPrivileged((PrivilegedAction<Void>) () -> {\n            accessibleObject.setAccessible(true);\n            return null;\n        });\n    }\n\n    /**\n     * Look up class and package level @JsonbVisibility, or global config PropertyVisibilityStrategy.\n     * If any is found it is used for resolving visibility by calling provided visibilityCheckFunction.\n     *\n     * @param visibilityCheckFunction function declaring visibility check\n     * @return Optional with result of visibility check, or empty optional if no strategy is found\n     */\n    private static boolean isVisible(Predicate<PropertyVisibilityStrategy> visibilityCheckFunction,\n                                     Method method,\n                                     PropertyVisibilityStrategy strategy) {\n        return strategy != null\n                ? visibilityCheckFunction.test(strategy)\n                : visibilityCheckFunction.test(new DefaultVisibilityStrategy(method));\n    }\n\n    private static final class DefaultVisibilityStrategy implements PropertyVisibilityStrategy {\n\n        private final Method method;\n\n        DefaultVisibilityStrategy(Method method) {\n            this.method = method;\n        }\n\n        @Override\n        public boolean isVisible(Field field) {\n            //don't check field if getter is not visible (forced by spec)\n            return (method == null || isVisible(method)) && Modifier.isPublic(field.getModifiers());\n        }\n\n        @Override\n        public boolean isVisible(Method method) {\n            return Modifier.isPublic(method.getModifiers());\n        }\n    }\n\n    public MethodHandle getGetValueHandle() {\n        return getValueHandle;\n    }\n\n    public MethodHandle getSetValueHandle() {\n        return setValueHandle;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/ReverseTreeMap.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model;\n\nimport java.util.Comparator;\nimport java.util.TreeMap;\n\n/**\n * TreeMap with a reverse ordering by default.\n *\n * @param <K> comparable key\n * @param <V> value\n */\npublic class ReverseTreeMap<K extends Comparable<? super K>, V> extends TreeMap<K, V> {\n\n    /**\n     * Default constructor of a TreeMap with reverse order.\n     */\n    public ReverseTreeMap() {\n        super(Comparator.reverseOrder());\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/customization/ClassCustomization.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model.customization;\n\nimport jakarta.json.bind.config.PropertyVisibilityStrategy;\n\nimport org.eclipse.yasson.internal.JsonbDateFormatter;\nimport org.eclipse.yasson.internal.JsonbNumberFormatter;\nimport org.eclipse.yasson.internal.model.JsonbCreator;\n\n/**\n * Customization which could be applied on a class or package level.\n */\npublic class ClassCustomization extends CustomizationBase {\n\n    private static final ClassCustomization EMPTY = new ClassCustomization(new Builder());\n\n    private final JsonbCreator creator;\n    private final String[] propertyOrder;\n    private final JsonbNumberFormatter numberFormatter;\n    private final JsonbDateFormatter dateTimeFormatter;\n    private final PropertyVisibilityStrategy propertyVisibilityStrategy;\n    private final TypeInheritanceConfiguration typeInheritanceConfiguration;\n\n    /**\n     * Copies properties from builder an creates immutable instance.\n     *\n     * @param builder not null\n     */\n    private ClassCustomization(Builder builder) {\n        super(builder);\n        this.creator = builder.creator;\n        this.propertyOrder = builder.propertyOrder;\n        this.numberFormatter = builder.numberFormatter;\n        this.dateTimeFormatter = builder.dateTimeFormatter;\n        this.propertyVisibilityStrategy = builder.propertyVisibilityStrategy;\n        this.typeInheritanceConfiguration = builder.typeInheritanceConfiguration;\n    }\n\n    public static ClassCustomization empty() {\n        return EMPTY;\n    }\n\n    public static Builder builder() {\n        return new Builder();\n    }\n\n    /**\n     * Returns instance of {@link JsonbCreator}.\n     *\n     * @return instance of creator\n     */\n    public JsonbCreator getCreator() {\n        return creator;\n    }\n\n    /**\n     * Names of properties to sort with.\n     *\n     * @return sorted names of properties\n     */\n    public String[] getPropertyOrder() {\n        return propertyOrder;\n    }\n\n    /**\n     * Property visibility strategy for this class model.\n     *\n     * @return visibility strategy\n     */\n    public PropertyVisibilityStrategy getPropertyVisibilityStrategy() {\n        return propertyVisibilityStrategy;\n    }\n\n    @Override\n    public JsonbNumberFormatter getSerializeNumberFormatter() {\n        return numberFormatter;\n    }\n\n    @Override\n    public JsonbNumberFormatter getDeserializeNumberFormatter() {\n        return numberFormatter;\n    }\n\n    @Override\n    public JsonbDateFormatter getSerializeDateFormatter() {\n        return dateTimeFormatter;\n    }\n\n    @Override\n    public JsonbDateFormatter getDeserializeDateFormatter() {\n        return dateTimeFormatter;\n    }\n\n    public TypeInheritanceConfiguration getPolymorphismConfig() {\n        return typeInheritanceConfiguration;\n    }\n\n    /**\n     * The customization builder that would be used to build an instance of {@link ClassCustomization} to ensure its immutability.\n     */\n    public static class Builder extends CustomizationBase.Builder<Builder, ClassCustomization> {\n\n        private JsonbCreator creator;\n        private String[] propertyOrder;\n        private JsonbNumberFormatter numberFormatter;\n        private JsonbDateFormatter dateTimeFormatter;\n        private PropertyVisibilityStrategy propertyVisibilityStrategy;\n        private TypeInheritanceConfiguration typeInheritanceConfiguration;\n\n        private Builder() {\n        }\n\n        @Override\n        public Builder of(ClassCustomization customization) {\n            super.of(customization);\n            creator(customization.creator);\n            propertyOrder(customization.propertyOrder);\n            numberFormatter(customization.numberFormatter);\n            dateTimeFormatter(customization.dateTimeFormatter);\n            propertyVisibilityStrategy(customization.propertyVisibilityStrategy);\n            return this;\n        }\n\n        public Builder creator(JsonbCreator creator) {\n            this.creator = creator;\n            return this;\n        }\n\n        public Builder propertyOrder(String[] propertyOrder) {\n            this.propertyOrder = propertyOrder;\n            return this;\n        }\n\n        public Builder numberFormatter(JsonbNumberFormatter numberFormatter) {\n            this.numberFormatter = numberFormatter;\n            return this;\n        }\n\n        public Builder dateTimeFormatter(JsonbDateFormatter dateTimeFormatter) {\n            this.dateTimeFormatter = dateTimeFormatter;\n            return this;\n        }\n\n        public Builder propertyVisibilityStrategy(PropertyVisibilityStrategy propertyVisibilityStrategy) {\n            this.propertyVisibilityStrategy = propertyVisibilityStrategy;\n            return this;\n        }\n\n        public Builder polymorphismConfig(TypeInheritanceConfiguration typeInheritanceConfiguration) {\n            this.typeInheritanceConfiguration = typeInheritanceConfiguration;\n            return this;\n        }\n\n        @Override\n        public ClassCustomization build() {\n            return new ClassCustomization(this);\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/customization/ComponentBoundCustomization.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model.customization;\n\nimport org.eclipse.yasson.internal.components.AdapterBinding;\nimport org.eclipse.yasson.internal.components.DeserializerBinding;\nimport org.eclipse.yasson.internal.components.SerializerBinding;\n\n/**\n * Customization which is aware of bound components, such as adapters and (de)serializers.\n */\npublic interface ComponentBoundCustomization {\n\n    /**\n     * @return Adapter wrapper class with resolved generic information.\n     */\n    AdapterBinding getSerializeAdapterBinding();\n\n    /**\n     * @return Adapter wrapper class with resolved generic information.\n     */\n    AdapterBinding getDeserializeAdapterBinding();\n\n    /**\n     * Serializer wrapper with resolved generic info.\n     *\n     * @return serializer wrapper\n     */\n    SerializerBinding<?> getSerializerBinding();\n\n    /**\n     * Deserializer wrapper with resolved generic info.\n     *\n     * @return deserializer wrapper\n     */\n    DeserializerBinding<?> getDeserializerBinding();\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/customization/CreatorCustomization.java",
    "content": "/*\n * Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model.customization;\n\nimport org.eclipse.yasson.internal.JsonbDateFormatter;\nimport org.eclipse.yasson.internal.JsonbNumberFormatter;\nimport org.eclipse.yasson.internal.model.PropertyModel;\n\n/**\n * Customization for creator (constructor / factory methods) parameters.\n */\npublic class CreatorCustomization extends CustomizationBase {\n\n    private final JsonbNumberFormatter numberFormatter;\n    private final JsonbDateFormatter dateFormatter;\n    private final boolean required;\n    private PropertyModel propertyModel;\n\n    /**\n     * Creates new creator customization instance.\n     *\n     * @param builder builder of the customization\n     */\n    private CreatorCustomization(Builder builder) {\n        super(builder);\n        this.numberFormatter = builder.numberFormatter;\n        this.dateFormatter = builder.dateFormatter;\n        this.required = builder.required;\n    }\n\n    public static Builder builder() {\n        return new Builder();\n    }\n\n    @Override\n    public JsonbNumberFormatter getSerializeNumberFormatter() {\n        throw new UnsupportedOperationException(\"Serialization is not supported for creator parameters.\");\n    }\n\n    @Override\n    public JsonbNumberFormatter getDeserializeNumberFormatter() {\n        if (numberFormatter != null) {\n            return numberFormatter;\n        } else if (propertyModel != null) {\n            return propertyModel.getCustomization().getDeserializeNumberFormatter();\n        }\n        return null;\n    }\n\n    @Override\n    public JsonbDateFormatter getSerializeDateFormatter() {\n        throw new UnsupportedOperationException(\"Serialization is not supported for creator parameters.\");\n    }\n\n    @Override\n    public JsonbDateFormatter getDeserializeDateFormatter() {\n        if (dateFormatter != null) {\n            return dateFormatter;\n        } else if (propertyModel != null) {\n            return propertyModel.getCustomization().getDeserializeDateFormatter();\n        }\n        return null;\n    }\n\n    @Override\n    public boolean isNillable() {\n        throw new UnsupportedOperationException(\"Not supported for creator parameters.\");\n    }\n\n    /**\n     * Set property referenced model.\n     *\n     * @param propertyModel referenced property model\n     */\n    public void setPropertyModel(PropertyModel propertyModel) {\n        this.propertyModel = propertyModel;\n    }\n\n    public boolean isRequired() {\n        return required;\n    }\n\n    public static final class Builder extends CustomizationBase.Builder<Builder, CreatorCustomization> {\n\n        private JsonbNumberFormatter numberFormatter;\n        private JsonbDateFormatter dateFormatter;\n        private boolean required = false;\n\n        private Builder() {\n        }\n\n        @Override\n        public Builder of(CreatorCustomization customization) {\n            super.of(customization);\n            numberFormatter = customization.numberFormatter;\n            dateFormatter = customization.dateFormatter;\n            return this;\n        }\n\n        public Builder numberFormatter(JsonbNumberFormatter numberFormatter) {\n            this.numberFormatter = numberFormatter;\n            return this;\n        }\n\n        public Builder dateFormatter(JsonbDateFormatter dateFormatter) {\n            this.dateFormatter = dateFormatter;\n            return this;\n        }\n\n        public Builder required(boolean required) {\n            this.required = required;\n            return this;\n        }\n\n        @Override\n        public CreatorCustomization build() {\n            return new CreatorCustomization(this);\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/customization/Customization.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model.customization;\n\nimport org.eclipse.yasson.internal.JsonbDateFormatter;\nimport org.eclipse.yasson.internal.JsonbNumberFormatter;\n\n/**\n * Customization configuration for class or field.\n * Configuration parsed from annotation is put here.\n * Immutable.\n */\npublic interface Customization {\n\n    /**\n     * Number formatter for formatting numbers during serialization process. It could be the same formatter instance used for\n     * deserialization\n     * (returned by {@link #getDeserializeNumberFormatter()}\n     *\n     * @return number formatter\n     */\n    JsonbNumberFormatter getSerializeNumberFormatter();\n\n    /**\n     * Number formatter for formatting numbers during deserialization process. It could be the same formatter instance used for\n     * serialization\n     * (returned by {@link #getSerializeNumberFormatter()}\n     *\n     * @return number formatter\n     */\n    JsonbNumberFormatter getDeserializeNumberFormatter();\n\n    /**\n     * Date formatter for formatting date values during serialization process. It could be the same formatter instance used for\n     * deserialization\n     * (returned by {@link #getDeserializeDateFormatter()}. If not set, defaulted to <code>jakarta.json.bind.annotation\n     * .JsonbDateFormat.DEFAULT_FORMAT.\n     * </code>\n     *\n     * @return date formatter\n     */\n    JsonbDateFormatter getSerializeDateFormatter();\n\n    /**\n     * Date formatter for formatting date values during deserialization process. It could be the same formatter instance used\n     * for serialization\n     * (returned by {@link #getSerializeDateFormatter()}. If not set, defaulted to <code>jakarta.json.bind.annotation\n     * .JsonbDateFormat.DEFAULT_FORMAT.\n     * </code>\n     *\n     * @return date formatter\n     */\n    JsonbDateFormatter getDeserializeDateFormatter();\n\n    /**\n     * Returns true if <i>nillable</i> customization is present.\n     *\n     * @return True if <i>nillable</i> customization is present.\n     */\n    boolean isNillable();\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/customization/CustomizationBase.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model.customization;\n\nimport org.eclipse.yasson.internal.components.AdapterBinding;\nimport org.eclipse.yasson.internal.components.DeserializerBinding;\nimport org.eclipse.yasson.internal.components.SerializerBinding;\n\n/**\n * Common properties of {@link ClassCustomization} and {@link PropertyCustomization}.\n */\nabstract class CustomizationBase implements Customization, ComponentBoundCustomization {\n\n    private final AdapterBinding adapterBinding;\n    private final SerializerBinding<?> serializerBinding;\n    private final DeserializerBinding<?> deserializerBinding;\n    private final boolean nillable;\n\n    /**\n     * Copies properties from builder an creates immutable instance.\n     *\n     * @param builder not null\n     */\n    CustomizationBase(Builder<?, ?> builder) {\n        this.nillable = builder.nillable;\n        this.adapterBinding = builder.adapterBinding;\n        this.serializerBinding = builder.serializerBinding;\n        this.deserializerBinding = builder.deserializerBinding;\n    }\n\n    /**\n     * Returns true if <i>nillable</i> customization is present.\n     *\n     * @return True if <i>nillable</i> customization is present.\n     */\n    public boolean isNillable() {\n        return nillable;\n    }\n\n    public AdapterBinding getSerializeAdapterBinding() {\n        return adapterBinding;\n    }\n\n    @Override\n    public AdapterBinding getDeserializeAdapterBinding() {\n        return adapterBinding;\n    }\n\n    /**\n     * Serializer wrapper with resolved generic info.\n     *\n     * @return serializer wrapper\n     */\n    public SerializerBinding<?> getSerializerBinding() {\n        return serializerBinding;\n    }\n\n    /**\n     * Deserializer wrapper with resolved generic info.\n     *\n     * @return deserializer wrapper\n     */\n    public DeserializerBinding<?> getDeserializerBinding() {\n        return deserializerBinding;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    abstract static class Builder<T extends Builder<T, B>, B extends CustomizationBase> {\n\n        private AdapterBinding adapterBinding;\n        private SerializerBinding<?> serializerBinding;\n        private DeserializerBinding<?> deserializerBinding;\n        private boolean nillable;\n\n        Builder() {\n        }\n\n        public T of(B customization) {\n            adapterBinding = customization.getDeserializeAdapterBinding();\n            serializerBinding = customization.getSerializerBinding();\n            deserializerBinding = customization.getDeserializerBinding();\n            nillable = customization.isNillable();\n            return (T) this;\n        }\n\n        public T adapterBinding(AdapterBinding adapterBinding) {\n            this.adapterBinding = adapterBinding;\n            return (T) this;\n        }\n\n        public T serializerBinding(SerializerBinding<?> serializerBinding) {\n            this.serializerBinding = serializerBinding;\n            return (T) this;\n        }\n\n        public T deserializerBinding(DeserializerBinding<?> deserializerBinding) {\n            this.deserializerBinding = deserializerBinding;\n            return (T) this;\n        }\n\n        public T nillable(boolean nillable) {\n            this.nillable = nillable;\n            return (T) this;\n        }\n\n        public abstract B build();\n\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/customization/PropertyCustomization.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model.customization;\n\nimport org.eclipse.yasson.internal.JsonbDateFormatter;\nimport org.eclipse.yasson.internal.JsonbNumberFormatter;\nimport org.eclipse.yasson.internal.components.AdapterBinding;\n\n/**\n * Customization for a property of a class.\n */\npublic class PropertyCustomization extends CustomizationBase {\n\n    private final String jsonReadName;\n    private final String jsonWriteName;\n\n    private final JsonbNumberFormatter serializeNumberFormatter;\n    private final JsonbNumberFormatter deserializeNumberFormatter;\n\n    private final JsonbDateFormatter serializeDateFormatter;\n    private final JsonbDateFormatter deserializeDateFormatter;\n\n    private final AdapterBinding serializeAdapter;\n    private final AdapterBinding deserializeAdapter;\n\n    private final boolean readTransient;\n    private final boolean writeTransient;\n\n    private final Class<?> implementationClass;\n\n    /**\n     * Copies properties from builder an creates immutable instance.\n     *\n     * @param builder not null\n     */\n    private PropertyCustomization(Builder builder) {\n        super(builder);\n        this.serializeAdapter = builder.serializeAdapter;\n        this.deserializeAdapter = builder.deserializeAdapter;\n        this.jsonReadName = builder.jsonReadName;\n        this.jsonWriteName = builder.jsonWriteName;\n        this.serializeNumberFormatter = builder.serializeNumberFormatter;\n        this.deserializeNumberFormatter = builder.deserializeNumberFormatter;\n        this.serializeDateFormatter = builder.serializeDateFormatter;\n        this.deserializeDateFormatter = builder.deserializeDateFormatter;\n        this.readTransient = builder.readTransient;\n        this.writeTransient = builder.writeTransient;\n        this.implementationClass = builder.implementationClass;\n    }\n\n    public static Builder builder() {\n        return new Builder();\n    }\n\n    /**\n     * Name if specified for property setter with {@link jakarta.json.bind.annotation.JsonbProperty}.\n     *\n     * @return read name\n     */\n    public String getJsonReadName() {\n        return jsonReadName;\n    }\n\n    /**\n     * Name if specified for property getter with {@link jakarta.json.bind.annotation.JsonbProperty}.\n     *\n     * @return write name\n     */\n    public String getJsonWriteName() {\n        return jsonWriteName;\n    }\n\n    @Override\n    public JsonbNumberFormatter getSerializeNumberFormatter() {\n        return serializeNumberFormatter;\n    }\n\n    @Override\n    public JsonbNumberFormatter getDeserializeNumberFormatter() {\n        return deserializeNumberFormatter;\n    }\n\n    @Override\n    public JsonbDateFormatter getSerializeDateFormatter() {\n        return serializeDateFormatter;\n    }\n\n    @Override\n    public JsonbDateFormatter getDeserializeDateFormatter() {\n        return deserializeDateFormatter;\n    }\n\n    /**\n     * The flag indicating whether the value of the underlying type/property should be processed during serialization process\n     * or not.\n     *\n     * @return true indicates that the underlying type/property should be included in serialization process and false indicates\n     * it should not\n     */\n    public boolean isReadTransient() {\n        return readTransient;\n    }\n\n    /**\n     * The flag indicating whether the value of the underlying type/property should be processed during deserialization process\n     * or not.\n     *\n     * @return true indicates that the underlying type/property should be included in deserialization process and false\n     * indicates it should not\n     */\n    public boolean isWriteTransient() {\n        return writeTransient;\n    }\n\n    /**\n     * Implementation class if property is interface type.\n     *\n     * @return class implementing property interface\n     */\n    public Class<?> getImplementationClass() {\n        return implementationClass;\n    }\n\n    @Override\n    public AdapterBinding getDeserializeAdapterBinding() {\n        return deserializeAdapter;\n    }\n\n    @Override\n    public AdapterBinding getSerializeAdapterBinding() {\n        return serializeAdapter;\n    }\n\n    public static final class Builder extends CustomizationBase.Builder<Builder, PropertyCustomization> {\n\n        private String jsonReadName;\n        private String jsonWriteName;\n        private JsonbNumberFormatter serializeNumberFormatter;\n        private JsonbNumberFormatter deserializeNumberFormatter;\n        private JsonbDateFormatter serializeDateFormatter;\n        private JsonbDateFormatter deserializeDateFormatter;\n        private AdapterBinding serializeAdapter;\n        private AdapterBinding deserializeAdapter;\n        private boolean readTransient;\n        private boolean writeTransient;\n        private Class<?> implementationClass;\n\n        private Builder() {\n        }\n\n        @Override\n        public Builder of(PropertyCustomization customization) {\n            jsonReadName = customization.jsonReadName;\n            jsonWriteName = customization.jsonWriteName;\n            serializeNumberFormatter = customization.serializeNumberFormatter;\n            deserializeNumberFormatter = customization.deserializeNumberFormatter;\n            serializeDateFormatter = customization.serializeDateFormatter;\n            deserializeDateFormatter = customization.deserializeDateFormatter;\n            serializeAdapter = customization.serializeAdapter;\n            deserializeAdapter = customization.deserializeAdapter;\n            readTransient = customization.readTransient;\n            writeTransient = customization.writeTransient;\n            implementationClass = customization.implementationClass;\n            return super.of(customization);\n        }\n\n        /**\n         * Set a JSON property name used to read a property value from on deserialization.\n         *\n         * @param jsonReadName JSON property name\n         */\n        public Builder jsonReadName(String jsonReadName) {\n            this.jsonReadName = jsonReadName;\n            return this;\n        }\n\n        /**\n         * Set a property name which is written to JSON document on serialization.\n         *\n         * @param jsonWriteName Property name.\n         */\n        public Builder jsonWriteName(String jsonWriteName) {\n            this.jsonWriteName = jsonWriteName;\n            return this;\n        }\n\n        /**\n         * Set number formatter for formatting numbers during serialization process.\n         *\n         * @param serializeNumberFormatter Number formatter for formatting numbers during serialization process.\n         */\n        public Builder serializeNumberFormatter(JsonbNumberFormatter serializeNumberFormatter) {\n            this.serializeNumberFormatter = serializeNumberFormatter;\n            return this;\n        }\n\n        /**\n         * Set number formatter for formatting numbers during deserialization process.\n         *\n         * @param deserializeNumberFormatter Number formatter for formatting numbers during deserialization process.\n         */\n        public Builder deserializeNumberFormatter(JsonbNumberFormatter deserializeNumberFormatter) {\n            this.deserializeNumberFormatter = deserializeNumberFormatter;\n            return this;\n        }\n\n        /**\n         * Set date formatter for formatting dates during serialization process.\n         *\n         * @param serializeDateFormatter Date formatter for formatting dates during serialization process.\n         */\n        public Builder serializeDateFormatter(JsonbDateFormatter serializeDateFormatter) {\n            this.serializeDateFormatter = serializeDateFormatter;\n            return this;\n        }\n\n        /**\n         * Set date formatter for formatting dates during deserialization process.\n         *\n         * @param deserializeDateFormatter Date formatter for formatting dates during deserialization process.\n         */\n        public Builder deserializeDateFormatter(JsonbDateFormatter deserializeDateFormatter) {\n            this.deserializeDateFormatter = deserializeDateFormatter;\n            return this;\n        }\n\n        public Builder serializeAdapter(AdapterBinding serializeAdapter) {\n            this.serializeAdapter = serializeAdapter;\n            return this;\n        }\n\n        public Builder deserializeAdapter(AdapterBinding deserializeAdapter) {\n            this.deserializeAdapter = deserializeAdapter;\n            return this;\n        }\n\n        /**\n         * Sets a presence of <i>read transient</i> customization.\n         *\n         * @param readTransient Presence of <i>read transient</i> customization.\n         */\n        public Builder readTransient(boolean readTransient) {\n            this.readTransient = readTransient;\n            return this;\n        }\n\n        public boolean readTransient() {\n            return readTransient;\n        }\n\n        /**\n         * Sets a presence of <i>write transient</i> customization.\n         *\n         * @param writeTransient Presence of <i>write transient</i> customization.\n         */\n        public Builder writeTransient(boolean writeTransient) {\n            this.writeTransient = writeTransient;\n            return this;\n        }\n\n        public boolean writeTransient() {\n            return writeTransient;\n        }\n\n        /**\n         * Implementation class if property is interface type.\n         *\n         * @param implementationClass implementing property interface\n         */\n        public Builder implementationClass(Class<?> implementationClass) {\n            this.implementationClass = implementationClass;\n            return this;\n        }\n\n        @Override\n        public PropertyCustomization build() {\n            return new PropertyCustomization(this);\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/customization/PropertyOrdering.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model.customization;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.function.Consumer;\n\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.config.PropertyOrderStrategy;\n\nimport org.eclipse.yasson.internal.model.ClassModel;\nimport org.eclipse.yasson.internal.model.PropertyModel;\n\n/**\n * Order properties in bean object. {@link jakarta.json.bind.annotation.JsonbPropertyOrder} have always precedence.\n * If configured with {@link JsonbConfig} provided property order strategy will be used.\n */\npublic class PropertyOrdering {\n\n    private final Consumer<List<PropertyModel>> propertyOrderStrategy;\n\n    /**\n     * Creates a new instance.\n     *\n     * @param propertyOrderStrategy Property order strategy. Must be not null.\n     */\n    public PropertyOrdering(Consumer<List<PropertyModel>> propertyOrderStrategy) {\n        this.propertyOrderStrategy = Objects.requireNonNull(propertyOrderStrategy);\n    }\n\n    /**\n     * Sorts class properties either, by class {@link jakarta.json.bind.annotation.JsonbPropertyOrder} annotation,\n     * or by {@link PropertyOrderStrategy} if set in {@link JsonbConfig}.\n     *\n     * @param properties Properties to sort.\n     * @param classModel Class model.\n     * @return Sorted list of properties.\n     */\n    public List<PropertyModel> orderProperties(List<PropertyModel> properties, ClassModel classModel) {\n        Map<String, PropertyModel> byReadName = new HashMap<>();\n        properties.forEach(propertyModel -> byReadName.put(propertyModel.getPropertyName(), propertyModel));\n\n        String[] order = classModel.getClassCustomization().getPropertyOrder();\n        List<PropertyModel> sortedProperties = new ArrayList<>();\n        if (order != null) {\n            //if @JsonbPropertyOrder annotation is defined on a class\n            for (String propName : order) {\n                final PropertyModel remove = byReadName.remove(propName);\n                if (remove != null) {\n                    sortedProperties.add(remove);\n                }\n            }\n        }\n\n        List<PropertyModel> readNamesToSort = new ArrayList<>(byReadName.values());\n        propertyOrderStrategy.accept(readNamesToSort);\n        sortedProperties.addAll(readNamesToSort);\n        return sortedProperties;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/customization/StrategiesProvider.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model.customization;\n\nimport java.nio.CharBuffer;\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.function.Consumer;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.config.PropertyNamingStrategy;\n\nimport org.eclipse.yasson.internal.model.PropertyModel;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\nimport static java.util.Comparator.comparing;\n\nimport static jakarta.json.bind.config.PropertyNamingStrategy.CASE_INSENSITIVE;\nimport static jakarta.json.bind.config.PropertyNamingStrategy.IDENTITY;\nimport static jakarta.json.bind.config.PropertyNamingStrategy.LOWER_CASE_WITH_DASHES;\nimport static jakarta.json.bind.config.PropertyNamingStrategy.LOWER_CASE_WITH_UNDERSCORES;\nimport static jakarta.json.bind.config.PropertyNamingStrategy.UPPER_CAMEL_CASE;\nimport static jakarta.json.bind.config.PropertyNamingStrategy.UPPER_CAMEL_CASE_WITH_SPACES;\nimport static jakarta.json.bind.config.PropertyOrderStrategy.ANY;\nimport static jakarta.json.bind.config.PropertyOrderStrategy.LEXICOGRAPHICAL;\nimport static jakarta.json.bind.config.PropertyOrderStrategy.REVERSE;\n\n/**\n * Provides strategies for {@link jakarta.json.bind.config.PropertyNamingStrategy} and\n * {@link jakarta.json.bind.config.PropertyOrderStrategy}.\n */\npublic final class StrategiesProvider {\n    private StrategiesProvider() {\n    }\n\n    /**\n     * Case insensitive naming strategy.\n     */\n    public static final PropertyNamingStrategy CASE_INSENSITIVE_STRATEGY = Objects::requireNonNull;\n\n    /**\n     * Returns an ordering strategy which corresponds to the ordering strategy name.\n     *\n     * @param strategy ordering strategy name\n     * @return ordering strategy\n     */\n    public static Consumer<List<PropertyModel>> getOrderingFunction(String strategy) {\n        switch (strategy) {\n        case LEXICOGRAPHICAL:\n            return props -> props.sort(comparing(PropertyModel::getWriteName));\n        case ANY:\n            return props -> {\n            };\n        case REVERSE:\n            return props -> props.sort(comparing(PropertyModel::getWriteName).reversed());\n        default:\n            throw new JsonbException(Messages.getMessage(MessageKeys.PROPERTY_ORDER, strategy));\n        }\n    }\n\n    /**\n     * Returns a naming strategy which corresponds to the naming strategy name.\n     *\n     * @param strategy naming strategy name\n     * @return naming strategy\n     */\n    public static PropertyNamingStrategy getPropertyNamingStrategy(String strategy) {\n        switch (strategy) {\n        case LOWER_CASE_WITH_UNDERSCORES:\n            return createLowerCaseStrategyWithSeparator('_');\n        case LOWER_CASE_WITH_DASHES:\n            return createLowerCaseStrategyWithSeparator('-');\n        case UPPER_CAMEL_CASE:\n            return createUpperCamelCaseStrategy();\n        case UPPER_CAMEL_CASE_WITH_SPACES:\n            return createUpperCamelCaseWithSpaceStrategy();\n        case IDENTITY:\n            return Objects::requireNonNull;\n        case CASE_INSENSITIVE:\n            return CASE_INSENSITIVE_STRATEGY;\n        default:\n            throw new JsonbException(\"No property naming strategy was found for: \" + strategy);\n        }\n    }\n\n    private static PropertyNamingStrategy createUpperCamelCaseStrategy() {\n        return propertyName -> {\n            Objects.requireNonNull(propertyName);\n            char first = Character.toUpperCase(propertyName.charAt(0));\n\n            return first + propertyName.substring(1);\n        };\n    }\n\n    private static PropertyNamingStrategy createUpperCamelCaseWithSpaceStrategy() {\n        return propertyName -> {\n            String upperCased = createUpperCamelCaseStrategy().translateName(propertyName);\n            CharBuffer buffer = CharBuffer.allocate(upperCased.length() * 2);\n            char last = Character.MIN_VALUE;\n\n            for (int i = 0; i < upperCased.length(); ++i) {\n                char current = upperCased.charAt(i);\n\n                if (i > 0 && Character.isUpperCase(current) && isLowerCaseCharacter(last)) {\n                    buffer.append(' ');\n                }\n                last = current;\n                buffer.append(current);\n            }\n            return new String(buffer.array(), 0, buffer.position());\n        };\n    }\n\n    private static PropertyNamingStrategy createLowerCaseStrategyWithSeparator(char separator) {\n        return propertyName -> {\n            Objects.requireNonNull(propertyName);\n            CharBuffer charBuffer = CharBuffer.allocate(propertyName.length() * 2);\n            char last = Character.MIN_VALUE;\n\n            for (int i = 0; i < propertyName.length(); ++i) {\n                char current = propertyName.charAt(i);\n\n                if (i > 0 && Character.isUpperCase(current) && isLowerCaseCharacter(last)) {\n                    charBuffer.append(separator);\n                }\n                last = current;\n                charBuffer.append(Character.toLowerCase(current));\n            }\n            return new String(charBuffer.array(), 0, charBuffer.position());\n        };\n    }\n\n    private static boolean isLowerCaseCharacter(char character) {\n        return Character.isAlphabetic(character) && Character.isLowerCase(character);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/customization/TypeInheritanceConfiguration.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model.customization;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Objects;\n\nimport jakarta.json.bind.annotation.JsonbTypeInfo;\n\n/**\n * Type inheritance configuration.\n */\npublic class TypeInheritanceConfiguration {\n\n    private final String fieldName;\n    private final boolean inherited;\n    private final Map<Class<?>, String> aliases;\n    private final Class<?> definedType;\n    private final TypeInheritanceConfiguration parentConfig;\n\n    private TypeInheritanceConfiguration(Builder builder) {\n        this.fieldName = builder.fieldName;\n        this.inherited = builder.inherited;\n        this.aliases = Map.copyOf(builder.aliases);\n        this.parentConfig = builder.parentConfig;\n        this.definedType = builder.definedType;\n    }\n\n    public static Builder builder() {\n        return new Builder();\n    }\n\n    public String getFieldName() {\n        return fieldName;\n    }\n\n    public boolean isInherited() {\n        return inherited;\n    }\n\n    public Map<Class<?>, String> getAliases() {\n        return aliases;\n    }\n\n    public Class<?> getDefinedType() {\n        return definedType;\n    }\n\n    public TypeInheritanceConfiguration getParentConfig() {\n        return parentConfig;\n    }\n\n    public static final class Builder {\n\n        private Map<Class<?>, String> aliases = new HashMap<>();\n        private String fieldName = JsonbTypeInfo.DEFAULT_KEY_NAME;\n        private boolean inherited = false;\n        private Class<?> definedType;\n        private TypeInheritanceConfiguration parentConfig;\n\n        private Builder() {\n        }\n\n        public Builder inherited(boolean inherited) {\n            this.inherited = inherited;\n            return this;\n        }\n\n        public Builder fieldName(String fieldName) {\n            this.fieldName = Objects.requireNonNull(fieldName);\n            return this;\n        }\n\n        public Builder alias(Class<?> clazz, String alias) {\n            this.aliases.put(clazz, alias);\n            return this;\n        }\n\n        public Builder parentConfig(TypeInheritanceConfiguration parentConfig) {\n            this.parentConfig = parentConfig;\n            return this;\n        }\n\n        public Builder definedType(Class<?> definedType) {\n            this.definedType = definedType;\n            return this;\n        }\n\n        public Builder of(TypeInheritanceConfiguration typeInheritanceConfiguration) {\n            this.fieldName = typeInheritanceConfiguration.fieldName;\n            this.aliases = new HashMap<>(typeInheritanceConfiguration.aliases);\n            this.inherited = typeInheritanceConfiguration.inherited;\n            this.parentConfig = typeInheritanceConfiguration.parentConfig;\n            this.definedType = typeInheritanceConfiguration.definedType;\n            return this;\n        }\n\n        public TypeInheritanceConfiguration build() {\n            return new TypeInheritanceConfiguration(this);\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/model/customization/VisibilityStrategiesProvider.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model.customization;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Modifier;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.config.PropertyVisibilityStrategy;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Provider of the JSON-B visibility strategies.\n */\npublic class VisibilityStrategiesProvider {\n\n    private static final PropertyVisibilityStrategy PUBLIC_PROPERTY = new PublicPropertyVisibilityStrategy();\n    private static final PropertyVisibilityStrategy PUBLIC_ACCESSOR_METHODS = new PublicAccessorVisibilityStrategy();\n    private static final PropertyVisibilityStrategy PUBLIC_FIELDS = new PublicFieldsVisibilityStrategy();\n    private static final PropertyVisibilityStrategy ALL_FIELDS_AND_METHODS = new AllFieldsVisibilityStrategy();\n\n    private VisibilityStrategiesProvider() {\n        throw new IllegalStateException(\"This class cannot be instantiated\");\n    }\n\n    public static PropertyVisibilityStrategy getStrategy(String strategy) {\n        switch (strategy) {\n        case \"PUBLIC_PROPERTY\":\n            return PUBLIC_PROPERTY;\n        case \"PUBLIC_ACCESSOR_METHODS\":\n            return PUBLIC_ACCESSOR_METHODS;\n        case \"PUBLIC_FIELDS\":\n            return PUBLIC_FIELDS;\n        case \"ALL_FIELD_AND_ACCESSORS\":\n            return ALL_FIELDS_AND_METHODS;\n        default:\n            throw new JsonbException(Messages.getMessage(MessageKeys.UNKNOWN_VISIBILITY_STRATEGY, strategy));\n        }\n    }\n\n    private static final class PublicPropertyVisibilityStrategy implements PropertyVisibilityStrategy {\n        @Override\n        public boolean isVisible(Field field) {\n            return Modifier.isPublic(field.getModifiers());\n        }\n\n        @Override\n        public boolean isVisible(Method method) {\n            return Modifier.isPublic(method.getModifiers());\n        }\n    }\n\n    private static final class PublicAccessorVisibilityStrategy implements PropertyVisibilityStrategy {\n\n        @Override\n        public boolean isVisible(Field field) {\n            return false;\n        }\n\n        @Override\n        public boolean isVisible(Method method) {\n            return Modifier.isPublic(method.getModifiers());\n        }\n\n    }\n\n    private static final class PublicFieldsVisibilityStrategy implements PropertyVisibilityStrategy {\n\n        @Override\n        public boolean isVisible(Field field) {\n            return Modifier.isPublic(field.getModifiers());\n        }\n\n        @Override\n        public boolean isVisible(Method method) {\n            return false;\n        }\n\n    }\n\n    private static final class AllFieldsVisibilityStrategy implements PropertyVisibilityStrategy {\n        @Override\n        public boolean isVisible(Field field) {\n            return true;\n        }\n\n        @Override\n        public boolean isVisible(Method method) {\n            return true;\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/properties/MessageKeys.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.properties;\n\nimport java.beans.ConstructorProperties;\nimport java.lang.reflect.ParameterizedType;\nimport java.sql.Date;\n\nimport jakarta.json.JsonNumber;\nimport jakarta.json.JsonValue;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.annotation.JsonbTransient;\n\n/**\n * Contains all message keys present in language property files.\n */\npublic enum MessageKeys {\n\n    /**\n     * An error has occurred while json deserialization.\n     */\n    PROCESS_FROM_JSON(\"processFromJson\"),\n    /**\n     * An error has occurred while object serialization.\n     */\n    PROCESS_TO_JSON(\"processToJson\"),\n    /**\n     * Object cannot be serialized.\n     */\n    CANNOT_MARSHAL_OBJECT(\"cannotMarshallObject\"),\n    /**\n     * An error has occurred during runtime type resolution.\n     */\n    TYPE_RESOLUTION_ERROR(\"typeResolutionError\"),\n    /**\n     * Generic bound not found.\n     */\n    GENERIC_BOUND_NOT_FOUND(\"genericBoundNotFound\"),\n    /**\n     * {@link JsonValue} could not be converted to some type.\n     */\n    CANT_CONVERT_JSON_VALUE(\"cantConvertJsonValue\"),\n    /**\n     * Root instance could not be created.\n     */\n    CANT_CREATE_ROOT_INSTANCE(\"cantCreateRootInstance\"),\n    /**\n     * Class does not have default constructor.\n     */\n    NO_DEFAULT_CONSTRUCTOR(\"noDefaultConstructor\"),\n    /**\n     * Class does not have default constructor.\n     */\n    RECORD_MULTIPLE_CONSTRUCTORS(\"recordMultipleConstructors\"),\n    /**\n     * There has been an error while invoking getter.\n     */\n    INVOKING_GETTER(\"invokingGetter\"),\n    /**\n     * Could not get field value.\n     */\n    GETTING_VALUE(\"gettingValue\"),\n    /**\n     * Could not set field value.\n     */\n    SETTING_VALUE(\"settingValue\"),\n    /**\n     * No logger name provided.\n     */\n    NO_LOGGER_NAME(\"noLoggerName\"),\n    /**\n     * {@link ParameterizedType} superclass could not be resolved.\n     */\n    RESOLVE_PARAMETRIZED_TYPE(\"resolveParametrizedType\"),\n    /**\n     * Instance could not be created.\n     */\n    CANT_CREATE_INSTANCE(\"cantCreateInstance\"),\n    /**\n     * Type could not be inferred to deserialization.\n     */\n    INFER_TYPE_FOR_UNMARSHALL(\"inferTypeForUnmarshall\"),\n    /**\n     * Implementation class is not compatible.\n     */\n    IMPL_CLASS_INCOMPATIBLE(\"implClassIncompatible\"),\n    /**\n     * Value is not of target type.\n     */\n    NOT_VALUE_TYPE(\"notValueType\"),\n    /**\n     * Unexpected parser event has occurred.\n     */\n    UNEXPECTED_PARSE_EVENT(\"unexpectedParseEvent\"),\n    /**\n     * Am error has occurred while creating handles.\n     */\n    CREATING_HANDLES(\"creatingHandles\"),\n    /**\n     * Could not get field value with method.\n     */\n    GETTING_VALUE_WITH(\"gettingValueWith\"),\n    /**\n     * Could not set field value with method.\n     */\n    SETTING_VALUE_WITH(\"settingValueWith\"),\n    /**\n     * String contains unpaired surrogate.\n     */\n    UNPAIRED_SURROGATE(\"unpairedSurrogate\"),\n    /**\n     * An exception occurred while adapting object.\n     */\n    ADAPTER_EXCEPTION(\"adapterException\"),\n    /**\n     * Adapter for current type has been found.\n     */\n    ADAPTER_FOUND(\"adapterFound\"),\n    /**\n     * Adapter is incompatible for current type.\n     */\n    ADAPTER_INCOMPATIBLE(\"adapterIncompatible\"),\n    /**\n     * Property order strategy not recognized.\n     */\n    PROPERTY_ORDER(\"propertyOrder\"),\n    /**\n     * Unsupported Jsonp serializer value.\n     */\n    UNSUPPORTED_JSONP_SERIALIZER_VALUE(\"unsupportedJsonpSerializerValue\"),\n    /**\n     * {@link JsonbConfig#FORMATTING} supports only Boolean types.\n     */\n    JSONB_CONFIG_FORMATTING_ILLEGAL_VALUE(\"Only Boolean type values are supported for JsonbConfig.FORMATTING property.\"),\n    /**\n     * No JNDI provider found.\n     */\n    NO_JNDI_ENVIRONMENT(\"noJndiEnvironment\"),\n    /**\n     * CDI API provider has not been found.\n     */\n    NO_CDI_API_PROVIDER(\"noCdiApiProvider\"),\n    /**\n     * Insufficient permissions to access property.\n     */\n    ILLEGAL_ACCESS(\"illegalAccess\"),\n    /**\n     * CDI bean manager not found, serializers and adapters will not have CDI support.\n     */\n    BEAN_MANAGER_NOT_FOUND_USING_DEFAULT(\"usingDefaultConstructorInstantiator\"),\n    /**\n     * CDI environment is not available.\n     */\n    NO_CDI_ENVIRONMENT(\"noCdiEnvironment\"),\n    /**\n     * Cannot serialize single value due to I-Json support is enabled.\n     */\n    IJSON_ENABLED_SINGLE_VALUE(\"iJsonEnabledSingleValue\"),\n    /**\n     * Property not found in target class.\n     */\n    PROPERTY_NOT_FOUND_DESERIALIZER(\"propertyNotFoundDeserializer\"),\n    /**\n     * Property could not be set to target property.\n     */\n    SETTING_PROPERTY_DESERIALIZER(\"settingPropertyDeserializer\"),\n    /**\n     * Loading of specific class in not allowed.\n     */\n    CLASS_LOAD_NOT_ALLOWED(\"classLoadNotAllowed\"),\n    /**\n     * Data type is not supported.\n     */\n    UNSUPPORTED_DATE_TYPE(\"dateTypeNotSupported\"),\n    /**\n     * There has been an error during parsing number.\n     */\n    DATE_PARSE_ERROR(\"errorParsingDate\"),\n    /**\n     * Parsing offset date from epoch millisecond, UTC zone offset will be used.\n     */\n    OFFSET_DATE_TIME_FROM_MILLIS(\"offsetDateTimeFromMillis\"),\n    /**\n     * Target date object could not be converted to or from epoch millis.\n     */\n    TIME_TO_EPOCH_MILLIS_ERROR(\"timeToEpochMillisError\"),\n    /**\n     * Jsonb config property contains invalid type.\n     */\n    JSONB_CONFIG_PROPERTY_INVALID_TYPE(\"configPropertyInvalidType\"),\n    /**\n     * Conversion target type from or to String is not supported.\n     */\n    CONVERSION_NOT_SUPPORTED(\"conversionNotSupported\"),\n    /**\n     * End of the json structure reached.\n     */\n    END_OF_JSON_STRUCTURE(\"endOfJsonStructure\"),\n    /**\n     * Json value type could not be deserialized to the target type.\n     */\n    INVALID_DESERIALIZATION_JSON_TYPE(\"invalidDeserializationType\"),\n    /**\n     * An error occurred while calling {@link JsonbCreator}.\n     */\n    ERROR_CALLING_JSONB_CREATOR(\"errorCallingJsonbCreator\"),\n    /**\n     * Return type of the {@link JsonbCreator} has to be the same as target type.\n     */\n    INCOMPATIBLE_FACTORY_CREATOR_RETURN_TYPE(\"incompatibleFactoryCreatorReturnType\"),\n    /**\n     * Only one {@link JsonbCreator} can be present in the class.\n     */\n    MULTIPLE_JSONB_CREATORS(\"multipleJsonbCreators\"),\n    /**\n     * An internal error has occurred.\n     */\n    INTERNAL_ERROR(\"internalError\"),\n    /**\n     * There has been an error during property serialization.\n     */\n    SERIALIZE_PROPERTY_ERROR(\"serializePropertyError\"),\n    /**\n     * There has been an error during value deserialization.\n     */\n    DESERIALIZE_VALUE_ERROR(\"deserializeValueError\"),\n    /**\n     * Number has unsupported format.\n     */\n    PARSING_NUMBER(\"parsingNumber\"),\n    /**\n     * Unknown binary data strategy selected.\n     */\n    UNKNOWN_BINARY_DATA_STRATEGY(\"unknownBinaryDataStrategy\"),\n    /**\n     * Invalid property naming strategy selected.\n     */\n    PROPERTY_NAMING_STRATEGY_INVALID(\"invalidPropertyNamingStrategy\"),\n    /**\n     * Creator parameter has to be annotated by {@link JsonbProperty} annotation.\n     */\n    CREATOR_PARAMETER_NOT_ANNOTATED(\"creatorParameterNotAnnotated\"),\n    /**\n     * Json property could not be mapped to the target class.\n     */\n    UNKNOWN_JSON_PROPERTY(\"unknownJsonProperty\"),\n    /**\n     * Json does not contain all necessary properties for {@link JsonbCreator}.\n     */\n    JSONB_CREATOR_MISSING_PROPERTY(\"jsonbCreatorMissingProperty\"),\n    /**\n     * There has been an error during zone deserialization.\n     */\n    ZONE_PARSE_ERROR(\"zoneParseError\"),\n    /**\n     * {@link JsonbTransient} was not the only annotation on class property.\n     */\n    JSONB_TRANSIENT_WITH_OTHER_ANNOTATIONS(\"jsonbTransientWithOtherAnnotations\"),\n    /**\n     * Target type is not {@link ParameterizedType}.\n     */\n    NON_PARAMETRIZED_TYPE(\"nonParametrizedType\"),\n    /**\n     * Handled property has the same read/write name in target class as some other property present there.\n     */\n    PROPERTY_NAME_CLASH(\"propertyNameClash\"),\n    /**\n     * {@link Date} is not supported I-Json is enabled.\n     */\n    SQL_DATE_IJSON_ERROR(\"sqlDateIJsonError\"),\n    /**\n     * Recursive reference detected.\n     */\n    RECURSIVE_REFERENCE(\"recursiveReference\"),\n    /**\n     * An error occurred while DatatypeFactory creation.\n     */\n    DATATYPE_FACTORY_CREATION_FAILED(\"datatypeFactoryCreationFailed\"),\n    /**\n     * Bean manager provider not found.\n     */\n    BEAN_MANAGER_PROVIDER_NOT_FOUND(\"beanManagerProviderNotFound\"),\n    /**\n     * More than one constructor annotated with {@link ConstructorProperties} declared in target class.\n     */\n    MULTIPLE_CONSTRUCTOR_PROPERTIES_CREATORS(\"multipleConstructorPropertiesCreators\"),\n    /**\n     * Target annotation is not visible in modules or classpath.\n     */\n    ANNOTATION_NOT_AVAILABLE(\"annotationNotAvailable\"),\n    /**\n     * Missing value property in target annotation.\n     */\n    MISSING_VALUE_PROPERTY_IN_ANNOTATION(\"missingValuePropertyInAnnotation\"),\n    /**\n     * Target json value is not valid {@link JsonNumber}.\n     */\n    NUMBER_INCOMPATIBLE_VALUE_TYPE_ARRAY(\"numberIncompatibleValueTypeArray\"),\n    /**\n     * Target json value is not valid {@link JsonNumber}.\n     */\n    NUMBER_INCOMPATIBLE_VALUE_TYPE_OBJECT(\"numberIncompatibleValueTypeObject\"),\n    /**\n     * Unknown visibility strategy.\n     */\n    UNKNOWN_VISIBILITY_STRATEGY(\"unknownVisibilityStrategy\");\n\n    /**\n     * Message bundle key.\n     */\n    private final String key;\n\n    /**\n     * Creates an instance of message bundle key.\n     *\n     * @param key Message key from bundle.\n     */\n    MessageKeys(final String key) {\n        this.key = key;\n    }\n\n    /**\n     * Returns message bundle key.\n     *\n     * @return message bundle key\n     */\n    public String getKey() {\n        return key;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/properties/Messages.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.properties;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.net.URL;\nimport java.net.URLConnection;\nimport java.text.MessageFormat;\nimport java.util.Locale;\nimport java.util.PropertyResourceBundle;\nimport java.util.ResourceBundle;\n\n/**\n * JSON-B messages.\n */\npublic class Messages {\n\n    private static final String MESSAGE_BUNDLE = \"yasson-messages\";\n    private static final String ENCODING = \"UTF-8\";\n\n    private Messages() {\n    }\n\n    /**\n     * Gets message by key. Default locale is used.\n     *\n     * @param key     Message key.\n     * @param objects Message parameters.\n     * @return Formatted message in string.\n     */\n    public static String getMessage(MessageKeys key, Object... objects) {\n        return getMessage(key, Locale.getDefault(), objects);\n    }\n\n    /**\n     * Gets message by key and locale.\n     *\n     * @param key     Message key.\n     * @param locale  Locale.\n     * @param objects Message parameters.\n     * @return Formatted message in string.\n     */\n    public static String getMessage(MessageKeys key, Locale locale, Object... objects) {\n        ResourceBundle messages = getResourceBundle(locale);\n        MessageFormat formatter = new MessageFormat(messages.getString(key.getKey()));\n        return formatter.format(objects);\n    }\n\n    /**\n     * ResourceBundle.Control is not supported when loaded from JPMS native module.\n     */\n    private static ResourceBundle getResourceBundle(Locale locale) {\n        try {\n            return ResourceBundle.getBundle(MESSAGE_BUNDLE, locale, new UTF8Control());\n        } catch (UnsupportedOperationException e) {\n            return ResourceBundle.getBundle(MESSAGE_BUNDLE, locale);\n        }\n    }\n\n    static class UTF8Control extends ResourceBundle.Control {\n        public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload)\n                throws IllegalAccessException, InstantiationException, IOException {\n            // The below is a copy of the default implementation.\n            String bundleName = toBundleName(baseName, locale);\n            String resourceName = toResourceName(bundleName, \"properties\");\n            ResourceBundle bundle = null;\n            InputStream stream = null;\n            if (reload) {\n                URL url = loader.getResource(resourceName);\n                if (url != null) {\n                    URLConnection connection = url.openConnection();\n                    if (connection != null) {\n                        connection.setUseCaches(false);\n                        stream = connection.getInputStream();\n                    }\n                }\n            } else {\n                stream = loader.getResourceAsStream(resourceName);\n            }\n            if (stream != null) {\n                try {\n                    // Only this line is changed to make it to read properties files as UTF-8.\n                    bundle = new PropertyResourceBundle(new InputStreamReader(stream, ENCODING));\n                } finally {\n                    stream.close();\n                }\n            }\n            return bundle;\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/AbstractSerializer.java",
    "content": "/*\n * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\n/**\n * Abstract model serializer with delegate.\n */\nabstract class AbstractSerializer implements ModelSerializer {\n\n    final ModelSerializer delegate;\n\n    AbstractSerializer(ModelSerializer delegate) {\n        this.delegate = delegate;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/AdapterSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.adapter.JsonbAdapter;\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\nimport org.eclipse.yasson.internal.components.AdapterBinding;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * User defined adapter invoker.\n */\nclass AdapterSerializer extends AbstractSerializer {\n\n    private final JsonbAdapter<Object, Object> adapter;\n    private final AdapterBinding adapterBinding;\n\n    @SuppressWarnings(\"unchecked\")\n    AdapterSerializer(AdapterBinding adapterBinding,\n                      ModelSerializer delegate) {\n        super(delegate);\n        this.adapter = (JsonbAdapter<Object, Object>) adapterBinding.getAdapter();\n        this.adapterBinding = adapterBinding;\n    }\n\n    @Override\n    public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        try {\n            delegate.serialize(adapter.adaptToJson(value), generator, context);\n        } catch (Exception e) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.ADAPTER_EXCEPTION,\n                                                         adapterBinding.getBindingType(),\n                                                         adapterBinding.getToType(),\n                                                         adapter.getClass()), e);\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/ArraySerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport java.util.Base64;\nimport java.util.Map;\nimport java.util.function.Function;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.config.BinaryDataStrategy;\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.JsonbContext;\nimport org.eclipse.yasson.internal.SerializationContextImpl;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Array container serializer.\n */\nabstract class ArraySerializer implements ModelSerializer {\n\n    private static final Map<Class<?>, Function<ModelSerializer, ArraySerializer>> ARRAY_SERIALIZERS;\n\n    static {\n        ARRAY_SERIALIZERS = Map.of(boolean[].class, BooleanArraySerializer::new,\n                                   byte[].class, ByteArraySerializer::new,\n                                   char[].class, CharacterArraySerializer::new,\n                                   double[].class, DoubleArraySerializer::new,\n                                   float[].class, FloatArraySerializer::new,\n                                   int[].class, IntegerArraySerializer::new,\n                                   long[].class, LongArraySerializer::new,\n                                   short[].class, ShortArraySerializer::new);\n    }\n\n    private final ModelSerializer valueSerializer;\n\n    protected ArraySerializer(ModelSerializer valueSerializer) {\n        this.valueSerializer = valueSerializer;\n    }\n\n    public static ModelSerializer create(Class<?> arrayType,\n                                         JsonbContext jsonbContext,\n                                         ModelSerializer modelSerializer) {\n        String binaryDataStrategy = jsonbContext.getConfigProperties().getBinaryDataStrategy();\n        if (byte[].class.equals(arrayType) && !binaryDataStrategy.equals(BinaryDataStrategy.BYTE)) {\n            return new Base64ByteArraySerializer(binaryDataStrategy);\n        }\n        if (ARRAY_SERIALIZERS.containsKey(arrayType)) {\n            return ARRAY_SERIALIZERS.get(arrayType).apply(modelSerializer);\n        }\n        return new ObjectArraySerializer(modelSerializer);\n    }\n\n    @Override\n    public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        generator.writeStartArray();\n        serializeArray(value, generator, context);\n        generator.writeEnd();\n    }\n\n    abstract void serializeArray(Object value, JsonGenerator generator, SerializationContextImpl context);\n\n    protected ModelSerializer getValueSerializer() {\n        return valueSerializer;\n    }\n\n    private static final class ByteArraySerializer extends ArraySerializer {\n\n        ByteArraySerializer(ModelSerializer valueSerializer) {\n            super(valueSerializer);\n        }\n\n        @Override\n        public void serializeArray(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            byte[] array = (byte[]) value;\n            for (byte b : array) {\n                getValueSerializer().serialize(b, generator, context);\n            }\n        }\n\n    }\n\n    private static final class Base64ByteArraySerializer implements ModelSerializer {\n\n        private final Base64.Encoder encoder;\n\n        Base64ByteArraySerializer(String strategy) {\n            this.encoder = getEncoder(strategy);\n        }\n\n        @Override\n        public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            byte[] array = (byte[]) value;\n            generator.write(encoder.encodeToString(array));\n        }\n\n        private Base64.Encoder getEncoder(String strategy) {\n            switch (strategy) {\n            case BinaryDataStrategy.BASE_64:\n                return Base64.getEncoder();\n            case BinaryDataStrategy.BASE_64_URL:\n                return Base64.getUrlEncoder();\n            default:\n                throw new JsonbException(Messages.getMessage(MessageKeys.INTERNAL_ERROR, \"Invalid strategy: \" + strategy));\n            }\n        }\n    }\n\n    private static final class ShortArraySerializer extends ArraySerializer {\n\n        ShortArraySerializer(ModelSerializer valueSerializer) {\n            super(valueSerializer);\n        }\n\n        @Override\n        public void serializeArray(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            short[] array = (short[]) value;\n            for (short s : array) {\n                getValueSerializer().serialize(s, generator, context);\n            }\n        }\n\n    }\n\n    private static final class IntegerArraySerializer extends ArraySerializer {\n\n        IntegerArraySerializer(ModelSerializer valueSerializer) {\n            super(valueSerializer);\n        }\n\n        @Override\n        public void serializeArray(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            int[] array = (int[]) value;\n            for (int i : array) {\n                getValueSerializer().serialize(i, generator, context);\n            }\n        }\n\n    }\n\n    private static final class LongArraySerializer extends ArraySerializer {\n\n        LongArraySerializer(ModelSerializer valueSerializer) {\n            super(valueSerializer);\n        }\n\n        @Override\n        public void serializeArray(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            long[] array = (long[]) value;\n            for (long l : array) {\n                getValueSerializer().serialize(l, generator, context);\n            }\n        }\n\n    }\n\n    private static final class FloatArraySerializer extends ArraySerializer {\n\n        FloatArraySerializer(ModelSerializer valueSerializer) {\n            super(valueSerializer);\n        }\n\n        @Override\n        public void serializeArray(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            float[] array = (float[]) value;\n            for (float f : array) {\n                getValueSerializer().serialize(f, generator, context);\n            }\n        }\n\n    }\n\n    private static final class DoubleArraySerializer extends ArraySerializer {\n\n        DoubleArraySerializer(ModelSerializer valueSerializer) {\n            super(valueSerializer);\n        }\n\n        @Override\n        public void serializeArray(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            double[] array = (double[]) value;\n            for (double d : array) {\n                getValueSerializer().serialize(d, generator, context);\n            }\n        }\n\n    }\n\n    private static final class BooleanArraySerializer extends ArraySerializer {\n\n        BooleanArraySerializer(ModelSerializer valueSerializer) {\n            super(valueSerializer);\n        }\n\n        @Override\n        public void serializeArray(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            boolean[] array = (boolean[]) value;\n            for (boolean b : array) {\n                getValueSerializer().serialize(b, generator, context);\n            }\n        }\n\n    }\n\n    private static final class CharacterArraySerializer extends ArraySerializer {\n\n        CharacterArraySerializer(ModelSerializer valueSerializer) {\n            super(valueSerializer);\n        }\n\n        @Override\n        public void serializeArray(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            char[] array = (char[]) value;\n            for (char c : array) {\n                getValueSerializer().serialize(c, generator, context);\n            }\n        }\n\n    }\n\n    private static final class ObjectArraySerializer extends ArraySerializer {\n\n        ObjectArraySerializer(ModelSerializer valueSerializer) {\n            super(valueSerializer);\n        }\n\n        @Override\n        public void serializeArray(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            Object[] array = (Object[]) value;\n            for (Object o : array) {\n                getValueSerializer().serialize(o, generator, context);\n            }\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/CollectionSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport java.util.Collection;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Collection container serializer.\n */\nclass CollectionSerializer implements ModelSerializer {\n\n    private final ModelSerializer delegate;\n\n    CollectionSerializer(ModelSerializer delegate) {\n        this.delegate = delegate;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        Collection<Object> collection = (Collection<Object>) value;\n        generator.writeStartArray();\n        collection.forEach(object -> delegate.serialize(object, generator, context));\n        generator.writeEnd();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/CyclicReferenceSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport java.lang.reflect.Type;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Solution for cyclic references in serialization.\n * This approach helps us to avoid creation of multiple serializers for the same type.\n */\nclass CyclicReferenceSerializer implements ModelSerializer {\n\n    private final Type type;\n    private ModelSerializer delegate;\n\n    CyclicReferenceSerializer(Type type) {\n        this.type = type;\n    }\n\n    @Override\n    public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        if (delegate == null) {\n            delegate = context.getJsonbContext().getSerializationModelCreator().serializerChain(type, true, true);\n        }\n        delegate.serialize(value, generator, context);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/KeyWriter.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Key name writer. Writes key name of the property if present.\n */\npublic class KeyWriter implements ModelSerializer {\n\n    private final ModelSerializer delegate;\n\n    /**\n     * Create new instance.\n     *\n     * @param delegate delegate to be called after the key is written\n     */\n    public KeyWriter(ModelSerializer delegate) {\n        this.delegate = delegate;\n    }\n\n    @Override\n    public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        if (context.getKey() != null) {\n            generator.writeKey(context.getKey());\n            context.setKey(null);\n        }\n        delegate.serialize(value, generator, context);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/MapSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport java.util.Map;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.JsonbContext;\nimport org.eclipse.yasson.internal.SerializationContextImpl;\nimport org.eclipse.yasson.internal.serializer.types.TypeSerializers;\n\n/**\n * Map container serializer.\n */\nabstract class MapSerializer implements ModelSerializer {\n\n    private final ModelSerializer keySerializer;\n    private final ModelSerializer valueSerializer;\n\n    MapSerializer(ModelSerializer keySerializer, ModelSerializer valueSerializer) {\n        this.keySerializer = keySerializer;\n        this.valueSerializer = valueSerializer;\n    }\n\n    ModelSerializer getKeySerializer() {\n        return keySerializer;\n    }\n\n    ModelSerializer getValueSerializer() {\n        return valueSerializer;\n    }\n\n    static MapSerializer create(Class<?> keyClass, ModelSerializer keySerializer, ModelSerializer valueSerializer, JsonbContext jsonbContext) {\n        if (TypeSerializers.isSupportedMapKey(keyClass)) {\n            //Issue #663: A custom JsonbSerializer is available for an already supported Map key. Serialization must\n            //not use normal key:value map. No further checking needed. Wrapping object needs to be used.\n            if (TypeSerializers.hasCustomJsonbSerializer(keyClass, jsonbContext)) {\n                return new ObjectKeyMapSerializer(keySerializer, valueSerializer);\n            } else {\n                return new StringKeyMapSerializer(keySerializer, valueSerializer);\n            }\n        } else if (Object.class.equals(keyClass)) {\n            return new DynamicMapSerializer(keySerializer, valueSerializer);\n        }\n        return new ObjectKeyMapSerializer(keySerializer, valueSerializer);\n    }\n\n    private static final class DynamicMapSerializer extends MapSerializer {\n\n        private final StringKeyMapSerializer stringMap;\n        private final ObjectKeyMapSerializer objectMap;\n        private MapSerializer serializer;\n\n        DynamicMapSerializer(ModelSerializer keySerializer,\n                                    ModelSerializer valueSerializer) {\n            super(keySerializer, valueSerializer);\n            stringMap = new StringKeyMapSerializer(keySerializer, valueSerializer);\n            objectMap = new ObjectKeyMapSerializer(keySerializer, valueSerializer);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            if (serializer == null) {\n                //We have to be sure that Map with Object as a key contains only supported values for key:value format map.\n                Map<Object, Object> map = (Map<Object, Object>) value;\n                boolean suitable = true;\n                for (Object key : map.keySet()) {\n                    if (key == null) {\n                        if (context.getJsonbContext().getConfigProperties().isForceMapArraySerializerForNullKeys()) {\n                            suitable = false;\n                            break;\n                        }\n                        continue;\n                    }\n                    Class<?> keyClass = key.getClass();\n                    if (TypeSerializers.isSupportedMapKey(keyClass)) {\n\n                        //Issue #663: A custom JsonbSerializer is available for an already supported Map key.\n                        //Serialization must not use normal key:value map. No further checking needed. Wrapping object\n                        //needs to be used.\n                        if (TypeSerializers.hasCustomJsonbSerializer(keyClass, context.getJsonbContext())) {\n                            suitable = false;\n                            break;\n                        } else {\n                            continue;\n                        }\n                    }\n                    //No other checks needed. Map is not suitable for normal key:value map. Wrapping object needs to be used.\n                    suitable = false;\n                    break;\n                }\n                serializer = suitable ? stringMap : objectMap;\n            }\n            serializer.serialize(value, generator, context);\n        }\n\n    }\n\n    private static final class StringKeyMapSerializer extends MapSerializer {\n\n        StringKeyMapSerializer(ModelSerializer keySerializer,\n                                      ModelSerializer valueSerializer) {\n            super(keySerializer, valueSerializer);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            Map<Object, Object> map = (Map<Object, Object>) value;\n            generator.writeStartObject();\n            map.forEach((key, val) -> {\n                getKeySerializer().serialize(key, generator, context);\n                getValueSerializer().serialize(val, generator, context);\n            });\n            generator.writeEnd();\n        }\n\n    }\n\n    private static final class ObjectKeyMapSerializer extends MapSerializer {\n\n        ObjectKeyMapSerializer(ModelSerializer keySerializer,\n                                      ModelSerializer valueSerializer) {\n            super(keySerializer, valueSerializer);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            Map<Object, Object> map = (Map<Object, Object>) value;\n            generator.writeStartArray();\n            map.forEach((key, val) -> {\n                generator.writeStartObject();\n                generator.writeKey(\"key\");\n                if (key == null) {\n                    generator.writeNull();\n                } else {\n                    getKeySerializer().serialize(key, generator, context);\n                }\n                generator.writeKey(\"value\");\n                getValueSerializer().serialize(val, generator, context);\n                generator.writeEnd();\n            });\n            generator.writeEnd();\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/ModelSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Type serializer.\n * <br>\n * All the instances are required to be reusable and without any states\n * stored in the class fields.\n */\npublic interface ModelSerializer {\n\n    /**\n     * Serialize provided value or delegate serialization to the next serializer.\n     *\n     * @param value     value to be serialized\n     * @param generator json generator\n     * @param context   serialization context\n     */\n    void serialize(Object value, JsonGenerator generator, SerializationContextImpl context);\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/NullSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.JsonbContext;\nimport org.eclipse.yasson.internal.SerializationContextImpl;\nimport org.eclipse.yasson.internal.model.customization.Customization;\n\n/**\n * Null value serializer. Determines proper behavior when the serialized value is null.\n */\npublic class NullSerializer implements ModelSerializer {\n\n    private final ModelSerializer delegate;\n    private final ModelSerializer nullSerializer;\n    private final ModelSerializer rootNullSerializer;\n\n    /**\n     * Create new instance.\n     *\n     * @param delegate      non-null value delegate\n     * @param customization component customization\n     * @param jsonbContext  jsonb context\n     */\n    public NullSerializer(ModelSerializer delegate,\n                          Customization customization,\n                          JsonbContext jsonbContext) {\n        this.delegate = delegate;\n        if (customization.isNillable()) {\n            nullSerializer = new NullWritingEnabled();\n        } else {\n            nullSerializer = new NullWritingDisabled();\n        }\n        JsonbSerializer<?> userDefinedNullSerializer = jsonbContext.getConfigProperties().getNullSerializer();\n        if (userDefinedNullSerializer != null) {\n            rootNullSerializer = (value, generator, context) -> userDefinedNullSerializer.serialize(null, generator, context);\n        } else {\n            rootNullSerializer = nullSerializer;\n        }\n    }\n\n    @Override\n    public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        if (value == null) {\n            if (context.isRoot()) {\n                context.setRoot(false);\n                rootNullSerializer.serialize(null, generator, context);\n            } else {\n                nullSerializer.serialize(null, generator, context);\n            }\n            context.setKey(null);\n        } else {\n            context.setRoot(false);\n            delegate.serialize(value, generator, context);\n        }\n    }\n\n    private static final class NullWritingEnabled implements ModelSerializer {\n\n        @Override\n        public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            if (context.getKey() == null) {\n                generator.writeNull();\n            } else {\n                generator.writeNull(context.getKey());\n            }\n        }\n\n    }\n\n    private static class NullWritingDisabled implements ModelSerializer {\n\n        @Override\n        public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            if (context.isContainerWithNulls()) {\n                if (context.getKey() == null) {\n                    generator.writeNull();\n                } else {\n                    generator.writeNull(context.getKey());\n                }\n            }\n            context.setKey(null);\n            //Do nothing\n        }\n\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/NullVisibilitySwitcher.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Switching mechanism for default null value visibility in the JSON.\n *\n * Some constructs such as arrays, collections etc. require to have nulls serialized into the JSON by default.\n * This class switches from the default parent null visibility to the current construct visibility. As soon as the current\n * construct is serialized, visibility is switched back to the parent ones.\n */\nclass NullVisibilitySwitcher implements ModelSerializer {\n\n    private final boolean nullsEnabled;\n    private final ModelSerializer delegate;\n\n    NullVisibilitySwitcher(boolean nullsEnabled, ModelSerializer delegate) {\n        this.nullsEnabled = nullsEnabled;\n        this.delegate = delegate;\n    }\n\n    @Override\n    public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        boolean previous = context.isContainerWithNulls();\n        context.setContainerWithNulls(nullsEnabled);\n        delegate.serialize(value, generator, context);\n        context.setContainerWithNulls(previous);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/ObjectSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport java.util.LinkedHashMap;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Object container serializer.\n */\nclass ObjectSerializer implements ModelSerializer {\n\n    private final LinkedHashMap<String, ModelSerializer> propertySerializers;\n\n    ObjectSerializer(LinkedHashMap<String, ModelSerializer> propertySerializers) {\n        this.propertySerializers = propertySerializers;\n    }\n\n    @Override\n    public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        generator.writeStartObject();\n        propertySerializers.forEach((key, serializer) -> {\n            try {\n                context.setKey(key);\n                serializer.serialize(value, generator, context);\n            } catch (Exception e) {\n                throw new JsonbException(Messages.getMessage(MessageKeys.SERIALIZE_PROPERTY_ERROR, key,\n                                                             value.getClass().getCanonicalName()), e);\n            }\n        });\n        generator.writeEnd();\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/OptionalSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport java.util.Optional;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Optional container serializer.\n */\nclass OptionalSerializer implements ModelSerializer {\n\n    private final ModelSerializer delegate;\n\n    OptionalSerializer(ModelSerializer delegate) {\n        this.delegate = delegate;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        Optional<Object> optional = (Optional<Object>) value;\n        delegate.serialize(optional == null ? null : optional.orElse(null), generator, context);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/RecursionChecker.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Recursion checker serializer deals with possible instance recursion in instances.\n */\nclass RecursionChecker implements ModelSerializer {\n\n    private final ModelSerializer delegate;\n\n    RecursionChecker(ModelSerializer delegate) {\n        this.delegate = delegate;\n    }\n\n    @Override\n    public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        if (!context.addProcessedObject(value)) {\n            throw new JsonbException(Messages.getMessage(MessageKeys.RECURSIVE_REFERENCE, value.getClass()));\n        }\n        delegate.serialize(value, generator, context);\n        context.removeProcessedObject(value);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/SerializationModelCreator.java",
    "content": "/*\n * Copyright (c) 2021, 2023 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport java.lang.reflect.GenericArrayType;\nimport java.lang.reflect.Modifier;\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.LinkedHashMap;\nimport java.util.LinkedList;\nimport java.util.ListIterator;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.concurrent.ConcurrentHashMap;\n\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.internal.ComponentMatcher;\nimport org.eclipse.yasson.internal.JsonbContext;\nimport org.eclipse.yasson.internal.ReflectionUtils;\nimport org.eclipse.yasson.internal.components.AdapterBinding;\nimport org.eclipse.yasson.internal.components.SerializerBinding;\nimport org.eclipse.yasson.internal.model.ClassModel;\nimport org.eclipse.yasson.internal.model.PropertyModel;\nimport org.eclipse.yasson.internal.model.customization.ClassCustomization;\nimport org.eclipse.yasson.internal.model.customization.ComponentBoundCustomization;\nimport org.eclipse.yasson.internal.model.customization.Customization;\nimport org.eclipse.yasson.internal.model.customization.TypeInheritanceConfiguration;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\nimport org.eclipse.yasson.internal.serializer.types.ObjectTypeSerializer;\nimport org.eclipse.yasson.internal.serializer.types.TypeSerializers;\n\n/**\n * Create or obtain already created type serializer.\n */\npublic class SerializationModelCreator {\n\n    private final Map<Type, ModelSerializer> explicitChain = new ConcurrentHashMap<>();\n    private final Map<Type, ModelSerializer> dynamicChain = new ConcurrentHashMap<>();\n    private final JsonbContext jsonbContext;\n\n    /**\n     * Create new instance.\n     *\n     * @param jsonbContext jsonb context\n     */\n    public SerializationModelCreator(JsonbContext jsonbContext) {\n        this.jsonbContext = jsonbContext;\n    }\n\n    /**\n     * Wrap {@link ModelSerializer} in the common set of serializers.\n     *\n     * @param modelSerializer serializer to be wrapped\n     * @param customization   component customization\n     * @param jsonbContext    jsonb context\n     * @return wrapped serializer\n     */\n    public static ModelSerializer wrapInCommonSet(ModelSerializer modelSerializer,\n                                                  Customization customization,\n                                                  JsonbContext jsonbContext) {\n        KeyWriter serializer = new KeyWriter(modelSerializer);\n        return new NullSerializer(serializer, customization, jsonbContext);\n    }\n\n    /**\n     * Create new {@link ModelSerializer} of the given type.\n     *\n     * @param type               type to be serialized\n     * @param rootValue          whether it is a root value\n     * @param resolveRootAdapter whether to resolve root adapter\n     * @return type model serializer\n     */\n    public ModelSerializer serializerChain(Type type, boolean rootValue, boolean resolveRootAdapter) {\n        Class<?> rawType = ReflectionUtils.getRawType(type);\n        ClassModel classModel = jsonbContext.getMappingContext().getOrCreateClassModel(rawType);\n        LinkedList<Type> chain = new LinkedList<>();\n        return serializerChain(chain, type, classModel.getClassCustomization(), rootValue, false, resolveRootAdapter);\n    }\n\n    /**\n     * Create new {@link ModelSerializer} of the given type.\n     *\n     * @param chain                 chain of types used before the one currently processed\n     * @param type                  type to be serialized\n     * @param propertyCustomization component customization\n     * @param rootValue             whether it is a root value\n     * @param isKey                 whether it is a key\n     * @return type model serializer\n     */\n    public ModelSerializer serializerChainRuntime(LinkedList<Type> chain,\n                                                  Type type,\n                                                  Customization propertyCustomization,\n                                                  boolean rootValue,\n                                                  boolean isKey) {\n        if (chain.contains(type)) {\n            return new CyclicReferenceSerializer(type);\n        }\n        //If the class instance and class of the field are the same and there has been generics specified for this field,\n        //we need to use those instead of raw type.\n        Class<?> rawType = ReflectionUtils.getRawType(type);\n        Class<?> rawLast = ReflectionUtils.getRawType(chain.getLast());\n        if (rawLast.equals(rawType)) {\n            return serializerChainInternal(chain, chain.getLast(), propertyCustomization, rootValue, isKey, true);\n        }\n        return serializerChainInternal(chain, type, propertyCustomization, rootValue, isKey, true);\n    }\n\n    private ModelSerializer serializerChain(LinkedList<Type> chain,\n                                            Type type,\n                                            Customization propertyCustomization,\n                                            boolean rootValue,\n                                            boolean isKey,\n                                            boolean resolveRootAdapter) {\n        if (chain.contains(type)) {\n            return new CyclicReferenceSerializer(type);\n        }\n        try {\n            chain.add(type);\n            return serializerChainInternal(chain, type, propertyCustomization, rootValue, isKey, resolveRootAdapter);\n        } finally {\n            chain.removeLast();\n        }\n    }\n\n    private ModelSerializer serializerChainInternal(LinkedList<Type> chain,\n                                                    Type type,\n                                                    Customization propertyCustomization,\n                                                    boolean rootValue,\n                                                    boolean isKey,\n                                                    boolean resolveRootAdapter) {\n        if (explicitChain.containsKey(type)) {\n            return explicitChain.get(type);\n        }\n        Class<?> rawType = ReflectionUtils.getRawType(type);\n        Optional<ModelSerializer> serializerBinding = userSerializer(type,\n                                                                     (ComponentBoundCustomization) propertyCustomization);\n        if (serializerBinding.isPresent()) {\n            return serializerBinding.get();\n        }\n        if (resolveRootAdapter) {\n            Optional<AdapterBinding> maybeAdapter = adapterBinding(type, (ComponentBoundCustomization) propertyCustomization);\n            if (maybeAdapter.isPresent()) {\n                AdapterBinding adapterBinding = maybeAdapter.get();\n                Type toType = adapterBinding.getToType();\n                Class<?> rawToType = ReflectionUtils.getRawType(toType);\n                ModelSerializer typeSerializer = TypeSerializers\n                        .getTypeSerializer(rawToType, propertyCustomization, jsonbContext);\n                if (typeSerializer == null) {\n                    typeSerializer = serializerChain(toType, rootValue, !type.equals(toType));\n                }\n                AdapterSerializer adapterSerializer = new AdapterSerializer(adapterBinding, typeSerializer);\n                RecursionChecker recursionChecker = new RecursionChecker(adapterSerializer);\n                NullSerializer nullSerializer = new NullSerializer(recursionChecker, propertyCustomization, jsonbContext);\n                explicitChain.put(type, nullSerializer);\n                return nullSerializer;\n            }\n        }\n\n        ModelSerializer typeSerializer = null;\n        if (!Object.class.equals(rawType)) {\n            typeSerializer = TypeSerializers.getTypeSerializer(chain, rawType, propertyCustomization, jsonbContext, isKey);\n        }\n        if (typeSerializer != null) {\n            if (jsonbContext.getConfigProperties().isStrictIJson() && rootValue) {\n                throw new JsonbException(Messages.getMessage(MessageKeys.IJSON_ENABLED_SINGLE_VALUE));\n            }\n            return typeSerializer;\n        }\n        ClassModel classModel = jsonbContext.getMappingContext().getOrCreateClassModel(rawType);\n        if (Collection.class.isAssignableFrom(rawType)) {\n            return createCollectionSerializer(chain, type, propertyCustomization);\n        } else if (Map.class.isAssignableFrom(rawType)) {\n            return createMapSerializer(chain, type, propertyCustomization);\n        } else if (rawType.isArray()) {\n            return createArraySerializer(chain, rawType, propertyCustomization);\n        } else if (type instanceof GenericArrayType) {\n            return createGenericArraySerializer(chain, type, propertyCustomization);\n        } else if (Optional.class.equals(rawType)) {\n            return createOptionalSerializer(chain, type, propertyCustomization, isKey);\n        }\n        return createObjectSerializer(chain, type, classModel);\n    }\n\n    private ModelSerializer createObjectSerializer(LinkedList<Type> chain,\n                                                   Type type,\n                                                   ClassModel classModel) {\n        LinkedHashMap<String, ModelSerializer> propertySerializers = new LinkedHashMap<>();\n        TypeInheritanceConfiguration typeInheritanceConfiguration = classModel.getClassCustomization().getPolymorphismConfig();\n        if (typeInheritanceConfiguration != null) {\n            addPolymorphismProperty(typeInheritanceConfiguration, propertySerializers, classModel);\n        }\n        for (PropertyModel model : classModel.getSortedProperties()) {\n            if (model.isReadable()) {\n                String name = model.getWriteName();\n                ModelSerializer memberModel = memberSerializer(chain,\n                                                               model.getPropertySerializationType(),\n                                                               model.getCustomization(),\n                                                               false);\n                propertySerializers.put(name, new ValueGetterSerializer(model.getGetValueHandle(), memberModel));\n            }\n        }\n        ModelSerializer objectSerializer = new ObjectSerializer(propertySerializers);\n        RecursionChecker recursionChecker = new RecursionChecker(objectSerializer);\n        KeyWriter keyWriter = new KeyWriter(recursionChecker);\n        NullVisibilitySwitcher nullVisibilitySwitcher = new NullVisibilitySwitcher(false, keyWriter);\n        NullSerializer nullSerializer = new NullSerializer(nullVisibilitySwitcher, classModel.getClassCustomization(),\n                                                           jsonbContext);\n        explicitChain.put(type, nullSerializer);\n        return nullSerializer;\n    }\n\n    private void addPolymorphismProperty(TypeInheritanceConfiguration typeInheritanceConfiguration,\n                                         LinkedHashMap<String, ModelSerializer> propertySerializers,\n                                         ClassModel classModel) {\n        Class<?> rawType = classModel.getType();\n        String alias = typeInheritanceConfiguration.getAliases().get(rawType);\n        ModelSerializer serializer = createPolymorphismPropertySerializer(typeInheritanceConfiguration, alias);\n        if ((!typeInheritanceConfiguration.isInherited() || alias != null) && typeInheritanceConfiguration.getParentConfig() != null) {\n            addParentPolymorphismProperty(typeInheritanceConfiguration.getParentConfig(), propertySerializers, classModel);\n        }\n        if (serializer != null) {\n            propertySerializers.put(typeInheritanceConfiguration.getFieldName(), serializer);\n        }\n        for (PropertyModel propertyModel : classModel.getSortedProperties()) {\n            if (propertySerializers.containsKey(propertyModel.getWriteName())) {\n                throw new JsonbException(\"CHANGE naming conflict!\");\n            }\n        }\n    }\n\n    private void addParentPolymorphismProperty(TypeInheritanceConfiguration typeInheritanceConfiguration,\n                                               LinkedHashMap<String, ModelSerializer> propertySerializers,\n                                               ClassModel classModel) {\n        Class<?> rawType = classModel.getType();\n        TypeInheritanceConfiguration current = typeInheritanceConfiguration;\n        LinkedHashMap<String, ModelSerializer> toBeAdded = new LinkedHashMap<>();\n        while (current != null) {\n            TypeInheritanceConfiguration local = current;\n            String alias = local.getAliases().entrySet().stream()\n                    .filter(entry -> entry.getKey().isAssignableFrom(rawType))\n                    .map(Map.Entry::getValue)\n                    .findFirst()\n                    .orElse(null);\n            if (alias != null) {\n                ModelSerializer serializer = createPolymorphismPropertySerializer(local, alias);\n                toBeAdded.put(current.getFieldName(), serializer);\n                current = current.getParentConfig();\n            }\n        }\n        ListIterator<Map.Entry<String, ModelSerializer>> iterator = new ArrayList<>(toBeAdded.entrySet())\n                .listIterator(toBeAdded.size());\n        while (iterator.hasPrevious()) {\n            Map.Entry<String, ModelSerializer> entry = iterator.previous();\n            propertySerializers.put(entry.getKey(), entry.getValue());\n        }\n    }\n\n    private ModelSerializer createPolymorphismPropertySerializer(TypeInheritanceConfiguration configuration, String alias) {\n        if (alias != null) {\n            return (value, generator, context) -> generator.write(configuration.getFieldName(), alias);\n        }\n        return null;\n    }\n\n    private ModelSerializer createCollectionSerializer(LinkedList<Type> chain,\n                                                       Type type,\n                                                       Customization customization) {\n        Type colType = type instanceof ParameterizedType\n                ? ((ParameterizedType) type).getActualTypeArguments()[0]\n                : Object.class;\n        Type resolvedKey = ReflectionUtils.resolveType(chain, colType);\n        Class<?> rawClass = ReflectionUtils.getRawType(resolvedKey);\n        ClassModel classModel = jsonbContext.getMappingContext().getOrCreateClassModel(rawClass);\n        ModelSerializer typeSerializer = memberSerializer(chain, colType, classModel.getClassCustomization(), false);\n        CollectionSerializer collectionSerializer = new CollectionSerializer(typeSerializer);\n        KeyWriter keyWriter = new KeyWriter(collectionSerializer);\n        NullVisibilitySwitcher nullVisibilitySwitcher = new NullVisibilitySwitcher(true, keyWriter);\n        return new NullSerializer(nullVisibilitySwitcher, customization, jsonbContext);\n    }\n\n    private ModelSerializer createMapSerializer(LinkedList<Type> chain, Type type, Customization propertyCustomization) {\n        Type keyType = type instanceof ParameterizedType\n                ? ((ParameterizedType) type).getActualTypeArguments()[0]\n                : Object.class;\n        Type valueType = type instanceof ParameterizedType\n                ? ((ParameterizedType) type).getActualTypeArguments()[1]\n                : Object.class;\n        Type resolvedKey = ReflectionUtils.resolveType(chain, keyType);\n        Class<?> rawClass = ReflectionUtils.getRawType(resolvedKey);\n        ModelSerializer keySerializer = memberSerializer(chain, keyType, ClassCustomization.empty(), true);\n        Type resolvedValue = ReflectionUtils.resolveType(chain, valueType);\n        ClassModel valueClassModel = jsonbContext.getMappingContext().getOrCreateClassModel(ReflectionUtils.getRawType(resolvedValue));\n        ModelSerializer valueSerializer = memberSerializer(chain, valueType, valueClassModel.getClassCustomization(), false);\n        MapSerializer mapSerializer = MapSerializer.create(rawClass, keySerializer, valueSerializer, jsonbContext);\n        KeyWriter keyWriter = new KeyWriter(mapSerializer);\n        NullVisibilitySwitcher nullVisibilitySwitcher = new NullVisibilitySwitcher(true, keyWriter);\n        return new NullSerializer(nullVisibilitySwitcher, propertyCustomization, jsonbContext);\n    }\n\n    private ModelSerializer createArraySerializer(LinkedList<Type> chain,\n                                                  Class<?> raw,\n                                                  Customization propertyCustomization) {\n        Class<?> arrayComponent = raw.getComponentType();\n        ClassModel classModel = jsonbContext.getMappingContext().getOrCreateClassModel(arrayComponent);\n        ModelSerializer modelSerializer = memberSerializer(chain, arrayComponent, classModel.getClassCustomization(), false);\n        ModelSerializer arraySerializer = ArraySerializer.create(raw, jsonbContext, modelSerializer);\n        KeyWriter keyWriter = new KeyWriter(arraySerializer);\n        NullVisibilitySwitcher nullVisibilitySwitcher = new NullVisibilitySwitcher(true, keyWriter);\n        return new NullSerializer(nullVisibilitySwitcher, propertyCustomization, jsonbContext);\n    }\n\n    private ModelSerializer createGenericArraySerializer(LinkedList<Type> chain,\n                                                         Type type,\n                                                         Customization propertyCustomization) {\n        Class<?> raw = ReflectionUtils.getRawType(type);\n        Class<?> component = ReflectionUtils.getRawType(((GenericArrayType) type).getGenericComponentType());\n        ClassModel classModel = jsonbContext.getMappingContext().getOrCreateClassModel(component);\n        ModelSerializer modelSerializer = memberSerializer(chain, component, classModel.getClassCustomization(), false);\n        ModelSerializer arraySerializer = ArraySerializer.create(raw, jsonbContext, modelSerializer);\n        KeyWriter keyWriter = new KeyWriter(arraySerializer);\n        NullVisibilitySwitcher nullVisibilitySwitcher = new NullVisibilitySwitcher(true, keyWriter);\n        return new NullSerializer(nullVisibilitySwitcher, propertyCustomization, jsonbContext);\n    }\n\n    private ModelSerializer createOptionalSerializer(LinkedList<Type> chain,\n                                                     Type type,\n                                                     Customization propertyCustomization,\n                                                     boolean isKey) {\n        Type optType = type instanceof ParameterizedType\n                ? ((ParameterizedType) type).getActualTypeArguments()[0]\n                : Object.class;\n        Type resolvedOptType = ReflectionUtils.resolveType(chain, optType);\n        ClassModel classModel = jsonbContext.getMappingContext().getOrCreateClassModel(ReflectionUtils.getRawType(resolvedOptType));\n        ModelSerializer modelSerializer = memberSerializer(chain, optType, classModel.getClassCustomization(), isKey);\n        return new OptionalSerializer(modelSerializer);\n    }\n\n    private ModelSerializer memberSerializer(LinkedList<Type> chain,\n                                             Type type,\n                                             Customization customization,\n                                             boolean key) {\n        Type resolved = ReflectionUtils.resolveType(chain, type);\n        Class<?> rawType = ReflectionUtils.getRawType(resolved);\n\n        Optional<ModelSerializer> serializerBinding = userSerializer(resolved,\n                                                                     (ComponentBoundCustomization) customization);\n        if (serializerBinding.isPresent()) {\n            return serializerBinding.get();\n        }\n        Optional<AdapterBinding> maybeAdapter = adapterBinding(resolved, (ComponentBoundCustomization) customization);\n        if (maybeAdapter.isPresent()) {\n            AdapterBinding adapterBinding = maybeAdapter.get();\n            Type toType = adapterBinding.getToType();\n            Class<?> rawToType = ReflectionUtils.getRawType(toType);\n            ModelSerializer typeSerializer = TypeSerializers.getTypeSerializer(rawToType, customization, jsonbContext);\n            if (typeSerializer == null) {\n                typeSerializer = serializerChain(toType, false, true);\n            }\n            AdapterSerializer adapterSerializer = new AdapterSerializer(adapterBinding, typeSerializer);\n            return new NullSerializer(adapterSerializer, customization, jsonbContext);\n        }\n        ModelSerializer typeSerializer = TypeSerializers.getTypeSerializer(chain, rawType, customization, jsonbContext, key);\n        if (typeSerializer == null) {\n            //Final classes dont have any child classes. It is safe to assume that there will be instance of that specific class.\n            boolean isFinal = Modifier.isFinal(rawType.getModifiers());\n            if (isFinal\n                    || Collection.class.isAssignableFrom(rawType)\n                    || Map.class.isAssignableFrom(rawType)) {\n                return serializerChain(chain, resolved, customization, false, key, true);\n            } else {\n                if (dynamicChain.containsKey(resolved)) {\n                    return dynamicChain.get(resolved);\n                }\n                boolean isAbstract = Modifier.isAbstract(rawType.getModifiers());\n                ModelSerializer specificTypeSerializer = null;\n                if (!isAbstract && !rawType.equals(Object.class)) {\n                    if (explicitChain.containsKey(resolved)) {\n                        specificTypeSerializer = explicitChain.get(resolved);\n                    } else {\n                        specificTypeSerializer = serializerChain(chain, resolved, customization, false, key, true);\n                    }\n                }\n                //Needs to be dynamically resolved with special cache since possible inheritance problem.\n                if (resolved instanceof Class) {\n                    typeSerializer = TypeSerializers.getTypeSerializer(chain, Object.class, customization, jsonbContext, key);\n                } else {\n                    chain.add(resolved);\n                    typeSerializer = TypeSerializers.getTypeSerializer(chain, Object.class, customization, jsonbContext, key);\n                    chain.removeLast();\n                }\n                if (specificTypeSerializer != null && typeSerializer instanceof ObjectTypeSerializer) {\n                    ((ObjectTypeSerializer) typeSerializer).addSpecificSerializer(rawType, specificTypeSerializer);\n                }\n                //Since typeSerializer is handled as Object currently, we need to wrap it with null checker (if it is not a key)\n                if (!key) {\n                    typeSerializer = new NullSerializer(typeSerializer, customization, jsonbContext);\n                }\n\n                dynamicChain.put(type, typeSerializer);\n            }\n        }\n        if (!key && typeSerializer instanceof ObjectTypeSerializer) {\n            typeSerializer = new NullSerializer(typeSerializer, customization, jsonbContext);\n        }\n        return typeSerializer;\n    }\n\n    private Optional<ModelSerializer> userSerializer(Type type, ComponentBoundCustomization classCustomization) {\n        final ComponentMatcher componentMatcher = jsonbContext.getComponentMatcher();\n        return componentMatcher.getSerializerBinding(type, classCustomization)\n                .map(SerializerBinding::getJsonbSerializer)\n                .map(UserDefinedSerializer::new)\n                .map(RecursionChecker::new)\n                .map(serializer -> SerializationModelCreator.wrapInCommonSet(serializer,\n                                                                             (Customization) classCustomization,\n                                                                             jsonbContext));\n    }\n\n    private Optional<AdapterBinding> adapterBinding(Type type, ComponentBoundCustomization classCustomization) {\n        return jsonbContext.getComponentMatcher().getSerializeAdapterBinding(type, classCustomization);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/SerializerBuilderParams.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport java.lang.reflect.Type;\nimport java.util.Objects;\n\nimport org.eclipse.yasson.internal.model.customization.ClassCustomization;\nimport org.eclipse.yasson.internal.model.customization.Customization;\n\n/**\n * Not currently supported. Possibly implemented in the future.\n *\n * Holder of serialization parameters during creation process. Reduces the number of needed parameters.\n */\nclass SerializerBuilderParams {\n\n    private final Type type;\n    private final Customization customization;\n    private final boolean root;\n    private final boolean key;\n    private final boolean resolveRootAdapter;\n    private final ModelSerializer objectBaseSerializer;\n\n    private SerializerBuilderParams(Builder builder) {\n        this.type = builder.type;\n        this.customization = builder.customization;\n        this.root = builder.root;\n        this.key = builder.key;\n        this.resolveRootAdapter = builder.resolveRootAdapter;\n        this.objectBaseSerializer = builder.objectBaseSerializer;\n    }\n\n    public static Builder builder(Type type) {\n        return new Builder(type);\n    }\n\n    public Type getType() {\n        return type;\n    }\n\n    public Customization getCustomization() {\n        return customization;\n    }\n\n    public boolean isRoot() {\n        return root;\n    }\n\n    public boolean isKey() {\n        return key;\n    }\n\n    public boolean isResolveRootAdapter() {\n        return resolveRootAdapter;\n    }\n\n    public ModelSerializer getObjectBaseSerializer() {\n        return objectBaseSerializer;\n    }\n\n    static final class Builder {\n\n        private Type type;\n        private Customization customization;\n        private boolean root;\n        private boolean key;\n        private boolean resolveRootAdapter;\n        private ModelSerializer objectBaseSerializer;\n\n        private Builder(Type type) {\n            this.type = Objects.requireNonNull(type);\n            this.customization = ClassCustomization.empty();\n            this.root = true;\n            this.key = false;\n        }\n\n        public Builder type(Type type) {\n            this.type = Objects.requireNonNull(type);\n            return this;\n        }\n\n        public Builder customization(Customization customization) {\n            this.customization = Objects.requireNonNull(customization);\n            return this;\n        }\n\n        public Builder root(boolean root) {\n            this.root = root;\n            return this;\n        }\n\n        public Builder key(boolean key) {\n            this.key = key;\n            return this;\n        }\n\n        public Builder resolveRootAdapter(boolean resolveRootAdapter) {\n            this.resolveRootAdapter = resolveRootAdapter;\n            return this;\n        }\n\n        public Builder objectBaseSerializer(ModelSerializer objectBaseSerializer) {\n            this.objectBaseSerializer = objectBaseSerializer;\n            return this;\n        }\n\n        public SerializerBuilderParams build() {\n            return new SerializerBuilderParams(this);\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/UserDefinedSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * User defined serializer executor.\n */\nclass UserDefinedSerializer<T> implements ModelSerializer {\n\n    private final JsonbSerializer<T> userDefinedSerializer;\n\n    UserDefinedSerializer(JsonbSerializer<T> userDefinedSerializer) {\n        this.userDefinedSerializer = userDefinedSerializer;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        YassonGenerator yassonGenerator = new YassonGenerator(generator);\n        userDefinedSerializer.serialize((T) value, yassonGenerator, context);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/ValueGetterSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport java.lang.invoke.MethodHandle;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Extractor of the serialized value from the instance.\n */\nclass ValueGetterSerializer implements ModelSerializer {\n\n    private final MethodHandle valueGetter;\n    private final ModelSerializer delegate;\n\n    ValueGetterSerializer(MethodHandle valueGetter, ModelSerializer delegate) {\n        this.valueGetter = valueGetter;\n        this.delegate = delegate;\n    }\n\n    @Override\n    public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        Object object;\n        try {\n            object = valueGetter.invoke(value);\n        } catch (Throwable e) {\n            throw new JsonbException(\"Error getting value on: \" + value.getClass().getName(), e);\n        }\n        delegate.serialize(object, generator, context);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/YassonGenerator.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\n\nimport jakarta.json.JsonValue;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonGenerator;\n\n/**\n * Yasson {@link JsonGenerator} generator wrapper.\n * <br>\n * Used for user defined serializers. Does not allow serializer to write outside the scope it should be used on.\n */\nclass YassonGenerator implements JsonGenerator {\n\n    private final JsonGenerator delegate;\n    private int level;\n\n    YassonGenerator(JsonGenerator delegate) {\n        this.delegate = delegate;\n    }\n\n    @Override\n    public JsonGenerator writeStartObject() {\n        writeValidate(\"writeStartObject()\");\n        level++;\n        delegate.writeStartObject();\n        return this;\n    }\n\n    @Override\n    public JsonGenerator writeStartObject(String name) {\n        writeValidate(\"writeStartObject(String name)\");\n        level++;\n        delegate.writeStartObject(name);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator writeKey(String name) {\n        writeValidate(\"writeKey(String name)\");\n        delegate.writeKey(name);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator writeStartArray() {\n        writeValidate(\"writeStartArray()\");\n        level++;\n        delegate.writeStartArray();\n        return this;\n    }\n\n    @Override\n    public JsonGenerator writeStartArray(String name) {\n        writeValidate(\"writeStartArray(String name)\");\n        level++;\n        delegate.writeStartArray(name);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String name, JsonValue value) {\n        writeValidate(\"write(String name, JsonValue value)\");\n        delegate.write(name, value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String name, String value) {\n        writeValidate(\"write(String name, String value)\");\n        delegate.write(name, value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String name, BigInteger value) {\n        writeValidate(\"write(String name, BigInteger value)\");\n        delegate.write(name, value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String name, BigDecimal value) {\n        writeValidate(\"write(String name, BigDecimal value)\");\n        delegate.write(name, value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String name, int value) {\n        writeValidate(\"write(String name, int value)\");\n        delegate.write(name, value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String name, long value) {\n        writeValidate(\"write(String name, long value)\");\n        delegate.write(name, value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String name, double value) {\n        writeValidate(\"write(String name, double value)\");\n        delegate.write(name, value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String name, boolean value) {\n        writeValidate(\"write(String name, boolean value)\");\n        delegate.write(name, value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator writeNull(String name) {\n        writeValidate(\"writeNull(String name)\");\n        delegate.writeNull(name);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator writeEnd() {\n        level--;\n        if (level < 0) {\n            throw new JsonbException(\"writeEnd() cannot be called outside of the scope of user generator.\");\n        }\n        if (level == 0) {\n            level--; //if user has closed array or object and is on the same level he started. There is no more allowed writing.\n        }\n        delegate.writeEnd();\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(JsonValue value) {\n        writeValidate(\"write(JsonValue value)\");\n        delegate.write(value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(String value) {\n        writeValidate(\"write(String value)\");\n        delegate.write(value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(BigDecimal value) {\n        writeValidate(\"write(BigDecimal value)\");\n        delegate.write(value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(BigInteger value) {\n        writeValidate(\"write(BigInteger value)\");\n        delegate.write(value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(int value) {\n        writeValidate(\"write(int value)\");\n        delegate.write(value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(long value) {\n        writeValidate(\"write(long value)\");\n        delegate.write(value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(double value) {\n        writeValidate(\"write(double value)\");\n        delegate.write(value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator write(boolean value) {\n        writeValidate(\"write(boolean value)\");\n        delegate.write(value);\n        return this;\n    }\n\n    @Override\n    public JsonGenerator writeNull() {\n        writeValidate(\"writeNull()\");\n        delegate.writeNull();\n        return this;\n    }\n\n    @Override\n    public void close() {\n        throw new JsonbException(\"Unsupported operation in user defined serializer.\");\n    }\n\n    @Override\n    public void flush() {\n        throw new JsonbException(\"Unsupported operation in user defined serializer.\");\n    }\n\n    private void writeValidate(String method) {\n        if (level < 0) {\n            throw new JsonbException(method + \" cannot be called outside of the scope of user generator.\");\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/AbstractDateSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.Instant;\nimport java.time.ZoneId;\nimport java.time.format.DateTimeFormatter;\nimport java.time.temporal.TemporalAccessor;\nimport java.util.Locale;\nimport java.util.Optional;\nimport java.util.function.BiConsumer;\nimport java.util.function.Function;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.JsonbConfigProperties;\nimport org.eclipse.yasson.internal.JsonbDateFormatter;\nimport org.eclipse.yasson.internal.SerializationContextImpl;\nimport org.eclipse.yasson.internal.model.customization.Customization;\n\n/**\n * Base for all date related serializers.\n */\nabstract class AbstractDateSerializer<T> extends TypeSerializer<T> {\n\n    static final ZoneId UTC = ZoneId.of(\"UTC\");\n\n    private final Function<T, String> toStringSerializer;\n    private final BiConsumer<T, JsonGenerator> valueWriter;\n\n    AbstractDateSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n        Customization customization = serializerBuilder.getCustomization();\n        JsonbConfigProperties properties = serializerBuilder.getJsonbContext().getConfigProperties();\n        final JsonbDateFormatter formatter = getJsonbDateFormatter(properties, customization);\n        toStringSerializer = valueSerializer(serializerBuilder);\n        if (JsonbDateFormat.TIME_IN_MILLIS.equals(formatter.getFormat()) && !properties.isDateInMillisecondsAsString()) {\n            valueWriter = (value, generator) -> generator.write(toInstant(value).toEpochMilli());\n        } else {\n            valueWriter = (value, generator) -> generator.write(toStringSerializer.apply(value));\n        }\n    }\n\n    private Function<T, String> valueSerializer(TypeSerializerBuilder serializerBuilder) {\n        Customization customization = serializerBuilder.getCustomization();\n        JsonbConfigProperties properties = serializerBuilder.getJsonbContext().getConfigProperties();\n        final JsonbDateFormatter formatter = getJsonbDateFormatter(properties, customization);\n        if (JsonbDateFormat.TIME_IN_MILLIS.equals(formatter.getFormat())) {\n            return value -> String.valueOf(toInstant(value).toEpochMilli());\n        } else if (formatter.getDateTimeFormatter() != null) {\n            DateTimeFormatter dateTimeFormatter = formatter.getDateTimeFormatter();\n            return value -> formatWithFormatter(value, dateTimeFormatter);\n        } else {\n            DateTimeFormatter configDateTimeFormatter = properties.getConfigDateFormatter().getDateTimeFormatter();\n            if (configDateTimeFormatter != null) {\n                return value -> formatWithFormatter(value, configDateTimeFormatter);\n            }\n        }\n        if (properties.isStrictIJson()) {\n            return this::formatStrictIJson;\n        }\n        Locale locale = properties.getLocale(formatter.getLocale());\n        return value -> formatDefault(value, locale);\n    }\n\n    private JsonbDateFormatter getJsonbDateFormatter(JsonbConfigProperties properties, Customization customization) {\n        return Optional.ofNullable(customization.getSerializeDateFormatter())\n                .orElse(properties.getConfigDateFormatter());\n    }\n\n    /**\n     * Convert date object to {@link TemporalAccessor}\n     *\n     * Only for legacy dates.\n     *\n     * @param value date object\n     * @return converted {@link TemporalAccessor}\n     */\n    protected TemporalAccessor toTemporalAccessor(T value) {\n        return (TemporalAccessor) value;\n    }\n\n    /**\n     * Convert java.time object to epoch milliseconds instant. Discards zone offset and zone id information.\n     *\n     * @param value date object to convert\n     * @return instant\n     */\n    protected abstract Instant toInstant(T value);\n\n    /**\n     * Format with default formatter for a given java.time date object.\n     * Different default formatter for each date object type is used.\n     *\n     * @param value  date object\n     * @param locale locale from annotation / default not null\n     * @return formatted date obj as string\n     */\n    protected abstract String formatDefault(T value, Locale locale);\n\n    /**\n     * Format date object with given formatter.\n     *\n     * @param value     date object to format\n     * @param formatter formatter to format with\n     * @return formatted result\n     */\n    protected String formatWithFormatter(T value, DateTimeFormatter formatter) {\n        return formatter.format(toTemporalAccessor(value));\n    }\n\n    /**\n     * Format date object as strict IJson date format.\n     *\n     * @param value value to format\n     * @return formatted result\n     */\n    protected String formatStrictIJson(T value) {\n        return JsonbDateFormatter.IJSON_DATE_FORMATTER.format(toTemporalAccessor(value));\n    }\n\n    /**\n     * Append UTC zone in case zone is not set on formatter.\n     *\n     * @param formatter formatter\n     * @return zoned formatter\n     */\n    protected DateTimeFormatter getZonedFormatter(DateTimeFormatter formatter) {\n        return formatter.getZone() != null\n                ? formatter\n                : formatter.withZone(UTC);\n    }\n\n    @Override\n    void serializeValue(T value, JsonGenerator generator, SerializationContextImpl context) {\n        valueWriter.accept(value, generator);\n    }\n\n    @Override\n    void serializeKey(T key, JsonGenerator generator, SerializationContextImpl context) {\n        generator.writeKey(toStringSerializer.apply(key));\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/AbstractNumberSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.text.DecimalFormat;\nimport java.text.NumberFormat;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.JsonbContext;\nimport org.eclipse.yasson.internal.JsonbNumberFormatter;\nimport org.eclipse.yasson.internal.SerializationContextImpl;\nimport org.eclipse.yasson.internal.model.customization.Customization;\nimport org.eclipse.yasson.internal.serializer.ModelSerializer;\n\n/**\n * Base for all number related serializers.\n */\nabstract class AbstractNumberSerializer<T> extends TypeSerializer<T> {\n\n    private final ModelSerializer actualSerializer;\n\n    AbstractNumberSerializer(TypeSerializerBuilder builder) {\n        super(builder);\n        actualSerializer = actualSerializer(builder.getCustomization(), builder.getJsonbContext());\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private ModelSerializer actualSerializer(Customization customization, JsonbContext jsonbContext) {\n        JsonbNumberFormatter formatter = customization.getSerializeNumberFormatter();\n        if (formatter == null) {\n            return (value, generator, context) -> writeValue((T) value, generator);\n        }\n        final NumberFormat format = NumberFormat\n                .getInstance(jsonbContext.getConfigProperties().getLocale(formatter.getLocale()));\n        ((DecimalFormat) format).applyPattern(formatter.getFormat());\n        return (value, generator, context) -> generator.write(format.format(value));\n    }\n\n    @Override\n    void serializeValue(T value, JsonGenerator generator, SerializationContextImpl context) {\n        actualSerializer.serialize(value, generator, context);\n    }\n\n    abstract void writeValue(T value, JsonGenerator generator);\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/BigDecimalSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.math.BigDecimal;\n\nimport jakarta.json.stream.JsonGenerator;\n\n/**\n * Serializer of the {@link BigDecimal} type.\n */\nclass BigDecimalSerializer extends AbstractNumberSerializer<BigDecimal> {\n\n    BigDecimalSerializer(TypeSerializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    void writeValue(BigDecimal value, JsonGenerator generator) {\n        generator.write(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/BigIntegerSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.math.BigInteger;\n\nimport jakarta.json.stream.JsonGenerator;\n\n/**\n * Serializer of the {@link BigInteger} type.\n */\nclass BigIntegerSerializer extends AbstractNumberSerializer<BigInteger> {\n\n    BigIntegerSerializer(TypeSerializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    void writeValue(BigInteger value, JsonGenerator generator) {\n        generator.write(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/BooleanSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Serializer of the {@link Boolean} type.\n */\nclass BooleanSerializer extends TypeSerializer<Boolean> {\n\n    BooleanSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    void serializeValue(Boolean value, JsonGenerator generator, SerializationContextImpl context) {\n        generator.write(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/ByteSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport jakarta.json.stream.JsonGenerator;\n\n/**\n * Serializer of the {@link Byte} type.\n */\nclass ByteSerializer extends AbstractNumberSerializer<Byte> {\n\n    ByteSerializer(TypeSerializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    void writeValue(Byte value, JsonGenerator generator) {\n        generator.write(value);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/CalendarSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.Instant;\nimport java.time.ZonedDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.time.temporal.TemporalAccessor;\nimport java.util.Calendar;\nimport java.util.Locale;\n\n/**\n * Serializer of the {@link Calendar} type.\n */\nclass CalendarSerializer extends AbstractDateSerializer<Calendar> {\n\n    CalendarSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    protected Instant toInstant(Calendar value) {\n        return value.toInstant();\n    }\n\n    @Override\n    protected String formatDefault(Calendar value, Locale locale) {\n        DateTimeFormatter formatter = value.isSet(Calendar.HOUR) || value.isSet(Calendar.HOUR_OF_DAY)\n                ? DateTimeFormatter.ISO_DATE_TIME\n                : DateTimeFormatter.ISO_DATE;\n        return formatter.withZone(value.getTimeZone().toZoneId())\n                .withLocale(locale).format(toTemporalAccessor(value));\n    }\n\n    @Override\n    protected TemporalAccessor toTemporalAccessor(Calendar object) {\n        return ZonedDateTime.ofInstant(Instant.ofEpochMilli(object.getTimeInMillis()),\n                                       object.getTimeZone().toZoneId());\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/CharSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Serializer of the {@link Character} type.\n */\nclass CharSerializer extends TypeSerializer<Character> {\n\n    CharSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    void serializeValue(Character value, JsonGenerator generator, SerializationContextImpl context) {\n        generator.write(String.valueOf(value));\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/DateSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.Instant;\nimport java.time.format.DateTimeFormatter;\nimport java.time.temporal.TemporalAccessor;\nimport java.util.Date;\nimport java.util.Locale;\n\nimport org.eclipse.yasson.internal.JsonbDateFormatter;\n\n/**\n * Serializer of the {@link Date} type.\n */\nclass DateSerializer<T extends Date> extends AbstractDateSerializer<T> {\n\n    private static final DateTimeFormatter DEFAULT_DATE_FORMATTER = DateTimeFormatter.ISO_DATE_TIME.withZone(UTC);\n\n    DateSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    protected Instant toInstant(Date value) {\n        return value.toInstant();\n    }\n\n    @Override\n    protected String formatDefault(Date value, Locale locale) {\n        return DEFAULT_DATE_FORMATTER.withLocale(locale).format(toInstant(value));\n    }\n\n    @Override\n    protected String formatWithFormatter(Date value, DateTimeFormatter formatter) {\n        return getZonedFormatter(formatter).format(toTemporalAccessor(value));\n    }\n\n    @Override\n    protected String formatStrictIJson(Date value) {\n        return JsonbDateFormatter.IJSON_DATE_FORMATTER.withZone(UTC).format(toTemporalAccessor(value));\n    }\n\n    @Override\n    protected TemporalAccessor toTemporalAccessor(Date object) {\n        return toInstant(object);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/DoubleSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport jakarta.json.stream.JsonGenerator;\n\n/**\n * Serializer of the {@link Double} type.\n */\nclass DoubleSerializer extends AbstractNumberSerializer<Double> {\n\n    DoubleSerializer(TypeSerializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    void writeValue(Double value, JsonGenerator generator) {\n        generator.write(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/DurationSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.Duration;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Serializer of the {@link Duration} type.\n */\nclass DurationSerializer extends TypeSerializer<Duration> {\n\n    DurationSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    void serializeValue(Duration value, JsonGenerator generator, SerializationContextImpl context) {\n        generator.write(value.toString());\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/EnumSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Serializer of the {@link Enum} types.\n */\nclass EnumSerializer extends TypeSerializer<Enum<?>> {\n\n    EnumSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    void serializeValue(Enum<?> value, JsonGenerator generator, SerializationContextImpl context) {\n        generator.write(value.name());\n    }\n\n    @Override\n    void serializeKey(Enum<?> key, JsonGenerator generator, SerializationContextImpl context) {\n        generator.writeKey(key.name());\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/FloatSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.math.BigDecimal;\n\nimport jakarta.json.stream.JsonGenerator;\n\n/**\n * Serializer of the {@link Float} type.\n */\nclass FloatSerializer extends AbstractNumberSerializer<Float> {\n\n    FloatSerializer(TypeSerializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    void writeValue(Float value, JsonGenerator generator) {\n        //floats lose precision, after upcasting to doubles in jsonp\n        generator.write(new BigDecimal(String.valueOf(value)));\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/InstantSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.Instant;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\nimport org.eclipse.yasson.internal.JsonbDateFormatter;\n\n/**\n * Serializer of the {@link Instant} type.\n */\nclass InstantSerializer extends AbstractDateSerializer<Instant> {\n\n    InstantSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    protected Instant toInstant(Instant value) {\n        return value;\n    }\n\n    @Override\n    protected String formatDefault(Instant value, Locale locale) {\n        return DateTimeFormatter.ISO_INSTANT.withLocale(locale).format(value);\n    }\n\n    @Override\n    protected String formatWithFormatter(Instant value, DateTimeFormatter formatter) {\n        return formatter.withZone(UTC).format(value);\n    }\n\n    @Override\n    protected String formatStrictIJson(Instant value) {\n        return JsonbDateFormatter.IJSON_DATE_FORMATTER.withZone(UTC).format(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/IntegerSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport jakarta.json.stream.JsonGenerator;\n\n/**\n * Serializer of the {@link Integer} type.\n */\nclass IntegerSerializer extends AbstractNumberSerializer<Integer> {\n\n    IntegerSerializer(TypeSerializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    void writeValue(Integer value, JsonGenerator generator) {\n        generator.write(value);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/JsonValueSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport jakarta.json.JsonValue;\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Serializer of the {@link JsonValue} type.\n */\nclass JsonValueSerializer extends TypeSerializer<JsonValue> {\n\n    JsonValueSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    void serializeValue(JsonValue value, JsonGenerator generator, SerializationContextImpl context) {\n        generator.write(value);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/LocalDateSerializer.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.Instant;\nimport java.time.LocalDate;\nimport java.time.ZonedDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\nimport org.eclipse.yasson.internal.JsonbDateFormatter;\n\n/**\n * Serializer of the {@link LocalDate} type.\n */\nclass LocalDateSerializer extends AbstractDateSerializer<LocalDate> {\n\n    private static final DateTimeFormatter DEFAULT_FORMAT = DateTimeFormatter.ISO_LOCAL_DATE.withZone(UTC);\n\n    LocalDateSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    protected Instant toInstant(LocalDate value) {\n        return Instant.from(value.atStartOfDay(UTC));\n    }\n\n    @Override\n    protected String formatDefault(LocalDate value, Locale locale) {\n        return DEFAULT_FORMAT.withLocale(locale).format(value);\n    }\n\n    @Override\n    protected String formatStrictIJson(LocalDate value) {\n        final ZonedDateTime zonedDateTime = value.atTime(0, 0, 0).atZone(UTC);\n        return JsonbDateFormatter.IJSON_DATE_FORMATTER.withZone(UTC).format(zonedDateTime);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/LocalDateTimeSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.Instant;\nimport java.time.LocalDateTime;\nimport java.time.ZonedDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\nimport org.eclipse.yasson.internal.JsonbDateFormatter;\n\n/**\n * Serializer of the {@link LocalDateTime} type.\n */\nclass LocalDateTimeSerializer extends AbstractDateSerializer<LocalDateTime> {\n\n    LocalDateTimeSerializer(TypeSerializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    protected Instant toInstant(LocalDateTime value) {\n        return value.atZone(UTC).toInstant();\n    }\n\n    @Override\n    protected String formatDefault(LocalDateTime value, Locale locale) {\n        return DateTimeFormatter.ISO_LOCAL_DATE_TIME.withLocale(locale).format(value);\n    }\n\n    @Override\n    protected String formatWithFormatter(LocalDateTime value, DateTimeFormatter formatter) {\n        return getZonedFormatter(formatter).format(value);\n    }\n\n    @Override\n    protected String formatStrictIJson(LocalDateTime value) {\n        final ZonedDateTime zonedDateTime = value.atZone(UTC);\n        return JsonbDateFormatter.IJSON_DATE_FORMATTER.format(zonedDateTime);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/LocalTimeSerializer.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.Instant;\nimport java.time.LocalTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Serializer of the {@link LocalTime} type.\n */\nclass LocalTimeSerializer extends AbstractDateSerializer<LocalTime> {\n\n    LocalTimeSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    protected Instant toInstant(LocalTime value) {\n        throw new JsonbException(Messages.getMessage(MessageKeys.TIME_TO_EPOCH_MILLIS_ERROR, LocalTime.class.getSimpleName()));\n    }\n\n    @Override\n    protected String formatDefault(LocalTime value, Locale locale) {\n        return DateTimeFormatter.ISO_LOCAL_TIME.withLocale(locale).format(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/LongSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport jakarta.json.stream.JsonGenerator;\n\n/**\n * Serializer of the {@link Long} type.\n */\nclass LongSerializer extends AbstractNumberSerializer<Long> {\n\n    LongSerializer(TypeSerializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    void writeValue(Long value, JsonGenerator generator) {\n        generator.write(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/MonthDayTypeSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.Instant;\nimport java.time.MonthDay;\nimport java.time.Year;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\n/**\n * Serializer of the {@link MonthDay} type.\n */\nclass MonthDayTypeSerializer extends AbstractDateSerializer<MonthDay> {\n\n    private static final int YEAR_NUMBER = Year.now().getValue();\n\n    private static final DateTimeFormatter DEFAULT_FORMAT = DateTimeFormatter.ofPattern(\"--MM-dd\").withZone(UTC);\n\n    MonthDayTypeSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    protected Instant toInstant(MonthDay value) {\n        return value.atYear(YEAR_NUMBER).atStartOfDay(UTC).toInstant();\n    }\n\n    @Override\n    protected String formatDefault(MonthDay value, Locale locale) {\n        return DEFAULT_FORMAT.withLocale(locale).format(value);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/NumberSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.math.BigDecimal;\n\nimport jakarta.json.stream.JsonGenerator;\n\n/**\n * Serializer of the {@link Number} type.\n */\nclass NumberSerializer extends AbstractNumberSerializer<Number> {\n\n    NumberSerializer(TypeSerializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    void writeValue(Number value, JsonGenerator generator) {\n        generator.write(new BigDecimal(String.valueOf(value)));\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/ObjectTypeSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.lang.reflect.Type;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\nimport org.eclipse.yasson.internal.model.customization.Customization;\nimport org.eclipse.yasson.internal.serializer.ModelSerializer;\nimport org.eclipse.yasson.internal.serializer.SerializationModelCreator;\n\n/**\n * Object type serializer. Dynamically resolves the serialized type based on the serialized instance class.\n */\npublic class ObjectTypeSerializer extends TypeSerializer<Object> {\n\n    private final Customization customization;\n\n    private final Map<Class<?>, ModelSerializer> cache;\n    private final List<Type> chain;\n    private final boolean isKey;\n\n    ObjectTypeSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n        this.customization = serializerBuilder.getCustomization();\n        this.cache = new ConcurrentHashMap<>();\n        this.chain = new LinkedList<>(serializerBuilder.getChain());\n        this.isKey = serializerBuilder.isKey();\n    }\n\n    @Override\n    void serializeValue(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        //Dynamically resolved type during runtime. Cached in SerializationModelCreator.\n        findSerializer(value, generator, context);\n    }\n\n    @Override\n    void serializeKey(Object key, JsonGenerator generator, SerializationContextImpl context) {\n        if (key == null) {\n            super.serializeKey(null, generator, context);\n            return;\n        }\n        //Dynamically resolved type during runtime. Cached in SerializationModelCreator.\n        findSerializer(key, generator, context);\n    }\n\n    private void findSerializer(Object key, JsonGenerator generator, SerializationContextImpl context) {\n        Class<?> clazz = key.getClass();\n        cache.computeIfAbsent(clazz, aClass -> {\n            SerializationModelCreator serializationModelCreator = context.getJsonbContext().getSerializationModelCreator();\n            return serializationModelCreator.serializerChainRuntime(new LinkedList<>(chain), clazz, customization, false, isKey);\n        }).serialize(key, generator, context);\n    }\n\n    /**\n     * Add serializer to the cache.\n     *\n     * @param clazz           class of the serializer\n     * @param modelSerializer model serializer bound to the class\n     */\n    public void addSpecificSerializer(Class<?> clazz, ModelSerializer modelSerializer) {\n        cache.put(clazz, modelSerializer);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/OffsetDateTimeSerializer.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.Instant;\nimport java.time.OffsetDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\n/**\n * Serializer of the {@link OffsetDateTime} type.\n */\nclass OffsetDateTimeSerializer extends AbstractDateSerializer<OffsetDateTime> {\n\n    OffsetDateTimeSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    protected Instant toInstant(OffsetDateTime value) {\n        return value.toInstant();\n    }\n\n    @Override\n    protected String formatDefault(OffsetDateTime value, Locale locale) {\n        return DateTimeFormatter.ISO_OFFSET_DATE_TIME.withLocale(locale).format(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/OffsetTimeSerializer.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.Instant;\nimport java.time.OffsetTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Serializer of the {@link OffsetTime} type.\n */\nclass OffsetTimeSerializer extends AbstractDateSerializer<OffsetTime> {\n\n    OffsetTimeSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    protected Instant toInstant(OffsetTime value) {\n        throw new JsonbException(Messages.getMessage(MessageKeys.TIME_TO_EPOCH_MILLIS_ERROR, OffsetTime.class.getSimpleName()));\n    }\n\n    @Override\n    protected String formatDefault(OffsetTime value, Locale locale) {\n        return DateTimeFormatter.ISO_OFFSET_TIME.withLocale(locale).format(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/OptionalDoubleSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.util.OptionalDouble;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\nimport org.eclipse.yasson.internal.serializer.ModelSerializer;\n\n/**\n * Serializer of the {@link OptionalDouble} type.\n */\nclass OptionalDoubleSerializer implements ModelSerializer {\n\n    private final ModelSerializer typeSerializer;\n\n    OptionalDoubleSerializer(ModelSerializer typeSerializer) {\n        this.typeSerializer = typeSerializer;\n    }\n\n    @Override\n    public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        OptionalDouble optionalDouble = (OptionalDouble) value;\n        if (optionalDouble != null && optionalDouble.isPresent()) {\n            typeSerializer.serialize(optionalDouble.getAsDouble(), generator, context);\n        } else {\n            typeSerializer.serialize(null, generator, context);\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/OptionalIntSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.util.OptionalInt;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\nimport org.eclipse.yasson.internal.serializer.ModelSerializer;\n\n/**\n * Serializer of the {@link OptionalInt} type.\n */\nclass OptionalIntSerializer implements ModelSerializer {\n\n    private final ModelSerializer typeSerializer;\n\n    OptionalIntSerializer(ModelSerializer typeSerializer) {\n        this.typeSerializer = typeSerializer;\n    }\n\n    @Override\n    public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        OptionalInt optionalInt = (OptionalInt) value;\n        if (optionalInt != null && optionalInt.isPresent()) {\n            typeSerializer.serialize(optionalInt.getAsInt(), generator, context);\n        } else {\n            typeSerializer.serialize(null, generator, context);\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/OptionalLongSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.util.OptionalLong;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\nimport org.eclipse.yasson.internal.serializer.ModelSerializer;\n\n/**\n * Serializer of the {@link OptionalLong} type.\n */\nclass OptionalLongSerializer implements ModelSerializer {\n\n    private final ModelSerializer typeSerializer;\n\n    OptionalLongSerializer(ModelSerializer typeSerializer) {\n        this.typeSerializer = typeSerializer;\n    }\n\n    @Override\n    public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        OptionalLong optionalLong = (OptionalLong) value;\n        if (optionalLong != null && optionalLong.isPresent()) {\n            typeSerializer.serialize(optionalLong.getAsLong(), generator, context);\n        } else {\n            typeSerializer.serialize(null, generator, context);\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/PathSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.nio.file.Path;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Serializer of the {@link Path} type.\n */\nclass PathSerializer extends TypeSerializer<Path> {\n\n    PathSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    void serializeValue(Path value, JsonGenerator generator, SerializationContextImpl context) {\n        generator.write(value.toString());\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/PeriodSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.Period;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Serializer of the {@link Period} type.\n */\nclass PeriodSerializer extends TypeSerializer<Period> {\n\n    PeriodSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    void serializeValue(Period value, JsonGenerator generator, SerializationContextImpl context) {\n        generator.write(value.toString());\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/ShortSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport jakarta.json.stream.JsonGenerator;\n\n/**\n * Serializer of the {@link Short} type.\n */\nclass ShortSerializer extends AbstractNumberSerializer<Short> {\n\n    ShortSerializer(TypeSerializerBuilder builder) {\n        super(builder);\n    }\n\n    @Override\n    void writeValue(Short value, JsonGenerator generator) {\n        generator.write(value);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/SqlDateSerializer.java",
    "content": "/*\n * Copyright (c) 2018, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.Instant;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Date;\nimport java.util.Locale;\n\n/**\n * Common serializer for {@link Date} and {@link java.sql.Date} types.\n */\nclass SqlDateSerializer extends DateSerializer<Date> {\n\n    SqlDateSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    protected Instant toInstant(Date value) {\n        if (value instanceof java.sql.Date) {\n            // java.sql.Date doesn't have a time component, so do our best if TIME_IN_MILLIS is requested\n            // In the future (at a breaking change boundary) we should probably reject this code path\n            return Instant.ofEpochMilli(value.getTime());\n        } else {\n            return super.toInstant(value);\n        }\n    }\n\n    @Override\n    protected String formatDefault(Date value, Locale locale) {\n        if (value instanceof java.sql.Date) {\n            return value.toString() + 'Z'; // Z is the UTC timezone indicator\n        } else {\n            return super.formatDefault(value, locale);\n        }\n    }\n\n    @Override\n    protected String formatWithFormatter(Date value, DateTimeFormatter formatter) {\n        if (value instanceof java.sql.Date) {\n            return ((java.sql.Date) value).toLocalDate().format(formatter);\n        } else {\n            return super.formatWithFormatter(value, formatter);\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/SqlTimestampSerializer.java",
    "content": "/*\n * Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.sql.Timestamp;\nimport java.time.Instant;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\n/**\n * Serializer of the {@link Timestamp} type.\n */\nclass SqlTimestampSerializer extends AbstractDateSerializer<Timestamp> {\n\n    /**\n     * Default Yasson {@link DateTimeFormatter}.\n     */\n    private static final DateTimeFormatter DEFAULT_FORMATTER = DateTimeFormatter.ISO_DATE_TIME.withZone(UTC);\n\n    SqlTimestampSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    protected Instant toInstant(Timestamp value) {\n        return value.toInstant();\n    }\n\n    @Override\n    protected String formatDefault(Timestamp value, Locale locale) {\n        return DEFAULT_FORMATTER.withLocale(locale).format(toInstant(value));\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/StringSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.nio.charset.StandardCharsets;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.JsonbConfigProperties;\nimport org.eclipse.yasson.internal.SerializationContextImpl;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Serializer of the {@link String} type.\n */\nclass StringSerializer extends TypeSerializer<String> {\n\n    StringSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    void serializeValue(String value, JsonGenerator generator, SerializationContextImpl context) {\n        JsonbConfigProperties configProperties = context.getJsonbContext().getConfigProperties();\n        if (configProperties.isStrictIJson()) {\n            String newString = new String(value.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);\n            if (!newString.equals(value)) {\n                throw new JsonbException(Messages.getMessage(MessageKeys.UNPAIRED_SURROGATE));\n            }\n        }\n        generator.write(value);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/TimeZoneSerializer.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.util.TimeZone;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Serializer of the {@link TimeZone} type.\n */\nclass TimeZoneSerializer extends TypeSerializer<TimeZone> {\n\n    TimeZoneSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    void serializeValue(TimeZone value, JsonGenerator generator, SerializationContextImpl context) {\n        generator.write(value.getID());\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/TypeSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\nimport org.eclipse.yasson.internal.serializer.ModelSerializer;\n\n/**\n * Base for all the type serializers.\n */\nabstract class TypeSerializer<T> implements ModelSerializer {\n\n    private final ModelSerializer serializer;\n\n    TypeSerializer(TypeSerializerBuilder serializerBuilder) {\n        if (serializerBuilder.isKey()) {\n            serializer = new KeySerializer();\n        } else {\n            serializer = new ValueSerializer();\n        }\n    }\n\n    @Override\n    public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n        serializer.serialize(value, generator, context);\n    }\n\n    abstract void serializeValue(T value, JsonGenerator generator, SerializationContextImpl context);\n\n    void serializeKey(T key, JsonGenerator generator, SerializationContextImpl context) {\n        generator.writeKey(String.valueOf(key));\n    }\n\n    private final class ValueSerializer implements ModelSerializer {\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            serializeValue((T) value, generator, context);\n        }\n\n    }\n\n    private final class KeySerializer implements ModelSerializer {\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public void serialize(Object value, JsonGenerator generator, SerializationContextImpl context) {\n            serializeKey((T) value, generator, context);\n        }\n\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/TypeSerializerBuilder.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.lang.reflect.Type;\nimport java.util.List;\n\nimport org.eclipse.yasson.internal.JsonbContext;\nimport org.eclipse.yasson.internal.model.customization.Customization;\n\n/**\n * Type serializer data holder object used during serializer creation.\n */\nclass TypeSerializerBuilder {\n\n    private final List<Type> chain;\n    private final Class<?> clazz;\n    private final Customization customization;\n    private final JsonbContext jsonbContext;\n    private final boolean key;\n\n    TypeSerializerBuilder(List<Type> chain,\n                          Class<?> clazz,\n                          Customization customization,\n                          JsonbContext jsonbContext,\n                          boolean key) {\n        this.chain = chain;\n        this.clazz = clazz;\n        this.customization = customization;\n        this.jsonbContext = jsonbContext;\n        this.key = key;\n    }\n\n    public List<Type> getChain() {\n        return chain;\n    }\n\n    public Class<?> getClazz() {\n        return clazz;\n    }\n\n    public Customization getCustomization() {\n        return customization;\n    }\n\n    public JsonbContext getJsonbContext() {\n        return jsonbContext;\n    }\n\n    public boolean isKey() {\n        return key;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/TypeSerializers.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.lang.reflect.Type;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.net.URI;\nimport java.net.URL;\nimport java.nio.file.Path;\nimport java.time.Duration;\nimport java.time.Instant;\nimport java.time.LocalDate;\nimport java.time.LocalDateTime;\nimport java.time.LocalTime;\nimport java.time.MonthDay;\nimport java.time.OffsetDateTime;\nimport java.time.OffsetTime;\nimport java.time.Period;\nimport java.time.YearMonth;\nimport java.time.ZoneId;\nimport java.time.ZoneOffset;\nimport java.time.ZonedDateTime;\nimport java.util.Calendar;\nimport java.util.Collections;\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.OptionalDouble;\nimport java.util.OptionalInt;\nimport java.util.OptionalLong;\nimport java.util.Set;\nimport java.util.TimeZone;\nimport java.util.UUID;\nimport java.util.function.Function;\n\nimport javax.xml.datatype.XMLGregorianCalendar;\n\nimport jakarta.json.JsonNumber;\nimport jakarta.json.JsonString;\nimport jakarta.json.JsonValue;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.serializer.JsonbSerializer;\n\nimport org.eclipse.yasson.internal.JsonbContext;\nimport org.eclipse.yasson.internal.model.customization.Customization;\nimport org.eclipse.yasson.internal.serializer.ModelSerializer;\nimport org.eclipse.yasson.internal.serializer.SerializationModelCreator;\n\nimport static org.eclipse.yasson.internal.BuiltInTypes.isClassAvailable;\n\n/**\n * Specific type serializers.\n */\npublic class TypeSerializers {\n\n    private static final Map<Class<?>, Function<TypeSerializerBuilder, ModelSerializer>> SERIALIZERS;\n    private static final Set<Class<?>> SUPPORTED_MAP_KEYS;\n\n    private static final Map<Class<?>, Class<?>> OPTIONALS;\n\n    static {\n        Map<Class<?>, Function<TypeSerializerBuilder, ModelSerializer>> cache = new HashMap<>();\n        cache.put(Byte.class, ByteSerializer::new);\n        cache.put(Byte.TYPE, ByteSerializer::new);\n        cache.put(BigDecimal.class, BigDecimalSerializer::new);\n        cache.put(BigInteger.class, BigIntegerSerializer::new);\n        cache.put(Boolean.class, BooleanSerializer::new);\n        cache.put(Boolean.TYPE, BooleanSerializer::new);\n        cache.put(Calendar.class, CalendarSerializer::new);\n        cache.put(Character.class, CharSerializer::new);\n        cache.put(Character.TYPE, CharSerializer::new);\n        cache.put(Date.class, DateSerializer::new);\n        cache.put(Double.class, DoubleSerializer::new);\n        cache.put(Double.TYPE, DoubleSerializer::new);\n        cache.put(Duration.class, DurationSerializer::new);\n        cache.put(Float.class, FloatSerializer::new);\n        cache.put(Float.TYPE, FloatSerializer::new);\n        cache.put(Integer.class, IntegerSerializer::new);\n        cache.put(Integer.TYPE, IntegerSerializer::new);\n        cache.put(Instant.class, InstantSerializer::new);\n        cache.put(LocalDateTime.class, LocalDateTimeSerializer::new);\n        cache.put(LocalDate.class, LocalDateSerializer::new);\n        cache.put(LocalTime.class, LocalTimeSerializer::new);\n        cache.put(Long.class, LongSerializer::new);\n        cache.put(Long.TYPE, LongSerializer::new);\n        cache.put(MonthDay.class, MonthDayTypeSerializer::new);\n        cache.put(Number.class, NumberSerializer::new);\n        cache.put(Object.class, ObjectTypeSerializer::new);\n        cache.put(OffsetDateTime.class, OffsetDateTimeSerializer::new);\n        cache.put(OffsetTime.class, OffsetTimeSerializer::new);\n        cache.put(Path.class, PathSerializer::new);\n        cache.put(Period.class, PeriodSerializer::new);\n        cache.put(Short.class, ShortSerializer::new);\n        cache.put(Short.TYPE, ShortSerializer::new);\n        cache.put(String.class, StringSerializer::new);\n        cache.put(TimeZone.class, TimeZoneSerializer::new);\n        cache.put(URI.class, UriSerializer::new);\n        cache.put(URL.class, UrlSerializer::new);\n        cache.put(UUID.class, UuidSerializer::new);\n        if (isClassAvailable(\"javax.xml.datatype.XMLGregorianCalendar\")) {\n            cache.put(XMLGregorianCalendar.class, XmlGregorianCalendarSerializer::new);\n        }\n        cache.put(YearMonth.class, YearMonthTypeSerializer::new);\n        cache.put(ZonedDateTime.class, ZonedDateTimeSerializer::new);\n        cache.put(ZoneId.class, ZoneIdSerializer::new);\n        cache.put(ZoneOffset.class, ZoneOffsetSerializer::new);\n        if (isClassAvailable(\"java.sql.Date\")) {\n            cache.put(Date.class, SqlDateSerializer::new);\n            cache.put(java.sql.Date.class, SqlDateSerializer::new);\n            cache.put(java.sql.Timestamp.class, SqlTimestampSerializer::new);\n        }\n        SERIALIZERS = Map.copyOf(cache);\n\n        Map<Class<?>, Class<?>> optionals = new HashMap<>();\n        optionals.put(OptionalDouble.class, Double.class);\n        optionals.put(OptionalInt.class, Integer.class);\n        optionals.put(OptionalLong.class, Long.class);\n        OPTIONALS = Map.copyOf(optionals);\n\n        Set<Class<?>> mapKeys = new HashSet<>(SERIALIZERS.keySet());\n        mapKeys.addAll(optionals.keySet());\n        mapKeys.add(JsonNumber.class);\n        mapKeys.add(JsonString.class);\n        mapKeys.remove(Object.class);\n        SUPPORTED_MAP_KEYS = Set.copyOf(mapKeys);\n\n    }\n\n    private TypeSerializers() {\n        throw new IllegalStateException(\"Util class cannot be instantiated\");\n    }\n\n    /**\n     * Whether type is the supported key type.\n     *\n     * @param clazz key type\n     * @return whether type is supported key type\n     */\n    public static boolean isSupportedMapKey(Class<?> clazz) {\n        return Enum.class.isAssignableFrom(clazz) || SUPPORTED_MAP_KEYS.contains(clazz);\n    }\n\n    /**\n     * Whether type has a custom {@link JsonbSerializer} implementation.\n     *\n     * @param clazz        type to serialize\n     * @param jsonbContext jsonb context\n     * @return whether a custom JsonSerializer for the type is available\n     */\n    public static boolean hasCustomJsonbSerializer(Class<?> clazz, JsonbContext jsonbContext) {\n        return jsonbContext.getComponentMatcher().getSerializerBinding(clazz, null).isPresent();\n    }\n\n    /**\n     * Create new type serializer.\n     *\n     * @param clazz         type of the serializer\n     * @param customization serializer customization\n     * @param jsonbContext  jsonb context\n     * @return new type serializer\n     */\n    public static ModelSerializer getTypeSerializer(Class<?> clazz, Customization customization, JsonbContext jsonbContext) {\n        return getTypeSerializer(Collections.emptyList(), clazz, customization, jsonbContext, false);\n    }\n\n    /**\n     * Create new type serializer.\n     *\n     * @param chain         chain of the type predecessors\n     * @param clazz         type of the serializer\n     * @param customization serializer customization\n     * @param jsonbContext  jsonb context\n     * @param key           whether serializer is a key\n     * @return new type serializer\n     */\n    public static ModelSerializer getTypeSerializer(List<Type> chain,\n                                                    Class<?> clazz,\n                                                    Customization customization,\n                                                    JsonbContext jsonbContext,\n                                                    boolean key) {\n        Class<?> current = clazz;\n        List<Type> chainClone = new LinkedList<>(chain);\n        TypeSerializerBuilder builder = new TypeSerializerBuilder(chainClone, clazz, customization, jsonbContext, key);\n        ModelSerializer typeSerializer = null;\n        if (Object.class.equals(current)) {\n            return SERIALIZERS.get(current).apply(builder);\n        }\n        if (OPTIONALS.containsKey(current)) {\n            Class<?> optionalInner = OPTIONALS.get(current);\n            ModelSerializer serializer = getTypeSerializer(chainClone, optionalInner, customization, jsonbContext, key);\n            if (OptionalInt.class.equals(current)) {\n                return new OptionalIntSerializer(serializer);\n            } else if (OptionalLong.class.equals(current)) {\n                return new OptionalLongSerializer(serializer);\n            } else if (OptionalDouble.class.equals(current)) {\n                return new OptionalDoubleSerializer(serializer);\n            } else {\n                throw new JsonbException(\"Unsupported Optional type for serialization: \" + clazz);\n            }\n        }\n\n        if (Enum.class.isAssignableFrom(clazz)) {\n            typeSerializer = new EnumSerializer(builder);\n        } else if (JsonValue.class.isAssignableFrom(clazz)) {\n            typeSerializer = new JsonValueSerializer(builder);\n        }\n        if (typeSerializer == null) {\n            do {\n                if (SERIALIZERS.containsKey(current)) {\n                    typeSerializer = SERIALIZERS.get(current).apply(builder);\n                    break;\n                }\n                current = current.getSuperclass();\n            } while (!Object.class.equals(current) && current != null);\n        }\n\n        if (key) {\n            //We do not want any other special serializers around our type serializer if it will be used as a key\n            return typeSerializer;\n        }\n        return typeSerializer == null\n                ? null\n                : SerializationModelCreator.wrapInCommonSet(typeSerializer, customization, jsonbContext);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/UriSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.net.URI;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Serializer of the {@link URI} type.\n */\nclass UriSerializer extends TypeSerializer<URI> {\n\n    UriSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    void serializeValue(URI value, JsonGenerator generator, SerializationContextImpl context) {\n        generator.write(value.toString());\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/UrlSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.net.URL;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Serializer of the {@link URL} type.\n */\nclass UrlSerializer extends TypeSerializer<URL> {\n\n    UrlSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    void serializeValue(URL value, JsonGenerator generator, SerializationContextImpl context) {\n        generator.write(value.toString());\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/UuidSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.util.UUID;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Serializer of the {@link UUID} type.\n */\nclass UuidSerializer extends TypeSerializer<UUID> {\n\n    UuidSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    void serializeValue(UUID value, JsonGenerator generator, SerializationContextImpl context) {\n        generator.write(value.toString());\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/XmlGregorianCalendarSerializer.java",
    "content": "/*\n * Copyright (c) 2018, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.Instant;\nimport java.time.ZonedDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.time.temporal.TemporalAccessor;\nimport java.util.Locale;\n\nimport javax.xml.datatype.XMLGregorianCalendar;\n\n/**\n * Serializer of the {@link XMLGregorianCalendar} type.\n */\nclass XmlGregorianCalendarSerializer extends AbstractDateSerializer<XMLGregorianCalendar> {\n\n    XmlGregorianCalendarSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    protected Instant toInstant(XMLGregorianCalendar value) {\n        return Instant.ofEpochMilli(value.toGregorianCalendar().getTimeInMillis());\n    }\n\n    @Override\n    protected String formatDefault(XMLGregorianCalendar value, Locale locale) {\n        DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME;\n        return formatter\n                .withLocale(locale)\n                .withZone(value.toGregorianCalendar().getTimeZone().toZoneId())\n                .format(toTemporalAccessor(value));\n    }\n\n    @Override\n    protected TemporalAccessor toTemporalAccessor(XMLGregorianCalendar object) {\n        return ZonedDateTime.ofInstant(Instant.ofEpochMilli(object.toGregorianCalendar().getTimeInMillis()),\n                                       object.toGregorianCalendar().getTimeZone().toZoneId());\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/YearMonthTypeSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.Instant;\nimport java.time.YearMonth;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\n/**\n * Serializer of the {@link YearMonth} type.\n */\nclass YearMonthTypeSerializer extends AbstractDateSerializer<YearMonth> {\n\n    private static final DateTimeFormatter DEFAULT_FORMAT = DateTimeFormatter.ofPattern(\"yyyy-MM\").withZone(UTC);\n\n    YearMonthTypeSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    protected Instant toInstant(YearMonth value) {\n        return value.atDay(1).atStartOfDay(UTC).toInstant();\n    }\n\n    @Override\n    protected String formatDefault(YearMonth value, Locale locale) {\n        return DEFAULT_FORMAT.withLocale(locale).format(value);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/ZoneIdSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.ZoneId;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Serializer of the {@link ZoneId} type.\n */\nclass ZoneIdSerializer extends TypeSerializer<ZoneId> {\n\n    ZoneIdSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    void serializeValue(ZoneId value, JsonGenerator generator, SerializationContextImpl context) {\n        generator.write(value.getId());\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/ZoneOffsetSerializer.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.ZoneOffset;\n\nimport jakarta.json.stream.JsonGenerator;\n\nimport org.eclipse.yasson.internal.SerializationContextImpl;\n\n/**\n * Serializer of the {@link ZoneOffset} type.\n */\nclass ZoneOffsetSerializer extends TypeSerializer<ZoneOffset> {\n\n    ZoneOffsetSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    void serializeValue(ZoneOffset value, JsonGenerator generator, SerializationContextImpl context) {\n        generator.write(value.getId());\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/internal/serializer/types/ZonedDateTimeSerializer.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer.types;\n\nimport java.time.Instant;\nimport java.time.ZonedDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Locale;\n\n/**\n * Serializer of the {@link ZonedDateTime} type.\n */\nclass ZonedDateTimeSerializer extends AbstractDateSerializer<ZonedDateTime> {\n\n    ZonedDateTimeSerializer(TypeSerializerBuilder serializerBuilder) {\n        super(serializerBuilder);\n    }\n\n    @Override\n    protected Instant toInstant(ZonedDateTime value) {\n        return value.toInstant();\n    }\n\n    @Override\n    protected String formatDefault(ZonedDateTime value, Locale locale) {\n        return DateTimeFormatter.ISO_ZONED_DATE_TIME.withLocale(locale).format(value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/eclipse/yasson/spi/JsonbComponentInstanceCreator.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.spi;\n\nimport java.io.Closeable;\n\n/**\n * Creates instances of JsonbComponents such as JsonbAdapter.\n *\n * <p>\n * Yasson attempts to load the implementations using {@link java.util.ServiceLoader} first. If there are multiple\n * implementations found the service provider with the highest priority is used. If there are no service providers found the\n * default implementation is used.\n * </p>\n */\npublic interface JsonbComponentInstanceCreator extends Closeable {\n\n    /**\n     * Default component priority.\n     */\n    int DEFAULT_PRIORITY = 0;\n\n    /**\n     * Returns instance of JsonbComponent for desired class.\n     *\n     * @param <T>            Jsonb component type\n     * @param componentClass component class\n     * @return component instance\n     */\n    <T> T getOrCreateComponent(Class<T> componentClass);\n\n    /**\n     * @return the priority of the component\n     */\n    default int getPriority() {\n        return DEFAULT_PRIORITY;\n    }\n}\n"
  },
  {
    "path": "src/main/java16/org/eclipse/yasson/internal/ClassMultiReleaseExtension.java",
    "content": "/*\n * Copyright (c) 2021, 2024 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Method;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.config.PropertyNamingStrategy;\n\nimport org.eclipse.yasson.internal.model.JsonbCreator;\nimport org.eclipse.yasson.internal.model.Property;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\n/**\n * Search for instance creator from other sources.\n * Mainly intended to add extensibility for different java versions and new features.\n */\npublic class ClassMultiReleaseExtension {\n\n    private ClassMultiReleaseExtension() {\n        throw new IllegalStateException(\"This class cannot be instantiated\");\n    }\n\n    static boolean shouldTransformToPropertyName(Method method) {\n        return !method.getDeclaringClass().isRecord();\n    }\n\n    static boolean isSpecialAccessorMethod(Method method, Map<String, Property> classProperties) {\n        return isRecord(method.getDeclaringClass())\n                && method.getParameterCount() == 0\n                && !void.class.equals(method.getReturnType())\n                && classProperties.containsKey(method.getName());\n    }\n\n    static JsonbCreator findCreator(Class<?> clazz,\n                                    Constructor<?>[] declaredConstructors,\n                                    AnnotationIntrospector introspector,\n                                    PropertyNamingStrategy propertyNamingStrategy) {\n        if (clazz.isRecord()) {\n            if (declaredConstructors.length == 1) {\n                return introspector.createJsonbCreator(declaredConstructors[0], null, clazz, propertyNamingStrategy);\n            }\n        }\n        return null;\n    }\n\n    public static boolean isRecord(Class<?> clazz) {\n        return clazz.isRecord();\n    }\n\n    public static Optional<JsonbException> exceptionToThrow(Class<?> clazz) {\n        if (clazz.isRecord()) {\n            if (clazz.getDeclaredConstructors().length > 1) {\n                return Optional.of(new JsonbException(Messages.getMessage(MessageKeys.RECORD_MULTIPLE_CONSTRUCTORS, clazz)));\n            }\n        }\n        return Optional.empty();\n    }\n\n}\n"
  },
  {
    "path": "src/main/resources/META-INF/native-image/org.eclipse/yasson/native-image.properties",
    "content": "#\n# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n#\n# This program and the accompanying materials are made available under the\n# terms of the Eclipse Public License v. 2.0 which is available at\n# http://www.eclipse.org/legal/epl-2.0,\n# or the Eclipse Distribution License v. 1.0 which is available at\n# http://www.eclipse.org/org/documents/edl-v10.php.\n#\n# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n#\n\n# This adds command line options to native image tool\nArgs=-H:IncludeResourceBundles=yasson-messages"
  },
  {
    "path": "src/main/resources/META-INF/services/jakarta.json.bind.spi.JsonbProvider",
    "content": "org.eclipse.yasson.JsonBindingProvider"
  },
  {
    "path": "src/main/resources/yasson-messages.properties",
    "content": "#\n# Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n#\n# This program and the accompanying materials are made available under the\n# terms of the Eclipse Public License v. 2.0 which is available at\n# http://www.eclipse.org/legal/epl-2.0,\n# or the Eclipse Distribution License v. 1.0 which is available at\n# http://www.eclipse.org/org/documents/edl-v10.php.\n#\n# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n#\n\n# The following 2 comment lines are for automated tools that the IBM translation teams use\n#NLS_MESSAGEFORMAT_VAR\n#NLS_ENCODING=UNICODE\n\ncannotMarshallObject=Cannot marshall object\ntypeResolutionError=Error resolving runtime type for type: {0}\ngenericBoundNotFound=Generic bound not found for type {0} declared in {1}.\ncantConvertJsonValue=Cannot convert JSON value into: {0}\ncantCreateRootInstance=Cannot create root instance\ninvokingGetter=Error invoking getter method.\ngettingValue=Error getting field value.\nsettingValue=Error setting field value.\nnoLoggerName=Logger name has to be set\nresolveParametrizedType=Cannot resolve ParameterizedType superclass for: {0}\ncantCreateInstance=Cannot create instance\ninferTypeForUnmarshall=Cannot infer a type for unmarshalling into: {0}\nimplClassIncompatible=Implementation class {0} is not a subtype of interface {1}.\nnotValueType=Not a value type: {0}\nunexpectedParseEvent=Unexpected parser event: {0}\nprocessFromJson=Process class: {0} from json using converter: {1}\nprocessToJson=Process class: {0} to json using converter: {1}\ncreatingHandles=Error creating handles.\nsettingValueWith=Error setting value with: {0}\ngettingValueWith=Error getting value with: {0}\nunpairedSurrogate=String contains unpaired surrogate.\nadapterException=Problem adapting object of type {0} to {1} in class {2}\nadapterFound=Found adapter from type {0} to type {1}.\nadapterIncompatible=Adapter of runtime type {0} does not match property type {1}\npropertyOrder=Property order strategy with name {0} was not recognized\nunknownVisibilityStrategy=Property visibility strategy with name {0} was not recognized\nunsupportedJsonpSerializerValue=Unsupported value of type {0} for JSON serializer.\nnoJndiEnvironment=No JNDI environment ({0}) found to look for CDI provider.\nnoCdiApiProvider=CDI API not found on class or module path {0}.\nillegalAccess=Yasson does not have sufficient permissions to {0}.\nusingDefaultConstructorInstantiator=CDI bean manager not found, serializers and adapters will not have CDI support.\nnoCdiEnvironment=CDI environment is not available.\niJsonEnabledSingleValue=Cannot marshal single value because I-Json is enabled!\ndateTypeNotSupported=Date type not supported: {0}\nerrorParsingDate=Error parsing {1} from value: {0}. Check your @JsonbDateFormat has all time units for {1} type, \\\n  or consider using org.eclipse.yasson.YassonConfig#ZERO_TIME_PARSE_DEFAULTING.\nnoDefaultConstructor=Cannot create instance of a class: {0}, No default constructor found.\nrecordMultipleConstructors=Cannot create instance of a record: {0}, Multiple constructors found.\noffsetDateTimeFromMillis=Parsing {0} from epoch millisecond, UTC zone offset will be used.\ntimeToEpochMillisError=Cannot convert {0} to/from epoch milliseconds.\nconfigPropertyInvalidType=JsonbConfig property [{0}] must be of type [{1}].\nconversionNotSupported=Conversion of type [{0}] to/from string value is not supported.\nendOfJsonStructure=End of JSON structure reached.\ninvalidDeserializationType=Invalid json value type {0} for deserialization into type {1}.\nczechDiacritics=p\\u0159\\u00edli\\u0161,\\u017elu\\u0165ou\\u010dk\\u00fd,k\\u016f\\u0148,\\u00fap\\u011bl,\\u010f\\u00e1belsk\\u00e9,\\u00f3dy\nrussianDiacritics=\\u0441\\u043b\\u0438\\u0448\\u043a\\u043e\\u043c,\\u0436\\u0435\\u043b\\u0442\\u0435\\u043d\\u044c\\u043a\\u0438\\u0439,\\u043a\\u043e\\u043d\\u044c,\\u043f\\u0435\\u043b,\\u0430\\u0434\\u0441\\u043a\\u0438\\u0435,\\u043e\\u0434\\u044b\npropertyNotFoundDeserializer=Property {0} was not found in class {1}. Skipping value {2}.\nsettingPropertyDeserializer=Setting property {0} in class {1} with value {2}.\nclassLoadNotAllowed=Class load for {0} name is not allowed!\nerrorCallingJsonbCreator=Exception occurred during call to JSONB creator on class: {0}.\nincompatibleFactoryCreatorReturnType=Return type of creator {0} must be of type {1}.\nmultipleJsonbCreators=More than one @JsonbCreator declared in class {0}.\ninternalError=Internal error: {0}\nserializePropertyError=Unable to serialize property ''{0}'' from {1}\ndeserializeValueError=Error deserialize JSON value into type: {0}.\nparsingNumber=Error parsing number {0} with format {1}.\nunknownBinaryDataStrategy=Unknown binary data strategy: {0}\ninvalidPropertyNamingStrategy=Property naming strategy must be either: String name, or instance of jakarta.json.bind.config.PropertyNamingStrategy.\ncreatorParameterNotAnnotated=Argument has no JsonbProperty annotation for JsonbCreator {0}.\nunknownJsonProperty=Json property {0} can not be mapped to a class {1}.\njsonbCreatorMissingProperty=JsonbCreator parameter {0} is missing in json document.\nzoneParseError=Cannot parse zone from json value: {0}\njsonbTransientWithOtherAnnotations=JsonbTransient annotation cannot be used with other jsonb annotations on the same property.\nnonParametrizedType=Type: {0} is not a parametrized type.\npropertyNameClash=Property {0} clashes with property {1} by read or write name in class {2}.\nsqlDateIJsonError=java.sql.Date is not supported in STRICT_IJSON mode.\nrecursiveReference=Recursive reference has been found in class {0}.\ndatatypeFactoryCreationFailed=An error occurred while DatatypeFactory creation.\nmultipleConstructorPropertiesCreators=More than one constructor annotated with @ConstructorProperties declared in class {0}.\nannotationNotAvailable=Annotation {0} is not visible in modules or classpath. Annotation will be ignored.\nmissingValuePropertyInAnnotation=Missing value property in Annotation {0}. Annotation will be ignored.\nnumberIncompatibleValueTypeArray=Value type {0} is not a JsonNumber.\nnumberIncompatibleValueTypeObject=Value type {0} at key {1} is not a JsonNumber.\n"
  },
  {
    "path": "src/test/java/PackagelessClassTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\n/**\n * Tests the serialization/deserialization of a class that has no package.\n *\n * @author Ehsan Zaery Moghaddam (zaerymoghaddam@gmail.com)\n */\npublic class PackagelessClassTest {\n\n    @Test\n    public void testSerialization() throws Exception {\n        PackagelessModel packagelessClass = new PackagelessModel(12, \"Hello World!\");\n\n        String expected = \"{\\\"intValue\\\":12,\\\"stringValue\\\":\\\"Hello World!\\\"}\";\n        assertEquals(expected, defaultJsonb.toJson(packagelessClass));\n    }\n\n    @Test\n    public void testDeSerialization() throws Exception {\n        PackagelessModel packagelessClass = new PackagelessModel(12, \"Hello World!\");\n\n        String input = \"{\\\"intValue\\\":12,\\\"stringValue\\\":\\\"Hello World!\\\"}\";\n        PackagelessModel packagelessModel = defaultJsonb.fromJson(input, PackagelessModel.class);\n        assertEquals(packagelessModel.getIntValue(), 12);\n        assertEquals(packagelessModel.getStringValue(), \"Hello World!\");\n    }\n}\n"
  },
  {
    "path": "src/test/java/PackagelessModel.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\n/**\n * This class is designed outside any packages intentionally to test serialization/deserialization scenarios for such\n * cases.\n *\n * @author Ehsan Zaery Moghaddam (zaerymoghaddam@gmail.com)\n */\npublic class PackagelessModel {\n    private int intValue;\n    private String stringValue;\n\n    public PackagelessModel() {\n    }\n\n    public PackagelessModel(int intValue, String stringValue) {\n        this.intValue = intValue;\n        this.stringValue = stringValue;\n    }\n\n    public int getIntValue() {\n        return intValue;\n    }\n\n    public void setIntValue(int intValue) {\n        this.intValue = intValue;\n    }\n\n    public String getStringValue() {\n        return stringValue;\n    }\n\n    public void setStringValue(String stringValue) {\n        this.stringValue = stringValue;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/Assertions.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson;\n\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport java.util.function.Function;\nimport java.util.function.Supplier;\n\nimport jakarta.json.bind.JsonbException;\n\npublic class Assertions {\n\t\n\t/**\n\t * Asserts that the given operation will fail with a JsonbException\n\t * @param operation The operation that is expected to fail\n\t */\n\tpublic static void shouldFail(Supplier<?> operation) {\n\t\tshouldFail(operation, JsonbException.class, msg -> true);\n\t}\n\t\n\tpublic static void shouldFail(Runnable operation) {\n\t\tshouldFail(() -> {\n\t\t\toperation.run();\n\t\t\treturn null;\n\t\t});\n\t}\n\t\n\t/**\n\t * Asserts that the given operation will fail with a JsonbException\n\t * @param operation The operation that is expected to fail\n\t * @param checkExceptionMessage Any checks that should be made on the exception message. For example, ensuring the exception\n\t * includes a specific token. \n\t */\n\tpublic static void shouldFail(Supplier<?> operation, Function<String,Boolean> checkExceptionMessage) {\n\t\tshouldFail(operation, JsonbException.class, checkExceptionMessage);\n\t}\n\n\t/**\n\t * Asserts that the given operation will fail\n\t * @param operation The operation that is expected to fail\n\t * @param expectedType The expected exception type to receive when evaluating the operation\n\t * @param checkExceptionMessage Any checks that should be made on the exception message. For example, ensuring the exception\n\t * includes a specific token. \n\t */\n\tpublic static void shouldFail(Supplier<?> operation, Class<? extends Throwable> expectedType, Function<String,Boolean> checkExceptionMessage) {\n\t\ttry {\n\t\t\toperation.get();\n\t\t\tfail(\"The operation should have failed with a \" + expectedType.getCanonicalName() + \" but it succeeded.\");\n\t\t} catch (Throwable t) {\n\t\t\tString fullErrorMessage = \"\";\n\t\t\tfor (Throwable current = t; current != null && current.getCause() != current; current = current.getCause()) {\n\t\t\t    fullErrorMessage += current.getClass().getCanonicalName() + \": \";\n\t\t\t\tfullErrorMessage += current.getMessage() + \"\\n\";\n\t\t\t}\n\t\t\tif (expectedType.isAssignableFrom(t.getClass())) {\n\t\t\t\tif (!checkExceptionMessage.apply(fullErrorMessage)) {\n\t\t\t\t\tt.printStackTrace();\n\t\t\t\t\tfail(\"Exception did not contain the proper content: \" + fullErrorMessage);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tt.printStackTrace();\n\t\t\t\tfail(\"Expected to get an exception of \" + expectedType + \" but instead was \" + t.getClass());\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/DefaultGetterInInterface.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.internal.JsonbContext;\n\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.spi.JsonProvider;\nimport java.lang.reflect.Method;\n\n/**\n *\n * @author Maxence Laurent\n */\npublic class DefaultGetterInInterface {\n\n    public static interface Defaulted {\n\n        default public String getGetterA() {\n            return \"valueA\";\n        }\n    }\n\n    public static class PojoWithDefault implements Defaulted {\n    }\n\n    @Test\n    public void testWithDefault() {\n        PojoWithDefault pojo = new PojoWithDefault();\n        String result = defaultJsonb.toJson(pojo);\n        assertEquals(\"{\\\"getterA\\\":\\\"valueA\\\"}\", result);\n    }\n\n    public static interface WithGetterI {\n\n        @JsonbProperty(\"withGetterI\")\n        String getGetterI();\n    }\n\n    public static interface WithDefaultGetterI extends WithGetterI {\n\n        @Override\n        @JsonbProperty(\"default\")\n        default String getGetterI() {\n            return \"default\";\n        }\n    }\n\n    public static interface OtherWithDefaultGetterI extends WithGetterI {\n\n        @Override\n        @JsonbProperty(\"otherDefault\")\n        default String getGetterI() {\n            return \"otherDefault\";\n        }\n    }\n\n    public static class Pojo implements WithGetterI {\n\n        @Override\n        @JsonbProperty(\"implementation\")\n        public String getGetterI() {\n            return \"implementation\";\n        }\n    }\n\n\n    public static class PojoNoAnnotation implements WithGetterI {\n\n        @Override\n        public String getGetterI() {\n            return \"withGetterI\";\n        }\n    }\n\n    public static class PojoWithDefaultSuperImplementation extends Pojo implements WithDefaultGetterI {\n    }\n\n    public static class PojoWithDefaultImplementation implements WithDefaultGetterI {\n\n        @Override\n        @JsonbProperty(\"defaultImplementation\")\n        public String getGetterI() {\n            return \"defaultImplementation\";\n        }\n\n    }\n\n    public static class PojoWithDefaultOnly implements WithDefaultGetterI {\n    }\n\n    public static class PojoGetterDefaultedTwice extends PojoWithDefaultImplementation implements OtherWithDefaultGetterI {\n    }\n\n    @Test\n    public void testWithInheritedAndDefault() throws NoSuchMethodException {\n        JsonbContext jsonbContext = new JsonbContext(new JsonbConfig(), JsonProvider.provider());\n\n        // direct implementation only (no default implementation)\n        Method pojoGetter = jsonbContext.getMappingContext().getOrCreateClassModel(Pojo.class).getPropertyModel(\"getterI\").getGetter();\n\n        // default implementation\n        Method pojoDefaultOnlyGetter = jsonbContext.getMappingContext().getOrCreateClassModel(PojoWithDefaultOnly.class).getPropertyModel(\"getterI\").getGetter();\n\n        // default implementation overriden by super class\n        Method pojoDefaultSuperGetter = jsonbContext.getMappingContext().getOrCreateClassModel(PojoWithDefaultSuperImplementation.class).getPropertyModel(\"getterI\").getGetter();\n\n        // default implementation\n        Method pojoDefaultImplementationGetter = jsonbContext.getMappingContext().getOrCreateClassModel(PojoWithDefaultImplementation.class).getPropertyModel(\"getterI\").getGetter();\n\n        // two default implementations\n        Method pojoTwoDefault = jsonbContext.getMappingContext().getOrCreateClassModel(PojoGetterDefaultedTwice.class).getPropertyModel(\"getterI\").getGetter();\n\n        // assert getters selected by ClassParser\n        assertEquals(Pojo.class.getMethod(\"getGetterI\"), pojoGetter);\n        assertEquals(WithDefaultGetterI.class.getMethod(\"getGetterI\"), pojoDefaultOnlyGetter);\n        assertEquals(Pojo.class.getMethod(\"getGetterI\"), pojoDefaultSuperGetter);\n        assertEquals(PojoWithDefaultImplementation.class.getMethod(\"getGetterI\"), pojoDefaultImplementationGetter);\n        assertEquals(PojoWithDefaultImplementation.class.getMethod(\"getGetterI\"), pojoTwoDefault);\n\n        // assert serialized json is correct, including property name as specified by JsonbProperty annotations\n        assertJson(new Pojo(), \"implementation\");\n        assertJson(new PojoNoAnnotation(), \"withGetterI\");\n        assertJson(new PojoWithDefaultOnly(), \"default\");\n        assertJson(new PojoWithDefaultSuperImplementation(), \"implementation\");\n        assertJson(new PojoWithDefaultImplementation(), \"defaultImplementation\");\n        assertJson(new PojoGetterDefaultedTwice(), \"defaultImplementation\");\n    }\n\n    private static void assertJson(WithGetterI pojo, String expected){\n        assertEquals(expected, pojo.getGetterI());\n        assertEquals(\"{\\\"\" + expected + \"\\\":\\\"\" + pojo.getGetterI() + \"\\\"}\", defaultJsonb.toJson(pojo));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/FieldAccessStrategyTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */package org.eclipse.yasson;\n\n import org.junit.jupiter.api.*;\n import static org.junit.jupiter.api.Assertions.*;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.annotation.JsonbTransient;\nimport jakarta.json.bind.config.PropertyVisibilityStrategy;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\n\npublic class FieldAccessStrategyTest {\n\n    public static class PrivateFields {\n        private String strField;\n        @JsonbTransient\n        private boolean setterCalled;\n        @JsonbTransient\n        private boolean getterCalled;\n\n        public PrivateFields() {\n        }\n\n        public PrivateFields(String strField) {\n            this.strField = strField;\n        }\n\n        public String getStrField() {\n            getterCalled = true;\n            return strField;\n        }\n\n        public void setStrField(String strField) {\n            setterCalled = true;\n            this.strField = strField;\n        }\n    }\n\n    public static class PublicFields {\n        public String strField;\n    }\n\n\n    @Test\n    public void testPrivateFields() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyVisibilityStrategy(new FieldAccessStrategy()));\n\n        PrivateFields pojo = new PrivateFields(\"pojo string\");\n\n        String expected = \"{\\\"strField\\\":\\\"pojo string\\\"}\";\n\n        assertEquals(expected, jsonb.toJson(pojo));\n        PrivateFields result = jsonb.fromJson(expected, PrivateFields.class);\n        assertEquals(false, result.getterCalled);\n        assertEquals(false, result.setterCalled);\n        assertEquals(\"pojo string\", result.strField);\n    }\n\n\n    @Test\n    public void testHidePublicFields() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyVisibilityStrategy(new NoAccessStrategy()));\n\n        PublicFields pojo = new PublicFields();\n        pojo.strField = \"string field\";\n\n        String expected = \"{}\";\n\n        assertEquals(expected, jsonb.toJson(pojo));\n        PublicFields result = jsonb.fromJson(\"{\\\"strField\\\":\\\"pojo string\\\"}\", PublicFields.class);\n        assertEquals(null, result.strField);\n    }\n\n    /**\n     * Ignores public / private, visibility is set by name.\n     */\n    @Test\n    public void testCustomVisibityStrategy() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyVisibilityStrategy(new CustomVisibilityStrategy()));\n\n        String json = \"{\\\"floatInstance\\\":10.0,\\\"stringInstance\\\":\\\"Test String\\\"}\";\n        SimpleContainer simpleContainer = new SimpleContainer();\n        simpleContainer.setStringInstance(\"Test String\");\n        simpleContainer.setIntegerInstance(10);\n        simpleContainer.setFloatInstance(10.0f);\n        assertEquals(json, jsonb.toJson(simpleContainer));\n\n\n        SimpleContainer result = jsonb.fromJson(\"{ \\\"stringInstance\\\" : \\\"Test String\\\", \\\"floatInstance\\\" : 1.0, \\\"integerInstance\\\" : 1 }\", SimpleContainer.class);\n        assertEquals(\"Test String\", result.stringInstance);\n        assertNull(result.integerInstance);\n        assertNull(result.floatInstance);\n    }\n\n    public class CustomVisibilityStrategy implements PropertyVisibilityStrategy {\n        @Override\n        public boolean isVisible(Field field) {\n            return field.getName().equals(\"stringInstance\");\n        }\n\n        @Override\n        public boolean isVisible(Method method) {\n            return method.getName().equals(\"getFloatInstance\");\n        }\n    }\n    public static class SimpleContainer {\n        private String stringInstance;\n        private Integer integerInstance;\n        private Float floatInstance;\n\n        public String getStringInstance() {\n            return stringInstance;\n        }\n\n        public void setStringInstance(String stringInstance) {\n            this.stringInstance = stringInstance;\n        }\n\n        public Integer getIntegerInstance() {\n            return integerInstance;\n        }\n\n        public void setIntegerInstance(Integer integerInstance) {\n            this.integerInstance = integerInstance;\n        }\n\n        public float getFloatInstance() {\n            return floatInstance;\n        }\n\n        public void setFloatInstance(float floatInstance) {\n            this.floatInstance = floatInstance;\n        }\n    }\n\n\n    private static final class NoAccessStrategy implements PropertyVisibilityStrategy {\n\n        @Override\n        public boolean isVisible(Field field) {\n            return false;\n        }\n\n        @Override\n        public boolean isVisible(Method method) {\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/Issue454Test.java",
    "content": "/*\n * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\n\nimport org.junit.jupiter.api.Test;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.annotation.JsonbTransient;\n\npublic class Issue454Test {\n\n    @Test\n    public void test() {\n        final String EXPECTED = \"{\\\"field2\\\":\\\"bbb\\\"}\";\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig());\n        assertEquals(EXPECTED, jsonb.toJson(new TheInterface() {\n\n            @Override\n            public String getField1() {\n                return \"aaa\";\n            }\n\n            @Override\n            public String getField2() {\n                return \"bbb\";\n            }}));\n        assertEquals(EXPECTED, jsonb.toJson(new TheClass() {\n            @Override\n            public String getField1() {\n                return \"aaa\";\n            }\n            @Override\n            public String getField2() {\n                return \"bbb\";\n            }}));\n        assertEquals(EXPECTED, jsonb.toJson(new TheClass2()));\n        assertEquals(EXPECTED, jsonb.toJson(new TheClass2() {}));\n    }\n    \n    public static abstract class TheClass {\n        @JsonbTransient\n        public abstract String getField1();\n\n        public abstract String getField2();\n    }\n\n    public static class TheClass2 extends TheClass {\n        @Override\n        public String getField1() {\n            return \"aaa\";\n        }\n        @Override\n        public String getField2() {\n            return \"bbb\";\n        }\n    }\n    \n    public static interface TheInterface {\n\n        @JsonbTransient\n        String getField1();\n\n        String getField2();\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/Issue456Test.java",
    "content": "/*\n * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson;\n\nimport static org.junit.jupiter.api.Assertions.fail;\n\nimport org.junit.jupiter.api.Test;\n\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbException;\n\npublic class Issue456Test {\n\n    @Test\n    public void dontInvokeToString() {\n        try {\n            JsonbBuilder.create().toJson(new Example());\n            fail(\"JsonbException is expected\");\n        } catch (JsonbException e) {\n            // Expected\n        }\n    }\n\n    public static class Example {\n\n        public String getProperty() {\n            throw new RuntimeException(\"some error\");\n        }\n\n        @Override\n        public String toString() {\n            return JsonbBuilder.create().toJson(this);\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/JavaxNamingExcludedTest.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.internal.cdi.NonCdiAdapter;\nimport org.eclipse.yasson.internal.components.JsonbComponentInstanceCreatorFactory;\n\nimport jakarta.json.bind.annotation.JsonbTypeAdapter;\n\n/**\n * Requires --limit-modules java.base,java.logging,java.sql (to exclude java.naming) to work.\n * See pom.xml surefire plugin configuration.\n */\npublic class JavaxNamingExcludedTest {\n\n    @Test\n    public void testNoJavaxNamingModule() {\n        try {\n            Class.forName(JsonbComponentInstanceCreatorFactory.INITIAL_CONTEXT_CLASS);\n            fail(\"Class [\" + JsonbComponentInstanceCreatorFactory.INITIAL_CONTEXT_CLASS\n                    + \"] should not be available for this test.\");\n        } catch (ClassNotFoundException e) {\n            //OK, java.naming is not observable\n        }\n\n        final String result = defaultJsonb.toJson(new AdaptedPojo());\n        assertEquals(\"{\\\"adaptedValue1\\\":1111,\\\"adaptedValue2\\\":1001,\\\"adaptedValue3\\\":1010}\", result);\n    }\n\n    public static final class AdaptedPojo {\n        @JsonbTypeAdapter(NonCdiAdapter.class)\n        public String adaptedValue1 = \"1111\";\n\n        @JsonbTypeAdapter(NonCdiAdapter.class)\n        public String adaptedValue2 = \"1001\";\n\n        @JsonbTypeAdapter(NonCdiAdapter.class)\n        public String adaptedValue3 = \"1010\";\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/Jsonbs.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson;\n\nimport jakarta.json.bind.*;\nimport org.eclipse.yasson.internal.*;\n\npublic class Jsonbs {\n\tpublic static final Jsonb defaultJsonb = JsonbBuilder.create();\n\tpublic static final Jsonb bindingJsonb = new JsonBindingBuilder().build();\n\tpublic static final Jsonb formattingJsonb = JsonbBuilder.create(new JsonbConfig().withFormatting(Boolean.TRUE));\n\tpublic static final Jsonb nullableJsonb = JsonbBuilder.create(new JsonbConfig().withNullValues(Boolean.TRUE));\n    public static final YassonJsonb yassonJsonb = (YassonJsonb) JsonbBuilder.create();\n\tpublic static final YassonJsonb bindingYassonJsonb = (YassonJsonb) new JsonBindingProvider().create().build();\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/SimpleTest.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson;\n\nimport org.junit.jupiter.api.Test;\n\nimport static org.eclipse.yasson.Jsonbs.bindingJsonb;\nimport static org.eclipse.yasson.Jsonbs.defaultJsonb;\nimport static org.junit.jupiter.api.Assertions.assertEquals;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class SimpleTest {\n\n    @Test\n    public void testSimpleSerialize() {\n        final StringWrapper wrapper = new StringWrapper();\n        wrapper.setValue(\"abc\");\n        final String val = bindingJsonb.toJson(wrapper);\n        assertEquals(\"{\\\"value\\\":\\\"abc\\\"}\", val);\n    }\n\n    @Test\n    public void testSimpleDeserializer() {\n        final StringWrapper stringWrapper = defaultJsonb.fromJson(\"{\\\"value\\\":\\\"abc\\\"}\", StringWrapper.class);\n        assertEquals(\"abc\", stringWrapper.value);\n    }\n\n    public static class StringWrapper {\n\n        public String value;\n\n        public String getValue() {\n            return value;\n        }\n\n        public void setValue(String value) {\n            this.value = value;\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/TestTypeToken.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson;\n\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\n\n/**\n * @author Roman Grigoriadi\n */\npublic abstract class TestTypeToken<T> {\n    public Type getType() {\n        return ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/YassonConfigTest.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\n\nimport org.junit.jupiter.api.Test;\n\n/**\n * Tests that the names of configuration fields in {@link YassonConfig} do not change.\n */\npublic class YassonConfigTest {\n\n    @SuppressWarnings(\"deprecation\")\n    @Test\n    public void testFailOnUnknownPropertiesUnchanged() {\n        assertEquals(\"jsonb.fail-on-unknown-properties\", YassonConfig.FAIL_ON_UNKNOWN_PROPERTIES);\n        assertEquals(\"jsonb.fail-on-unknown-properties\", YassonProperties.FAIL_ON_UNKNOWN_PROPERTIES);\n    }\n\n    @SuppressWarnings(\"deprecation\")\n    @Test\n    public void testUserTypeMappingUnchanged() {\n        assertEquals(\"jsonb.user-type-mapping\", YassonConfig.USER_TYPE_MAPPING);\n        assertEquals(\"jsonb.user-type-mapping\", YassonProperties.USER_TYPE_MAPPING);\n    }\n\n    @SuppressWarnings(\"deprecation\")\n    @Test\n    public void testZeroTimeDefaultingUnchanged() {\n        assertEquals(\"jsonb.zero-time-defaulting\", YassonConfig.ZERO_TIME_PARSE_DEFAULTING);\n        assertEquals(\"jsonb.zero-time-defaulting\", YassonProperties.ZERO_TIME_PARSE_DEFAULTING);\n    }\n\n    @SuppressWarnings(\"deprecation\")\n    @Test\n    public void testNullRootSerializerUnchanged() {\n        assertEquals(\"yasson.null-root-serializer\", YassonConfig.NULL_ROOT_SERIALIZER);\n        assertEquals(\"yasson.null-root-serializer\", YassonProperties.NULL_ROOT_SERIALIZER);\n    }\n    \n    @Test\n    public void testEagerInitClassesUnchanged() {\n        assertEquals(\"yasson.eager-parse-classes\", YassonConfig.EAGER_PARSE_CLASSES);\n    }\n    \n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/AdaptersTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.TestTypeToken;\nimport org.eclipse.yasson.adapters.model.*;\nimport org.eclipse.yasson.defaultmapping.generics.model.ScalarValueWrapper;\n\nimport jakarta.json.Json;\nimport jakarta.json.JsonObject;\nimport jakarta.json.JsonString;\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.adapter.JsonbAdapter;\nimport java.lang.reflect.Type;\nimport java.math.BigDecimal;\nimport java.time.Instant;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.UUID;\n\nimport static java.util.Collections.unmodifiableMap;\n\n/**\n * Tests adapters to behave correctly.\n *\n * @author Roman Grigoriadi\n */\npublic class AdaptersTest {\n\n    public static class NonGenericPojo {\n        public String strValues;\n        public Box box;\n    }\n\n    @Test\n    public void testBoxToCrateNoGenerics() throws Exception {\n        JsonbAdapter<?, ?>[] adapters = {\n                new JsonbAdapter<Box, Crate>() {\n                    @Override\n                    public Crate adaptToJson(Box box) {\n                        final Crate crate = new Crate();\n                        crate.setCrateStrField(\"crateAdapted\" + box.getBoxStrField());\n                        crate.setCrateIntField(box.getBoxIntegerField() + 1);\n                        return crate;\n                    }\n\n                    @Override\n                    public Box adaptFromJson(Crate crate) {\n                        Box box = new Box();\n                        box.setBoxStrField(\"boxAdapted\" + crate.getCrateStrField());\n                        box.setBoxIntegerField(crate.getCrateIntField() + 1);\n                        return box;\n                    }\n                }\n        };\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().setProperty(JsonbConfig.ADAPTERS, adapters));\n\n        AdaptedPojo pojo = new AdaptedPojo();\n        Box box = new Box();\n        box.setBoxStrField(\"BoxStr\");\n        box.setBoxIntegerField(10);\n        pojo.box = box;\n        String json = jsonb.toJson(pojo);\n        assertEquals(\"{\\\"box\\\":{\\\"crateIntField\\\":11,\\\"crateStrField\\\":\\\"crateAdaptedBoxStr\\\"}}\", json);\n\n        AdaptedPojo<?> result = jsonb.fromJson(\"{\\\"box\\\":{\\\"crateIntField\\\":10,\\\"crateStrField\\\":\\\"CrateStr\\\"}}\", AdaptedPojo.class);\n        assertEquals(Integer.valueOf(11), result.box.getBoxIntegerField());\n        assertEquals(\"boxAdaptedCrateStr\", result.box.getBoxStrField());\n    }\n\n    @Test\n    public void testValueFieldAdapter() throws Exception {\n        JsonbAdapter<?, ?>[] adapters = {\n                new JsonbAdapter<Integer, String>() {\n                    @Override\n                    public String adaptToJson(Integer integer) {\n                        return String.valueOf(integer);\n                    }\n\n                    @Override\n                    public Integer adaptFromJson(String s) {\n                        return Integer.valueOf(s);\n                    }\n                }\n        };\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().setProperty(JsonbConfig.ADAPTERS, adapters));\n\n        AdaptedPojo pojo = new AdaptedPojo();\n        pojo.intField = 11;\n        String json = jsonb.toJson(pojo);\n        assertEquals(\"{\\\"intField\\\":\\\"11\\\"}\", json);\n\n        AdaptedPojo<?> result = jsonb.fromJson(\"{\\\"intField\\\":\\\"10\\\"}\", AdaptedPojo.class);\n        assertEquals(Integer.valueOf(10), result.intField);\n    }\n\n    @Test\n    public void testGenericAdapter() throws Exception {\n        JsonbAdapter<?, ?>[] adapters = {new BoxToCrateCompatibleGenericsAdapter<Integer>() {\n        }};\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().setProperty(JsonbConfig.ADAPTERS, adapters));\n\n        AdaptedPojo<Integer> pojo = new AdaptedPojo<>();\n        pojo.strField = \"POJO_STRING\";\n        pojo.intBox = new GenericBox<>(\"INT_BOX_STR\", 11);\n        pojo.tBox = new GenericBox<>(\"T_BOX_STR\", 110);\n\n        String marshalledJson = jsonb.toJson(pojo, new TestTypeToken<AdaptedPojo<Integer>>(){}.getType());\n        assertEquals(\"{\\\"intBox\\\":{\\\"adaptedT\\\":11,\\\"crateStrField\\\":\\\"INT_BOX_STR\\\"},\" +\n                \"\\\"strField\\\":\\\"POJO_STRING\\\",\" +\n                \"\\\"tBox\\\":{\\\"adaptedT\\\":110,\\\"crateStrField\\\":\\\"T_BOX_STR\\\"}}\", marshalledJson);\n\n        String toUnmarshall = \"{\\\"intBox\\\":{\\\"crateStrField\\\":\\\"Box3\\\",\\\"adaptedT\\\":33},\" +\n                \"\\\"tBox\\\":{\\\"crateStrField\\\":\\\"tGenBoxCrateStr\\\",\\\"adaptedT\\\":22},\" +\n                \"\\\"strField\\\":\\\"POJO_STRING\\\",\" +\n                \"\\\"strBox\\\":{\\\"strField\\\":\\\"strBoxStr\\\",\\\"x\\\":\\\"44\\\"}}\";\n        AdaptedPojo result = jsonb.fromJson(toUnmarshall, new TestTypeToken<AdaptedPojo<Integer>>(){}.getType());\n        assertEquals(\"POJO_STRING\", result.strField);\n        assertEquals(\"Box3\", result.intBox.getStrField());\n        assertEquals(33, result.intBox.getX());\n        assertEquals(\"tGenBoxCrateStr\", result.tBox.getStrField());\n        assertEquals(22, result.tBox.getX());\n        assertEquals(\"strBoxStr\", result.strBox.getStrField());\n        assertEquals(\"44\", result.strBox.getX());\n    }\n\n    @Test\n    public void testPropagatedTypeArgs() throws Exception {\n        JsonbAdapter<?, ?>[] adapters = {new BoxToCratePropagatedIntegerStringAdapter()};\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().setProperty(JsonbConfig.ADAPTERS, adapters));\n\n        AdaptedPojo<Integer> pojo = new AdaptedPojo<>();\n        pojo.intBox = new GenericBox<>(\"INT_BOX_STR\", 110);\n        pojo.tBox = new GenericBox<>(\"T_BOX_STR\", 111);\n        pojo.strBox = new GenericBox<>(\"STR_BOX_STR\", \"101\");\n\n        String marshalledJson = jsonb.toJson(pojo, new TestTypeToken<AdaptedPojo<Integer>>(){}.getType());\n        assertEquals(\"{\\\"intBox\\\":{\\\"adaptedT\\\":{\\\"x\\\":[\\\"110\\\"]},\\\"crateStrField\\\":\\\"INT_BOX_STR\\\"},\" +\n                        \"\\\"strBox\\\":{\\\"strField\\\":\\\"STR_BOX_STR\\\",\\\"x\\\":\\\"101\\\"},\" +\n                        \"\\\"tBox\\\":{\\\"adaptedT\\\":{\\\"x\\\":[\\\"111\\\"]},\\\"crateStrField\\\":\\\"T_BOX_STR\\\"}}\",\n                marshalledJson);\n\n        String toUnmarshall = \"{\\\"intBox\\\":{\\\"crateStrField\\\":\\\"strCrateStr\\\",\\\"adaptedT\\\":{\\\"strField\\\":\\\"crateBoxStrField\\\",\\\"x\\\":[\\\"77\\\"]}},\" +\n                \"\\\"tBox\\\":{\\\"crateStrField\\\":\\\"tStrCrateStr\\\",\\\"adaptedT\\\":{\\\"strField\\\":\\\"crateBoxStrField\\\",\\\"x\\\":[\\\"88\\\"]}},\" +\n                \"\\\"strField\\\":\\\"POJO_STRING\\\",\" +\n                \"\\\"strBox\\\":{\\\"strField\\\":\\\"strBoxStr\\\",\\\"x\\\":\\\"44\\\"}}\";\n\n        AdaptedPojo result = jsonb.fromJson(toUnmarshall, new TestTypeToken<AdaptedPojo<Integer>>(){}.getType());\n        assertEquals(\"POJO_STRING\", result.strField);\n        assertEquals(\"strCrateStr\", result.intBox.getStrField());\n        assertEquals(77, result.intBox.getX());\n        assertEquals(\"tStrCrateStr\", result.tBox.getStrField());\n        assertEquals(88, result.tBox.getX());\n        assertEquals(\"strBoxStr\", result.strBox.getStrField());\n        assertEquals(\"44\", result.strBox.getX());\n    }\n\n    @Test\n    public void testStringToGenericCollectionAdapter() throws Exception {\n        JsonbAdapter<?, ?>[] adapters = {new IntegerListToStringAdapter()};\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().setProperty(JsonbConfig.ADAPTERS, adapters));\n\n        AdaptedPojo<List<Integer>> pojo = new AdaptedPojo<>();\n        pojo.tVar = Arrays.asList(11, 22, 33);\n        pojo.integerList = Arrays.asList(110, 111, 101);\n        String marshalledJson = jsonb.toJson(pojo, new TestTypeToken<AdaptedPojo<List<Integer>>>(){}.getType());\n        assertEquals(\"{\\\"integerList\\\":\\\"110#111#101\\\",\" +\n                \"\\\"tVar\\\":\\\"11#22#33\\\"}\", marshalledJson);\n\n        String toUnmarshall = \"{\\\"integerList\\\":\\\"11#22#33#44\\\",\\\"stringList\\\":[\\\"first\\\",\\\"second\\\"],\" +\n                \"\\\"tVar\\\":\\\"110#111#101\\\"}\";\n\n        AdaptedPojo result = jsonb.fromJson(toUnmarshall, new TestTypeToken<AdaptedPojo<List<Integer>>>(){}.getType());\n        List<Integer> expectedIntegerList = Arrays.asList(11, 22, 33, 44);\n        List<String> expectedStringList = Arrays.asList(\"first\", \"second\");\n        List<Integer> expectedTList = Arrays.asList(110, 111, 101);\n\n        assertEquals(expectedIntegerList, result.integerList);\n        assertEquals(expectedStringList, result.stringList);\n        assertEquals(expectedTList, result.tVar);\n    }\n\n    @Test\n    public void testAdaptObjectInCollection() throws Exception {\n        JsonbAdapter<?, ?>[] adapters = {new BoxToCrateCompatibleGenericsAdapter<Integer>() {\n        }};\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().setProperty(JsonbConfig.ADAPTERS, adapters));\n\n        AdaptedPojo<Integer> pojo = new AdaptedPojo<>();\n\n        pojo.tGenericBoxList = new ArrayList<>();\n        pojo.tGenericBoxList.add(new GenericBox<>(\"GEN_BOX_STR_1\", 110));\n        pojo.tGenericBoxList.add(new GenericBox<>(\"GEN_BOX_STR_2\", 101));\n\n        String marshalledJson = jsonb.toJson(pojo, new TestTypeToken<AdaptedPojo<Integer>>(){}.getType());\n        assertEquals(\"{\\\"tGenericBoxList\\\":[{\\\"adaptedT\\\":110,\\\"crateStrField\\\":\\\"GEN_BOX_STR_1\\\"},{\\\"adaptedT\\\":101,\\\"crateStrField\\\":\\\"GEN_BOX_STR_2\\\"}]}\", marshalledJson);\n\n        String toUnmarshall = \"{\\\"integerList\\\":[11,22,33,44],\\\"stringList\\\":[\\\"first\\\",\\\"second\\\"],\" +\n                \"\\\"tGenericBoxList\\\":[{\\\"crateStrField\\\":\\\"FirstCrate\\\",\\\"adaptedT\\\":11},{\\\"crateStrField\\\":\\\"SecondCrate\\\",\\\"adaptedT\\\":22}]}\";\n\n        AdaptedPojo<Integer> result = jsonb.fromJson(toUnmarshall, new TestTypeToken<AdaptedPojo<Integer>>(){}.getType());\n        assertEquals(\"FirstCrate\", result.tGenericBoxList.get(0).getStrField());\n        assertEquals(\"SecondCrate\", result.tGenericBoxList.get(1).getStrField());\n        assertEquals(Integer.valueOf(11), result.tGenericBoxList.get(0).getX());\n        assertEquals(Integer.valueOf(22), result.tGenericBoxList.get(1).getX());\n    }\n\n    @Test\n    public void testAdaptTypeIntoCollection() throws Exception {\n\n        JsonbAdapter<?, ?>[] adapters = {new JsonbAdapter<String, List<Integer>>() {\n            @Override\n            public List<Integer> adaptToJson(String s) {\n                List<Integer> result = new ArrayList<>();\n                for (String str : s.split(\",\")) {\n                    result.add(Integer.parseInt(str));\n                }\n                return result;\n            }\n\n            @Override\n            public String adaptFromJson(List<Integer> ints) {\n                StringBuilder sb = new StringBuilder();\n                for (Integer i : ints) {\n                    if (!sb.toString().isEmpty()) {\n                        sb.append(\",\");\n                    }\n                    sb.append(i);\n                }\n                return sb.toString();\n            }\n        }\n        };\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().setProperty(JsonbConfig.ADAPTERS, adapters));\n\n        String json = \"{\\\"strValues\\\":[11,22,33]}\";\n        final NonGenericPojo object = new NonGenericPojo();\n        object.strValues = \"11,22,33\";\n        assertEquals(json, jsonb.toJson(object));\n        NonGenericPojo pojo = jsonb.fromJson(json, NonGenericPojo.class);\n        assertEquals(\"11,22,33\", pojo.strValues);\n    }\n\n    @Test\n    public void testMarshallGenericField() throws Exception {\n        JsonbAdapter<?, ?>[] adapters = {new BoxToCratePropagatedIntegerStringAdapter()};\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().setProperty(JsonbConfig.ADAPTERS, adapters));\n\n        AdaptedPojo<Integer> adaptedPojo = new AdaptedPojo<>();\n        adaptedPojo.tBox = new GenericBox<>(\"tGenBoxStrField\", 22);\n        adaptedPojo.intBox = new GenericBox<>(\"genBoxStrField\", 11);\n        String json = jsonb.toJson(adaptedPojo, new TestTypeToken<AdaptedPojo<Integer>>(){}.getType());\n        assertEquals(\"{\\\"intBox\\\":{\\\"adaptedT\\\":{\\\"x\\\":[\\\"11\\\"]},\\\"crateStrField\\\":\\\"genBoxStrField\\\"},\\\"tBox\\\":{\\\"adaptedT\\\":{\\\"x\\\":[\\\"22\\\"]},\\\"crateStrField\\\":\\\"tGenBoxStrField\\\"}}\", json);\n\n        AdaptedPojo<Integer> unmarshalledAdaptedPojo = jsonb.fromJson(json, new TestTypeToken<AdaptedPojo<Integer>>(){}.getType());\n        assertEquals(\"genBoxStrField\", unmarshalledAdaptedPojo.intBox.getStrField());\n        assertEquals(Integer.valueOf(11), unmarshalledAdaptedPojo.intBox.getX());\n    }\n\n    @Test\n    public void testTypeVariable() throws Exception {\n        JsonbAdapter<?, ?>[] adapters = {new JsonbAdapter<List<GenericBox<Double>>, BigDecimal>() {\n            @Override\n            public BigDecimal adaptToJson(List<GenericBox<Double>> genericBoxes) {\n                return BigDecimal.valueOf(genericBoxes.get(0).getX());\n            }\n\n            @Override\n            public List<GenericBox<Double>> adaptFromJson(BigDecimal bigDecimal) {\n                List<GenericBox<Double>> list = new ArrayList<>();\n                list.add(new GenericBox<>(\"\", bigDecimal.doubleValue()));\n                return list;\n            }\n        }};\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().setProperty(JsonbConfig.ADAPTERS, adapters));\n\n        AdaptedPojo<List<GenericBox<Double>>> intBoxPojo = new AdaptedPojo<>();\n        List<GenericBox<Double>> intBoxList = new ArrayList<>();\n        intBoxList.add(new GenericBox<>(\"\", 11d));\n        intBoxPojo.tVar = intBoxList;\n\n        String json = jsonb.toJson(intBoxPojo, new TestTypeToken<AdaptedPojo<List<GenericBox<Double>>>>(){}.getType());\n        assertEquals(\"{\\\"tVar\\\":11.0}\", json);\n\n        AdaptedPojo<List<GenericBox<Double>>> result = jsonb.fromJson(json, new TestTypeToken<AdaptedPojo<List<GenericBox<Double>>>>(){}.getType());\n        assertEquals(Double.valueOf(11), result.tVar.get(0).getX());\n    }\n\n    @Test\n    public void testAdaptRoot() throws Exception {\n\n        JsonbAdapter<?, ?>[] adapters = {new JsonbAdapter<Box, Crate>() {\n            @Override\n            public Crate adaptToJson(Box box) {\n                return new Crate(box.getBoxStrField(), box.getBoxIntegerField());\n            }\n\n            @Override\n            public Box adaptFromJson(Crate crate) {\n                return new Box(crate.getCrateStrField(), crate.getCrateIntField());\n            }\n        }};\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().setProperty(JsonbConfig.ADAPTERS, adapters));\n\n        Box pojo = new Box(\"BOX_STR\", 101);\n        String marshalledJson = jsonb.toJson(pojo);\n        assertEquals(\"{\\\"crateIntField\\\":101,\\\"crateStrField\\\":\\\"BOX_STR\\\"}\", marshalledJson);\n\n        Box result = jsonb.fromJson(\"{\\\"crateIntField\\\":110,\\\"crateStrField\\\":\\\"CRATE_STR\\\"}\", Box.class);\n        assertEquals(\"CRATE_STR\", result.getBoxStrField());\n        assertEquals(Integer.valueOf(110), result.getBoxIntegerField());\n    }\n\n    @Test\n    public void testAdaptMapString() throws Exception {\n\n        JsonbAdapter<?, ?>[] adapters = {new JsonbAdapter<Map<String, Integer>, String>() {\n            @Override\n            public Map<String, Integer> adaptFromJson(String obj) throws Exception {\n                final HashMap<String, Integer> result = new HashMap<>();\n                result.put(\"fake\", 101);\n                return result;\n            }\n\n            @Override\n            public String adaptToJson(Map<String, Integer> obj) throws Exception {\n                StringBuilder sb = new StringBuilder();\n                for (Map.Entry<String, Integer> entry : obj.entrySet()) {\n                    if (sb.length() > 0) {\n                        sb.append(\"#\");\n                    }\n                    sb.append(entry.getKey()).append(\"-\").append(entry.getValue());\n                }\n                return sb.toString();\n            }\n        }};\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().setProperty(JsonbConfig.ADAPTERS, adapters));\n\n        AdaptedPojo<Integer> pojo = new AdaptedPojo<>();\n        pojo.stringIntegerMap = new HashMap<>();\n        pojo.stringIntegerMap.put(\"first\", 11);\n        pojo.stringIntegerMap.put(\"second\", 22);\n        pojo.tMap = new HashMap<>(pojo.stringIntegerMap);\n        String marshalledJson = jsonb.toJson(pojo, new AdaptedPojo<Integer>(){}.getClass());\n        assertEquals(\"{\\\"stringIntegerMap\\\":\\\"first-11#second-22\\\",\\\"tMap\\\":\\\"first-11#second-22\\\"}\", marshalledJson);\n\n        AdaptedPojo<Integer> result = jsonb.fromJson(\"{\\\"stringIntegerMap\\\":\\\"fake-value\\\",\\\"tMap\\\":\\\"fake-value\\\"}\", new TestTypeToken<AdaptedPojo<Integer>>(){}.getType());\n        assertEquals(Integer.valueOf(101), result.stringIntegerMap.get(\"fake\"));\n        assertEquals(Integer.valueOf(101), result.tMap.get(\"fake\"));\n    }\n\n    @Test\n    public void testAdaptMapToObject() throws Exception {\n        JsonbAdapter<?, ?>[] adapters = {new JsonbAdapter<Map<String, String>, Crate>() {\n            @Override\n            public Map<String, String> adaptFromJson(Crate obj) throws Exception {\n                final HashMap<String, String> fake = new HashMap<>();\n                fake.put(\"fake\", \"11\");\n                return fake;\n            }\n\n            @Override\n            public Crate adaptToJson(Map<String, String> obj) throws Exception {\n                final Map.Entry<String, String> next = obj.entrySet().iterator().next();\n                return new Crate(next.getKey(), Integer.parseInt(next.getValue()));\n            }\n        }};\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().setProperty(JsonbConfig.ADAPTERS, adapters));\n\n        AdaptedPojo<String> pojo = new AdaptedPojo<>();\n        pojo.tMap = new HashMap<>();\n        pojo.tMap.put(\"first\", \"101\");\n\n        TestTypeToken<AdaptedPojo<String>> typeToken = new TestTypeToken<AdaptedPojo<String>>() {};\n\n        String marshalledJson = jsonb.toJson(pojo, typeToken.getType());\n        assertEquals(\"{\\\"tMap\\\":{\\\"crateIntField\\\":101,\\\"crateStrField\\\":\\\"first\\\"}}\", marshalledJson);\n\n        AdaptedPojo<String> result = jsonb.fromJson(\"{\\\"tMap\\\":{\\\"crateIntField\\\":101,\\\"crateStrField\\\":\\\"first\\\"}}\", typeToken.getType());\n        assertEquals(\"11\", result.tMap.get(\"fake\"));\n    }\n\n    @Test\n    public void testAdaptJsonObject() {\n        JsonObjectPojo pojo = new JsonObjectPojo();\n        pojo.box = new Box(\"strFieldValue\", 110);\n\n        String json = defaultJsonb.toJson(pojo);\n        assertEquals(\"{\\\"box\\\":{\\\"boxStrField\\\":\\\"strFieldValue\\\",\\\"boxIntegerField\\\":110}}\", json);\n\n        JsonObjectPojo result = defaultJsonb.fromJson(json, JsonObjectPojo.class);\n        assertEquals(\"strFieldValue\", result.box.getBoxStrField());\n        assertEquals(Integer.valueOf(110), result.box.getBoxIntegerField());\n    }\n\n    @Test\n    public void testAdaptAuthor() {\n        Author author = new Author();\n        author.setFirstName(\"John\");\n        author.setLastName(\"Connor\");\n\n        String json = defaultJsonb.toJson(author);\n        assertEquals(\"{\\\"firstName\\\":\\\"J\\\",\\\"lastName\\\":\\\"Connor\\\"}\", json);\n\n        Author result = defaultJsonb.fromJson(\"{\\\"firstName\\\":\\\"J\\\",\\\"lastName\\\":\\\"Connor\\\"}\", Author.class);\n        assertEquals(\"\\\"J\\\"\", result.getFirstName());\n        assertEquals(\"Connor\", result.getLastName());\n    }\n\n    @Test\n    public void testAdapterReturningNull() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withAdapters(new ReturnNullAdapter()).withNullValues(true));\n\n        ScalarValueWrapper<Number> wrapper = new ScalarValueWrapper<>();\n        wrapper.setValue(10);\n        Type type = new TestTypeToken<ScalarValueWrapper<Number>>() {\n        }.getType();\n        String json = jsonb.toJson(wrapper, type);\n\n        assertEquals(\"{\\\"value\\\":null}\", json);\n\n        ScalarValueWrapper<Number> result = jsonb.fromJson(\"{\\\"value\\\":null}\", type);\n        assertNull(result.getValue());\n    }\n\n    @Test\n    public void testAdaptUUID() {\n        UUIDContainer pojo = new UUIDContainer();\n        UUID uuid = UUID.fromString(\"b329da91-0d96-44b6-b466-56c2458b2877\");\n        pojo.setUuidClsBased(uuid);\n        pojo.setUuidIfcBased(uuid);\n\n        String result = defaultJsonb.toJson(pojo);\n        assertEquals(\"{\\\"uuidClsBased\\\":\\\"b329da91-0d96-44b6-b466-56c2458b2877\\\",\\\"uuidIfcBased\\\":\\\"b329da91-0d96-44b6-b466-56c2458b2877\\\"}\", result);\n\n        UUIDContainer uuidContainer = defaultJsonb.fromJson(result, UUIDContainer.class);\n        assertEquals(uuid, uuidContainer.getUuidClsBased());\n        assertEquals(uuid, uuidContainer.getUuidIfcBased());\n    }\n\n    @Test\n    public void testSupertypeAdapter() {\n        SupertypeAdapterPojo pojo = new SupertypeAdapterPojo();\n        pojo.setNumberInteger(10);\n        pojo.setSerializableInteger(11);\n        assertEquals(\"{\\\"numberInteger\\\":\\\"11\\\",\\\"serializableInteger\\\":12}\", defaultJsonb.toJson(pojo));\n        pojo = defaultJsonb.fromJson(\"{\\\"numberInteger\\\":\\\"11\\\",\\\"serializableInteger\\\":12}\", SupertypeAdapterPojo.class);\n        assertEquals(Integer.valueOf(10), pojo.getNumberInteger());\n        assertEquals(Integer.valueOf(11), pojo.getSerializableInteger());\n    }\n    \n    public static class PropertyTypeMismatch {\n        private Throwable error = new RuntimeException(\"foo\");\n        \n        public Optional<Throwable> getError() {\n            return Optional.ofNullable(error);\n        }\n        \n        public void setError(Instant errorTime) {\n            this.error = new RuntimeException(\"Error at: \" + errorTime.toString());\n        }\n    }        \n    \n    public static class ThrowableAdapter implements JsonbAdapter<Throwable, Map<String, Object>> {\n\n        public int callCount = 0;\n\n        @Override\n        public Map<String, Object> adaptToJson(Throwable obj) throws Exception {\n            HashMap<String, Object> output = new HashMap<>();\n            output.put(\"message\", obj.getMessage());\n            output.put(\"type\", obj.getClass().getName());\n            callCount++;\n\n            return unmodifiableMap(output);\n        }\n\n        @Override\n        public Throwable adaptFromJson(Map<String, Object> obj) throws Exception {\n            throw new UnsupportedOperationException(\"not implemented\");\n        }\n    }\n    \n    /**\n     * Serialize a class that has mismatching properties. The field is of type\n     * Throwable but the getter method is of type Optional<Throwable>. The user-defined\n     * adapter for Throwable should still be called.\n     */\n    @Test\n    public void testOptionalAdapter() {\n        ThrowableAdapter adapter = new ThrowableAdapter();\n        Jsonb jsonb = JsonbBuilder.newBuilder().withConfig(new JsonbConfig().withAdapters(adapter)).build();\n        \n        PropertyTypeMismatch obj = new PropertyTypeMismatch();\n        String json = jsonb.toJson(obj);\n        assertEquals(\"{\\\"error\\\":{\\\"message\\\":\\\"foo\\\",\\\"type\\\":\\\"java.lang.RuntimeException\\\"}}\", json);\n        assertEquals(1, adapter.callCount, \"The user-defined ThrowableAdapter should have been called\");\n    }\n    \n    public static class InstantAdapter implements JsonbAdapter<Instant, String> {\n\n        public int callCount = 0;\n\n        @Override\n        public String adaptToJson(Instant obj) throws Exception {\n            return obj.toString();\n        }\n\n        @Override\n        public Instant adaptFromJson(String obj) throws Exception {\n            callCount++;\n            if (obj.equals(\"CUSTOM_VALUE\"))\n                return Instant.MAX;\n            return Instant.parse(obj);\n        }\n    }\n    \n    /**\n     * Make sure that the same property can use a different adapter for\n     * serialization and deserialization.\n     */\n    @Test\n    public void testDifferentAdapters() {\n        ThrowableAdapter throwableAdapter = new ThrowableAdapter();\n        InstantAdapter instantAdapter = new InstantAdapter();\n        Jsonb jsonb = JsonbBuilder.newBuilder()\n                .withConfig(new JsonbConfig().withAdapters(throwableAdapter, instantAdapter))\n                .build();\n        \n        String json = \"{\\\"error\\\":\\\"CUSTOM_VALUE\\\"}\";\n        PropertyTypeMismatch obj = jsonb.fromJson(json, PropertyTypeMismatch.class);\n        assertEquals(\"Error at: +1000000000-12-31T23:59:59.999999999Z\", obj.getError().get().getMessage());\n        assertEquals(1, instantAdapter.callCount);\n        \n        String afterJson = jsonb.toJson(obj);\n        assertEquals(\"{\\\"error\\\":{\\\"message\\\":\\\"Error at: +1000000000-12-31T23:59:59.999999999Z\\\",\\\"type\\\":\\\"java.lang.RuntimeException\\\"}}\", \n                afterJson);\n        assertEquals(1, throwableAdapter.callCount);\n    }\n    \n    public static class StringAdapter implements JsonbAdapter<String, String> {\n\t\t@Override\n\t\tpublic String adaptToJson(String obj) throws Exception {\n\t\t\treturn obj.toUpperCase();\n\t\t}\n\n\t\t@Override\n\t\tpublic String adaptFromJson(String obj) throws Exception {\n\t\t\treturn obj.toLowerCase();\n\t\t}\n    }\n    \n    /**\n     * Test for: https://github.com/eclipse-ee4j/yasson/issues/346\n     */\n    @Test\n    public void testAdaptedRootType() {\n    \tJsonb jsonb = JsonbBuilder.newBuilder()\n    \t\t\t.withConfig(new JsonbConfig().withAdapters(new StringAdapter()))\n    \t\t\t.build();\n    \t\n    \tString original = \"hello world!\";\n    \tassertEquals(\"\\\"HELLO WORLD!\\\"\", jsonb.toJson(original));\n    \tassertEquals(original, jsonb.fromJson(\"\\\"HELLO WORLD!\\\"\", String.class));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/JsonbTypeAdapterTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.TestTypeToken;\nimport org.eclipse.yasson.adapters.model.*;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.adapter.JsonbAdapter;\nimport jakarta.json.bind.annotation.JsonbTypeAdapter;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class JsonbTypeAdapterTest {\n\n    public static class BoxToStringAdapter implements JsonbAdapter<Box, String> {\n\n        @Override\n        public Box adaptFromJson(String obj) throws Exception {\n            String[] strings = obj.split(\":\");\n            return new Box(strings[0], Integer.valueOf(strings[1]));\n        }\n\n        @Override\n        public String adaptToJson(Box obj) throws Exception {\n            return obj.getBoxStrField()+\":\"+obj.getBoxIntegerField();\n        }\n    }\n\n    public static class IncompatibleAdapterPojo<T,X> {\n\n        @JsonbTypeAdapter(BoxToStringAdapter.class)\n        public String str;\n\n    }\n\n    public static class AnnotatedPojo<T,X> {\n\n        @JsonbTypeAdapter(BoxToStringAdapter.class)\n        public Box box;\n        @JsonbTypeAdapter(BoxToCratePropagatedIntegerStringAdapter.class)\n        public GenericBox<T> tBox;\n        @JsonbTypeAdapter(BoxToCratePropagatedIntegerStringAdapter.class)\n        public GenericBox<X> xBox;\n    }\n\n    @Test\n    public void testIncompatibleAdapter() throws Exception {\n        IncompatibleAdapterPojo incompatibleAdapterFieldPojo = new IncompatibleAdapterPojo();\n        incompatibleAdapterFieldPojo.str = \"STR\";\n        try {\n            defaultJsonb.toJson(incompatibleAdapterFieldPojo);\n            fail();\n        } catch (JsonbException e) {\n            assertTrue(e.getMessage().startsWith(\"Adapter of runtime type class\"));\n            assertTrue(e.getMessage().contains(\"does not match property type \"));\n        }\n    }\n\n    @Test\n    public void testGenericFieldsMatch() {\n        AnnotatedPojo<Integer, String> annotatedPojo = new AnnotatedPojo<>();\n        annotatedPojo.tBox = new GenericBox<>(\"T_BOX\", 110);\n        String marshalledJson = defaultJsonb.toJson(annotatedPojo, new TestTypeToken<AnnotatedPojo<Integer, String>>(){}.getType());\n        assertEquals(\"{\\\"tBox\\\":{\\\"adaptedT\\\":{\\\"x\\\":[\\\"110\\\"]},\\\"crateStrField\\\":\\\"T_BOX\\\"}}\", marshalledJson);\n\n        AnnotatedPojo<Integer,String> result = defaultJsonb.fromJson(\"{\\\"tBox\\\":{\\\"crateStrField\\\":\\\"T_BOX\\\",\\\"adaptedT\\\":{\\\"x\\\":[\\\"110\\\"]}}}\", new TestTypeToken<AnnotatedPojo<Integer,String>>(){}.getType());\n        assertEquals(\"T_BOX\", result.tBox.getStrField());\n        assertEquals(Integer.valueOf(110), result.tBox.getX());\n    }\n\n    @Test\n    public void testAnnotatedTbox() throws Exception {\n        AnnotatedPojo pojo = new AnnotatedPojo();\n        pojo.box = new Box(\"STR\", 101);\n        String marshalledJson = defaultJsonb.toJson(pojo);\n        assertEquals(\"{\\\"box\\\":\\\"STR:101\\\"}\", marshalledJson);\n\n        AnnotatedPojo<?, ?> result = defaultJsonb.fromJson(\"{\\\"box\\\":\\\"STR:110\\\"}\", AnnotatedPojo.class);\n        assertEquals(\"STR\", result.box.getBoxStrField());\n        assertEquals(Integer.valueOf(110), result.box.getBoxIntegerField());\n    }\n\n    @Test\n    public void testBoxWithTypeAdapter() {\n        BoxWithAdapter boxWithAdapter = new BoxWithAdapter(\"STR\", 101);\n        String marshalledJson = defaultJsonb.toJson(boxWithAdapter);\n        assertEquals(\"{\\\"boxInteger\\\":101,\\\"boxStr\\\":\\\"STR\\\"}\", marshalledJson);\n\n        BoxWithAdapter result = defaultJsonb.fromJson(\"{\\\"boxInteger\\\":101,\\\"boxStr\\\":\\\"STR\\\"}\", BoxWithAdapter.class);\n        assertEquals(\"STR\", result.getBoxStrField());\n        assertEquals(Integer.valueOf(101), result.getBoxIntegerField());\n    }\n\n    @Test\n    public void testBoxWithTypeSerializer() {\n        BoxWithSerializer boxWithSerializer = new BoxWithSerializer(\"STR\", 101);\n        String marshalledJson = defaultJsonb.toJson(boxWithSerializer);\n        assertEquals(\"{\\\"boxInteger\\\":101,\\\"boxStr\\\":\\\"STR\\\"}\", marshalledJson);\n    }\n\n    @Test\n    public void testBoxWithTypeDeserializer() {\n        BoxWithDeserializer result = defaultJsonb.fromJson(\"{\\\"boxInteger\\\":101,\\\"boxStr\\\":\\\"STR\\\"}\", BoxWithDeserializer.class);\n        assertEquals(\"STR\", result.getBoxStrField());\n        assertEquals(Integer.valueOf(101), result.getBoxIntegerField());\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/AdaptedPojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport java.util.List;\nimport java.util.Map;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class AdaptedPojo<T> {\n    public String strField;\n    public Integer intField;\n    public Box box;\n    public GenericBox<Integer> intBox;\n    public GenericBox<String> strBox;\n    public GenericBox<T> tBox;\n    public List<GenericBox<T>> tGenericBoxList;\n    public List<Integer> integerList;\n    public List<String> stringList;\n    public Map<String, Integer> stringIntegerMap;\n    public Map<String, T> tMap;\n    public T tVar;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/Author.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.annotation.JsonbTypeAdapter;\n\npublic class Author {\n    @JsonbTypeAdapter(FirstNameAdapter.class)\n    private String firstName;\n    private String lastName;\n\n    public String getFirstName() {\n        return firstName;\n    }\n\n    public void setFirstName(String firstName) {\n        this.firstName = firstName;\n    }\n\n    public String getLastName() {\n        return lastName;\n    }\n\n    public void setLastName(String lastName) {\n        this.lastName = lastName;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/Box.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class Box {\n\n    private String boxStrField;\n\n    private Integer boxIntegerField;\n\n    public Box() {\n    }\n\n    public Box(String boxStrField, Integer boxIntegerField) {\n        this.boxStrField = boxStrField;\n        this.boxIntegerField = boxIntegerField;\n    }\n\n    public String getBoxStrField() {\n        return boxStrField;\n    }\n\n    public void setBoxStrField(String boxStrField) {\n        this.boxStrField = boxStrField;\n    }\n\n    public Integer getBoxIntegerField() {\n        return boxIntegerField;\n    }\n\n    public void setBoxIntegerField(Integer boxIntegerField) {\n        this.boxIntegerField = boxIntegerField;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/BoxToCrateCompatibleGenericsAdapter.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.adapter.JsonbAdapter;\n\n/**\n * @author Roman Grigoriadi\n */\npublic abstract class BoxToCrateCompatibleGenericsAdapter<T> implements JsonbAdapter<GenericBox<T>,GenericCrate<T>> {\n\n    @Override\n    public GenericCrate<T> adaptToJson(GenericBox<T> tGenericBox) {\n        GenericCrate<T> genericCrate = new GenericCrate<>();\n        genericCrate.setCrateStrField(tGenericBox.getStrField());\n        genericCrate.setT(tGenericBox.getX());\n        return genericCrate;\n    }\n\n    @Override\n    public GenericBox<T> adaptFromJson(GenericCrate<T> tGenericCrate) {\n        GenericBox<T> genericBox = new GenericBox<>();\n        genericBox.setStrField(tGenericCrate.getCrateStrField());\n        genericBox.setX(tGenericCrate.getT());\n        return genericBox;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/BoxToCratePropagatedIntegerStringAdapter.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class BoxToCratePropagatedIntegerStringAdapter extends BoxToCratePropagatedTypeArgsAdapter<Integer, String> {\n    @Override\n    public GenericCrate<GenericBox<List<String>>> adaptToJson(GenericBox<Integer> integerGenericBox) {\n        if (integerGenericBox == null) {\n            return null;\n        }\n        GenericCrate<GenericBox<List<String>>> crate = new GenericCrate<>();\n        crate.setCrateStrField(integerGenericBox.getStrField());\n        crate.setT(new GenericBox<>());\n        crate.getT().setX(new ArrayList<>());\n        crate.getT().getX().add(integerGenericBox.getX().toString());\n        return crate;\n    }\n\n    @Override\n    public GenericBox<Integer> adaptFromJson(GenericCrate<GenericBox<List<String>>> boxGenericCrate) {\n        if (boxGenericCrate == null) {\n            return null;\n        }\n        GenericBox<Integer> genericBox = new GenericBox<>();\n        genericBox.setStrField(boxGenericCrate.getCrateStrField());\n        genericBox.setX(Integer.parseInt(boxGenericCrate.getT().getX().get(0)));\n        return genericBox;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/BoxToCratePropagatedTypeArgsAdapter.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.adapter.JsonbAdapter;\nimport java.util.List;\n\n/**\n * @author Roman Grigoriadi\n */\npublic abstract class BoxToCratePropagatedTypeArgsAdapter<T,X> implements JsonbAdapter<GenericBox<T>, GenericCrate<GenericBox<List<X>>>> {\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/BoxToJsonObjectAdapter.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.JsonObject;\nimport jakarta.json.JsonObjectBuilder;\nimport jakarta.json.bind.adapter.JsonbAdapter;\nimport jakarta.json.spi.JsonProvider;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class BoxToJsonObjectAdapter implements JsonbAdapter<Box, JsonObject> {\n    @Override\n    public JsonObject adaptToJson(Box obj) throws Exception {\n        final JsonObjectBuilder builder = JsonProvider.provider().createObjectBuilder();\n        builder.add(\"boxStrField\", obj.getBoxStrField());\n        builder.add(\"boxIntegerField\", obj.getBoxIntegerField());\n        return builder.build();\n    }\n\n    @Override\n    public Box adaptFromJson(JsonObject jsonObj) throws Exception {\n        Box box = new Box();\n        box.setBoxStrField(jsonObj.getString(\"boxStrField\"));\n        box.setBoxIntegerField(jsonObj.getInt(\"boxIntegerField\"));\n        return box;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/BoxWithAdapter.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.annotation.JsonbTypeAdapter;\n\n/**\n * @author David Kral\n */\n@JsonbTypeAdapter(BoxWithAdapterAdapter.class)\npublic class BoxWithAdapter {\n\n    private String boxStrField;\n\n    private Integer boxIntegerField;\n\n    public BoxWithAdapter() {\n    }\n\n    public BoxWithAdapter(String boxStrField, Integer boxIntegerField) {\n        this.boxStrField = boxStrField;\n        this.boxIntegerField = boxIntegerField;\n    }\n\n    public String getBoxStrField() {\n        return boxStrField;\n    }\n\n    public void setBoxStrField(String boxStrField) {\n        this.boxStrField = boxStrField;\n    }\n\n    public Integer getBoxIntegerField() {\n        return boxIntegerField;\n    }\n\n    public void setBoxIntegerField(Integer boxIntegerField) {\n        this.boxIntegerField = boxIntegerField;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/BoxWithAdapterAdapter.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.JsonObject;\nimport jakarta.json.JsonObjectBuilder;\nimport jakarta.json.bind.adapter.JsonbAdapter;\nimport jakarta.json.spi.JsonProvider;\n\n/**\n * @author David Kral\n */\npublic class BoxWithAdapterAdapter implements JsonbAdapter<BoxWithAdapter, JsonObject> {\n    @Override\n    public JsonObject adaptToJson(BoxWithAdapter obj) {\n        final JsonObjectBuilder builder = JsonProvider.provider().createObjectBuilder();\n        builder.add(\"boxInteger\", obj.getBoxIntegerField());\n        builder.add(\"boxStr\", obj.getBoxStrField());\n        return builder.build();\n    }\n\n    @Override\n    public BoxWithAdapter adaptFromJson(JsonObject jsonObj) {\n        BoxWithAdapter box = new BoxWithAdapter();\n        box.setBoxIntegerField(jsonObj.getInt(\"boxInteger\"));\n        box.setBoxStrField(jsonObj.getString(\"boxStr\"));\n        return box;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/BoxWithDeserializer.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.annotation.JsonbTypeDeserializer;\n\n/**\n * @author David Kral\n */\n@JsonbTypeDeserializer(BoxWithDeserializerDeserializer.class)\npublic class BoxWithDeserializer {\n\n    private String boxStrField;\n\n    private Integer boxIntegerField;\n\n    public BoxWithDeserializer() {\n    }\n\n    public BoxWithDeserializer(String boxStrField, Integer boxIntegerField) {\n        this.boxStrField = boxStrField;\n        this.boxIntegerField = boxIntegerField;\n    }\n\n    public String getBoxStrField() {\n        return boxStrField;\n    }\n\n    public void setBoxStrField(String boxStrField) {\n        this.boxStrField = boxStrField;\n    }\n\n    public Integer getBoxIntegerField() {\n        return boxIntegerField;\n    }\n\n    public void setBoxIntegerField(Integer boxIntegerField) {\n        this.boxIntegerField = boxIntegerField;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/BoxWithDeserializerDeserializer.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.stream.JsonParser;\nimport java.lang.reflect.Type;\n\n/**\n * @author David Kral\n */\npublic class BoxWithDeserializerDeserializer implements JsonbDeserializer<BoxWithDeserializer> {\n\n    @Override\n    public BoxWithDeserializer deserialize(JsonParser jsonParser, DeserializationContext ctx, Type type) {\n        BoxWithDeserializer box = new BoxWithDeserializer();\n        while (jsonParser.hasNext()) {\n            JsonParser.Event next = jsonParser.next();\n            if (next.equals(JsonParser.Event.KEY_NAME) && jsonParser.getString().equals(\"boxInteger\")) {\n                box.setBoxIntegerField(ctx.deserialize(Integer.class, jsonParser));\n            } else if (next.equals(JsonParser.Event.KEY_NAME) && jsonParser.getString().equals(\"boxStr\")) {\n                box.setBoxStrField(ctx.deserialize(String.class, jsonParser));\n            }\n        }\n        return box;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/BoxWithSerializer.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.annotation.JsonbTypeSerializer;\n\n/**\n * @author David Kral\n */\n@JsonbTypeSerializer(BoxWithSerializerSerializer.class)\npublic class BoxWithSerializer {\n\n    private String boxStrField;\n\n    private Integer boxIntegerField;\n\n    public BoxWithSerializer() {\n    }\n\n    public BoxWithSerializer(String boxStrField, Integer boxIntegerField) {\n        this.boxStrField = boxStrField;\n        this.boxIntegerField = boxIntegerField;\n    }\n\n    public String getBoxStrField() {\n        return boxStrField;\n    }\n\n    public void setBoxStrField(String boxStrField) {\n        this.boxStrField = boxStrField;\n    }\n\n    public Integer getBoxIntegerField() {\n        return boxIntegerField;\n    }\n\n    public void setBoxIntegerField(Integer boxIntegerField) {\n        this.boxIntegerField = boxIntegerField;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/BoxWithSerializerSerializer.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\n\n/**\n * @author David Kral\n */\npublic class BoxWithSerializerSerializer implements JsonbSerializer<BoxWithSerializer> {\n\n    @Override\n    public void serialize(BoxWithSerializer boxWithSerializer, JsonGenerator jsonGenerator, SerializationContext serializationContext) {\n        jsonGenerator\n                .writeStartObject()\n                .writeKey(\"boxInteger\").write(boxWithSerializer.getBoxIntegerField())\n                .writeKey(\"boxStr\").write(boxWithSerializer.getBoxStrField())\n                .writeEnd();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/Chain.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\npublic class Chain {\n    \n    private String name;\n    private Chain linksTo;\n    private Foo has;\n    \n    public Chain(String name) {\n        this.name = name;\n    }\n    \n    public Chain() {\n    }\n\n    public String getName() {\n        return name;\n    }\n    public void setName(String name) {\n        this.name = name;\n    }\n    public Chain getLinksTo() {\n        return linksTo;\n    }\n    public void setLinksTo(Chain linksTo) {\n        this.linksTo = linksTo;\n    }\n    public Foo getHas() {\n        return has;\n    }\n    public void setHas(Foo has) {\n        this.has = has;\n    }\n    \n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/ChainAdapter.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport java.util.LinkedHashMap;\nimport java.util.Map;\n\nimport jakarta.json.bind.adapter.JsonbAdapter;\n\npublic class ChainAdapter implements JsonbAdapter<Chain, Map<String, Object>>{\n\n    @Override\n    public Map<String, Object> adaptToJson(Chain obj) throws Exception {\n        Map<String, Object> map = new LinkedHashMap<>();\n        map.put(\"has\", obj.getHas());\n        map.put(\"linksTo\", obj.getLinksTo());\n        map.put(\"name\", obj.getName());\n        return map;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public Chain adaptFromJson(Map<String, Object> obj) throws Exception {\n        if(obj != null) {\n            Chain chain = new Chain((String) obj.get(\"name\"));\n            chain.setHas((Foo) obj.get(\"has\"));\n            adaptFromJson((Map<String, Object>) obj.get(\"linksTo\"));\n            return chain;\n        } else {\n            return null;\n        }\n        \n    }\n    \n}"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/ChainSerializer.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\n\npublic class ChainSerializer implements JsonbSerializer<Chain>{\n    \n    public static final String RECURSIVE_REFERENCE_ERROR = \"There is a recursive reference\";\n    \n    @Override\n    public void serialize(Chain obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.writeStartObject();\n        if(obj.getHas() != null) {\n            ctx.serialize(\"has\", obj.getHas(), generator);\n        }\n        if(obj.getLinksTo() != null) {\n            ctx.serialize(\"linksTo\", obj.getLinksTo(), generator);\n        }\n        generator.write(\"name\", obj.getName());\n        generator.writeEnd();\n    }\n    \n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/Crate.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class Crate {\n\n    private String crateStrField;\n\n    private Integer crateIntField;\n\n    public Crate() {\n    }\n\n    public Crate(String crateStrField, Integer crateIntField) {\n        this.crateStrField = crateStrField;\n        this.crateIntField = crateIntField;\n    }\n\n    public String getCrateStrField() {\n        return crateStrField;\n    }\n\n    public void setCrateStrField(String crateStrField) {\n        this.crateStrField = crateStrField;\n    }\n\n    public Integer getCrateIntField() {\n        return crateIntField;\n    }\n\n    public void setCrateIntField(Integer crateIntField) {\n        this.crateIntField = crateIntField;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/FirstNameAdapter.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.Json;\nimport jakarta.json.JsonValue;\nimport jakarta.json.bind.adapter.JsonbAdapter;\n\npublic class FirstNameAdapter implements JsonbAdapter<String, JsonValue> {\n    @Override\n    public JsonValue adaptToJson(String firstName) {\n        return Json.createValue(firstName.subSequence(0,1).toString());\n    }\n    @Override\n    public String adaptFromJson(JsonValue json) {\n        return json.toString();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/Foo.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\npublic class Foo {\n    \n    private String bar;\n\n    public Foo(String bar) {\n        this.bar = bar;\n    }\n\n    public String getBar() {\n        return bar;\n    }\n\n    public void setBar(String bar) {\n        this.bar = bar;\n    }\n    \n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/FooAdapter.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport jakarta.json.bind.adapter.JsonbAdapter;\n\npublic class FooAdapter implements JsonbAdapter<Foo, Map<String, String>>{\n\n    @Override\n    public Map<String, String> adaptToJson(Foo obj) throws Exception {\n        Map<String, String> map = new HashMap<>();\n        map.put(\"bar\", obj.getBar());\n        return map;\n    }\n\n    @Override\n    public Foo adaptFromJson( Map<String, String> obj) throws Exception {\n        return new Foo(obj.get(\"bar\").toString());\n    }\n    \n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/FooSerializer.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\n\npublic class FooSerializer implements JsonbSerializer<Foo>{\n    \n    @Override\n    public void serialize(Foo obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.writeStartObject();\n        generator.write(\"bar\", obj.getBar());\n        generator.writeEnd(); \n    }\n    \n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/GenericBox.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class GenericBox<X> {\n\n    private String strField;\n\n    private X x;\n\n    public GenericBox(String strField, X x) {\n        this.strField = strField;\n        this.x = x;\n    }\n\n    public GenericBox() {\n    }\n\n    public X getX() {\n        return x;\n    }\n\n    public String getStrField() {\n        return strField;\n    }\n\n    public void setStrField(String strField) {\n        this.strField = strField;\n    }\n\n    public void setX(X x) {\n        this.x = x;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/GenericCrate.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class GenericCrate<T> {\n\n    private String crateStrField;\n\n    @JsonbProperty(\"adaptedT\")\n    private T t;\n\n    public GenericCrate(String crateStrField, T t) {\n        this.crateStrField = crateStrField;\n        this.t = t;\n    }\n\n    public GenericCrate() {\n    }\n\n    public String getCrateStrField() {\n        return crateStrField;\n    }\n\n    public T getT() {\n        return t;\n    }\n\n    public void setCrateStrField(String crateStrField) {\n        this.crateStrField = crateStrField;\n    }\n\n    public void setT(T t) {\n        this.t = t;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/IntegerListToStringAdapter.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.adapter.JsonbAdapter;\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class IntegerListToStringAdapter implements JsonbAdapter<List<Integer>, String> {\n\n    @Override\n    public String adaptToJson(List<Integer> integers) {\n        StringBuilder sb = new StringBuilder();\n        for (Integer integer : integers) {\n            if (!sb.toString().isEmpty()) {\n                sb.append(\"#\");\n            }\n            sb.append(integer);\n        }\n        return sb.toString();\n    }\n\n    @Override\n    public List<Integer> adaptFromJson(String s) {\n        String[] items = s.split(\"#\");\n        List<Integer> integerList = new ArrayList<>();\n        for (String item : items) {\n            integerList.add(Integer.parseInt(item));\n        }\n        return integerList;\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/JsonObjectPojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.annotation.JsonbTypeAdapter;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class JsonObjectPojo {\n\n    @JsonbTypeAdapter(BoxToJsonObjectAdapter.class)\n    public Box box;\n\n    public GenericBox<Box> genericBox;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/LocalPolymorphicAdapter.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.adapter.JsonbAdapter;\nimport java.lang.reflect.Constructor;\nimport java.util.stream.Stream;\n\n/**\n * Causes {@link StackOverflowError} if recursive calls of user components are not checked by runtime.\n */\npublic abstract class LocalPolymorphicAdapter<T> implements JsonbAdapter<T, LocalTypeWrapper<T>> {\n\n    private final String[] allowedClasses;\n\n    /**\n     * Create new instance.\n     *\n     * @param allowedClasses allowed classes for loading by name\n     */\n    public LocalPolymorphicAdapter(final Class... allowedClasses) {\n        this.allowedClasses = Stream.of(allowedClasses).map(Class::getName).toArray(value -> new String[allowedClasses.length]);\n    }\n\n    /**\n     * Returns all classes which are allowed for loading.\n     *\n     * @return allowed classes for loading by name\n     */\n    public String[] getAllowedClasses() {\n        return allowedClasses;\n    }\n\n    @Override\n    public LocalTypeWrapper<T> adaptToJson(T obj) throws Exception {\n        LocalTypeWrapper<T> wrapper = new LocalTypeWrapper<>();\n        wrapper.setClassName(obj.getClass().getName());\n        wrapper.setInstance(obj);\n        return wrapper;\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public final T adaptFromJson(LocalTypeWrapper<T> obj) throws Exception {\n        if (!isAllowed(obj.getClassName())) {\n            throw new ClassNotFoundException(obj.getClassName());\n        }\n        Constructor<T> constructor = (Constructor<T>) Class.forName(obj.getClassName()).getConstructor();\n        T instance = constructor.newInstance();\n        populateInstance(instance, obj);\n        return instance;\n    }\n\n    protected abstract void populateInstance(T instance, LocalTypeWrapper<T> obj);\n\n    private boolean isAllowed(String name) {\n        for (String className : allowedClasses) {\n            if (className.equals(name)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/LocalTypeWrapper.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\n/**\n * Created by Roman Grigoriadi (roman.grigoriadi@oracle.com) on 08/06/2017.\n */\npublic class LocalTypeWrapper<E> {\n    private String className;\n    private E instance;\n\n    /**\n     * Gets class name.\n     *\n     * @return Class name.\n     */\n    public String getClassName() {\n        return className;\n    }\n\n    /**\n     * Sets class name.\n     *\n     * @param className Class name to set.\n     */\n    public void setClassName(String className) {\n        this.className = className;\n    }\n\n    /**\n     * Gets instance.\n     *\n     * @return Instance.\n     */\n    public E getInstance() {\n        return instance;\n    }\n\n    /**\n     * Sets instance.\n     *\n     * @param instance Instance to set.\n     */\n    public void setInstance(E instance) {\n        this.instance = instance;\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/MultiinterfaceAdapter.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.adapter.JsonbAdapter;\nimport java.io.Serializable;\n\ninterface MultiinterfaceAdapter<X, T> extends Serializable, JsonbAdapter<X, T> {\n\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/MultilevelAdapterClass.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\npublic abstract class MultilevelAdapterClass<X, T> implements MultiinterfaceAdapter<X, T> {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/NumberAdapter.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.adapter.JsonbAdapter;\n\npublic class NumberAdapter implements JsonbAdapter<Number, String> {\n    @Override\n    public String adaptToJson(Number obj) throws Exception {\n        return Integer.valueOf(((Integer)obj) + 1).toString();\n    }\n\n    @Override\n    public Number adaptFromJson(String obj) throws Exception {\n        return Integer.parseInt(obj) - 1;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/ReturnNullAdapter.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.adapter.JsonbAdapter;\n\npublic class ReturnNullAdapter implements JsonbAdapter<Number, String> {\n    @Override\n    public String adaptToJson(Number obj) throws Exception {\n        return null;\n    }\n\n    @Override\n    public Number adaptFromJson(String obj) throws Exception {\n        return null;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/SerializableAdapter.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.adapter.JsonbAdapter;\nimport java.io.Serializable;\n\npublic class SerializableAdapter implements JsonbAdapter<Serializable, Integer> {\n    @Override\n    public Integer adaptToJson(Serializable obj) throws Exception {\n        return Integer.valueOf(obj.toString()) + 1;\n    }\n\n    @Override\n    public Serializable adaptFromJson(Integer obj) throws Exception {\n        return obj - 1;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/SupertypeAdapterPojo.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.annotation.JsonbTypeAdapter;\n\npublic class SupertypeAdapterPojo {\n\n    @JsonbTypeAdapter(NumberAdapter.class)\n    private Integer numberInteger;\n\n    @JsonbTypeAdapter(SerializableAdapter.class)\n    private Integer serializableInteger;\n\n    public Integer getNumberInteger() {\n        return numberInteger;\n    }\n\n    public void setNumberInteger(Integer numberInteger) {\n        this.numberInteger = numberInteger;\n    }\n\n    public Integer getSerializableInteger() {\n        return serializableInteger;\n    }\n\n    public void setSerializableInteger(Integer serializableInteger) {\n        this.serializableInteger = serializableInteger;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/UUIDContainer.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport jakarta.json.bind.annotation.JsonbTypeAdapter;\nimport java.util.UUID;\n\n\npublic class UUIDContainer {\n    @JsonbTypeAdapter(UUIDMapperClsBased.class)\n    private UUID uuidClsBased;\n\n    @JsonbTypeAdapter(UUIDMapperIfcBased.class)\n    private UUID uuidIfcBased;\n\n    public UUID getUuidClsBased() {\n        return uuidClsBased;\n    }\n\n    public void setUuidClsBased(UUID uuidClsBased) {\n        this.uuidClsBased = uuidClsBased;\n    }\n\n    public UUID getUuidIfcBased() {\n        return uuidIfcBased;\n    }\n\n    public void setUuidIfcBased(UUID uuidIfcBased) {\n        this.uuidIfcBased = uuidIfcBased;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/UUIDMapperClsBased.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport java.util.Optional;\nimport java.util.UUID;\n\npublic class UUIDMapperClsBased extends MultilevelAdapterClass<UUID, String> {\n\n    @Override\n    public String adaptToJson(UUID obj) throws Exception {\n        return Optional.ofNullable(obj).map(UUID::toString).orElse(null);\n    }\n\n    @Override\n    public UUID adaptFromJson(String obj) throws Exception {\n        return Optional.ofNullable(obj).map(UUID::fromString).orElse(null);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/adapters/model/UUIDMapperIfcBased.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.adapters.model;\n\nimport java.util.Optional;\nimport java.util.UUID;\n\npublic class UUIDMapperIfcBased implements MultiinterfaceAdapter<UUID, String> {\n\n    @Override\n    public String adaptToJson(UUID obj) throws Exception {\n        return Optional.ofNullable(obj).map(UUID::toString).orElse(null);\n    }\n\n    @Override\n    public UUID adaptFromJson(String obj) throws Exception {\n        return Optional.ofNullable(obj).map(UUID::fromString).orElse(null);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/AnnotationInheritanceTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.customization.model.InheritedAnnotationsPojo;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class AnnotationInheritanceTest {\n\n    @Test\n    public void testAnnotationInheritance() {\n        InheritedAnnotationsPojo pojo = new InheritedAnnotationsPojo();\n        String expectedJson = \"{}\";\n        assertEquals(expectedJson, defaultJsonb.toJson(pojo));\n\n        InheritedAnnotationsPojo result = defaultJsonb.fromJson(\"{\\\"renamedProperty\\\":\\\"abc\\\"}\", InheritedAnnotationsPojo.class);\n        assertEquals(\"abc\", result.property);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/EncodingTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport org.eclipse.yasson.TestTypeToken;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport java.io.ByteArrayInputStream;\nimport java.io.ByteArrayOutputStream;\nimport java.io.InputStream;\nimport java.io.UnsupportedEncodingException;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.ResourceBundle;\nimport java.util.logging.Logger;\n\n/**\n * Tests encoding to JSONP propagation\n *\n * @author Roman Grigoriadi\n */\npublic class EncodingTest {\n\n    private static final Logger logger = Logger.getLogger(EncodingTest.class.getName());\n\n    private static final String[] CZECH;\n    private static final String[] RUSSIAN;\n\n\n    static {\n        ResourceBundle messages = ResourceBundle.getBundle(\"yasson-messages\");\n        CZECH = messages.getString(\"czechDiacritics\").split(\",\");\n        RUSSIAN = messages.getString(\"russianDiacritics\").split(\",\");\n    }\n\n    @Test\n    public void testCP1250Encoding() throws UnsupportedEncodingException {\n    \tString encoding = \"cp1250\";\n    \tJsonb jsonb = JsonbBuilder.create(new JsonbConfig().withEncoding(encoding));\n    \t\n        testMarshaller(CZECH, jsonb, encoding);\n        testUnmarshaller(CZECH, jsonb, encoding);\n    }\n\n    @Test\n    public void testUTF8Encoding() throws UnsupportedEncodingException {\n    \tString encoding = \"UTF-8\";\n    \tJsonb jsonb = JsonbBuilder.create(new JsonbConfig().withEncoding(encoding));\n    \t\n        testMarshaller(CZECH, jsonb, encoding);\n        testUnmarshaller(CZECH, jsonb, encoding);\n        testMarshaller(RUSSIAN, jsonb, encoding);\n        testUnmarshaller(RUSSIAN, jsonb, encoding);\n    }\n\n    @Test\n    public void testcp1251Encoding() throws UnsupportedEncodingException {\n    \tString encoding = \"cp1251\";\n    \tJsonb jsonb = JsonbBuilder.create(new JsonbConfig().withEncoding(encoding));\n    \t\n        testMarshaller(RUSSIAN, jsonb, encoding);\n        testUnmarshaller(RUSSIAN, jsonb, encoding);\n    }\n\n    private static void testMarshaller(String[] input, Jsonb jsonb, String encoding) throws UnsupportedEncodingException {\n        List<String> strings = Arrays.asList(input);\n        ByteArrayOutputStream baos = new ByteArrayOutputStream();\n        jsonb.toJson(strings, baos);\n        String marshallerResult = baos.toString(encoding);\n        logger.finest(\"Marshaller JSON result: \"+marshallerResult);\n        assertEquals(diacriticsToJsonArray(input), marshallerResult);\n    }\n\n    private static void testUnmarshaller(String[] input, Jsonb jsonb, String encoding) throws UnsupportedEncodingException {\n        String json = diacriticsToJsonArray(input);\n        logger.finest(\"JSON for unmarshaller: \"+json);\n        InputStream bis = new ByteArrayInputStream(json.getBytes(encoding));\n        ArrayList<String> result = jsonb.fromJson(bis, new TestTypeToken<ArrayList<String>>(){}.getType());\n        assertArrayEquals(input, result.toArray(new String[result.size()]));\n    }\n\n    private static String diacriticsToJsonArray(String[] diacritics) {\n        StringBuilder sb = new StringBuilder();\n        sb.append(\"[\");\n        for (String str : diacritics) {\n            sb.append(\"\\\"\").append(str).append(\"\\\",\");\n        }\n        sb.deleteCharAt(sb.length() - 1);\n        sb.append(\"]\");\n        return sb.toString();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/ImplementationClassTest.java",
    "content": "/*\n * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.customization.model.Animal;\nimport org.eclipse.yasson.customization.model.Dog;\nimport org.eclipse.yasson.customization.model.ImplementationClassPojo;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport java.util.HashMap;\n\nimport static org.eclipse.yasson.YassonConfig.USER_TYPE_MAPPING;\n\npublic class ImplementationClassTest {\n\n    @Test\n    public void testAnnotatedImplementation() {\n        ImplementationClassPojo pojo = new ImplementationClassPojo();\n        Animal dog = new Dog(\"Bulldog\");\n        pojo.setAnimal(dog);\n        String expected = \"{\\\"animal\\\":{\\\"dogProperty\\\":\\\"Bulldog\\\"}}\";\n        String json = defaultJsonb.toJson(pojo);\n\n        assertEquals(expected, json);\n        ImplementationClassPojo result = defaultJsonb.fromJson(expected, ImplementationClassPojo.class);\n        assertTrue(result.getAnimal() instanceof Dog);\n        assertEquals(\"Bulldog\", ((Dog)result.getAnimal()).getDogProperty());\n    }\n\n    @Test\n    public void testJsonbConfigUserImplementation() {\n        HashMap<Class, Class> userMapping = new HashMap<>();\n        userMapping.put(Animal.class, Dog.class);\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().setProperty(USER_TYPE_MAPPING, userMapping));\n        Animal animal = new Dog(\"Bulldog\");\n        String expected = \"{\\\"dogProperty\\\":\\\"Bulldog\\\"}\";\n        String json = jsonb.toJson(animal);\n\n        assertEquals(expected, json);\n\n        Dog result = (Dog) jsonb.fromJson(\"{\\\"dogProperty\\\":\\\"Bulldog\\\"}\", Animal.class);\n        assertEquals(\"Bulldog\", result.getDogProperty());\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/InterfaceAnnotationsTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.customization.model.InterfacedPojoB;\nimport org.eclipse.yasson.customization.model.InterfacedPojoImpl;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class InterfaceAnnotationsTest {\n\n    @Test\n    public void testJsonbPropertyIfcInheritance() {\n        InterfacedPojoB pojo = new InterfacedPojoImpl();\n        pojo.setPropertyA(\"AA\");\n        pojo.setPropertyB(\"BB\");\n\n        final String json = \"{\\\"propA\\\":\\\"AA\\\",\\\"propB\\\":\\\"BB\\\"}\";\n        assertEquals(json, defaultJsonb.toJson(pojo));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/JsonbCreatorTest.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization;\n\nimport java.math.BigDecimal;\nimport java.time.LocalDate;\nimport java.util.Set;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport jakarta.json.bind.annotation.JsonbNumberFormat;\nimport jakarta.json.bind.annotation.JsonbProperty;\n\nimport org.eclipse.yasson.customization.model.CreatorConstructorPojo;\nimport org.eclipse.yasson.customization.model.CreatorFactoryMethodPojo;\nimport org.eclipse.yasson.customization.model.CreatorIncompatibleTypePojo;\nimport org.eclipse.yasson.customization.model.CreatorMultipleDeclarationErrorPojo;\nimport org.eclipse.yasson.customization.model.CreatorPackagePrivateConstructor;\nimport org.eclipse.yasson.customization.model.CreatorWithoutJavabeanProperty;\nimport org.eclipse.yasson.customization.model.CreatorWithoutJsonbProperty1;\nimport org.eclipse.yasson.customization.model.ParameterNameTester;\nimport org.junit.jupiter.api.Test;\n\nimport static org.eclipse.yasson.Jsonbs.defaultJsonb;\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.is;\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.assertNull;\nimport static org.junit.jupiter.api.Assertions.assertThrows;\nimport static org.junit.jupiter.api.Assertions.assertTrue;\nimport static org.junit.jupiter.api.Assertions.fail;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class JsonbCreatorTest {\n\n    @Test\n    public void testRootConstructor() {\n        String json = \"{\\\"str1\\\":\\\"abc\\\",\\\"str2\\\":\\\"def\\\",\\\"bigDec\\\":25}\";\n        CreatorConstructorPojo pojo = defaultJsonb.fromJson(json, CreatorConstructorPojo.class);\n        assertEquals(\"abc\", pojo.str1);\n        assertEquals(\"def\", pojo.str2);\n        assertEquals(new BigDecimal(\"25\"), pojo.bigDec);\n    }\n\n    @Test\n    public void testRootFactoryMethod() {\n        String json = \"{\\\"par1\\\":\\\"abc\\\",\\\"par2\\\":\\\"def\\\",\\\"bigDec\\\":25}\";\n        CreatorFactoryMethodPojo pojo = defaultJsonb.fromJson(json, CreatorFactoryMethodPojo.class);\n        assertEquals(\"abc\", pojo.str1);\n        assertEquals(\"def\", pojo.str2);\n        assertEquals(new BigDecimal(\"25\"), pojo.bigDec);\n    }\n\n    @Test\n    public void testRootCreatorWithInnerCreator() {\n        String json = \"{\\\"str1\\\":\\\"abc\\\",\\\"str2\\\":\\\"def\\\",\\\"bigDec\\\":25, \\\"innerFactoryCreator\\\":{\\\"par1\\\":\\\"inn1\\\",\\\"par2\\\":\\\"inn2\\\",\\\"bigDec\\\":11}}\";\n        CreatorConstructorPojo pojo = defaultJsonb.fromJson(json, CreatorConstructorPojo.class);\n        assertEquals(\"abc\", pojo.str1);\n        assertEquals(\"def\", pojo.str2);\n        assertEquals(new BigDecimal(\"25\"), pojo.bigDec);\n\n        assertEquals(\"inn1\", pojo.innerFactoryCreator.str1);\n        assertEquals(\"inn2\", pojo.innerFactoryCreator.str2);\n        assertEquals(new BigDecimal(\"11\"), pojo.innerFactoryCreator.bigDec);\n    }\n\n    @Test\n    public void testIncompatibleFactoryMethodReturnType() {\n        try {\n        \tdefaultJsonb.fromJson(\"{\\\"s1\\\":\\\"abc\\\"}\", CreatorIncompatibleTypePojo.class);\n            fail();\n        } catch (JsonbException e) {\n            assertTrue(e.getMessage().startsWith(\"Return type of creator\"));\n        }\n    }\n\n    @Test\n    public void testMultipleCreatorsError() {\n        try {\n        \tdefaultJsonb.fromJson(\"{\\\"s1\\\":\\\"abc\\\"}\", CreatorMultipleDeclarationErrorPojo.class);\n            fail();\n        } catch (JsonbException e) {\n            assertTrue(e.getMessage().startsWith(\"More than one @JsonbCreator\"));\n        }\n    }\n\n    @Test\n    public void testCreatorWithoutJsonbParameters1() {\n        //arg2 is missing in json document\n        CreatorWithoutJsonbProperty1 object = defaultJsonb.fromJson(\"{\\\"arg0\\\":\\\"abc\\\", \\\"s2\\\":\\\"def\\\"}\",\n                                                                    CreatorWithoutJsonbProperty1.class);\n        assertThat(object.getPar1(), is(\"abc\"));\n        assertThat(object.getPar2(), is(\"def\"));\n        assertThat(object.getPar3(), is((byte) 0));\n    }\n\n    @Test\n    public void testCreatorWithoutJavabeanProperty() {\n        final CreatorWithoutJavabeanProperty result = defaultJsonb.fromJson(\"{\\\"s1\\\":\\\"abc\\\", \\\"s2\\\":\\\"def\\\"}\", CreatorWithoutJavabeanProperty.class);\n        assertEquals(\"abcdef\", result.getStrField());\n\n    }\n\n    @Test\n    public void testPackagePrivateCreator() {\n    \tassertThrows(JsonbException.class, () -> defaultJsonb.fromJson(\"{\\\"strVal\\\":\\\"abc\\\", \\\"intVal\\\":5}\", CreatorPackagePrivateConstructor.class));\n    }\n\n    @Test\n    public void testLocalizedConstructor() {\n        String json = \"{\\\"localDate\\\":\\\"05-09-2017\\\"}\";\n        DateConstructor result = defaultJsonb.fromJson(json, DateConstructor.class);\n        assertEquals(LocalDate.of(2017, 9, 5), result.localDate);\n    }\n\n    @Test\n    public void testLocalizedConstructorMergedWithProperty() {\n        String json = \"{\\\"localDate\\\":\\\"05-09-2017\\\"}\";\n        DateConstructorMergedWithProperty result = defaultJsonb.fromJson(json, DateConstructorMergedWithProperty.class);\n        assertEquals(LocalDate.of(2017, 9, 5), result.localDate);\n    }\n\n    @Test\n    public void testLocalizedFactoryParameter() {\n        String json = \"{\\\"number\\\":\\\"10.000\\\"}\";\n        FactoryNumberParam result = defaultJsonb.fromJson(json, FactoryNumberParam.class);\n        assertEquals(BigDecimal.TEN, result.number);\n    }\n\n    @Test\n    public void testLocalizedFactoryParameterMergedWithProperty() {\n        String json = \"{\\\"number\\\":\\\"10.000\\\"}\";\n        FactoryNumberParamMergedWithProperty result = defaultJsonb.fromJson(json, FactoryNumberParamMergedWithProperty.class);\n        assertEquals(BigDecimal.TEN, result.number);\n    }\n\n    @Test\n    public void testCorrectCreatorParameterNames() {\n        String json = \"{\\\"string\\\":\\\"someText\\\", \\\"someParam\\\":null }\";\n        ParameterNameTester result = defaultJsonb.fromJson(json, ParameterNameTester.class);\n        assertEquals(\"someText\", result.name);\n        assertNull(result.secondParam);\n    }\n\n    @Test\n    public void testGenericCreatorParameter() throws Exception {\n        final String json = \"{\\\"persons\\\": [{\\\"name\\\": \\\"name1\\\"}]}\";\n        Persons persons = defaultJsonb.fromJson(json, Persons.class);\n        assertEquals(1, persons.hiddenPersons.size());\n        assertEquals(\"name1\", persons.hiddenPersons.iterator().next().getName());\n    }\n\n    public static final class Persons {\n\n        Set<Person> hiddenPersons;\n\n        private Persons(Set<Person> persons) {\n            this.hiddenPersons = persons;\n        }\n\n        @JsonbCreator\n        public static Persons wrap(@JsonbProperty(\"persons\") Set<Person> persons) {\n            return new Persons(persons);\n        }\n\n        public Set<Person> getPersons() {\n            return null;\n        }\n    }\n\n    public static final class Person {\n        private String name;\n\n        public String getName() {\n            return name;\n        }\n\n        public void setName(String name) {\n            this.name = name;\n        }\n    }\n\n\n    public static final class DateConstructor {\n        public LocalDate localDate;\n\n        @JsonbCreator\n        public DateConstructor(@JsonbProperty(\"localDate\") @JsonbDateFormat(value = \"dd-MM-yyyy\", locale = \"nl-NL\") LocalDate localDate) {\n            this.localDate = localDate;\n        }\n\n    }\n\n    public static final class DateConstructorMergedWithProperty {\n        @JsonbDateFormat(value = \"dd-MM-yyyy\", locale = \"cs-CZ\")\n        public LocalDate localDate;\n\n        @JsonbCreator\n        public DateConstructorMergedWithProperty(@JsonbProperty(\"localDate\") LocalDate localDate) {\n            this.localDate = localDate;\n        }\n\n    }\n\n    public static final class FactoryNumberParam {\n        public BigDecimal number;\n\n        private FactoryNumberParam(BigDecimal number) {\n            this.number = number;\n        }\n\n        @JsonbCreator\n        public static FactoryNumberParam createInstance(\n                @JsonbProperty(\"number\") @JsonbNumberFormat(value = \"000.000\", locale = \"en-us\")\n                        BigDecimal number) {\n            return new FactoryNumberParam(number);\n        }\n\n    }\n\n    public static final class FactoryNumberParamMergedWithProperty {\n\n        @JsonbNumberFormat(value = \"000.000\", locale = \"en-us\")\n        public BigDecimal number;\n\n        private FactoryNumberParamMergedWithProperty(BigDecimal number) {\n            this.number = number;\n        }\n\n        @JsonbCreator\n        public static FactoryNumberParamMergedWithProperty createInstance(@JsonbProperty(\"number\") BigDecimal number) {\n            return new FactoryNumberParamMergedWithProperty(number);\n        }\n\n    }\n\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/JsonbDateFormatterTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.customization.model.DateFormatPojo;\nimport org.eclipse.yasson.customization.model.DateFormatPojoWithClassLevelFormatter;\nimport org.eclipse.yasson.customization.model.TrimmedDatePojo;\nimport org.eclipse.yasson.internal.JsonBindingBuilder;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport java.time.ZoneId;\nimport java.time.ZonedDateTime;\nimport java.util.Calendar;\nimport java.util.Date;\nimport java.util.TimeZone;\n\nimport static org.eclipse.yasson.YassonConfig.ZERO_TIME_PARSE_DEFAULTING;\n\n/**\n * Tests customization of date fields via {@link jakarta.json.bind.annotation.JsonbDateFormat} annotation\n *\n * @author Ehsan Zaery Moghaddam (zaerymoghaddam@gmail.com)\n */\npublic class JsonbDateFormatterTest {\n\n    @Test\n    public void testCustomDateFormatSerialization() {\n        final Calendar timeCalendar = new Calendar.Builder()\n                .setDate(2017, Calendar.MARCH, 3)\n                .setTimeOfDay(11, 11, 10)\n                .setTimeZone(TimeZone.getTimeZone(\"UTC\"))\n                .build();\n\n        DateFormatPojo dateFormatPojo = new DateFormatPojo();\n        dateFormatPojo.plainDateField = timeCalendar.getTime();\n        dateFormatPojo.formattedDateField = timeCalendar.getTime();\n        dateFormatPojo.getterFormattedDateField = timeCalendar.getTime();\n        dateFormatPojo.setterFormattedDateField = timeCalendar.getTime();\n        dateFormatPojo.getterAndFieldFormattedDateField = timeCalendar.getTime();\n        dateFormatPojo.setterAndFieldFormattedDateField = timeCalendar.getTime();\n        dateFormatPojo.getterAndSetterFormattedDateField = timeCalendar.getTime();\n        dateFormatPojo.getterAndSetterAndFieldFormattedDateField = timeCalendar.getTime();\n\n        String expectedJson = \"{\\\"formattedDateField\\\":\\\"11:11:10 ^^ 03-03-2017\\\",\\\"getterAndFieldFormattedDateField\\\":\\\"11:11:10 <> 03-03-2017\\\",\\\"getterAndSetterAndFieldFormattedDateField\\\":\\\"11:11:10 <> 03-03-2017\\\",\\\"getterAndSetterFormattedDateField\\\":\\\"11:11:10 ^^ 03-03-2017\\\",\\\"getterFormattedDateField\\\":\\\"11:11:10 ^^ 03-03-2017\\\",\\\"plainDateField\\\":\\\"2017-03-03T11:11:10Z[UTC]\\\",\\\"setterAndFieldFormattedDateField\\\":\\\"11:11:10 ^^ 03-03-2017\\\",\\\"setterFormattedDateField\\\":\\\"2017-03-03T11:11:10Z[UTC]\\\"}\";\n\n        assertEquals(expectedJson, defaultJsonb.toJson(dateFormatPojo));\n    }\n\n    @Test\n    public void testCustomDateFormatDeserialization() {\n        final Calendar timeCalendar = new Calendar.Builder()\n                .setDate(2017, Calendar.MARCH, 3)\n                .setTimeOfDay(11, 11, 10)\n                .setTimeZone(TimeZone.getTimeZone(\"UTC\"))\n                .build();\n\n        DateFormatPojo result = defaultJsonb.fromJson(\"{\\\"formattedDateField\\\":\\\"11:11:10 ^^ 03-03-2017\\\",\\\"getterAndSetterAndFieldFormattedDateField\\\":\\\"11:11:10 $$ 03-03-2017\\\",\\\"getterAndSetterFormattedDateField\\\":\\\"11:11:10 <> 03-03-2017\\\",\\\"getterAndFieldFormattedDateField\\\":\\\"11:11:10 ^^ 03-03-2017\\\",\\\"getterFormattedDateField\\\":\\\"2017-03-03T11:11:10\\\",\\\"plainDateField\\\":\\\"2017-03-03T11:11:10\\\",\\\"setterAndFieldFormattedDateField\\\":\\\"11:11:10 <> 03-03-2017\\\",\\\"setterFormattedDateField\\\":\\\"11:11:10 ^^ 03-03-2017\\\"}\", DateFormatPojo.class);\n\n        assertEquals(timeCalendar.getTime(), result.plainDateField);\n        assertEquals(timeCalendar.getTime(), result.formattedDateField);\n        assertEquals(timeCalendar.getTime(), result.getterFormattedDateField);\n        assertEquals(timeCalendar.getTime(), result.setterFormattedDateField);\n        assertEquals(timeCalendar.getTime(), result.getterAndFieldFormattedDateField);\n        assertEquals(timeCalendar.getTime(), result.setterAndFieldFormattedDateField);\n        assertEquals(timeCalendar.getTime(), result.getterAndSetterFormattedDateField);\n        assertEquals(timeCalendar.getTime(), result.getterAndSetterAndFieldFormattedDateField);\n    }\n\n    @Test\n    public void testCustomDateFormatSerializationWithClassLevelDateFormatterDefined() {\n        final Calendar timeCalendar = new Calendar.Builder()\n                .setDate(2017, Calendar.MARCH, 3)\n                .setTimeOfDay(11, 11, 10)\n                .setTimeZone(TimeZone.getTimeZone(\"UTC\"))\n                .build();\n\n        DateFormatPojoWithClassLevelFormatter dateFormatPojo = new DateFormatPojoWithClassLevelFormatter();\n        dateFormatPojo.plainDateField = timeCalendar.getTime();\n        dateFormatPojo.formattedDateField = timeCalendar.getTime();\n        dateFormatPojo.getterFormattedDateField = timeCalendar.getTime();\n        dateFormatPojo.setterFormattedDateField = timeCalendar.getTime();\n        dateFormatPojo.getterAndFieldFormattedDateField = timeCalendar.getTime();\n        dateFormatPojo.setterAndFieldFormattedDateField = timeCalendar.getTime();\n        dateFormatPojo.getterAndSetterFormattedDateField = timeCalendar.getTime();\n        dateFormatPojo.getterAndSetterAndFieldFormattedDateField = timeCalendar.getTime();\n\n        String expectedJson = \"{\\\"formattedDateField\\\":\\\"11:11:10 ^^ 03-03-2017\\\",\\\"getterAndFieldFormattedDateField\\\":\\\"11:11:10 <> 03-03-2017\\\",\\\"getterAndSetterAndFieldFormattedDateField\\\":\\\"11:11:10 <> 03-03-2017\\\",\\\"getterAndSetterFormattedDateField\\\":\\\"11:11:10 ^^ 03-03-2017\\\",\\\"getterFormattedDateField\\\":\\\"11:11:10 ^^ 03-03-2017\\\",\\\"plainDateField\\\":\\\"11:11:10 ^ 03-03-2017\\\",\\\"setterAndFieldFormattedDateField\\\":\\\"11:11:10 ^^ 03-03-2017\\\",\\\"setterFormattedDateField\\\":\\\"11:11:10 ^ 03-03-2017\\\"}\";\n\n        assertEquals(expectedJson, defaultJsonb.toJson(dateFormatPojo));\n    }\n\n    @Test\n    public void testCustomDateFormatDeserializationWithClassLevelDateFormatterDefined() {\n        final Calendar timeCalendar = new Calendar.Builder()\n                .setDate(2017, Calendar.MARCH, 3)\n                .setTimeOfDay(11, 11, 10)\n                .setTimeZone(TimeZone.getTimeZone(\"UTC\"))\n                .build();\n\n        DateFormatPojoWithClassLevelFormatter result = defaultJsonb.fromJson(\"{\\\"formattedDateField\\\":\\\"11:11:10 ^^ 03-03-2017\\\",\\\"getterAndSetterAndFieldFormattedDateField\\\":\\\"11:11:10 $$ 03-03-2017\\\",\\\"getterAndSetterFormattedDateField\\\":\\\"11:11:10 <> 03-03-2017\\\",\\\"getterAndFieldFormattedDateField\\\":\\\"11:11:10 ^^ 03-03-2017\\\",\\\"getterFormattedDateField\\\":\\\"11:11:10 ^ 03-03-2017\\\",\\\"plainDateField\\\":\\\"11:11:10 ^ 03-03-2017\\\",\\\"setterAndFieldFormattedDateField\\\":\\\"11:11:10 <> 03-03-2017\\\",\\\"setterFormattedDateField\\\":\\\"11:11:10 ^^ 03-03-2017\\\"}\", DateFormatPojoWithClassLevelFormatter.class);\n\n        assertEquals(timeCalendar.getTime(), result.plainDateField);\n        assertEquals(timeCalendar.getTime(), result.formattedDateField);\n        assertEquals(timeCalendar.getTime(), result.getterFormattedDateField);\n        assertEquals(timeCalendar.getTime(), result.setterFormattedDateField);\n        assertEquals(timeCalendar.getTime(), result.getterAndFieldFormattedDateField);\n        assertEquals(timeCalendar.getTime(), result.setterAndFieldFormattedDateField);\n        assertEquals(timeCalendar.getTime(), result.getterAndSetterFormattedDateField);\n        assertEquals(timeCalendar.getTime(), result.getterAndSetterAndFieldFormattedDateField);\n    }\n\n    @Test\n    public void testTrimmedDateParsing() {\n        ZoneId utcZone = ZoneId.of(\"UTC\");\n        ZonedDateTime zdt = ZonedDateTime.of(2018, 1, 30, 0, 0, 0, 0, utcZone);\n\n        TrimmedDatePojo pojo = new TrimmedDatePojo();\n        pojo.setDate(Date.from(zdt.toInstant()));\n        Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone(utcZone));\n        calendar.setTime(pojo.getDate());\n        pojo.setCalendar(calendar);\n        pojo.setLocalDateTime(zdt.toLocalDateTime());\n        pojo.setZonedDateTime(zdt);\n        pojo.setZonedDateTimeNanosOfDay(zdt.plusNanos(3000));\n        pojo.setZonedDateTimeHoursAndSeconds(zdt);\n        pojo.setZonedDateTimeOverriddenZone(zdt.withZoneSameInstant(ZoneId.of(\"Europe/Paris\")));\n        pojo.setZonedInstant(zdt.withZoneSameInstant(ZoneId.of(\"Europe/Paris\")).toInstant());\n\n        Jsonb zeroDefaultingJsonb = new JsonBindingBuilder()\n                .withConfig(new JsonbConfig().setProperty(ZERO_TIME_PARSE_DEFAULTING, true))\n                .build();\n\n        String serialized = zeroDefaultingJsonb.toJson(pojo);\n        assertEquals(\n                \"{\\\"calendar\\\":\\\"2018.01.30\\\",\\\"date\\\":\\\"2018.01.30\\\",\\\"localDateTime\\\":\\\"2018.01.30\\\",\\\"zonedDateTime\\\":\\\"2018.01.30\\\",\\\"zonedDateTimeHoursAndSeconds\\\":\\\"2018.01.30 00:00\\\",\\\"zonedDateTimeNanosOfDay\\\":\\\"2018.01.30 3000\\\",\\\"zonedDateTimeOverriddenZone\\\":\\\"2018.01.30 Europe/Paris\\\",\\\"zonedInstant\\\":\\\"2018.01.30 UTC\\\"}\",\n                serialized);\n\n        String jsonToDeserialize = \"{\\\"calendar\\\":\\\"2018.01.30\\\",\\\"date\\\":\\\"2018.01.30\\\",\\\"localDateTime\\\":\\\"2018.01.30\\\",\\\"zonedDateTime\\\":\\\"2018.01.30\\\",\\\"zonedDateTimeHoursAndSeconds\\\":\\\"2018.01.30 12:15\\\",\\\"zonedDateTimeNanosOfDay\\\":\\\"2018.01.30 9000\\\",\\\"zonedDateTimeOverriddenZone\\\":\\\"2018.01.30 Europe/Prague\\\",\\\"zonedInstant\\\":\\\"2018.01.30 Europe/Prague\\\"}\";\n        TrimmedDatePojo trimmedDatePojo = zeroDefaultingJsonb.fromJson(jsonToDeserialize, TrimmedDatePojo.class);\n\n        //Nanos are overridden in json for deserialization. Tests that defaulting hour/minute/second does not affect other units.\n        assertEquals(2018, trimmedDatePojo.getZonedDateTimeNanosOfDay().getYear());\n        assertEquals(1, trimmedDatePojo.getZonedDateTimeNanosOfDay().getMonthValue());\n        assertEquals(30, trimmedDatePojo.getZonedDateTimeNanosOfDay().getDayOfMonth());\n        assertEquals(0, trimmedDatePojo.getZonedDateTimeNanosOfDay().getHour());\n        assertEquals(0, trimmedDatePojo.getZonedDateTimeNanosOfDay().getMinute());\n        assertEquals(0, trimmedDatePojo.getZonedDateTimeNanosOfDay().getSecond());\n        assertEquals(9000, trimmedDatePojo.getZonedDateTimeNanosOfDay().getNano());\n        assertEquals(utcZone, trimmedDatePojo.getZonedDateTimeNanosOfDay().getZone());\n\n        //Test trimmed zoned date time have correct values.\n        assertEquals(2018, trimmedDatePojo.getZonedDateTime().getYear());\n        assertEquals(1, trimmedDatePojo.getZonedDateTime().getMonthValue());\n        assertEquals(30, trimmedDatePojo.getZonedDateTime().getDayOfMonth());\n        assertEquals(0, trimmedDatePojo.getZonedDateTime().getHour());\n        assertEquals(0, trimmedDatePojo.getZonedDateTime().getMinute());\n        assertEquals(0, trimmedDatePojo.getZonedDateTime().getSecond());\n        assertEquals(utcZone, trimmedDatePojo.getZonedDateTime().getZone());\n\n\n        //Zone is overridden in JSON, causing\n        assertEquals(2018, trimmedDatePojo.getZonedDateTimeHoursAndSeconds().getYear());\n        assertEquals(1, trimmedDatePojo.getZonedDateTimeHoursAndSeconds().getMonthValue());\n        assertEquals(30, trimmedDatePojo.getZonedDateTimeHoursAndSeconds().getDayOfMonth());\n        assertEquals(12, trimmedDatePojo.getZonedDateTimeHoursAndSeconds().getHour());\n        assertEquals(0, trimmedDatePojo.getZonedDateTimeHoursAndSeconds().getMinute());\n        assertEquals(15, trimmedDatePojo.getZonedDateTimeHoursAndSeconds().getSecond());\n        assertEquals(utcZone, trimmedDatePojo.getZonedDateTimeHoursAndSeconds().getZone());\n\n        //Defaulting UTC zone is overridden in JSON.\n        assertEquals(2018, trimmedDatePojo.getZonedDateTimeOverriddenZone().getYear());\n        assertEquals(1, trimmedDatePojo.getZonedDateTimeOverriddenZone().getMonthValue());\n        assertEquals(30, trimmedDatePojo.getZonedDateTimeOverriddenZone().getDayOfMonth());\n        assertEquals(0, trimmedDatePojo.getZonedDateTimeOverriddenZone().getHour());\n        assertEquals(0, trimmedDatePojo.getZonedDateTimeOverriddenZone().getMinute());\n        assertEquals(0, trimmedDatePojo.getZonedDateTimeOverriddenZone().getSecond());\n        assertEquals(ZoneId.of(\"Europe/Prague\"), trimmedDatePojo.getZonedDateTimeOverriddenZone().getZone());\n\n        //Tests LocalDateTime trimmed values\n        assertEquals(2018, trimmedDatePojo.getLocalDateTime().getYear());\n        assertEquals(1, trimmedDatePojo.getLocalDateTime().getMonthValue());\n        assertEquals(30, trimmedDatePojo.getLocalDateTime().getDayOfMonth());\n        assertEquals(0, trimmedDatePojo.getLocalDateTime().getHour());\n        assertEquals(0, trimmedDatePojo.getLocalDateTime().getMinute());\n        assertEquals(0, trimmedDatePojo.getLocalDateTime().getSecond());\n\n        //Test date and instant have correct time.\n        assertEquals(zdt.toInstant().toEpochMilli(), trimmedDatePojo.getDate().getTime());\n        assertEquals(zdt.withZoneSameLocal(ZoneId.of(\"Europe/Prague\")).toInstant().toEpochMilli(), trimmedDatePojo.getZonedInstant().toEpochMilli());\n\n        //Test calendar instance\n        //Tests LocalDateTime trimmed values\n        assertEquals(2018, trimmedDatePojo.getCalendar().get(Calendar.YEAR));\n        assertEquals(0, trimmedDatePojo.getCalendar().get(Calendar.MONTH));\n        assertEquals(30, trimmedDatePojo.getCalendar().get(Calendar.DAY_OF_MONTH));\n        assertEquals(0, trimmedDatePojo.getCalendar().get(Calendar.HOUR_OF_DAY));\n        assertEquals(0, trimmedDatePojo.getCalendar().get(Calendar.MINUTE));\n        assertEquals(0, trimmedDatePojo.getCalendar().get(Calendar.SECOND));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/JsonbNillableTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization;\n\nimport org.junit.jupiter.api.*;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.annotation.JsonbProperty;\n\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.customization.model.JsonbNillableClassSecondLevel;\nimport org.eclipse.yasson.customization.model.JsonbNillableOverriddenWithJsonbProperty;\nimport org.eclipse.yasson.customization.model.JsonbNillableOverridesClass;\nimport org.eclipse.yasson.customization.model.JsonbNillableOverridesInterface;\nimport org.eclipse.yasson.customization.model.JsonbNillableValue;\nimport org.eclipse.yasson.customization.model.packagelevelannotations.JsonbNillablePackageLevel;\nimport org.eclipse.yasson.customization.model.packagelevelannotations.PackageLevelOverriddenWithClassLevel;\nimport org.eclipse.yasson.defaultmapping.generics.model.ScalarValueWrapper;\n\n/**\n * Tests a {@link jakarta.json.bind.annotation.JsonbNillable} annotation.\n * @author Roman Grigoriadi\n */\npublic class JsonbNillableTest {\n\n    @Test\n    public void testJsonbNillable() {\n        JsonbNillableValue pojo = new JsonbNillableValue();\n        assertEquals(\"{\\\"nillableField\\\":null}\", defaultJsonb.toJson(pojo));\n    }\n\n    @Test\n    public void testJsonbNillableOverriddenWithJsonbProperty() {\n        JsonbNillableOverriddenWithJsonbProperty pojo = new JsonbNillableOverriddenWithJsonbProperty();\n        assertEquals(\"{}\", defaultJsonb.toJson(pojo));\n    }\n\n    @Test\n    public void testPackageLevelNillable() {\n        JsonbNillablePackageLevel pojo = new JsonbNillablePackageLevel();\n        assertEquals(\"{\\\"packageLevelNillableField\\\":null}\", defaultJsonb.toJson(pojo));\n    }\n\n    @Test\n    public void testPackageLevelOverriddenWithClassLevel() {\n        PackageLevelOverriddenWithClassLevel pojo = new PackageLevelOverriddenWithClassLevel();\n        assertEquals(\"{}\", defaultJsonb.toJson(pojo));\n    }\n\n    /**\n     * Tests inheritance of annotations from interfaces.\n     */\n    @Test\n    public void testNillableInheritFromInterface() throws Exception {\n        JsonbNillableClassSecondLevel pojo = new JsonbNillableClassSecondLevel();\n        assertEquals(\"{\\\"classNillable\\\":null}\", defaultJsonb.toJson(pojo));\n    }\n\n    @Test\n    public void testInheritanceOverride() throws Exception {\n        JsonbNillableOverridesInterface overridesInterface = new JsonbNillableOverridesInterface();\n        assertEquals(\"{}\", defaultJsonb.toJson(overridesInterface));\n\n        JsonbNillableOverridesClass overridesClass = new JsonbNillableOverridesClass();\n        assertEquals(\"{}\", defaultJsonb.toJson(overridesClass));\n    }\n\n    @Test\n    public void testNillableInConfig() {\n        String jsonString = nullableJsonb.toJson(new ScalarValueWrapper<String>(){});\n        assertEquals(\"{\\\"value\\\":null}\", jsonString);\n    }\n    \n    public static class PrimitiveNullBoolean {\n\n        @JsonbProperty(nillable = true)\n        private Boolean someBoolean;\n\n        void setSomeBoolean(boolean value) { // note that value is a primitive boolean\n            // leaving this empty, exception will be thrown before Yasson gets here.\n        }\n    }\n    \n    /**\n     * Test for issue https://github.com/eclipse-ee4j/yasson/issues/399\n     */\n    @Test\n    public void testNillableSomeBoolean() {\n    \tJsonb jsonb = JsonbBuilder.create();\n        String input = \"{\\\"someBoolean\\\": null}\";\n        PrimitiveNullBoolean deserialized = jsonb.fromJson(input, PrimitiveNullBoolean.class);\n        assertNull(deserialized.someBoolean);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/JsonbPropertyTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.customization.model.JsonbPropertyName;\nimport org.eclipse.yasson.customization.model.JsonbPropertyNameCollision;\nimport org.eclipse.yasson.customization.model.JsonbPropertyNillable;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.config.PropertyNamingStrategy;\n\n/**\n * Tests parsing of {@link jakarta.json.bind.annotation.JsonbProperty} test.\n * @author Roman Grigoriadi\n */\npublic class JsonbPropertyTest {\n\n    @Test\n    public void testPropertyName() throws Exception {\n\n        JsonbPropertyName pojo = new JsonbPropertyName();\n        pojo.setFieldAnnotatedName(\"FIELD_ANNOTATED\");\n        pojo.setMethodAnnotName(\"METHOD_ANNOTATED\");\n        pojo.setFieldOverriddenWithMethodAnnot(\"OVERRIDDEN_GETTER\");\n\n        assertEquals(\"{\\\"fieldAnnotatedNameCustomized\\\":\\\"FIELD_ANNOTATED\\\",\\\"getterAnnotatedName\\\":\\\"METHOD_ANNOTATED\\\",\\\"getterOverriddenName\\\":\\\"OVERRIDDEN_GETTER\\\"}\",\n                defaultJsonb.toJson(pojo));\n\n        String toUnmarshall = \"{\\\"fieldAnnotatedNameCustomized\\\":\\\"FIELD_ANNOTATED\\\",\\\"setterOverriddenName\\\":\\\"OVERRIDDEN_GETTER\\\",\\\"setterAnnotatedName\\\":\\\"METHOD_ANNOTATED\\\"}\";\n        JsonbPropertyName result = defaultJsonb.fromJson(toUnmarshall, JsonbPropertyName.class);\n        assertEquals(\"FIELD_ANNOTATED\", result.getFieldAnnotatedName());\n        assertEquals(\"METHOD_ANNOTATED\", result.getMethodAnnotName());\n        assertEquals(\"OVERRIDDEN_GETTER\", result.getFieldOverriddenWithMethodAnnot());\n    }\n\n    @Test\n    public void testNameCollision() {\n        JsonbPropertyNameCollision nameCollisionPojo = new JsonbPropertyNameCollision();\n        tryClash(() -> defaultJsonb.toJson(nameCollisionPojo));\n        tryClash(() -> defaultJsonb.fromJson(\"{}\", JsonbPropertyNameCollision.class));\n    }\n\n\n\n    private static void tryClash(Runnable clashCommand) {\n        try {\n            clashCommand.run();\n            fail();\n        } catch (Exception e) {\n            assertTrue(e.getMessage().startsWith(\"Property pojoName clashes with property pojoNameCollision\"));\n        }\n    }\n\n\n    @Test\n    public void testPropertyNillable() {\n        JsonbPropertyNillable pojo = new JsonbPropertyNillable();\n        assertEquals(\"{\\\"nullField\\\":null}\", defaultJsonb.toJson(pojo));\n    }\n    \n    @Test\n    public void testRenamedGetterAndSetter() {\n        // Reported in issue: https://github.com/eclipse-ee4j/yasson/issues/355\n        final RenamedGetterAndSetter b = new RenamedGetterAndSetter();\n        b.setTest(\"hi\");\n        final String h = defaultJsonb.toJson(b);\n        final String expectedJson = \"{\\\"apple\\\":\\\"hi\\\"}\";\n        assertEquals(expectedJson, h); //this passes\n        final RenamedGetterAndSetter b1 = defaultJsonb.fromJson(h, RenamedGetterAndSetter.class);\n        \n        assertEquals(\"hi\", b1.getTest()); //this fails but passes in 1.0.4\n    }\n    \n    @Test\n    public void testRenamedGetterAndSetter2() {\n        // Reported in issue: https://github.com/eclipse-ee4j/yasson/issues/81\n        final Jsonb jsonb = JsonbBuilder.create(\n                new JsonbConfig().withPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE));\n\n        final RenamedGetterAndSetter2 bean1 = new RenamedGetterAndSetter2();\n        bean1.setAPIDocumentation(\"REST\");\n\n        final String json = jsonb.toJson(bean1);\n        final RenamedGetterAndSetter2 bean2 = jsonb.fromJson(json, RenamedGetterAndSetter2.class);\n        assertEquals(bean1.getAPIDocumentation(), bean2.getAPIDocumentation());\n    }\n    \n    @Test\n    public void testRenamedGetterAndSetter3() {\n        // Reported in issue: https://github.com/eclipse-ee4j/yasson/issues/81\n        final Jsonb jsonb = JsonbBuilder.create();\n        \n        final RenamedGetterAndSetter2 bean1 = new RenamedGetterAndSetter2();\n        bean1.setAPIDocumentation(\"REST\");\n\n        final String json = jsonb.toJson(bean1);\n        final RenamedGetterAndSetter2 bean2 = jsonb.fromJson(json, RenamedGetterAndSetter2.class);\n        assertEquals(bean1.getAPIDocumentation(), bean2.getAPIDocumentation());\n    }\n    \n    public static class RenamedGetterAndSetter {\n        private String apple;\n        \n        @JsonbProperty(\"apple\")\n        public String getTest() {\n            return apple;\n        }\n\n        @JsonbProperty(\"apple\")\n        public void setTest(String test) {\n            this.apple = test;\n        }\n    }\n    \n    public static class RenamedGetterAndSetter2 {\n        \n        private String api;\n        \n        @JsonbProperty(\"api\")\n        public String getAPIDocumentation() {\n            return api;\n        }\n        \n        @JsonbProperty(\"api\")\n        public void setAPIDocumentation(String api) {\n            this.api = api;\n        }\n    }\n\n    /**\n     * In this test getter / setter doesn't match to field \"doi\", because declared by javabean convention.\n     * When model is parsed there are to properties:\n     * Property for private field \"doi\", without customization. This property is not readable because field\n     * is private without getter / setter.\n     * And property \"DOI\" - getter / setter without a field with customization on getter renaming it to doi\n     * in serialized document.\n     *\n     * Because first of those properties is not readable this should not raise naming clash error.\n     */\n    @Test\n    public void testNonConflictingProperties() {\n        NonConflictingProperties nonConflictingProperties = new NonConflictingProperties();\n        nonConflictingProperties.setDOI(\"DOI value\");\n\n        String json = defaultJsonb.toJson(nonConflictingProperties);\n        assertEquals(\"{\\\"doi\\\":\\\"DOI value\\\"}\", json);\n\n        NonConflictingProperties result = defaultJsonb.fromJson(\"{\\\"DOI\\\":\\\"DOI value\\\"}\", NonConflictingProperties.class);\n        assertEquals(\"DOI value\", result.getDOI());\n    }\n\n    /**\n     * Same problem as above but now field is public, so clash takes place.\n     */\n    @Test\n    public void testConflictingProperties() {\n        ConflictingProperties conflictingProperties = new ConflictingProperties();\n        conflictingProperties.setDOI(\"DOI value\");\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig());\n\n        try {\n            jsonb.toJson(conflictingProperties);\n            fail();\n        } catch (JsonbException e) {\n            if (!e.getMessage().equals(\"Property DOI clashes with property doi by read or write name in class org.eclipse.yasson.customization.JsonbPropertyTest$ConflictingProperties.\")) {\n                throw e;\n            }\n        }\n    }\n\n    /**\n     * Tests clash with property altered by naming strategy.\n     */\n    @Test\n    public void testConflictingWithUpperCamelStrategy() {\n        ConflictingWithUpperCamelStrategy pojo = new ConflictingWithUpperCamelStrategy();\n        pojo.setDOI(\"DOI value\");\n\n        String json = defaultJsonb.toJson(pojo);\n        assertEquals(\"{\\\"Doi\\\":\\\"DOI value\\\",\\\"doi\\\":\\\"DOI value\\\"}\", json);\n\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig()\n                .withPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE));\n\n        try {\n            jsonb.toJson(pojo);\n            fail();\n        } catch (JsonbException e) {\n            if (!e.getMessage().equals(\"Property DOI clashes with property doi by read or write name in class org.eclipse.yasson.customization.JsonbPropertyTest$ConflictingWithUpperCamelStrategy.\")) {\n                throw e;\n            }\n        }\n\n    }\n    \n    @Test\n    public void testConflictingWithLowercaseStrategy() {\n    \t// scenario raised by user here: https://github.com/eclipse-ee4j/yasson/issues/296\n    \tJsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CASE_WITH_UNDERSCORES));\n    \tassertEquals(\"{\\\"url\\\":\\\"http://foo.com\\\"}\", \n    \t\t\tjsonb.toJson(new ConflictingIfLowercase()));\n    }\n    \n    public static class ConflictingIfLowercase {\n    \tprivate String url = \"foo.com\";\n    \t\n    \tpublic String getURL() {\n    \t\treturn \"http://\" + url;\n    \t}\n    }\n\n    public static class NonConflictingProperties {\n        private String doi;\n\n        @JsonbProperty(\"doi\")\n        public String getDOI() {\n            return doi;\n        }\n        public void setDOI(String doi) {\n            this.doi = doi;\n        }\n    }\n\n    public static class ConflictingProperties {\n        public String doi;\n\n        @JsonbProperty(\"doi\")\n        public String getDOI() {\n            return doi;\n        }\n        public void setDOI(String doi) {\n            this.doi = doi;\n        }\n    }\n\n    public static class ConflictingWithUpperCamelStrategy {\n        public String doi;\n\n        @JsonbProperty(\"Doi\")\n        public String getDOI() {\n            return doi;\n        }\n        public void setDOI(String doi) {\n            this.doi = doi;\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/JsonbPropertyVisibilityStrategyTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.annotation.JsonbVisibility;\nimport jakarta.json.bind.config.PropertyVisibilityStrategy;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\n\n/**\n * Tests custom {@link PropertyVisibilityStrategy}\n *\n * @author Roman Grigoriadi\n */\npublic class JsonbPropertyVisibilityStrategyTest {\n\n    public static class FieldPojo {\n\n        private String afield;\n        private String bfield;\n        public String cfield;\n        public String dfield;\n\n        public FieldPojo(String afield, String bfield, String cfield, String dfield) {\n            this.afield = afield;\n            this.bfield = bfield;\n            this.cfield = cfield;\n            this.dfield = dfield;\n        }\n    }\n\n    public static class GetterPojo {\n        public String getAgetter() {\n            return \"avalue\";\n        }\n        public String getBgetter() {\n            return \"bvalue\";\n        }\n        private String getCgetter() {\n            return \"cvalue\";\n        }\n        private String getDgetter() {\n            return \"dvalue\";\n        }\n    }\n\n    @JsonbVisibility(TestVisibilityStrategy.class)\n    public static final class AnnotatedPojo {\n\n        private String afield;\n        private String bfield;\n        public String cfield;\n        public String dfield;\n\n        public AnnotatedPojo(String afield, String bfield, String cfield, String dfield) {\n            this.afield = afield;\n            this.bfield = bfield;\n            this.cfield = cfield;\n            this.dfield = dfield;\n        }\n\n        public String getAgetter() {\n            return \"avalue\";\n        }\n        public String getBgetter() {\n            return \"bvalue\";\n        }\n        private String getCgetter() {\n            return \"cvalue\";\n        }\n        private String getDgetter() {\n            return \"dvalue\";\n        }\n    }\n\n\n    public static final class TestVisibilityStrategy implements PropertyVisibilityStrategy {\n        @Override\n        public boolean isVisible(Field field) {\n            final String fieldName = field.getName();\n            return fieldName.equals(\"bfield\") || fieldName.equals(\"cfield\");\n        }\n\n        @Override\n        public boolean isVisible(Method method) {\n            final String methodName = method.getName();\n            return methodName.equals(\"getBgetter\") || methodName.equals(\"getCgetter\");\n        }\n    }\n\n    /**\n     * Tests applying for both public and nonpublic fields.\n     */\n    @Test\n    public void testFieldVisibilityStrategy() {\n        JsonbConfig customizedConfig = new JsonbConfig();\n        customizedConfig.setProperty(JsonbConfig.PROPERTY_VISIBILITY_STRATEGY, new PropertyVisibilityStrategy() {\n            @Override\n            public boolean isVisible(Field field) {\n                final String fieldName = field.getName();\n                return fieldName.equals(\"afield\") || fieldName.equals(\"dfield\");\n            }\n\n            @Override\n            public boolean isVisible(Method method) {\n                throw new IllegalStateException(\"Not supported\");\n            }\n        });\n\n        FieldPojo fieldPojo = new FieldPojo(\"avalue\", \"bvalue\", \"cvalue\", \"dvalue\");\n\n        Jsonb jsonb = JsonbBuilder.create(customizedConfig);\n        assertEquals(\"{\\\"afield\\\":\\\"avalue\\\",\\\"dfield\\\":\\\"dvalue\\\"}\", jsonb.toJson(fieldPojo));\n    }\n\n    /**\n     * Tests applying for both public and nonpublic getters.\n     */\n    @Test\n    public void testMethodVisibilityStrategy() {\n        JsonbConfig customizedConfig = new JsonbConfig();\n        customizedConfig.setProperty(JsonbConfig.PROPERTY_VISIBILITY_STRATEGY, new PropertyVisibilityStrategy() {\n            @Override\n            public boolean isVisible(Field field) {\n                throw new IllegalStateException(\"Not supported\");\n            }\n\n            @Override\n            public boolean isVisible(Method method) {\n                final String methodName = method.getName();\n                return methodName.equals(\"getAgetter\") || methodName.equals(\"getDgetter\");\n            }\n        });\n\n        GetterPojo getterPojo = new GetterPojo();\n\n        Jsonb jsonb = JsonbBuilder.create(customizedConfig);\n        assertEquals(\"{\\\"agetter\\\":\\\"avalue\\\",\\\"dgetter\\\":\\\"dvalue\\\"}\", jsonb.toJson(getterPojo));\n    }\n\n    @Test\n    public void testAnnotatedPojo() {\n        AnnotatedPojo fieldPojo = new AnnotatedPojo(\"avalue\", \"bvalue\", \"cvalue\", \"dvalue\");\n        assertEquals(\"{\\\"bfield\\\":\\\"bvalue\\\",\\\"bgetter\\\":\\\"bvalue\\\",\\\"cfield\\\":\\\"cvalue\\\",\\\"cgetter\\\":\\\"cvalue\\\"}\", defaultJsonb.toJson(fieldPojo));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/NumberFormatTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport org.eclipse.yasson.customization.model.NumberFormatPojo;\nimport org.eclipse.yasson.customization.model.NumberFormatPojoWithoutClassLevelFormatter;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.Locale;\nimport jakarta.json.bind.JsonbConfig;\n\n/**\n * Tests number format.\n * @author Roman Grigoriadi\n */\npublic class NumberFormatTest {\n    private static final Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withLocale(Locale.US));\n\n    @Test\n    public void testSerialize() {\n        NumberFormatPojo pojo = new NumberFormatPojo();\n        pojo.bigDecimal = BigDecimal.TEN;\n        pojo.bigInteger = BigInteger.ONE;\n        pojo.aDouble = .1d;\n        pojo.aFloat = .35f;\n        pojo.aLong = Long.MAX_VALUE;\n        pojo.integer = Integer.MAX_VALUE;\n        pojo.aShort = 1;\n        pojo.aByte = 127;\n        pojo.setDoubleGetterFormatted(.1d);\n        pojo.setDoubleSetterFormatted(.5d);\n        pojo.setDoubleSetterAndPropertyFormatter(0.6d);\n\n        String expectedJson = \"{\\\"aByte\\\":\\\"127\\\",\\\"aDouble\\\":\\\"000.10000000\\\",\\\"aFloat\\\":\\\"000.34999999\\\",\\\"aLong\\\":\\\"9223372036854775807\\\",\\\"aShort\\\":\\\"00001\\\",\\\"bigDecimal\\\":\\\"00000010.000000\\\",\\\"bigInteger\\\":\\\"00000001\\\",\\\"doubleGetterFormatted\\\":\\\"000.10000000\\\",\\\"doubleSetterAndPropertyFormatter\\\":\\\"000.600\\\",\\\"doubleSetterFormatted\\\":\\\"0.5\\\",\\\"integer\\\":\\\"2147483647.0\\\"}\";\n\n        assertEquals(expectedJson, jsonb.toJson(pojo));\n    }\n\n    @Test\n    public void testDeserializer() {\n        String expectedJson = \"{\\\"aByte\\\":\\\"127\\\",\\\"aDouble\\\":\\\"000.10000000\\\",\\\"aFloat\\\":\\\"000.34999999\\\",\\\"aLong\\\":\\\"9223372036854775807\\\",\\\"aShort\\\":\\\"00001\\\",\\\"bigDecimal\\\":\\\"00000010.000000\\\",\\\"bigInteger\\\":\\\"00000001\\\",\\\"doubleGetterFormatted\\\":\\\"000.10000\\\",\\\"doubleSetterFormatted\\\":\\\",005\\\",\\\"doubleSetterAndPropertyFormatter\\\":\\\"000,600\\\",\\\"integer\\\":\\\"2147483647.0\\\"}\";\n        NumberFormatPojo pojo = jsonb.fromJson(expectedJson, NumberFormatPojo.class);\n\n        assertEquals(BigDecimal.TEN, pojo.bigDecimal);\n        assertEquals(BigInteger.ONE, pojo.bigInteger);\n        assertEquals(Byte.valueOf((byte) 127), pojo.aByte);\n        assertEquals(Double.valueOf(.1d), pojo.aDouble);\n        assertEquals(Float.valueOf(.35f), pojo.aFloat);\n        assertEquals((Integer)Integer.MAX_VALUE, pojo.integer);\n        assertEquals(Short.valueOf((short) 1), pojo.aShort);\n        assertEquals((Long)Long.MAX_VALUE, pojo.aLong);\n        assertEquals(Double.valueOf(.1d), pojo.getDoubleGetterFormatted());\n        assertEquals(Double.valueOf(.005d), pojo.getDoubleSetterFormatted());\n        assertEquals(Double.valueOf(.6d), pojo.getDoubleSetterAndPropertyFormatter());\n    }\n\n    @Test\n    public void testSerializeWithoutClassLevelFormatter() {\n        NumberFormatPojoWithoutClassLevelFormatter pojo = new NumberFormatPojoWithoutClassLevelFormatter();\n        pojo.setDoubleGetterFormatted(.1d);\n        pojo.setDoubleSetterFormatted(.5d);\n        pojo.setDoubleSetterAndPropertyFormatter(0.6d);\n\n        String expectedJson = \"{\\\"doubleGetterFormatted\\\":\\\"000.10000000\\\",\\\"doubleSetterAndPropertyFormatter\\\":\\\"000.600\\\",\\\"doubleSetterFormatted\\\":0.5}\";\n\n        assertEquals(expectedJson, jsonb.toJson(pojo));\n    }\n\n    @Test\n    public void testDeserializeWithoutClassLevelFormatter() {\n        String expectedJson = \"{\\\"doubleGetterFormatted\\\":\\\"000.10000\\\",\\\"doubleSetterFormatted\\\":\\\",005\\\",\\\"doubleSetterAndPropertyFormatter\\\":\\\"000,600\\\"}\";\n        NumberFormatPojoWithoutClassLevelFormatter pojo = jsonb.fromJson(expectedJson, NumberFormatPojoWithoutClassLevelFormatter.class);\n\n        assertEquals(Double.valueOf(.1d), pojo.getDoubleGetterFormatted());\n        assertEquals(Double.valueOf(.005d), pojo.getDoubleSetterFormatted());\n        assertEquals(Double.valueOf(.6d), pojo.getDoubleSetterAndPropertyFormatter());\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/PrettyPrintTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport java.util.Arrays;\n\n/**\n * Tests pretty print to JSONP propagation\n *\n * @author Roman Grigoriadi\n */\npublic class PrettyPrintTest {\n\n    @Test\n    public void testPrettyPrint() {\n        assertEquals(\"[\\n    \\\"first\\\",\\n    \\\"second\\\"\\n]\", formattingJsonb.toJson(Arrays.asList(\"first\", \"second\")));\n    }\n\n    @Test\n    public void testPrettyPrintFalse() {\n        assertEquals(\"[\\\"first\\\",\\\"second\\\"]\", defaultJsonb.toJson(Arrays.asList(\"first\", \"second\")));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/PropertyOrderTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.customization.model.FieldCustomOrder;\nimport org.eclipse.yasson.customization.model.FieldCustomOrderWrapper;\nimport org.eclipse.yasson.customization.model.FieldOrder;\nimport org.eclipse.yasson.customization.model.FieldOrderNameAnnotation;\nimport org.eclipse.yasson.customization.model.FieldSpecificOrder;\nimport org.eclipse.yasson.customization.model.RenamedPropertiesContainer;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.annotation.JsonbPropertyOrder;\nimport jakarta.json.bind.config.PropertyOrderStrategy;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class PropertyOrderTest {\n\n    @Test\n    public void testPropertySorting() {\n        FieldOrder fieldOrder = new FieldOrder();\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyOrderStrategy(PropertyOrderStrategy.LEXICOGRAPHICAL));\n        String expectedLexicographical = \"{\\\"aField\\\":\\\"aValue\\\",\\\"bField\\\":\\\"bValue\\\",\\\"cField\\\":\\\"cValue\\\",\\\"dField\\\":\\\"dValue\\\"}\";\n        assertEquals(expectedLexicographical, jsonb.toJson(fieldOrder));\n\n        jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyOrderStrategy(PropertyOrderStrategy.REVERSE));\n        String expectedReverse = \"{\\\"dField\\\":\\\"dValue\\\",\\\"cField\\\":\\\"cValue\\\",\\\"bField\\\":\\\"bValue\\\",\\\"aField\\\":\\\"aValue\\\"}\";\n        assertEquals(expectedReverse, jsonb.toJson(fieldOrder));\n    }\n\n    @Test\n    public void testPropertyCustomOrder() {\n        FieldCustomOrder fieldCustomOrder = new FieldCustomOrder();\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyOrderStrategy(PropertyOrderStrategy.LEXICOGRAPHICAL));\n        String expectedCustomOrder = \"{\\\"aField\\\":\\\"aValue\\\",\\\"cField\\\":\\\"cValue\\\",\\\"dField\\\":\\\"dValue\\\",\\\"bField\\\":\\\"bValue\\\"}\";\n        assertEquals(expectedCustomOrder, jsonb.toJson(fieldCustomOrder));\n\n        FieldCustomOrderWrapper fieldCustomOrderWrapper = new FieldCustomOrderWrapper();\n        String expectedOrder = \"{\\\"fieldCustomOrder\\\":{\\\"aField\\\":\\\"aValue\\\",\\\"cField\\\":\\\"cValue\\\",\\\"dField\\\":\\\"dValue\\\",\\\"bField\\\":\\\"bValue\\\"},\\\"intField\\\":1,\\\"stringField\\\":\\\"stringValue\\\"}\";\n        assertEquals(expectedOrder, jsonb.toJson(fieldCustomOrderWrapper));\n    }\n\n    @Test\n    public void testPropertySetCustomOrder() {\n        FieldSpecificOrder fieldSpecificOrder = new FieldSpecificOrder();\n        String expectedSpecific = \"{\\\"aField\\\":\\\"aValue\\\",\\\"dField\\\":\\\"dValue\\\",\\\"bField\\\":\\\"bValue\\\",\\\"cField\\\":\\\"cValue\\\"}\";\n        assertEquals(expectedSpecific, defaultJsonb.toJson(fieldSpecificOrder));\n        \n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyOrderStrategy(PropertyOrderStrategy.REVERSE));\n        expectedSpecific = \"{\\\"aField\\\":\\\"aValue\\\",\\\"dField\\\":\\\"dValue\\\",\\\"cField\\\":\\\"cValue\\\",\\\"bField\\\":\\\"bValue\\\"}\";\n        assertEquals(expectedSpecific, jsonb.toJson(fieldSpecificOrder));\n    }\n\n    @Test\n    public void testPropertySortingWithNamingAnnotation() {\n        FieldOrderNameAnnotation fieldOrderNameAnnotation = new FieldOrderNameAnnotation();\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyOrderStrategy(PropertyOrderStrategy.LEXICOGRAPHICAL));\n        String expectedLexicographical = \"{\\\"bField\\\":\\\"bValue\\\",\\\"cField\\\":\\\"cValue\\\",\\\"dField\\\":\\\"dValue\\\",\\\"zField\\\":\\\"aValue\\\"}\";\n        assertEquals(expectedLexicographical, jsonb.toJson(fieldOrderNameAnnotation));\n\n        jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyOrderStrategy(PropertyOrderStrategy.REVERSE));\n        String expectedReverse = \"{\\\"zField\\\":\\\"aValue\\\",\\\"dField\\\":\\\"dValue\\\",\\\"cField\\\":\\\"cValue\\\",\\\"bField\\\":\\\"bValue\\\"}\";\n        assertEquals(expectedReverse, jsonb.toJson(fieldOrderNameAnnotation));\n    }\n\n    @Test\n    public void testLexicographicalPropertyOrderRenamedProperties() {\n        JsonbConfig config = new JsonbConfig();\n        config.setProperty(JsonbConfig.PROPERTY_ORDER_STRATEGY, PropertyOrderStrategy.LEXICOGRAPHICAL);\n        Jsonb jsonb = JsonbBuilder.create(config);\n\n        String jsonString = jsonb.toJson(new RenamedPropertiesContainer() {{ setStringInstance(\"Test String\"); setLongInstance(1); }});\n        assertTrue(jsonString.matches(\"\\\\{\\\\s*\\\"first\\\"\\\\s*\\\\:\\\\s*0\\\\s*,\\\\s*\\\"second\\\"\\\\s*\\\\:\\\\s*\\\"Test String\\\"\\\\s*,\\\\s*\\\"third\\\"\\\\s*\\\\:\\\\s*1\\\\s*\\\\}\"));\n\n        RenamedPropertiesContainer unmarshalledObject = jsonb.fromJson(\"{ \\\"first\\\" : 1, \\\"second\\\" : \\\"Test String\\\", \\\"third\\\" : 1 }\", RenamedPropertiesContainer.class);\n        assertEquals(3, unmarshalledObject.getIntInstance());\n    }\n\n    @Test\n    public void testJsonbPropertyOrderOnRenamedProperties() {\n        assertEquals(\"{\\\"c\\\":11,\\\"d\\\":10,\\\"aExtra\\\":\\\"extra\\\"}\", defaultJsonb.toJson(new Range(10, 11)));\n    }\n    \n    // By default, this object would use A-X ordering with property order:\n    // anExtraProp, propA, propB\n    // But with JsonbPropertyOrder we will put props 'propB' and 'propA' first, and leftovers will go at the end, resulting in:\n    // propB, propA, anExtraProp\n    @JsonbPropertyOrder({\"propB\",\"propA\"})\n    public class Range {\n\n        @JsonbProperty(\"d\")\n        public final int propA;\n\n        @JsonbProperty(\"c\")\n        public final int propB;\n        \n        @JsonbProperty(\"aExtra\")\n        public final String anExtraProp = \"extra\";\n\n        @JsonbCreator\n        public Range(\n                @JsonbProperty(\"d\") int propA,\n                @JsonbProperty(\"c\") int propB\n        ) {\n            this.propA = propA;\n            this. propB = propB;\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/YassonSpecificConfigTests.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization;\n\nimport java.util.Optional;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\nimport org.eclipse.yasson.YassonConfig;\nimport org.junit.jupiter.api.Test;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\n\n/**\n * Tests for Yasson specific config properties.\n */\npublic class YassonSpecificConfigTests {\n\n    private static final String NULL_VALUE_STRING = \"null value handled\";\n    private static final String NULL_VALUE_SERIALIZED = \"\\\"\" + NULL_VALUE_STRING + \"\\\"\";\n\n    @Test\n    public void nullRootSerializerTest() {\n        Jsonb jsonb = JsonbBuilder.create(new YassonConfig().withNullRootSerializer(new RootNullSerializer()));\n        assertEquals(NULL_VALUE_SERIALIZED, jsonb.toJson(null));\n    }\n\n    @Test\n    public void emptyOptionalRootSerializerTest() {\n        Jsonb jsonb = JsonbBuilder.create(new YassonConfig().withNullRootSerializer(new RootNullSerializer()));\n        assertEquals(NULL_VALUE_SERIALIZED, jsonb.toJson(Optional.empty()));\n    }\n\n    @Test\n    public void nullSerializerNotUsedTest() {\n        Jsonb jsonb = JsonbBuilder.create(new YassonConfig().withNullRootSerializer(new RootNullSerializer()));\n        assertEquals(\"[null]\", jsonb.toJson(new String[] {null}));\n    }\n\n    private static final class RootNullSerializer implements JsonbSerializer<Object> {\n\n        @Override\n        public void serialize(Object obj, JsonGenerator generator, SerializationContext ctx) {\n            generator.write(NULL_VALUE_STRING);\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/Animal.java",
    "content": "/*\n * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\npublic interface Animal {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/CollectionsWithFormatters.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport java.util.List;\n\nimport jakarta.json.bind.annotation.JsonbNumberFormat;\n\n@JsonbNumberFormat(value = \"000.000\", locale = \"en-us\")\npublic class CollectionsWithFormatters {\n\n    public List<Double> doubleList;\n\n    @JsonbNumberFormat(locale = \"da-da\")\n    public List<Double> doubleList2;\n\n    public List<Double> doubleList3;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/CreatorConstructorPojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport java.math.BigDecimal;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class CreatorConstructorPojo {\n\n    public String str1;\n\n    public String str2;\n\n    public BigDecimal bigDec;\n\n    public CreatorFactoryMethodPojo innerFactoryCreator;\n\n    @JsonbCreator\n    public CreatorConstructorPojo(@JsonbProperty(\"str1\") String str1, @JsonbProperty(\"str2\") String str2) {\n        this.str1 = str1;\n        this.str2 = str2;\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/CreatorFactoryMethodPojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport java.math.BigDecimal;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class CreatorFactoryMethodPojo {\n\n    public final String str1;\n\n    public final String str2;\n\n    public BigDecimal bigDec;\n\n    private CreatorFactoryMethodPojo(String str1, String str2) {\n        this.str1 = str1;\n        this.str2 = str2;\n    }\n    @JsonbCreator\n    public static CreatorFactoryMethodPojo getInstance(@JsonbProperty(\"par1\") String str1, @JsonbProperty(\"par2\")String str2) {\n        return new CreatorFactoryMethodPojo(str1, str2);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/CreatorIncompatibleTypePojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport java.io.Serializable;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class CreatorIncompatibleTypePojo {\n\n    public String s1;\n\n    @JsonbCreator\n    public static Serializable getInstance() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/CreatorMultipleDeclarationErrorPojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class CreatorMultipleDeclarationErrorPojo {\n\n    public String s1;\n\n    @JsonbCreator\n    public CreatorMultipleDeclarationErrorPojo(@JsonbProperty(\"val1\") String s1) {\n        this.s1 = s1;\n    }\n\n    @JsonbCreator\n    public static CreatorMultipleDeclarationErrorPojo getInstance() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/CreatorPackagePrivateConstructor.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class CreatorPackagePrivateConstructor {\n\n    private String strVal;\n\n    private final int intVal;\n\n    @JsonbCreator\n    CreatorPackagePrivateConstructor(@JsonbProperty(\"intVal\") int intVal) {\n        this.intVal = intVal;\n    }\n\n    public String getStrVal() {\n        return strVal;\n    }\n\n    public void setStrVal(String strVal) {\n        this.strVal = strVal;\n    }\n\n    public int getIntVal() {\n        return intVal;\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/CreatorWithoutJavabeanProperty.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class CreatorWithoutJavabeanProperty {\n\n    private String strField;\n\n    @JsonbCreator\n    public CreatorWithoutJavabeanProperty(@JsonbProperty(\"s1\") String s1, @JsonbProperty(\"s2\") String s2) {\n        this.strField = s1 + s2;\n    }\n\n    public String getStrField() {\n        return strField;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/CreatorWithoutJsonbProperty.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class CreatorWithoutJsonbProperty {\n\n    private final String par1;\n    private final String par2;\n    private double par3;\n\n    @JsonbCreator\n    public CreatorWithoutJsonbProperty(@JsonbProperty(\"s1\") String par1, String par2, double d1) {\n        this.par1 = par1;\n        this.par2 = par2;\n        this.par3 = d1;\n    }\n\n    public String getPar1() {\n        return par1;\n    }\n\n    public String getPar2() {\n        return par2;\n    }\n\n    public double getPar3() {\n        return par3;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/CreatorWithoutJsonbProperty1.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class CreatorWithoutJsonbProperty1 {\n\n    private final String par1;\n    private final String par2;\n    private byte par3;\n\n    @JsonbCreator\n    public CreatorWithoutJsonbProperty1(String par1, @JsonbProperty(\"s2\") String par2, byte par3) {\n        this.par1 = par1;\n        this.par2 = par2;\n        this.par3 = par3;\n    }\n\n    public String getPar1() {\n        return par1;\n    }\n\n    public String getPar2() {\n        return par2;\n    }\n\n    public byte getPar3() {\n        return par3;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/DateFormatPojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport java.util.Date;\n\n/**\n * @author Ehsan Zaery Moghaddam (zaerymoghaddam@gmail.com)\n */\npublic class DateFormatPojo {\n\n    public Date plainDateField;\n\n    @JsonbDateFormat(value = \"HH:mm:ss ^^ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public Date formattedDateField;\n\n    public Date getterFormattedDateField;\n\n    public Date setterFormattedDateField;\n\n    @JsonbDateFormat(value = \"HH:mm:ss ^^ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public Date getterAndFieldFormattedDateField;\n\n    @JsonbDateFormat(value = \"HH:mm:ss ^^ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public Date setterAndFieldFormattedDateField;\n\n    public Date getterAndSetterFormattedDateField;\n\n    @JsonbDateFormat(value = \"HH:mm:ss ^^ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public Date getterAndSetterAndFieldFormattedDateField;\n\n\n\n    public Date getPlainDateField() {\n        return plainDateField;\n    }\n\n    public void setPlainDateField(Date plainDateField) {\n        this.plainDateField = plainDateField;\n    }\n\n\n\n    public Date getFormattedDateField() {\n        return formattedDateField;\n    }\n\n    public void setFormattedDateField(Date formattedDateField) {\n        this.formattedDateField = formattedDateField;\n    }\n\n\n\n    @JsonbDateFormat(value = \"HH:mm:ss ^^ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public Date getGetterFormattedDateField() {\n        return getterFormattedDateField;\n    }\n\n    public void setGetterFormattedDateField(Date getterFormattedDateField) {\n        this.getterFormattedDateField = getterFormattedDateField;\n    }\n\n\n\n    public Date getSetterFormattedDateField() {\n        return setterFormattedDateField;\n    }\n\n    @JsonbDateFormat(value = \"HH:mm:ss ^^ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public void setSetterFormattedDateField(Date setterFormattedDateField) {\n        this.setterFormattedDateField = setterFormattedDateField;\n    }\n\n\n\n    @JsonbDateFormat(value = \"HH:mm:ss <> dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public Date getGetterAndFieldFormattedDateField() {\n        return getterAndFieldFormattedDateField;\n    }\n\n    public void setGetterAndFieldFormattedDateField(Date getterAndFieldFormattedDateField) {\n        this.getterAndFieldFormattedDateField = getterAndFieldFormattedDateField;\n    }\n\n\n\n    public Date getSetterAndFieldFormattedDateField() {\n        return setterAndFieldFormattedDateField;\n    }\n\n    @JsonbDateFormat(value = \"HH:mm:ss <> dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public void setSetterAndFieldFormattedDateField(Date setterAndFieldFormattedDateField) {\n        this.setterAndFieldFormattedDateField = setterAndFieldFormattedDateField;\n    }\n\n\n\n    @JsonbDateFormat(value = \"HH:mm:ss ^^ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public Date getGetterAndSetterFormattedDateField() {\n        return getterAndSetterFormattedDateField;\n    }\n\n    @JsonbDateFormat(value = \"HH:mm:ss <> dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public void setGetterAndSetterFormattedDateField(Date getterAndSetterFormattedDateField) {\n        this.getterAndSetterFormattedDateField = getterAndSetterFormattedDateField;\n    }\n\n\n\n    @JsonbDateFormat(value = \"HH:mm:ss <> dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public Date getGetterAndSetterAndFieldFormattedDateField() {\n        return getterAndSetterAndFieldFormattedDateField;\n    }\n\n    @JsonbDateFormat(value = \"HH:mm:ss $$ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public void setGetterAndSetterAndFieldFormattedDateField(Date getterAndSetterAndFieldFormattedDateField) {\n        this.getterAndSetterAndFieldFormattedDateField = getterAndSetterAndFieldFormattedDateField;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/DateFormatPojoWithClassLevelFormatter.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport java.util.Date;\n\n/**\n * The pojo class that used to test {@link JsonbDateFormat} when the containing class has a default {@link JsonbDateFormat} defined\n *\n * @author Ehsan Zaery Moghaddam (zaerymoghaddam@gmail.com)\n */\n@JsonbDateFormat(value = \"HH:mm:ss ^ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\npublic class DateFormatPojoWithClassLevelFormatter {\n\n    public Date plainDateField;\n\n    @JsonbDateFormat(value = \"HH:mm:ss ^^ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public Date formattedDateField;\n\n    public Date getterFormattedDateField;\n\n    public Date setterFormattedDateField;\n\n    @JsonbDateFormat(value = \"HH:mm:ss ^^ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public Date getterAndFieldFormattedDateField;\n\n    @JsonbDateFormat(value = \"HH:mm:ss ^^ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public Date setterAndFieldFormattedDateField;\n\n    public Date getterAndSetterFormattedDateField;\n\n    @JsonbDateFormat(value = \"HH:mm:ss ^^ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public Date getterAndSetterAndFieldFormattedDateField;\n\n\n\n    public Date getPlainDateField() {\n        return plainDateField;\n    }\n\n    public void setPlainDateField(Date plainDateField) {\n        this.plainDateField = plainDateField;\n    }\n\n\n\n    public Date getFormattedDateField() {\n        return formattedDateField;\n    }\n\n    public void setFormattedDateField(Date formattedDateField) {\n        this.formattedDateField = formattedDateField;\n    }\n\n\n\n    @JsonbDateFormat(value = \"HH:mm:ss ^^ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public Date getGetterFormattedDateField() {\n        return getterFormattedDateField;\n    }\n\n    public void setGetterFormattedDateField(Date getterFormattedDateField) {\n        this.getterFormattedDateField = getterFormattedDateField;\n    }\n\n\n\n    public Date getSetterFormattedDateField() {\n        return setterFormattedDateField;\n    }\n\n    @JsonbDateFormat(value = \"HH:mm:ss ^^ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public void setSetterFormattedDateField(Date setterFormattedDateField) {\n        this.setterFormattedDateField = setterFormattedDateField;\n    }\n\n\n\n    @JsonbDateFormat(value = \"HH:mm:ss <> dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public Date getGetterAndFieldFormattedDateField() {\n        return getterAndFieldFormattedDateField;\n    }\n\n    public void setGetterAndFieldFormattedDateField(Date getterAndFieldFormattedDateField) {\n        this.getterAndFieldFormattedDateField = getterAndFieldFormattedDateField;\n    }\n\n\n\n    public Date getSetterAndFieldFormattedDateField() {\n        return setterAndFieldFormattedDateField;\n    }\n\n    @JsonbDateFormat(value = \"HH:mm:ss <> dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public void setSetterAndFieldFormattedDateField(Date setterAndFieldFormattedDateField) {\n        this.setterAndFieldFormattedDateField = setterAndFieldFormattedDateField;\n    }\n\n\n\n    @JsonbDateFormat(value = \"HH:mm:ss ^^ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public Date getGetterAndSetterFormattedDateField() {\n        return getterAndSetterFormattedDateField;\n    }\n\n    @JsonbDateFormat(value = \"HH:mm:ss <> dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public void setGetterAndSetterFormattedDateField(Date getterAndSetterFormattedDateField) {\n        this.getterAndSetterFormattedDateField = getterAndSetterFormattedDateField;\n    }\n\n\n\n    @JsonbDateFormat(value = \"HH:mm:ss <> dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public Date getGetterAndSetterAndFieldFormattedDateField() {\n        return getterAndSetterAndFieldFormattedDateField;\n    }\n\n    @JsonbDateFormat(value = \"HH:mm:ss $$ dd-MM-yyyy\", locale = \"Europe/Copenhagen\")\n    public void setGetterAndSetterAndFieldFormattedDateField(Date getterAndSetterAndFieldFormattedDateField) {\n        this.getterAndSetterAndFieldFormattedDateField = getterAndSetterAndFieldFormattedDateField;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/Dog.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\npublic class Dog implements Animal {\n\n    private String dogProperty;\n\n    public Dog() {\n    }\n\n    public Dog(String dogProperty) {\n        this.dogProperty = dogProperty;\n    }\n\n    public String getDogProperty() {\n        return dogProperty;\n    }\n\n    public void setDogProperty(String dogProperty) {\n        this.dogProperty = dogProperty;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/FieldCustomOrder.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbPropertyOrder;\n\n/**\n * @author David Kral\n */\n@JsonbPropertyOrder({\"aField\", \"cField\", \"dField\" ,\"bField\"})\npublic class FieldCustomOrder {\n\n    public String aField = \"aValue\";\n    public String dField = \"dValue\";\n    public String bField = \"bValue\";\n    public String cField = \"cValue\";\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/FieldCustomOrderWrapper.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\n/**\n * @author David Kral\n */\npublic class FieldCustomOrderWrapper {\n\n    public String stringField = \"stringValue\";\n    public int intField = 1;\n    public FieldCustomOrder fieldCustomOrder = new FieldCustomOrder();\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/FieldOrder.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\n/**\n * @author David Kral\n */\npublic class FieldOrder {\n\n    public String aField = \"aValue\";\n    public String dField = \"dValue\";\n    public String bField = \"bValue\";\n    public String cField = \"cValue\";\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/FieldOrderNameAnnotation.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author David Kral\n */\npublic class FieldOrderNameAnnotation {\n\n    @JsonbProperty(value = \"zField\")\n    public String aField = \"aValue\";\n    public String dField = \"dValue\";\n    public String bField = \"bValue\";\n    public String cField = \"cValue\";\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/FieldSpecificOrder.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbPropertyOrder;\n\n/**\n * @author David Kral\n */\n@JsonbPropertyOrder({\"aField\", \"dField\"})\npublic class FieldSpecificOrder {\n\n    public String aField = \"aValue\";\n    public String dField = \"dValue\";\n    public String bField = \"bValue\";\n    public String cField = \"cValue\";\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/ImplementationClassPojo.java",
    "content": "/*\n * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport org.eclipse.yasson.ImplementationClass;\n\npublic class ImplementationClassPojo {\n\n    @ImplementationClass(Dog.class)\n    private Animal animal;\n\n    public Animal getAnimal() {\n        return animal;\n    }\n\n    public void setAnimal(Animal animal) {\n        this.animal = animal;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/InheritedAnnotationsPojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\n/**\n * @author Roman Grigoriadi\n */\n@InheritsNillableRecursion\npublic class InheritedAnnotationsPojo {\n\n    @InheritsJsonbProperty\n    public String property;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/InheritsJsonbProperty.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@JsonbProperty(\"renamedProperty\")\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})\npublic @interface InheritsJsonbProperty {\n    String value() default \"abc\";\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/InheritsNillable.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbNillable;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.*;\n\n@JsonbNillable()\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ANNOTATION_TYPE, TYPE, PACKAGE})\npublic @interface InheritsNillable {\n    String value() default \"abc\";\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/InheritsNillableRecursion.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.*;\n\n@InheritsNillable\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ANNOTATION_TYPE, TYPE, PACKAGE})\npublic @interface InheritsNillableRecursion {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/InterfacedPojoA.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author Roman Grigoriadi\n */\npublic interface InterfacedPojoA {\n\n\n    @JsonbProperty(\"propA\")\n    String getPropertyA();\n\n    @JsonbProperty(\"propA\")\n    void setPropertyA(String property);\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/InterfacedPojoAbsImpl.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic abstract class InterfacedPojoAbsImpl implements InterfacedPojoA {\n\n    private String propertyA;\n\n    @Override\n    public String getPropertyA() {\n        return propertyA;\n    }\n\n    @Override\n    public void setPropertyA(String property) {\n        this.propertyA = property;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/InterfacedPojoB.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author Roman Grigoriadi\n */\npublic interface InterfacedPojoB extends InterfacedPojoA {\n\n    @JsonbProperty(\"propB\")\n    String getPropertyB();\n\n    @JsonbProperty(\"propB\")\n    void setPropertyB(String propertyB);\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/InterfacedPojoC.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author Roman Grigoriadi\n */\npublic interface InterfacedPojoC extends InterfacedPojoB {\n\n    @JsonbProperty(\"propC\")\n    String getPropertyC();\n\n    @JsonbProperty(\"propC\")\n    void setPropertyC(String propertyC);\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/InterfacedPojoImpl.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class InterfacedPojoImpl extends InterfacedPojoAbsImpl implements InterfacedPojoB {\n\n    private String propertyB;\n\n    @Override\n    public String getPropertyB() {\n        return propertyB;\n    }\n\n    @Override\n    public void setPropertyB(String propertyB) {\n        this.propertyB = propertyB;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/JsonbNillableClassFirstLevel.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\n/**\n * Implements a class with nillable annotation.\n *\n * @author Roman Grigoriadi\n */\npublic class JsonbNillableClassFirstLevel implements JsonbNillableInterfaceBaseOne {\n\n    private String classNillable;\n\n    public String getClassNillable() {\n        return classNillable;\n    }\n\n    public void setClassNillable(String classNillable) {\n        this.classNillable = classNillable;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/JsonbNillableClassSecondLevel.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\n/**\n * Extends a class which implements interface which is nillable.\n *\n * @author Roman Grigoriadi\n */\npublic class JsonbNillableClassSecondLevel extends JsonbNillableClassFirstLevel {\n\n    private String subclassNillable;\n\n    public String getSubclassNillable() {\n        return subclassNillable;\n    }\n\n    public void setSubclassNillable(String subclassNillable) {\n        this.subclassNillable = subclassNillable;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/JsonbNillableInterfaceBase.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbNillable;\n\n/**\n * All extending classes should be nillable.\n * @author Roman Grigoriadi\n */\n@JsonbNillable\npublic interface JsonbNillableInterfaceBase {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/JsonbNillableInterfaceBaseOne.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic interface JsonbNillableInterfaceBaseOne extends JsonbNillableInterfaceBase {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/JsonbNillableInterfaceBaseTwo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbNillable;\n\n/**\n * Overrides super interface nillable value.\n *\n * @author Roman Grigoriadi\n */\n@JsonbNillable(false)\npublic interface JsonbNillableInterfaceBaseTwo extends JsonbNillableInterfaceBase {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/JsonbNillableOverriddenWithJsonbProperty.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class JsonbNillableOverriddenWithJsonbProperty {\n\n    @JsonbProperty(\"nillableOverriddenAccidentallyWithDefaultValue\")\n    private String nillableOverriddenWithFieldJsonbProperty;\n\n    private String nillableOverriddenWithGetterJsonbProperty;\n\n    private String nillableOverriddenWithSetterJsonbProperty;\n\n    public String getNillableOverriddenWithFieldJsonbProperty() {\n        return nillableOverriddenWithFieldJsonbProperty;\n    }\n\n    public void setNillableOverriddenWithFieldJsonbProperty(String nillableOverriddenWithFieldJsonbProperty) {\n        this.nillableOverriddenWithFieldJsonbProperty = nillableOverriddenWithFieldJsonbProperty;\n    }\n\n    @JsonbProperty(nillable = false)\n    public String getNillableOverriddenWithGetterJsonbProperty() {\n        return nillableOverriddenWithGetterJsonbProperty;\n    }\n\n    public void setNillableOverriddenWithGetterJsonbProperty(String nillableOverriddenWithGetterJsonbProperty) {\n        this.nillableOverriddenWithGetterJsonbProperty = nillableOverriddenWithGetterJsonbProperty;\n    }\n\n    public String getNillableOverriddenWithSetterJsonbProperty() {\n        return nillableOverriddenWithSetterJsonbProperty;\n    }\n\n    @JsonbProperty(nillable = false)\n    public void setNillableOverriddenWithSetterJsonbProperty(String nillableOverriddenWithSetterJsonbProperty) {\n        this.nillableOverriddenWithSetterJsonbProperty = nillableOverriddenWithSetterJsonbProperty;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/JsonbNillableOverridesClass.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbNillable;\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author Roman Grigoriadi\n */\n@JsonbNillable\npublic class JsonbNillableOverridesClass  extends JsonbNillableOverridesInterface {\n    @JsonbProperty(\"overridesNillableInParent\")\n    public String nillableField;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/JsonbNillableOverridesInterface.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbNillable;\n\n/**\n * @author Roman Grigoriadi\n */\n@JsonbNillable(false)\npublic class JsonbNillableOverridesInterface implements JsonbNillableInterfaceBaseTwo {\n    public String nillableField;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/JsonbNillableValue.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbNillable;\n\n/**\n * @author Roman Grigoriadi\n */\n@JsonbNillable\npublic class JsonbNillableValue {\n\n    private String nillableField;\n\n    private String privateField;\n\n    private static String staticField;\n\n    public String getNillableField() {\n        return nillableField;\n    }\n\n    public void setNillableField(String nillableField) {\n        this.nillableField = nillableField;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/JsonbPropertyName.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class JsonbPropertyName {\n\n    @JsonbProperty(\"fieldAnnotatedNameCustomized\")\n    private String fieldAnnotatedName;\n\n    private String methodAnnotName;\n\n    @JsonbProperty(\"fieldAnnotatedNameToOverride\")\n    private String fieldOverriddenWithMethodAnnot;\n\n    public String getFieldAnnotatedName() {\n        return fieldAnnotatedName;\n    }\n\n    public void setFieldAnnotatedName(String fieldAnnotatedName) {\n        this.fieldAnnotatedName = fieldAnnotatedName;\n    }\n\n    @JsonbProperty(\"getterAnnotatedName\")\n    public String getMethodAnnotName() {\n        return methodAnnotName;\n    }\n\n    @JsonbProperty(\"setterAnnotatedName\")\n    public void setMethodAnnotName(String methodAnnotName) {\n        this.methodAnnotName = methodAnnotName;\n    }\n\n    @JsonbProperty(\"getterOverriddenName\")\n    public String getFieldOverriddenWithMethodAnnot() {\n        return fieldOverriddenWithMethodAnnot;\n    }\n\n    @JsonbProperty(\"setterOverriddenName\")\n    public void setFieldOverriddenWithMethodAnnot(String fieldOverriddenWithMethodAnnot) {\n        this.fieldOverriddenWithMethodAnnot = fieldOverriddenWithMethodAnnot;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/JsonbPropertyNameCollision.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class JsonbPropertyNameCollision {\n\n    private String pojoName;\n\n    @JsonbProperty(\"pojoName\")\n    private String pojoNameCollision;\n\n    public String getPojoName() {\n        return pojoName;\n    }\n\n    public void setPojoName(String pojoName) {\n        this.pojoName = pojoName;\n    }\n\n    public String getPojoNameCollision() {\n        return pojoNameCollision;\n    }\n\n    public void setPojoNameCollision(String pojoNameCollision) {\n        this.pojoNameCollision = pojoNameCollision;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/JsonbPropertyNillable.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class JsonbPropertyNillable {\n\n    @JsonbProperty(nillable = true)\n    private String nullField;\n\n    @JsonbProperty(nillable = false)\n    private String nillableOverride;\n\n    public String getNullField() {\n        return nullField;\n    }\n\n    public void setNullField(String nullField) {\n        this.nullField = nullField;\n    }\n\n    @JsonbProperty(nillable = true)\n    public String getNillableOverride() {\n        return nillableOverride;\n    }\n\n    public void setNillableOverride(String nillableOverride) {\n        this.nillableOverride = nillableOverride;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/NumberFormatPojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbNumberFormat;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\n\n/**\n * @author Roman Grigoriadi\n */\n@JsonbNumberFormat(\"0.0\")\npublic class NumberFormatPojo {\n\n    @JsonbNumberFormat(\"00000000.000000\")\n    public BigDecimal bigDecimal;\n\n    @JsonbNumberFormat(\"00000000\")\n    public BigInteger bigInteger;\n\n    @JsonbNumberFormat(\"000.00000000\")\n    public Double aDouble;\n\n    @JsonbNumberFormat(\"000.00000000\")\n    public Float aFloat;\n\n    @JsonbNumberFormat(\"00000000000\")\n    public Long aLong;\n\n    public Integer integer;\n\n    @JsonbNumberFormat(\"00000\")\n    public Short aShort;\n\n    @JsonbNumberFormat(\"000\")\n    public Byte aByte;\n\n    private Double doubleGetterFormatted;\n\n    private Double doubleSetterFormatted;\n\n    @JsonbNumberFormat(value = \"000.000\", locale = \"en-us\")\n    private Double doubleSetterAndPropertyFormatter;\n\n    @JsonbNumberFormat(\"000.00000000\")\n    public Double getDoubleGetterFormatted() {\n        return doubleGetterFormatted;\n    }\n\n    public void setDoubleGetterFormatted(Double doubleGetterFormatted) {\n        this.doubleGetterFormatted = doubleGetterFormatted;\n    }\n\n    public Double getDoubleSetterFormatted() {\n        return doubleSetterFormatted;\n    }\n\n    @JsonbNumberFormat(value = \"000,000\", locale = \"da-da\")\n    public void setDoubleSetterFormatted(Double doubleSetterFormatted) {\n        this.doubleSetterFormatted = doubleSetterFormatted;\n    }\n\n    public Double getDoubleSetterAndPropertyFormatter() {\n        return doubleSetterAndPropertyFormatter;\n    }\n\n    @JsonbNumberFormat(value = \"000,000\", locale = \"da-da\")\n    public void setDoubleSetterAndPropertyFormatter(Double doubleSetterAndPropertyFormatter) {\n        this.doubleSetterAndPropertyFormatter = doubleSetterAndPropertyFormatter;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/NumberFormatPojoWithoutClassLevelFormatter.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbNumberFormat;\n\n/**\n * @author Ehsan Zaery Moghaddam (zaerymoghaddam@gmail.com)\n */\npublic class NumberFormatPojoWithoutClassLevelFormatter {\n    private Double doubleGetterFormatted;\n\n    private Double doubleSetterFormatted;\n\n    @JsonbNumberFormat(value = \"000.000\", locale = \"en-us\")\n    private Double doubleSetterAndPropertyFormatter;\n\n    @JsonbNumberFormat(\"000.00000000\")\n    public Double getDoubleGetterFormatted() {\n        return doubleGetterFormatted;\n    }\n\n    public void setDoubleGetterFormatted(Double doubleGetterFormatted) {\n        this.doubleGetterFormatted = doubleGetterFormatted;\n    }\n\n    public Double getDoubleSetterFormatted() {\n        return doubleSetterFormatted;\n    }\n\n    @JsonbNumberFormat(value = \"000,000\", locale = \"da-da\")\n    public void setDoubleSetterFormatted(Double doubleSetterFormatted) {\n        this.doubleSetterFormatted = doubleSetterFormatted;\n    }\n\n    public Double getDoubleSetterAndPropertyFormatter() {\n        return doubleSetterAndPropertyFormatter;\n    }\n\n    @JsonbNumberFormat(value = \"000,000\", locale = \"da-da\")\n    public void setDoubleSetterAndPropertyFormatter(Double doubleSetterAndPropertyFormatter) {\n        this.doubleSetterAndPropertyFormatter = doubleSetterAndPropertyFormatter;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/ParameterNameTester.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport java.net.URI;\n\n/**\n *\n * @author David Kral\n */\npublic class ParameterNameTester {\n    @JsonbProperty(\"string\")\n    public final String name;\n    @JsonbProperty(\"someParam\")\n    public final String secondParam;\n\n    @JsonbCreator\n    public ParameterNameTester(@JsonbProperty(\"string\") String name, @JsonbProperty(\"someParam\") String secondParam) {\n        this.name = name;\n        this.secondParam = secondParam;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/RenamedPropertiesContainer.java",
    "content": "/*\n * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\n/*\n * $Id$\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\n\npublic class RenamedPropertiesContainer {\n    @JsonbProperty(\"first\")\n    private int intInstance;\n    @JsonbProperty(\"second\")\n    private String stringInstance;\n    @JsonbProperty(\"third\")\n    private long longInstance;\n\n    public String getStringInstance() {\n        return stringInstance;\n    }\n\n    public void setStringInstance(String stringInstance) {\n        this.stringInstance = stringInstance;\n        if (intInstance == 1) {\n            intInstance = 2;\n        }\n    }\n\n    public int getIntInstance() {\n        return intInstance;\n    }\n\n    public void setIntInstance(int intInstance) {\n        this.intInstance = intInstance;\n    }\n\n    public long getLongInstance() {\n        return longInstance;\n    }\n\n    public void setLongInstance(long longInstance) {\n        this.longInstance = longInstance;\n        if (intInstance == 2) {\n            intInstance = 3;\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/TrimmedDatePojo.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport java.time.Instant;\nimport java.time.LocalDateTime;\nimport java.time.ZonedDateTime;\nimport java.util.Calendar;\nimport java.util.Date;\n\npublic class TrimmedDatePojo {\n\n    @JsonbDateFormat(value = \"yyyy.MM.dd\")\n    private Date date;\n\n    @JsonbDateFormat(value = \"yyyy.MM.dd\")\n    private Calendar calendar;\n\n    @JsonbDateFormat(value = \"yyyy.MM.dd\")\n    private LocalDateTime localDateTime;\n\n    @JsonbDateFormat(value = \"yyyy.MM.dd\")\n    private ZonedDateTime zonedDateTime;\n\n\n    @JsonbDateFormat(value = \"yyyy.MM.dd HH:ss\")\n    private ZonedDateTime zonedDateTimeHoursAndSeconds;\n\n    @JsonbDateFormat(value = \"yyyy.MM.dd N\")\n    private ZonedDateTime zonedDateTimeNanosOfDay;\n\n    @JsonbDateFormat(value = \"yyyy.MM.dd VV\")\n    private ZonedDateTime zonedDateTimeOverriddenZone;\n\n    @JsonbDateFormat(value = \"yyyy.MM.dd VV\")\n    private Instant zonedInstant;\n\n    public Date getDate() {\n        return date;\n    }\n\n    public void setDate(Date date) {\n        this.date = date;\n    }\n\n    public LocalDateTime getLocalDateTime() {\n        return localDateTime;\n    }\n\n    public void setLocalDateTime(LocalDateTime localDateTime) {\n        this.localDateTime = localDateTime;\n    }\n\n    public ZonedDateTime getZonedDateTime() {\n        return zonedDateTime;\n    }\n\n    public void setZonedDateTime(ZonedDateTime zonedDateTime) {\n        this.zonedDateTime = zonedDateTime;\n    }\n\n    public ZonedDateTime getZonedDateTimeNanosOfDay() {\n        return zonedDateTimeNanosOfDay;\n    }\n\n    public void setZonedDateTimeNanosOfDay(ZonedDateTime zonedDateTimeNanosOfDay) {\n        this.zonedDateTimeNanosOfDay = zonedDateTimeNanosOfDay;\n    }\n\n    public ZonedDateTime getZonedDateTimeHoursAndSeconds() {\n        return zonedDateTimeHoursAndSeconds;\n    }\n\n    public void setZonedDateTimeHoursAndSeconds(ZonedDateTime zonedDateTimeHoursAndSeconds) {\n        this.zonedDateTimeHoursAndSeconds = zonedDateTimeHoursAndSeconds;\n    }\n\n    public ZonedDateTime getZonedDateTimeOverriddenZone() {\n        return zonedDateTimeOverriddenZone;\n    }\n\n    public void setZonedDateTimeOverriddenZone(ZonedDateTime zonedDateTimeOverriddenZone) {\n        this.zonedDateTimeOverriddenZone = zonedDateTimeOverriddenZone;\n    }\n\n    public Instant getZonedInstant() {\n        return zonedInstant;\n    }\n\n    public void setZonedInstant(Instant zonedInstant) {\n        this.zonedInstant = zonedInstant;\n    }\n\n    public Calendar getCalendar() {\n        return calendar;\n    }\n\n    public void setCalendar(Calendar calendar) {\n        this.calendar = calendar;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/packagelevelannotations/JsonbNillablePackageLevel.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model.packagelevelannotations;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class JsonbNillablePackageLevel {\n\n    private String packageLevelNillableField;\n\n    public String getPackageLevelNillableField() {\n        return packageLevelNillableField;\n    }\n\n    public void setPackageLevelNillableField(String packageLevelNillableField) {\n        this.packageLevelNillableField = packageLevelNillableField;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/packagelevelannotations/PackageLevelOverriddenWithClassLevel.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.model.packagelevelannotations;\n\nimport jakarta.json.bind.annotation.JsonbNillable;\n\n/**\n * @author Roman Grigoriadi\n */\n@JsonbNillable(false)\npublic class PackageLevelOverriddenWithClassLevel {\n\n    private String nillableOverriddenField;\n\n    public String getNillableOverriddenField() {\n        return nillableOverriddenField;\n    }\n\n    public void setNillableOverriddenField(String nillableOverriddenField) {\n        this.nillableOverriddenField = nillableOverriddenField;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/model/packagelevelannotations/package-info.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\n/**\n * @author Roman Grigoriadi\n */\n@JsonbNillable\npackage org.eclipse.yasson.customization.model.packagelevelannotations;\n\nimport jakarta.json.bind.annotation.JsonbNillable;\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/polymorphism/AnnotationPolymorphismTest.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.polymorphism;\n\nimport java.time.LocalDate;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.annotation.JsonbSubtype;\nimport jakarta.json.bind.annotation.JsonbTypeInfo;\n\nimport org.eclipse.yasson.Jsonbs;\nimport org.junit.jupiter.api.Test;\n\nimport static org.hamcrest.CoreMatchers.instanceOf;\nimport static org.hamcrest.CoreMatchers.is;\nimport static org.hamcrest.CoreMatchers.startsWith;\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.junit.jupiter.api.Assertions.assertThrows;\n\n/**\n * Tests for verification of proper polymorphism handling based on annotation.\n */\npublic class AnnotationPolymorphismTest {\n\n    public static final String ARRAY_EXPECTED = \"[{\\\"@type\\\":\\\"dog\\\",\\\"isDog\\\":true},{\\\"@type\\\":\\\"cat\\\",\\\"isCat\\\":true},\"\n            + \"{\\\"@type\\\":\\\"dog\\\",\\\"isDog\\\":true}]\";\n\n    @Test\n    public void testBasicSerialization() {\n        Dog dog = new Dog();\n        assertThat(Jsonbs.defaultJsonb.toJson(dog), is(\"{\\\"@type\\\":\\\"dog\\\",\\\"isDog\\\":true}\"));\n        Cat cat = new Cat();\n        assertThat(Jsonbs.defaultJsonb.toJson(cat), is(\"{\\\"@type\\\":\\\"cat\\\",\\\"isCat\\\":true}\"));\n    }\n\n    @Test\n    public void testBasicDeserialization() {\n        Animal dog = Jsonbs.defaultJsonb.fromJson(\"{\\\"@type\\\":\\\"dog\\\",\\\"isDog\\\":false}\", Animal.class);\n        assertThat(dog, instanceOf(Dog.class));\n        assertThat(((Dog) dog).isDog, is(false));\n        Animal cat = Jsonbs.defaultJsonb.fromJson(\"{\\\"@type\\\":\\\"cat\\\",\\\"isCat\\\":false}\", Animal.class);\n        assertThat(cat, instanceOf(Cat.class));\n        assertThat(((Cat) cat).isCat, is(false));\n    }\n\n    @Test\n    public void testExactTypeDeserialization() {\n        Dog dog = Jsonbs.defaultJsonb.fromJson(\"{\\\"isDog\\\":false}\", Dog.class);\n        assertThat(dog.isDog, is(false));\n        dog = Jsonbs.defaultJsonb.fromJson(\"{\\\"@type\\\":\\\"dog\\\", \\\"isDog\\\":false}\", Dog.class);\n        assertThat(dog.isDog, is(false));\n    }\n\n    @Test\n    public void testUnknownAliasDeserialization() {\n        JsonbException exception = assertThrows(JsonbException.class,\n                                                () -> Jsonbs.defaultJsonb.fromJson(\"{\\\"@type\\\":\\\"rat\\\",\\\"isDog\\\":false}\",\n                                                                                   Animal.class));\n        assertThat(exception.getMessage(), startsWith(\"Unknown alias \\\"rat\\\" of the type org.eclipse.yasson.customization.\"\n                                                              + \"polymorphism.AnnotationPolymorphismTest$Animal. Known aliases: [\"));\n    }\n\n    @Test\n    public void testUnknownAliasSerialization() {\n        Rat rat = new Rat();\n        assertThat(Jsonbs.defaultJsonb.toJson(rat), is(\"{\\\"isRat\\\":true}\"));\n    }\n\n    @Test\n    public void testCreatorDeserialization() {\n        SomeDateType creator = Jsonbs.defaultJsonb\n                .fromJson(\"{\\\"@dateType\\\":\\\"constructor\\\",\\\"localDate\\\":\\\"26-02-2021\\\"}\", SomeDateType.class);\n        assertThat(creator, instanceOf(DateConstructor.class));\n    }\n\n    @Test\n    public void testArraySerialization() {\n        Animal[] animals = new Animal[] {new Dog(), new Cat(), new Dog()};\n        assertThat(Jsonbs.defaultJsonb.toJson(animals), is(ARRAY_EXPECTED));\n    }\n\n    @Test\n    public void testArrayDeserialization() {\n        Animal[] deserialized = Jsonbs.defaultJsonb.fromJson(ARRAY_EXPECTED, Animal[].class);\n        assertThat(deserialized.length, is(3));\n        assertThat(deserialized[0], instanceOf(Dog.class));\n        assertThat(deserialized[1], instanceOf(Cat.class));\n        assertThat(deserialized[2], instanceOf(Dog.class));\n    }\n\n    @JsonbTypeInfo({\n            @JsonbSubtype(alias = \"dog\", type = Dog.class),\n            @JsonbSubtype(alias = \"cat\", type = Cat.class)\n    })\n    public interface Animal {\n\n    }\n\n    public static class Dog implements Animal {\n\n        public boolean isDog = true;\n\n    }\n\n    public static class Cat implements Animal {\n\n        public boolean isCat = true;\n\n    }\n\n    public static class Rat implements Animal {\n\n        public boolean isRat = true;\n\n    }\n\n    @JsonbTypeInfo(key = \"@dateType\", value = {\n            @JsonbSubtype(alias = \"constructor\", type = DateConstructor.class)\n    })\n    public interface SomeDateType {\n\n    }\n\n    public static final class DateConstructor implements SomeDateType {\n\n        public LocalDate localDate;\n\n        @JsonbCreator\n        public DateConstructor(@JsonbProperty(\"localDate\") @JsonbDateFormat(value = \"dd-MM-yyyy\", locale = \"nl-NL\") LocalDate localDate) {\n            this.localDate = localDate;\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/polymorphism/MultiplePolymorphicInfoTest.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.polymorphism;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.annotation.JsonbSubtype;\nimport jakarta.json.bind.annotation.JsonbTypeInfo;\n\nimport org.junit.jupiter.api.Test;\n\nimport static org.hamcrest.CoreMatchers.instanceOf;\nimport static org.hamcrest.CoreMatchers.is;\nimport static org.hamcrest.MatcherAssert.assertThat;\n\n/**\n * TODO javadoc\n */\npublic class MultiplePolymorphicInfoTest {\n\n    private static final Jsonb JSONB = JsonbBuilder.create();\n\n    @Test\n    public void testMultiplePolymorphicInfoPropertySerialization() {\n        String expected = \"{\\\"@something\\\":\\\"animal\\\",\\\"@animal\\\":\\\"dog\\\",\\\"@dogRace\\\":\\\"labrador\\\",\\\"isLabrador\\\":true}\";\n        Labrador labrador = new Labrador();\n        assertThat(JSONB.toJson(labrador), is(expected));\n    }\n\n    @Test\n    public void testMultiplePolymorphicInfoPropertyDeserialization() {\n        String json = \"{\\\"@something\\\":\\\"animal\\\",\\\"@animal\\\":\\\"dog\\\",\\\"@dogRace\\\":\\\"labrador\\\",\\\"isLabrador\\\":true}\";\n        assertThat(JSONB.fromJson(json, Labrador.class), instanceOf(Labrador.class));\n    }\n\n    @Test\n    public void testPolymorphicParentInstanceSerialization() {\n        String expected = \"{\\\"@type\\\":\\\"area\\\",\\\"name\\\":\\\"North America\\\",\\\"population\\\":600000000}\";\n        Area northAmerica = new Area();\n        northAmerica.name = \"North America\";\n        northAmerica.population = 600000000;\n        assertThat(JSONB.toJson(northAmerica), is(expected));\n    }\n\n    @Test\n    public void testPolymorphicParentInstanceDeserialization() {\n        String json = \"{\\\"@type\\\":\\\"area\\\",\\\"name\\\":\\\"North America\\\",\\\"population\\\":600000000}\";\n        assertThat(JSONB.fromJson(json, Location.class), instanceOf(Area.class));\n    }\n\n    @JsonbTypeInfo(key = \"@something\", value = {\n            @JsonbSubtype(alias = \"animal\", type = Animal.class)\n    })\n    public interface Something { }\n\n    @JsonbTypeInfo(key = \"@animal\", value = {\n            @JsonbSubtype(alias = \"dog\", type = Dog.class)\n    })\n    public interface Animal extends Something {\n    }\n\n    @JsonbTypeInfo(key = \"@dogRace\", value = {\n            @JsonbSubtype(alias = \"labrador\", type = Labrador.class)\n    })\n    public interface Dog extends Animal {\n    }\n\n    public static class Labrador implements Dog {\n\n        public boolean isLabrador = true;\n\n    }\n\n    @JsonbTypeInfo({\n            @JsonbSubtype(alias = \"area\", type = Area.class)\n    })\n    public interface Location {\n    }\n\n    @JsonbTypeInfo(key = \"@area\", value = {\n            @JsonbSubtype(alias = \"city\", type = City.class),\n            @JsonbSubtype(alias = \"state\", type = State.class)\n    })\n    public static class Area implements Location {\n        public String name;\n        public long population;\n    }\n\n    public static class City extends Area {\n        public String state;\n    }\n\n    public static class State extends Area {\n        public String capital;\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/polymorphism/NestedPolymorphismTest.java",
    "content": "/*\n * Copyright (c) 2021, 2023 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.polymorphism;\n\nimport jakarta.json.bind.annotation.JsonbSubtype;\nimport jakarta.json.bind.annotation.JsonbTypeInfo;\n\nimport org.eclipse.yasson.Jsonbs;\nimport org.junit.jupiter.api.Test;\n\nimport static org.eclipse.yasson.Jsonbs.defaultJsonb;\nimport static org.hamcrest.CoreMatchers.instanceOf;\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.junit.jupiter.api.Assertions.assertDoesNotThrow;\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.assertNotNull;\n\n/**\n * Tests for verification of proper polymorphism handling based on annotation.\n */\npublic class NestedPolymorphismTest {\n\n    /**\n     * 1st test for: https://github.com/eclipse-ee4j/yasson/issues/589\n     * <p>(deserialization of nested polymorphic and unmapped properties)\n     */\n    @Test\n    public void testNestedUnmappedProperty() {\n        String json = \"{\\\"inner\\\":{\\\"id\\\":123,\\\"@type\\\":\\\"derivationA\\\",\"\n                + \"\\\"unmapped\\\":{\\\"x\\\":9,\\\"y\\\":[9,8,7]},\\\"name\\\":\\\"abc\\\"}}\";\n        Outer obj = assertDoesNotThrow(() -> defaultJsonb.fromJson(json, Outer.class));\n        assertEquals(123L, obj.inner.id);\n        assertEquals(\"abc\", obj.inner.name);\n    }\n\n    // a base class\n    @JsonbTypeInfo(key = \"@type\", value =\n            @JsonbSubtype(type = InnerBase.class, alias = \"derivationA\"))\n    public static class InnerBase {\n        public Long id;\n        public String name;\n    }\n\n    // derivation of the base class\n    public class Derivation extends InnerBase {}\n\n    // an arbitrary 'outer' root element\n    public static class Outer {\n        public InnerBase inner;\n    }\n\n    /**\n     * 2nd test for: https://github.com/eclipse-ee4j/yasson/issues/589\n     * <p>(deserialization of multiple nested polymorphic properties)\n     */\n    @Test\n    public void testNestedDeserialization() {\n        String json = \"{\\\"@type\\\":\\\"Pets\\\",\\\"pet1\\\":{\\\"@type\\\":\\\"Cat\\\",\\\"name\\\":\\\"kitty\\\"}\"\n                + \",\\\"pet2\\\":{\\\"@type\\\":\\\"Dog\\\",\\\"name\\\":\\\"puppy\\\"}}\";\n        final Animals animals = Jsonbs.defaultJsonb.fromJson(json, Animals.class);\n        assertThat(animals, instanceOf(Pets.class));\n        assertNotNull(((Pets) animals).pet1, \"Empty 'pet1' property\");\n        assertEquals(\"kitty\", ((Cat) ((Pets) animals).pet1).name, \"First pet has invalid name\");\n        assertNotNull(((Pets) animals).pet2, \"Empty 'pet2' property\");\n        assertThat(\"Invalid pet nr 2\", ((Pets) animals).pet2, instanceOf(Dog.class));\n    }\n    \n    @JsonbTypeInfo(key = \"@type\", value = {\n            @JsonbSubtype(alias = \"Dog\", type = Dog.class),\n            @JsonbSubtype(alias = \"Cat\", type = Cat.class)\n    })\n    public interface Pet {\n        public String getType();\n    }\n\n    public static class Dog implements Pet {\n\n        public String name;\n\n        @Override\n        public String getType() {\n            return \"Dog\";\n        }\n    }\n\n    public static class Cat implements Pet {\n\n        public String name;\n\n        @Override\n        public String getType() {\n            return \"Cat\";\n        }\n    }\n\n    @JsonbTypeInfo(key = \"@type\", value = {\n            @JsonbSubtype(alias = \"Pets\", type = Pets.class),\n            @JsonbSubtype(alias = \"Fishes\", type = Fishes.class)\n        })\n    public interface Animals {\n\n    }\n\n    public static class Pets implements Animals {\n        public Pet pet1;\n        public Pet pet2;\n    }\n\n    public static class Fishes implements Animals {\n\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/transients/JsonbTransientTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.transients;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.customization.transients.models.*;\nimport jakarta.json.bind.JsonbException;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class JsonbTransientTest {\n\n    @Test\n    public void testJsonbTransientPropertySerialize() {\n        JsonbTransientValue pojo = new JsonbTransientValue();\n        pojo.setPlainProperty(\"non transient\");\n        pojo.setPropertyTransient(\"TRANSIENT\");\n        pojo.setGetterTransient(\"Getter transient value\");\n        pojo.setSetterTransient(\"Setter transient value\");\n        pojo.setGetterAndPropertyTransient(\"Getter and property transient value\");\n        pojo.setSetterAndPropertyTransient(\"Setter and property transient value\");\n        pojo.setSetterAndGetterTransient(\"Setter and getter transient value\");\n        pojo.setSetterAndGetterAndPropertyTransient(\"Setter and getter and property transient value\");\n\n        assertEquals(\"{\\\"plainProperty\\\":\\\"non transient\\\",\\\"setterTransient\\\":\\\"Setter transient value\\\"}\", defaultJsonb.toJson(pojo));\n    }\n\n    @Test\n    public void testJsonbTransientPropertyDeserialize() {\n        JsonbTransientValue result = defaultJsonb.fromJson(\"{\\\"plainProperty\\\":\\\"plainProperty value\\\",\" +\n                        \"\\\"propertyTransient\\\":\\\"TRANSIENT\\\",\" +\n                        \"\\\"getterTransient\\\":\\\"Getter transient value\\\",\" +\n                        \"\\\"setterTransient\\\":\\\"Setter transient value\\\",\" +\n                        \"\\\"getterAndPropertyTransient\\\":\\\"Getter and property transient value\\\",\" +\n                        \"\\\"setterAndPropertyTransient\\\":\\\"Setter and property transient value\\\",\" +\n                        \"\\\"setterAndGetterTransient\\\":\\\"Setter and getter transient value\\\",\" +\n                        \"\\\"setterAndGetterAndPropertyTransient\\\":\\\"Setter and getter and property transient value\\\"\" +\n                        \"}\"\n                , JsonbTransientValue.class);\n\n        assertEquals(\"plainProperty value\", result.getPlainProperty());\n        assertNull(result.getPropertyTransient());\n        assertEquals(\"Getter transient value\", result.getGetterTransient());\n        assertNull(result.getSetterTransient());\n        assertNull(result.getGetterAndPropertyTransient());\n        assertNull(result.getSetterAndPropertyTransient());\n        assertNull(result.getSetterAndGetterTransient());\n        assertNull(result.getSetterAndGetterAndPropertyTransient());\n    }\n\n    @Test\n    public void testTransientCollidesOnProperty() throws Exception {\n        JsonbTransientCollisionOnProperty pojo = new JsonbTransientCollisionOnProperty();\n        pojo.setTransientProperty(\"TRANSIENT\");\n\n        try {\n        \tdefaultJsonb.toJson(pojo);\n            fail();\n        } catch (JsonbException e) {\n            assertTrue(e.getMessage().startsWith(\"JsonbTransient annotation cannot be used with other jsonb annotations on the same property.\"));\n        }\n    }\n\n    @Test\n    public void testTransientCollidesOnGetter() throws Exception {\n        JsonbTransientCollisionOnGetter pojo = new JsonbTransientCollisionOnGetter();\n        pojo.setTransientProperty(\"TRANSIENT\");\n\n        try {\n        \tdefaultJsonb.toJson(pojo);\n            fail();\n        } catch (JsonbException e) {\n            assertTrue(e.getMessage().startsWith(\"JsonbTransient annotation cannot be used with other jsonb annotations on the same property.\"));\n        }\n    }\n\n    @Test\n    public void testTransientCollidesOnPropertyAndGetter() throws Exception {\n        JsonbTransientCollisionOnPropertyAndGetter pojo = new JsonbTransientCollisionOnPropertyAndGetter();\n        pojo.setTransientProperty(\"TRANSIENT\");\n\n        try {\n        \tdefaultJsonb.toJson(pojo);\n            fail();\n        } catch (JsonbException e) {\n            assertTrue(e.getMessage().startsWith(\"JsonbTransient annotation cannot be used with other jsonb annotations on the same property.\"));\n        }\n    }\n\n    @Test\n    public void testTransientCollidesOnSetter() throws Exception {\n        JsonbTransientCollisionOnSetter pojo = new JsonbTransientCollisionOnSetter();\n        pojo.setTransientProperty(\"TRANSIENT\");\n\n        try {\n        \tdefaultJsonb.toJson(pojo);\n            fail();\n        } catch (JsonbException e) {\n            assertTrue(e.getMessage().startsWith(\"JsonbTransient annotation cannot be used with other jsonb annotations on the same property.\"));\n        }\n    }\n\n    @Test\n    public void testTransientCollidesOnPropertyAndSetter() throws Exception {\n        JsonbTransientCollisionOnPropertyAndSetter pojo = new JsonbTransientCollisionOnPropertyAndSetter();\n        pojo.setTransientProperty(\"TRANSIENT\");\n\n        try {\n        \tdefaultJsonb.toJson(pojo);\n            fail();\n        } catch (JsonbException e) {\n            assertTrue(e.getMessage().startsWith(\"JsonbTransient annotation cannot be used with other jsonb annotations on the same property.\"));\n        }\n    }\n\n    @Test\n    public void testTransientCollidesOnPropertyAndGetterAndSetter() throws Exception {\n        JsonbTransientCollisionOnPropertyAndGetterAndSetter pojo = new JsonbTransientCollisionOnPropertyAndGetterAndSetter();\n        pojo.setTransientProperty(\"TRANSIENT\");\n\n        try {\n        \tdefaultJsonb.toJson(pojo);\n            fail();\n        } catch (JsonbException e) {\n            assertTrue(e.getMessage().startsWith(\"JsonbTransient annotation cannot be used with other jsonb annotations on the same property.\"));\n        }\n    }\n\n    @Test\n    public void testTransientGetterPlusJsonbPropertyField() {\n    \tassertThrows(JsonbException.class, () -> {\n\t        TransientGetterPlusCustomizationAnnotatedFieldContainer pojo = new TransientGetterPlusCustomizationAnnotatedFieldContainer();\n\t        defaultJsonb.toJson(pojo);\n    \t});\n    }\n\n    @Test\n    public void testTransientSetterPlusJsonbPropertyField() {\n    \tassertThrows(JsonbException.class, () -> {\n\t        TransientSetterPlusCustomizationAnnotatedFieldContainer pojo = new TransientSetterPlusCustomizationAnnotatedFieldContainer();\n\t        defaultJsonb.toJson(pojo);\n    \t});\n    }\n\n    @Test\n    public void testTransientSetterplusJsonbPropertyGetter() {\n        TransientSetterPlusCustomizationAnnotatedGetterContainer pojo = new TransientSetterPlusCustomizationAnnotatedGetterContainer();\n        assertEquals(\"{\\\"instance\\\":\\\"INSTANCE\\\"}\", defaultJsonb.toJson(pojo));\n    }\n\n    @Test\n    public void testTransientGetterNoField() {\n        TransientGetterNoField pojo = new TransientGetterNoField();\n        assertEquals(\"{}\", defaultJsonb.toJson(pojo));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/transients/models/JsonbTransientCollisionOnGetter.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.transients.models;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.annotation.JsonbTransient;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class JsonbTransientCollisionOnGetter {\n\n    private String transientProperty;\n\n    @JsonbTransient\n    @JsonbProperty(\"custom_name\")\n    public String getTransientProperty() {\n        return transientProperty;\n    }\n\n    public void setTransientProperty(String transientProperty) {\n        this.transientProperty = transientProperty;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/transients/models/JsonbTransientCollisionOnProperty.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.transients.models;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.annotation.JsonbTransient;\n\n/**\n * @author Ehsan Zaery Moghaddam (zaerymoghaddam@gmail.com)\n */\npublic class JsonbTransientCollisionOnProperty {\n\n    @JsonbTransient\n    @JsonbProperty(\"custom_name\")\n    private String transientProperty;\n\n    public String getTransientProperty() {\n        return transientProperty;\n    }\n\n    public void setTransientProperty(String transientProperty) {\n        this.transientProperty = transientProperty;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/transients/models/JsonbTransientCollisionOnPropertyAndGetter.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.transients.models;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.annotation.JsonbTransient;\n\n/**\n * @author Ehsan Zaery Moghaddam (zaerymoghaddam@gmail.com)\n */\npublic class JsonbTransientCollisionOnPropertyAndGetter {\n\n    @JsonbTransient\n    private String transientProperty;\n\n    @JsonbProperty(\"custom_name\")\n    public String getTransientProperty() {\n        return transientProperty;\n    }\n\n    public void setTransientProperty(String transientProperty) {\n        this.transientProperty = transientProperty;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/transients/models/JsonbTransientCollisionOnPropertyAndGetterAndSetter.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.transients.models;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.annotation.JsonbTransient;\n\n/**\n * @author Ehsan Zaery Moghaddam (zaerymoghaddam@gmail.com)\n */\npublic class JsonbTransientCollisionOnPropertyAndGetterAndSetter {\n\n    @JsonbTransient\n    private String transientProperty;\n\n    @JsonbProperty(\"custom_name\")\n    public String getTransientProperty() {\n        return transientProperty;\n    }\n\n    @JsonbProperty(\"custom_name\")\n    public void setTransientProperty(String transientProperty) {\n        this.transientProperty = transientProperty;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/transients/models/JsonbTransientCollisionOnPropertyAndSetter.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.transients.models;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.annotation.JsonbTransient;\n\n/**\n * @author Ehsan Zaery Moghaddam (zaerymoghaddam@gmail.com)\n */\npublic class JsonbTransientCollisionOnPropertyAndSetter {\n\n    @JsonbTransient\n    private String transientProperty;\n\n    public String getTransientProperty() {\n        return transientProperty;\n    }\n\n    @JsonbProperty(\"custom_name\")\n    public void setTransientProperty(String transientProperty) {\n        this.transientProperty = transientProperty;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/transients/models/JsonbTransientCollisionOnSetter.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.transients.models;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.annotation.JsonbTransient;\n\n/**\n * @author Ehsan Zaery Moghaddam (zaerymoghaddam@gmail.com)\n */\npublic class JsonbTransientCollisionOnSetter {\n\n    private String transientProperty;\n\n    public String getTransientProperty() {\n        return transientProperty;\n    }\n\n    @JsonbTransient\n    @JsonbProperty(\"custom_name\")\n    public void setTransientProperty(String transientProperty) {\n        this.transientProperty = transientProperty;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/transients/models/JsonbTransientValue.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.transients.models;\n\nimport jakarta.json.bind.annotation.JsonbTransient;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class JsonbTransientValue {\n\n    private String plainProperty;\n\n    @JsonbTransient\n    public String publicTransient = \"publicTransient\";\n\n    @JsonbTransient\n    private String transientFieldWithGetterNoSetter = \"transientFieldWithGetterNoSetter\";\n\n    @JsonbTransient\n    private String propertyTransient;\n\n    private String getterTransient;\n\n    private String setterTransient;\n\n    @JsonbTransient\n    private String getterAndPropertyTransient;\n\n    @JsonbTransient\n    private String setterAndPropertyTransient;\n\n    private String setterAndGetterTransient;\n\n    @JsonbTransient\n    private String setterAndGetterAndPropertyTransient;\n\n\n    public String getPropertyTransient() {\n        return propertyTransient;\n    }\n\n    public void setPropertyTransient(String propertyTransient) {\n        this.propertyTransient = propertyTransient;\n    }\n\n\n\n    public String getPlainProperty() {\n        return plainProperty;\n    }\n\n    public void setPlainProperty(String plainProperty) {\n        this.plainProperty = plainProperty;\n    }\n\n\n\n    @JsonbTransient\n    public String getGetterTransient() {\n        return getterTransient;\n    }\n\n    public void setGetterTransient(String getterTransient) {\n        this.getterTransient = getterTransient;\n    }\n\n\n\n    public String getSetterTransient() {\n        return setterTransient;\n    }\n\n    @JsonbTransient\n    public void setSetterTransient(String setterTransient) {\n        this.setterTransient = setterTransient;\n    }\n\n\n\n    @JsonbTransient\n    public String getGetterAndPropertyTransient() {\n        return getterAndPropertyTransient;\n    }\n\n    public void setGetterAndPropertyTransient(String getterAndPropertyTransient) {\n        this.getterAndPropertyTransient = getterAndPropertyTransient;\n    }\n\n\n\n    public String getSetterAndPropertyTransient() {\n        return setterAndPropertyTransient;\n    }\n\n    @JsonbTransient\n    public void setSetterAndPropertyTransient(String setterAndPropertyTransient) {\n        this.setterAndPropertyTransient = setterAndPropertyTransient;\n    }\n\n\n\n    @JsonbTransient\n    public String getSetterAndGetterTransient() {\n        return setterAndGetterTransient;\n    }\n\n    @JsonbTransient\n    public void setSetterAndGetterTransient(String setterAndGetterTransient) {\n        this.setterAndGetterTransient = setterAndGetterTransient;\n    }\n\n\n\n    @JsonbTransient\n    public String getSetterAndGetterAndPropertyTransient() {\n        return setterAndGetterAndPropertyTransient;\n    }\n\n    @JsonbTransient\n    public void setSetterAndGetterAndPropertyTransient(String setterAndGetterAndPropertyTransient) {\n        this.setterAndGetterAndPropertyTransient = setterAndGetterAndPropertyTransient;\n    }\n\n\n    public String getTransientFieldWithGetterNoSetter() {\n        return transientFieldWithGetterNoSetter;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/transients/models/TransientGetterNoField.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.transients.models;\n\nimport jakarta.json.bind.annotation.JsonbTransient;\n\npublic class TransientGetterNoField {\n\n    @JsonbTransient\n    public String getFooString() {\n        return \"\";\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/transients/models/TransientGetterPlusCustomizationAnnotatedFieldContainer.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.customization.transients.models;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.annotation.JsonbTransient;\n\npublic class TransientGetterPlusCustomizationAnnotatedFieldContainer {\n    @JsonbProperty(\"instance\")\n    private String instance;\n\n    @JsonbTransient\n    public String getInstance() {\n        return instance;\n    }\n\n    public void setInstance(String instance) {\n        this.instance = instance;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/transients/models/TransientSetterPlusCustomizationAnnotatedFieldContainer.java",
    "content": "/*\n * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\n/*\n * $Id$\n */\n\npackage org.eclipse.yasson.customization.transients.models;\n\n\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.annotation.JsonbTransient;\n\npublic class TransientSetterPlusCustomizationAnnotatedFieldContainer {\n\t@JsonbProperty(\"instance\")\n    private String instance;\n\n    public String getInstance() {\n        return instance;\n    }\n\n    @JsonbTransient\n    public void setInstance(String instance) {\n        this.instance = instance;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/customization/transients/models/TransientSetterPlusCustomizationAnnotatedGetterContainer.java",
    "content": "/*\n * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\n/*\n * $Id$\n */\n\npackage org.eclipse.yasson.customization.transients.models;\n\n\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.annotation.JsonbTransient;\n\npublic class TransientSetterPlusCustomizationAnnotatedGetterContainer {\n    private String instance = \"INSTANCE\";\n\n    @JsonbProperty(\"instance\")\n    public String getInstance() {\n        return instance;\n    }\n\n    @JsonbTransient\n    public void setInstance(String instance) {\n        this.instance = instance;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/EnumTest.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.TestTypeToken;\nimport org.eclipse.yasson.defaultmapping.collections.Language;\nimport org.eclipse.yasson.defaultmapping.generics.model.ScalarValueWrapper;\n\npublic class EnumTest {\n\n    @Test\n    public void testEnumValue() {\n        assertEquals(\"\\\"Russian\\\"\", defaultJsonb.toJson(Language.Russian));\n        Language result = defaultJsonb.fromJson(\"\\\"Russian\\\"\", Language.class);\n        assertEquals(Language.Russian, result);\n    }\n\n    @Test\n    public void testEnumInObject() {\n        assertEquals(\"{\\\"value\\\":\\\"Russian\\\"}\", defaultJsonb.toJson(new ScalarValueWrapper<>(Language.Russian)));\n        ScalarValueWrapper<Language> result = defaultJsonb.fromJson(\"{\\\"value\\\":\\\"Russian\\\"}\", new TestTypeToken<ScalarValueWrapper<Language>>() {\n        }.getType());\n\n        assertEquals(result.getValue(), Language.Russian);\n    }\n\n    @Test\n    public void testEnumValueWithToStringOverriden() {\n        assertEquals(\"\\\"HARD_BACK\\\"\", defaultJsonb.toJson(Binding.HARD_BACK));\n        Binding result = defaultJsonb.fromJson(\"\\\"HARD_BACK\\\"\", Binding.class);\n        assertEquals(Binding.HARD_BACK, result);\n    }\n\n    @Test\n    public void testEnumInObjectWithToStringOverriden() {\n        assertEquals(\"{\\\"value\\\":\\\"HARD_BACK\\\"}\", defaultJsonb.toJson(new ScalarValueWrapper<>(Binding.HARD_BACK)));\n        ScalarValueWrapper<Binding> result = defaultJsonb.fromJson(\"{\\\"value\\\":\\\"HARD_BACK\\\"}\", new TestTypeToken<ScalarValueWrapper<Binding>>(){}.getType());\n        assertEquals(Binding.HARD_BACK, result.getValue());\n    }\n\n    public enum Binding {\n        HARD_BACK {\n            @Override\n\t\t\tpublic String toString() {\n                return \"Hard Back\";\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/IJsonTest.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport org.eclipse.yasson.TestTypeToken;\nimport org.eclipse.yasson.defaultmapping.generics.model.ScalarValueWrapper;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport java.time.*;\nimport java.util.Calendar;\nimport java.util.Date;\nimport java.util.TimeZone;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class IJsonTest {\n\n    private Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withStrictIJSON(true));\n\n    @Test\n    public void testStrictCalendar() {\n        Calendar calendar = Calendar.getInstance();\n        calendar.clear();\n        calendar.set(1970, 0, 1, 0, 0, 0);\n        calendar.setTimeZone(TimeZone.getTimeZone(\"Europe/Paris\"));\n\n        String jsonString = jsonb.toJson(new ScalarValueWrapper<>(calendar));\n        assertEquals(\"{\\\"value\\\":\\\"1970-01-01T00:00:00Z+01:00\\\"}\", jsonString);\n\n        ScalarValueWrapper<Calendar> result = jsonb.fromJson(\"{\\\"value\\\":\\\"1970-01-01T00:00:00Z+01:00\\\"}\", new TestTypeToken<ScalarValueWrapper<Calendar>>() {}.getType());\n\n        assertEquals(calendar.toInstant(), result.getValue().toInstant());\n    }\n\n    @Test\n    public void testStrictDate() {\n        Calendar calendar = Calendar.getInstance();\n        calendar.set(1970, 0, 1, 0, 0, 0);\n        calendar.setTimeZone(TimeZone.getTimeZone(\"UTC\"));\n        calendar.clear(Calendar.MILLISECOND);\n\n        String jsonString = jsonb.toJson(new ScalarValueWrapper<>(calendar.getTime()));\n        assertTrue(jsonString.matches(\"\\\\{\\\"value\\\":\\\"1970-01-01T00:00:00Z\\\\+[0-9]{2}:[0-9]{2}\\\"}\"));\n\n        ScalarValueWrapper<Date> result = jsonb.fromJson(\"{\\\"value\\\":\\\"1970-01-01T00:00:00Z+00:00\\\"}\", new TestTypeToken<ScalarValueWrapper<Date>>(){}.getType());\n        assertEquals(0, result.getValue().compareTo(calendar.getTime()));\n\n    }\n\n    @Test\n    public void testStrictInstant() {\n        Instant instant = LocalDateTime.of(2017, 3, 24, 12,0,0).toInstant(ZoneOffset.MIN);\n        final String json = jsonb.toJson(new ScalarValueWrapper<>(instant));\n        assertEquals(\"{\\\"value\\\":\\\"2017-03-25T06:00:00Z+00:00\\\"}\", json);\n        ScalarValueWrapper<Instant> result = jsonb.fromJson(\"{\\\"value\\\":\\\"2017-03-25T06:00:00Z+00:00\\\"}\", new TestTypeToken<ScalarValueWrapper<Instant>>() {}.getType());\n        assertEquals(instant, result.getValue());\n    }\n\n    @Test\n    public void testLocalDate() {\n        final LocalDate localDate = LocalDate.of(1970, 1, 1);\n        final String json = jsonb.toJson(new ScalarValueWrapper<>(localDate));\n        assertEquals(\"{\\\"value\\\":\\\"1970-01-01T00:00:00Z+00:00\\\"}\", json);\n\n        ScalarValueWrapper<LocalDate> result = jsonb.fromJson(\"{\\\"value\\\":\\\"1970-01-01T00:00:00Z+00:00\\\"}\", new TestTypeToken<ScalarValueWrapper<LocalDate>>() {\n        }.getType());\n\n\n        assertEquals(localDate, result.getValue());\n    }\n\n    @Test\n    public void testLocalDateTime() {\n        final LocalDateTime localDateTime = LocalDateTime.of(1970, 1, 1, 1, 1, 1);\n        final String json = jsonb.toJson(new ScalarValueWrapper<>(localDateTime));\n\n        assertEquals(\"{\\\"value\\\":\\\"1970-01-01T01:01:01Z+00:00\\\"}\", json);\n\n        ScalarValueWrapper<LocalDateTime> result = jsonb.fromJson(\"{\\\"value\\\":\\\"1970-01-01T01:01:01Z+00:00\\\"}\", new TestTypeToken<ScalarValueWrapper<LocalDateTime>>() {\n        }.getType());\n\n\n        assertEquals(localDateTime, result.getValue());\n    }\n\n    @Test\n    public void testDuration() {\n        Duration duration = Duration.ofDays(1).plus(Duration.ofHours(1)).plus(Duration.ofSeconds(1));\n\n        final String json = jsonb.toJson(new ScalarValueWrapper<>(duration));\n        assertEquals(\"{\\\"value\\\":\\\"PT25H1S\\\"}\", json);\n\n        ScalarValueWrapper<Duration> result = jsonb.fromJson(json, new TestTypeToken<ScalarValueWrapper<Duration>>() {\n        }.getType());\n        assertEquals(duration, result.getValue());\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/anonymous/AnonymousClassTest.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.anonymous;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\n/**\n * This class contains tests for marshalling/unmarshalling anonymous classes.\n *\n * @author Dmitry Kornilov\n */\npublic class AnonymousClassTest {\n\n    @Test\n    public void testMarshallInnerClass() {\n        assertEquals(\"{\\\"anonymousField\\\":\\\"anonymousValue\\\",\\\"id\\\":1,\\\"name\\\":\\\"pojoName\\\"}\", defaultJsonb.toJson(new InnerPojo() {\n            public String anonymousField = \"anonymousValue\";\n\n            @Override\n            public Integer getId() {\n                return 1;\n            }\n\n            @Override\n            public String getName() {\n                return \"pojoName\";\n            }\n        }));\n    }\n\n    @Test\n    public void testMarshallOuterClass() {\n        assertEquals(\"{\\\"id\\\":1,\\\"anonymousField\\\":\\\"anonymousValue\\\"}\", defaultJsonb.toJson(new OuterPojo() {\n            public String anonymousField = \"anonymousValue\";\n        }));\n    }\n\n    public static class InnerPojo {\n        private Integer id;\n        private String name;\n\n        public Integer getId() {\n            return id;\n        }\n\n        public void setId(Integer id) {\n            this.id = id;\n        }\n\n        public String getName() {\n            return name;\n        }\n\n        public void setName(String name) {\n            this.name = name;\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/anonymous/OuterPojo.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.anonymous;\n\n/**\n * Test class.\n *\n * @author Dmitry Kornilov\n */\npublic class OuterPojo {\n    private Integer id = 1;\n    private String name;\n\n    public Integer getId() {\n        return id;\n    }\n\n    public void setId(Integer id) {\n        this.id = id;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/basic/BasicTest.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.basic;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.io.StringWriter;\nimport java.io.Writer;\n\n/**\n * Default mapping primitives tests.\n *\n * @author Dmitry Kornilov\n */\npublic class BasicTest {\n\n    @Test\n    public void testMarshallEscapedString() {\n        assertEquals(\"[\\\" \\\\\\\\ \\\\\\\" / \\\\f\\\\b\\\\r\\\\n\\\\t 9\\\"]\", bindingJsonb.toJson(new String[] {\" \\\\ \\\" / \\f\\b\\r\\n\\t \\u0039\"}));\n    }\n\n    @Test\n    public void testMarshallWriter() {\n        Writer writer = new StringWriter();\n        bindingJsonb.toJson(new Long[]{5L}, writer);\n        assertEquals(\"[5]\", writer.toString());\n    }\n    \n    @Test\n    public void testDoubleWriter() throws Exception {\n        Writer writer = new StringWriter();\n        writer.write(\"{\");\n        bindingJsonb.toJson(\"Hello\", writer);\n        writer.write(\",\");\n        bindingJsonb.toJson(\"World\", writer);\n        writer.write(\"}\");\n        assertEquals(\"{\\\"Hello\\\",\\\"World\\\"}\", writer.toString());\n    }\n\n    @Test\n    public void testMarshallOutputStream() throws IOException {\n        try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) {\n        \tbindingJsonb.toJson(new Long[]{5L}, baos);\n            assertEquals(\"[5]\", baos.toString(\"UTF-8\"));\n        }\n    }\n\n    @Test\n    public void testObjectSerialization() {\n        final String val = bindingJsonb.toJson(new Object());\n        assertEquals(\"{}\", val);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/basic/BooleanTest.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.basic;\n\nimport org.junit.jupiter.api.*;\n\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.CoreMatchers.is;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.defaultmapping.basic.model.BooleanModel;\n\n/**\n * Tests serialization and deserialization of boolean values.\n *\n * @author Ehsan Zaery Moghaddam (zaerymoghaddam@gmail.com)\n */\npublic class BooleanTest {\n\n    @Test\n    public void testBooleanSerialization() throws Exception {\n        BooleanModel booleanModel = new BooleanModel(true, false);\n\n        String expected = \"{\\\"field1\\\":true,\\\"field2\\\":false}\";\n        assertEquals(expected, defaultJsonb.toJson(booleanModel));\n    }\n\n    @Test\n    public void testBooleanDeserializationFromBooleanAsStringValue() throws Exception {\n        BooleanModel booleanModel = defaultJsonb.fromJson(\"{\\\"field1\\\":\\\"true\\\",\\\"field2\\\":\\\"true\\\"}\", BooleanModel.class);\n        assertEquals(true, booleanModel.field1);\n        assertEquals(true, booleanModel.field2);\n    }\n\n    @Test\n    public void testBooleanDeserializationFromBooleanRawValue() throws Exception {\n        BooleanModel booleanModel = defaultJsonb.fromJson(\"{\\\"field1\\\":false,\\\"field2\\\":false}\", BooleanModel.class);\n        assertThat(booleanModel.field1, is(false));\n        assertThat(booleanModel.field2, is(false));\n    }\n\n    @Test\n    public void testNakedBooleans() {\n        assertEquals(true, defaultJsonb.fromJson(\"true\", boolean.class));\n        assertEquals(true, defaultJsonb.fromJson(\"true\", Boolean.class));\n        assertEquals(false, defaultJsonb.fromJson(\"false\", boolean.class));\n        assertEquals(false, defaultJsonb.fromJson(\"false\", Boolean.class));\n        \n        assertEquals(\"true\", defaultJsonb.toJson(true, boolean.class));\n        assertEquals(\"false\", defaultJsonb.toJson(Boolean.FALSE, Boolean.class));\n    }\n    \n    //Fix for issue #390\n    @Test\n    public void testBooleanArrays() {\n        assertArrayEquals(new boolean[] {true, false}, defaultJsonb.fromJson(\"[true, false]\", boolean[].class));\n        assertArrayEquals(new Boolean[] {true, false}, defaultJsonb.fromJson(\"[true, false]\", Boolean[].class));\n        \n        assertEquals(\"[true,false]\", defaultJsonb.toJson(new boolean[] {true, false}));\n        assertEquals(\"[true,false]\", defaultJsonb.toJson(new Boolean[] {true, false}));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/basic/NumberTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.basic;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport static org.eclipse.yasson.Assertions.*;\nimport org.eclipse.yasson.TestTypeToken;\nimport org.eclipse.yasson.defaultmapping.basic.model.BigDecimalInNumber;\nimport org.eclipse.yasson.defaultmapping.generics.model.ScalarValueWrapper;\n\nimport jakarta.json.Json;\nimport jakarta.json.JsonObject;\nimport jakarta.json.JsonObjectBuilder;\nimport jakarta.json.JsonWriter;\nimport jakarta.json.stream.JsonGenerator;\n\nimport java.io.StringWriter;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.Map;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class NumberTest {\n\n    @Test\n    public void testSerializeFloat() {\n        final String json = defaultJsonb.toJson(0.35f);\n        assertEquals(\"0.35\", json);\n\n        Float result = defaultJsonb.fromJson(\"0.35\", Float.class);\n        assertEquals((Float) .35f, result);\n    }\n\n    @Test\n    public void testBigDecimalMarshalling() {\n        String jsonString = defaultJsonb.toJson(new BigDecimal(\"0.10000000000000001\"));\n        assertEquals(\"0.10000000000000001\", jsonString);\n\n        jsonString = defaultJsonb.toJson(new BigDecimal(\"0.1000000000000001\"));\n        assertEquals(\"0.1000000000000001\", jsonString);\n\n        BigDecimal result = defaultJsonb.fromJson(\"0.10000000000000001\", BigDecimal.class);\n        assertEquals(new BigDecimal(\"0.10000000000000001\"), result);\n\n        result = defaultJsonb.fromJson(\"0.100000000000000001\", BigDecimal.class);\n        assertEquals(new BigDecimal(\"0.100000000000000001\"), result);\n    }\n\n    @Test\n    public void testBigDecimalIEEE748() {\n        String jsonString = defaultJsonb.toJson(new BigDecimal(\"9007199254740991\"));\n        assertEquals(\"9007199254740991\", jsonString);\n\n        jsonString = defaultJsonb.toJson(new BigDecimal(\"9007199254740992\"));\n        assertEquals(\"9007199254740992\", jsonString);\n\n        jsonString = defaultJsonb.toJson(new BigDecimal(\"9007199254740991.1\"));\n        assertEquals(\"9007199254740991.1\", jsonString);\n\n        jsonString = defaultJsonb.toJson(new BigDecimal(new BigInteger(\"1\"), -400));\n        assertEquals(new BigDecimal(new BigInteger(\"1\"), -400).toString(), jsonString);\n    }\n\n    @Test\n    public void testBigIntegerIEEE748() {\n        String jsonString = defaultJsonb.toJson(new BigInteger(\"9007199254740991\"));\n        assertEquals(\"9007199254740991\", jsonString);\n\n        jsonString = defaultJsonb.toJson(new BigInteger(\"9007199254740992\"));\n        assertEquals(\"9007199254740992\", jsonString);\n    }\n\n    @Test\n    public void testBigDecimalInNumber() {\n        BigDecimalInNumber testValueQuoted = new BigDecimalInNumber() {{setBigDecValue(new BigDecimal(\"9007199254740992\"));}};\n        BigDecimalInNumber testValueUnQuoted = new BigDecimalInNumber() {{setBigDecValue(new BigDecimal(\"9007199254740991\"));}};\n        String jsonString = defaultJsonb.toJson(testValueQuoted);\n        assertEquals(\"{\\\"bigDecValue\\\":9007199254740992}\", jsonString);\n\n        jsonString = defaultJsonb.toJson(testValueUnQuoted);\n        assertEquals(\"{\\\"bigDecValue\\\":9007199254740991}\", jsonString);\n\n        BigDecimalInNumber result = defaultJsonb.fromJson(\"{\\\"bigDecValue\\\":9007199254740992}\", BigDecimalInNumber.class);\n        assertEquals(testValueQuoted.getBigDecValue(), result.getBigDecValue());\n\n        result = defaultJsonb.fromJson(\"{\\\"bigDecValue\\\":9007199254740991}\", BigDecimalInNumber.class);\n        assertEquals(testValueUnQuoted.getBigDecValue(), result.getBigDecValue());\n    }\n\n    @Test\n    public void testBigDecimalWrappedMarshalling() {\n        String jsonString = defaultJsonb.toJson(new ScalarValueWrapper<>(new BigDecimal(\"0.1000000000000001\")));\n        assertEquals(\"{\\\"value\\\":0.1000000000000001}\", jsonString);\n\n        jsonString = defaultJsonb.toJson(new ScalarValueWrapper<>(new BigDecimal(\"0.10000000000000001\")));\n        assertEquals(\"{\\\"value\\\":0.10000000000000001}\", jsonString);\n\n        ScalarValueWrapper<BigDecimal> result = defaultJsonb.fromJson(\"{\\\"value\\\":0.1000000000000001}\", new TestTypeToken<ScalarValueWrapper<BigDecimal>>(){}.getType());\n        assertEquals(new BigDecimal(\"0.1000000000000001\"), result.getValue());\n\n        result = defaultJsonb.fromJson(\"{\\\"value\\\":0.10000000000000001}\", new TestTypeToken<ScalarValueWrapper<BigDecimal>>(){}.getType());\n        assertEquals(new BigDecimal(\"0.10000000000000001\"), result.getValue());\n    }\n\n    @Test\n    public void testBigDecimalCastedToNumber() {\n        String jsonString = defaultJsonb.toJson(new Object() { public Number number = new BigDecimal(\"0.10000000000000001\"); });\n        assertEquals(\"{\\\"number\\\":0.10000000000000001}\", jsonString);\n\n        jsonString = defaultJsonb.toJson(new Object() { public Number number = new BigDecimal(\"0.1000000000000001\"); });\n        assertEquals(\"{\\\"number\\\":0.1000000000000001}\", jsonString);\n    }\n\n    @Test\n    public void testLongIEEE748() {\n        // 9007199254740991L\n        Long maxJsSafeValue = Double.valueOf(Math.pow(2, 53)).longValue() - 1;\n        Long upperJsUnsafeValue = maxJsSafeValue + 1;\n\n        String json = defaultJsonb.toJson(maxJsSafeValue);\n        assertEquals(\"9007199254740991\", json);\n        Long deserialized = defaultJsonb.fromJson(json, Long.class);\n        assertEquals(Long.valueOf(\"9007199254740991\"), deserialized);\n\n        json = defaultJsonb.toJson(upperJsUnsafeValue);\n        assertEquals(\"9007199254740992\", json);\n        deserialized = defaultJsonb.fromJson(json, Long.class);\n        assertEquals(Long.valueOf(\"9007199254740992\"), deserialized);\n\n\n        Long minJsSafeValue = Math.negateExact(maxJsSafeValue);\n        Long lowerJsUnsafeValue = minJsSafeValue - 1;\n\n        json = defaultJsonb.toJson(minJsSafeValue);\n        assertEquals(\"-9007199254740991\", json);\n        deserialized = defaultJsonb.fromJson(json, Long.class);\n        assertEquals(Long.valueOf(\"-9007199254740991\"), deserialized);\n\n        json = defaultJsonb.toJson(lowerJsUnsafeValue);\n        assertEquals(\"-9007199254740992\", json);\n        deserialized = defaultJsonb.fromJson(json, Long.class);\n        assertEquals(Long.valueOf(\"-9007199254740992\"), deserialized);\n    }\n\n    /**\n     * Tests that JSON-P RI itself does no big number (out of IEEE 754 quotation).\n     * This is why it is now must be done in Yasson to match the JSONB spec.\n     */\n    @Test\n    public void testJsonpBigNumber() {\n        StringWriter w = new StringWriter();\n        JsonGenerator generator = Json.createGenerator(w);\n\n        Long maxJsSafeValue = Double.valueOf(Math.pow(2, 53)).longValue() - 1;\n        Long upperJsUnsafeValue = Long.MAX_VALUE;\n\n        generator.writeStartObject();\n        generator.write(\"safeLongValue\", maxJsSafeValue);\n        generator.write(\"unsafeLongValue\", upperJsUnsafeValue);\n        generator.write(\"safeBigDecimalValue\", BigDecimal.TEN);\n        generator.write(\"unsafeBigDecimalValue\", BigDecimal.valueOf(upperJsUnsafeValue));\n        generator.writeEnd();\n        generator.close();\n\n        assertEquals(\"{\" +\n                        \"\\\"safeLongValue\\\":9007199254740991,\" +\n                        \"\\\"unsafeLongValue\\\":9223372036854775807,\" +\n                        \"\\\"safeBigDecimalValue\\\":10,\" +\n                        \"\\\"unsafeBigDecimalValue\\\":9223372036854775807}\",\n                w.toString());\n\n\n        w = new StringWriter();\n        JsonWriter writer = Json.createWriter(w);\n\n\n        JsonObjectBuilder objectBuilder = Json.createObjectBuilder();\n        objectBuilder.add(\"safeLongValue\", maxJsSafeValue);\n        objectBuilder.add(\"unsafeLongValue\", upperJsUnsafeValue);\n        objectBuilder.add(\"safeBigDecimalValue\", BigDecimal.valueOf(maxJsSafeValue));\n        objectBuilder.add(\"unsafeBigDecimalValue\", BigDecimal.valueOf(upperJsUnsafeValue));\n        JsonObject build = objectBuilder.build();\n        writer.write(build);\n        writer.close();\n\n        assertEquals(\"{\" +\n                \"\\\"safeLongValue\\\":9007199254740991,\" +\n                \"\\\"unsafeLongValue\\\":9223372036854775807,\" +\n                \"\\\"safeBigDecimalValue\\\":9007199254740991,\" +\n                \"\\\"unsafeBigDecimalValue\\\":9223372036854775807}\", w.toString());\n\n    }\n    \n    public static class NumberContainer {\n    \tpublic Double doubleProp;\n    \tpublic Collection<Double> collectionProp;\n    \tpublic Map<String,Double> mapProp;\n    }\n    \n    @Test\n    public void testSerializeInvalidDouble() {\n        shouldFail(() -> defaultJsonb.toJson(Double.POSITIVE_INFINITY));\n\n        NumberContainer obj = new NumberContainer();\n        obj.doubleProp = Double.POSITIVE_INFINITY;\n        shouldFail(() -> defaultJsonb.toJson(obj), msg -> msg.contains(\"doubleProp\") && msg.contains(\"NumberContainer\"));\n    }\n    \n    \n    @Test\n    public void testSerializeInvalidDoubleCollection() {\n        NumberContainer obj = new NumberContainer();\n        obj.collectionProp = Collections.singleton(Double.POSITIVE_INFINITY);\n        shouldFail(() -> defaultJsonb.toJson(obj),\n                  msg -> msg.contains(\"collectionProp\") && msg.contains(\"NumberContainer\"));\n    }\n\n    @Test\n    public void testSerializeInvalidDoubleMap() {\n        NumberContainer obj = new NumberContainer();\n        obj.mapProp = Collections.singletonMap(\"doubleKey\", Double.POSITIVE_INFINITY);\n        shouldFail(() -> defaultJsonb.toJson(obj),\n                  msg -> msg.contains(\"mapProp\") && msg.contains(\"NumberContainer\"));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/basic/PropertyMismatchTest.java",
    "content": "/*\n * Copyright (c) 2016, 2021 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.basic;\n\nimport java.net.URI;\nimport java.time.Instant;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Objects;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.annotation.JsonbTransient;\nimport org.jboss.weld.exceptions.IllegalStateException;\nimport org.junit.jupiter.api.Test;\n\nimport static org.eclipse.yasson.Jsonbs.defaultJsonb;\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.assertNotNull;\n\n/**\n * Tests to verify that read-only properties (properties with no field or setter)\n * are ignored when deserializing and that write-only properties (properties with\n * no field or getter) are ignored when serializing.\n */\npublic class PropertyMismatchTest {\n\n    public static class CollectionGetterOnly {\n        public HiddenCtorCollection getDataCollection() {\n            throw new IllegalStateException(\"Get was called\");\n        }\n\n        public HiddenCtorMap getDataMap() {\n            throw new IllegalStateException(\"Get was called\");\n        }\n\n        public HiddenCtorType[] getDataArray() {\n            throw new IllegalStateException(\"Get was called\");\n        }\n\n        public HiddenCtorType getData() {\n            throw new IllegalStateException(\"Get was called\");\n        }\n    }\n\n    public static class CollectionSetterOnly {\n        public void setDataCollection(HiddenCtorCollection set) {\n            throw new IllegalStateException(\"Set was called\");\n        }\n\n        public void setDataMap(HiddenCtorMap map) {\n            throw new IllegalStateException(\"Set was called\");\n        }\n\n        public void setDataArray(HiddenCtorType[] arr) {\n            throw new IllegalStateException(\"Set was called\");\n        }\n\n        public void setData(HiddenCtorType obj) {\n            throw new IllegalStateException(\"Set was called\");\n        }\n    }\n\n    public static class HiddenCtorCollection extends HashSet<String> {\n        private static final long serialVersionUID = -2254550505591024068L;\n\n        private HiddenCtorCollection() {\n            throw new IllegalStateException(\"Object should not be initialized!\");\n        }\n    }\n\n    public static class HiddenCtorMap extends HashMap<String,String> {\n        private static final long serialVersionUID = -3042588327575185446L;\n\n        private HiddenCtorMap() {\n            throw new IllegalStateException(\"Object should not be initialized!\");\n        }\n    }\n\n    public static class HiddenCtorType {\n\n        private HiddenCtorType() {\n            throw new IllegalStateException(\"Object should not be initialized!\");\n        }\n    }\n\n    /**\n     * When deserializing a JSON, a property without a setter should be ignored as a property\n     */\n    @Test\n    public void testGetterOnly() {\n        String jsonCollection = \"{\\\"dataCollection\\\": [\\\"foo\\\"], \" +\n                                 \"\\\"dataMap\\\": { \\\"foo\\\": \\\"bar\\\" }, \" +\n                                 \"\\\"dataArray\\\": [\\\"foo\\\"], \" +\n                                 \"\\\"data\\\": \\\"foo\\\" }\";\n        CollectionGetterOnly collection = defaultJsonb.fromJson(jsonCollection, CollectionGetterOnly.class);\n        // Don't need to verify resulting object (except that it is non-null)\n        // because if any getters or ctors were called, we would get an ISE\n        assertNotNull(collection);\n    }\n\n    /**\n     * When serializing an object, a property without a getter should be ignored as a property\n     */\n    @Test\n    public void testSetterOnly() {\n        CollectionSetterOnly obj = new CollectionSetterOnly();\n        String json = defaultJsonb.toJson(obj);\n        assertEquals(\"{}\", json);\n    }\n    \n    public static class PropertyTypeMismatch {\n        @JsonbTransient\n        public Instant internalInstantProperty;\n        \n        private String foo;\n        public int getFoo() {\n            return foo.length();\n        }\n        public void setFoo(Instant instant) {\n            this.foo = instant.toString();\n            this.internalInstantProperty = instant;\n        }\n    }\n\n    @Test\n    public void testTransientAndPropertyAnnotationMerge() {\n        TransientAndPropertyAnnotationMerge object = new TransientAndPropertyAnnotationMerge();\n        String expected = \"{\\\"number\\\":\\\"http://localhost/\\\"}\";\n        String json = defaultJsonb.toJson(object);\n        assertEquals(expected, json);\n        TransientAndPropertyAnnotationMerge deserialized = defaultJsonb.fromJson(expected,\n                                                                                 TransientAndPropertyAnnotationMerge.class);\n        assertEquals(object, deserialized);\n    }\n\n    public static class TransientAndPropertyAnnotationMerge {\n\n        @JsonbTransient\n        private Integer number;\n\n        @JsonbProperty(\"number\")\n        private URI someLink;\n\n        public TransientAndPropertyAnnotationMerge() {\n            number = -1;\n            someLink = URI.create(\"http://localhost/\");\n        }\n\n        public Integer getNumber() {\n            return number;\n        }\n\n        public void setNumber(Integer number) {\n            this.number = number;\n        }\n\n        public URI getSomeLink() {\n            return someLink;\n        }\n\n        public void setSomeLink(URI someLink) {\n            this.someLink = someLink;\n        }\n\n        @Override\n        public boolean equals(Object o) {\n            if (this == o) {\n                return true;\n            }\n            if (o == null || getClass() != o.getClass()) {\n                return false;\n            }\n            TransientAndPropertyAnnotationMerge that = (TransientAndPropertyAnnotationMerge) o;\n            return Objects.equals(number, that.number) && Objects.equals(someLink, that.someLink);\n        }\n\n        @Override\n        public int hashCode() {\n            return Objects.hash(number, someLink);\n        }\n    }\n\n    /**\n     * Test that properties of the same name with different\n     * field/getter/setter types behave properly and that we don't\n     * assume they are all equal\n     */\n    @Test\n    public void testPropertyTypesMismatch() {\n        PropertyTypeMismatch obj = new PropertyTypeMismatch();\n        Instant now = Instant.now();\n        obj.setFoo(now);\n        \n        String json = defaultJsonb.toJson(obj);\n        assertEquals(\"{\\\"foo\\\":\" + now.toString().length() + \"}\", json);\n        \n        PropertyTypeMismatch after = defaultJsonb.fromJson(\"{\\\"foo\\\":\\\"\" + now.toString() + \"\\\"}\", PropertyTypeMismatch.class);\n        assertEquals(obj.getFoo(), after.getFoo());\n        assertEquals(obj.internalInstantProperty, after.internalInstantProperty);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/basic/SingleValueTest.java",
    "content": "/*\n * Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.basic;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.internal.JsonBindingBuilder;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.JsonbException;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\n\n/**\n * @author David Kral\n */\npublic class SingleValueTest {\n\n    @Test\n    public void testMarshallPrimitives() {\n        // String\n        assertEquals(\"\\\"some_string\\\"\", bindingJsonb.toJson(\"some_string\"));\n\n        // Character\n        assertEquals(\"\\\"\\uFFFF\\\"\", bindingJsonb.toJson('\\uFFFF'));\n\n        // Byte\n        assertEquals(\"1\", bindingJsonb.toJson((byte)1));\n\n        // Short\n        assertEquals(\"1\", bindingJsonb.toJson((short)1));\n\n        // Integer\n        assertEquals(\"1\", bindingJsonb.toJson(1));\n\n        // Long\n        assertEquals(\"5\", bindingJsonb.toJson(5L));\n\n        // Float\n        assertEquals(\"1.2\", bindingJsonb.toJson(1.2f));\n\n        // Double\n        assertEquals(\"1.2\", bindingJsonb.toJson(1.2));\n\n        // BigInteger\n        assertEquals(\"1\", bindingJsonb.toJson(new BigInteger(\"1\")));\n\n        // BigDecimal\n        assertEquals(\"1.2\", bindingJsonb.toJson(new BigDecimal(\"1.2\")));\n\n        // Number\n        assertEquals(\"1.2\", bindingJsonb.toJson(1.2));\n\n        // Boolean true\n        assertEquals(\"true\", bindingJsonb.toJson(true));\n\n        // Boolean false\n        assertEquals(\"false\", bindingJsonb.toJson(false));\n\n        assertEquals(\"1\", bindingJsonb.toJson(1));\n\n        // null\n        assertEquals(\"null\", bindingJsonb.toJson(null));\n    }\n\n    @Test\n    public void testSingleValue() {\n        assertEquals(\"5\", bindingJsonb.toJson(5));\n\n        Jsonb jsonb = new JsonBindingBuilder().withConfig(new JsonbConfig().withStrictIJSON(true)).build();\n        try {\n            jsonb.toJson(5);\n            fail();\n        } catch (JsonbException exception){\n            assertEquals(Messages.getMessage(MessageKeys.IJSON_ENABLED_SINGLE_VALUE), exception.getMessage());\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/basic/UnqualifiedPropertiesTest.java",
    "content": "/*\n * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.basic;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\npublic class UnqualifiedPropertiesTest {\n\t\n\tpublic static class Widget {\n\t\t\n\t\tpublic long now;\n\n\t    public String getFoo() {\n\t        return \"foo\";\n\t    }\n\n\t    public String getBar(final int baz) {\n\t        return \"bar\" + baz;\n\t    }\n\t    \n\t    public boolean isPositive(int num) {\n\t    \treturn num > 0;\n\t    }\n\t    \n\t    public Widget setNow() {\n\t    \tnow = 1511576115722L;\n\t    \treturn this;\n\t    }\n\t}\n\t\n\t@Test\n\tpublic void testGetWithArgs() {\n\t    assertEquals(\"{\\\"foo\\\":\\\"foo\\\",\\\"now\\\":0}\", defaultJsonb.toJson(new Widget()));\n\t}\n\t\n\t@Test\n\tpublic void testSetWithNoArgs() {\n\t\tassertEquals(\"{\\\"foo\\\":\\\"foo\\\",\\\"now\\\":1511576115722}\", defaultJsonb.toJson(new Widget().setNow()));\n\t}\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/basic/model/BigDecimalInNumber.java",
    "content": "/*\n * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.basic.model;\n\n/**\n * Encapsulates Number type of field so the serialization and deserialization of number can be tested\n *\n * @author David Kral\n */\npublic class BigDecimalInNumber {\n\n    private Number bigDecValue;\n\n    public BigDecimalInNumber(){\n    }\n\n    public Number getBigDecValue() {\n        return bigDecValue;\n    }\n\n    public void setBigDecValue(Number bigDecValue) {\n        this.bigDecValue = bigDecValue;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/basic/model/BooleanModel.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.basic.model;\n\n/**\n * Encapsulates different types of boolean values as a field so that the boolean value's serialization and\n * deserialization could be tested.\n *\n * @author Ehsan Zaery Moghaddam (zaerymoghaddam@gmail.com)\n */\npublic class BooleanModel {\n    public Boolean field1;\n    public boolean field2;\n\n    public BooleanModel() {\n    }\n\n    public BooleanModel(boolean field1, Boolean field2) {\n        this.field2 = field2;\n        this.field1 = field1;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/collections/ArrayTest.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.collections;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.TestTypeToken;\n\nimport java.math.BigDecimal;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class ArrayTest {\n\n    @Test\n    public void testStringArray() {\n        String[] stringArray = new String[3];\n        stringArray[0] = \"first\";\n        stringArray[1] = \"second\";\n        stringArray[2] = \"third\";\n\n        String expected = \"[\\\"first\\\",\\\"second\\\",\\\"third\\\"]\";\n\n        assertEquals(expected, nullableJsonb.toJson(stringArray));\n\n        String[] result = nullableJsonb.fromJson(expected, stringArray.getClass());\n        assertEquals(\"first\", result[0]);\n        assertEquals(\"second\", result[1]);\n        assertEquals(\"third\", result[2]);\n    }\n\n    @Test\n    public void testObjectArrayOfObjects() {\n        Object[] objectArray = new Object[2];\n        objectArray[0] = new KeyValue(\"first\");\n        objectArray[1] = new KeyValue(\"second\");\n\n        String expected = \"[{\\\"field\\\":\\\"first\\\"},{\\\"field\\\":\\\"second\\\"}]\";\n\n        assertEquals(expected, nullableJsonb.toJson(objectArray));\n        Object[] result = nullableJsonb.fromJson(expected, objectArray.getClass());\n        assertEquals(HashMap.class, result[0].getClass());\n        assertEquals(HashMap.class, result[1].getClass());\n        assertEquals(\"first\", ((Map) result[0]).get(\"field\"));\n        assertEquals(\"second\", ((Map) result[1]).get(\"field\"));\n    }\n\n    @Test\n    public void testListOfArrays() {\n        List<String[]> listOfArrays = new ArrayList<>();\n        String[] stringArray = new String[2];\n        stringArray[0] = \"first\";\n        stringArray[1] = \"second\";\n        listOfArrays.add(stringArray);\n        listOfArrays.add(stringArray);\n\n        String expected = \"[[\\\"first\\\",\\\"second\\\"],[\\\"first\\\",\\\"second\\\"]]\";\n        assertEquals(expected, nullableJsonb.toJson(listOfArrays));\n        List<String[]> result = nullableJsonb.fromJson(expected, new TestTypeToken<ArrayList<String[]>>(){}.getType());\n        assertEquals(\"first\", result.get(0)[0]);\n        assertEquals(\"second\", result.get(0)[1]);\n        assertEquals(\"first\", result.get(1)[0]);\n        assertEquals(\"second\", result.get(1)[1]);\n    }\n\n    @Test\n    public void testMultidimensionalArrays() {\n        String[][] multi = new String[2][2];\n        multi[0][0] = \"[0],[0]\";\n        multi[0][1] = \"[0],[1]\";\n        multi[1][0] = \"[1],[0]\";\n        multi[1][1] = \"[1],[1]\";\n        String expected = \"[[\\\"[0],[0]\\\",\\\"[0],[1]\\\"],[\\\"[1],[0]\\\",\\\"[1],[1]\\\"]]\";\n        assertEquals(expected, nullableJsonb.toJson(multi));\n        String[][] result = nullableJsonb.fromJson(expected, multi.getClass());\n        assertEquals(\"[0],[0]\", result[0][0]);\n        assertEquals(\"[0],[1]\", result[0][1]);\n        assertEquals(\"[1],[0]\", result[1][0]);\n        assertEquals(\"[1],[1]\", result[1][1]);\n    }\n\n    @Test\n    public void testDeserializeJsonArrayIntoObject() {\n        String json = \"[\\\"first\\\",\\\"second\\\",\\\"third\\\"]\";\n        Object result = nullableJsonb.fromJson(json, Object.class);\n        assertTrue(result instanceof List);\n        assertEquals(\"first\", ((List)result).get(0));\n        assertEquals(\"second\", ((List)result).get(1));\n        assertEquals(\"third\", ((List)result).get(2));\n    }\n\n    @Test\n    public void testDeserializeJsonObjectIntoListOfMaps() {\n        String json = \"[{\\\"first\\\":1,\\\"second\\\":10}]\";\n        Object result = nullableJsonb.fromJson(json, List.class);\n        assertTrue(result instanceof List);\n        assertEquals(BigDecimal.ONE, ((Map) ((List) result).get(0)).get(\"first\"));\n        assertEquals(BigDecimal.TEN, ((Map) ((List) result).get(0)).get(\"second\"));\n    }\n\n    @Test\n    public void testUnmarshallMapWithArrayValue() {\n        Map<String, String[]> arrayValueMap = new HashMap<>();\n        String[] strings = new String[2];\n        strings[0] = \"zero\";\n        strings[1] = \"one\";\n        arrayValueMap.put(\"first\", strings);\n        String expected = \"{\\\"first\\\":[\\\"zero\\\",\\\"one\\\"]}\";\n        assertEquals(expected, nullableJsonb.toJson(arrayValueMap));\n        Map<String, String[]> result = nullableJsonb.fromJson(expected, new TestTypeToken<HashMap<String, String[]>>(){}.getType());\n        assertEquals(\"zero\", result.get(\"first\")[0]);\n        assertEquals(\"one\", result.get(\"first\")[1]);\n    }\n\n    @Test\n    public void testArrayOfNulls() {\n        String[] nulls = new String[2];\n        String expected = \"[null,null]\";\n        assertEquals(expected, nullableJsonb.toJson(nulls));\n        String[] result = nullableJsonb.fromJson(expected, nulls.getClass());\n        assertTrue(result.length == 2);\n        assertNull(result[0]);\n        assertNull(result[1]);\n\n        Integer ints[] = new Integer[2];\n        assertEquals(expected, nullableJsonb.toJson(ints));\n    }\n\n    @Test\n    public void testByteArray() {\n        byte[] byteArr = {-128, 127};\n        assertEquals(\"[-128,127]\", nullableJsonb.toJson(byteArr));\n        assertArrayEquals(byteArr, nullableJsonb.fromJson(\"[-128, 127]\", byte[].class));\n    }\n\n    @Test\n    public void testCharArray() {\n        char[] charArr = {'a', 'b', 'c'};\n        assertEquals(\"[\\\"a\\\",\\\"b\\\",\\\"c\\\"]\", nullableJsonb.toJson(charArr));\n        assertArrayEquals(charArr, nullableJsonb.fromJson(\"[\\\"a\\\",\\\"b\\\",\\\"c\\\"]\", char[].class));\n    }\n\n    @Test\n    public void testShortArray() {\n        short[] shortArr = {-128, 127};\n        assertEquals(\"[-128,127]\", nullableJsonb.toJson(shortArr));\n        assertArrayEquals(shortArr, nullableJsonb.fromJson(\"[-128, 127]\", short[].class));\n    }\n\n    @Test\n    public void testIntArray() {\n        int[] intArr = {-128, 127};\n        assertEquals(\"[-128,127]\", nullableJsonb.toJson(intArr));\n        assertArrayEquals(intArr, nullableJsonb.fromJson(\"[-128, 127]\", int[].class));\n    }\n\n    @Test\n    public void testLongArray() {\n        long[] longArr = {-128, 127};\n        assertEquals(\"[-128,127]\", nullableJsonb.toJson(longArr));\n        assertArrayEquals(longArr, nullableJsonb.fromJson(\"[-128, 127]\", long[].class));\n    }\n\n    @Test\n    public void testFloatArray() {\n        float[] floatArr = {-128, 127};\n        assertEquals(\"[-128.0,127.0]\", nullableJsonb.toJson(floatArr));\n        assertArrayEquals(floatArr, nullableJsonb.fromJson(\"[-128.0, 127.0]\", float[].class), 0f);\n    }\n\n    @Test\n    public void testDoubleArray() {\n        double[] doubleArr = {-128, 127};\n        assertEquals(\"[-128.0,127.0]\", nullableJsonb.toJson(doubleArr));\n        assertArrayEquals(doubleArr, nullableJsonb.fromJson(\"[-128.0, 127.0]\", double[].class), 0d);\n    }\n\n    public static class KeyValue {\n        public String field;\n\n        public KeyValue(String field) {\n            this.field = field;\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/collections/CollectionsTest.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.collections;\n\nimport static org.eclipse.yasson.Jsonbs.*;\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.assertTrue;\n\nimport java.math.BigDecimal;\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Deque;\nimport java.util.EnumMap;\nimport java.util.EnumSet;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.LinkedHashMap;\nimport java.util.LinkedHashSet;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NavigableMap;\nimport java.util.SortedMap;\nimport java.util.TreeMap;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentMap;\nimport java.util.concurrent.ConcurrentNavigableMap;\nimport java.util.concurrent.ConcurrentSkipListMap;\n\nimport org.eclipse.yasson.TestTypeToken;\nimport org.eclipse.yasson.defaultmapping.generics.model.Circle;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Default mapping arrays/collections/enums tests.\n *\n * @author Dmitry Kornilov\n */\npublic class CollectionsTest {\n\n    @Test\n    public void testMarshallCollection() {\n        final Collection<Integer> collection = Arrays.asList(1, 2, 3);\n        assertEquals(\"[1,2,3]\", nullableJsonb.toJson(collection));\n    }\n\n    @Test\n    public void testMarshallMap() {\n        Map<String, Integer> stringIntegerMap = new LinkedHashMap<>();\n        stringIntegerMap.put(\"1\",1);\n        stringIntegerMap.put(\"2\",2);\n        stringIntegerMap.put(\"3\",3);\n\n        assertEquals(\"{\\\"1\\\":1,\\\"2\\\":2,\\\"3\\\":3}\", nullableJsonb.toJson(stringIntegerMap));\n        assertEquals(stringIntegerMap, nullableJsonb.fromJson(\"{\\\"1\\\":1,\\\"2\\\":2,\\\"3\\\":3}\", new LinkedHashMap<String, Integer>(){}.getClass().getGenericSuperclass()));\n        System.out.println();\n    }\n\n    @Test\n    public void testMarshallMapWithNulls() {\n        Map<String, String> mapWithNulls = new LinkedHashMap<>();\n        mapWithNulls.put(\"key1\",null);\n        mapWithNulls.put(\"key2\",null);\n        mapWithNulls.put(\"key3\",null);\n\n        assertEquals(\"{\\\"key1\\\":null,\\\"key2\\\":null,\\\"key3\\\":null}\", nullableJsonb.toJson(mapWithNulls));\n    }\n\n    @Test\n    public void testListOfNumbers() {\n        List<Number> numberList = new ArrayList<>();\n        numberList.add(1L);\n        numberList.add(2f);\n        numberList.add(10);\n\n        String result = nullableJsonb.toJson(numberList, new TestTypeToken<List<Number>>(){}.getType());\n    }\n\n    @Test\n    public void testListOfListsOfStrings() {\n        List<List<String>> listOfListsOfStrings = new ArrayList<>();\n        \n        for(int i = 0; i < 10; i++) {\n            List<String> stringList = new ArrayList<>();\n            stringList.add(\"first\");\n            stringList.add(\"second\");\n            stringList.add(\"third\");\n            listOfListsOfStrings.add(stringList);\n        }\n        \n        final String expected = \"[[\\\"first\\\",\\\"second\\\",\\\"third\\\"],[\\\"first\\\",\\\"second\\\",\\\"third\\\"],[\\\"first\\\",\\\"second\\\",\\\"third\\\"],[\\\"first\\\",\\\"second\\\",\\\"third\\\"],[\\\"first\\\",\\\"second\\\",\\\"third\\\"],[\\\"first\\\",\\\"second\\\",\\\"third\\\"],[\\\"first\\\",\\\"second\\\",\\\"third\\\"],[\\\"first\\\",\\\"second\\\",\\\"third\\\"],[\\\"first\\\",\\\"second\\\",\\\"third\\\"],[\\\"first\\\",\\\"second\\\",\\\"third\\\"]]\";\n        assertEquals(expected, nullableJsonb.toJson(listOfListsOfStrings));\n        assertEquals(listOfListsOfStrings, nullableJsonb.fromJson(expected, new ArrayList<List<String>>(){}.getClass().getGenericSuperclass()));\n    }\n\n    @Test\n    public void listOfMapsOfListsOfMaps() {\n        List<Map<String, List<Map<String, Integer>>>> listOfMapsOfListsOfMaps = new ArrayList<>();\n        \n        for(int i = 0; i < 3; i++) {\n            Map<String, List<Map<String, Integer>>> mapOfListsOfMap = new HashMap<>();\n            \n            for(int j = 0; j < 3; j++) {\n                List<Map<String, Integer>> listOfMaps = new ArrayList<>();\n                \n                for(int k = 0; k < 3; k++) {\n                    Map<String, Integer> stringIntegerMap = new HashMap<>();\n                    stringIntegerMap.put(\"first\", 1);\n                    stringIntegerMap.put(\"second\", 2);\n                    stringIntegerMap.put(\"third\", 3);\n                    listOfMaps.add(stringIntegerMap);\n                }\n                mapOfListsOfMap.put(String.valueOf(j), listOfMaps);\n            }\n            listOfMapsOfListsOfMaps.add(mapOfListsOfMap);\n        }\n        \n        String expected = \"[{\\\"0\\\":[{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2}],\\\"1\\\":[{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2}],\\\"2\\\":[{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2}]},{\\\"0\\\":[{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2}],\\\"1\\\":[{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2}],\\\"2\\\":[{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2}]},{\\\"0\\\":[{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2}],\\\"1\\\":[{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2}],\\\"2\\\":[{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2},{\\\"third\\\":3,\\\"first\\\":1,\\\"second\\\":2}]}]\";\n        assertEquals(expected, nullableJsonb.toJson(listOfMapsOfListsOfMaps));\n        ArrayList<Map<String, List<Map<String, Integer>>>> result = nullableJsonb.fromJson(expected, new TestTypeToken<ArrayList<Map<String, List<Map<String, Integer>>>>>(){}.getType());\n        assertEquals(listOfMapsOfListsOfMaps, result);\n    }\n\n    @Test\n    public void testAnyCollection() {\n        final Deque<String> deque = new ArrayDeque<>();\n        deque.add(\"dequeueFirst\");\n        deque.add(\"dequeueSecond\");\n        String expected = \"[\\\"dequeueFirst\\\",\\\"dequeueSecond\\\"]\";\n        assertEquals(expected, nullableJsonb.toJson(deque));\n        Deque<String> dequeueResult = nullableJsonb.fromJson(expected, new TestTypeToken<ArrayDeque<String>>(){}.getType());\n        assertEquals(\"dequeueFirst\", dequeueResult.getFirst());\n        assertEquals(\"dequeueSecond\", dequeueResult.getLast());\n\n        LinkedHashSet<String> linkedHashSet = new LinkedHashSet<>();\n        linkedHashSet.add(\"setFirst\");\n        linkedHashSet.add(\"setSecond\");\n        expected = \"[\\\"setFirst\\\",\\\"setSecond\\\"]\";\n        assertEquals(expected, nullableJsonb.toJson(linkedHashSet));\n        LinkedHashSet<String> linkedHashSetResult = nullableJsonb.fromJson(expected, new TestTypeToken<LinkedHashSet<String>>(){}.getType());\n        Iterator<String> iterator = linkedHashSetResult.iterator();\n        assertEquals(\"setFirst\", iterator.next());\n        assertEquals(\"setSecond\", iterator.next());\n\n        LinkedList<String> linkedList = new LinkedList<>();\n        linkedList.add(\"listFirst\");\n        linkedList.add(\"listSecond\");\n        expected = \"[\\\"listFirst\\\",\\\"listSecond\\\"]\";\n        assertEquals(expected, nullableJsonb.toJson(linkedList));\n        LinkedList<String> linkedListResult = nullableJsonb.fromJson(expected, new TestTypeToken<LinkedList<String>>(){}.getType());\n        iterator = linkedListResult.iterator();\n        assertEquals(\"listFirst\", iterator.next());\n        assertEquals(\"listSecond\", iterator.next());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testMarshallArray() {\n        //support of arrays of types that JSON Binding is able to serialize\n        //Byte[], Short[], Integer[] Long[], Float[], Double[], BigInteger[], BigDecimal[], Number[]\n        //Object[], JsonArray[], JsonObject[], JsonStructure[]\n        //String[], Character[]\n        //byte[], short[], int[], long[], float[], double[], char[], boolean[]\n        //java.net.URL[], java.net.URI[]\n        //Map[], Collection[], other collections ...\n        //enum, EnumSet, EnumMap\n        //support of multidimensional arrays\n\n        final Byte[] byteArray = {1, 2, 3};\n        assertEquals(\"[1,2,3]\", nullableJsonb.toJson(byteArray));\n\n        final Integer[] integerArray = {1, 2, 3};\n        assertEquals(\"[1,2,3]\", nullableJsonb.toJson(integerArray));\n\n        final String[] stringArray = {\"first\", \"second\", \"third\"};\n        assertEquals(\"[\\\"first\\\",\\\"second\\\",\\\"third\\\"]\", nullableJsonb.toJson(stringArray));\n\n        Character[] charArr = {'a', 'b', 'c'};\n        assertEquals(\"[\\\"a\\\",\\\"b\\\",\\\"c\\\"]\", nullableJsonb.toJson(charArr));\n\n        final byte[] bytePrimitivesArray = {1, 2, 3};\n        assertEquals(\"[1,2,3]\", nullableJsonb.toJson(bytePrimitivesArray));\n\n        final int[] intArray = {1, 2, 3};\n        assertEquals(\"[1,2,3]\", nullableJsonb.toJson(intArray));\n\n        final String[][] stringMultiArray = {{\"first\", \"second\"},{\"third\", \"fourth\"}};\n        assertEquals(\"[[\\\"first\\\",\\\"second\\\"],[\\\"third\\\",\\\"fourth\\\"]]\", nullableJsonb.toJson(stringMultiArray));\n\n        final Map<String, Object>[][] mapMultiArray = new LinkedHashMap[2][2];\n        mapMultiArray[0][0] = new LinkedHashMap<>(1);\n        mapMultiArray[0][0].put(\"0\", 0);\n        mapMultiArray[0][1] = new LinkedHashMap<>(1);\n        mapMultiArray[0][1].put(\"0\", 1);\n        mapMultiArray[1][0] = new LinkedHashMap<>(1);\n        mapMultiArray[1][0].put(\"1\", 0);\n        mapMultiArray[1][1] = new LinkedHashMap<>(1);\n        mapMultiArray[1][1].put(\"1\", 1);\n\n        assertEquals(\"[[{\\\"0\\\":0},{\\\"0\\\":1}],[{\\\"1\\\":0},{\\\"1\\\":1}]]\", nullableJsonb.toJson(mapMultiArray));\n    }\n\n    @Test\n    public void testMarshallEnumSet() {\n        final EnumSet<Language> languageEnumSet = EnumSet.of(Language.Czech, Language.Slovak);\n\n        final String result = nullableJsonb.toJson(languageEnumSet);\n        assertTrue(\"[\\\"Czech\\\",\\\"Slovak\\\"]\".equals(result) || \"[\\\"Slovak\\\",\\\"Czech\\\"]\".equals(result));\n        assertEquals(languageEnumSet, nullableJsonb.fromJson(result, new TestTypeToken<EnumSet<Language>>() {}.getType()));\n    }\n\n    @Test\n    public void testMarshallEnumMap() {\n        final EnumMap<Language, String> languageEnumMap = new EnumMap<>(Language.class);\n        languageEnumMap.put(Language.Russian, \"ru\");\n        languageEnumMap.put(Language.English, \"en\");\n\n        final String result = nullableJsonb.toJson(languageEnumMap);\n        assertTrue(\"{\\\"Russian\\\":\\\"ru\\\",\\\"English\\\":\\\"en\\\"}\".equals(result) ||\n                \"{\\\"English\\\":\\\"en\\\",\\\"Russian\\\":\\\"ru\\\"}\".equals(result));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testRawCollection() {\n        List rawList = new ArrayList();\n        rawList.add(\"first\");\n        Circle circle = new Circle();\n        circle.setRadius(2.0);\n        circle.setArea(1.0);\n        rawList.add(circle);\n\n        String expected = \"[\\\"first\\\",{\\\"area\\\":1.0,\\\"radius\\\":2.0}]\";\n        assertEquals(expected, nullableJsonb.toJson(rawList));\n        List result = nullableJsonb.fromJson(expected, List.class);\n        assertEquals(\"first\", result.get(0));\n        assertEquals(new BigDecimal(\"2.0\"), ((Map)result.get(1)).get(\"radius\"));\n        assertEquals(new BigDecimal(\"1.0\"), ((Map)result.get(1)).get(\"area\"));\n    }\n\n    @Test\n    public void testNavigableMap() {\n        NavigableMap<String, String> map = new TreeMap<>();\n        map.put(\"first\", \"abc\");\n        map.put(\"second\", \"def\");\n        final String json = nullableJsonb.toJson(map);\n        assertEquals(\"{\\\"first\\\":\\\"abc\\\",\\\"second\\\":\\\"def\\\"}\", json);\n\n        NavigableMap<String, String> result = nullableJsonb.fromJson(json, new TestTypeToken<NavigableMap<String, String>>() {}.getType());\n        assertEquals(TreeMap.class, result.getClass());\n        assertEquals(\"abc\", result.get(\"first\"));\n        assertEquals(\"def\", result.get(\"second\"));\n    }\n\n    @Test\n    public void testSortedMap() {\n        SortedMap<String, String> map = new TreeMap<>();\n        map.put(\"first\", \"abc\");\n        map.put(\"second\", \"def\");\n        final String json = nullableJsonb.toJson(map);\n        assertEquals(\"{\\\"first\\\":\\\"abc\\\",\\\"second\\\":\\\"def\\\"}\", json);\n\n        SortedMap<String, String> result = nullableJsonb.fromJson(json, new TestTypeToken<SortedMap<String, String>>() {}.getType());\n        assertEquals(TreeMap.class, result.getClass());\n        assertEquals(\"abc\", result.get(\"first\"));\n        assertEquals(\"def\", result.get(\"second\"));\n    }\n    \n    public static class ConcurrentMapContainer {\n    \tpublic ConcurrentMap<String, String> concurrentMap;\n    \tpublic ConcurrentHashMap<String,String> concurrentHashMap;\n    \tpublic ConcurrentNavigableMap<String, String> concurrentNavigableMap;\n    \tpublic ConcurrentSkipListMap<String, String> concurrentSkipListMap;\n    }\n    \n    @Test\n    public void testConcurrentMaps() {\n    \t// ConcurrentMap\n    \tConcurrentMapContainer c = new ConcurrentMapContainer();\n    \tc.concurrentMap = new ConcurrentHashMap<String, String>();\n    \tc.concurrentMap.put(\"foo\", \"fooVal\");\n    \tc.concurrentMap.put(\"bar\", \"barVal\");\n    \tString expectedJson = \"{\\\"concurrentMap\\\":{\\\"bar\\\":\\\"barVal\\\",\\\"foo\\\":\\\"fooVal\\\"}}\";\n    \tassertEquals(expectedJson, defaultJsonb.toJson(c));\n    \tassertEquals(c.concurrentMap, defaultJsonb.fromJson(expectedJson, ConcurrentMapContainer.class).concurrentMap);\n    \t\n    \t// ConcurrentHashMap\n    \tc = new ConcurrentMapContainer();\n    \tc.concurrentHashMap = new ConcurrentHashMap<String, String>();\n    \tc.concurrentHashMap.put(\"foo\", \"fooVal2\");\n    \tc.concurrentHashMap.put(\"bar\", \"barVal2\");\n    \texpectedJson = \"{\\\"concurrentHashMap\\\":{\\\"bar\\\":\\\"barVal2\\\",\\\"foo\\\":\\\"fooVal2\\\"}}\";\n    \tassertEquals(expectedJson, defaultJsonb.toJson(c));\n    \tassertEquals(c.concurrentHashMap, defaultJsonb.fromJson(expectedJson, ConcurrentMapContainer.class).concurrentHashMap);\n    \t\n    \t// ConcurrentNavigableMap\n    \tc = new ConcurrentMapContainer();\n    \tc.concurrentNavigableMap = new ConcurrentSkipListMap<String, String>();\n    \tc.concurrentNavigableMap.put(\"foo\", \"fooVal3\");\n    \tc.concurrentNavigableMap.put(\"bar\", \"barVal3\");\n    \texpectedJson = \"{\\\"concurrentNavigableMap\\\":{\\\"bar\\\":\\\"barVal3\\\",\\\"foo\\\":\\\"fooVal3\\\"}}\";\n    \tassertEquals(expectedJson, defaultJsonb.toJson(c));\n    \tassertEquals(c.concurrentNavigableMap, defaultJsonb.fromJson(expectedJson, ConcurrentMapContainer.class).concurrentNavigableMap);\n    \t\n    \t// ConcurrentSkipListMap\n    \tc = new ConcurrentMapContainer();\n    \tc.concurrentSkipListMap = new ConcurrentSkipListMap<String, String>();\n    \tc.concurrentSkipListMap.put(\"foo\", \"fooVal4\");\n    \tc.concurrentSkipListMap.put(\"bar\", \"barVal4\");\n    \texpectedJson = \"{\\\"concurrentSkipListMap\\\":{\\\"bar\\\":\\\"barVal4\\\",\\\"foo\\\":\\\"fooVal4\\\"}}\";\n    \tassertEquals(expectedJson, defaultJsonb.toJson(c));\n    \tassertEquals(c.concurrentSkipListMap, defaultJsonb.fromJson(expectedJson, ConcurrentMapContainer.class).concurrentSkipListMap);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/collections/Language.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.collections;\n\n/**\n * Test enumeration.\n *\n * @author Dmitry Kornilov\n */\npublic enum Language {\n    English,\n    Russian,\n    Slovak,\n    Czech\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/collections/MapKeyTypesTest.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.collections;\n\nimport java.time.ZoneId;\nimport java.time.ZonedDateTime;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.UUID;\n\nimport org.eclipse.yasson.Jsonbs;\nimport org.eclipse.yasson.TestTypeToken;\nimport org.junit.jupiter.api.Test;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\n\n/**\n * Tests to verify proper map key serialization and deserialization.\n */\npublic class MapKeyTypesTest {\n\n    @Test\n    public void uuidMapKey() {\n        String expected = \"{\\\"ccf3e2d3-3589-4c91-9ba9-1250ef515327\\\":{\\\"firstName\\\":\\\"FirstName1\\\",\\\"sureName\\\":\\\"SureName1\\\"},\"\n                + \"\\\"0bb54cee-d538-428b-9719-5cc38c988522\\\":{\\\"firstName\\\":\\\"FirstName2\\\",\\\"sureName\\\":\\\"SureName2\\\"}}\";\n        Map<UUID, Person> map = new HashMap<>();\n        Person person = new Person();\n        person.firstName = \"FirstName1\";\n        person.sureName = \"SureName1\";\n        Person person2 = new Person();\n        person2.firstName = \"FirstName2\";\n        person2.sureName = \"SureName2\";\n        map.put(UUID.fromString(\"ccf3e2d3-3589-4c91-9ba9-1250ef515327\"), person);\n        map.put(UUID.fromString(\"0bb54cee-d538-428b-9719-5cc38c988522\"), person2);\n        assertEquals(expected, Jsonbs.defaultJsonb.toJson(map));\n        assertEquals(map, Jsonbs.defaultJsonb.fromJson(expected, new TestTypeToken<Map<UUID, Person>>() { }.getType()));\n    }\n\n    @Test\n    public void zonedDateTimeMapKey() {\n        ZonedDateTime zonedDateTime = ZonedDateTime.of(2020, 9, 14,\n                                                       9, 33, 12, 0,\n                                                       ZoneId.of(\"UTC\"));\n        ZonedDateTime zonedDateTime2 = ZonedDateTime.of(2019, 8, 13,\n                                                        8, 32, 11, 1234,\n                                                        ZoneId.of(\"UTC\"));\n        String expected = \"{\\\"2020-09-14T09:33:12Z[UTC]\\\":{\\\"firstName\\\":\\\"FirstName1\\\",\"\n                + \"\\\"sureName\\\":\\\"SureName1\\\"},\"\n                + \"\\\"2019-08-13T08:32:11.000001234Z[UTC]\\\":{\\\"firstName\\\":\\\"FirstName2\\\",\"\n                + \"\\\"sureName\\\":\\\"SureName2\\\"}}\";\n        Map<ZonedDateTime, Person> map = new HashMap<>();\n        Person person = new Person();\n        person.firstName = \"FirstName1\";\n        person.sureName = \"SureName1\";\n        Person person2 = new Person();\n        person2.firstName = \"FirstName2\";\n        person2.sureName = \"SureName2\";\n        map.put(zonedDateTime, person);\n        map.put(zonedDateTime2, person2);\n        assertEquals(expected, Jsonbs.defaultJsonb.toJson(map));\n        assertEquals(map, Jsonbs.defaultJsonb.fromJson(expected, new TestTypeToken<Map<ZonedDateTime, Person>>() { }.getType()));\n    }\n\n    public static final class Person {\n\n        public String firstName;\n        public String sureName;\n\n        @Override\n        public boolean equals(Object o) {\n            if (this == o) {\n                return true;\n            }\n            if (o == null || getClass() != o.getClass()) {\n                return false;\n            }\n            Person person = (Person) o;\n            return Objects.equals(firstName, person.firstName) &&\n                    Objects.equals(sureName, person.sureName);\n        }\n\n        @Override\n        public int hashCode() {\n            return Objects.hash(firstName, sureName);\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/DatesTest.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates;\n\nimport java.io.Serializable;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.sql.Timestamp;\nimport java.text.ParseException;\nimport java.text.SimpleDateFormat;\nimport java.time.Duration;\nimport java.time.Instant;\nimport java.time.LocalDate;\nimport java.time.LocalDateTime;\nimport java.time.LocalTime;\nimport java.time.Month;\nimport java.time.MonthDay;\nimport java.time.OffsetDateTime;\nimport java.time.OffsetTime;\nimport java.time.Period;\nimport java.time.YearMonth;\nimport java.time.ZoneId;\nimport java.time.ZoneOffset;\nimport java.time.ZonedDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Calendar;\nimport java.util.Date;\nimport java.util.GregorianCalendar;\nimport java.util.HashMap;\nimport java.util.Locale;\nimport java.util.Map;\nimport java.util.SimpleTimeZone;\nimport java.util.TimeZone;\n\nimport javax.xml.datatype.DatatypeConfigurationException;\nimport javax.xml.datatype.DatatypeFactory;\nimport javax.xml.datatype.XMLGregorianCalendar;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport jakarta.json.bind.annotation.JsonbTypeDeserializer;\nimport jakarta.json.bind.config.PropertyVisibilityStrategy;\nimport org.eclipse.yasson.TestTypeToken;\nimport org.eclipse.yasson.YassonConfig;\nimport org.eclipse.yasson.defaultmapping.dates.model.CalendarPojo;\nimport org.eclipse.yasson.defaultmapping.dates.model.ClassLevelDateAnnotation;\nimport org.eclipse.yasson.defaultmapping.dates.model.DatePojo;\nimport org.eclipse.yasson.defaultmapping.dates.model.DateWithZonePojo;\nimport org.eclipse.yasson.defaultmapping.dates.model.InstantPojo;\nimport org.eclipse.yasson.defaultmapping.dates.model.LocalDatePojo;\nimport org.eclipse.yasson.defaultmapping.dates.model.LocalDateTimePojo;\nimport org.eclipse.yasson.defaultmapping.dates.model.LocalTimePojo;\nimport org.eclipse.yasson.defaultmapping.dates.model.MonthDayPojo;\nimport org.eclipse.yasson.defaultmapping.dates.model.OffsetDateTimePojo;\nimport org.eclipse.yasson.defaultmapping.dates.model.OffsetTimePojo;\nimport org.eclipse.yasson.defaultmapping.dates.model.YearMonthPojo;\nimport org.eclipse.yasson.defaultmapping.dates.model.ZonedDateTimePojo;\nimport org.eclipse.yasson.defaultmapping.generics.model.ScalarValueWrapper;\nimport org.eclipse.yasson.internal.deserializer.types.SqlDateDeserializer;\nimport org.junit.jupiter.api.Test;\n\nimport static org.eclipse.yasson.Jsonbs.bindingJsonb;\nimport static org.eclipse.yasson.Jsonbs.defaultJsonb;\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.fail;\n\n/**\n * This class contains tests for marshalling/unmarshalling dates.\n *\n * @author Dmitry Kornilov\n */\npublic class DatesTest {\n    \n    private static LocalDate localDate = LocalDate.of(2018, 1, 31);\n\n    @SuppressWarnings(\"serial\")\n\tpublic static class LocalDateObj implements Serializable {\n        public LocalDate date = localDate;\n    }\n\n    @SuppressWarnings(\"serial\")\n\tpublic static class SqlDateObj implements Serializable {\n        public java.sql.Date sqlDate = java.sql.Date.valueOf(\"2018-01-31\");\n        //no way for runtime to choose java.sql.Date deserializer here without a hint\n        @JsonbTypeDeserializer(SqlDateDeserializer.class)\n        public java.util.Date utilDate = java.sql.Date.valueOf(\"2018-01-31\");\n\n    }\n    \n    public static class SqlDateFormatted {\n        @JsonbDateFormat(value = \"yyyy-MM-dd\")\n        public java.sql.Date sqlDate;\n        @JsonbDateFormat(value = \"yyyy-MM-dd\")\n        public java.util.Date utilDate;\n\n\n    }\n\n    @Test\n    public void testSqlTimestamp() {\n        Timestamp expectedTimestamp = Timestamp.from(Instant.now());\n\n        String json = bindingJsonb.toJson(expectedTimestamp);\n\n        Timestamp timestamp = bindingJsonb.fromJson(json, Timestamp.class);\n        assertEquals(expectedTimestamp, timestamp);\n    }\n\n    @Test\n    public void testMarshallSqlDate() {\n        String jsonString = bindingJsonb.toJson(new SqlDateObj());\n        assertEquals(\"{\\\"sqlDate\\\":\\\"2018-01-31Z\\\",\\\"utilDate\\\":\\\"2018-01-31Z\\\"}\", jsonString);\n    }\n\n    @Test\n    public void testUnmarshallSqlDate() {\n        SqlDateObj result = bindingJsonb.fromJson(\"{\\\"sqlDate\\\":\\\"2018-01-31Z\\\",\\\"utilDate\\\":\\\"2018-01-31Z\\\"}\", SqlDateObj.class);\n        assertEquals(\"2018-01-31\", result.sqlDate.toString());\n        assertEquals(\"2018-01-31\", result.utilDate.toString());\n    }\n\n    @Test\n    public void testMarshallSqlDateFormatted() {\n        final String date = \"2026-02-25\";\n        final String expectedJson = String.format(\"{\\\"sqlDate\\\":\\\"%1$s\\\",\\\"utilDate\\\":\\\"%1$s\\\"}\", date);\n\n        final SqlDateFormatted sqlDateFormatted = new SqlDateFormatted();\n        sqlDateFormatted.sqlDate = java.sql.Date.valueOf(date);\n        // We use a java.sql.Date here as we want to test as if this was a Jakarta Persistence temporal date\n        sqlDateFormatted.utilDate = java.sql.Date.valueOf(date);\n        String jsonString = bindingJsonb.toJson(sqlDateFormatted);\n        assertEquals(expectedJson, jsonString);\n\n        // Unmarshal the object\n        final SqlDateFormatted result = bindingJsonb.fromJson(jsonString, SqlDateFormatted.class);\n        assertEquals(sqlDateFormatted.sqlDate, result.sqlDate);\n        // The Date objects will not be equal unless user.timezone is set to UTC. The sqlDateFormatted.utilDate is\n        // created at midnight in the current timezone (via valueOf()), while result.utilDate is created at midnight UTC\n        // per the JSON-B specification. To verify both represent the same calendar date, we convert each to LocalDate\n        // using its respective timezone: the original uses systemDefault(), the deserialized uses UTC.\n        assertEquals(Instant.ofEpochMilli(sqlDateFormatted.utilDate.getTime()).atZone(ZoneId.systemDefault()).toLocalDate(),\n                result.utilDate.toInstant().atZone(ZoneOffset.UTC).toLocalDate());\n    }\n\n    @Test\n    public void testUnmarshallSqlDateFormatted() {\n        final String date = \"2026-02-25\";\n        final String expectedString = String.format(\"{\\\"sqlDate\\\":\\\"%1$s\\\",\\\"utilDate\\\":\\\"%1$s\\\"}\", date);\n\n        final SqlDateFormatted sqlDateFormatted = bindingJsonb.fromJson(expectedString, SqlDateFormatted.class);\n        assertEquals(date, sqlDateFormatted.sqlDate.toString());\n        // Convert java.util.Date to LocalDate for comparison\n        final LocalDate resultDate = sqlDateFormatted.utilDate.toInstant()\n                .atZone(ZoneOffset.UTC)\n                .toLocalDate();\n        assertEquals(LocalDate.parse(date),  resultDate);\n\n        // Unmarshal the object\n        final String result = bindingJsonb.toJson(sqlDateFormatted);\n        assertEquals(expectedString, result);\n    }\n\n    public static class YearMonthFormatted {\n        @JsonbDateFormat(value = \"yyyy-MM\")\n        public java.util.Date date;\n    }\n\n    @Test\n    public void testMarshallYearMonthFormat() {\n        final YearMonthFormatted yearMonthFormatted = new YearMonthFormatted();\n        yearMonthFormatted.date = java.sql.Date.valueOf(\"2026-02-25\");\n        String jsonString = bindingJsonb.toJson(yearMonthFormatted);\n        assertEquals(\"{\\\"date\\\":\\\"2026-02\\\"}\", jsonString);\n    }\n\n    @Test\n    public void testUnmarshallYearMonthFormat() {\n        final YearMonthFormatted yearMonthFormatted = bindingJsonb.fromJson(\n                \"{\\\"date\\\":\\\"2026-02\\\"}\",\n                YearMonthFormatted.class);\n        final LocalDate resultDate = yearMonthFormatted.date.toInstant()\n                .atZone(ZoneOffset.UTC)\n                .toLocalDate();\n        assertEquals(LocalDate.of(2026, 2, 1), resultDate);\n    }\n\n    @Test\n    public void testDateOnlyPatternEdgeCases() {\n        // Test various edge cases to ensure date values are preserved correctly\n        testDateRoundTrip(\"2028-03-01\"); // Day after leap year\n        testDateRoundTrip(\"2026-12-31\"); // Last day of year\n        testDateRoundTrip(\"2028-02-29\"); // Leap year day\n        testDateRoundTrip(\"2027-01-01\"); // First day of year\n        testDateRoundTrip(\"2028-01-31\"); // Last day of January\n        testDateRoundTrip(\"2028-02-01\"); // First day of February\n    }\n\n    private void testDateRoundTrip(final String date) {\n        final String json = String.format(\"{\\\"sqlDate\\\":\\\"%1$s\\\",\\\"utilDate\\\":\\\"%1$s\\\"}\", date);\n\n        // Deserialize\n        final SqlDateFormatted deserialized = bindingJsonb.fromJson(json, SqlDateFormatted.class);\n\n        // Verify utilDate represents midnight UTC for the specified date\n        final LocalDate resultDate = deserialized.utilDate.toInstant()\n                .atZone(ZoneOffset.UTC)\n                .toLocalDate();\n        assertEquals(LocalDate.parse(date), resultDate, () -> String.format(\"Date should be %s when viewed in UTC\", date));\n\n        // Verify JSON round-trip\n        final String roundTripped = bindingJsonb.toJson(deserialized);\n        assertEquals(json, roundTripped, () -> String.format(\"JSON should round-trip correctly for %s\", date));\n    }\n\n\n    @Test\n    public void testSqlDateTimeZonesFormatted() {\n        testSqlDateWithTZFormatted(TimeZone.getTimeZone(ZoneId.of(\"Europe/Sofia\")));\n        testSqlDateWithTZFormatted(TimeZone.getTimeZone(ZoneId.of(\"US/Hawaii\")));\n        testSqlDateWithTZFormatted(TimeZone.getTimeZone(ZoneId.of(\"Australia/Sydney\")));\n    }\n    \n    private void testSqlDateWithTZFormatted(TimeZone tz) {\n        final TimeZone originalTZ = TimeZone.getDefault();\n        TimeZone.setDefault(tz);\n        try {\n            Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withDateFormat(\"yyyy-MM-dd\", Locale.getDefault()));\n            java.sql.Date d = java.sql.Date.valueOf(\"1966-11-04\");\n            String json = jsonb.toJson(d);\n            assertEquals(\"\\\"1966-11-04\\\"\", json);\n            assertEquals(\"1966-11-04\", jsonb.fromJson(json, java.sql.Date.class).toString());\n        } finally {\n            TimeZone.setDefault(originalTZ);\n        }\n    }\n    \n    @Test\n    public void testSqlDateTimeZonesMillis() {\n        testSqlDateTimeZonesMillis(TimeZone.getTimeZone(ZoneId.of(\"Europe/Sofia\")), -99712800000L);\n        testSqlDateTimeZonesMillis(TimeZone.getTimeZone(ZoneId.of(\"US/Hawaii\")), -99669600000L);\n        testSqlDateTimeZonesMillis(TimeZone.getTimeZone(ZoneId.of(\"Australia/Sydney\")), -99741600000L);\n    }\n    \n    private void testSqlDateTimeZonesMillis(TimeZone tz, long expectedMs) {\n        final TimeZone originalTZ = TimeZone.getDefault();\n        TimeZone.setDefault(tz);\n        JsonbConfig jsonbConfig = new JsonbConfig().withDateFormat(JsonbDateFormat.TIME_IN_MILLIS, Locale.getDefault());\n        try (Jsonb jsonb = JsonbBuilder.create(jsonbConfig)) {\n            java.sql.Date d = java.sql.Date.valueOf(\"1966-11-04\");\n            String json = jsonb.toJson(d);\n            assertEquals(\"\" + expectedMs, json);\n            assertEquals(d, jsonb.fromJson(json, java.sql.Date.class));\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        } finally {\n            TimeZone.setDefault(originalTZ);\n        }\n    }\n    \n    @Test\n    public void testSqlDateTimeZones() {\n        testSqlDateWithTZ(TimeZone.getTimeZone(ZoneId.of(\"Europe/Sofia\")));\n        testSqlDateWithTZ(TimeZone.getTimeZone(ZoneId.of(\"US/Hawaii\")));\n        testSqlDateWithTZ(TimeZone.getTimeZone(ZoneId.of(\"Australia/Sydney\")));\n    }\n    \n    private void testSqlDateWithTZ(TimeZone tz) {\n        final TimeZone originalTZ = TimeZone.getDefault();\n        TimeZone.setDefault(tz);\n        try {\n            java.sql.Date d = java.sql.Date.valueOf(\"1966-11-04\");\n            String json = defaultJsonb.toJson(d);\n            assertEquals(\"\\\"1966-11-04Z\\\"\", json);\n            assertEquals(\"1966-11-04\", defaultJsonb.fromJson(json, java.sql.Date.class).toString());\n        } finally {\n            TimeZone.setDefault(originalTZ);\n        }\n    }\n\n    @Test\n    public void testMarshallLocalDate() {\n        String jsonString = bindingJsonb.toJson(new LocalDateObj());\n        if (jsonString.contains(\"T\")) {\n            fail(\"JSON contains time for a non Date that doesn't include time\");\n        }\n    }\n\n    @Test\n    public void testUnmarshallLocalDate() {\n        LocalDateObj localDateObj = bindingJsonb.fromJson(\"{\\\"date\\\":\\\"2018-01-31\\\"}\", LocalDateObj.class);\n        assertEquals(localDate, localDateObj.date);\n    }\n\n    @Test\n    public void testDate() throws ParseException {\n        final SimpleDateFormat sdf = new SimpleDateFormat(\"dd.MM.yyyy\");\n        sdf.setTimeZone(TimeZone.getTimeZone(\"UTC\"));\n        final Date parsedDate = sdf.parse(\"04.03.2015\");\n\n        final DatePojo pojo = new DatePojo();\n        pojo.customDate = parsedDate;\n        pojo.defaultFormatted = parsedDate;\n        pojo.millisFormatted = parsedDate;\n\n        // marshal to ISO format\n        final String expected = \"{\\\"defaultFormatted\\\":\\\"2015-03-04T00:00:00Z[UTC]\\\",\" +\n                \"\\\"millisFormatted\\\":\" + parsedDate.getTime()+ \",\" +\n                \"\\\"customDate\\\":\\\"00:00:00 | 04-03-2015\\\"}\";\n        assertEquals(expected, bindingJsonb.toJson(pojo));\n\n        final DatePojo result = bindingJsonb.fromJson(expected, DatePojo.class);\n        assertEquals(parsedDate, result.customDate);\n        assertEquals(parsedDate, result.defaultFormatted);\n        assertEquals(parsedDate, result.millisFormatted);\n    }\n\n    @Test\n    public void testDateWithZoneOffset() throws ParseException {\n        // Test for Yasson-172\n        final SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ssXXX\");\n        final Date parsedDate = sdf.parse(\"2018-11-02T00:00:00+01:00\");\n    \t\n    \tString jsonDateWithZone = \"{\\\"dateWithZone\\\":\\\"2018-11-02T00:00:00+01:00\\\"}\";\n    \tfinal DateWithZonePojo result = bindingJsonb.fromJson(jsonDateWithZone, DateWithZonePojo.class);\n    \t\n    \tassertEquals(parsedDate, result.dateWithZone);\n    }\n    \n    @Test\n    public void testDateWithZoneId() throws ParseException {\n        // Test for Yasson-172\n        final SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ssXXX\");\n        final Date parsedDate = sdf.parse(\"2018-11-02T00:00:00+01:00\");\n    \t\n    \tString jsonDateWithZone = \"{\\\"dateWithZone\\\":\\\"2018-11-02T00:00:00+01:00[Europe/Berlin]\\\"}\";\n    \tfinal DateWithZonePojo result = bindingJsonb.fromJson(jsonDateWithZone, DateWithZonePojo.class);\n    \t\n    \tassertEquals(parsedDate, result.dateWithZone);\n    }\n    \n    @Test\n    public void testCalendar() {\n        final Calendar timeCalendar = new Calendar.Builder()\n                .setDate(2015, Calendar.APRIL, 3)\n                .setTimeOfDay(11, 11, 10)\n                .setTimeZone(TimeZone.getTimeZone(\"Europe/Prague\"))\n                .build();\n\n        final CalendarPojo calendarPojo = new CalendarPojo();\n        calendarPojo.customCalendar = timeCalendar;\n        calendarPojo.defaultFormatted = timeCalendar;\n        calendarPojo.millisFormatted = timeCalendar;\n\n        // marshal to ISO_DATE\n        final String expected = \"{\\\"defaultFormatted\\\":\\\"2015-04-03T11:11:10+02:00[Europe/Prague]\\\",\" +\n                \"\\\"millisFormatted\\\":1428052270000,\" +\n                \"\\\"customCalendar\\\":\\\"11:11:10 | 03-04-2015, +0200\\\"}\";\n        assertEquals(expected, bindingJsonb.toJson(calendarPojo));\n\n        // marshal to ISO_DATE_TIME\n        final CalendarPojo result = bindingJsonb.fromJson(expected, CalendarPojo.class);\n        assertEquals(timeCalendar.getTime(), result.customCalendar.getTime());\n        assertEquals(timeCalendar.getTime(), result.millisFormatted.getTime());\n        assertEquals(timeCalendar.getTime(), result.defaultFormatted.getTime());\n    }\n\n    @Test\n    public void testCalendarWithoutTime() {\n        ScalarValueWrapper<Calendar> result = bindingJsonb.fromJson(\"{\\\"value\\\":\\\"2015-04-03+01:00\\\"}\", new TestTypeToken<ScalarValueWrapper<Calendar>>(){}.getType());\n        assertEquals(2015, result.getValue().get(Calendar.YEAR));\n        assertEquals(3, result.getValue().get(Calendar.MONTH));\n        assertEquals(3, result.getValue().get(Calendar.DAY_OF_MONTH));\n        assertEquals(0, result.getValue().get(Calendar.HOUR_OF_DAY));\n        assertEquals(0, result.getValue().get(Calendar.MINUTE));\n        assertEquals(0, result.getValue().get(Calendar.SECOND));\n        assertEquals(\"GMT+01:00\", result.getValue().getTimeZone().toZoneId().toString());\n    }\n\n    @Test\n    public void testCalendarWithNonDefaultTimeZone() {\n        final ZoneId zoneId = ZoneId.of(\"Europe/Prague\");\n        final Calendar cal = new Calendar.Builder()\n                .setDate(2015, Calendar.APRIL, 3)\n                .setTimeOfDay(10, 10, 10)\n                .setTimeZone(TimeZone.getTimeZone(zoneId))\n                .build();\n\n        final CalendarPojo calendarPojo = new CalendarPojo();\n        calendarPojo.customCalendar = cal;\n        calendarPojo.defaultFormatted = cal;\n        calendarPojo.millisFormatted = cal;\n\n        // marshal to ISO_DATE\n        final String expected = \"{\\\"defaultFormatted\\\":\\\"2015-04-03T10:10:10+02:00[\" + zoneId + \"]\\\",\" +\n                \"\\\"millisFormatted\\\":\" + cal.getTimeInMillis() + \",\" +\n                \"\\\"customCalendar\\\":\\\"10:10:10 | 03-04-2015, +0200\\\"}\";\n        assertEquals(expected, bindingJsonb.toJson(calendarPojo));\n\n        // marshal to ISO_DATE_TIME\n        final CalendarPojo result = bindingJsonb.fromJson(expected, CalendarPojo.class);\n        assertEquals(cal.getTime(), result.customCalendar.getTime());\n        assertEquals(cal.getTime(), result.millisFormatted.getTime());\n        assertEquals(cal.getTime(), result.defaultFormatted.getTime());\n    }\n\n    @Test\n    public void testMarshalGregorianCalendar() {\n        final Calendar cal = GregorianCalendar.getInstance();\n        cal.clear();\n        cal.set(2015, Calendar.APRIL, 3);\n        cal.setTimeZone(TimeZone.getTimeZone(\"UTC\"));\n\n        // marshal to ISO_DATE\n        assertEquals(\"{\\\"value\\\":\\\"2015-04-03Z\\\"}\", bindingJsonb.toJson(new ScalarValueWrapper<>(cal)));\n\n        // marshal to ISO_DATE_TIME\n        final Calendar dateTimeGregorianCalendar = new Calendar.Builder().setDate(2015, 3, 3)\n                .setTimeZone(TimeZone.getTimeZone(\"Europe/Prague\"))\n                .build();\n        assertEquals(\"{\\\"value\\\":\\\"2015-04-03T00:00:00+02:00[Europe/Prague]\\\"}\", bindingJsonb.toJson(new ScalarValueWrapper<>(dateTimeGregorianCalendar)));\n    }\n\n    @Test\n    public void testMarshalTimeZone() {\n        assertEquals(\"{\\\"value\\\":\\\"Europe/Prague\\\"}\", bindingJsonb.toJson(new ScalarValueWrapper<>(TimeZone.getTimeZone(\"Europe/Prague\"))));\n        assertEquals(\"{\\\"value\\\":\\\"Europe/Prague\\\"}\", bindingJsonb.toJson(new ScalarValueWrapper<>(SimpleTimeZone.getTimeZone(\"Europe/Prague\"))));\n    }\n\n    @Test\n    public void testMarshalInstant() {\n        final Instant instant = Instant.parse(\"2015-03-03T23:00:00Z\");\n        InstantPojo instantPojo = new InstantPojo(instant);\n\n        final String expected = \"{\\\"defaultFormatted\\\":\\\"2015-03-03T23:00:00Z\\\",\" +\n                \"\\\"millisFormatted\\\":1425423600000,\" +\n                \"\\\"instant\\\":\\\"23:00:00 | 03-03-2015\\\"}\";\n        assertEquals(expected, bindingJsonb.toJson(instantPojo));\n\n        InstantPojo result = bindingJsonb.fromJson(expected, InstantPojo.class);\n        assertEquals(instant, result.defaultFormatted);\n        assertEquals(instant, result.millisFormatted);\n        assertEquals(instant, result.instant);\n    }\n\n    @Test\n    public void testDateFormattedAsMillisInString() {\n        Jsonb jsonb = JsonbBuilder.create(new YassonConfig().withTimeInMillisAsAString(true));\n        final Instant instant = Instant.parse(\"2015-03-03T23:00:00Z\");\n        InstantPojo instantPojo = new InstantPojo(instant);\n\n        final String expected = \"{\\\"defaultFormatted\\\":\\\"2015-03-03T23:00:00Z\\\",\" +\n                \"\\\"millisFormatted\\\":\\\"1425423600000\\\",\" +\n                \"\\\"instant\\\":\\\"23:00:00 | 03-03-2015\\\"}\";\n        assertEquals(expected, jsonb.toJson(instantPojo));\n\n        InstantPojo result = jsonb.fromJson(expected, InstantPojo.class);\n        assertEquals(instant, result.defaultFormatted);\n        assertEquals(instant, result.millisFormatted);\n        assertEquals(instant, result.instant);\n    }\n\n    @Test\n    public void testMarshalDuration() {\n        assertEquals(\"{\\\"value\\\":\\\"PT5H4M\\\"}\", bindingJsonb.toJson(new ScalarValueWrapper<>(Duration.ofHours(5).plusMinutes(4))));\n    }\n\n    @Test\n    public void testMarshalPeriod() {\n        final Period period = Period.between(LocalDate.of(1960, Month.JANUARY, 1), LocalDate.of(1970, Month.JANUARY, 1));\n        final ScalarValueWrapper<Period> value = new ScalarValueWrapper<>(period);\n        assertEquals(\"{\\\"value\\\":\\\"P10Y\\\"}\", bindingJsonb.toJson(value));\n    }\n\n    @Test\n    public void testLocalDate() {\n        final LocalDate localDate = LocalDate.of(2015, Month.APRIL, 10);\n        final LocalDatePojo pojo = new LocalDatePojo(localDate);\n\n        // Get proper milliseconds\n        final long millis = localDate.atStartOfDay(ZoneId.of(\"Z\")).toInstant().toEpochMilli();\n\n        final String expected = \"{\\\"defaultFormatted\\\":\\\"2015-04-10\\\",\" +\n                \"\\\"millisFormatted\\\":\" + millis + \",\" +\n                \"\\\"customLocalDate\\\":\\\"10-04-2015\\\"}\";\n        assertEquals(expected, bindingJsonb.toJson(pojo));\n\n        final LocalDatePojo result = bindingJsonb.fromJson(expected, LocalDatePojo.class);\n        assertEquals(localDate, result.customLocalDate);\n        assertEquals(localDate, result.millisFormatted);\n        assertEquals(localDate, result.defaultFormatted);\n    }\n\n    @Test\n    public void testlLocalTime() {\n        final Jsonb jsonb = getJsonbWithMillisIgnored();\n        final LocalTime localTime = LocalTime.of(22, 33);\n        final LocalTimePojo localTimePojo = new LocalTimePojo(localTime);\n        final String expected = \"{\\\"defaultFormatted\\\":\\\"22:33:00\\\",\\\"localTime\\\":\\\"22:33:00\\\"}\";\n        assertEquals(expected, jsonb.toJson(localTimePojo));\n\n        final LocalTimePojo result = jsonb.fromJson(expected, LocalTimePojo.class);\n        assertEquals(localTime, result.defaultFormatted);\n        assertEquals(localTime, result.localTime);\n    }\n\n    private Jsonb getJsonbWithMillisIgnored() {\n        final JsonbConfig config = new JsonbConfig();\n        config.withPropertyVisibilityStrategy(new PropertyVisibilityStrategy() {\n            @Override\n            public boolean isVisible(Field field) {\n                return !field.getName().startsWith(\"millis\");\n            }\n\n            @Override\n            public boolean isVisible(Method method) {\n                return false;\n            }\n        });\n        return JsonbBuilder.create(config);\n    }\n\n    @Test\n    public void testLocalDateTime() {\n        final LocalDateTime dateTime = LocalDateTime.of(2015, 2, 16, 13, 21);\n        final LocalDateTimePojo pojo = new LocalDateTimePojo(dateTime);\n\n        // Get proper milliseconds\n        final long millis = dateTime.atZone(ZoneId.of(\"Z\")).toInstant().toEpochMilli();\n\n        final String expected = \"{\\\"defaultFormatted\\\":\\\"2015-02-16T13:21:00\\\",\" +\n                \"\\\"millisFormatted\\\":\" + millis + \",\" +\n                \"\\\"customLocalDate\\\":\\\"16-02-2015--00:21:13\\\"}\";\n        assertEquals(expected, bindingJsonb.toJson(pojo));\n\n        final LocalDateTimePojo result = bindingJsonb.fromJson(expected, LocalDateTimePojo.class);\n        assertEquals(dateTime, result.defaultFormatted);\n        assertEquals(dateTime, result.millisFormatted);\n        assertEquals(dateTime, result.customLocalDate);\n    }\n\n    @Test\n    public void testLocalDateTimeWithoutConfig() {\n        final LocalDateTime dateTime = LocalDateTime.of(2015, 2, 16, 13, 21);\n        final ScalarValueWrapper<LocalDateTime> pojo = new ScalarValueWrapper<>();\n        pojo.setValue(dateTime);\n\n        final String expected = \"{\\\"value\\\":\\\"2015-02-16T13:21:00\\\"}\";\n        assertEquals(expected, bindingJsonb.toJson(pojo));\n\n        final ScalarValueWrapper<LocalDateTime> result = bindingJsonb.fromJson(expected, new TestTypeToken<ScalarValueWrapper<LocalDateTime>>(){}.getType());\n        assertEquals(dateTime, result.getValue());\n    }\n\n    @Test\n    public void testDifferentConfigsLocalDateTime() {\n        final LocalDateTime dateTime = LocalDateTime.of(2015, 2, 16, 13, 21);\n        final long millis = dateTime.atZone(ZoneId.of(\"Z\")).toInstant().toEpochMilli();\n        final ScalarValueWrapper<LocalDateTime> pojo = new ScalarValueWrapper<>();\n        pojo.setValue(dateTime);\n\n        final String expected = \"{\\\"value\\\":\\\"2015-02-16T13:21:00\\\"}\";\n        assertEquals(expected, bindingJsonb.toJson(pojo));\n\n        final Jsonb jsonbCustom = JsonbBuilder.create(new JsonbConfig().withDateFormat(JsonbDateFormat.TIME_IN_MILLIS, Locale.FRENCH));\n        assertEquals(\"{\\\"value\\\":\" + millis + \"}\", jsonbCustom.toJson(pojo));\n\n        ScalarValueWrapper<LocalDateTime> result = bindingJsonb.fromJson(expected, new TestTypeToken<ScalarValueWrapper<LocalDateTime>>(){}.getType());\n        assertEquals(dateTime, result.getValue());\n\n        result = jsonbCustom.fromJson(\"{\\\"value\\\":\\\"\" + millis + \"\\\"}\", new TestTypeToken<ScalarValueWrapper<LocalDateTime>>(){}.getType());\n        assertEquals(dateTime, result.getValue());\n    }\n\n    @Test\n    public void testZonedDateTime() {\n        final ZoneId zone = ZoneId.of(\"Asia/Almaty\");\n        final ZonedDateTime dateTime = ZonedDateTime.of(2015, 2, 16, 13, 21, 0, 0, zone);\n        final ZonedDateTimePojo pojo = new ZonedDateTimePojo(dateTime);\n\n        final String expected = \"{\\\"defaultFormatted\\\":\\\"2015-02-16T13:21:00+06:00[\" + zone + \"]\\\",\" +\n                \"\\\"millisFormatted\\\":\" + dateTime.toInstant().toEpochMilli() + \",\" +\n                \"\\\"customZonedDate\\\":\\\"+06\" + zone + \" | 16-02-2015--00:21:13\\\"}\";\n        assertEquals(expected, bindingJsonb.toJson(pojo));\n\n        final ZonedDateTimePojo result = bindingJsonb.fromJson(expected, ZonedDateTimePojo.class);\n        assertEquals(dateTime, result.defaultFormatted);\n        assertEquals(dateTime, result.customZonedDate);\n\n        // time zone and seconds omitted\n        final ZonedDateTimePojo result1 = bindingJsonb.fromJson(\"{\\\"defaultFormatted\\\":\\\"2015-02-16T13:21+06:00\\\"}\", ZonedDateTimePojo.class);\n        assertEquals(dateTime.getHour(), result1.defaultFormatted.getHour());\n        assertEquals(dateTime.getOffset(), result1.defaultFormatted.getOffset());\n    }\n\n    @Test\n    public void testMarshalZoneId() {\n        assertEquals(\"{\\\"value\\\":\\\"Europe/Prague\\\"}\", bindingJsonb.toJson(new ScalarValueWrapper<>(ZoneId.of(\"Europe/Prague\"))));\n    }\n\n    @Test\n    public void testMarshalZoneOffset() {\n        assertEquals(\"{\\\"value\\\":\\\"+02:00\\\"}\", bindingJsonb.toJson(new ScalarValueWrapper<>(ZoneOffset.of(\"+02:00\"))));\n    }\n\n    @Test\n    public void testMarshalOffsetDateTime() {\n        final OffsetDateTime dateTime = OffsetDateTime.of(2015, 2, 16, 13, 21, 0, 0, ZoneOffset.of(\"+05:00\"));\n        final OffsetDateTimePojo pojo = new OffsetDateTimePojo(dateTime);\n\n        final String expected = \"{\\\"defaultFormatted\\\":\\\"2015-02-16T13:21:00+05:00\\\",\" +\n                \"\\\"millisFormatted\\\":1424074860000,\" +\n                \"\\\"offsetDateTime\\\":\\\"+0500 16-02-2015--00:21:13\\\"}\";\n        assertEquals(expected, bindingJsonb.toJson(pojo));\n\n        final OffsetDateTimePojo result = bindingJsonb.fromJson(expected, OffsetDateTimePojo.class);\n        assertEquals(dateTime, result.defaultFormatted);\n        assertEquals(dateTime, result.offsetDateTime);\n    }\n\n    @Test\n    public void testMarshalOffsetTime() {\n        final Jsonb jsonb = getJsonbWithMillisIgnored();\n        final OffsetTime dateTime = OffsetTime.of(13, 21, 15, 0, ZoneOffset.of(\"+05:00\"));\n        final OffsetTimePojo pojo = new OffsetTimePojo(dateTime);\n\n        final String expected = \"{\\\"defaultFormatted\\\":\\\"13:21:15+05:00\\\",\\\"offsetTime\\\":\\\"13:21:15+0500\\\"}\";\n        assertEquals(expected, jsonb.toJson(pojo));\n\n        final OffsetTimePojo result = jsonb.fromJson(expected, OffsetTimePojo.class);\n        assertEquals(dateTime, result.defaultFormatted);\n        assertEquals(dateTime, result.offsetTime);\n    }\n\n    @Test\n    public void testClassLevel() throws ParseException {\n        final ClassLevelDateAnnotation pojo = new ClassLevelDateAnnotation();\n        final SimpleDateFormat sdf = new SimpleDateFormat(\"dd.MM.yyyy\");\n        sdf.setTimeZone(TimeZone.getTimeZone(\"UTC\"));\n        pojo.date = sdf.parse(\"04.03.2015\");\n\n        final ZoneId zone = ZoneId.of(\"Asia/Almaty\");\n        pojo.calendar = new Calendar.Builder().setDate(2015, Calendar.APRIL, 3).setTimeOfDay(11, 11, 10).setTimeZone(TimeZone.getTimeZone(zone)).build();\n        pojo.zonedDateTime = ZonedDateTime.of(2015, 4, 3, 13, 21, 0, 0, zone);\n        pojo.defaultZoned = pojo.zonedDateTime;\n        pojo.localDateTime  = LocalDateTime.of(2015, 4, 3, 13, 21, 0, 0);\n\n        final String expected = \"{\\\"date\\\":\\\"04-03-2015 00:00:00\\\",\" +\n                \"\\\"localDateTime\\\":\\\"03-04-2015 13:21:00\\\",\" +\n                \"\\\"calendar\\\":\\\"+06 ALMT ven. avril 03-04-2015 11:11:10\\\",\" +\n                \"\\\"defaultZoned\\\":\\\"2015-04-03T13:21:00+06:00[Asia/Almaty]\\\",\" +\n                \"\\\"zonedDateTime\\\":\\\"+06 ALMT ven. avril 03-04-2015 13:21:00\\\"}\";\n        assertEquals(expected, bindingJsonb.toJson(pojo));\n\n        final ClassLevelDateAnnotation result = bindingJsonb.fromJson(expected, ClassLevelDateAnnotation.class);\n        assertEquals(pojo.date, result.date);\n        assertEquals(pojo.localDateTime, result.localDateTime);\n        assertEquals(pojo.calendar.getTime(), result.calendar.getTime());\n        assertEquals(pojo.zonedDateTime, result.zonedDateTime);\n    }\n\n    @Test\n    public void testGlobalConfigDateFormat() {\n        final JsonbConfig config = new JsonbConfig();\n        config.withDateFormat(\"X z E MMMM dd-MM-yyyy HH:mm:ss\", Locale.FRENCH);\n\n        final Jsonb jsonb = JsonbBuilder.create(config);\n\n        final ZonedDateTime dateTime = ZonedDateTime.of(2015, 4, 3, 13, 21, 0, 0, ZoneId.of(\"Asia/Almaty\"));\n        final String expected = \"{\\\"value\\\":\\\"+06 ALMT ven. avril 03-04-2015 13:21:00\\\"}\";\n        assertEquals(expected, jsonb.toJson(new ScalarValueWrapper<>(dateTime)));\n\n        final ScalarValueWrapper<ZonedDateTime> result = jsonb.fromJson(expected, new TestTypeToken<ScalarValueWrapper<ZonedDateTime>>(){}.getType());\n        assertEquals(dateTime, result.getValue());\n    }\n\n    @Test\n    public void testDateFrenchLocale() {\n        String format = \"E DD MMM yyyy HH:mm:ss z\";\n        Locale locale = Locale.forLanguageTag(\"fr-FR\");\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withDateFormat(format, locale));\n\n        final ScalarValueWrapper<Date> result = jsonb.fromJson(\"{ \\\"value\\\" : \\\"lun. 93 avr. 2017 16:51:12 CEST\\\" }\", new TestTypeToken<ScalarValueWrapper<Date>>(){}.getType());\n\n        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);\n        final Instant instant = Instant.from(formatter.withLocale(locale).parse(\"lun. 93 avr. 2017 16:51:12 CEST\"));\n        assertEquals(instant, result.getValue().toInstant());\n    }\n\n    @Test\n    public void testSimpleTimeZone() {\n        String json = bindingJsonb.toJson(new ScalarValueWrapper<>(new SimpleTimeZone(0, \"America/Los_Angeles\")));\n        assertEquals(\"{\\\"value\\\":\\\"America/Los_Angeles\\\"}\", json);\n\n        ScalarValueWrapper<TimeZone> result = bindingJsonb.fromJson(json, new TestTypeToken<ScalarValueWrapper<TimeZone>>() {\n        }.getType());\n        assertEquals(\"America/Los_Angeles\", result.getValue().getID());\n        assertEquals(LocalDateTime.now().atZone(ZoneId.of(\"America/Los_Angeles\")).getOffset().getTotalSeconds() * 1000,\n                result.getValue().getOffset(System.currentTimeMillis()));\n    }\n\n    @Test\n    public void testDateInMap() {\n\n        JsonbConfig config = new JsonbConfig()\n                .withDateFormat(\"yyyy\", Locale.ENGLISH);\n\n        Jsonb jsonb = JsonbBuilder.create(config);\n        LocalDate localDate = LocalDate.of(2017, 9, 14);\n\n        DateInMapPojo pojo = new DateInMapPojo();\n        pojo.setLocalDate(localDate);\n        pojo.setDateMap(new HashMap<>());\n        pojo.getDateMap().put(\"first\", localDate);\n\n        String json = jsonb.toJson(pojo);\n\n        assertEquals(\"{\\\"dateMap\\\":{\\\"first\\\":\\\"2017\\\"},\\\"localDate\\\":\\\"2017\\\"}\", json);\n\n        config = new JsonbConfig()\n                .withDateFormat(\"dd.MM.yyyy\", Locale.ENGLISH);\n        jsonb = JsonbBuilder.create(config);\n        DateInMapPojo result = jsonb.fromJson(\"{\\\"dateMap\\\":{\\\"first\\\":\\\"01.01.2017\\\"},\\\"localDate\\\":\\\"01.01.2017\\\"}\", DateInMapPojo.class);\n        assertEquals(LocalDate.of(2017,1,1), result.localDate);\n        assertEquals(LocalDate.of(2017,1,1), result.dateMap.get(\"first\"));\n    }\n\n    @Test\n    public void testYearMonth() {\n        YearMonthPojo yearMonthPojo = new YearMonthPojo();\n        yearMonthPojo.yearMonth = YearMonth.of(2019, Month.MAY);\n        yearMonthPojo.yearMonthWithFormatter = YearMonth.of(2019, Month.MAY);\n\n        String expected = \"{\\\"yearMonth\\\":\\\"2019-05\\\",\\\"yearMonthWithFormatter\\\":\\\"05-2019\\\"}\";\n        String serialized = bindingJsonb.toJson(yearMonthPojo);\n        assertEquals(expected, serialized);\n\n        YearMonthPojo deserialized = bindingJsonb.fromJson(expected, YearMonthPojo.class);\n        assertEquals(yearMonthPojo, deserialized);\n    }\n\n    @Test\n    public void testMonthDay() {\n        MonthDayPojo monthDay = new MonthDayPojo();\n        monthDay.monthDay = MonthDay.of(Month.MAY, 2);\n        monthDay.monthDayWithFormatter = MonthDay.of(Month.MAY, 2);\n\n        String expected = \"{\\\"monthDay\\\":\\\"--05-02\\\",\\\"monthDayWithFormatter\\\":\\\"02-05\\\"}\";\n        String serialized = bindingJsonb.toJson(monthDay);\n        assertEquals(expected, serialized);\n\n        MonthDayPojo deserialized = bindingJsonb.fromJson(expected, MonthDayPojo.class);\n        assertEquals(monthDay, deserialized);\n    }\n\n    @Test\n    public void testXMLGregorianCalendar() throws DatatypeConfigurationException {\n        final Calendar calendar = new Calendar.Builder()\n                .setDate(2015, Calendar.APRIL, 3)\n                .setTimeOfDay(11, 11, 10)\n                .setTimeZone(TimeZone.getTimeZone(\"Europe/Prague\"))\n                .build();\n\n        final XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory.newInstance()\n                .newXMLGregorianCalendar((GregorianCalendar) calendar);\n\n        String serialized = bindingJsonb.toJson(xmlGregorianCalendar);\n\n        assertEquals(\"\\\"2015-04-03T11:11:10+02:00[GMT+02:00]\\\"\", serialized);\n        assertEquals(xmlGregorianCalendar, bindingJsonb.fromJson(serialized, XMLGregorianCalendar.class));\n    }\n\n\n    public static class DateInMapPojo {\n        private LocalDate localDate;\n        private Map<String, LocalDate> dateMap;\n\n        public LocalDate getLocalDate() {\n            return localDate;\n        }\n\n        public void setLocalDate(LocalDate localDate) {\n            this.localDate = localDate;\n        }\n\n        public Map<String, LocalDate> getDateMap() {\n            return dateMap;\n        }\n\n        public void setDateMap(Map<String, LocalDate> dateMap) {\n            this.dateMap = dateMap;\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/model/AbstractDateTimePojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\n\n/**\n * Common parent class for testing date objects.\n * Contains {@link JsonbDateFormat} DEFAULT_FORMAT and TIME_IN_MILLIS annotated date objects.\n *\n * @author Roman Grigoriadi\n */\npublic class AbstractDateTimePojo<T> {\n\n    public AbstractDateTimePojo() {\n    }\n\n    public AbstractDateTimePojo(T dateObj) {\n        this.defaultFormatted = dateObj;\n        this.millisFormatted = dateObj;\n    }\n\n    @JsonbDateFormat(JsonbDateFormat.DEFAULT_FORMAT)\n    public T defaultFormatted;\n\n    @JsonbDateFormat(JsonbDateFormat.TIME_IN_MILLIS)\n    public T millisFormatted;\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/model/CalendarPojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport java.util.Calendar;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class CalendarPojo extends AbstractDateTimePojo<Calendar> {\n\n    public CalendarPojo() {\n    }\n\n    public CalendarPojo(Calendar dateObj) {\n        super(dateObj);\n        this.customCalendar = dateObj;\n    }\n\n    @JsonbDateFormat(\"HH:mm:ss | dd-MM-yyyy, Z\")\n    public Calendar customCalendar;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/model/ClassLevelDateAnnotation.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport java.time.ZonedDateTime;\nimport java.util.Calendar;\n\n/**\n * @author Roman Grigoriadi\n */\n@JsonbDateFormat(value = \"X z E MMMM dd-MM-yyyy HH:mm:ss\", locale = \"fr\")\npublic class ClassLevelDateAnnotation extends ClassLevelDateAnnotationParent {\n\n    public ZonedDateTime zonedDateTime;\n\n    public Calendar calendar;\n\n    @JsonbDateFormat(value = JsonbDateFormat.DEFAULT_FORMAT)\n    public ZonedDateTime defaultZoned;\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/model/ClassLevelDateAnnotationParent.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport java.time.LocalDateTime;\nimport java.util.Date;\n\n/**\n * @author Roman Grigoriadi\n */\n@JsonbDateFormat(\"dd-MM-yyyy HH:mm:ss\")\npublic class ClassLevelDateAnnotationParent {\n\n    public Date date;\n\n    public LocalDateTime localDateTime;\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/model/CollectionDatePojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport java.util.Date;\nimport java.util.List;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class CollectionDatePojo {\n\n    @JsonbDateFormat(\"HH:mm:ss | dd-MM-yyyy\")\n    public List<Date> dates;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/model/DatePojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport java.util.Date;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class DatePojo extends AbstractDateTimePojo<Date> {\n\n    public DatePojo() {\n    }\n\n    public DatePojo(Date dateObj) {\n        super(dateObj);\n        this.customDate = dateObj;\n    }\n\n    @JsonbDateFormat(\"HH:mm:ss | dd-MM-yyyy\")\n    public Date customDate;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/model/DateWithZonePojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates.model;\n\nimport java.util.Date;\n\n/**\n * @author Dennis Kriechel\n */\npublic class DateWithZonePojo extends AbstractDateTimePojo<Date> {\n\n    public DateWithZonePojo() {\n    }\n\n    public DateWithZonePojo(Date dateObj) {\n        super(dateObj);\n        this.dateWithZone = dateObj;\n    }\n\n    public Date dateWithZone;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/model/InstantPojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport java.time.Instant;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class InstantPojo extends AbstractDateTimePojo<Instant> {\n\n    public InstantPojo() {\n    }\n\n    public InstantPojo(Instant dateObj) {\n        super(dateObj);\n        this.instant = dateObj;\n    }\n\n    @JsonbDateFormat(\"HH:mm:ss | dd-MM-yyyy\")\n    public Instant instant;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/model/LocalDatePojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport java.time.LocalDate;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class LocalDatePojo extends AbstractDateTimePojo<LocalDate> {\n\n    public LocalDatePojo() {\n    }\n\n    public LocalDatePojo(LocalDate date) {\n        super(date);\n        this.customLocalDate = date;\n    }\n\n    @JsonbDateFormat(\"dd-MM-yyyy\")\n    public LocalDate customLocalDate;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/model/LocalDateTimePojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport java.time.LocalDateTime;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class LocalDateTimePojo extends AbstractDateTimePojo<LocalDateTime> {\n\n    public LocalDateTimePojo() {\n    }\n\n    public LocalDateTimePojo(LocalDateTime date) {\n        super(date);\n        this.customLocalDate = date;\n    }\n\n    @JsonbDateFormat(\"dd-MM-yyyy--ss:mm:HH\")\n    public LocalDateTime customLocalDate;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/model/LocalTimePojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport java.time.LocalTime;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class LocalTimePojo extends AbstractDateTimePojo<LocalTime> {\n\n    public LocalTimePojo() {\n    }\n\n    public LocalTimePojo(LocalTime date) {\n        super(date);\n        this.localTime = date;\n    }\n\n    @JsonbDateFormat(\"HH:mm:ss\")\n    public LocalTime localTime;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/model/MonthDayPojo.java",
    "content": "/*\n * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates.model;\n\nimport java.time.MonthDay;\nimport java.util.Objects;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\n\n/**\n * Pojo object of the {@link MonthDay}.\n */\npublic class MonthDayPojo {\n\n    public MonthDay monthDay;\n\n    @JsonbDateFormat(\"dd-MM\")\n    public MonthDay monthDayWithFormatter;\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        MonthDayPojo that = (MonthDayPojo) o;\n        return Objects.equals(monthDay, that.monthDay) && Objects\n                .equals(monthDayWithFormatter, that.monthDayWithFormatter);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(monthDay, monthDayWithFormatter);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/model/OffsetDateTimePojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport java.time.OffsetDateTime;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class OffsetDateTimePojo extends AbstractDateTimePojo<OffsetDateTime> {\n\n    public OffsetDateTimePojo() {\n    }\n\n    public OffsetDateTimePojo(OffsetDateTime date) {\n        super(date);\n        this.offsetDateTime = date;\n    }\n\n    @JsonbDateFormat(\"Z dd-MM-yyyy--ss:mm:HH\")\n    public OffsetDateTime offsetDateTime;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/model/OffsetTimePojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport java.time.OffsetTime;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class OffsetTimePojo extends AbstractDateTimePojo<OffsetTime> {\n\n    public OffsetTimePojo() {\n    }\n\n    public OffsetTimePojo(OffsetTime date) {\n        super(date);\n        this.offsetTime = date;\n    }\n\n    @JsonbDateFormat(\"HH:mm:ssZ\")\n    public OffsetTime offsetTime;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/model/YearMonthPojo.java",
    "content": "/*\n * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates.model;\n\nimport java.time.YearMonth;\nimport java.util.Objects;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\n\n/**\n * Pojo object of the {@link YearMonth}.\n */\npublic class YearMonthPojo {\n\n    public YearMonth yearMonth;\n\n    @JsonbDateFormat(\"MM-yyyy\")\n    public YearMonth yearMonthWithFormatter;\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        YearMonthPojo that = (YearMonthPojo) o;\n        return Objects.equals(yearMonth, that.yearMonth) && Objects\n                .equals(yearMonthWithFormatter, that.yearMonthWithFormatter);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(yearMonth, yearMonthWithFormatter);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/dates/model/ZonedDateTimePojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.dates.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport java.time.ZonedDateTime;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class ZonedDateTimePojo extends AbstractDateTimePojo<ZonedDateTime> {\n\n    public ZonedDateTimePojo() {\n    }\n\n    public ZonedDateTimePojo(ZonedDateTime date) {\n        super(date);\n        this.customZonedDate = date;\n    }\n\n    @JsonbDateFormat(\"XVV | dd-MM-yyyy--ss:mm:HH\")\n    public ZonedDateTime customZonedDate;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/GenericsTest.java",
    "content": "/*\n * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics;\n\nimport static org.eclipse.yasson.Jsonbs.defaultJsonb;\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.assertThrows;\nimport static org.junit.jupiter.api.Assertions.assertTrue;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Type;\nimport java.math.BigDecimal;\nimport java.text.ParseException;\nimport java.text.SimpleDateFormat;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.TimeZone;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport org.eclipse.yasson.TestTypeToken;\nimport org.eclipse.yasson.adapters.model.GenericBox;\nimport org.eclipse.yasson.defaultmapping.generics.model.AnotherGenericTestClass;\nimport org.eclipse.yasson.defaultmapping.generics.model.BoundedGenericClass;\nimport org.eclipse.yasson.defaultmapping.generics.model.Circle;\nimport org.eclipse.yasson.defaultmapping.generics.model.CollectionContainer;\nimport org.eclipse.yasson.defaultmapping.generics.model.CollectionElement;\nimport org.eclipse.yasson.defaultmapping.generics.model.CollectionWrapper;\nimport org.eclipse.yasson.defaultmapping.generics.model.ColoredCircle;\nimport org.eclipse.yasson.defaultmapping.generics.model.ConstructorContainer;\nimport org.eclipse.yasson.defaultmapping.generics.model.CyclicSubClass;\nimport org.eclipse.yasson.defaultmapping.generics.model.FinalGenericWrapper;\nimport org.eclipse.yasson.defaultmapping.generics.model.FinalMember;\nimport org.eclipse.yasson.defaultmapping.generics.model.GenericArrayClass;\nimport org.eclipse.yasson.defaultmapping.generics.model.GenericTestClass;\nimport org.eclipse.yasson.defaultmapping.generics.model.GenericWithUnboundedWildcardClass;\nimport org.eclipse.yasson.defaultmapping.generics.model.LowerBoundTypeVariableWithCollectionAttributeClass;\nimport org.eclipse.yasson.defaultmapping.generics.model.MultiLevelExtendedGenericTestClass;\nimport org.eclipse.yasson.defaultmapping.generics.model.MultipleBoundsContainer;\nimport org.eclipse.yasson.defaultmapping.generics.model.MyCyclicGenericClass;\nimport org.eclipse.yasson.defaultmapping.generics.model.PropagatedGenericClass;\nimport org.eclipse.yasson.defaultmapping.generics.model.Shape;\nimport org.eclipse.yasson.defaultmapping.generics.model.StaticCreatorContainer;\nimport org.eclipse.yasson.defaultmapping.generics.model.TreeContainer;\nimport org.eclipse.yasson.defaultmapping.generics.model.TreeElement;\nimport org.eclipse.yasson.defaultmapping.generics.model.WildCardClass;\nimport org.eclipse.yasson.defaultmapping.generics.model.WildcardMultipleBoundsClass;\nimport org.eclipse.yasson.serializers.model.Box;\nimport org.eclipse.yasson.serializers.model.Crate;\nimport org.junit.jupiter.api.Test;\n\n/**\n * This class contains JSONB default mapping generics tests.\n *\n * @author Dmitry Kornilov\n */\npublic class GenericsTest {\n\n    @Test\n    public void testGenericClass() {\n        GenericTestClass<String, Integer> genericClass = new GenericTestClass<>();\n        genericClass.field1 = \"value1\";\n        genericClass.field2 = 3;\n\n        String expected = \"{\\\"field1\\\":\\\"value1\\\",\\\"field2\\\":3}\";\n        assertEquals(expected, defaultJsonb.toJson(genericClass));\n\n        Type type = new TestTypeToken<GenericTestClass<String, Integer>>(){}.getType();\n        GenericTestClass<String, Integer> result = defaultJsonb.fromJson(expected, type);\n        assertEquals(\"value1\", result.field1);\n        assertEquals(Integer.valueOf(3), result.field2);\n    }\n\n    @Test\n    public void testMultiLevelGenericClass() {\n\n        GenericTestClass<String, Integer> innerMostGenericClass = new GenericTestClass<>();\n        innerMostGenericClass.field1 = \"innerMostValue3\";\n        innerMostGenericClass.field2 = 3;\n\n        AnotherGenericTestClass<GenericTestClass<String, Integer>, Integer> another = new AnotherGenericTestClass<>();\n        another.field1 = innerMostGenericClass;\n        another.field2 = 2;\n\n        GenericTestClass<String, AnotherGenericTestClass<GenericTestClass<String, Integer>, Integer>> nestedGenericField = new GenericTestClass<>();\n        nestedGenericField.field1 = \"outerValue1\";\n        nestedGenericField.field2 = another;\n\n        String expected = \"{\\\"field1\\\":\\\"outerValue1\\\",\\\"field2\\\":{\\\"field1\\\":{\\\"field1\\\":\\\"innerMostValue3\\\",\\\"field2\\\":3},\\\"field2\\\":2}}\";\n        assertEquals(expected, defaultJsonb.toJson(nestedGenericField));\n\n        Type type = new TestTypeToken<GenericTestClass<String, AnotherGenericTestClass<GenericTestClass<String, Integer>, Integer>>>(){}.getType();\n        GenericTestClass<String, AnotherGenericTestClass<GenericTestClass<String, Integer>, Integer>> result = defaultJsonb.fromJson(expected, type);\n        assertEquals(\"outerValue1\", result.field1);\n        assertEquals(Integer.valueOf(2), result.field2.field2);\n        assertEquals(\"innerMostValue3\", result.field2.field1.field1);\n        assertEquals(Integer.valueOf(3), result.field2.field1.field2);\n    }\n\n    @Test\n    public void testNestedGenericSelfClass() {\n        GenericTestClass<String, Integer> inner = new GenericTestClass<>();\n        inner.field1 = \"innerValue1\";\n        inner.field2 = 5;\n\n        GenericTestClass<String, GenericTestClass<String, Integer>> nestedGenericOnSelfClass = new GenericTestClass<>();\n        nestedGenericOnSelfClass.field1 = \"outerValue1\";\n        nestedGenericOnSelfClass.field2 = inner;\n\n        String expected = \"{\\\"field1\\\":\\\"outerValue1\\\",\\\"field2\\\":{\\\"field1\\\":\\\"innerValue1\\\",\\\"field2\\\":5}}\";\n        assertEquals(expected, defaultJsonb.toJson(nestedGenericOnSelfClass));\n\n        Type type = new TestTypeToken<GenericTestClass<String, GenericTestClass<String, Integer>>>(){}.getType();\n        GenericTestClass<String, GenericTestClass<String, Integer>> result = defaultJsonb.fromJson(expected, type);\n        assertEquals(\"outerValue1\", result.field1);\n        assertEquals(\"innerValue1\", result.field2.field1);\n        assertEquals(Integer.valueOf(5), result.field2.field2);\n    }\n\n    @Test\n    public void testCyclicGenericClass() {\n\n        final MyCyclicGenericClass<CyclicSubClass> myCyclicGenericClass = new MyCyclicGenericClass<>();\n        final CyclicSubClass cyclicSubClass = new CyclicSubClass();\n        cyclicSubClass.subField = \"subFieldValue\";\n        myCyclicGenericClass.field1 = cyclicSubClass;\n\n        String expected = \"{\\\"field1\\\":{\\\"subField\\\":\\\"subFieldValue\\\"}}\";\n        assertEquals(expected, defaultJsonb.toJson(myCyclicGenericClass));\n        MyCyclicGenericClass<CyclicSubClass> result = defaultJsonb.fromJson(expected, new TestTypeToken<MyCyclicGenericClass<CyclicSubClass>>(){}.getType());\n        assertEquals(CyclicSubClass.class, result.field1.getClass());\n        assertEquals(\"subFieldValue\", result.field1.subField);\n    }\n\n    @Test\n    public void testWildCards() {\n\n        final WildCardClass<Integer> integerWildCard = new WildCardClass<>();\n\n        integerWildCard.number = 10;\n        String expected = \"{\\\"number\\\":10}\";\n        assertEquals(expected, defaultJsonb.toJson(integerWildCard));\n        WildCardClass<Integer> result = defaultJsonb.fromJson(expected, new TestTypeToken<WildCardClass<Integer>>(){}.getType());\n        assertEquals(Integer.valueOf(10), result.number);\n    }\n\n    @Test\n    public void testGenericWithUnboundedWildcard() {\n        //wildcardList is treated as List<Object>\n        String expected = \"{\\\"wildcardList\\\":[{\\\"k1\\\":\\\"v1\\\",\\\"k2\\\":\\\"v2\\\"}]}\";\n\n        GenericWithUnboundedWildcardClass genericWithUnboundedWildcardClass = new GenericWithUnboundedWildcardClass();\n        List<Map<String, String>> list = new ArrayList<>();\n        genericWithUnboundedWildcardClass.wildcardList = list;\n        Map<String, String> stringMap = new HashMap<>();\n        stringMap.put(\"k1\", \"v1\");\n        stringMap.put(\"k2\", \"v2\");\n        list.add(stringMap);\n        assertEquals(expected, defaultJsonb.toJson(genericWithUnboundedWildcardClass));\n\n        GenericWithUnboundedWildcardClass result = defaultJsonb.fromJson(expected, GenericWithUnboundedWildcardClass.class);\n        assertTrue(result.wildcardList.get(0) instanceof Map);\n        assertEquals(\"v1\", ((Map) result.wildcardList.get(0)).get(\"k1\"));\n        assertEquals(\"v2\", ((Map) result.wildcardList.get(0)).get(\"k2\"));\n    }\n\n    @Test\n    public void testWildCardMultipleBounds() {\n\n        WildcardMultipleBoundsClass<BigDecimal> multipleBoundsClass = new WildcardMultipleBoundsClass<>();\n        multipleBoundsClass.wildcardField = BigDecimal.ONE;\n\n        GenericTestClass<String, BigDecimal> genericTestClass = new GenericTestClass<>();\n        genericTestClass.field1 = \"genericTestClassField1\";\n        genericTestClass.field2 = BigDecimal.TEN;\n        multipleBoundsClass.genericTestClassPropagatedWildCard = genericTestClass;\n\n        List<ExtendsBigDecimal> extendsBigDecimalList = new ArrayList<>();\n        extendsBigDecimalList.add(new ExtendsBigDecimal(\"11\"));\n        multipleBoundsClass.propagatedWildcardList = extendsBigDecimalList;\n\n        String expected = \"{\\\"genericTestClassPropagatedWildCard\\\":{\\\"field1\\\":\\\"genericTestClassField1\\\",\\\"field2\\\":10},\\\"propagatedWildcardList\\\":[11],\\\"wildcardField\\\":1}\";\n        assertEquals(expected, defaultJsonb.toJson(multipleBoundsClass, new WildcardMultipleBoundsClass<BigDecimal>(){}.getClass()));\n\n\n        WildcardMultipleBoundsClass<BigDecimal> result = defaultJsonb.fromJson(expected, new TestTypeToken<WildcardMultipleBoundsClass<BigDecimal>>(){}.getType());\n        assertEquals(BigDecimal.ONE, result.wildcardField);\n        assertEquals(\"genericTestClassField1\", result.genericTestClassPropagatedWildCard.field1);\n        assertEquals(BigDecimal.TEN, result.genericTestClassPropagatedWildCard.field2);\n        assertEquals(new BigDecimal(\"11\"), result.propagatedWildcardList.get(0));\n\n    }\n\n    @Test\n    public void testWithType() {\n        List<Optional<String>> expected = Arrays.asList(Optional.empty(), Optional.of(\"first\"), Optional.of(\"second\"));\n        //String json = jsonb.toJson(expected, DefaultMappingGenericsTest.class.getField(\"listOfOptionalStringField\").getGenericType());\n\n        String json = defaultJsonb.toJson(expected);\n        assertEquals(\"[null,\\\"first\\\",\\\"second\\\"]\", json);\n    }\n\n    @Test\n    public void testPropagatedGenerics() {\n        List<Integer> integerList = new ArrayList<>();\n        integerList.add(1);\n        integerList.add(2);\n\n        GenericTestClass<List<Integer>, String> genericInList = new GenericTestClass<>();\n        genericInList.field1 = integerList;\n        genericInList.field2 = \"GenericsInListF2\";\n\n        List<GenericTestClass<List<Integer>, String>> listWithGenerics = new ArrayList<>();\n        listWithGenerics.add(genericInList);\n\n        GenericTestClass<Integer, String> genericTestClass = new GenericTestClass<>();\n        genericTestClass.field1 = 1;\n        genericTestClass.field2 = \"first\";\n\n        PropagatedGenericClass<Integer, String> propagatedGenericClass = new PropagatedGenericClass<>();\n        propagatedGenericClass.genericTestClass = genericTestClass;\n        propagatedGenericClass.genericList = listWithGenerics;\n\n        String expected = \"{\\\"genericList\\\":[{\\\"field1\\\":[1,2],\\\"field2\\\":\\\"GenericsInListF2\\\"}],\\\"genericTestClass\\\":{\\\"field1\\\":1,\\\"field2\\\":\\\"first\\\"}}\";\n\n        assertEquals(expected, defaultJsonb.toJson(propagatedGenericClass, new TestTypeToken<PropagatedGenericClass<Integer, String>>(){}.getType()));\n        PropagatedGenericClass<Integer, String> result = defaultJsonb.fromJson(expected, new TestTypeToken<PropagatedGenericClass<Integer, String>>(){}.getType());\n        assertEquals(GenericTestClass.class, result.genericList.get(0).getClass());\n        assertEquals(Integer.valueOf(1), result.genericList.get(0).field1.get(0));\n        assertEquals(Integer.valueOf(2), result.genericList.get(0).field1.get(1));\n        assertEquals(\"GenericsInListF2\", result.genericList.get(0).field2);\n        assertEquals(GenericTestClass.class, result.genericTestClass.getClass());\n        assertEquals(Integer.valueOf(1), result.genericTestClass.field1);\n        assertEquals(\"first\", result.genericTestClass.field2);\n\n    }\n\n    @Test\n    public void testMarshallPropagatedGenericsRaw() {\n\n        List<Integer> integerList = new ArrayList<>();\n        integerList.add(1);\n        integerList.add(2);\n\n        GenericBox<List<Integer>> box = new GenericBox<>();\n        box.setX(integerList);\n        box.setStrField(\"IntegerListBox\");\n\n        GenericTestClass<GenericBox<List<Integer>>, String> pojo = new GenericTestClass<>();\n        pojo.field1 = box;\n        pojo.field2 = \"GenericTestClass\";\n\n        assertEquals(\"{\\\"field1\\\":{\\\"strField\\\":\\\"IntegerListBox\\\",\\\"x\\\":[1,2]},\\\"field2\\\":\\\"GenericTestClass\\\"}\",\n                \tdefaultJsonb.toJson(pojo));\n    }\n\n\n\n    @Test\n    public void testFunctional() {\n        FunctionalInterface myFunction = new FunctionalInterface<String>() {\n\n            private String value = \"initValue\";\n\n            @Override\n            public String getValue() {\n                return value;\n            }\n\n            public void setValue(String value) {\n                this.value = value;\n            }\n        };\n\n        assertEquals(\"{\\\"value\\\":\\\"initValue\\\"}\", defaultJsonb.toJson(myFunction));\n    }\n\n    @Test\n    public void testBoundedGenerics() {\n        //bounded generics\n        BoundedGenericClass<HashSet<Integer>, Circle> boundedGenericClass = new BoundedGenericClass<>();\n        List<Shape> shapeList = new ArrayList<>();\n        Circle circle = new Circle();\n        circle.setRadius(2.5);\n        shapeList.add(circle);\n        boundedGenericClass.lowerBoundedList = shapeList;\n\n        List<ColoredCircle> coloredCircles = new ArrayList<>();\n        ColoredCircle coloredCircle = new ColoredCircle();\n        coloredCircle.radius = 3.5;\n        coloredCircle.color = \"0,0,255\";\n        coloredCircles.add(coloredCircle);\n        boundedGenericClass.upperBoundedList = coloredCircles;\n\n        HashSet<Integer> intSet = new HashSet<>();\n        intSet.add(3);\n        boundedGenericClass.boundedSet = intSet;\n\n        String expected = \"{\\\"boundedSet\\\":[3],\\\"lowerBoundedList\\\":[{\\\"radius\\\":2.5}],\\\"upperBoundedList\\\":[{\\\"radius\\\":3.5,\\\"color\\\":\\\"0,0,255\\\"}]}\";\n        assertEquals(expected, defaultJsonb.toJson(boundedGenericClass));\n\n        Jsonb localJsonb = JsonbBuilder.create(new JsonbConfig());\n        BoundedGenericClass<HashSet<Integer>, Circle> result = localJsonb.fromJson(expected,\n                new TestTypeToken<BoundedGenericClass<HashSet<Integer>, Circle>>(){}.getType());\n        assertEquals(Circle.class, result.lowerBoundedList.get(0).getClass());\n        assertEquals(Double.valueOf(2.5), ((Circle) result.lowerBoundedList.get(0)).getRadius());\n\n        //There is no way of identifying precise class (ColoredCircle) during json unmarshalling.\n        //Fields that are missing in upper bounds are skipped.\n        assertEquals(Circle.class, result.upperBoundedList.get(0).getClass());\n        assertEquals(Double.valueOf(3.5), result.upperBoundedList.get(0).getRadius());\n        //If it was possible we could assert following, but it is not.\n        //assertEquals(\"0,0,255\", ((ColoredCircle) result.upperBoundedList.get(0)).color);\n    }\n\n    @Test\n    public void testIncompatibleTypes() {\n        //exception incompatible types\n    \tassertThrows(ClassCastException.class, () -> {\n\t        BoundedGenericClass<HashSet<Integer>, Circle> otherGeneric = defaultJsonb.fromJson(\"{\\\"boundedSet\\\":[3],\\\"lowerBoundedList\\\":[{\\\"radius\\\":2.5}]}\",\n\t                new TestTypeToken<BoundedGenericClass<HashSet<Double>, Circle>>(){}.getType());\n\t        HashSet<Integer> otherIntSet = otherGeneric.boundedSet;\n\t        Integer intValue = otherIntSet.iterator().next();\n    \t});\n    }\n\n    @Test\n    public void testMultiLevelGenericExtension() {\n        MultiLevelExtendedGenericTestClass extended = new MultiLevelExtendedGenericTestClass();\n        extended.field1 = \"first\";\n        extended.field2 = 1;\n\n        String expected = \"{\\\"field1\\\":\\\"first\\\",\\\"field2\\\":1}\";\n        assertEquals(expected, defaultJsonb.toJson(extended));\n        MultiLevelExtendedGenericTestClass result = defaultJsonb.fromJson(expected, MultiLevelExtendedGenericTestClass.class);\n        assertEquals(\"first\", result.field1);\n        assertEquals(Integer.valueOf(1), result.field2);\n    }\n\n    @Test\n    public void testGenericArray() {\n        GenericArrayClass<Number, Integer> genericArrayClass = new GenericArrayClass<>();\n        Number[] numbers = new Number[2];\n        numbers[0] = 1;\n        numbers[1] = BigDecimal.TEN;\n        genericArrayClass.genericArray = numbers;\n\n        Integer[] integers = new Integer[2];\n        integers[0] = 1;\n        integers[1] = 10;\n        genericArrayClass.anotherGenericArray = integers;\n\n        GenericTestClass<Number[], Integer[]> genericTestClass = new GenericTestClass<>();\n        genericTestClass.field1 = Arrays.copyOf(numbers, numbers.length);\n        genericTestClass.field2 = Arrays.copyOf(integers, numbers.length);\n        genericArrayClass.propagatedGenericArray = genericTestClass;\n\n        String expected = \"{\\\"anotherGenericArray\\\":[1,10],\\\"genericArray\\\":[1,10],\\\"propagatedGenericArray\\\":{\\\"field1\\\":[1,10],\\\"field2\\\":[1,10]}}\";\n        assertEquals(expected, defaultJsonb.toJson(genericArrayClass, new TestTypeToken<GenericArrayClass<Number,Integer>>(){}.getType()));\n        GenericArrayClass<Number, Integer> result = defaultJsonb.fromJson(expected, new TestTypeToken<GenericArrayClass<Number, Integer>>(){}.getType());\n        assertEquals(BigDecimal.ONE, result.genericArray[0]);\n        assertEquals(BigDecimal.TEN, result.genericArray[1]);\n        assertEquals(Integer.valueOf(1), result.anotherGenericArray[0]);\n        assertEquals(Integer.valueOf(10), result.anotherGenericArray[1]);\n        assertEquals(BigDecimal.ONE, result.propagatedGenericArray.field1[0]);\n        assertEquals(BigDecimal.TEN, result.propagatedGenericArray.field1[1]);\n        assertEquals(Integer.valueOf(1), result.propagatedGenericArray.field2[0]);\n        assertEquals(Integer.valueOf(10), result.propagatedGenericArray.field2[1]);\n\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testMarshallRawList() throws ParseException {\n        List rawList = new ArrayList();\n        final SimpleDateFormat ddMMyyyy = new SimpleDateFormat(\"ddMMyyyy\");\n        ddMMyyyy.setTimeZone(TimeZone.getTimeZone(\"Z\"));\n        rawList.add(ddMMyyyy.parse(\"24031981\"));\n        Box box = new Box();\n        box.boxStr = \"box string\";\n        box.crate = new Crate();\n        box.crate.crateStr = \"crate str\";\n        rawList.add(box);\n\n        String result = defaultJsonb.toJson(rawList);\n        assertEquals(\"[\\\"1981-03-24T00:00:00Z[UTC]\\\",{\\\"boxStr\\\":\\\"box string\\\",\\\"crate\\\":{\\\"crate_str\\\":\\\"crate str\\\"}}]\", result);\n    }\n\n    @Test\n    public void testMultipleBounds() {\n        final LinkedList<String> list = new LinkedList<>(Arrays.asList(\"Test 1\", \"Test 2\"));\n        MultipleBoundsContainer<LinkedList<String>> container = new MultipleBoundsContainer<>();\n        container.setInstance(new ArrayList<>());\n        container.getInstance().add(list);\n\n        final Type type = new TestTypeToken<MultipleBoundsContainer<LinkedList<String>>>() {\n        }.getType();\n\n        String jsonString = defaultJsonb.toJson(container, type);\n        assertEquals(\"{\\\"instance\\\":[[\\\"Test 1\\\",\\\"Test 2\\\"]]}\", jsonString);\n\n        MultipleBoundsContainer<LinkedList<String>> result = defaultJsonb.fromJson(jsonString, type);\n\n        assertEquals(container.getInstance(), result.getInstance());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testDeserializeIntoRaw() {\n\n        GenericTestClass result = defaultJsonb.fromJson(\"{\\\"field1\\\":{\\\"val1\\\":\\\"abc\\\"},\\\"field2\\\":{\\\"val1\\\":\\\"def\\\"}}\", GenericTestClass.class);\n        assertEquals(((HashMap<String, ?>) result.getField1()).get(\"val1\"), \"abc\");\n        assertEquals(((HashMap<String, ?>) result.getField2()).get(\"val1\"), \"def\");\n    }\n\n    @Test\n    public void collectionWrapperTest() {\n        CollectionWrapper<String> collectionWrapper = new CollectionWrapper<>();\n        collectionWrapper.setCollection(new ArrayList<>());\n\n        collectionWrapper.setWrappedCollection(new ArrayList<>());\n        collectionWrapper.setWrappedMap(new HashMap<>());\n        String s = defaultJsonb.toJson(collectionWrapper);\n    }\n\n    @Test\n    public void multipleGenericLevels() {\n        FinalMember member = new FinalMember();\n        member.setName(\"Jason\");\n        FinalGenericWrapper concreteContainer = new FinalGenericWrapper();\n        concreteContainer.setMember(member);\n\n        String expected = \"{\\\"member\\\":{\\\"name\\\":\\\"Jason\\\"}}\";\n        Jsonb jsonb = JsonbBuilder.create();\n        assertEquals(expected, jsonb.toJson(concreteContainer));\n        FinalGenericWrapper finalGenericWrapper = jsonb.fromJson(expected, FinalGenericWrapper.class);\n        assertEquals(concreteContainer, finalGenericWrapper);\n    }\n\n    @Test\n    public void lowerBoundTypeVariableInCollectionAttribute() throws Exception {\n        \n        Shape shape = new Shape();\n        shape.setArea(5D);\n        \n        AnotherGenericTestClass<Integer, Shape> anotherGenericTestClass = new AnotherGenericTestClass<>();\n        anotherGenericTestClass.field1 = 6;\n        anotherGenericTestClass.field2 = shape;\n        \n        List<AnotherGenericTestClass<Integer, Shape>> asList = Arrays.asList(anotherGenericTestClass);\n        \n        Jsonb jsonb = JsonbBuilder.create();\n        String toJson = jsonb.toJson(asList);\n        \n        Field field = LowerBoundTypeVariableWithCollectionAttributeClass.class.getDeclaredField(\"value\");\n        \n        Type genericType = field.getGenericType();\n        \n        List<AnotherGenericTestClass<Integer, Shape>> fromJson = jsonb.fromJson(toJson, genericType);\n\n        assertEquals(5, fromJson.get(0).field2.getArea());\n        assertEquals(6, fromJson.get(0).field1);\n        \n    }\n\n    @Test\n    public void genericConstructorCreator() {\n        final String expectedJson = \"{\\\"value\\\":\\\"Test\\\"}\";\n        final ConstructorContainer<String> container = new ConstructorContainer<>(\"Test\");\n\n        assertEquals(expectedJson, defaultJsonb.toJson(container));\n        assertEquals(container, defaultJsonb.fromJson(expectedJson, ConstructorContainer.class));\n    }\n\n    @Test\n    public void genericStaticCreator() {\n        final String expectedJson = \"{\\\"value\\\":\\\"static\\\"}\";\n        final StaticCreatorContainer<String> container = StaticCreatorContainer.create(\"static\");\n\n        assertEquals(expectedJson, defaultJsonb.toJson(container));\n        assertEquals(container, defaultJsonb.fromJson(expectedJson, StaticCreatorContainer.class));\n    }\n\n    @Test\n    public void wildcardCollectionContainer() {\n        final String expectedJson = \"{\\\"collection\\\":{\\\"collection\\\":[{\\\"wrapped\\\":\\\"wrappedElement\\\"}]}}\";\n        final CollectionContainer collectionContainer = new CollectionContainer();\n        final CollectionWrapper<CollectionElement<?>> collectionWrapper = new CollectionWrapper<>();\n        final CollectionElement<String> wildcardType = new CollectionElement<>();\n        wildcardType.setWrapped(\"wrappedElement\");\n        final Collection<CollectionElement<?>> list = List.of(wildcardType);\n        collectionWrapper.setCollection(list);\n        collectionContainer.setCollection(collectionWrapper);\n\n        assertEquals(expectedJson, defaultJsonb.toJson(collectionContainer));\n        final CollectionContainer result = defaultJsonb.fromJson(expectedJson, CollectionContainer.class);\n        assertEquals(collectionContainer, result);\n    }\n\n    @Test\n    public void genericUpperBoundContainer() {\n        final String expectedJson = \"{\\\"tree\\\":{\\\"children\\\":[{\\\"children\\\":[],\\\"name\\\":\\\"child\\\"}],\\\"name\\\":\\\"parent\\\"}}\";\n        final TreeContainer<TreeElement> container = new TreeContainer<>();\n        final TreeElement parent = new TreeElement(\"parent\");\n        parent.setChildren(List.of(new TreeElement(\"child\")));\n        container.setTree(parent);\n\n        assertEquals(expectedJson, defaultJsonb.toJson(container));\n\n    }\n    \n    public interface FunctionalInterface<T> {\n        T getValue();\n    }\n\n    public static class ExtendsBigDecimal extends BigDecimal {\n\n        public ExtendsBigDecimal(String val) {\n            super(val);\n        }\n    }\n\n}\n\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/AbstractGenericWrapper.java",
    "content": "/*\n * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\nimport java.util.Objects;\n\npublic abstract class AbstractGenericWrapper<T extends AbstractMember> {\n\n    T member;\n\n    public T getMember() {\n        return member;\n    }\n\n    public void setMember(T member) {\n        this.member = member;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        AbstractGenericWrapper<?> that = (AbstractGenericWrapper<?>) o;\n        return Objects.equals(member, that.member);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(member);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/AbstractMember.java",
    "content": "/*\n * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\npublic class AbstractMember {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/AnotherGenericTestClass.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class AnotherGenericTestClass<T1, T2> {\n\n    public T1 field1;\n\n    public T2 field2;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/BoundedGenericClass.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\nimport java.util.List;\nimport java.util.Set;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class BoundedGenericClass<T extends Set<? extends Number>, U> {\n    public List<? extends U> upperBoundedList;\n    public List<? super U> lowerBoundedList;\n    public T boundedSet;\n\n    public BoundedGenericClass() {\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/Circle.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class Circle extends Shape {\n    public Double radius;\n\n    public Circle() {\n        super();\n    }\n\n    public Double getRadius() {\n        return radius;\n    }\n\n    public void setRadius(double radius) {\n        this.radius = radius;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/CollectionContainer.java",
    "content": "/*\n * Copyright (c) 2025 Red Hat, Inc. and/or its affiliates.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\nimport java.util.Collection;\nimport java.util.Objects;\n\n/**\n * @author <a href=\"mailto:jperkins@redhat.com\">James R. Perkins</a>\n */\npublic class CollectionContainer {\n\n    private CollectionWrapper<CollectionElement<?>> collection;\n\n    public CollectionWrapper<CollectionElement<?>> getCollection() {\n        return collection;\n    }\n\n    public void setCollection(final CollectionWrapper<CollectionElement<?>> collection) {\n        this.collection = collection;\n    }\n\n    @Override\n    public boolean equals(final Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (!(obj instanceof CollectionContainer)) {\n            return false;\n        }\n        final CollectionContainer other = (CollectionContainer) obj;\n        final Collection<CollectionElement<?>> thisCollection = collection.getCollection();\n        final Collection<CollectionElement<?>> otherCollection = other.collection.getCollection();\n        if (thisCollection == null && otherCollection == null) {\n            return true;\n        }\n        if (thisCollection == null || otherCollection == null) {\n            return false;\n        }\n        return thisCollection.containsAll(otherCollection) && otherCollection.containsAll(thisCollection);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(collection);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/CollectionElement.java",
    "content": "/*\n * Copyright (c) 2025 Red Hat, Inc. and/or its affiliates.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\nimport java.util.Objects;\n\n/**\n * @author <a href=\"mailto:jperkins@redhat.com\">James R. Perkins</a>\n */\npublic class CollectionElement<T> {\n\n    private T wrapped;\n\n    public T getWrapped() {\n        return wrapped;\n    }\n\n    public void setWrapped(T wrapped) {\n        this.wrapped = wrapped;\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(wrapped);\n    }\n\n    @Override\n    public boolean equals(final Object obj) {\n        if (this == obj) {\n            return true;\n        }\n        if (!(obj instanceof CollectionElement)) {\n            return false;\n        }\n        final CollectionElement<?> other = (CollectionElement<?>) obj;\n        return Objects.equals(wrapped, other.wrapped);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/CollectionWrapper.java",
    "content": "/*\n * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\nimport java.util.Collection;\nimport java.util.Map;\n\npublic class CollectionWrapper<T> {\n\n    public CollectionWrapper() {\n    }\n\n    private Collection<T> collection;\n\n    private Collection<Collection<T>> wrappedCollection;\n\n    private Map<String, Map<String,String>> wrappedMap;\n\n    public Collection<T> getCollection() {\n        return collection;\n    }\n\n    public void setCollection(Collection<T> collection) {\n        this.collection = collection;\n    }\n\n    public Collection<Collection<T>> getWrappedCollection() {\n        return wrappedCollection;\n    }\n\n    public void setWrappedCollection(Collection<Collection<T>> wrappedCollection) {\n        this.wrappedCollection = wrappedCollection;\n    }\n\n    public Map<String, Map<String, String>> getWrappedMap() {\n        return wrappedMap;\n    }\n\n    public void setWrappedMap(Map<String, Map<String, String>> wrappedMap) {\n        this.wrappedMap = wrappedMap;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/ColoredCircle.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class ColoredCircle extends Circle {\n\n    public String color;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/ConstructorContainer.java",
    "content": "/*\n * Copyright (c) 2025 Red Hat, Inc. and/or its affiliates.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\nimport java.util.Objects;\n\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author <a href=\"mailto:jperkins@redhat.com\">James R. Perkins</a>\n */\npublic class ConstructorContainer<T> {\n\n    private final T value;\n\n    @JsonbCreator\n    public ConstructorContainer(@JsonbProperty(\"value\") final T value) {\n        this.value = value;\n    }\n\n    public T getValue() {\n        return value;\n    }\n\n    @Override\n    public String toString() {\n        return \"ConstructorContainer[value=\" + value + \"]\";\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(value);\n    }\n\n    @Override\n    public boolean equals(final Object obj) {\n        if (this == obj) {\n            return true;\n        }\n        if (!(obj instanceof ConstructorContainer)) {\n            return false;\n        }\n        final ConstructorContainer<?> other = (ConstructorContainer<?>) obj;\n        return Objects.equals(value, other.value);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/CyclicSubClass.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class CyclicSubClass extends MyCyclicGenericClass<CyclicSubClass> {\n    public String subField;\n\n    public CyclicSubClass() {\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/ExtendedGenericTestClass.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class ExtendedGenericTestClass extends GenericTestClass<String, Integer> {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/FinalGenericWrapper.java",
    "content": "/*\n * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\npublic class FinalGenericWrapper extends MiddleGenericWrapper<FinalMember> {\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/FinalMember.java",
    "content": "/*\n * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\nimport java.util.Objects;\n\npublic class FinalMember extends AbstractMember {\n    String name;\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        FinalMember that = (FinalMember) o;\n        return Objects.equals(name, that.name);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(name);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/GenericArrayClass.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class GenericArrayClass<T, U extends T> {\n    public T[] genericArray;\n    public U[] anotherGenericArray;\n    public GenericTestClass<T[], U[]> propagatedGenericArray;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/GenericTestClass.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\n/**\n * Test class used in generics tests.\n *\n * @author Dmitry Kornilov\n */\npublic class GenericTestClass<T,U> {\n    public T field1;\n    public U field2;\n\n    public GenericTestClass() {}\n\n    public T getField1() {\n        return field1;\n    }\n\n    public void setField1(T field1) {\n        this.field1 = field1;\n    }\n\n    public U getField2() {\n        return field2;\n    }\n\n    public void setField2(U field2) {\n        this.field2 = field2;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/GenericWithUnboundedWildcardClass.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\nimport java.util.List;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class GenericWithUnboundedWildcardClass {\n    public List<?> wildcardList;\n\n    public GenericWithUnboundedWildcardClass() {\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/LowerBoundTypeVariableWithCollectionAttributeClass.java",
    "content": "/*\n * Copyright (c) 2015, 2023 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\nimport java.util.Collection;\n\n/**\n * @author Alessandro Moscatelli\n */\npublic class LowerBoundTypeVariableWithCollectionAttributeClass<T extends Shape> {\n    \n    private Collection<AnotherGenericTestClass<Integer, T>> value;\n\n    public Collection<AnotherGenericTestClass<Integer, T>> getValue() {\n        return value;\n    }\n\n    public void setValue(Collection<AnotherGenericTestClass<Integer, T>> value) {\n        this.value = value;\n    }\n    \n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/MiddleGenericWrapper.java",
    "content": "/*\n * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\npublic abstract class MiddleGenericWrapper<T extends AbstractMember> extends AbstractGenericWrapper<T> {\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/MultiLevelExtendedGenericTestClass.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class MultiLevelExtendedGenericTestClass extends ExtendedGenericTestClass {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/MultipleBoundsContainer.java",
    "content": "/*\n * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\n/*\n * $Id$\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\nimport java.util.List;\nimport java.util.Queue;\n\npublic class MultipleBoundsContainer<T extends List & Queue> implements TypeContainer<List<T>> {\n    protected List<T> instance;\n\n    @Override\n    public List<T> getInstance() {\n        return instance;\n    }\n\n    @Override\n    public void setInstance(List<T> instance) {\n        this.instance = instance;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/MyCyclicGenericClass.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class MyCyclicGenericClass<T extends MyCyclicGenericClass<? extends T>> {\n    public T field1;\n\n    public MyCyclicGenericClass() {\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/PropagatedGenericClass.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\nimport java.util.List;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class PropagatedGenericClass<P, X> {\n    public List<GenericTestClass<List<P>, X>> genericList;\n    public GenericTestClass<P, X> genericTestClass;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/ScalarValueWrapper.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class ScalarValueWrapper<T> {\n\n    private T value;\n\n    public ScalarValueWrapper() {\n    }\n\n    public ScalarValueWrapper(T value) {\n        this.value = value;\n    }\n\n    public T getValue() {\n        return value;\n    }\n\n    public void setValue(T value) {\n        this.value = value;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/Shape.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class Shape {\n    private Double area;\n\n    public Shape() {\n    }\n\n    public Double getArea() {\n        return area;\n    }\n\n    public void setArea(Double area) {\n        this.area = area;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/StaticCreatorContainer.java",
    "content": "/*\n * Copyright (c) 2025 Red Hat, Inc. and/or its affiliates.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\nimport java.util.Objects;\n\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbProperty;\n\n/**\n * @author <a href=\"mailto:jperkins@redhat.com\">James R. Perkins</a>\n */\npublic class StaticCreatorContainer<T> {\n    private final T value;\n\n    private StaticCreatorContainer(T value) {\n        this.value = value;\n    }\n\n    @JsonbCreator\n    public static <T> StaticCreatorContainer<T> create(@JsonbProperty(\"value\") final T value) {\n        return new StaticCreatorContainer<>(value);\n    }\n\n    public T getValue() {\n        return value;\n    }\n\n    @Override\n    public String toString() {\n        return \"StaticCreatorContainer[value=\" + value + \"]\";\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(value);\n    }\n\n    @Override\n    public boolean equals(final Object obj) {\n        if (this == obj) {\n            return true;\n        }\n        if (!(obj instanceof StaticCreatorContainer)) {\n            return false;\n        }\n        final StaticCreatorContainer<?> other = (StaticCreatorContainer<?>) obj;\n        return Objects.equals(value, other.value);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/TreeContainer.java",
    "content": "/*\n * Copyright (c) 2025 Red Hat, Inc. and/or its affiliates.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\n/**\n * @author <a href=\"mailto:jperkins@redhat.com\">James R. Perkins</a>\n */\npublic class TreeContainer<T extends TreeTypeContainer<T>> {\n\n    private TreeTypeContainer<T> tree;\n\n    public TreeTypeContainer<T> getTree() {\n        return tree;\n    }\n\n    public void setTree(final TreeTypeContainer<T> tree) {\n        this.tree = tree;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/TreeElement.java",
    "content": "/*\n * Copyright (c) 2025 Red Hat, Inc. and/or its affiliates.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * @author <a href=\"mailto:jperkins@redhat.com\">James R. Perkins</a>\n */\npublic class TreeElement implements TreeTypeContainer<TreeElement> {\n\n    private final String name;\n    private List<TreeElement> children = new ArrayList<>();\n\n    public TreeElement(final String name) {\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public List<TreeElement> getChildren() {\n        return children;\n    }\n\n    public void setChildren(final List<TreeElement> children) {\n        this.children = children;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/TreeTypeContainer.java",
    "content": "/*\n * Copyright (c) 2025 Red Hat, Inc. and/or its affiliates.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\nimport java.util.List;\n\n/**\n * @author <a href=\"mailto:jperkins@redhat.com\">James R. Perkins</a>\n */\npublic interface TreeTypeContainer<T extends TreeTypeContainer<T>> {\n\n    List<T> getChildren();\n\n    void setChildren(List<T> children);\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/TypeContainer.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\npublic interface TypeContainer<T> {\n    T getInstance();\n    void setInstance(T instance);\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/WildCardClass.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class WildCardClass <T extends Number> {\n\n    public T number;\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/generics/model/WildcardMultipleBoundsClass.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.generics.model;\n\nimport java.io.Serializable;\nimport java.util.List;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class WildcardMultipleBoundsClass<T extends Number & Serializable & Comparable<? extends T>> {\n\n    public T wildcardField;\n\n    public GenericTestClass<String, T> genericTestClassPropagatedWildCard;\n\n    public List<? extends T> propagatedWildcardList;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/InheritanceTest.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.TestTypeToken;\nimport org.eclipse.yasson.defaultmapping.generics.model.GenericTestClass;\nimport org.eclipse.yasson.defaultmapping.generics.model.PropagatedGenericClass;\nimport org.eclipse.yasson.defaultmapping.inheritance.model.PartialOverride;\nimport org.eclipse.yasson.defaultmapping.inheritance.model.PropertyOrderSecond;\nimport org.eclipse.yasson.defaultmapping.inheritance.model.SecondLevel;\nimport org.eclipse.yasson.defaultmapping.inheritance.model.generics.ExtendsExtendsPropagatedGenericClass;\nimport org.eclipse.yasson.defaultmapping.inheritance.model.generics.ExtendsPropagatedGenericClass;\nimport org.eclipse.yasson.defaultmapping.inheritance.model.generics.ImplementsGenericInterfaces;\nimport org.eclipse.yasson.defaultmapping.inheritance.model.generics.SecondLevelGeneric;\n\nimport java.lang.reflect.Type;\nimport java.math.BigDecimal;\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * Tests inheritance model marshalling / unmarshalling\n *\n * Tests property order, method overloading, generic type ({@link java.lang.reflect.TypeVariable}) resolving for unmarshalling.\n *\n * @author Roman Grigoriadi\n */\npublic class InheritanceTest {\n\n    @Test\n    public void testBasicInheritance() throws Exception {\n        SecondLevel secondLevel = new SecondLevel();\n        secondLevel.setInFirstLevel(\"IN_FIRST_LEVEL\");\n        secondLevel.setInSecondLevel(\"IN_SECOND_LEVEL\");\n        secondLevel.setInZeroOverriddenInFirst(\"IN_ZERO_OVERRIDDEN_IN_FIRST\");\n\n        String json = \"{\\\"inZeroOverriddenInFirst\\\":\\\"IN_ZERO_OVERRIDDEN_IN_FIRST\\\",\\\"inFirstLevel\\\":\\\"IN_FIRST_LEVEL\\\",\\\"inSecondLevel\\\":\\\"IN_SECOND_LEVEL\\\"}\";\n        assertEquals(json, defaultJsonb.toJson(secondLevel));\n\n        SecondLevel result = defaultJsonb.fromJson(json, SecondLevel.class);\n        assertEquals(\"IN_FIRST_LEVEL\", result.getInFirstLevel());\n        assertEquals(\"IN_SECOND_LEVEL\", result.getInSecondLevel());\n        assertEquals(\"IN_ZERO_OVERRIDDEN_IN_FIRST\", result.getInZeroOverriddenInFirst());\n\n    }\n\n    @Test\n    public void testBasicGenericInheritance() {\n        SecondLevelGeneric<Number, Short, String> secondLevelGeneric = new SecondLevelGeneric<>();\n        secondLevelGeneric.setInSecondLevel(BigDecimal.TEN);\n        secondLevelGeneric.setInFirstLevel((short) 255);\n        secondLevelGeneric.setInZeroOverriddenInFirst(\"IN_ZERO_OVERRIDDEN_IN_FIRST\");\n        secondLevelGeneric.setInZero(\"IN_ZERO\");\n\n        String json = \"{\\\"inZero\\\":\\\"IN_ZERO\\\",\\\"inFirstLevel\\\":255,\\\"inZeroOverriddenInFirst\\\":\\\"IN_ZERO_OVERRIDDEN_IN_FIRST\\\",\\\"inSecondLevel\\\":10}\";\n        assertEquals(json, defaultJsonb.toJson(secondLevelGeneric));\n\n        SecondLevelGeneric<Number, Short, String> result = defaultJsonb.fromJson(json, new TestTypeToken<SecondLevelGeneric<Number, Short, String>>(){}.getType());\n        assertEquals(BigDecimal.TEN, result.getInSecondLevel());\n        assertEquals(Short.valueOf(\"255\"), result.getInFirstLevel());\n        assertEquals(\"IN_ZERO_OVERRIDDEN_IN_FIRST\", result.getInZeroOverriddenInFirst());\n        assertEquals(\"IN_ZERO\", result.getInZero());\n    }\n\n    @Test\n    public void testPropagatedGenericInheritance() throws Exception {\n        List<String> stringList = new ArrayList<>();\n        stringList.add(\"first\");\n        stringList.add(\"second\");\n\n        GenericTestClass<List<String>, BigDecimal> genericInList = new GenericTestClass<>();\n        genericInList.field1 = stringList;\n        genericInList.field2 = BigDecimal.TEN;\n\n        List<GenericTestClass<List<String>, BigDecimal>> listWithGenerics = new ArrayList<>();\n        listWithGenerics.add(genericInList);\n\n        GenericTestClass<String, BigDecimal> genericTestClass = new GenericTestClass<>();\n        genericTestClass.field1 = \"GENERIC_STRING\";\n        genericTestClass.field2 = BigDecimal.ONE;\n\n        ExtendsExtendsPropagatedGenericClass underTest = new ExtendsExtendsPropagatedGenericClass();\n        underTest.genericTestClass = genericTestClass;\n        underTest.genericList = listWithGenerics;\n\n        String json = \"{\\\"genericList\\\":[{\\\"field1\\\":[\\\"first\\\",\\\"second\\\"],\\\"field2\\\":10}],\\\"genericTestClass\\\":{\\\"field1\\\":\\\"GENERIC_STRING\\\",\\\"field2\\\":1}}\";\n        assertEquals(json, defaultJsonb.toJson(underTest));\n\n        ExtendsExtendsPropagatedGenericClass result = defaultJsonb.fromJson(json, ExtendsExtendsPropagatedGenericClass.class);\n        assertEquals(GenericTestClass.class, result.genericList.get(0).getClass());\n        assertEquals(\"first\", result.genericList.get(0).field1.get(0));\n        assertEquals(\"second\", result.genericList.get(0).field1.get(1));\n        assertEquals(BigDecimal.TEN, result.genericList.get(0).field2);\n        assertEquals(GenericTestClass.class, result.genericTestClass.getClass());\n        assertEquals(\"GENERIC_STRING\", result.genericTestClass.field1);\n        assertEquals(BigDecimal.ONE, result.genericTestClass.field2);\n    }\n\n    @Test\n    public void testPropagatedGenericInheritance1() throws Exception {\n        List<String> stringList = new ArrayList<>();\n        stringList.add(\"first\");\n        stringList.add(\"second\");\n\n        GenericTestClass<List<String>, BigDecimal> genericInList = new GenericTestClass<>();\n        genericInList.field1 = stringList;\n        genericInList.field2 = BigDecimal.TEN;\n\n        List<GenericTestClass<List<String>, BigDecimal>> listWithGenerics = new ArrayList<>();\n        listWithGenerics.add(genericInList);\n\n        GenericTestClass<String, BigDecimal> genericTestClass = new GenericTestClass<>();\n        genericTestClass.field1 = \"SECOND_LEVEL_GENERIC_STRING\";\n        genericTestClass.field2 = BigDecimal.ONE;\n\n        PropagatedGenericClass<String, BigDecimal> propagatedGenericClass = new PropagatedGenericClass<>();\n        propagatedGenericClass.genericList = listWithGenerics;\n        propagatedGenericClass.genericTestClass = genericTestClass;\n\n\n        stringList = new ArrayList<>();\n        stringList.add(\"third\");\n        stringList.add(\"fourth\");\n\n        genericInList = new GenericTestClass<>();\n        genericInList.field1 = stringList;\n        genericInList.field2 = BigDecimal.ZERO;\n\n        listWithGenerics = new ArrayList<>();\n        listWithGenerics.add(genericInList);\n\n        genericTestClass = new GenericTestClass<>();\n        genericTestClass.field1 = \"FIRST_LEVEL_GENERIC_STRING\";\n        genericTestClass.field2 = new BigDecimal(\"11\");\n\n        ExtendsPropagatedGenericClass<String, BigDecimal> extendsPropagatedGenericClass = new ExtendsPropagatedGenericClass<>();\n        extendsPropagatedGenericClass.genericList = listWithGenerics;\n        extendsPropagatedGenericClass.genericTestClass = genericTestClass;\n\n        SecondLevelGeneric<PropagatedGenericClass<String, BigDecimal>, ExtendsPropagatedGenericClass<String, BigDecimal>, String> secondLevelGeneric = new SecondLevelGeneric<>();\n        secondLevelGeneric.setInSecondLevel(propagatedGenericClass);\n        secondLevelGeneric.setInFirstLevel(extendsPropagatedGenericClass);\n        secondLevelGeneric.setInZeroOverriddenInFirst(\"STRING_IN_ZERO_OVERRIDDEN_IN_FIRST\");\n        secondLevelGeneric.setInZero(\"IN_ZERO\");\n\n        String json = \"{\\\"inZero\\\":\\\"IN_ZERO\\\",\\\"inFirstLevel\\\":{\\\"genericList\\\":[{\\\"field1\\\":[\\\"third\\\",\\\"fourth\\\"],\\\"field2\\\":0}],\\\"genericTestClass\\\":{\\\"field1\\\":\\\"FIRST_LEVEL_GENERIC_STRING\\\",\\\"field2\\\":11}},\\\"inZeroOverriddenInFirst\\\":\\\"STRING_IN_ZERO_OVERRIDDEN_IN_FIRST\\\",\\\"inSecondLevel\\\":{\\\"genericList\\\":[{\\\"field1\\\":[\\\"first\\\",\\\"second\\\"],\\\"field2\\\":10}],\\\"genericTestClass\\\":{\\\"field1\\\":\\\"SECOND_LEVEL_GENERIC_STRING\\\",\\\"field2\\\":1}}}\";\n\n        final Type runtimeType = new TestTypeToken<SecondLevelGeneric<PropagatedGenericClass<String, BigDecimal>, ExtendsPropagatedGenericClass<String, BigDecimal>, String>>(){}.getType();\n        assertEquals(json, defaultJsonb.toJson(secondLevelGeneric, runtimeType));\n        SecondLevelGeneric<PropagatedGenericClass<String, BigDecimal>, ExtendsPropagatedGenericClass<String, BigDecimal>, String> result =\n        \t\tdefaultJsonb.fromJson(json, runtimeType);\n\n        assertEquals(\"first\", result.getInSecondLevel().genericList.get(0).field1.get(0));\n        assertEquals(\"second\", result.getInSecondLevel().genericList.get(0).field1.get(1));\n        assertEquals(BigDecimal.TEN, result.getInSecondLevel().genericList.get(0).field2);\n        assertEquals(\"SECOND_LEVEL_GENERIC_STRING\", result.getInSecondLevel().genericTestClass.field1);\n        assertEquals(BigDecimal.ONE, result.getInSecondLevel().genericTestClass.field2);\n\n        assertEquals(\"third\", result.getInFirstLevel().genericList.get(0).field1.get(0));\n        assertEquals(\"fourth\", result.getInFirstLevel().genericList.get(0).field1.get(1));\n        assertEquals(BigDecimal.ZERO, result.getInFirstLevel().genericList.get(0).field2);\n        assertEquals(\"FIRST_LEVEL_GENERIC_STRING\", result.getInFirstLevel().genericTestClass.field1);\n        assertEquals(new BigDecimal(\"11\"), result.getInFirstLevel().genericTestClass.field2);\n\n        assertEquals(\"STRING_IN_ZERO_OVERRIDDEN_IN_FIRST\", result.getInZeroOverriddenInFirst());\n        assertEquals(\"IN_ZERO\", result.getInZero());\n    }\n\n    @Test\n    public void testInterfaceGenericInheritance() throws Exception {\n        ImplementsGenericInterfaces<String, Integer> implementsGenericInterfaces = new ImplementsGenericInterfaces<>();\n\n        implementsGenericInterfaces.setGenericValue(\"GENERIC_VALUE\");\n        implementsGenericInterfaces.setAnotherGenericValue(255);\n\n        String json = \"{\\\"anotherGenericValue\\\":255,\\\"genericValue\\\":\\\"GENERIC_VALUE\\\"}\";\n        assertEquals(json, defaultJsonb.toJson(implementsGenericInterfaces));\n\n        ImplementsGenericInterfaces<String, Integer> result = defaultJsonb.fromJson(json, new TestTypeToken<ImplementsGenericInterfaces<String, Integer>>(){}.getType());\n        assertEquals(\"GENERIC_VALUE\", result.getGenericValue());\n        assertEquals(Integer.valueOf(255), result.getAnotherGenericValue());\n    }\n\n    @Test\n    public void testPartialOverride() {\n        PartialOverride partialOverride = new PartialOverride();\n        partialOverride.setIntValue(5);\n        partialOverride.setStrValue(\"abc\");\n        String json = defaultJsonb.toJson(partialOverride);\n        assertEquals(\"{\\\"intValue\\\":5,\\\"strValue\\\":\\\"abc\\\"}\", json);\n\n        PartialOverride result = defaultJsonb.fromJson(\"{\\\"intValue\\\":5,\\\"strValue\\\":\\\"abc\\\"}\", PartialOverride.class);\n        assertEquals(5, result.getIntValue());\n        assertEquals(\"abc\", result.getStrValue());\n    }\n\n    @Test\n    public void testPropOrderPartiallyOverriddenProperty() {\n        PropertyOrderSecond pojo = new PropertyOrderSecond();\n        pojo.setZero(\"ZERO\");\n        pojo.setZeroPartiallyOverriddenInFirst(\"ZERO_PARTIALLY_OVERRIDDEN_IN_FIRST\");\n        pojo.setZeroOverriddenInSecond(\"ZERO_OVERRIDDEN_IN_SECOND\");\n        pojo.setFirst(\"FIRST\");\n        pojo.setSecond(\"SECOND\");\n\n        String result = defaultJsonb.toJson(pojo);\n        assertEquals(\"{\\\"zero\\\":\\\"ZERO\\\",\\\"zeroPartiallyOverriddenInFirst\\\":\\\"ZERO_PARTIALLY_OVERRIDDEN_IN_FIRST\\\",\\\"first\\\":\\\"FIRST\\\",\\\"second\\\":\\\"SECOND\\\",\\\"zeroOverriddenInSecond\\\":\\\"ZERO_OVERRIDDEN_IN_SECOND\\\"}\",\n                result);\n    }\n\n    @Test\n    public void testInheritanceSerialization() {\n        AnimalWrapper animalWrapper = new AnimalWrapper();\n        animalWrapper.animal = new Dog();\n        //Just initialize serializer cache for Animal and Dog\n        defaultJsonb.toJson(animalWrapper);\n\n        //Check if the Dog instance is dynamically resolved even though Dog serializer has been created before\n        DogWrapper dogWrapper = new DogWrapper();\n        dogWrapper.dog = new Dog();\n        assertEquals(\"{\\\"dog\\\":{\\\"isDog\\\":true}}\", defaultJsonb.toJson(dogWrapper));\n        dogWrapper.dog = new SmallDog();\n        assertEquals(\"{\\\"dog\\\":{\\\"isDog\\\":true,\\\"isSmallDog\\\":true}}\", defaultJsonb.toJson(dogWrapper));\n\n    }\n\n    public static class AnimalWrapper {\n\n        public Animal animal;\n\n    }\n\n    public static class DogWrapper {\n\n        public Dog dog;\n\n    }\n\n    public static class Animal {\n\n    }\n\n    public static class Dog extends Animal {\n        public boolean isDog = true;\n    }\n\n    public static class SmallDog extends Dog {\n        public boolean isSmallDog = true;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/AbstractZeroLevel.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic abstract class AbstractZeroLevel {\n\n    protected String inZeroOverriddenInFirst;\n\n    abstract String getInZeroOverriddenInFirst();\n\n    abstract void setInZeroOverriddenInFirst(String value);\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/FirstLevel.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class FirstLevel extends AbstractZeroLevel {\n\n    private String inFirstLevel;\n\n    @Override\n    public String getInZeroOverriddenInFirst() {\n        return inZeroOverriddenInFirst;\n    }\n\n    @Override\n    public void setInZeroOverriddenInFirst(String value) {\n        inZeroOverriddenInFirst = value;\n    }\n\n    public String getInFirstLevel() {\n        return inFirstLevel;\n    }\n\n    public void setInFirstLevel(String inFirstLevel) {\n        this.inFirstLevel = inFirstLevel;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/PartialOverride.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance.model;\n\n/**\n * Bias property is not readable by putting field and getter in other class than setter.\n *\n * @author Roman Grigoriadi\n */\npublic class PartialOverride extends PartialOverrideBase {\n\n    @Override\n    public void setIntValue(int intValue) {\n        super.setIntValue(intValue);\n    }\n\n    @Override\n    public void setStrValue(String strValue) {\n        super.setStrValue(strValue);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/PartialOverrideBase.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class PartialOverrideBase {\n\n    private int intValue;\n    private String strValue;\n\n    public int getIntValue() {\n        return intValue;\n    }\n\n    public void setIntValue(int intValue) {\n        this.intValue = intValue;\n    }\n\n    public String getStrValue() {\n        return strValue;\n    }\n\n    public void setStrValue(String strValue) {\n        this.strValue = strValue;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/PropertyOrderFirst.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class PropertyOrderFirst extends PropertyOrderZero {\n\n    private String first;\n\n    public String getFirst() {\n        return first;\n    }\n\n    public void setFirst(String first) {\n        this.first = first;\n    }\n\n    @Override\n    public void setZeroPartiallyOverriddenInFirst(String zeroPartiallyOverriddenInFirst) {\n        super.setZeroPartiallyOverriddenInFirst(zeroPartiallyOverriddenInFirst);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/PropertyOrderSecond.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class PropertyOrderSecond extends PropertyOrderFirst {\n\n    private String zeroOverridden;\n\n    private String second;\n\n    public String getSecond() {\n        return second;\n    }\n\n    public void setSecond(String second) {\n        this.second = second;\n    }\n\n    @Override\n    public String getZeroOverriddenInSecond() {\n        return zeroOverridden;\n    }\n\n    @Override\n    public void setZeroOverriddenInSecond(String zeroOverriddenInSecond) {\n        this.zeroOverridden = zeroOverriddenInSecond;\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/PropertyOrderZero.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class PropertyOrderZero {\n\n    private String zeroOverriddenInSecond;\n\n    //only setter is overridden\n    private String zeroPartiallyOverriddenInFirst;\n\n    private String zero;\n\n    public String getZero() {\n        return zero;\n    }\n\n    public void setZero(String zero) {\n        this.zero = zero;\n    }\n\n    public String getZeroOverriddenInSecond() {\n        return zeroOverriddenInSecond;\n    }\n\n    public void setZeroOverriddenInSecond(String zeroOverriddenInSecond) {\n        this.zeroOverriddenInSecond = zeroOverriddenInSecond;\n    }\n\n    public String getZeroPartiallyOverriddenInFirst() {\n        return zeroPartiallyOverriddenInFirst;\n    }\n\n    public void setZeroPartiallyOverriddenInFirst(String zeroPartiallyOverriddenInFirst) {\n        this.zeroPartiallyOverriddenInFirst = zeroPartiallyOverriddenInFirst;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/SecondLevel.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class SecondLevel extends FirstLevel {\n\n    private String inSecondLevel;\n\n    //hides inFirstLevel in FirstLevelGeneric\n    private String inFirstLevel;\n\n    public String getInSecondLevel() {\n        return inSecondLevel;\n    }\n\n    public void setInSecondLevel(String inSecondLevel) {\n        this.inSecondLevel = inSecondLevel;\n    }\n\n    @Override\n    public String getInFirstLevel() {\n        return inFirstLevel;\n    }\n\n    @Override\n    public void setInFirstLevel(String inFirstLevel) {\n        this.inFirstLevel = inFirstLevel;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/generics/AbstractZeroLevelGeneric.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance.model.generics;\n\n/**\n * @author Roman Grigoriadi\n */\npublic abstract class AbstractZeroLevelGeneric<ZF, Z> {\n\n    private Z inZero;\n\n    protected ZF inZeroOverriddenInFirst;\n\n    abstract ZF getInZeroOverriddenInFirst();\n\n    abstract void setInZeroOverriddenInFirst(ZF value);\n\n    public Z getInZero() {\n        return inZero;\n    }\n\n    public void setInZero(Z inZero) {\n        this.inZero = inZero;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/generics/AnotherGenericInterface.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance.model.generics;\n\n/**\n * @author Roman Grigoriadi\n */\npublic interface AnotherGenericInterface<T> {\n\n    T getAnotherGenericValue();\n\n    void setAnotherGenericValue(T value);\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/generics/ExtendsExtendsPropagatedGenericClass.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance.model.generics;\n\nimport java.math.BigDecimal;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class ExtendsExtendsPropagatedGenericClass extends ExtendsPropagatedGenericClass<String, BigDecimal> {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/generics/ExtendsPropagatedGenericClass.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance.model.generics;\n\nimport org.eclipse.yasson.defaultmapping.generics.model.PropagatedGenericClass;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class ExtendsPropagatedGenericClass<A,B> extends PropagatedGenericClass<A,B> {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/generics/FirstLevelGeneric.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance.model.generics;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class FirstLevelGeneric<F, Z> extends AbstractZeroLevelGeneric<Z, String> {\n\n    private F inFirstLevel;\n\n    @Override\n    public Z getInZeroOverriddenInFirst() {\n        return inZeroOverriddenInFirst;\n    }\n\n    @Override\n    public void setInZeroOverriddenInFirst(Z value) {\n        inZeroOverriddenInFirst = value;\n    }\n\n    public F getInFirstLevel() {\n        return inFirstLevel;\n    }\n\n    public void setInFirstLevel(F inFirstLevel) {\n        this.inFirstLevel = inFirstLevel;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/generics/GenericInterface.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance.model.generics;\n\n/**\n * @author Roman Grigoriadi\n */\npublic interface GenericInterface<T> {\n\n    T getGenericValue();\n\n    void setGenericValue(T value);\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/generics/ImplementsGenericInterfaces.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance.model.generics;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class ImplementsGenericInterfaces<A, B> implements GenericInterface<A>, AnotherGenericInterface<B> {\n\n    private A a;\n\n    private B b;\n\n    @Override\n    public B getAnotherGenericValue() {\n        return b;\n    }\n\n    @Override\n    public void setAnotherGenericValue(B value) {\n        this.b = value;\n    }\n\n    @Override\n    public A getGenericValue() {\n        return a;\n    }\n\n    @Override\n    public void setGenericValue(A value) {\n        this.a = value;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/generics/SecondLevelGeneric.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.inheritance.model.generics;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class SecondLevelGeneric<S,SF extends S,Z> extends FirstLevelGeneric<SF,Z> {\n\n    private S inSecondLevel;\n\n    public S getInSecondLevel() {\n        return inSecondLevel;\n    }\n\n    public void setInSecondLevel(S inSecondLevel) {\n        this.inSecondLevel = inSecondLevel;\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/jsonp/JsonpLong.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.jsonp;\n\nimport jakarta.json.JsonNumber;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\n\n/**\n * Test class implementing {@link JsonNumber} interface.\n *\n * @author Dmitry Kornilov\n */\nfinal public class JsonpLong implements JsonNumber {\n    private final long num;\n    private BigDecimal bigDecimal;  // assigning it lazily on demand\n\n    public JsonpLong(long num) {\n        this.num = num;\n    }\n\n    @Override\n    public int intValue() {\n        return bigDecimalValue().intValue();\n    }\n\n    @Override\n    public int intValueExact() {\n        return bigDecimalValue().intValueExact();\n    }\n\n    @Override\n    public BigInteger bigIntegerValue() {\n        return bigDecimalValue().toBigInteger();\n    }\n\n    @Override\n    public BigInteger bigIntegerValueExact() {\n        return bigDecimalValue().toBigIntegerExact();\n    }\n\n\n    @Override\n    public boolean isIntegral() {\n        return true;\n    }\n\n    @Override\n    public long longValue() {\n        return num;\n    }\n\n    @Override\n    public long longValueExact() {\n        return num;\n    }\n\n    @Override\n    public double doubleValue() {\n        return num;\n    }\n\n    @Override\n    public BigDecimal bigDecimalValue() {\n        // reference assignments are atomic. At the most some more temp\n        // BigDecimal objects are created\n        BigDecimal bd = bigDecimal;\n        if (bd == null) {\n            bigDecimal = bd = new BigDecimal(num);\n        }\n        return bd;\n    }\n\n    @Override\n    public ValueType getValueType() {\n        return ValueType.NUMBER;\n    }\n\n    @Override\n    public String toString() {\n        return Long.toString(num);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/jsonp/JsonpString.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.jsonp;\n\nimport jakarta.json.JsonString;\n\n/**\n * Test class implementing {@link JsonString} interface.\n *\n * @author Dmitry Kornilov\n */\npublic class JsonpString implements JsonString {\n\n    private final String value;\n\n    public JsonpString(String value) {\n        this.value = value;\n    }\n\n    @Override\n    public String getString() {\n        return value;\n    }\n\n    @Override\n    public CharSequence getChars() {\n        return value;\n    }\n\n    @Override\n    public ValueType getValueType() {\n        return ValueType.STRING;\n    }\n\n    @Override\n    public int hashCode() {\n        return value.hashCode();\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (!(obj instanceof JsonString)) {\n            return false;\n        }\n        JsonString other = (JsonString) obj;\n        return getString().equals(other.getString());\n    }\n\n    @Override\n    public String toString() {\n        return \"\\\"\" + value + \"\\\"\";\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/jsonp/JsonpTest.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.jsonp;\n\nimport java.math.BigDecimal;\n\nimport jakarta.json.Json;\nimport jakarta.json.JsonArray;\nimport jakarta.json.JsonArrayBuilder;\nimport jakarta.json.JsonBuilderFactory;\nimport jakarta.json.JsonObject;\nimport jakarta.json.JsonObjectBuilder;\nimport jakarta.json.JsonString;\nimport jakarta.json.JsonValue;\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.spi.JsonProvider;\nimport org.eclipse.yasson.defaultmapping.jsonp.model.JsonpPojo;\nimport org.junit.jupiter.api.Test;\n\nimport static org.eclipse.yasson.Jsonbs.defaultJsonb;\nimport static org.hamcrest.CoreMatchers.is;\nimport static org.hamcrest.CoreMatchers.nullValue;\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.assertTrue;\n\n/**\n * Default mapping JSONP integration tests.\n *\n * @author Dmitry Kornilov\n */\npublic class JsonpTest {\n\n    public static class JsonValueWrapper {\n        public JsonValue jsonValue;\n\n        public JsonValueWrapper(JsonValue jsonValue) {\n            this.jsonValue = jsonValue;\n        }\n\n        public JsonValueWrapper() {\n        }\n    }\n\n    @Test\n    public void testInnerJsonObject() {\n\n        final JsonBuilderFactory factory = Json.createBuilderFactory(null);\n        final JsonObject jsonObject = factory.createObjectBuilder()\n                .add(\"name\", \"home\")\n                .add(\"city\", \"Prague\")\n                .build();\n\n        final JsonObjectBuilder customerBuilder = factory.createObjectBuilder();\n        customerBuilder.add(\"f1\", \"abc123\");\n        customerBuilder.add(\"f2\", BigDecimal.TEN);\n        customerBuilder.add(\"f3\", 12);\n        customerBuilder.add(\"city\", jsonObject);\n\n        final JsonObjectBuilder wrapperBuilder = factory.createObjectBuilder();\n        wrapperBuilder.add(\"f1\", \"abc\");\n        wrapperBuilder.add(\"cust\", customerBuilder);\n\n        final JsonObject wrapper = wrapperBuilder.build();\n\n        String expected = \"{\\\"f1\\\":\\\"abc\\\",\\\"cust\\\":{\\\"f1\\\":\\\"abc123\\\",\\\"f2\\\":10,\\\"f3\\\":12,\\\"city\\\":{\\\"name\\\":\\\"home\\\",\\\"city\\\":\\\"Prague\\\"}}}\";\n        assertEquals(expected, defaultJsonb.toJson(wrapper));\n\n        JsonObject result = defaultJsonb.fromJson(expected, JsonObject.class);\n        assertEquals(\"home\", result.getJsonObject(\"cust\").getJsonObject(\"city\").getString(\"name\"));\n        assertEquals(\"abc123\", result.getJsonObject(\"cust\").getString(\"f1\"));\n        assertEquals(\"abc123\", result.getJsonObject(\"cust\").getString(\"f1\"));\n\n    }\n\n    @Test\n    public void testMarshallJsonArray() {\n\n        final JsonBuilderFactory factory = Json.createBuilderFactory(null);\n        final JsonArray jsonArray = factory.createArrayBuilder()\n                .add(1)\n                .add(2)\n                .build();\n\n        assertEquals(\"{\\\"jsonValue\\\":[1,2]}\", defaultJsonb.toJson(new JsonValueWrapper(jsonArray)));\n    }\n\n    @Test\n    public void testMarshallJsonValue() {\n        assertEquals(\"{\\\"jsonValue\\\":true}\", defaultJsonb.toJson(new JsonValueWrapper(JsonValue.TRUE)));\n    }\n\n    @Test\n    public void testMarshallJsonNumber() {\n                assertEquals(\"{\\\"jsonValue\\\":10}\", defaultJsonb.toJson(new JsonValueWrapper(new JsonpLong(10))));\n    }\n\n    @Test\n    public void testMarshallJsonString() {\n                assertEquals(\"{\\\"jsonValue\\\":\\\"hello\\\"}\", defaultJsonb.toJson(new JsonValueWrapper(new JsonpString(\"hello\"))));\n    }\n\n    @Test\n    public void testJsonPojo() {\n        JsonbConfig config = new JsonbConfig();\n//        config.withFormatting(true);\n        Jsonb jsonb = JsonbBuilder.create(config);\n\n\n        JsonpPojo pojo = new JsonpPojo();\n        final JsonObjectBuilder obj1builder = JsonProvider.provider().createObjectBuilder();\n        obj1builder.add(\"strVal\", \"string value\");\n        obj1builder.add(\"numVal\", 2.0d);\n        obj1builder.addNull(\"nullVal\");\n        obj1builder.add(\"boolVal\", Boolean.TRUE);\n\n        final JsonObjectBuilder obj2Builder = JsonProvider.provider().createObjectBuilder();\n        obj2Builder.add(\"innerStr\", \"string val\");\n        obj2Builder.add(\"innerNum\", 11.1d);\n        final JsonObject obj2 = obj2Builder.build();\n\n        JsonArrayBuilder array1Builder = JsonProvider.provider().createArrayBuilder();\n        array1Builder.addNull().add(false).add(11L).add(BigDecimal.TEN).add(\"array STR value\").add(obj2);\n        JsonArray jsonArray1 = array1Builder.build();\n\n        obj1builder.add(\"innerJsonObject\", obj2);\n        obj1builder.add(\"innerArrayObject\", jsonArray1);\n\n        final JsonObject obj1 = obj1builder.build();\n        pojo.jsonObject = obj1;\n\n        JsonArrayBuilder arrayBuilder = JsonProvider.provider().createArrayBuilder();\n        arrayBuilder.add(obj1).add(true).add(obj2).add(101.0d).add(BigDecimal.TEN);\n        pojo.jsonArray = arrayBuilder.build();\n\n\n        String expected = \"{\\\"jsonArray\\\":[{\\\"strVal\\\":\\\"string value\\\",\\\"numVal\\\":2.0,\\\"nullVal\\\":null,\\\"boolVal\\\":true,\\\"innerJsonObject\\\":{\\\"innerStr\\\":\\\"string val\\\",\\\"innerNum\\\":11.1},\\\"innerArrayObject\\\":[null,false,11,10,\\\"array STR value\\\",{\\\"innerStr\\\":\\\"string val\\\",\\\"innerNum\\\":11.1}]},true,{\\\"innerStr\\\":\\\"string val\\\",\\\"innerNum\\\":11.1},101.0,10],\\\"jsonObject\\\":{\\\"strVal\\\":\\\"string value\\\",\\\"numVal\\\":2.0,\\\"nullVal\\\":null,\\\"boolVal\\\":true,\\\"innerJsonObject\\\":{\\\"innerStr\\\":\\\"string val\\\",\\\"innerNum\\\":11.1},\\\"innerArrayObject\\\":[null,false,11,10,\\\"array STR value\\\",{\\\"innerStr\\\":\\\"string val\\\",\\\"innerNum\\\":11.1}]}}\";\n        final String actual = jsonb.toJson(pojo);\n        assertEquals(expected, actual);\n\n        JsonpPojo result = jsonb.fromJson(expected, JsonpPojo.class);\n        assertEquals(pojo.jsonObject, result.jsonObject);\n        assertEquals(pojo.jsonArray, result.jsonArray);\n    }\n\n    @Test\n    public void testJsonObject() {\n        final JsonObjectBuilder objBuilder = JsonProvider.provider().createObjectBuilder();\n        objBuilder.add(\"boolTrue\", Boolean.TRUE).add(\"boolFalse\", Boolean.FALSE)\n                .addNull(\"null\").add(\"str\", \"String\");\n\n        JsonArrayBuilder arrBuilder = JsonProvider.provider().createArrayBuilder();\n        arrBuilder.add(11L).add(Boolean.FALSE).add(BigDecimal.TEN);\n        objBuilder.add(\"array\", arrBuilder);\n\n        JsonObject object = objBuilder.build();\n\n        String expected = \"{\\\"boolTrue\\\":true,\\\"boolFalse\\\":false,\\\"null\\\":null,\\\"str\\\":\\\"String\\\",\\\"array\\\":[11,false,10]}\";\n        assertEquals(expected, defaultJsonb.toJson(object));\n\n        JsonObject result = defaultJsonb.fromJson(expected, JsonObject.class);\n\n        assertEquals(object, result);\n    }\n\n    @Test\n    public void testJsonArray() {\n\n        JsonArrayBuilder arrBuilder = JsonProvider.provider().createArrayBuilder();\n        arrBuilder.add(11L).add(Boolean.FALSE).add(BigDecimal.TEN);\n\n        JsonObjectBuilder objBuilder = JsonProvider.provider().createObjectBuilder();\n        objBuilder.add(\"boolTrue\", Boolean.TRUE).add(\"boolFalse\", Boolean.FALSE)\n                .addNull(\"null\").add(\"str\", \"String\");\n\n        arrBuilder.add(objBuilder);\n\n        JsonArray arr = arrBuilder.build();\n\n        String expected = \"[11,false,10,{\\\"boolTrue\\\":true,\\\"boolFalse\\\":false,\\\"null\\\":null,\\\"str\\\":\\\"String\\\"}]\";\n        assertEquals(expected, defaultJsonb.toJson(arr));\n\n        JsonArray result = defaultJsonb.fromJson(expected, JsonArray.class);\n\n        assertEquals(arr, result);\n    }\n\n    @Test\n    public void testJsonObjectAsValue() {\n        final JsonValueWrapper jsonValueWrapper = defaultJsonb.fromJson(\"{ \\\"jsonValue\\\" : { \\\"stringInstance\\\" : \\\"Test String\\\" } }\", JsonValueWrapper.class);\n        assertEquals(\"Test String\", ((JsonObject) jsonValueWrapper.jsonValue).getString(\"stringInstance\"));\n    }\n\n    @Test\n    public void testJsonValueString() {\n        JsonValueWrapper pojo = new JsonValueWrapper(Json.createValue(\"abc\"));\n        String json = defaultJsonb.toJson(pojo);\n        assertEquals(\"{\\\"jsonValue\\\":\\\"abc\\\"}\", json);\n\n        JsonValueWrapper result = defaultJsonb.fromJson(\"{\\\"jsonValue\\\":\\\"def\\\"}\", JsonValueWrapper.class);\n        assertTrue(result.jsonValue instanceof  JsonString);\n        assertEquals(\"def\", ((JsonString)result.jsonValue).getString());\n    }\n\n    @Test\n    public void testJsonValueAsObject() {\n        JsonObject build = Json.createObjectBuilder().add(\"prop1\", \"val1\")\n                .add(\"prop2\", \"val2\")\n                .add(\"innerObj1\", Json.createObjectBuilder().add(\"inner1\", \"innerVal1\").build())\n                .build();\n        JsonValueWrapper pojo = new JsonValueWrapper(build);\n        String expected = \"{\\\"jsonValue\\\":{\\\"prop1\\\":\\\"val1\\\",\\\"prop2\\\":\\\"val2\\\",\\\"innerObj1\\\":{\\\"inner1\\\":\\\"innerVal1\\\"}}}\";\n        String json = defaultJsonb.toJson(pojo);\n        assertEquals(expected, json);\n\n        JsonValueWrapper result = defaultJsonb.fromJson(expected, JsonValueWrapper.class);\n        assertTrue(result.jsonValue instanceof JsonObject);\n        JsonObject jsonObject = (JsonObject) result.jsonValue;\n        assertEquals(\"val1\", jsonObject.getString(\"prop1\"));\n        assertEquals(\"innerVal1\", jsonObject.getJsonObject(\"innerObj1\").getString(\"inner1\"));\n    }\n\n    @Test\n    public void testJsonValueAsArray() {\n        JsonArray jsonArray = Json.createArrayBuilder().add(1).add(2).add(3).add(Json.createObjectBuilder().add(\"a\",\"b\").build()).build();\n        JsonValueWrapper pojo = new JsonValueWrapper(jsonArray);\n        String expected = \"{\\\"jsonValue\\\":[1,2,3,{\\\"a\\\":\\\"b\\\"}]}\";\n        String json = defaultJsonb.toJson(pojo);\n        assertEquals(expected, json);\n\n        JsonValueWrapper result = defaultJsonb.fromJson(expected, JsonValueWrapper.class);\n        assertTrue(result.jsonValue instanceof JsonArray);\n        JsonArray resultArray = (JsonArray) result.jsonValue;\n        assertEquals(1, resultArray.getInt(0));\n        assertEquals(2, resultArray.getInt(1));\n        assertEquals(3, resultArray.getInt(2));\n        assertEquals(\"b\", resultArray.getJsonObject(3).getString(\"a\"));\n\n    }\n\n    @Test\n    public void testJsonNullValue() {\n        JsonValueWrapper pojo = new JsonValueWrapper(null);\n        String expected = \"{}\";\n        String json = defaultJsonb.toJson(pojo);\n        assertThat(json, is(expected));\n        JsonValueWrapper deserialized = defaultJsonb.fromJson(expected, JsonValueWrapper.class);\n        assertThat(deserialized.jsonValue, nullValue());\n        deserialized = defaultJsonb.fromJson(\"{\\\"jsonValue\\\":null}\", JsonValueWrapper.class);\n        assertThat(deserialized.jsonValue, is(JsonValue.NULL));\n    }\n\n    @Test\n    public void testJsonpNullValues() {\n        JsonpPojo pojo = new JsonpPojo();\n        String expected = \"{}\";\n        String nullValues = \"{\\\"jsonObject\\\":null, \\\"jsonArray\\\":null, \\\"jsonNumber\\\":null, \\\"jsonString\\\":null, \"\n                + \"\\\"jsonValue\\\":null }\";\n        String json = defaultJsonb.toJson(pojo);\n        assertThat(json, is(expected));\n        JsonpPojo deserialized = defaultJsonb.fromJson(expected, JsonpPojo.class);\n        assertThat(deserialized.jsonObject, nullValue());\n        deserialized = defaultJsonb.fromJson(nullValues, JsonpPojo.class);\n        assertThat(deserialized.jsonObject, nullValue());\n        assertThat(deserialized.jsonArray, nullValue());\n        assertThat(deserialized.jsonNumber, nullValue());\n        assertThat(deserialized.jsonString, nullValue());\n        assertThat(deserialized.jsonValue, is(JsonValue.NULL));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/jsonp/model/JsonpPojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.jsonp.model;\n\nimport jakarta.json.*;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class JsonpPojo {\n\n    public JsonObject jsonObject;\n\n    public JsonArray jsonArray;\n\n    public JsonNumber jsonNumber;\n\n    public JsonString jsonString;\n\n    public JsonValue jsonValue;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/lambda/Addressable.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.lambda;\n\n/**\n * A functional interface with no default properties.\n */\npublic interface Addressable {\n\n    /**\n     * Public readable property.\n     *\n     * @return name to be addressed with\n     */\n    String getName();\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/lambda/Cat.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.lambda;\n\n/**\n * Class used to control serialization of lambda expression generated from functional interfaces with defaults.\n */\npublic class Cat implements Pet {\n\n    private String name;\n\n    Cat(String name) {\n        this.name = name;\n    }\n\n    @Override\n    public String getName() {\n        return this.name;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/lambda/LambdaExpressionTest.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.lambda;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\n/**\n * Test marshalling objects generated using lambda expressions.\n *\n * Scenarios test lambda-generated objects serialization against concrete class objects serialization. It is thus\n * assumed that concrete class behaviour is tested successfully elsewhere.\n */\npublic class LambdaExpressionTest {\n\n    @Test\n    public void testMarshallFunctionalInterface() {\n        String name = \"WALL-E\";\n        Addressable control = new Robot(name);\n        Addressable lambda = () -> name;\n        assertEquals(defaultJsonb.toJson(control), defaultJsonb.toJson(lambda));\n    }\n\n    @Test\n    public void testMarshallFunctionalInterfaceWithDefaultProperties() {\n        String name = \"Cheshire\";\n        Pet control = new Cat(name);\n        Pet lambda = () -> name;\n        assertEquals(defaultJsonb.toJson(control), defaultJsonb.toJson(lambda));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/lambda/Pet.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.lambda;\n\n/**\n * A functional interface with one default property.\n */\npublic interface Pet extends Addressable {\n\n    /**\n     * Public readable property with default value.\n     *\n     * @return pet's age in months\n     */\n    default int getAge() {\n        return 0;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/lambda/Robot.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.lambda;\n\n/**\n * Class used to control serialization of lambda expression generated from functional interfaces with no defaults.\n */\npublic class Robot implements Addressable {\n\n    private String name;\n\n    Robot(String name) {\n        this.name = name;\n    }\n\n    @Override\n    public String getName() {\n        return this.name;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/modifiers/ClassModifiersTest.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.modifiers;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.Assertions;\nimport org.eclipse.yasson.defaultmapping.modifiers.model.ChildOfPackagePrivateParent;\n\n/**\n * Test access modifiers on classes\n *\n * @author David Kral\n */\npublic class ClassModifiersTest {\n\n    @Test\n    public void testPackagePrivateParent() {\n        ChildOfPackagePrivateParent child = new ChildOfPackagePrivateParent();\n        child.id = 1;\n        child.name = \"SomeName\";\n        String json = defaultJsonb.toJson(child);\n        assertEquals(\"{\\\"id\\\":1,\\\"name\\\":\\\"SomeName\\\"}\", json);\n        ChildOfPackagePrivateParent result = defaultJsonb.fromJson(json, ChildOfPackagePrivateParent.class);\n        assertEquals(child.id, result.id);\n        assertEquals(child.name, result.name);\n    }\n\n\n    class NestedPackageParent {\n        public int id;\n    }\n\n    public class NestedPackageChild extends NestedPackageParent {\n        public String name;\n    }\n\n    @Test\n    public void testNestedPackagePrivateParent() {\n        NestedPackageChild child = new NestedPackageChild();\n        child.id = 1;\n        child.name = \"SomeName\";\n        Assertions.shouldFail(() -> defaultJsonb.toJson(child),\n                msg -> msg.contains(\"java.lang.IllegalAccessException\") &&\n                       msg.contains(\"Error accessing field 'id' declared in \" +\n                                    \"'class org.eclipse.yasson.defaultmapping.modifiers.ClassModifiersTest$NestedPackageParent'\"));\n    }\n\n    private class NestedPrivateParent {\n        public int id;\n    }\n\n    public class NestedPrivateChild extends NestedPrivateParent {\n        public String name;\n    }\n\n    @Test\n    public void testNestedPrivateParent() {\n        NestedPrivateChild child = new NestedPrivateChild();\n        child.id = 1;\n        child.name = \"SomeName\";\n        Assertions.shouldFail(() -> defaultJsonb.toJson(child),\n                msg -> msg.contains(\"java.lang.IllegalAccessException\") &&\n                       msg.contains(\"Error accessing field 'id' declared in \" +\n                                    \"'class org.eclipse.yasson.defaultmapping.modifiers.ClassModifiersTest$NestedPrivateParent'\"));\n    }\n\n\n    static class NestedStaticPackageParent {\n        public int id;\n    }\n\n    public static class NestedStaticPackageChild extends NestedStaticPackageParent {\n        public String name;\n    }\n\n    @Test\n    public void testNestedStaticPackagePrivateParent() {\n        NestedStaticPackageChild child = new NestedStaticPackageChild();\n        child.id = 1;\n        child.name = \"SomeName\";\n        Assertions.shouldFail(() -> defaultJsonb.toJson(child),\n                msg -> msg.contains(\"java.lang.IllegalAccessException\") &&\n                       msg.contains(\"Error accessing field 'id' declared in \" +\n                                    \"'class org.eclipse.yasson.defaultmapping.modifiers.ClassModifiersTest$NestedStaticPackageParent'\"));\n    }\n\n    private static class NestedStaticPrivateParent {\n        public int id;\n    }\n\n    public static class NestedStaticPrivateChild extends NestedStaticPrivateParent {\n        public String name;\n    }\n\n    @Test\n    public void testNestedStaticPrivateParent() {\n        NestedStaticPrivateChild child = new NestedStaticPrivateChild();\n        child.id = 1;\n        child.name = \"SomeName\";\n        Assertions.shouldFail(() -> defaultJsonb.toJson(child),\n                msg -> msg.contains(\"java.lang.IllegalAccessException\") &&\n                       msg.contains(\"Error accessing field 'id' declared in \" +\n                                   \"'class org.eclipse.yasson.defaultmapping.modifiers.ClassModifiersTest$NestedStaticPrivateParent'\"));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/modifiers/DefaultMappingModifiersTest.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.modifiers;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.defaultmapping.modifiers.model.Person;\nimport org.eclipse.yasson.defaultmapping.modifiers.model.FieldModifiersClass;\nimport org.eclipse.yasson.defaultmapping.modifiers.model.MethodModifiersClass;\nimport org.eclipse.yasson.defaultmapping.modifiers.model.PrivateConstructorClass;\nimport org.eclipse.yasson.defaultmapping.modifiers.model.ProtectedConstructorClass;\n\nimport jakarta.json.bind.JsonbException;\n\n/**\n * Test access modifiers for default mapping.\n *\n * @author Roman Grigoriadi\n */\npublic class DefaultMappingModifiersTest {\n\n    @Test\n    public void testFieldModifiers() {\n        FieldModifiersClass fieldModifiersClass = new FieldModifiersClass();\n        assertEquals(\"{\\\"finalString\\\":\\\"FINAL_STRING\\\"}\", defaultJsonb.toJson(fieldModifiersClass));\n        FieldModifiersClass result = defaultJsonb.fromJson(\"{\\\"finalString\\\":\\\"FINAL_STRING\\\",\\\"staticString\\\":\\\"STATIC_STRING\\\",\\\"transientString\\\":\\\"TRANSIENT_STRING\\\"}\", FieldModifiersClass.class);\n        //no setter throwing illegal has been called.\n    }\n\n    @Test\n    public void testMethodModifiers() {\n        MethodModifiersClass methodModifiers = new MethodModifiersClass();\n        methodModifiers.publicFieldWithoutMethods = \"WITHOUT_METHODS\";\n\n        String validJson = \"{\\\"getterWithoutFieldValue\\\":\\\"GETTER_WITHOUT_FIELD\\\",\\\"publicFieldWithoutMethods\\\":\\\"WITHOUT_METHODS\\\"}\";\n        assertEquals(validJson, defaultJsonb.toJson(methodModifiers));\n\n        MethodModifiersClass result = defaultJsonb.fromJson(\"{\\\"publicFieldWithPrivateMethods\\\":\\\"value\\\"}\", MethodModifiersClass.class);\n        assertNull(result.publicFieldWithPrivateMethods);\n\n        result = defaultJsonb.fromJson(validJson, MethodModifiersClass.class);\n        assertEquals(\"WITHOUT_METHODS\", result.publicFieldWithoutMethods);\n    }\n\n    @Test\n    public void testConstructorModifiers() {\n        try{\n            ProtectedConstructorClass instance = defaultJsonb.fromJson(\"{\\\"randomField\\\":\\\"test\\\"}\", ProtectedConstructorClass.class);\n            assertEquals(instance.randomField, \"test\");\n        } catch (JsonbException e){\n            fail(\"No exception should be thrown for protected constructor\");\n            throw e;\n        }\n        try {\n        \tdefaultJsonb.fromJson(\"{\\\"randomField\\\":\\\"test\\\"}\", PrivateConstructorClass.class);\n            fail(\"Exception should have been thrown\");\n        }catch (JsonbException e){\n            assertTrue(e.getMessage().endsWith(\"Can't create instance\"));\n        }\n    }\n\n    @Test\n    public void testMultipleInstancesOfSameType() {\n        Person person = new Person();\n        Person personTwo = new Person();\n        person.name = \"Person 1\";\n        personTwo.name = \"Person 2\";\n        person.child = personTwo;\n\n        assertEquals(\"{\\\"child\\\":{\\\"name\\\":\\\"Person 2\\\"},\\\"name\\\":\\\"Person 1\\\"}\", bindingJsonb.toJson(person));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/modifiers/model/ChildOfPackagePrivateParent.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.modifiers.model;\n\n/**\n * @author David Kral\n */\npublic class ChildOfPackagePrivateParent extends PackagePrivateParent {\n\n    public String name;\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/modifiers/model/FieldModifiersClass.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.modifiers.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class FieldModifiersClass {\n\n    private final String finalString = \"FINAL_STRING\";\n\n    private static final Long serialVersionUID = Long.MAX_VALUE;\n\n    private static String staticString = \"STATIC_STRING\";\n\n    private transient String transientString = \"TRANSIENT_STRING\";\n\n    public String getFinalString() {\n        return finalString;\n    }\n\n    public void setFinalString() {\n        throw new IllegalStateException();\n    }\n\n    public static Long getSerialVersionUID() {\n        throw new IllegalStateException();\n    }\n\n    public String getTransientString() {\n        throw new IllegalStateException();\n    }\n\n    public void setTransientString(String transientString) {\n        throw new IllegalStateException();\n    }\n\n    public static String getStaticString() {\n        throw new IllegalStateException();\n    }\n\n    public static void setStaticString(String staticString) {\n        throw new IllegalStateException();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/modifiers/model/MethodModifiersClass.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.modifiers.model;\n\nimport java.util.function.Consumer;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class MethodModifiersClass {\n\n    private Consumer<String> setterWithoutFieldConsumer = s -> {};\n\n    public String publicFieldWithPrivateMethods;\n\n    public String publicFieldWithoutMethods;\n\n    public void setSetterWithoutFieldConsumer(Consumer<String> setterWithoutFieldConsumer) {\n        this.setterWithoutFieldConsumer = setterWithoutFieldConsumer;\n    }\n\n    public String getGetterWithoutFieldValue() {\n        return \"GETTER_WITHOUT_FIELD\";\n    }\n\n    public void setGetterWithoutFieldValue(String value) {\n        setterWithoutFieldConsumer.accept(value);\n    }\n\n    private String getPublicFieldWithPrivateMethods() {\n        return publicFieldWithPrivateMethods;\n    }\n\n    private void setPublicFieldWithPrivateMethods(String publicFieldWithPrivateMethods) {\n        this.publicFieldWithPrivateMethods = publicFieldWithPrivateMethods;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/modifiers/model/PackagePrivateParent.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.modifiers.model;\n\n/**\n * @author David Kral\n */\nclass PackagePrivateParent {\n\n    public int id;\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/modifiers/model/Person.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.modifiers.model;\n\n/**\n * @author David Kral\n */\npublic class Person {\n\n    public String name;\n\n    public Person child;\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/modifiers/model/PrivateConstructorClass.java",
    "content": "/*\n * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.modifiers.model;\n\n/**\n * @author David Kral\n */\npublic class PrivateConstructorClass {\n\n    public String randomField;\n\n    private PrivateConstructorClass(){\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/modifiers/model/ProtectedConstructorClass.java",
    "content": "/*\n * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.modifiers.model;\n\n/**\n * @author David Kral\n */\npublic class ProtectedConstructorClass {\n\n    public String randomField;\n\n    protected ProtectedConstructorClass(){\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/properties/PropertiesTest.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.properties;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\n\nimport java.io.IOException;\nimport java.util.Locale;\n\n/**\n * This class contains properties tests\n *\n * @author David Kral\n */\npublic class PropertiesTest {\n\n    @Test\n    public void testPropertiesWithoutLocale() throws IOException {\n        String template = \"Process class: {0} from json using converter: {1}\";\n        String message = Messages.getMessage(MessageKeys.PROCESS_FROM_JSON);\n\n        assertEquals(template, message);\n    }\n\n    @Test\n    public void testPropertiesWithLocale() throws IOException {\n        String templateCS = \"Zpracovávám třídu: {0} do jsonu za použití convertoru: {1}\";\n        String messageCS = Messages.getMessage(MessageKeys.PROCESS_TO_JSON, new Locale(\"cs\"));\n        String templateEN = \"Process class: {0} to json using converter: {1}\";\n        String messageEN = Messages.getMessage(MessageKeys.PROCESS_TO_JSON, new Locale(\"en\"));\n\n        assertEquals(templateCS, messageCS);\n        assertEquals(templateEN, messageEN);\n    }\n\n    @Test\n    public void testPropertiesAttributeSetting() throws IOException {\n        String template = \"Zpracovávám třídu: Test do jsonu za použití convertoru: Test1\";\n        String message = Messages.getMessage(MessageKeys.PROCESS_TO_JSON, new Locale(\"cs\"), \"Test\", \"Test1\");\n\n        assertEquals(template, message);\n    }\n\n}\n\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/CustomerTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific;\n\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport org.eclipse.yasson.defaultmapping.specific.model.Address;\nimport org.eclipse.yasson.defaultmapping.specific.model.Customer;\nimport org.eclipse.yasson.defaultmapping.specific.model.Street;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\n/**\n * @author Roman Grigoriadi\n */\npublic abstract class CustomerTest {\n\n    protected void assertCustomerValues(Customer customer, String customerName) {\n        assertEquals(customerName, customer.getName());\n        assertEquals(Integer.valueOf(33), customer.getAge());\n        /*assertEquals(1, customer.getAddresses().size());\n        for (Address address : customer.getAddresses()) {\n            assertEquals(\"Prague\", address.getTown());\n            assertEquals(\"Zoubkova88\", address.getStreet().getName());\n            assertEquals(Integer.valueOf(111), address.getStreet().getNumber());\n        }*/\n\n        if (customer.getStrings() != null) {\n            assertEquals(2, customer.getStrings().size());\n            assertEquals(\"green\", customer.getStrings().get(0));\n            assertEquals(\"yellow\", customer.getStrings().get(1));\n        }\n\n        if (customer.getIntegers() != null) {\n            assertEquals(2, customer.getIntegers().size());\n            assertEquals(Integer.valueOf(0),  customer.getIntegers().get(0));\n            assertEquals(Integer.valueOf(1), customer.getIntegers().get(1));\n        }\n\n        /*assertEquals(2, customer.getStringIntegerMap().size());\n        assertEquals(Integer.valueOf(1), customer.getStringIntegerMap().get(\"first\"));\n        assertEquals(Integer.valueOf(2), customer.getStringIntegerMap().get(\"second\"));*/\n    }\n\n    protected static Customer createCustomer(String customerName) {\n        Street street = new Street(\"Zoubkova\", 111);\n        Address address = new Address(street, \"Prague\");\n        Customer customer = new Customer(33, customerName);\n\n        List<Address> addresses = new ArrayList<>();\n        addresses.add(address);\n        customer.setAddresses(addresses);\n\n        List<String> strings = new ArrayList<>();\n        strings.add(\"green\");\n        strings.add(\"yellow\");\n        customer.setStrings(strings);\n\n        List<Integer> integers = new ArrayList<>();\n        integers.add(0);\n        integers.add(1);\n        customer.setIntegers(integers);\n\n        Map<String, Integer> stringIntegerMap = new HashMap<>();\n        stringIntegerMap.put(\"first\", 1);\n        stringIntegerMap.put(\"second\", 2);\n        customer.setStringIntegerMap(stringIntegerMap);\n\n        List<List<Integer>> listOfListsOfIntegers = new ArrayList<>();\n        for(int i=0; i<3; i++) {\n            List<Integer> integerList = new ArrayList<>();\n            integerList.add(0);\n            integerList.add(1);\n            integerList.add(2);\n            listOfListsOfIntegers.add(integerList);\n        }\n\n        customer.setListOfListsOfIntegers(listOfListsOfIntegers);\n\n        return customer;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/JsonStreamsTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.TestTypeToken;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.ByteArrayOutputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.nio.charset.Charset;\nimport java.util.HashMap;\nimport java.util.Map;\n\n/**\n * Tests calling JSONB with {@link java.util.stream.Stream} and {@link Readable}\n *\n * @author Roman Grigoriadi\n */\npublic class JsonStreamsTest {\n    private static final String CHARSET = \"UTF8\";\n\n    @Test\n    public void testUnmarshall() throws Exception {\n\n        String json = \"{\\\"key1\\\":\\\"value1\\\",\\\"key2\\\":\\\"value2\\\"}\";\n\n        Map<String, String> result = defaultJsonb.fromJson(new InputStreamReader(new ByteArrayInputStream(json.getBytes(CHARSET)), Charset.forName(CHARSET)), new TestTypeToken<HashMap<String, String>>(){}.getType());\n        assertMapValues(result);\n\n        result = defaultJsonb.fromJson(new ByteArrayInputStream(json.getBytes(CHARSET)), new TestTypeToken<HashMap<String, String>>() {}.getType());\n        assertMapValues(result);\n    }\n\n    @Test\n    public void testMarshall() throws Exception {\n        String expected = \"{\\\"key1\\\":\\\"value1\\\",\\\"key2\\\":\\\"value2\\\"}\";\n        int len = expected.getBytes(CHARSET).length;\n\n        Map<String, String> strMap = new HashMap<>();\n        strMap.put(\"key1\", \"value1\");\n        strMap.put(\"key2\", \"value2\");\n\n        ByteArrayOutputStream baos = new ByteArrayOutputStream(len);\n        defaultJsonb.toJson(strMap, baos);\n        assertEquals(expected, baos.toString(CHARSET));\n\n        baos = new ByteArrayOutputStream(len);\n        OutputStreamWriter writer = new OutputStreamWriter(baos, Charset.forName(CHARSET));\n        defaultJsonb.toJson(strMap, writer);\n        writer.close();\n\n        assertEquals(expected, baos.toString(CHARSET));\n    }\n\n    private static void assertMapValues(Map<String, String> result) {\n        assertEquals(2, result.size());\n        assertEquals(\"value1\", result.get(\"key1\"));\n        assertEquals(\"value2\", result.get(\"key2\"));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/NullTest.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n * Copyright (c) 2019, 2020 Payara Foundation and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific;\n\nimport org.eclipse.yasson.defaultmapping.specific.model.StreetWithPrimitives;\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.TestTypeToken;\nimport org.eclipse.yasson.defaultmapping.specific.model.Street;\n\nimport java.util.List;\nimport java.util.Map;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class NullTest {\n\n    @Test\n    public void testSetsNullIntoFields() {\n        String json = \"{\\\"name\\\":null,\\\"number\\\":null}\";\n\n        Street result = defaultJsonb.fromJson(json, Street.class);\n        //these have default initialization value\n        assertNull(result.getName());\n        assertNull(result.getNumber());\n    }\n//\n//    @Test\n//    public void testSetsNullToPrimitives() {\n//        String json = \"{\\\"name\\\":null,\\\"number\\\":null}\";\n//\n//        StreetWithPrimitives result = defaultJsonb.fromJson(json, StreetWithPrimitives.class);\n//        //these have default initialization value\n//        assertNull(result.getName());\n//        assertNull(result.getNumber());\n//    }\n\n    @Test\n    public void testDeserializeNull() {\n        assertNull(defaultJsonb.fromJson(\"null\", Object.class));\n    }\n\n    @Test\n    public void testDeserializeNullPojo() {\n        assertNull(defaultJsonb.fromJson(\"null\", Street.class));\n    }\n\n    @Test\n    public void testDeserializeNullList() {\n        assertNull(defaultJsonb.fromJson(\"null\", new TestTypeToken<List<Integer>>() {}.getType()));\n    }\n\n    @Test\n    public void testDeserializeNullMap() {\n        assertNull(defaultJsonb.fromJson(\"null\", new TestTypeToken<Map<String, Street>>() {}.getType()));\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/ObjectGraphTest.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.defaultmapping.specific.model.Customer;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class ObjectGraphTest extends CustomerTest {\n    private static final String EXPECTED = \"{\\\"addresses\\\":[{\\\"street\\\":{\\\"name\\\":\\\"Zoubkova\\\",\\\"number\\\":111},\\\"town\\\":\\\"Prague\\\"}],\\\"age\\\":33,\\\"friends\\\":{\\\"firstFriend\\\":{\\\"addresses\\\":[{\\\"street\\\":{\\\"name\\\":\\\"Zoubkova\\\",\\\"number\\\":111},\\\"town\\\":\\\"Prague\\\"}],\\\"age\\\":33,\\\"integers\\\":[0,1],\\\"listOfListsOfIntegers\\\":[[0,1,2],[0,1,2],[0,1,2]],\\\"name\\\":\\\"Jasons first friend\\\",\\\"stringIntegerMap\\\":{\\\"first\\\":1,\\\"second\\\":2},\\\"strings\\\":[\\\"green\\\",\\\"yellow\\\"]},\\\"secondFriend\\\":{\\\"addresses\\\":[{\\\"street\\\":{\\\"name\\\":\\\"Zoubkova\\\",\\\"number\\\":111},\\\"town\\\":\\\"Prague\\\"}],\\\"age\\\":33,\\\"integers\\\":[0,1],\\\"listOfListsOfIntegers\\\":[[0,1,2],[0,1,2],[0,1,2]],\\\"name\\\":\\\"Jasons second friend\\\",\\\"stringIntegerMap\\\":{\\\"first\\\":1,\\\"second\\\":2},\\\"strings\\\":[\\\"green\\\",\\\"yellow\\\"]}},\\\"integers\\\":[0,1],\\\"listOfListsOfIntegers\\\":[[0,1,2],[0,1,2],[0,1,2]],\\\"name\\\":\\\"Root Jason Customer\\\",\\\"stringIntegerMap\\\":{\\\"first\\\":1,\\\"second\\\":2},\\\"strings\\\":[\\\"green\\\",\\\"yellow\\\"]}\";\n\n    @Test\n    public void testObjectToJson() {\n        Customer customer = createCustomer(\"Root Jason Customer\");\n\n        Map<String, Customer> friends = new HashMap<>();\n        friends.put(\"firstFriend\", createCustomer(\"Jasons first friend\"));\n        friends.put(\"secondFriend\", createCustomer(\"Jasons second friend\"));\n        customer.setFriends(friends);\n\n        assertEquals(EXPECTED, bindingJsonb.toJson(customer));\n    }\n\n    @Test\n    public void testObjectFromJson() {\n        Customer customer = bindingJsonb.fromJson(EXPECTED, Customer.class);\n        assertCustomerValues(customer, \"Root Jason Customer\");\n        assertEquals(2, customer.getFriends().size());\n        assertCustomerValues(customer.getFriends().get(\"firstFriend\"), \"Jasons first friend\");\n        assertCustomerValues(customer.getFriends().get(\"secondFriend\"), \"Jasons second friend\");\n    }\n\n    @Test\n    public void testSimpleObject() {\n        Person person = new Person();\n        person.name = \"David\";\n        person.surname = \"Kral\";\n        String json = bindingJsonb.toJson(person);\n        Person deser = bindingJsonb.fromJson(json, Person.class);\n        System.out.println();\n    }\n\n    public static class Person {\n\n        public String name;\n\n        public String surname;\n\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/OptionalTest.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n * Copyright (c) 2019, 2020 Payara Foundation and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific;\n\nimport org.eclipse.yasson.defaultmapping.specific.model.SpecificOptionalWrapper;\nimport org.junit.jupiter.api.*;\n\nimport static org.hamcrest.CoreMatchers.is;\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.TestTypeToken;\nimport org.eclipse.yasson.defaultmapping.generics.model.ScalarValueWrapper;\nimport org.eclipse.yasson.defaultmapping.specific.model.OptionalWrapper;\nimport org.eclipse.yasson.defaultmapping.specific.model.NotMatchingGettersAndSetters;\nimport org.eclipse.yasson.defaultmapping.specific.model.Street;\nimport org.eclipse.yasson.internal.JsonBindingBuilder;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport java.util.*;\n\n/**\n * Default mapping Optional* tests.\n *\n * @author Dmitry Kornilov\n */\npublic class OptionalTest {\n\n\n    @Test\n    public void testOptionalString() {\n        assertEquals(\"{\\\"value\\\":\\\"abc\\\"}\", bindingJsonb.toJson(new ScalarValueWrapper<>(Optional.of(\"abc\"))));\n\n        ScalarValueWrapper<Optional> result = bindingJsonb.fromJson(\"{\\\"value\\\":\\\"abc\\\"}\", new TestTypeToken<ScalarValueWrapper<Optional>>() {}.getType());\n        assertEquals(Optional.of(\"abc\"), result.getValue());\n    }\n\n    @Test\n    public void testOptionalObject() {\n        final OptionalWrapper optionalWrapper = new OptionalWrapper();\n        Street street = new Street(\"Xaveriova\", 110);\n        optionalWrapper.setStreetOptional(Optional.of(street));\n\n        assertEquals(\"{\\\"streetOptional\\\":{\\\"name\\\":\\\"Xaveriova\\\",\\\"number\\\":110}}\", bindingJsonb.toJson(optionalWrapper));\n\n        OptionalWrapper result = bindingJsonb.fromJson(\"{\\\"streetOptional\\\":{\\\"name\\\":\\\"Xaveriova\\\",\\\"number\\\":110}}\", OptionalWrapper.class);\n        assertTrue(result.getStreetOptional().isPresent());\n        assertEquals(\"Xaveriova\", result.getStreetOptional().get().getName());\n        assertEquals(Integer.valueOf(110), result.getStreetOptional().get().getNumber());\n    }\n\n    @Test\n    public void testMarshallOptional() {\n        assertEquals(\"{}\", bindingJsonb.toJson(new ScalarValueWrapper<>(OptionalInt.empty())));\n        assertEquals(\"{}\", bindingJsonb.toJson(new ScalarValueWrapper<>(OptionalLong.empty())));\n        assertEquals(\"{}\", bindingJsonb.toJson(new ScalarValueWrapper<>(OptionalDouble.empty())));\n        assertEquals(\"{\\\"value\\\":10}\", bindingJsonb.toJson(new ScalarValueWrapper<>(OptionalInt.of(10))));\n        assertEquals(\"{\\\"value\\\":100}\", bindingJsonb.toJson(new ScalarValueWrapper<>(OptionalLong.of(100L))));\n        assertEquals(\"{\\\"value\\\":10.0}\", bindingJsonb.toJson(new ScalarValueWrapper<>(OptionalDouble.of(10.0D))));\n\n        final ScalarValueWrapper<OptionalInt> result = bindingJsonb.fromJson(\"{\\\"value\\\":10}\", new TestTypeToken<ScalarValueWrapper<OptionalInt>>() {}.getType());\n        assertEquals(OptionalInt.of(10), result.getValue());\n    }\n\n    @Test\n    public void testMarshallOptionalObject() {\n        assertEquals(\"{}\", bindingJsonb.toJson(new ScalarValueWrapper<>(Optional.empty())));\n        assertEquals(\"{\\\"id\\\":1,\\\"name\\\":\\\"Cust1\\\"}\", bindingJsonb.toJson(Optional.of(new Customer(1, \"Cust1\"))));\n\n    }\n\n    @Test\n    public void testMarshallOptionalIntArray() {\n        final OptionalInt[] array = {OptionalInt.of(1), OptionalInt.of(2), OptionalInt.empty()};\n        assertEquals(\"[1,2,null]\", bindingJsonb.toJson(array));\n\n        OptionalInt[] result = bindingJsonb.fromJson(\"[1,2,null]\", new TestTypeToken<OptionalInt[]>() {}.getType());\n\n        assertTrue(result[0].isPresent());\n        assertEquals(1, result[0].getAsInt());\n\n        assertTrue(result[1].isPresent());\n        assertEquals(2, result[1].getAsInt());\n\n        assertEquals(OptionalInt.empty(), result[2]);\n    }\n\n    @Test\n    public void testMarshallOptionalArray() {\n        final Optional[] array = {Optional.of(new Customer(1, \"Cust1\")), Optional.of(new Customer(2, \"Cust2\")), Optional.empty()};\n        assertEquals(\"[{\\\"id\\\":1,\\\"name\\\":\\\"Cust1\\\"},{\\\"id\\\":2,\\\"name\\\":\\\"Cust2\\\"},null]\", bindingJsonb.toJson(array));\n    }\n\n    @Test\n    public void testUnmarshallNullAsOptionalEmpty() {\n        final ScalarValueWrapper<OptionalInt> result = bindingJsonb.fromJson(\"{\\\"value\\\":null}\", new ScalarValueWrapper<OptionalInt>() {\n        }.getClass().getGenericSuperclass());\n        assertEquals(OptionalInt.empty(), result.getValue());\n    }\n\n    @Test\n    public void testUnmarshallOptionalArrayNulls() {\n        final OptionalLong[] result = bindingJsonb.fromJson(\"[null, null]\", OptionalLong[].class);\n\n        assertEquals(2, result.length);\n\n        for (OptionalLong item : result) {\n            assertEquals(OptionalLong.empty(), item);\n        }\n    }\n\n    @Test\n    public void testUnmarshallOptionalList() {\n        final List<Optional<Integer>> result = bindingJsonb.fromJson(\"[null, null]\", new TestTypeToken<List<Optional<Integer>>>() {}.getType());\n\n        assertEquals(2, result.size());\n\n        for (Optional<Integer> item : result) {\n            assertEquals(Optional.empty(), item);\n        }\n    }\n\n    @Test\n    public void testMarshallOptionalMap() {\n        Map<String, OptionalInt> ints = new HashMap<>();\n        ints.put(\"first\", OptionalInt.empty());\n        ints.put(\"second\", OptionalInt.empty());\n        String result = defaultJsonb.toJson(ints);\n        assertEquals(\"{\\\"first\\\":null,\\\"second\\\":null}\", result);\n    }\n\n    @Test\n    public void testCorrectOptionalGetter() {\n        NotMatchingGettersAndSetters personWithCorrectGetter = new NotMatchingGettersAndSetters();\n        String result = defaultJsonb.toJson(personWithCorrectGetter);\n        assertEquals(\"{\\\"firstName\\\":1,\\\"lastName\\\":\\\"Correct\\\"}\", result);\n\n        NotMatchingGettersAndSetters deserialized = defaultJsonb.fromJson(result, NotMatchingGettersAndSetters.class);\n        personWithCorrectGetter.setFirstName(1);\n        assertEquals(personWithCorrectGetter, deserialized);\n    }\n\n    @Test\n    public void testMarshalEmptyRoot() {\n        assertEquals(\"null\", bindingJsonb.toJson(Optional.empty()));\n    }\n\n    @Test\n    public void testUnmarshalEmptyRoot() {\n        assertEquals(Optional.empty(), bindingJsonb.fromJson(\"null\", new TestTypeToken<Optional<Customer>>() {}.getType()));\n    }\n\n    @Test\n    public void testMarshalEmptyInt() {\n        assertEquals(\"null\", bindingJsonb.toJson(OptionalInt.empty()));\n    }\n\n    @Test\n    public void testUnmarshalEmptyInt() {\n        assertEquals(OptionalInt.empty(), bindingJsonb.fromJson(\"null\", OptionalInt.class));\n    }\n\n    @Test\n    public void testMarshalEmptyLong() {\n        assertEquals(\"null\", bindingJsonb.toJson(OptionalLong.empty()));\n    }\n\n    @Test\n    public void testUnmarshalEmptyLong() {\n        assertEquals(OptionalLong.empty(), bindingJsonb.fromJson(\"null\", OptionalLong.class));\n    }\n\n    @Test\n    public void testMarshalEmptyDouble() {\n        assertEquals(\"null\", bindingJsonb.toJson(OptionalDouble.empty()));\n    }\n\n    @Test\n    public void testUnmarshalEmptyDouble() {\n        assertEquals(OptionalDouble.empty(), bindingJsonb.fromJson(\"null\", OptionalDouble.class));\n    }\n\n    @Test\n    public void testNullInsteadOfOptional() {\n        OptionalWrapper optionalWrapper = new OptionalWrapper();\n        String expected = \"{}\";\n        assertThat(bindingJsonb.toJson(optionalWrapper), is(expected));\n    }\n\n    @Test\n    public void testNullInsteadOfOptionalInSpecificOptionals() {\n        SpecificOptionalWrapper optionalWrapper = new SpecificOptionalWrapper();\n        String expected = \"{}\";\n        assertThat(bindingJsonb.toJson(optionalWrapper), is(expected));\n    }\n\n    public static class Customer {\n        private int id;\n        private String name;\n\n        public Customer() {\n        }\n\n        public Customer(int id, String name) {\n            this.id = id;\n            this.name = name;\n        }\n\n        public int getId() {\n            return id;\n        }\n\n        public void setId(int id) {\n            this.id = id;\n        }\n\n        public String getName() {\n            return name;\n        }\n\n        public void setName(String name) {\n            this.name = name;\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/RecursiveReferenceTest.java",
    "content": "/*\n * Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.fail;\n\nimport java.util.Arrays;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.Jsonbs;\nimport org.eclipse.yasson.adapters.model.Chain;\nimport org.eclipse.yasson.adapters.model.ChainAdapter;\nimport org.eclipse.yasson.adapters.model.ChainSerializer;\nimport org.eclipse.yasson.adapters.model.Foo;\nimport org.eclipse.yasson.adapters.model.FooAdapter;\nimport org.eclipse.yasson.adapters.model.FooSerializer;\nimport org.junit.jupiter.api.Test;\n\npublic class RecursiveReferenceTest {\n\n    private static final Jsonb userSerializerJsonb = JsonbBuilder.create(new JsonbConfig()\n                                                                                 .withSerializers(new ChainSerializer(),\n                                                                                                  new FooSerializer()));\n    private static final Jsonb adapterSerializerJsonb = JsonbBuilder.create(new JsonbConfig()\n                                                                                    .withAdapters(new ChainAdapter(),\n                                                                                                  new FooAdapter()));\n\n    @Test\n    public void testSerializeRecursiveReference() {\n        Chain recursive = new Chain(\"test\");\n        recursive.setLinksTo(recursive);\n        try {\n            Jsonbs.defaultJsonb.toJson(recursive);\n            fail(\"Exception should be caught\");\n        } catch (JsonbException e) {\n            assertEquals(\n                    \"Unable to serialize property 'linksTo' from org.eclipse.yasson.adapters.model.Chain\",\n                    e.getMessage());\n            assertEquals(\n                    \"Recursive reference has been found in class class org.eclipse.yasson.adapters.model.Chain.\",\n                    e.getCause().getMessage());\n        }\n    }\n\n    @Test\n    public void testSerializeRecursiveReferenceCustomAdapter() {\n        Chain recursive = new Chain(\"test\");\n        recursive.setLinksTo(recursive);\n        try {\n            adapterSerializerJsonb.toJson(recursive);\n            fail(\"Exception should be caught\");\n        } catch (JsonbException e) {\n            assertEquals(\"Problem adapting object of type class org.eclipse.yasson.adapters.model.Chain to java.util.Map<java.lang\"\n                            + \".String, java.lang.Object> in class class org.eclipse.yasson.adapters.model.ChainAdapter\",\n                    e.getMessage());\n        }\n    }\n\n    @Test\n    public void testSerializeRecursiveReferenceCustomSerializer() {\n        Chain recursive = new Chain(\"test\");\n        recursive.setLinksTo(recursive);\n        try {\n            userSerializerJsonb.toJson(recursive);\n            fail(\"Exception should be caught\");\n        } catch (JsonbException e) {\n            assertEquals(\"Recursive reference has been found in class class org.eclipse.yasson.adapters.model.Chain.\",\n                         e.getMessage());\n        }\n    }\n\n    @Test\n    public void testSerializeRepeatedInstance() {\n        String noNulls = \"[{\\\"linksTo\\\":{\\\"name\\\":\\\"test\\\"},\\\"name\\\":\\\"test\\\"},{\\\"linksTo\\\":{\\\"name\\\":\\\"test\\\"},\"\n                + \"\\\"name\\\":\\\"test\\\"}]\";\n        String withNulls = \"[{\\\"has\\\":null,\\\"linksTo\\\":{\\\"has\\\":null,\\\"linksTo\\\":null,\\\"name\\\":\\\"test\\\"},\\\"name\\\":\\\"test\\\"},\"\n                + \"{\\\"has\\\":null,\\\"linksTo\\\":{\\\"has\\\":null,\\\"linksTo\\\":null,\\\"name\\\":\\\"test\\\"},\\\"name\\\":\\\"test\\\"}]\";\n        checkSerializeRepeatedInstance(Jsonbs.defaultJsonb, noNulls);\n        //Since ChainAdapter is adapting Chain to Map<String, Object>, the produced json will contain nulls\n        checkSerializeRepeatedInstance(adapterSerializerJsonb, withNulls);\n        checkSerializeRepeatedInstance(userSerializerJsonb, noNulls);\n    }\n\n    private void checkSerializeRepeatedInstance(Jsonb jsonb, String expected) {\n        Chain recursive = new Chain(\"test\");\n        recursive.setLinksTo(new Chain(\"test\"));\n        String result = jsonb.toJson(Arrays.asList(recursive, recursive));\n        assertEquals(expected, result);\n    }\n\n    @Test\n    public void testSerialize2ReferencesSameObject() {\n        A a = new A();\n        Foo b = new Foo(\"foo\");\n        a.ref1 = b;\n        a.ref2 = b;\n        String result = Jsonbs.defaultJsonb.toJson(a);\n        assertEquals(\"{\\\"ref1\\\":{\\\"bar\\\":\\\"foo\\\"},\\\"ref2\\\":{\\\"bar\\\":\\\"foo\\\"}}\", result);\n    }\n\n    @Test\n    public void testChain() {\n        String noNulls = \"{\\\"has\\\":{\\\"bar\\\":\\\"foo\\\"},\\\"linksTo\\\":{\\\"has\\\":{\\\"bar\\\":\\\"foo\\\"},\\\"name\\\":\\\"c2\\\"},\\\"name\\\":\\\"c1\\\"}\";\n        String withNulls = \"{\\\"has\\\":{\\\"bar\\\":\\\"foo\\\"},\\\"linksTo\\\":{\\\"has\\\":{\\\"bar\\\":\\\"foo\\\"},\\\"linksTo\\\":null,\"\n                + \"\\\"name\\\":\\\"c2\\\"},\\\"name\\\":\\\"c1\\\"}\";\n        checkChain(Jsonbs.defaultJsonb, noNulls);\n        //Since ChainAdapter is adapting Chain to Map<String, Object>, the produced json will contain nulls\n        checkChain(adapterSerializerJsonb, withNulls);\n        checkChain(userSerializerJsonb, noNulls);\n    }\n\n    private void checkChain(Jsonb jsonb, String expected) {\n        Foo foo = new Foo(\"foo\");\n        Chain c1 = new Chain(\"c1\");\n        Chain c2 = new Chain(\"c2\");\n        c1.setLinksTo(c2);\n        c1.setHas(foo);\n        c2.setHas(foo);\n        String result = jsonb.toJson(c1);\n        assertEquals(expected, result);\n    }\n\n    @Test\n    public void testDeeperChain() {\n        String noNulls = \"{\\\"has\\\":{\\\"bar\\\":\\\"foo\\\"},\\\"linksTo\\\":{\\\"has\\\":{\\\"bar\\\":\\\"foo\\\"},\\\"linksTo\\\":{\\\"name\\\":\\\"c3\\\"},\"\n                + \"\\\"name\\\":\\\"c2\\\"},\\\"name\\\":\\\"c1\\\"}\";\n        String withNulls = \"{\\\"has\\\":{\\\"bar\\\":\\\"foo\\\"},\\\"linksTo\\\":{\\\"has\\\":{\\\"bar\\\":\\\"foo\\\"},\\\"linksTo\\\":{\\\"has\\\":null,\"\n                + \"\\\"linksTo\\\":null,\\\"name\\\":\\\"c3\\\"},\\\"name\\\":\\\"c2\\\"},\\\"name\\\":\\\"c1\\\"}\";\n        checkDeeperChain(Jsonbs.defaultJsonb, noNulls);\n        //Since ChainAdapter is adapting Chain to Map<String, Object>, the produced json will contain nulls\n        checkDeeperChain(adapterSerializerJsonb, withNulls);\n        checkDeeperChain(userSerializerJsonb, noNulls);\n    }\n\n    private void checkDeeperChain(Jsonb jsonb, String expected) {\n        Foo foo = new Foo(\"foo\");\n        Chain c1 = new Chain(\"c1\");\n        Chain c2 = new Chain(\"c2\");\n        Chain c3 = new Chain(\"c3\");\n        c1.setLinksTo(c2);\n        c1.setHas(foo);\n        c2.setHas(foo);\n        c2.setLinksTo(c3);\n        String result = jsonb.toJson(c1);\n        assertEquals(expected, result);\n    }\n\n    public static class A {\n        public Foo ref1;\n        public Foo ref2;\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/SpecificTest.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.defaultmapping.generics.model.ScalarValueWrapper;\n\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.net.MalformedURLException;\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.net.URL;\n\n/**\n * Specific standard Java SE types tests: {@link BigDecimal}, {@link BigInteger}, {@link URL}, {@link URI}.\n *\n * @author Dmitry Kornilov\n */\npublic class SpecificTest {\n    @Test\n    public void testMarshallBigDecimal() {\n        assertEquals(\"{\\\"value\\\":100}\", bindingJsonb.toJson(new ScalarValueWrapper<>(BigDecimal.valueOf(100L))));\n        assertEquals(\"{\\\"value\\\":100.1}\", bindingJsonb.toJson(new ScalarValueWrapper<>(BigDecimal.valueOf(100.1D))));\n    }\n\n    @Test\n    public void testMarshallBigInteger() {\n        assertEquals(\"{\\\"value\\\":100}\", bindingJsonb.toJson(new ScalarValueWrapper<>(BigInteger.valueOf(100))));\n    }\n\n    @Test\n    public void testMarshallUri() throws URISyntaxException {\n        assertEquals(\"{\\\"value\\\":\\\"http://www.oracle.com\\\"}\", bindingJsonb.toJson(new ScalarValueWrapper<>(new URI(\"http://www.oracle.com\"))));\n    }\n\n    @Test\n    public void testMarshallUrl() throws MalformedURLException {\n        assertEquals(\"{\\\"value\\\":\\\"http://www.oracle.com\\\"}\", bindingJsonb.toJson(new ScalarValueWrapper<>(new URL(\"http://www.oracle.com\"))));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/UnmarshallingUnsupportedTypesTest.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific;\n\nimport java.lang.reflect.Type;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.time.Instant;\nimport java.time.LocalDateTime;\nimport java.time.ZoneId;\nimport java.time.ZonedDateTime;\nimport java.util.OptionalDouble;\nimport java.util.OptionalInt;\nimport java.util.OptionalLong;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.TestTypeToken;\nimport org.eclipse.yasson.defaultmapping.generics.model.GenericTestClass;\nimport org.eclipse.yasson.defaultmapping.specific.model.ClassWithUnsupportedFields;\nimport org.eclipse.yasson.defaultmapping.specific.model.CustomUnsupportedInterface;\nimport org.eclipse.yasson.defaultmapping.specific.model.SupportedTypes;\nimport org.eclipse.yasson.defaultmapping.specific.model.SupportedTypes.NestedPojo;\nimport org.junit.jupiter.api.Test;\n\nimport static org.eclipse.yasson.Jsonbs.defaultJsonb;\nimport static org.eclipse.yasson.YassonConfig.FAIL_ON_UNKNOWN_PROPERTIES;\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.is;\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.assertThrows;\nimport static org.junit.jupiter.api.Assertions.assertTrue;\nimport static org.junit.jupiter.api.Assertions.fail;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class UnmarshallingUnsupportedTypesTest {\n\n    @Test\n    public void testUnmarshallToUnsupportedInterface() {\n        ClassWithUnsupportedFields unsupported = new ClassWithUnsupportedFields();\n        unsupported.customInterface = new CustomUnsupportedInterface() {\n\n            private String value = \"value1\";\n            @Override\n            public String getValue() {\n                return value;\n            }\n\n            @Override\n            public void setValue(String value) {\n                throw new IllegalStateException(\"Not supposed to be called.\");\n            }\n        };\n        String expected = \"{\\\"customInterface\\\":{\\\"value\\\":\\\"value1\\\"}}\";\n        assertEquals(expected, defaultJsonb.toJson(unsupported));\n        try {\n        \tdefaultJsonb.fromJson(expected, ClassWithUnsupportedFields.class);\n            fail(\"Should report an error\");\n        } catch (JsonbException e) {\n            assertTrue(e.getMessage().contains(\"Cannot infer a type\"));\n            assertTrue(e.getMessage().contains(\"customInterface\"));\n        }\n    }\n\n    @Test\n    public void testPojoForMalformedJson() {\n\n        SupportedTypes supportedTypes = new SupportedTypes();\n        LocalDateTime localDateTime = LocalDateTime.of(2015, 12, 28, 15, 57);\n        ZoneId prague = ZoneId.of(\"Europe/Prague\");\n        ZonedDateTime zonedDateTime = ZonedDateTime.of(localDateTime, prague);\n        supportedTypes.setInstant(Instant.from(zonedDateTime));\n        supportedTypes.setOptionalLong(OptionalLong.of(11L));\n        supportedTypes.setZonedDateTime(zonedDateTime);\n        supportedTypes.setNestedPojo(new SupportedTypes.NestedPojo());\n        supportedTypes.getNestedPojo().setIntegerValue(10);\n\n        String json = \"{\\\"instant\\\":\\\"2015-12-28T14:57:00Z\\\",\\\"nestedPojo\\\":{\\\"integerValue\\\":10},\\\"optionalLong\\\":11,\\\"zonedDateTime\\\":\\\"2015-12-28T15:57:00+01:00[Europe/Prague]\\\"}\";\n        assertEquals(json, defaultJsonb.toJson(supportedTypes));\n\n        SupportedTypes result = defaultJsonb.fromJson(json, SupportedTypes.class);\n        assertEquals(result.getInstant(), supportedTypes.getInstant());\n        assertEquals(result.getZonedDateTime(), supportedTypes.getZonedDateTime());\n        assertEquals(result.getOptionalLong(), supportedTypes.getOptionalLong());\n        assertEquals(Integer.valueOf(10), result.getNestedPojo().getIntegerValue());\n\n    }\n\n    @Test\n    public void testPojoAsScalarValue() {\n        //wrong, nestedPojo is a value.\n        String json  = \"{\\\"nestedPojo\\\":\\\"10\\\",\\\"optionalLong\\\":11}\";\n        assertFail(json, SupportedTypes.class, \"nestedPojo\", NestedPojo.class);\n    }\n\n    @Test\n    public void testPojoAsArray() {\n        //wrong, nestedPojo is a collection.\n        String json  = \"{\\\"nestedPojo\\\":[\\\"10\\\"],\\\"optionalLong\\\":11}\";\n        assertFail(json, SupportedTypes.class, \"nestedPojo\", NestedPojo.class);\n    }\n\n    @Test()\n    public void testMissingFieldDefault() {\n        String json  = \"{\\\"nestedPojo\\\":{\\\"integerValue\\\":10,\\\"missingField\\\":5},\\\"optionalLong\\\":11}\";\n        SupportedTypes result = defaultJsonb.fromJson(json, SupportedTypes.class);\n        assertEquals(Integer.valueOf(10), result.getNestedPojo().getIntegerValue());\n        assertEquals(11, result.getOptionalLong().getAsLong());\n    }\n\n    @Test()\n    public void testMissingFieldDefaultNull() {\n        String json  = \"{\\\"nestedPojo\\\":{\\\"integerValue\\\":10,\\\"missingField\\\":null},\\\"optionalLong\\\":11}\";\n        SupportedTypes result = defaultJsonb.fromJson(json, SupportedTypes.class);\n        assertEquals(Integer.valueOf(10), result.getNestedPojo().getIntegerValue());\n        assertEquals(11, result.getOptionalLong().getAsLong());\n    }\n\n    @Test\n    public void testMissingFieldIgnored() {\n    \tassertThrows(JsonbException.class, () -> {\n\t        Jsonb defaultConfig = JsonbBuilder.create(new JsonbConfig().setProperty(FAIL_ON_UNKNOWN_PROPERTIES, true));\n\t        String json  = \"{\\\"nestedPojo\\\":{\\\"integerValue\\\":10,\\\"missingField\\\":5},\\\"optionalLong\\\":11}\";\n\t        SupportedTypes result = defaultConfig.fromJson(json, SupportedTypes.class);\n    \t});\n    }\n\n    @Test\n    public void testMissingFieldWithObjectValue() {\n        String json  = \"{\\\"missingProperty\\\":{\\\"optionalLong\\\":404},\\\"optionalLong\\\":11}\";\n        SupportedTypes result = defaultJsonb.fromJson(json, SupportedTypes.class);\n\n        assertTrue(result.getOptionalLong().isPresent());\n        assertThat(result.getOptionalLong().getAsLong(), is(11L));\n    }\n\n    @Test\n    public void testMissingFieldWithArrayValue() {\n        String json  = \"{\\\"missingProperty\\\":[404],\\\"optionalLong\\\":11}\";\n        SupportedTypes result = defaultJsonb.fromJson(json, SupportedTypes.class);\n\n        assertTrue(result.getOptionalLong().isPresent());\n        assertThat(result.getOptionalLong().getAsLong(), is(11L));\n    }\n\n    @Test\n    public void testEmptyStringAsInteger() {\n        Type type = new TestTypeToken<GenericTestClass<Integer, Integer>>(){}.getType();\n        assertFail(\"{\\\"field1\\\":\\\"\\\"}\", type, \"field1\", Integer.class);\n    }\n\n    @Test\n    public void testEmptyStringAsDouble() {\n        Type type = new TestTypeToken<GenericTestClass<Double, Double>>(){}.getType();\n        assertFail(\"{\\\"field1\\\":\\\"\\\"}\", type, \"field1\", Double.class);\n    }\n\n    @Test\n    public void testEmptyStringAsFloat() {\n        Type type = new TestTypeToken<GenericTestClass<Float, Float>>(){}.getType();\n        assertFail(\"{\\\"field1\\\":\\\"\\\"}\", type, \"field1\", Float.class);\n    }\n\n    @Test\n    public void testEmptyStringAsLong() {\n        Type type = new TestTypeToken<GenericTestClass<Long, Long>>(){}.getType();\n        assertFail(\"{\\\"field1\\\":\\\"\\\"}\", type, \"field1\", Long.class);\n    }\n\n    @Test\n    public void testEmptyStringAsShort() {\n        Type type = new TestTypeToken<GenericTestClass<Short, Short>>(){}.getType();\n        assertFail(\"{\\\"field1\\\":\\\"\\\"}\", type, \"field1\", Short.class);\n    }\n\n    @Test\n    public void testEmptyStringAsByte() {\n        Type type = new TestTypeToken<GenericTestClass<Byte, Byte>>(){}.getType();\n        assertFail(\"{\\\"field1\\\":\\\"\\\"}\", type, \"field1\", Byte.class);\n    }\n\n    @Test\n    public void testEmptyStringAsBigDecimal() {\n        Type type = new TestTypeToken<GenericTestClass<BigDecimal, BigDecimal>>(){}.getType();\n        assertFail(\"{\\\"field1\\\":\\\"\\\"}\", type,\"field1\", BigDecimal.class);\n    }\n\n    @Test\n    public void testEmptyStringAsBigInteger() {\n        Type type = new TestTypeToken<GenericTestClass<BigInteger, BigInteger>>(){}.getType();\n        assertFail(\"{\\\"field1\\\":\\\"\\\"}\", type, \"field1\", BigInteger.class);\n    }\n\n    @Test\n    public void testEmptyStringAsOptionalDouble() {\n        Type type = new TestTypeToken<GenericTestClass<OptionalDouble, OptionalDouble>>(){}.getType();\n        assertFail(\"{\\\"field1\\\":\\\"\\\"}\", type,\"field1\", Double.class); //We are reusing Double deserializer\n    }\n\n    @Test\n    public void testEmptyStringAsOptionalInt() {\n        Type type = new TestTypeToken<GenericTestClass<OptionalInt, OptionalInt>>(){}.getType();\n        assertFail(\"{\\\"field1\\\":\\\"\\\"}\", type, \"field1\", Integer.class); //We are reusing Integer deserializer\n    }\n\n    @Test\n    public void testEmptyStringAsOptionalLong() {\n        Type type = new TestTypeToken<GenericTestClass<OptionalLong, OptionalLong>>(){}.getType();\n        assertFail(\"{\\\"field1\\\":\\\"\\\"}\", type,\"field1\", Long.class); //We are reusing Long deserializer\n    }\n\n    private void assertFail(String json, Type type, String failureProperty, Class<?> failurePropertyClass) {\n        try {\n        \tdefaultJsonb.fromJson(json, type);\n            fail();\n        } catch (JsonbException e) {\n            if(!e.getMessage().contains(failureProperty) || !e.getMessage().contains(failurePropertyClass.getName())) {\n                fail(\"Expected error message to contain '\" + failureProperty + \"' and '\" + failurePropertyClass.getName() + \"', but was: \" +\n                 e.getMessage());\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/model/Address.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class Address {\n    private Street street;\n\n    private String town;\n\n    public Address() {\n    }\n\n    public Address(Street street, String town) {\n        this.street = street;\n        this.town = town;\n    }\n\n    public Street getStreet() {\n        return street;\n    }\n\n    public void setStreet(Street street) {\n        this.street = street;\n    }\n\n    public String getTown() {\n        return town;\n    }\n\n    public void setTown(String town) {\n        this.town = town;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/model/ClassWithUnsupportedFields.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class ClassWithUnsupportedFields {\n    public CustomUnsupportedInterface customInterface;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/model/CustomUnsupportedInterface.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific.model;\n\n/**\n * Unmarhsalling to this interface is not supported.\n *\n * @author Roman Grigoriadi\n */\npublic interface CustomUnsupportedInterface {\n\n    String getValue();\n\n    void setValue(String value);\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/model/Customer.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific.model;\n\nimport java.util.List;\nimport java.util.Map;\n\n/**\n * Just a dummy pojo object, for testing object tree encapsulation.\n * Not much business sense here to look for.\n *\n * @author Roman Grigoriadi\n */\npublic class Customer {\n\n    private List<Address> addresses;\n\n    private List<String> strings;\n\n    private List<Integer> integers;\n\n    private List<List<Integer>> listOfListsOfIntegers;\n\n    private Map<String, Integer> stringIntegerMap;\n\n    private Map<String, Customer> friends;\n\n    private Integer age;\n\n    private String name;\n\n    public Customer() {\n    }\n\n    public Customer(Integer age, String name) {\n        this.age = age;\n        this.name = name;\n    }\n\n    public List<Address> getAddresses() {\n        return addresses;\n    }\n\n    public void setAddresses(List<Address> addresses) {\n        this.addresses = addresses;\n    }\n\n    public Integer getAge() {\n        return age;\n    }\n\n    public void setAge(Integer age) {\n        this.age = age;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public List<String> getStrings() {\n        return strings;\n    }\n\n    public void setStrings(List<String> strings) {\n        this.strings = strings;\n    }\n\n    public List<Integer> getIntegers() {\n        return integers;\n    }\n\n    public void setIntegers(List<Integer> integers) {\n        this.integers = integers;\n    }\n\n    public Map<String, Integer> getStringIntegerMap() {\n        return stringIntegerMap;\n    }\n\n    public void setStringIntegerMap(Map<String, Integer> stringIntegerMap) {\n        this.stringIntegerMap = stringIntegerMap;\n    }\n\n    public Map<String, Customer> getFriends() {\n        return friends;\n    }\n\n    public void setFriends(Map<String, Customer> friends) {\n        this.friends = friends;\n    }\n\n    public List<List<Integer>> getListOfListsOfIntegers() {\n        return listOfListsOfIntegers;\n    }\n\n    public void setListOfListsOfIntegers(List<List<Integer>> listOfListsOfIntegers) {\n        this.listOfListsOfIntegers = listOfListsOfIntegers;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/model/NotMatchingGettersAndSetters.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific.model;\n\nimport java.util.Objects;\nimport java.util.Optional;\n\n/**\n * @author David Kral.\n */\npublic class NotMatchingGettersAndSetters {\n\n    private String firstName = \"Person\";\n    private String lastName = \"Correct\";\n\n    public void setFirstName(Integer firstName) {\n        this.firstName = Integer.toString(firstName);\n    }\n\n    public Optional<Integer> getFirstName() {\n        return Optional.of(1);\n    }\n\n    public void setLastName(String lastName) {\n        this.lastName = lastName;\n    }\n\n    public Optional<String> getLastName() {\n        return Optional.ofNullable(lastName);\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) return true;\n        if (o == null || getClass() != o.getClass()) return false;\n        NotMatchingGettersAndSetters that = (NotMatchingGettersAndSetters) o;\n        return Objects.equals(firstName, that.firstName) &&\n                Objects.equals(lastName, that.lastName);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(firstName, lastName);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/model/OptionalWrapper.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific.model;\n\nimport java.util.Optional;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class OptionalWrapper {\n\n    private Optional<Street> streetOptional;\n\n    public Optional<Street> getStreetOptional() {\n        return streetOptional;\n    }\n\n    public void setStreetOptional(Optional<Street> streetOptional) {\n        this.streetOptional = streetOptional;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/model/SpecificOptionalWrapper.java",
    "content": "/*\n * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific.model;\n\nimport java.util.OptionalDouble;\nimport java.util.OptionalInt;\nimport java.util.OptionalLong;\n\npublic class SpecificOptionalWrapper {\n\n    private OptionalInt optionalInt;\n    private OptionalLong optionalLong;\n    private OptionalDouble optionalDouble;\n\n    public OptionalInt optionalInt() {\n        return optionalInt;\n    }\n\n    public void setOptionalInt(OptionalInt optionalInt) {\n        this.optionalInt = optionalInt;\n    }\n\n    public OptionalLong optionalLong() {\n        return optionalLong;\n    }\n\n    public void setOptionalLong(OptionalLong optionalLong) {\n        this.optionalLong = optionalLong;\n    }\n\n    public OptionalDouble optionalDouble() {\n        return optionalDouble;\n    }\n\n    public void setOptionalDouble(OptionalDouble optionalDouble) {\n        this.optionalDouble = optionalDouble;\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/model/Street.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class Street {\n    private String name = \"defaultName\";\n    private Integer number = 11;\n\n    public Street() {\n    }\n\n    public Street(String name, Integer number) {\n        this.name = name;\n        this.number = number;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public Integer getNumber() {\n        return number;\n    }\n\n    public void setNumber(Integer number) {\n        this.number = number;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/model/StreetWithPrimitives.java",
    "content": "/*\n * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class StreetWithPrimitives {\n    private String name = \"defaultName\";\n    private int number = 11;\n\n    public StreetWithPrimitives() {\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public int getNumber() {\n        return number;\n    }\n\n    public void setNumber(int number) {\n        this.number = number;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/specific/model/SupportedTypes.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.specific.model;\n\nimport java.time.Instant;\nimport java.time.ZonedDateTime;\nimport java.util.OptionalLong;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class SupportedTypes {\n\n    public static class NestedPojo {\n\n        private Integer integerValue;\n\n        public Integer getIntegerValue() {\n            return integerValue;\n        }\n\n        public void setIntegerValue(Integer integerValue) {\n            this.integerValue = integerValue;\n        }\n\n    }\n\n    private Instant instant;\n\n    private ZonedDateTime zonedDateTime;\n\n    private OptionalLong optionalLong;\n\n    private NestedPojo nestedPojo;\n\n    public Instant getInstant() {\n        return instant;\n    }\n\n    public void setInstant(Instant instant) {\n        this.instant = instant;\n    }\n\n    public OptionalLong getOptionalLong() {\n        return optionalLong;\n    }\n\n    public void setOptionalLong(OptionalLong optionalLong) {\n        this.optionalLong = optionalLong;\n    }\n\n    public ZonedDateTime getZonedDateTime() {\n        return zonedDateTime;\n    }\n\n    public void setZonedDateTime(ZonedDateTime zonedDateTime) {\n        this.zonedDateTime = zonedDateTime;\n    }\n\n    public NestedPojo getNestedPojo() {\n        return nestedPojo;\n    }\n\n    public void setNestedPojo(NestedPojo nestedPojo) {\n        this.nestedPojo = nestedPojo;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/typeConvertors/DefaultSerializersTest.java",
    "content": "/*\n * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.typeConvertors;\n\nimport org.junit.jupiter.api.*;\n\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.TestTypeToken;\nimport org.eclipse.yasson.defaultmapping.generics.model.ScalarValueWrapper;\nimport org.eclipse.yasson.defaultmapping.typeConvertors.model.ByteArrayWrapper;\nimport org.eclipse.yasson.internal.JsonBindingBuilder;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.config.BinaryDataStrategy;\n\nimport java.io.File;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.Base64;\nimport java.util.UUID;\n\n/**\n * This class contains Converter tests\n *\n * @author David Kral\n */\npublic class DefaultSerializersTest {\n\n    @Test\n    public void testCharacter() {\n        final String json = \"{\\\"value\\\":\\\"\\uFFFF\\\"}\";\n        assertEquals(json, defaultJsonb.toJson(new ScalarValueWrapper<>('\\uFFFF')));\n        ScalarValueWrapper<Character> result = defaultJsonb.fromJson(json, new TestTypeToken<ScalarValueWrapper<Character>>(){}.getType());\n        assertEquals((Character)'\\uFFFF', result.getValue());\n    }\n\n    @Test\n    public void testByteArray() {\n        byte[] array = {1, 2, 3};\n        assertEquals(\"[1,2,3]\", bindingJsonb.toJson(array));\n    }\n\n    @Test\n    public void testByteArrayWithBinaryStrategy() {\n        byte[] array = {127, -128, 127};\n        Jsonb jsonb = (new JsonBindingBuilder().withConfig(new JsonbConfig().withBinaryDataStrategy(BinaryDataStrategy.BYTE))).build();\n\n        assertEquals(\"[127,-128,127]\", jsonb.toJson(array));\n        assertArrayEquals(array, jsonb.fromJson(\"[127,-128,127]\", byte[].class));\n    }\n\n    @Test\n    public void testByteArrayWithStrictJson() {\n        byte[] array = {1, 2, 3};\n        ByteArrayWrapper byteArrayWrapper = new ByteArrayWrapper();\n        byteArrayWrapper.array = array;\n        Jsonb jsonb = (new JsonBindingBuilder().withConfig(new JsonbConfig().withStrictIJSON(true))).build();\n\n        assertEquals(\"{\\\"array\\\":\\\"\" + Base64.getUrlEncoder().encodeToString(array) + \"\\\"}\", jsonb.toJson(byteArrayWrapper));\n\n        jsonb = (new JsonBindingBuilder().withConfig(new JsonbConfig().withStrictIJSON(false))).build();\n\n        assertEquals(\"{\\\"array\\\":[1,2,3]}\", jsonb.toJson(byteArrayWrapper));\n    }\n\n    @Test\n    public void testByteArrayWithStrictJsonAndBinaryStrategy() {\n        byte[] array = {1, 2, 3};\n        ByteArrayWrapper byteArrayWrapper = new ByteArrayWrapper();\n        byteArrayWrapper.array = array;\n        Jsonb jsonb = (new JsonBindingBuilder().withConfig(new JsonbConfig().withStrictIJSON(true).withBinaryDataStrategy(BinaryDataStrategy.BYTE))).build();\n        final String base64UrlEncodedJson = \"{\\\"array\\\":\\\"\" + Base64.getUrlEncoder().encodeToString(array) + \"\\\"}\";\n        assertEquals(base64UrlEncodedJson, jsonb.toJson(byteArrayWrapper));\n        ByteArrayWrapper result = jsonb.fromJson(base64UrlEncodedJson, ByteArrayWrapper.class);\n        assertArrayEquals(array, result.array);\n\n        jsonb = (new JsonBindingBuilder().withConfig(new JsonbConfig().withStrictIJSON(true).withBinaryDataStrategy(BinaryDataStrategy.BASE_64))).build();\n        assertEquals(base64UrlEncodedJson, jsonb.toJson(byteArrayWrapper));\n        result = jsonb.fromJson(base64UrlEncodedJson, ByteArrayWrapper.class);\n        assertArrayEquals(array, result.array);\n\n        jsonb = (new JsonBindingBuilder().withConfig(new JsonbConfig().withStrictIJSON(true).withBinaryDataStrategy(BinaryDataStrategy.BASE_64_URL))).build();\n        assertEquals(base64UrlEncodedJson, jsonb.toJson(byteArrayWrapper));\n        result = jsonb.fromJson(base64UrlEncodedJson, ByteArrayWrapper.class);\n        assertArrayEquals(array, result.array);\n\n        jsonb = (new JsonBindingBuilder().withConfig(new JsonbConfig().withBinaryDataStrategy(BinaryDataStrategy.BYTE))).build();\n        assertEquals(\"[1,2,3]\", jsonb.toJson(array));\n        result = jsonb.fromJson(\"{\\\"array\\\":[1,2,3]}\", ByteArrayWrapper.class);\n        assertArrayEquals(array, result.array);\n\n        jsonb = (new JsonBindingBuilder().withConfig(new JsonbConfig().withBinaryDataStrategy(BinaryDataStrategy.BASE_64))).build();\n        final String base64EncodedJson = \"{\\\"array\\\":\\\"\" + Base64.getEncoder().encodeToString(array) + \"\\\"}\";\n        assertEquals(base64EncodedJson, jsonb.toJson(byteArrayWrapper));\n        result = jsonb.fromJson(base64EncodedJson, ByteArrayWrapper.class);\n        assertArrayEquals(array, result.array);\n\n        jsonb = (new JsonBindingBuilder().withConfig(new JsonbConfig().withBinaryDataStrategy(BinaryDataStrategy.BASE_64_URL))).build();\n        assertEquals(base64UrlEncodedJson, jsonb.toJson(byteArrayWrapper));\n        result = jsonb.fromJson(base64UrlEncodedJson, ByteArrayWrapper.class);\n        assertArrayEquals(array, result.array);\n    }\n    \n    @Test\n    public void testUUID() {\n        UUID uuid = UUID.randomUUID();\n        String json = defaultJsonb.toJson(uuid);\n        UUID result = defaultJsonb.fromJson(json, UUID.class);\n        assertEquals(uuid, result);\n    }\n    \n    @Test\n    public void serializeObjectWithPth() {\n        \n        Path expectedPath = Paths.get(\"/tmp/hello/me.txt\");\n        String expectedPathString = expectedPath.toString().replace(\"\\\\\", \"\\\\\\\\\");        \n        String expectedJson = \"{\\\"path\\\":\\\"\" + expectedPathString + \"\\\"}\";\n        final ObjectWithPath objectWithPath = new ObjectWithPath();\n        objectWithPath.path = expectedPath;\n        final String s = defaultJsonb.toJson(objectWithPath);\n        assertEquals(expectedJson, s);\n        \n        ObjectWithPath actualObject = defaultJsonb.fromJson(expectedJson, ObjectWithPath.class);\n        assertEquals(expectedPath, actualObject.path);\n    }\n    \n    public static class ObjectWithPath {\n        public Path path;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/typeConvertors/model/BigDecimalWrapper.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.typeConvertors.model;\n\nimport java.math.BigDecimal;\n\n/**\n * Created by David Kral.\n */\npublic class BigDecimalWrapper {\n\n    public BigDecimal bigDecimal;\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/typeConvertors/model/BigIntegerWrapper.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.typeConvertors.model;\n\nimport java.math.BigInteger;\n\n/**\n * Created by David Kral.\n */\npublic class BigIntegerWrapper {\n\n    public BigInteger bigInteger;\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/typeConvertors/model/ByteArrayWrapper.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.typeConvertors.model;\n\n/**\n * Created by David Kral.\n */\npublic class ByteArrayWrapper {\n\n    public byte[] array;\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/typeConvertors/model/CalendarWrapper.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.typeConvertors.model;\n\nimport java.util.Calendar;\n\n/**\n * Created by David Kral.\n */\npublic class CalendarWrapper {\n\n    public Calendar calendar;\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/defaultmapping/typeConvertors/model/StringWrapper.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.defaultmapping.typeConvertors.model;\n\n/**\n * Created by David Kral.\n */\npublic class StringWrapper {\n\n    public String string;\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/documented/DocumentationExampleTest.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.documented;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport java.lang.reflect.Type;\nimport java.math.BigDecimal;\nimport java.time.LocalDate;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.adapter.JsonbAdapter;\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport jakarta.json.bind.annotation.JsonbNillable;\nimport jakarta.json.bind.annotation.JsonbNumberFormat;\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.annotation.JsonbTransient;\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\nimport jakarta.json.stream.JsonParser;\n\n/**\n * Contains tests from http://json-b.net/docs/user-guide.html\n */\npublic class DocumentationExampleTest {\n\n    public static class Dog {\n        public String name;\n        public int age;\n        public boolean bitable;\n    }\n\n    @Test\n    public void testMappingExample() {\n        // Create a dog instance\n        Dog dog = new Dog();\n        dog.name = \"Falco\";\n        dog.age = 4;\n        dog.bitable = false;\n\n        // Create Jsonb and serialize\n        String result = defaultJsonb.toJson(dog);\n        assertEquals(\"{\\\"age\\\":4,\\\"bitable\\\":false,\\\"name\\\":\\\"Falco\\\"}\", result);\n\n        // Deserialize back\n        dog = defaultJsonb.fromJson(\"{\\\"name\\\":\\\"Falco\\\",\\\"age\\\":4,\\\"bites\\\":false}\", Dog.class);\n        assertEquals(\"Falco\", dog.name);\n        assertEquals(4, dog.age);\n        assertEquals(false, dog.bitable);\n    }\n\n    @Test\n    @SuppressWarnings({ \"rawtypes\", \"unchecked\" })\n    public void testMappingCollection() {\n        Dog falco = new Dog();\n        falco.name = \"Falco\";\n        falco.age = 4;\n        Dog cassidy = new Dog();\n        cassidy.name = \"Cassidy\";\n        cassidy.age = 5;\n\n        // List of dogs\n        List dogs = new ArrayList();\n        dogs.add(falco);\n        dogs.add(cassidy);\n\n        // Create Jsonb and serialize\n        String result = defaultJsonb.toJson(dogs);\n        assertEquals(\n                \"[{\\\"age\\\":4,\\\"bitable\\\":false,\\\"name\\\":\\\"Falco\\\"},{\\\"age\\\":5,\\\"bitable\\\":false,\\\"name\\\":\\\"Cassidy\\\"}]\",\n                result);\n\n        // We can also deserialize back into a raw collection, but since there is no way\n        // to infer a type here,\n        // the result will be a list of java.util.Map instances with string keys.\n        dogs = defaultJsonb.fromJson(result, ArrayList.class);\n        assertEquals(2, dogs.size());\n        assertEquals(\"Falco\", ((Map) dogs.get(0)).get(\"name\"));\n        assertEquals(\"Cassidy\", ((Map) dogs.get(1)).get(\"name\"));\n        // assertEquals(4, ((Map) dogs.get(0)).get(\"age\")); // TODO should these\n        // actually be BigDecimals?\n        // assertEquals(5, ((Map) dogs.get(1)).get(\"age\"));\n    }\n\n    @SuppressWarnings(\"serial\")\n    @Test\n    public void testMappingGenericCollection() {\n        Dog falco = new Dog();\n        falco.name = \"Falco\";\n        falco.age = 4;\n        Dog cassidy = new Dog();\n        cassidy.name = \"Cassidy\";\n        cassidy.age = 5;\n\n        // List of dogs\n        List<Dog> dogs = new ArrayList<>();\n        dogs.add(falco);\n        dogs.add(cassidy);\n\n        // Create Jsonb and serialize\n        String result = defaultJsonb.toJson(dogs);\n        assertEquals(\n                \"[{\\\"age\\\":4,\\\"bitable\\\":false,\\\"name\\\":\\\"Falco\\\"},{\\\"age\\\":5,\\\"bitable\\\":false,\\\"name\\\":\\\"Cassidy\\\"}]\",\n                result);\n\n        // Deserialize back\n        dogs = defaultJsonb.fromJson(result, new ArrayList<Dog>() {\n        }.getClass().getGenericSuperclass());\n        assertEquals(2, dogs.size());\n        assertEquals(\"Falco\", dogs.get(0).name);\n        assertEquals(\"Cassidy\", dogs.get(1).name);\n    }\n\n    @Test\n    public void testFormattedOutput() {\n        Dog pojo = new Dog();\n        pojo.name = \"Falco\";\n        pojo.age = 4;\n\n        // Use it!\n        String result = formattingJsonb.toJson(pojo);\n        assertEquals(\"{\\n\" + \n                \"    \\\"age\\\": 4,\\n\" + \n                \"    \\\"bitable\\\": false,\\n\" + \n                \"    \\\"name\\\": \\\"Falco\\\"\\n\" + \n                \"}\", result);\n    }\n    \n    public static class Person1 {\n        @JsonbProperty(\"person-name\")\n        public String name;\n        public String profession;\n    }\n    \n    @Test\n    public void testChangingPropertyNames1() {\n        Person1 p = new Person1();\n        p.name = \"Jason Bourne\";\n        p.profession = \"Super Agent\";\n        \n        String result = formattingJsonb.toJson(p);\n        assertEquals(\"{\\n\" + \n                \"    \\\"person-name\\\": \\\"Jason Bourne\\\",\\n\" + \n                \"    \\\"profession\\\": \\\"Super Agent\\\"\\n\" + \n                \"}\", result);\n    }\n    \n    public class Person2 {\n        private String name;\n        private String profession;\n\n        @JsonbProperty(\"person-name\")\n        public String getName() {\n            return name;\n        }\n\n        public String getProfession() {\n            return profession;\n        }\n\n        // public setters ...\n        public void setName(String name) {\n            this.name = name;\n        }\n        public void setProfession(String profession) {\n            this.profession = profession;\n        }\n    }\n    \n    @Test\n    public void testChangingPropertyNames2() {\n        Person2 p = new Person2();\n        p.name = \"Jason Bourne\";\n        p.profession = \"Super Agent\";\n        \n        String result = formattingJsonb.toJson(p);\n        assertEquals(\"{\\n\" + \n                \"    \\\"person-name\\\": \\\"Jason Bourne\\\",\\n\" + \n                \"    \\\"profession\\\": \\\"Super Agent\\\"\\n\" + \n                \"}\", result);\n    }\n    \n    public static class Person3 {\n        private String name;\n\n        @JsonbProperty(\"name-to-write\")\n        public String getName() {\n            return name;\n        }\n\n        @JsonbProperty(\"name-to-read\")\n        public void setName(String name) {\n            this.name = name;\n        }\n    }\n    \n    @Test\n    public void testChangingPropertyNames3() {\n        Person3 p = new Person3();\n        p.name = \"Jason Bourne\";\n        String result = defaultJsonb.toJson(p);\n        assertEquals(\"{\\\"name-to-write\\\":\\\"Jason Bourne\\\"}\", result);\n        \n        String json = \"{\\\"name-to-read\\\":\\\"Jason Bourne\\\"}\";\n        Person3 after = defaultJsonb.fromJson(json, Person3.class);\n        assertEquals(\"Jason Bourne\", after.name);\n    }\n    \n    public static class Person4 { // TODO: a non-static class results in an NPE\n        @JsonbTransient\n        private String name;\n\n        private String profession;\n\n        // public getters/setters ...\n        public String getName() {\n            return name;\n        }\n        public void setName(String name) {\n            this.name = name;\n        }\n        public String getProfession() {\n            return this.profession;\n        }\n        public void setProfession(String profession) {\n            this.profession = profession;\n        }\n    }\n    \n    @Test\n    public void testIgnoringProperties() {\n        Person4 p = new Person4();\n        p.name = \"Jason Bourne\";\n        p.profession = \"Super Agent\";\n        String result = defaultJsonb.toJson(p);\n        assertEquals(\"{\\\"profession\\\":\\\"Super Agent\\\"}\", result);\n        \n        String json = \"{\\\"profession\\\":\\\"Super Agent\\\"}\";\n        Person4 after = defaultJsonb.fromJson(json, Person4.class);\n        assertEquals(\"Super Agent\", after.profession);\n        assertNull(after.name);\n    }\n    \n    @JsonbNillable\n    public class Person5 {\n        private String name;\n        private String profession;\n\n        // public getters/setters ...\n        public String getName() {\n            return name;\n        }\n        public void setName(String name) {\n            this.name = name;\n        }\n        public String getProfession() {\n            return profession;\n        }\n        public void setProfession(String profession) {\n            this.profession = profession;\n        }\n    }\n    \n    @Test\n    public void testNullHandling1() {\n        Person5 p = new Person5();\n        String result = defaultJsonb.toJson(p);\n        assertEquals(\"{\\\"name\\\":null,\\\"profession\\\":null}\", result);\n    }\n    \n    public class Person6 {\n        @JsonbProperty(nillable=true)\n        private String name;\n\n        private String profession;\n\n        // public getters/setters ...\n        public String getName() {\n            return name;\n        }\n        public void setName(String name) {\n            this.name = name;\n        }\n        public String getProfession() {\n            return profession;\n        }\n        public void setProfession(String profession) {\n            this.profession = profession;\n        }\n    }\n    \n    @Test\n    public void testNullHandling2() {\n        Person6 p = new Person6();\n        String result = defaultJsonb.toJson(p);\n        assertEquals(\"{\\\"name\\\":null}\", result);\n    }\n    \n    public static class Person {\n        public String name;\n        public String profession;\n    }\n\n    @Test\n    public void testNullHandling3() {\n        Person p = new Person();\n        String result = nullableJsonb.toJson(p);\n        assertEquals(\"{\\\"name\\\":null,\\\"profession\\\":null}\", result);\n    }\n    \n    public static class Person8 { // TODO: obscure error here if non-static\n        public final String name;\n        public String profession;\n\n        @JsonbCreator\n        public Person8(@JsonbProperty(\"name\") String name) {\n            this.name = name;\n        }\n    }\n    \n    @Test\n    public void testCustomInstantiation() {\n        Person8 p = defaultJsonb.fromJson(\"{\\\"name\\\":\\\"Jason Bourne\\\"}\", Person8.class);\n        assertEquals(\"Jason Bourne\", p.name);\n    }\n    \n    public static class Person9 {\n        public String name;\n\n        @JsonbDateFormat(\"dd.MM.yyyy\")\n        public LocalDate birthDate;\n\n        @JsonbNumberFormat(\"#0.00\")\n        public BigDecimal salary;\n    }\n    \n    @Test\n    public void testDateNumberFormats1() {\n        Person9 p = new Person9();\n        p.name = \"Jason Bourne\";\n        p.birthDate = LocalDate.of(1999, 8, 7);\n        p.salary = new BigDecimal(\"123.45678\");\n        String json = defaultJsonb.toJson(p);\n        assertEquals(\"{\\\"birthDate\\\":\\\"07.08.1999\\\",\\\"name\\\":\\\"Jason Bourne\\\",\\\"salary\\\":\\\"123.46\\\"}\", json);\n        \n        Person9 after = defaultJsonb.fromJson(\"{\\\"birthDate\\\":\\\"07.08.1999\\\",\\\"name\\\":\\\"Jason Bourne\\\",\\\"salary\\\":\\\"123.46\\\"}\", Person9.class);\n        assertEquals(p.name, after.name);\n        assertEquals(p.birthDate, after.birthDate);\n        assertEquals(new BigDecimal(\"123.46\"), after.salary);\n    }\n    \n    public static class Person10 {\n        public String name;\n\n        public LocalDate birthDate;\n\n        public BigDecimal salary;\n    }\n    \n    @Test\n    public void testDateNumberFormats2() {\n        Person10 p = new Person10();\n        p.name = \"Jason Bourne\";\n        p.birthDate = LocalDate.of(1999, 8, 7);\n        p.salary = new BigDecimal(\"123.45678\");\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig()//\n                .withDateFormat(\"dd.MM.yyyy\", null)); // TODO: why no withNumberFormat?\n        String json = jsonb.toJson(p);\n        assertEquals(\"{\\\"birthDate\\\":\\\"07.08.1999\\\",\\\"name\\\":\\\"Jason Bourne\\\",\\\"salary\\\":123.45678}\", json);\n        \n        Person9 after = jsonb.fromJson(\"{\\\"birthDate\\\":\\\"07.08.1999\\\",\\\"name\\\":\\\"Jason Bourne\\\",\\\"salary\\\":123.45678}\", Person9.class);\n        assertEquals(p.name, after.name);\n        assertEquals(p.birthDate, after.birthDate);\n        assertEquals(p.salary, after.salary);\n    }\n    \n    public static class Customer {\n        private int id;\n        private String name;\n        private String organization;\n        private String position;\n        \n        public int getId() {\n            return id;\n        }\n        public void setId(int id) {\n            this.id = id;\n        }\n        public String getName() {\n            return name;\n        }\n        public void setName(String name) {\n            this.name = name;\n        }\n        public String getOrganization() {\n            return organization;\n        }\n        public void setOrganization(String organization) {\n            this.organization = organization;\n        }\n        public String getPosition() {\n            return position;\n        }\n        public void setPosition(String position) {\n            this.position = position;\n        }\n    }\n\n    public static class CustomerAnnotated {\n        @JsonbProperty(\"customer_id\")\n        private int id;\n\n        @JsonbProperty(\"customer_name\")\n        private String name;\n        \n        public int getId() {\n            return id;\n        }\n        public void setId(int id) {\n            this.id = id;\n        }\n        public String getName() {\n            return name;\n        }\n        public void setName(String name) {\n            this.name = name;\n        }\n    }\n\n    public static class CustomerAdapter implements JsonbAdapter<Customer, CustomerAnnotated> {\n        @Override\n        public CustomerAnnotated adaptToJson(Customer c) throws Exception {\n            CustomerAnnotated customer = new CustomerAnnotated();\n            customer.setId(c.getId());\n            customer.setName(c.getName());\n            return customer;\n        }\n\n        @Override\n        public Customer adaptFromJson(CustomerAnnotated adapted) throws Exception {\n            Customer customer = new Customer();\n            customer.setId(adapted.getId());\n            customer.setName(adapted.getName());\n            return customer;\n        }\n    }\n    \n    @Test\n    public void testAdapters1() {\n        // Create customer\n        Customer customer = new Customer();\n\n        customer.setId(1);\n        customer.setName(\"Jason Bourne\");\n        customer.setOrganization(\"Super Agents\");\n        customer.setPosition(\"Super Agent\");\n\n        // Serialize\n        String json = defaultJsonb.toJson(customer);\n        assertEquals(\"{\\\"id\\\":1,\\\"name\\\":\\\"Jason Bourne\\\",\\\"organization\\\":\\\"Super Agents\\\",\\\"position\\\":\\\"Super Agent\\\"}\", json);\n    }\n    \n    @Test\n    public void testAdapters2() {\n     // Create custom configuration\n        JsonbConfig config = new JsonbConfig()\n            .withAdapters(new CustomerAdapter());\n\n        // Create Jsonb with custom configuration\n        Jsonb jsonb = JsonbBuilder.create(config);\n\n        // Create customer\n        Customer customer = new Customer();\n\n        customer.setId(1);\n        customer.setName(\"Jason Bourne\");\n        customer.setOrganization(\"Super Agents\");\n        customer.setPosition(\"Super Agent\");\n\n        // Serialize\n        String json = jsonb.toJson(customer);\n        assertEquals(\"{\\\"customer_id\\\":1,\\\"customer_name\\\":\\\"Jason Bourne\\\"}\", json);\n    }\n    \n    public static class CustomerSerializer implements JsonbSerializer<Customer> {\n        @Override\n        public void serialize(Customer customer, JsonGenerator generator, SerializationContext ctx) {\n            generator.writeStartObject();\n            generator.write(\"customer_id\", customer.getId());\n            generator.write(\"customer_name\", customer.getName());\n            generator.writeEnd();\n        }\n    }\n\n    public static class CustomerDeserializer implements JsonbDeserializer<Customer> {\n        @Override\n        public Customer deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {\n            Customer customer = new Customer();\n            JsonParser.Event next;\n\n            // Moving parser by hand looking for customer_id and customer_name properties\n            while ((next = parser.next()) != JsonParser.Event.END_OBJECT) {\n                if (next == JsonParser.Event.KEY_NAME) {\n                    String jsonKeyName = parser.getString();\n\n                    // Move to json value\n                    parser.next();\n\n                    if (\"customer_id\".equals(jsonKeyName)) {\n                        customer.setId(parser.getInt());\n                    } else if (\"customer_name\".equals(jsonKeyName)) {\n                        customer.setName(parser.getString());\n                    }\n                }\n            }\n            return customer;\n        }\n    }\n    \n    @Test\n    public void testSerializerDeserializer() {\n        // Create pojo\n        Customer customer = new Customer();\n        customer.setId(1);\n        customer.setName(\"Freddie\");\n        customer.setOrganization(\"Super Agents\");\n        customer.setPosition(\"Super Agent\");\n\n        // Also configurable with @JsonbSerializer / JsonbDeserializer on properties and class.\n        JsonbConfig config = new JsonbConfig()\n                .withSerializers(new CustomerSerializer())\n                .withDeserializers(new CustomerDeserializer());\n\n        Jsonb jsonb = JsonbBuilder.create(config);\n        String json = jsonb.toJson(customer);\n        assertEquals(\"{\\\"customer_id\\\":1,\\\"customer_name\\\":\\\"Freddie\\\"}\", json);\n        \n        Customer result = jsonb.fromJson(json, Customer.class);\n        assertEquals(customer.getId(), result.getId());\n        assertEquals(customer.getName(), result.getName());\n        assertNull(result.getOrganization());\n        assertNull(result.getPosition());\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/AnnotationFinderTest.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport static org.eclipse.yasson.internal.AnnotationFinderTestFixtures.TESTVALUE;\nimport static org.eclipse.yasson.internal.AnnotationFinderTestFixtures.getConstructorAnnotationsOf;\nimport static org.eclipse.yasson.internal.AnnotationFinderTestFixtures.getMethodAnnotationsOf;\n\nimport org.eclipse.yasson.internal.AnnotationFinderTestFixtures.AnnotationAnnotatedWithDeprecated;\nimport org.eclipse.yasson.internal.AnnotationFinderTestFixtures.AnnotationWithoutValueProperty;\nimport org.eclipse.yasson.internal.AnnotationFinderTestFixtures.ObjectWithConstructAnnotation;\nimport org.eclipse.yasson.internal.AnnotationFinderTestFixtures.ObjectWithDeprecatedAndIgnoredMethod;\nimport org.eclipse.yasson.internal.AnnotationFinderTestFixtures.ObjectWithDeprecatedMethod;\nimport org.eclipse.yasson.internal.AnnotationFinderTestFixtures.ObjectWithIgnoredAndInheritedDeprecatedMethod;\nimport org.eclipse.yasson.internal.AnnotationFinderTestFixtures.ObjectWithIgnoredMethod;\nimport org.eclipse.yasson.internal.AnnotationFinderTestFixtures.ObjectWithInheritedAndDirectlyDeprecatedMethod;\nimport org.eclipse.yasson.internal.AnnotationFinderTestFixtures.ObjectWithInheritedDeprecatedMethod;\nimport org.eclipse.yasson.internal.AnnotationFinderTestFixtures.ObjectWithMissingValuePropertyAnnotation;\nimport org.eclipse.yasson.internal.AnnotationFinderTestFixtures.ObjectWithNoAnnotations;\n\npublic class AnnotationFinderTest {\n\n    /**\n     * class under test.\n     */\n    private AnnotationFinder findAnnotation = AnnotationFinder.findAnnotation(Deprecated.class);\n\n    @Test\n    public void testAnnotationShouldBeFound() {\n        assertNotNull(findAnnotation.in(getMethodAnnotationsOf(ObjectWithDeprecatedMethod.class)));\n    }\n\n    @Test\n    public void testAnnotationShouldBeFoundWithinOthers() {\n        assertNotNull(findAnnotation.in(getMethodAnnotationsOf(ObjectWithDeprecatedAndIgnoredMethod.class)));\n    }\n\n    @Test\n    public void testInheritedAnnotationShouldBeFound() {\n        Deprecated annotation = findAnnotation.in(getMethodAnnotationsOf(ObjectWithInheritedDeprecatedMethod.class));\n        assertEquals(\"inherited\", annotation.since());\n    }\n\n    @Test\n    public void testInheritedAnnotationShouldBeFoundWithinOthers() {\n        Deprecated annotation = findAnnotation.in(getMethodAnnotationsOf(ObjectWithIgnoredAndInheritedDeprecatedMethod.class));\n        assertEquals(\"inherited\", annotation.since());\n    }\n\n    @Test\n    public void testDirectAnnotationShouldBePreferedOverInheritedOnes() {\n        Deprecated annotation = findAnnotation.in(getMethodAnnotationsOf(ObjectWithInheritedAndDirectlyDeprecatedMethod.class));\n        assertEquals(\"\", annotation.since());\n    }\n\n    @Test\n    public void testResultShouldBeNullWhenThereIsNoAnnotation() {\n        assertNull(findAnnotation.in(getMethodAnnotationsOf(ObjectWithNoAnnotations.class)));\n    }\n\n    @Test\n    public void testResultShouldBeNullWhenThereAreOnlyOtherAnnotations() {\n        assertNull(findAnnotation.in(getMethodAnnotationsOf(ObjectWithIgnoredMethod.class)));\n    }\n\n    @Test\n    @SuppressWarnings(\"deprecation\")\n    public void testValueOfAnnotationShouldBeExtractedDynamically() {\n        findAnnotation = AnnotationFinder.findAnnotation(AnnotationAnnotatedWithDeprecated.class);\n        assertEquals(TESTVALUE, findAnnotation.valueIn(getMethodAnnotationsOf(ObjectWithInheritedDeprecatedMethod.class)));\n    }\n\n    @Test\n    public void testValueOfAnnotationShouldBeNullIfAnnotationDoesNotExist() {\n        findAnnotation = AnnotationFinder.findAnnotation(ObjectWithNoAnnotations.class);\n        assertNull(findAnnotation.valueIn(getMethodAnnotationsOf(ObjectWithInheritedDeprecatedMethod.class)));\n    }\n\n    @Test\n    public void testValueOfConstructorAnnotation() {\n        findAnnotation = AnnotationFinder.findConstructorProperties();\n        assertArrayEquals(new Object[] { TESTVALUE }, (Object[]) findAnnotation.valueIn(getConstructorAnnotationsOf(ObjectWithConstructAnnotation.class)));\n    }\n\n    @Test\n    @SuppressWarnings(\"deprecation\")\n    public void testValueOfConstructorMetaAnnotation() {\n        findAnnotation = AnnotationFinder.findAnnotation(AnnotationAnnotatedWithDeprecated.class);\n        assertEquals(TESTVALUE, findAnnotation.valueIn(getConstructorAnnotationsOf(ObjectWithConstructAnnotation.class)));\n    }\n\n    @Test\n    public void testIgnorenNonExistingOptionalAnnotationClassName() {\n        findAnnotation = AnnotationFinder.findAnnotationByName(\"java.nnnooootttt.eexxxxiissttting.Class\");\n        assertNull(findAnnotation.in(getMethodAnnotationsOf(ObjectWithIgnoredMethod.class)));\n    }\n\n    @Test\n    public void testIgnorenAnnotationAnnotationWithoutValueProperty() {\n        findAnnotation = AnnotationFinder.findAnnotation(AnnotationWithoutValueProperty.class);\n        assertNull(findAnnotation.valueIn(getMethodAnnotationsOf(ObjectWithMissingValuePropertyAnnotation.class)));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/AnnotationFinderTestFixtures.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport org.junit.jupiter.api.*;\n\nimport static java.lang.annotation.ElementType.CONSTRUCTOR;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\n\nimport java.beans.ConstructorProperties;\nimport java.lang.annotation.Annotation;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Disabled\nclass AnnotationFinderTestFixtures {\n\n    public static final String TESTVALUE = \"testvalue\";\n\n    public static final Annotation[] getMethodAnnotationsOf(Class<?> clazz) {\n        try {\n            return clazz.getMethod(\"annotatedMethod\").getAnnotations();\n        } catch (NoSuchMethodException | SecurityException e) {\n            throw new IllegalStateException(e);\n        }\n    }\n\n    public static final Annotation[] getConstructorAnnotationsOf(Class<?> clazz) {\n        try {\n            return clazz.getConstructor(String.class).getAnnotations();\n        } catch (NoSuchMethodException | SecurityException e) {\n            throw new IllegalStateException(e);\n        }\n    }\n\n    public static class ObjectWithNoAnnotations {\n        public void annotatedMethod() {\n            // empty\n        }\n    }\n\n    public static class ObjectWithDeprecatedMethod {\n        @Deprecated\n        public void annotatedMethod() {\n            // empty\n        }\n    }\n\n    public static class ObjectWithIgnoredMethod {\n        @Disabled\n        public void annotatedMethod() {\n            // empty\n        }\n    }\n\n    public static class ObjectWithDeprecatedAndIgnoredMethod {\n    \t@Disabled\n        @Deprecated\n        public void annotatedMethod() {\n            // empty\n        }\n    }\n\n    public static class ObjectWithInheritedDeprecatedMethod {\n        @AnnotationAnnotatedWithDeprecated()\n        public void annotatedMethod() {\n            // empty\n        }\n    }\n\n    public static class ObjectWithIgnoredAndInheritedDeprecatedMethod {\n    \t@Disabled\n        @AnnotationAnnotatedWithDeprecated\n        public void annotatedMethod() {\n            // empty\n        }\n    }\n\n    public static class ObjectWithInheritedAndDirectlyDeprecatedMethod {\n        @Deprecated\n        @AnnotationAnnotatedWithDeprecated\n        public void annotatedMethod() {\n            // empty\n        }\n    }\n\n    public static class ObjectWithConstructAnnotation {\n        @AnnotationAnnotatedWithDeprecated\n        @ConstructorProperties({ TESTVALUE })\n        public ObjectWithConstructAnnotation(String testvalue) {\n            // empty\n        }\n    }\n\n    public static class ObjectWithMissingValuePropertyAnnotation {\n        @AnnotationWithoutValueProperty\n        public void annotatedMethod() {\n            // empty\n        }\n    }\n\n    @Retention(RetentionPolicy.RUNTIME)\n    @Target(value = { METHOD, CONSTRUCTOR, TYPE })\n    @Deprecated(since = \"inherited\")\n    public @interface AnnotationAnnotatedWithDeprecated {\n\n        String value() default TESTVALUE;\n    }\n\n    @Retention(RetentionPolicy.RUNTIME)\n    @Target(value = { METHOD, CONSTRUCTOR, TYPE })\n    public @interface AnnotationWithoutValueProperty {\n\n        String someOtherProperty() default TESTVALUE;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/AnnotationIntrospectorTest.java",
    "content": "/*\n * Copyright (c) 2019, 2023 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport jakarta.json.bind.config.PropertyNamingStrategy;\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport static org.eclipse.yasson.internal.AnnotationIntrospectorTestAsserts.assertCreatedInstanceContainsAllParameters;\nimport static org.eclipse.yasson.internal.AnnotationIntrospectorTestAsserts.assertParameters;\n\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithJsonbCreatorAndConstructorPropertiesAnnotation;\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithJsonbCreatorAnnotatedConstructor;\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithJsonbCreatorAnnotatedFactoryMethod;\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithJsonbCreatorAnnotatedProtectedConstructor;\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithNoArgAndJsonbCreatorAnnotatedProtectedConstructor;\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithTwoJsonbCreatorAnnotatedSpots;\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithoutAnnotatedConstructor;\nimport org.eclipse.yasson.internal.model.JsonbCreator;\n\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.JsonbException;\n\nimport jakarta.json.spi.JsonProvider;\n\n/**\n * Tests the {@link AnnotationIntrospector}.\n * \n * @see AnnotationIntrospectorTestFixtures\n * @see AnnotationIntrospectorTestAsserts\n */\npublic class AnnotationIntrospectorTest {\n    private final JsonbContext jsonbContext = new JsonbContext(new JsonbConfig(), JsonProvider.provider());\n    private final PropertyNamingStrategy propertyNamingStrategy = jsonbContext.getConfigProperties().getPropertyNamingStrategy();\n\n    /**\n     * class under test.\n     */\n    private AnnotationIntrospector instrospector = new AnnotationIntrospector(jsonbContext);\n\n    @Test\n    public void testObjectShouldBeCreateableFromJsonbAnnotatedConstructor() {\n        JsonbCreator creator = instrospector.getCreator(ObjectWithJsonbCreatorAnnotatedConstructor.class, propertyNamingStrategy);\n        assertParameters(ObjectWithJsonbCreatorAnnotatedConstructor.parameters(), creator);\n        assertCreatedInstanceContainsAllParameters(ObjectWithJsonbCreatorAnnotatedConstructor.example(), creator);\n    }\n\n    @Test\n    public void testObjectShouldBeCreateableFromJsonbAnnotatedStaticFactoryMethod() {\n        JsonbCreator creator = instrospector.getCreator(ObjectWithJsonbCreatorAnnotatedFactoryMethod.class, propertyNamingStrategy);\n        assertParameters(ObjectWithJsonbCreatorAnnotatedFactoryMethod.parameters(), creator);\n        assertCreatedInstanceContainsAllParameters(ObjectWithJsonbCreatorAnnotatedFactoryMethod.example(), creator);\n    }\n\n    @Test\n    public void testObjectShouldBeCreateableFromJsonbAnnotatedStaticFactoryMethodIgnoringConstructorPorperties() {\n        JsonbCreator creator = instrospector.getCreator(ObjectWithJsonbCreatorAndConstructorPropertiesAnnotation.class, propertyNamingStrategy);\n        assertParameters(ObjectWithJsonbCreatorAndConstructorPropertiesAnnotation.parameters(), creator);\n        assertCreatedInstanceContainsAllParameters(ObjectWithJsonbCreatorAndConstructorPropertiesAnnotation.example(), creator);\n    }\n\n    @Test\n    public void testJsonbAnnotatedProtectedConstructorLeadsToAnException() {\n        assertThrows(JsonbException.class, () -> {\n\t        JsonbCreator creator = instrospector.getCreator(ObjectWithJsonbCreatorAnnotatedProtectedConstructor.class, propertyNamingStrategy);\n\t        assertCreatedInstanceContainsAllParameters(ObjectWithJsonbCreatorAnnotatedProtectedConstructor.example(), creator);\n        });\n    }\n\n    // TODO Under discussion: https://github.com/eclipse-ee4j/yasson/issues/326\n    @Disabled\n    @Test\n    public void testNoArgConstructorShouldBePreferredOverUnusableJsonbAnnotatedProtectedConstructor() {\n        JsonbCreator creator = instrospector.getCreator(ObjectWithNoArgAndJsonbCreatorAnnotatedProtectedConstructor.class, propertyNamingStrategy);\n        assertParameters(ObjectWithNoArgAndJsonbCreatorAnnotatedProtectedConstructor.parameters(), creator);\n        assertCreatedInstanceContainsAllParameters(ObjectWithNoArgAndJsonbCreatorAnnotatedProtectedConstructor.example(), creator);\n    }\n\n    @Test\n    public void testMoreThanOneAnnotatedCreatorMethodShouldLeadToAnException() {\n        assertThrows(JsonbException.class, \n        \t\t\t() -> instrospector.getCreator(ObjectWithTwoJsonbCreatorAnnotatedSpots.class, propertyNamingStrategy),\n        \t\t\t() -> \"More than one @\" + JsonbCreator.class.getSimpleName());\n    }\n\n    @Test\n    public void testCreatorShouldBeNullOnMissingConstructorAnnotation() {\n        assertNull(instrospector.getCreator(ObjectWithoutAnnotatedConstructor.class, propertyNamingStrategy));\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/AnnotationIntrospectorTestAsserts.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ProvidesParameterRepresentation;\nimport org.eclipse.yasson.internal.model.CreatorModel;\nimport org.eclipse.yasson.internal.model.JsonbCreator;\n\nimport java.lang.reflect.Type;\nimport java.util.Map;\nimport java.util.Map.Entry;\n\n@Disabled\nclass AnnotationIntrospectorTestAsserts {\n\n    /**\n     * Creates a new Instance of the Object using the given {@link JsonbCreator} and compares the result with the given\n     * expected Object. The comparison is done by comparing both {@link ProvidesParameterRepresentation#asParameters()}.\n     * \n     * @param expected {@link ProvidesParameterRepresentation}\n     * @param creator  {@link JsonbCreator}\n     */\n    public static <T extends ProvidesParameterRepresentation> void assertCreatedInstanceContainsAllParameters(T expected, JsonbCreator creator) {\n        assertNotNull(creator, JsonbCreator.class.getSimpleName() + \" expected\");\n        @SuppressWarnings(\"unchecked\")\n        T created = (T) creator.call(expected.asParameters(), expected.getClass());\n        assertArrayEquals(expected.asParameters(), created.asParameters());\n    }\n\n    /**\n     * Compares the expected parameters with the meta-model contained in the {@link JsonbCreator}.\n     * \n     * @param expectedParameters {@link Map} with {@link String}-Key and {@link Type}-Value\n     * @param creator            CreatorModel\n     */\n    public static void assertParameters(Map<String, Type> expectedParameters, JsonbCreator creator) {\n        assertNotNull(creator, JsonbCreator.class.getSimpleName() + \" expected\");\n        for (Entry<String, Type> parameter : expectedParameters.entrySet()) {\n            CreatorModel creatorModel = creator.findByName(parameter.getKey());\n            assertEquals(parameter.getKey(), creatorModel.getName());\n            assertEquals(parameter.getValue(), creatorModel.getType());\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/AnnotationIntrospectorTestFixtures.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport org.junit.jupiter.api.*;\n\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbProperty;\n\nimport java.beans.ConstructorProperties;\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Type;\nimport java.security.AccessController;\nimport java.security.PrivilegedAction;\nimport java.util.HashMap;\nimport java.util.Map;\n\n@Disabled\nclass AnnotationIntrospectorTestFixtures {\n\n    public static interface ProvidesParameterRepresentation {\n        Object[] asParameters();\n    }\n\n    private static final Map<String, Type> twoParameters(String name1, Type type1, String name2, Type type2) {\n        Map<String, Type> parameters = new HashMap<>();\n        parameters.put(name1, type1);\n        parameters.put(name2, type2);\n        return parameters;\n    }\n\n    public static Constructor<?>[] constructorsOf(Class<?> clazz) {\n        return AccessController.doPrivileged((PrivilegedAction<Constructor<?>[]>) clazz::getDeclaredConstructors);\n    }\n\n    public static class ObjectWithoutAnnotatedConstructor implements ProvidesParameterRepresentation {\n        private final String string;\n        private final long primitive;\n\n        public static final Map<String, Type> parameters() {\n            return twoParameters(\"string\", String.class, \"primitive\", long.class);\n        }\n\n        public static final ProvidesParameterRepresentation example() {\n            return new ObjectWithoutAnnotatedConstructor(\"a string\", Long.MAX_VALUE);\n        }\n\n        public ObjectWithoutAnnotatedConstructor(String aString, long aPrimitive) {\n            this.string = aString;\n            this.primitive = aPrimitive;\n        }\n\n        @Override\n        public Object[] asParameters() {\n            return new Object[] { string, primitive };\n        }\n\n        @Override\n        public String toString() {\n            return \"ObjectWithNotAnnotatedConstructor [string=\" + string + \", primitive=\" + primitive + \"]\";\n        }\n    }\n\n    public static class ObjectWithJsonbCreatorAnnotatedConstructor implements ProvidesParameterRepresentation {\n        private final String string;\n        private final long primitive;\n\n        public static final Map<String, Type> parameters() {\n            return twoParameters(\"string\", String.class, \"primitive\", long.class);\n        }\n\n        public static final ProvidesParameterRepresentation example() {\n            return new ObjectWithJsonbCreatorAnnotatedConstructor(\"a string\", Long.MAX_VALUE);\n        }\n\n        @JsonbCreator\n        public ObjectWithJsonbCreatorAnnotatedConstructor( //\n                @JsonbProperty(\"string\") String aString, //\n                @JsonbProperty(\"primitive\") long aPrimitive) {\n            this.string = aString;\n            this.primitive = aPrimitive;\n        }\n\n        @Override\n        public Object[] asParameters() {\n            return new Object[] { string, primitive };\n        }\n\n        @Override\n        public String toString() {\n            return \"ObjectWithJsonbCreatorAnnotatedConstructor [string=\" + string + \", primitive=\" + primitive + \"]\";\n        }\n    }\n\n    public static class ObjectWithJsonbCreatorAnnotatedProtectedConstructor implements ProvidesParameterRepresentation {\n        private final String string;\n        private final long primitive;\n\n        public static final Map<String, Type> parameters() {\n            return twoParameters(\"string\", String.class, \"primitive\", long.class);\n        }\n\n        public static final ProvidesParameterRepresentation example() {\n            return new ObjectWithJsonbCreatorAnnotatedProtectedConstructor(\"a string\", Long.MAX_VALUE);\n        }\n\n        @JsonbCreator\n        protected ObjectWithJsonbCreatorAnnotatedProtectedConstructor( //\n                @JsonbProperty(\"string\") String aString, //\n                @JsonbProperty(\"primitive\") long aPrimitive) {\n            this.string = aString;\n            this.primitive = aPrimitive;\n        }\n\n        @Override\n        public Object[] asParameters() {\n            return new Object[] { string, primitive };\n        }\n\n        @Override\n        public String toString() {\n            return \"ObjectWithJsonbCreatorAnnotatedProtectedConstructor [string=\" + string + \", primitive=\" + primitive + \"]\";\n        }\n    }\n\n    public static class ObjectWithNoArgAndJsonbCreatorAnnotatedProtectedConstructor implements ProvidesParameterRepresentation {\n        private String string;\n        private long primitive;\n\n        public static final Map<String, Type> parameters() {\n            return twoParameters(\"string\", String.class, \"primitive\", long.class);\n        }\n\n        public static final ProvidesParameterRepresentation example() {\n            return new ObjectWithNoArgAndJsonbCreatorAnnotatedProtectedConstructor(\"a string\", Long.MAX_VALUE);\n        }\n\n        public ObjectWithNoArgAndJsonbCreatorAnnotatedProtectedConstructor() {\n            super();\n        }\n\n        @JsonbCreator\n        protected ObjectWithNoArgAndJsonbCreatorAnnotatedProtectedConstructor( //\n                @JsonbProperty(\"string\") String aString, //\n                @JsonbProperty(\"primitive\") long aPrimitive) {\n            this.string = aString;\n            this.primitive = aPrimitive;\n        }\n\n        public String getString() {\n            return string;\n        }\n\n        public void setString(String string) {\n            this.string = string;\n        }\n\n        public long getPrimitive() {\n            return primitive;\n        }\n\n        public void setPrimitive(long primitive) {\n            this.primitive = primitive;\n        }\n\n        @Override\n        public Object[] asParameters() {\n            return new Object[] { string, primitive };\n        }\n\n        @Override\n        public String toString() {\n            return \"ObjectWithNoArgAndJsonbCreatorAnnotatedProtectedConstructor [string=\" + string + \", primitive=\" + primitive + \"]\";\n        }\n    }\n\n    public static class ObjectWithJsonbCreatorAnnotatedFactoryMethod implements ProvidesParameterRepresentation {\n        private final String string;\n        private final long primitive;\n\n        public static final Map<String, Type> parameters() {\n            return twoParameters(\"string\", String.class, \"primitive\", long.class);\n        }\n\n        public static final ProvidesParameterRepresentation example() {\n            return new ObjectWithJsonbCreatorAnnotatedFactoryMethod(\"text\", Long.MIN_VALUE);\n        }\n\n        @JsonbCreator\n        public static final ObjectWithJsonbCreatorAnnotatedFactoryMethod create( //\n                @JsonbProperty(\"string\") String aString, //\n                @JsonbProperty(\"primitive\") long aPrimitive) {\n            return new ObjectWithJsonbCreatorAnnotatedFactoryMethod(aString, aPrimitive);\n        }\n\n        private ObjectWithJsonbCreatorAnnotatedFactoryMethod(String string, long primitiv) {\n            this.string = string;\n            this.primitive = primitiv;\n        }\n\n        @Override\n        public Object[] asParameters() {\n            return new Object[] { string, primitive };\n        }\n\n        @Override\n        public String toString() {\n            return \"ObjectWithJsonbCreatorAnnotatedFactoryMethod [string=\" + string + \", primitive=\" + primitive + \"]\";\n        }\n    }\n\n    public static class ObjectWithTwoJsonbCreatorAnnotatedSpots implements ProvidesParameterRepresentation {\n        private final String string;\n        private final long primitive;\n\n        public static final Map<String, Type> parameters() {\n            return twoParameters(\"string\", String.class, \"primitive\", long.class);\n        }\n\n        public static final ProvidesParameterRepresentation example() {\n            return new ObjectWithJsonbCreatorAnnotatedConstructor(\"\", Long.valueOf(0));\n        }\n\n        @JsonbCreator\n        public static final ObjectWithTwoJsonbCreatorAnnotatedSpots create( //\n                @JsonbProperty(\"string\") String aString, //\n                @JsonbProperty(\"primitive\") long aPrimitive) {\n            return new ObjectWithTwoJsonbCreatorAnnotatedSpots(aString, aPrimitive);\n        }\n\n        @JsonbCreator\n        public ObjectWithTwoJsonbCreatorAnnotatedSpots( //\n                @JsonbProperty(\"string\") String aString, //\n                @JsonbProperty(\"primitive\") long aPrimitive) {\n            this.string = aString;\n            this.primitive = aPrimitive;\n        }\n\n        @Override\n        public Object[] asParameters() {\n            return new Object[] { string, primitive };\n        }\n\n        @Override\n        public String toString() {\n            return \"ObjectWithTwoJsonbCreatorAnnotatedSpots [string=\" + string + \", primitive=\" + primitive + \"]\";\n        }\n    }\n\n    public static class ObjectWithConstructorPropertiesAnnotation implements ProvidesParameterRepresentation {\n        private final String string;\n        private final long primitive;\n\n        public static final Map<String, Type> parameters() {\n            return twoParameters(\"string\", String.class, \"primitive\", long.class);\n        }\n\n        public static final ProvidesParameterRepresentation example() {\n            return new ObjectWithConstructorPropertiesAnnotation(\"  \", Long.valueOf(-12));\n        }\n\n        @ConstructorProperties({ \"string\", \"primitive\" })\n        public ObjectWithConstructorPropertiesAnnotation(String aString, long aPrimitive) {\n            this.string = aString;\n            this.primitive = aPrimitive;\n        }\n\n        @Override\n        public Object[] asParameters() {\n            return new Object[] { string, primitive };\n        }\n\n        @Override\n        public String toString() {\n            return \"ObjectWithConstructorPropertiesAnnotatedConstructor [string=\" + string + \", primitive=\" + primitive + \"]\";\n        }\n    }\n\n    public static class ObjectWithTwoConstructorPropertiesAnnotation implements ProvidesParameterRepresentation {\n        private final String string;\n        private final long primitive;\n\n        public static final Map<String, Type> parameters() {\n            return twoParameters(\"string\", String.class, \"primitive\", long.class);\n        }\n\n        public static final ProvidesParameterRepresentation example() {\n            return new ObjectWithTwoConstructorPropertiesAnnotation(\"  \", Long.valueOf(-12));\n        }\n\n        @ConstructorProperties({ \"string\" })\n        public ObjectWithTwoConstructorPropertiesAnnotation(String aString) {\n            this(aString, 0L);\n        }\n\n        @ConstructorProperties({ \"string\", \"primitive\" })\n        public ObjectWithTwoConstructorPropertiesAnnotation(String aString, long aPrimitive) {\n            this.string = aString;\n            this.primitive = aPrimitive;\n        }\n\n        @Override\n        public Object[] asParameters() {\n            return new Object[] { string, primitive };\n        }\n\n        @Override\n        public String toString() {\n            return \"ObjectWithTwoConstructorPropertiesAnnotation [string=\" + string + \", primitive=\" + primitive + \"]\";\n        }\n    }\n\n    public static class ObjectWithJsonbCreatorAndConstructorPropertiesAnnotation implements ProvidesParameterRepresentation {\n        private final String string;\n        private final long primitive;\n\n        public static final Map<String, Type> parameters() {\n            return twoParameters(\"string\", String.class, \"primitive\", long.class);\n        }\n\n        public static final ProvidesParameterRepresentation example() {\n            return new ObjectWithJsonbCreatorAndConstructorPropertiesAnnotation(\"\", Long.valueOf(0));\n        }\n\n        @JsonbCreator\n        public static final ObjectWithJsonbCreatorAndConstructorPropertiesAnnotation create( //\n                @JsonbProperty(\"string\") String aString, //\n                @JsonbProperty(\"primitive\") long aPrimitive) {\n            return new ObjectWithJsonbCreatorAndConstructorPropertiesAnnotation(aString, aPrimitive);\n        }\n\n        @ConstructorProperties({ \"string\", \"primitive\" })\n        public ObjectWithJsonbCreatorAndConstructorPropertiesAnnotation(String aString, long aPrimitive) {\n            this.string = aString;\n            this.primitive = aPrimitive;\n        }\n\n        @Override\n        public Object[] asParameters() {\n            return new Object[] { string, primitive };\n        }\n\n        @Override\n        public String toString() {\n            return \"ObjectWithJsonbCreatorAndConstructorPropertiesAnnotation [string=\" + string + \", primitive=\" + primitive + \"]\";\n        }\n    }\n\n    public static class ObjectWithPublicNoArgAndAnnotatedPrivateConstructor implements ProvidesParameterRepresentation {\n        private String string;\n        private Long primitive;\n\n        public static final Map<String, Type> parameters() {\n            return twoParameters(\"string\", String.class, \"primitive\", long.class);\n        }\n\n        public static final ProvidesParameterRepresentation example() {\n            return new ObjectWithPublicNoArgAndAnnotatedPrivateConstructor(\"  \", Long.valueOf(-12));\n        }\n\n        public ObjectWithPublicNoArgAndAnnotatedPrivateConstructor() {\n            super();\n        }\n\n        @ConstructorProperties({ \"string\", \"primitive\" })\n        private ObjectWithPublicNoArgAndAnnotatedPrivateConstructor(String aString, long aPrimitive) {\n            this.string = aString;\n            this.primitive = aPrimitive;\n        }\n\n        public Long getPrimitive() {\n            return primitive;\n        }\n\n        public void setPrimitive(Long primitive) {\n            this.primitive = primitive;\n        }\n\n        public String getString() {\n            return string;\n        }\n\n        public void setString(String string) {\n            this.string = string;\n        }\n\n        @Override\n        public Object[] asParameters() {\n            return new Object[] { string, primitive };\n        }\n\n        @Override\n        public String toString() {\n            return \"ObjectWithPublicNoArgAndAnnotatedPrivateConstructor [string=\" + string + \", primitive=\" + primitive + \"]\";\n        }\n    }\n\n    public static class ObjectWithPublicNoArgAndAnnotatedPackageProtectedConstructor implements ProvidesParameterRepresentation {\n        private String string;\n        private Long primitive;\n\n        public static final Map<String, Type> parameters() {\n            return twoParameters(\"string\", String.class, \"primitive\", long.class);\n        }\n\n        public static final ProvidesParameterRepresentation example() {\n            return new ObjectWithPublicNoArgAndAnnotatedPackageProtectedConstructor(\"  \", Long.valueOf(-12));\n        }\n\n        public static final ObjectWithPublicNoArgAndAnnotatedPackageProtectedConstructor create(String aString, long aPrimitive) {\n            return new ObjectWithPublicNoArgAndAnnotatedPackageProtectedConstructor(aString, aPrimitive);\n        }\n\n        public ObjectWithPublicNoArgAndAnnotatedPackageProtectedConstructor() {\n            super();\n        }\n\n        @ConstructorProperties({ \"string\", \"primitive\" })\n        ObjectWithPublicNoArgAndAnnotatedPackageProtectedConstructor(String aString, long aPrimitive) {\n            this.string = aString;\n            this.primitive = aPrimitive;\n        }\n\n        public Long getPrimitive() {\n            return primitive;\n        }\n\n        public void setPrimitive(Long primitive) {\n            this.primitive = primitive;\n        }\n\n        public String getString() {\n            return string;\n        }\n\n        public void setString(String string) {\n            this.string = string;\n        }\n\n        @Override\n        public Object[] asParameters() {\n            return new Object[] { string, primitive };\n        }\n\n        @Override\n        public String toString() {\n            return \"ObjectWithPublicNoArgAndAnnotatedPackageProtectedConstructor [string=\" + string + \", primitive=\" + primitive + \"]\";\n        }\n    }\n\n    public static class ObjectWithPublicNoArgAndAnnotatedProtectedConstructor implements ProvidesParameterRepresentation {\n        private String string;\n        private Long primitive;\n\n        public static final Map<String, Type> parameters() {\n            return twoParameters(\"string\", String.class, \"primitive\", long.class);\n        }\n\n        public static final ProvidesParameterRepresentation example() {\n            return new ObjectWithPublicNoArgAndAnnotatedPackageProtectedConstructor(\"  \", Long.valueOf(-12));\n        }\n\n        public static final ObjectWithPublicNoArgAndAnnotatedProtectedConstructor create(String aString, long aPrimitive) {\n            return new ObjectWithPublicNoArgAndAnnotatedProtectedConstructor(aString, aPrimitive);\n        }\n\n        @ConstructorProperties({ \"string\", \"primitive\" })\n        protected ObjectWithPublicNoArgAndAnnotatedProtectedConstructor(String aString, long aPrimitive) {\n            this.string = aString;\n            this.primitive = aPrimitive;\n        }\n\n        public ObjectWithPublicNoArgAndAnnotatedProtectedConstructor() {\n            super();\n        }\n\n        public Long getPrimitive() {\n            return primitive;\n        }\n\n        public void setPrimitive(Long primitive) {\n            this.primitive = primitive;\n        }\n\n        public String getString() {\n            return string;\n        }\n\n        public void setString(String string) {\n            this.string = string;\n        }\n\n        @Override\n        public Object[] asParameters() {\n            return new Object[] { string, primitive };\n        }\n\n        @Override\n        public String toString() {\n            return \"ObjectWithJsonbCreatorAndConstructorPropertiesAnnotation [string=\" + string + \", primitive=\" + primitive + \"]\";\n        }\n    }\n\n    public static class ObjectWithMissingConstructorAnnotation implements ProvidesParameterRepresentation {\n        private final String string;\n        private final long primitive;\n\n        public static final Map<String, Type> parameters() {\n            return twoParameters(\"string\", String.class, \"primitive\", long.class);\n        }\n\n        public static final ProvidesParameterRepresentation example() {\n            return new ObjectWithMissingConstructorAnnotation(\"a string\", Long.MAX_VALUE);\n        }\n\n        public ObjectWithMissingConstructorAnnotation(String aString, long aPrimitive) {\n            this.string = aString;\n            this.primitive = aPrimitive;\n        }\n\n        @Override\n        public Object[] asParameters() {\n            return new Object[] { string, primitive };\n        }\n\n        @Override\n        public String toString() {\n            return \"ObjectWithMissingConstructorAnnotation [string=\" + string + \", primitive=\" + primitive + \"]\";\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/AnnotationIntrospectorWithoutOptionalModulesTest.java",
    "content": "/*\n * Copyright (c) 2019, 2023 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport static org.eclipse.yasson.internal.AnnotationIntrospectorTestAsserts.assertCreatedInstanceContainsAllParameters;\nimport static org.eclipse.yasson.internal.AnnotationIntrospectorTestAsserts.assertParameters;\nimport static org.junit.jupiter.api.Assertions.assertNull;\nimport static org.junit.jupiter.api.Assertions.fail;\n\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.config.PropertyNamingStrategy;\nimport jakarta.json.spi.JsonProvider;\n\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithJsonbCreatorAnnotatedConstructor;\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithJsonbCreatorAnnotatedFactoryMethod;\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithoutAnnotatedConstructor;\nimport org.eclipse.yasson.internal.model.JsonbCreator;\n\nimport org.junit.jupiter.api.Test;\n\n/**\n * Tests the {@link AnnotationIntrospector} with missing optional module \"java.deskop\", <br>\n * that contains the ConstructorProperties-Annotation.\n * <p>\n * Requires --limit-modules java.base,java.logging,java.sql (to exclude java.desktop) to work. <br>\n * See pom.xml surefire plugin configuration.\n * \n * @see AnnotationIntrospectorTestFixtures\n */\npublic class AnnotationIntrospectorWithoutOptionalModulesTest {\n\n    /**\n     * class under test.\n     */\n    private static final AnnotationIntrospector instrospector = new AnnotationIntrospector(new JsonbContext(new JsonbConfig(), JsonProvider.provider()));\n    private final PropertyNamingStrategy propertyNamingStrategy = propertyName -> propertyName;\n\n    @Test\n    public void testNoConstructorPropertiesAnnotationWithoutOptionalModules() {\n        String className = \"java.beans.ConstructorProperties\";\n        try {\n            Class.forName(className);\n            fail(\"Class [\" + className + \"] should not be available for this test.\");\n        } catch (ClassNotFoundException e) {\n            // OK, as expected\n        }\n    }\n\n    @Test\n    public void testCreatorShouldBeNullOnMissingConstructorAnnotation() {\n        assertNull(instrospector.getCreator(ObjectWithoutAnnotatedConstructor.class, propertyNamingStrategy));\n    }\n\n    @Test\n    public void testObjectShouldBeCreateableFromJsonbAnnotatedConstructorWithoutOptionalModules() {\n        JsonbCreator creator = instrospector.getCreator(ObjectWithJsonbCreatorAnnotatedConstructor.class, propertyNamingStrategy);\n        assertParameters(ObjectWithJsonbCreatorAnnotatedConstructor.parameters(), creator);\n        assertCreatedInstanceContainsAllParameters(ObjectWithJsonbCreatorAnnotatedConstructor.example(), creator);\n    }\n\n    @Test\n    public void testObjectShouldBeCreateableFromJsonbAnnotatedStaticFactoryMethodWithoutOptionalModules() {\n        JsonbCreator creator = instrospector.getCreator(ObjectWithJsonbCreatorAnnotatedFactoryMethod.class, propertyNamingStrategy);\n        assertParameters(ObjectWithJsonbCreatorAnnotatedFactoryMethod.parameters(), creator);\n        assertCreatedInstanceContainsAllParameters(ObjectWithJsonbCreatorAnnotatedFactoryMethod.example(), creator);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/ClassParserTest.java",
    "content": "/*\n * Copyright (c) 2015, 2023 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport org.eclipse.yasson.internal.model.customization.ClassCustomization;\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport org.eclipse.yasson.defaultmapping.modifiers.model.FieldModifiersClass;\nimport org.eclipse.yasson.defaultmapping.modifiers.model.MethodModifiersClass;\nimport org.eclipse.yasson.internal.model.ClassModel;\nimport org.eclipse.yasson.internal.model.JsonbAnnotatedElement;\n\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.spi.JsonProvider;\nimport java.util.concurrent.atomic.AtomicReference;\nimport java.util.function.Consumer;\n\n/**\n * Test for ClassParser component.\n *\n * @author Roman Grigoriadi\n */\npublic class ClassParserTest {\n    private static final JsonbContext jsonbContext = new JsonbContext(new JsonbConfig(), JsonProvider.provider());\n    private static final ClassParser classParser = new ClassParser(jsonbContext);\n    private static final AnnotationIntrospector introspector = new AnnotationIntrospector(jsonbContext);\n\n    @Test\n    public void testDefaultMappingFieldModifiers() {\n        final JsonbAnnotatedElement<Class<?>> clsElement = introspector.collectAnnotations(FieldModifiersClass.class);\n        ClassModel model = new ClassModel(FieldModifiersClass.class, introspector.introspectCustomization(clsElement,\n                                                                                                          ClassCustomization.empty(), jsonbContext.getConfigProperties().getPropertyNamingStrategy()), null, null);\n        classParser.parseProperties(model, clsElement);\n        assertTrue(model.getPropertyModel(\"finalString\").isReadable());\n        assertFalse(model.getPropertyModel(\"finalString\").isWritable());\n        assertFalse(model.getPropertyModel(\"staticString\").isReadable());\n        assertFalse(model.getPropertyModel(\"staticString\").isWritable());\n        assertFalse(model.getPropertyModel(\"transientString\").isReadable());\n        assertFalse(model.getPropertyModel(\"transientString\").isWritable());\n    }\n\n    @Test\n    public void testDefaultMappingMethodModifiers() {\n        final JsonbAnnotatedElement<Class<?>> clsElement = introspector.collectAnnotations(MethodModifiersClass.class);\n        ClassModel model = new ClassModel(FieldModifiersClass.class, introspector.introspectCustomization(clsElement,\n                                                                                                          ClassCustomization.empty(), jsonbContext.getConfigProperties().getPropertyNamingStrategy()), null, null);\n        classParser.parseProperties(model, clsElement);\n        assertFalse(model.getPropertyModel(\"publicFieldWithPrivateMethods\").isReadable());\n        assertFalse(model.getPropertyModel(\"publicFieldWithPrivateMethods\").isWritable());\n        assertTrue(model.getPropertyModel(\"publicFieldWithoutMethods\").isReadable());\n        assertTrue(model.getPropertyModel(\"publicFieldWithoutMethods\").isWritable());\n        assertTrue(model.getPropertyModel(\"getterWithoutFieldValue\").isReadable());\n        assertTrue(model.getPropertyModel(\"getterWithoutFieldValue\").isWritable());\n\n\n        MethodModifiersClass object = new MethodModifiersClass();\n        final AtomicReference<String> accepted = new AtomicReference<>();\n        Consumer<String> withoutFieldConsumer = accepted::set;\n        object.setSetterWithoutFieldConsumer(withoutFieldConsumer);\n        model.getPropertyModel(\"getterWithoutFieldValue\").setValue(object, \"ACCEPTED_VALUE\");\n        assertEquals(\"ACCEPTED_VALUE\", accepted.get());\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/CollectionsWithJavaBaseTypesTest.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.config.PropertyVisibilityStrategy;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.time.LocalDate;\nimport java.util.*;\n\n/**\n * Contains java.base types inside collections.\n * Tests that yasson won't try to parse this types into ClassModel.\n */\npublic class CollectionsWithJavaBaseTypesTest {\n\n    @Test\n    public void testSimple() {\n        JavaBasePropertiesInContainer properties = new JavaBasePropertiesInContainer();\n        properties.setNames(Arrays.asList(\"First\", \"second\", null));\n        \n        for(int i = 0; i < 3; i++) {\n            List<Integer> integerList = new ArrayList<>();\n            integerList.add(0);\n            integerList.add(1);\n            integerList.add(null);\n            properties.setListOfListsOfIntegers(new ArrayList<>());\n            properties.getListOfListsOfIntegers().add(integerList);\n        }\n        properties.setOptionalInts(new ArrayList<>());\n        properties.getOptionalInts().add(Optional.of(Integer.MAX_VALUE));\n        properties.getOptionalInts().add(Optional.empty());\n        properties.setDates(new ArrayList<>());\n        properties.getDates().add(LocalDate.of(2020, 1, 1));\n        properties.getDates().add(null);\n\n        Integer[][] innerArrayInts = new Integer[1][2];\n        innerArrayInts[0][0] = 1;\n        innerArrayInts[0][1] = null;\n        properties.setInnerArrayInts(innerArrayInts);\n\n        //Making all fields accessible. When used on JPMS will fail if java.base classes are parsed into class model.\n        Jsonb jsonb =\n                new JsonBindingBuilder().withConfig(new JsonbConfig().withNullValues(Boolean.TRUE)\n                        .withPropertyVisibilityStrategy(new PropertyVisibilityStrategy() {\n            @Override\n            public boolean isVisible(Field field) {\n                return true;\n            }\n\n            @Override\n            public boolean isVisible(Method method) {\n                return true;\n            }\n        })).build();\n\n        String expected = \"{\\\"dates\\\":[\\\"2020-01-01\\\",null],\\\"innerArrayInts\\\":[[1,null]],\\\"listOfListsOfIntegers\\\":[[0,1,null]],\\\"names\\\":[\\\"First\\\",\\\"second\\\",null],\\\"optionalInts\\\":[2147483647,null]}\";\n        assertEquals(expected, jsonb.toJson(properties));\n\n        JavaBasePropertiesInContainer result = jsonb.fromJson(expected, JavaBasePropertiesInContainer.class);\n        assertEquals(properties.getNames(), result.getNames());\n        assertEquals(properties.getOptionalInts(), result.getOptionalInts());\n        assertEquals(properties.getListOfListsOfIntegers(), result.getListOfListsOfIntegers());\n        assertArrayEquals(properties.getInnerArrayInts(), result.getInnerArrayInts());\n    }\n\n    public static final class JavaBasePropertiesInContainer {\n\n        private List<String> names;\n\n        private List<Optional<Integer>> optionalInts;\n\n        private List<LocalDate> dates;\n\n        public Integer[][] getInnerArrayInts() {\n            return innerArrayInts;\n        }\n\n        public void setInnerArrayInts(Integer[][] innerArrayInts) {\n            this.innerArrayInts = innerArrayInts;\n        }\n\n        private Integer[][] innerArrayInts;\n\n        public List<LocalDate> getDates() {\n            return dates;\n        }\n\n        public void setDates(List<LocalDate> dates) {\n            this.dates = dates;\n        }\n\n        public List<Optional<Integer>> getOptionalInts() {\n            return optionalInts;\n        }\n\n        public void setOptionalInts(List<Optional<Integer>> optionalInts) {\n            this.optionalInts = optionalInts;\n        }\n\n        List<List<Integer>> listOfListsOfIntegers;\n\n        public List<List<Integer>> getListOfListsOfIntegers() {\n            return listOfListsOfIntegers;\n        }\n\n        public void setListOfListsOfIntegers(List<List<Integer>> listOfListsOfIntegers) {\n            this.listOfListsOfIntegers = listOfListsOfIntegers;\n        }\n\n        public List<String> getNames() {\n            return names;\n        }\n\n        public void setNames(List<String> names) {\n            this.names = names;\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/ConstructorPropertiesAnnotationIntrospectorTest.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport static org.eclipse.yasson.internal.AnnotationIntrospectorTestAsserts.assertCreatedInstanceContainsAllParameters;\nimport static org.eclipse.yasson.internal.AnnotationIntrospectorTestAsserts.assertParameters;\nimport static org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.constructorsOf;\n\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithConstructorPropertiesAnnotation;\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithJsonbCreatorAnnotatedConstructor;\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithPublicNoArgAndAnnotatedPackageProtectedConstructor;\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithPublicNoArgAndAnnotatedPrivateConstructor;\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithPublicNoArgAndAnnotatedProtectedConstructor;\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithTwoConstructorPropertiesAnnotation;\nimport org.eclipse.yasson.internal.AnnotationIntrospectorTestFixtures.ObjectWithoutAnnotatedConstructor;\nimport org.eclipse.yasson.internal.model.JsonbCreator;\n\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.spi.JsonProvider;\n\npublic class ConstructorPropertiesAnnotationIntrospectorTest {\n\n    private final JsonbContext jsonbContext = new JsonbContext(new JsonbConfig(), JsonProvider.provider());\n    private final AnnotationFinder constructorPropertiesFinder = AnnotationFinder.findConstructorProperties();\n\n    /**\n     * class under test.\n     */\n    private ConstructorPropertiesAnnotationIntrospector instrospector = new ConstructorPropertiesAnnotationIntrospector(jsonbContext, constructorPropertiesFinder);\n\n    @Test\n    public void testObjectShouldBeCreateableFromConstructorPropertiesAnnotatedConstructor() {\n        JsonbCreator creator = instrospector.getCreator(constructorsOf(ObjectWithConstructorPropertiesAnnotation.class));\n        assertParameters(ObjectWithConstructorPropertiesAnnotation.parameters(), creator);\n        assertCreatedInstanceContainsAllParameters(ObjectWithConstructorPropertiesAnnotation.example(), creator);\n    }\n\n    @Test\n    public void testShouldAlsoWorkWithStaticFactoryMethodAndPredefinedAnnotationFinder() {\n        instrospector = ConstructorPropertiesAnnotationIntrospector.forContext(jsonbContext);\n        JsonbCreator creator = instrospector.getCreator(constructorsOf(ObjectWithConstructorPropertiesAnnotation.class));\n        assertNotNull(creator);\n    }\n\n    @Test\n    public void testNullShouldBeReturnedWhenThereIsNoCreatorAnnotation() {\n        JsonbCreator creator = instrospector.getCreator(constructorsOf(ObjectWithoutAnnotatedConstructor.class));\n        assertNull(creator);\n    }\n\n    @Test\n    public void testNullShouldBeReturnedWhenThereIsNoConstructorPropertiesAnnotation() {\n        JsonbCreator creator = instrospector.getCreator(constructorsOf(ObjectWithJsonbCreatorAnnotatedConstructor.class));\n        assertNull(creator);\n    }\n\n    @Test\n    public void testNullShouldBeReturnedWhenThereAreMoreThanOneConstructorPropertiesAnnotation() {\n        JsonbCreator creator = instrospector.getCreator(constructorsOf(ObjectWithTwoConstructorPropertiesAnnotation.class));\n        assertNull(creator);\n    }\n\n    @Test\n    public void testAnnotatedInaccessiblePrivateConstructorShouldBeIgnored() {\n        JsonbCreator creator = instrospector.getCreator(constructorsOf(ObjectWithPublicNoArgAndAnnotatedPrivateConstructor.class));\n        assertNull(creator);\n    }\n\n    @Test\n    public void testAnnotatedInaccessiblePackageProtectedConstructorShouldBeIgnored() {\n        JsonbCreator creator = instrospector.getCreator(constructorsOf(ObjectWithPublicNoArgAndAnnotatedPackageProtectedConstructor.class));\n        assertNull(creator);\n    }\n\n    @Test\n    public void testAnnotatedInaccessibleProtectedConstructorShouldBeIgnored() {\n        JsonbCreator creator = instrospector.getCreator(constructorsOf(ObjectWithPublicNoArgAndAnnotatedProtectedConstructor.class));\n        assertNull(creator);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/JsonBindingTest.java",
    "content": "/*\n * Copyright (c) 2019, 2020 IBM and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\npackage org.eclipse.yasson.internal;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.assertNotNull;\nimport static org.junit.jupiter.api.Assertions.assertNull;\n\nimport java.lang.reflect.Field;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\n\nimport org.eclipse.yasson.YassonConfig;\nimport org.eclipse.yasson.internal.model.ClassModel;\nimport org.junit.jupiter.api.Test;\n\npublic class JsonBindingTest {\n    \n    public static class EagerParseClass {\n        public String foo;\n    }\n    \n    @Test\n    public void testEagerInit() throws Exception {\n        Jsonb jsonb = JsonbBuilder.create(new YassonConfig()\n                .withEagerParsing(EagerParseClass.class));\n        assertNotNull(getClassModel(jsonb, EagerParseClass.class));\n        \n        EagerParseClass obj = new EagerParseClass();\n        obj.foo = \"foo\";\n        assertEquals(\"{\\\"foo\\\":\\\"foo\\\"}\", jsonb.toJson(obj));\n    }\n    \n    @Test\n    public void testNoEagerInit() throws Exception {\n        Jsonb jsonb = JsonbBuilder.create();\n        assertNull(getClassModel(jsonb, EagerParseClass.class));\n        \n        EagerParseClass obj = new EagerParseClass();\n        obj.foo = \"foo\";\n        assertEquals(\"{\\\"foo\\\":\\\"foo\\\"}\", jsonb.toJson(obj));\n        \n        assertNotNull(getClassModel(jsonb, EagerParseClass.class));\n    }\n    \n    private ClassModel getClassModel(Jsonb jsonb, Class<?> clazz) throws Exception {\n        // Do some hacks to ensure that the class had a ClassModel registered\n        JsonBinding yasson = (JsonBinding) jsonb;\n        Field jsonbContext = yasson.getClass().getDeclaredField(\"jsonbContext\");\n        jsonbContext.setAccessible(true);\n        JsonbContext ctx = (JsonbContext) jsonbContext.get(yasson);\n        return ctx.getMappingContext().getClassModel(clazz);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/ReflectionUtilsTest.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Type;\nimport java.util.List;\nimport java.util.Map;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class ReflectionUtilsTest {\n\n    public static class Types<T> {\n\n        public List<String> resolvedParameterizedField;\n\n        public List<Map<Integer, String>> resolvedNestedParameterizedField;\n\n        public String resolvedStr;\n\n        public List<T> unresolvedParameterizedField;\n\n        public List<Map<Integer, T>> unresolvedNestedParameterizedField;\n\n        public T unresolvedField;\n\n        public List<?> unresolvedWildcardField;\n    }\n\n\n    @Test\n    public void testIsTypeResolved() {\n        Types<String> types = new Types<>();\n        assertTrue(ReflectionUtils.isResolvedType(getFieldType(\"resolvedParameterizedField\")));\n        assertTrue(ReflectionUtils.isResolvedType(getFieldType(\"resolvedNestedParameterizedField\")));\n        assertTrue(ReflectionUtils.isResolvedType(getFieldType(\"resolvedStr\")));\n        assertFalse(ReflectionUtils.isResolvedType(getFieldType(\"unresolvedParameterizedField\")));\n        assertFalse(ReflectionUtils.isResolvedType(getFieldType(\"unresolvedNestedParameterizedField\")));\n        assertFalse(ReflectionUtils.isResolvedType(getFieldType(\"unresolvedField\")));\n        assertFalse(ReflectionUtils.isResolvedType(getFieldType(\"unresolvedWildcardField\")));\n    }\n\n    private static Type getFieldType(String fieldName) {\n        try {\n            Field field = Types.class.getField(fieldName);\n            return field.getGenericType();\n        } catch (NoSuchFieldException e) {\n            throw new RuntimeException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/AdaptedPojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\nimport jakarta.json.bind.annotation.JsonbTypeAdapter;\n\n/**\n * @author Roman Grigoriadi\n */\n\npublic class AdaptedPojo {\n\n    @JsonbTypeAdapter(CdiDependentAdapter.class)\n    public String adaptedValue1 = \"1111\";\n\n    @JsonbTypeAdapter(CdiDependentAdapter.class)\n    public String adaptedValue2 = \"1001\";\n\n    @JsonbTypeAdapter(NonCdiAdapter.class)\n    public String adaptedValue3 = \"1010\";\n\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/CalledMethods.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.event.Observes;\nimport java.util.HashMap;\nimport java.util.Map;\n\n/**\n * Mockito like method call counter for CDI beans.\n *\n * @author Roman Grigoriadi\n */\n@ApplicationScoped\npublic class CalledMethods {\n\n    /**\n     * Maps method name to called count.\n     */\n    private Map<String, Integer> results = new HashMap<>();\n\n    public void registerCall(@Observes MethodCalledEvent methodCalledEvent) {\n        results.compute(methodCalledEvent.getMethodName(), (s, c) -> c == null ? 1 : c + 1);\n    }\n\n    public Map<String, Integer> getResults() {\n        return results;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/CdiDependentAdapter.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.json.bind.adapter.JsonbAdapter;\n\n/**\n * Test scope components for testing CDI injection and cleanup.\n *\n * @author Roman Grigoriadi\n */\n@ApplicationScoped\npublic class CdiDependentAdapter implements JsonbAdapter<String, Integer> {\n\n    @Inject\n    private CdiTestService cdiTestService;\n\n    @Inject\n    @Hello2\n    private IHelloService helloService;\n\n    @Override\n    public Integer adaptToJson(String obj) throws Exception {\n        cdiTestService.runService();\n        helloService.sayHello();\n        return Integer.valueOf(obj);\n    }\n\n    @Override\n    public String adaptFromJson(Integer obj) throws Exception {\n        return String.valueOf(obj);\n    }\n\n    public CdiTestService getCdiTestService() {\n        return cdiTestService;\n    }\n\n    public IHelloService getHelloService() {\n        return helloService;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/CdiInjectionTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport org.eclipse.yasson.internal.components.JsonbComponentInstanceCreatorFactory;\n\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.CDI;\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.config.PropertyVisibilityStrategy;\nimport javax.naming.InitialContext;\nimport javax.naming.NamingException;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.util.Map;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class CdiInjectionTest {\n\n    @Test\n    public void testInjectionAndCleanup() throws Exception {\n        WeldManager weldManager = new WeldManager();\n        weldManager.startWeld(CalledMethods.class, CdiTestService.class, HelloService1.class, HelloService2.class);\n\n        Jsonb jsonb = JsonbBuilder.create();\n        final String result = jsonb.toJson(new AdaptedPojo());\n        jsonb.close();\n        assertEquals(\"{\\\"adaptedValue1\\\":1111,\\\"adaptedValue2\\\":1001,\\\"adaptedValue3\\\":1010}\", result);\n\n        //HelloService1 is @ApplicationScoped\n        CalledMethods calledMethods = getCalledMethods();\n        Map<String, Integer> results = calledMethods.getResults();\n\n        assertTrue(results.containsKey(HelloService1.class.getName() + \".sayHello\"));\n        assertFalse(results.containsKey(HelloService1.class.getName() + \".preDestroy\"));\n\n        //HelloService2 is @Dependent\n        assertTrue(results.containsKey(HelloService2.class.getName() + \".sayHello\"));\n        assertTrue(results.containsKey(HelloService2.class.getName() + \".preDestroy\"));\n\n        //CdiTestService is @ApplicationScoped\n        assertTrue(results.containsKey(CdiTestService.class.getName() + \".runService\"));\n        assertFalse(results.containsKey(CdiTestService.class.getName() + \".preDestroy\"));\n//        getCalledMethods().printCalled();\n\n\n        weldManager.shutdownWeld();\n\n        assertTrue(results.containsKey(CdiTestService.class.getName() + \".preDestroy\"));\n        assertTrue(results.containsKey(HelloService1.class.getName() + \".preDestroy\"));\n\n//        getCalledMethods().printCalled();\n    }\n\n    @Test\n    public void testInJndiEnvironment() throws NamingException {\n        InitialContext context = new InitialContext();\n        context.bind(JsonbComponentInstanceCreatorFactory.BEAN_MANAGER_NAME, new JndiBeanManager());\n\n        String result;\n        try {\n            Jsonb jsonb = JsonbBuilder.create();\n            result = jsonb.toJson(new AdaptedPojo());\n        } finally {\n            context.unbind(JsonbComponentInstanceCreatorFactory.BEAN_MANAGER_NAME);\n        }\n        assertEquals(\"{\\\"adaptedValue1\\\":1111,\\\"adaptedValue2\\\":1001,\\\"adaptedValue3\\\":1010}\", result);\n    }\n\n    @Test\n    public void testNonCdiEnvironment() {\n        JsonbConfig config = new JsonbConfig();\n        //allow only field with components that doesn't has cdi dependencies.\n        config.withPropertyVisibilityStrategy(new PropertyVisibilityStrategy() {\n            @Override\n            public boolean isVisible(Field field) {\n                return \"adaptedValue3\".equals(field.getName());\n            }\n\n            @Override\n            public boolean isVisible(Method method) {\n                return false;\n            }\n        });\n        Jsonb jsonb = JsonbBuilder.create(config);\n        final String result = jsonb.toJson(new AdaptedPojo());\n        assertEquals(\"{\\\"adaptedValue3\\\":1010}\", result);\n    }\n\n    private CalledMethods getCalledMethods() {\n        final BeanManager beanManager = CDI.current().getBeanManager();\n        final Bean<?> resolve = beanManager.resolve(beanManager.getBeans(CalledMethods.class));\n        return (CalledMethods) beanManager.getReference(resolve, CalledMethods.class, beanManager.createCreationalContext(resolve));\n    }\n\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/CdiTestService.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\nimport jakarta.annotation.PreDestroy;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.event.Event;\nimport jakarta.inject.Inject;\n\n/**\n * CDI test service\n * @author Roman Grigoriadi\n */\n@ApplicationScoped\npublic class CdiTestService {\n\n    @Inject\n    private Event<MethodCalledEvent> calledEvent;\n\n    @Inject\n    @Hello1\n    private IHelloService helloService;\n\n    public CdiTestService() {\n    }\n\n    public void runService() {\n        helloService.sayHello();\n        calledEvent.fire(new MethodCalledEvent(getClass().getName() + \".runService\"));\n    }\n\n    @PreDestroy\n    public void preDestroy() {\n        calledEvent.fire(new MethodCalledEvent(getClass().getName() + \".preDestroy\"));\n    }\n\n    public IHelloService getHelloService() {\n        return helloService;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/Hello1.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\nimport jakarta.enterprise.inject.Default;\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * @author Roman Grigoriadi\n */\n@Default\n@Qualifier\n@Target({ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface Hello1 {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/Hello2.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\nimport jakarta.enterprise.inject.Default;\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * @author Roman Grigoriadi\n */\n@Default\n@Qualifier\n@Target({ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface Hello2 {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/HelloService1.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\nimport jakarta.annotation.PreDestroy;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.event.Event;\nimport jakarta.inject.Inject;\n\n/**\n * @author Roman Grigoriadi\n */\n@Hello1\n@ApplicationScoped\npublic class HelloService1 implements IHelloService {\n\n    @Inject\n    private Event<MethodCalledEvent> calledEvent;\n\n    @Override\n    public void sayHello() {\n        calledEvent.fire(new MethodCalledEvent(getClass().getName() + \".sayHello\"));\n    }\n\n    @PreDestroy\n    public void preDestroy() {\n        calledEvent.fire(new MethodCalledEvent(getClass().getName() + \".preDestroy\"));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/HelloService2.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\nimport jakarta.annotation.PreDestroy;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.event.Event;\nimport jakarta.inject.Inject;\n\n/**\n * Dependant scoped bean, should be destroyed with its wrapper bean.\n *\n * @author Roman Grigoriadi\n */\n@Hello2\n@Dependent\npublic class HelloService2 implements IHelloService {\n\n    @Inject\n    private Event<MethodCalledEvent> calledEvent;\n\n    @Override\n    public void sayHello() {\n        calledEvent.fire(new MethodCalledEvent(getClass().getName() + \".sayHello\"));\n    }\n\n    @PreDestroy\n    public void preDestroy() {\n        calledEvent.fire(new MethodCalledEvent(getClass().getName() + \".preDestroy\"));\n    }\n\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/IHelloService.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\n/**\n * @author Roman Grigoriadi\n */\npublic interface IHelloService {\n\n    void sayHello();\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/JndiBeanManager.java",
    "content": "/*\n * Copyright (c) 2018, 2024 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\nimport jakarta.el.ELResolver;\nimport jakarta.el.ExpressionFactory;\nimport jakarta.enterprise.context.spi.Context;\nimport jakarta.enterprise.context.spi.Contextual;\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.event.Event;\nimport jakarta.enterprise.inject.Instance;\nimport jakarta.enterprise.inject.spi.AnnotatedField;\nimport jakarta.enterprise.inject.spi.AnnotatedMember;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedParameter;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanAttributes;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.Decorator;\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.enterprise.inject.spi.InjectionTarget;\nimport jakarta.enterprise.inject.spi.InjectionTargetFactory;\nimport jakarta.enterprise.inject.spi.InterceptionFactory;\nimport jakarta.enterprise.inject.spi.InterceptionType;\nimport jakarta.enterprise.inject.spi.Interceptor;\nimport jakarta.enterprise.inject.spi.ObserverMethod;\nimport jakarta.enterprise.inject.spi.ProducerFactory;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Set;\n\npublic class JndiBeanManager implements BeanManager {\n    @Override\n    public Object getReference(Bean<?> bean, Type beanType, CreationalContext<?> ctx) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public Object getInjectableReference(InjectionPoint ij, CreationalContext<?> ctx) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public <T> CreationalContext<T> createCreationalContext(Contextual<T> contextual) {\n        return null;\n    }\n\n    @Override\n    public Set<Bean<?>> getBeans(Type beanType, Annotation... qualifiers) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public Set<Bean<?>> getBeans(String name) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public Bean<?> getPassivationCapableBean(String id) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public <X> Bean<? extends X> resolve(Set<Bean<? extends X>> beans) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public void validate(InjectionPoint injectionPoint) {\n\n    }\n\n    @Override\n    public <T> Set<ObserverMethod<? super T>> resolveObserverMethods(T event, Annotation... qualifiers) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public List<Decorator<?>> resolveDecorators(Set<Type> types, Annotation... qualifiers) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public List<Interceptor<?>> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public boolean isScope(Class<? extends Annotation> annotationType) {\n        return false;\n    }\n\n    @Override\n    public boolean isNormalScope(Class<? extends Annotation> annotationType) {\n        return false;\n    }\n\n    @Override\n    public boolean isPassivatingScope(Class<? extends Annotation> annotationType) {\n        return false;\n    }\n\n    @Override\n    public boolean isQualifier(Class<? extends Annotation> annotationType) {\n        return false;\n    }\n\n    @Override\n    public boolean isInterceptorBinding(Class<? extends Annotation> annotationType) {\n        return false;\n    }\n\n    @Override\n    public boolean isStereotype(Class<? extends Annotation> annotationType) {\n        return false;\n    }\n\n    @Override\n    public Set<Annotation> getInterceptorBindingDefinition(Class<? extends Annotation> bindingType) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public boolean areQualifiersEquivalent(Annotation qualifier1, Annotation qualifier2) {\n        return false;\n    }\n\n    @Override\n    public boolean areInterceptorBindingsEquivalent(Annotation interceptorBinding1, Annotation interceptorBinding2) {\n        return false;\n    }\n\n    @Override\n    public int getQualifierHashCode(Annotation qualifier) {\n        return 0;\n    }\n\n    @Override\n    public int getInterceptorBindingHashCode(Annotation interceptorBinding) {\n        return 0;\n    }\n\n    @Override\n    public Context getContext(Class<? extends Annotation> scopeType) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public Collection<Context> getContexts(Class<? extends Annotation> aClass) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public ELResolver getELResolver() {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public ExpressionFactory wrapExpressionFactory(ExpressionFactory expressionFactory) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public <T> AnnotatedType<T> createAnnotatedType(Class<T> type) {\n        return null;\n    }\n\n    @Override\n    public <T> InjectionTargetFactory<T> getInjectionTargetFactory(AnnotatedType<T> annotatedType) {\n        return new MockInjectionTargetFactory<>();\n    }\n\n    @Override\n    public <X> ProducerFactory<X> getProducerFactory(AnnotatedField<? super X> field, Bean<X> declaringBean) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public <X> ProducerFactory<X> getProducerFactory(AnnotatedMethod<? super X> method, Bean<X> declaringBean) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public <T> BeanAttributes<T> createBeanAttributes(AnnotatedType<T> type) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public BeanAttributes<?> createBeanAttributes(AnnotatedMember<?> type) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public <T> Bean<T> createBean(BeanAttributes<T> attributes, Class<T> beanClass, InjectionTargetFactory<T> injectionTargetFactory) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public <T, X> Bean<T> createBean(BeanAttributes<T> attributes, Class<X> beanClass, ProducerFactory<X> producerFactory) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public InjectionPoint createInjectionPoint(AnnotatedField<?> field) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public InjectionPoint createInjectionPoint(AnnotatedParameter<?> parameter) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public <T extends Extension> T getExtension(Class<T> extensionClass) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public <T> InterceptionFactory<T> createInterceptionFactory(CreationalContext<T> ctx, Class<T> clazz) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public Event<Object> getEvent() {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public Instance<Object> createInstance() {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public boolean isMatchingBean(Set<Type> set, Set<Annotation> set1, Type type, Set<Annotation> set2) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    @Override\n    public boolean isMatchingEvent(Type type, Set<Annotation> set, Type type1, Set<Annotation> set1) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/MethodCalledEvent.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class MethodCalledEvent {\n\n    private final String methodName;\n\n    public MethodCalledEvent(String methodName) {\n        this.methodName = methodName;\n    }\n\n    public String getMethodName() {\n        return methodName;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/MockInjectionTarget.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.enterprise.inject.spi.InjectionTarget;\nimport jakarta.json.bind.adapter.JsonbAdapter;\nimport java.util.Set;\n\n/**\n * For JNDI Bean Manager resolution testing purposes.\n */\npublic class MockInjectionTarget implements InjectionTarget<JsonbAdapter> {\n    @Override\n    public void inject(JsonbAdapter instance, CreationalContext<JsonbAdapter> ctx) {\n\n    }\n\n    @Override\n    public void postConstruct(JsonbAdapter instance) {\n\n    }\n\n    @Override\n    public void preDestroy(JsonbAdapter instance) {\n\n    }\n\n    @Override\n    public JsonbAdapter produce(CreationalContext<JsonbAdapter> ctx) {\n        return new NonCdiAdapter();\n    }\n\n    @Override\n    public void dispose(JsonbAdapter instance) {\n\n    }\n\n    @Override\n    public Set<InjectionPoint> getInjectionPoints() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/MockInjectionTargetFactory.java",
    "content": "/*\n * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.InjectionTarget;\nimport jakarta.enterprise.inject.spi.InjectionTargetFactory;\n\n/**\n * TODO javadoc\n */\npublic class MockInjectionTargetFactory<T> implements InjectionTargetFactory<T> {\n    @Override\n    public InjectionTarget<T> createInjectionTarget(Bean<T> bean) {\n        return (InjectionTarget<T>) new MockInjectionTarget();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/MockJndiContext.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\nimport javax.naming.*;\nimport java.util.Hashtable;\nimport java.util.concurrent.ConcurrentHashMap;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class MockJndiContext implements Context {\n    private static final ConcurrentHashMap<String, Object> objects = new ConcurrentHashMap<>();\n\n    @Override\n    public Object lookup(Name name) throws NamingException {\n        return null;\n    }\n\n    @Override\n    public Object lookup(String name) throws NamingException {\n        final Object o = objects.get(name);\n        if (o == null) {\n            throw new NamingException(\"No object found under: \"+name);\n        }\n        return o;\n    }\n\n    @Override\n    public void bind(Name name, Object obj) throws NamingException {\n\n    }\n\n    @Override\n    public void bind(String name, Object obj) throws NamingException {\n        objects.put(name, obj);\n    }\n\n    @Override\n    public void rebind(Name name, Object obj) throws NamingException {\n\n    }\n\n    @Override\n    public void rebind(String name, Object obj) throws NamingException {\n\n    }\n\n    @Override\n    public void unbind(Name name) throws NamingException {\n\n    }\n\n    @Override\n    public void unbind(String name) throws NamingException {\n        objects.remove(name);\n    }\n\n    @Override\n    public void rename(Name oldName, Name newName) throws NamingException {\n\n    }\n\n    @Override\n    public void rename(String oldName, String newName) throws NamingException {\n\n    }\n\n    @Override\n    public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {\n        return null;\n    }\n\n    @Override\n    public NamingEnumeration<NameClassPair> list(String name) throws NamingException {\n        return null;\n    }\n\n    @Override\n    public NamingEnumeration<Binding> listBindings(Name name) throws NamingException {\n        return null;\n    }\n\n    @Override\n    public NamingEnumeration<Binding> listBindings(String name) throws NamingException {\n        return null;\n    }\n\n    @Override\n    public void destroySubcontext(Name name) throws NamingException {\n\n    }\n\n    @Override\n    public void destroySubcontext(String name) throws NamingException {\n\n    }\n\n    @Override\n    public Context createSubcontext(Name name) throws NamingException {\n        return null;\n    }\n\n    @Override\n    public Context createSubcontext(String name) throws NamingException {\n        return null;\n    }\n\n    @Override\n    public Object lookupLink(Name name) throws NamingException {\n        return null;\n    }\n\n    @Override\n    public Object lookupLink(String name) throws NamingException {\n        return null;\n    }\n\n    @Override\n    public NameParser getNameParser(Name name) throws NamingException {\n        return null;\n    }\n\n    @Override\n    public NameParser getNameParser(String name) throws NamingException {\n        return null;\n    }\n\n    @Override\n    public Name composeName(Name name, Name prefix) throws NamingException {\n        return null;\n    }\n\n    @Override\n    public String composeName(String name, String prefix) throws NamingException {\n        return null;\n    }\n\n    @Override\n    public Object addToEnvironment(String propName, Object propVal) throws NamingException {\n        return null;\n    }\n\n    @Override\n    public Object removeFromEnvironment(String propName) throws NamingException {\n        return null;\n    }\n\n    @Override\n    public Hashtable<?, ?> getEnvironment() throws NamingException {\n        return null;\n    }\n\n    @Override\n    public void close() throws NamingException {\n\n    }\n\n    @Override\n    public String getNameInNamespace() throws NamingException {\n        return null;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/MockJndiContextFactory.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\nimport javax.naming.Context;\nimport javax.naming.NamingException;\nimport javax.naming.spi.InitialContextFactory;\nimport java.util.Hashtable;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class MockJndiContextFactory implements InitialContextFactory {\n    @Override\n    public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException {\n        return new MockJndiContext();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/NonCdiAdapter.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\nimport jakarta.json.bind.adapter.JsonbAdapter;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class NonCdiAdapter implements JsonbAdapter<String, Integer> {\n    @Override\n    public Integer adaptToJson(String obj) throws Exception {\n        return Integer.valueOf(obj);\n    }\n\n    @Override\n    public String adaptFromJson(Integer obj) throws Exception {\n        return String.valueOf(obj);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/cdi/WeldManager.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.cdi;\n\nimport org.eclipse.yasson.internal.components.JsonbComponentInstanceCreatorFactory;\nimport org.jboss.weld.environment.se.Weld;\nimport org.jboss.weld.environment.se.WeldContainer;\n\nimport javax.naming.InitialContext;\nimport javax.naming.NamingException;\n\n/**\n * Starts and Shutdowns Weld container, for CDI testing purposes.\n *\n * @author Roman Grigoriadi\n */\npublic class WeldManager {\n\n    private Weld weld;\n\n    private InitialContext initialContext;\n\n\n    public void startWeld(Class... scannedClasses) throws NamingException {\n        weld = new Weld().beanClasses(scannedClasses).disableDiscovery();\n        WeldContainer container = weld.initialize();\n        initialContext = new InitialContext();\n        initialContext.bind(JsonbComponentInstanceCreatorFactory.BEAN_MANAGER_NAME, container.getBeanManager());\n    }\n\n    public void shutdownWeld() throws NamingException {\n        weld.shutdown();\n        initialContext.unbind(JsonbComponentInstanceCreatorFactory.BEAN_MANAGER_NAME);\n        initialContext.close();\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/concurrent/JsonProcessingResult.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.concurrent;\n\n/**\n * A result produced by marshalling or unmarshalling operation called on jsonb.\n * @param <T> For marshalling its String, for unmarshalling Customer.\n */\nclass JsonProcessingResult<T> {\n    private final T result;\n\n    private final String dispatcherThreadName;\n\n    private final String jobId;\n\n    public JsonProcessingResult(T result, String dispatcherThreadName, String jobId) {\n        this.result = result;\n        this.dispatcherThreadName = dispatcherThreadName;\n        this.jobId = jobId;\n    }\n\n    public T getResult() {\n        return result;\n    }\n\n    public String getDispatcherThreadName() {\n        return dispatcherThreadName;\n    }\n\n    public String getJobId() {\n        return jobId;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/concurrent/MarshallerTask.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.concurrent;\n\nimport org.eclipse.yasson.defaultmapping.specific.model.Customer;\n\nimport jakarta.json.bind.Jsonb;\nimport java.util.concurrent.Callable;\nimport java.util.concurrent.CountDownLatch;\n\n/**\n * Runs JSON marshalling, returns Json result.\n */\nclass MarshallerTask implements Callable<JsonProcessingResult<MarshallerTaskResult>> {\n\n    private final Jsonb jsonb;\n    private final String jobId;\n    private final MultiTenancyTest.ConfigurationType configurationType;\n    private final CountDownLatch latch;\n    private final Customer customer;\n\n    public MarshallerTask(CountDownLatch latch, MultiTenancyTest.ConfigurationType jsonbConfiguration, String jobId, Customer customer) {\n        this.jsonb = jsonbConfiguration.getJsonbInstance();\n        this.jobId = jobId;\n        this.configurationType = jsonbConfiguration;\n        this.latch = latch;\n        this.customer = customer;\n    }\n\n    @Override\n    public JsonProcessingResult<MarshallerTaskResult> call() throws Exception {\n        try {\n            latch.await();\n        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n        }\n        //marshalling will produce wrong json result if JsonbConfig in ThreadLocal JsonbContext will not match expected result\n        String json = jsonb.toJson(customer);\n        return new JsonProcessingResult<>(new MarshallerTaskResult(json, configurationType), Thread.currentThread().getName(), jobId);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/concurrent/MarshallerTaskResult.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.concurrent;\n\n/**\n * Wraps a resulted JSON string with jsonb configuration type, to know against which json to check result.\n */\nclass MarshallerTaskResult {\n    private final String producedJson;\n    private final MultiTenancyTest.ConfigurationType configurationType;\n\n    public MarshallerTaskResult(String producedJson, MultiTenancyTest.ConfigurationType configurationType) {\n        this.producedJson = producedJson;\n        this.configurationType = configurationType;\n    }\n\n    public String getProducedJson() {\n        return producedJson;\n    }\n\n    public MultiTenancyTest.ConfigurationType getConfigurationType() {\n        return configurationType;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/concurrent/MultiTenancyTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.concurrent;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport org.eclipse.yasson.defaultmapping.specific.CustomerTest;\nimport org.eclipse.yasson.defaultmapping.specific.model.Customer;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.config.PropertyNamingStrategy;\nimport jakarta.json.bind.config.PropertyVisibilityStrategy;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.util.concurrent.*;\nimport java.util.concurrent.atomic.AtomicLong;\nimport java.util.logging.Logger;\n\n/**\n * Tests consistency along sharing instances of Jsonb with different JsonbConfig between threads.\n * Tests simulates web server like environment, where threads dispatching http requests are pooled and reused.\n *\n * Each of jsonb instances has different JsonbConfig, forcing to produce / parse\n * different JSON string during marshalling to / unmarshalling from json.\n *\n * If ThreadLocal JsonbContext will be inconsistently shared between pooled threads\n * this test should fail while testing results of calls to shared jsonb instances marshalling / unmarshalling methods.\n *\n * @author Roman Grigoriadi\n */\npublic class MultiTenancyTest extends CustomerTest {\n\n    private static Logger logger = Logger.getLogger(MultiTenancyTest.class.getName());\n\n    /**\n     * Expected JSON for defaultJsonBinding instance, default key names.\n     */\n    private static final String DEFAULT_CONFIG_JSON_STRING = \"{\\\"addresses\\\":[{\\\"street\\\":{\\\"name\\\":\\\"Zoubkova\\\",\\\"number\\\":111},\\\"town\\\":\\\"Prague\\\"}],\\\"age\\\":33,\\\"integers\\\":[0,1],\\\"listOfListsOfIntegers\\\":[[0,1,2],[0,1,2],[0,1,2]],\\\"name\\\":\\\"MULTI_TENANCY_TEST\\\",\\\"stringIntegerMap\\\":{\\\"first\\\":1,\\\"second\\\":2},\\\"strings\\\":[\\\"green\\\",\\\"yellow\\\"]}\";\n\n    /**\n     * Expected JSON for customizedJsonBinding instance, configured with LOWER_CASE_WITH_UNDERSCORES property naming strategy key names and also skips some properties according to custom PropertyVisibilityStrategy.\n     */\n    private static final String CUSTOMIZED_CONFIG_JSON_STRING = \"{\\\"addresses\\\":[{\\\"street\\\":{\\\"name\\\":\\\"Zoubkova\\\",\\\"number\\\":111},\\\"town\\\":\\\"Prague\\\"}],\\\"age\\\":33,\\\"list_of_lists_of_integers\\\":[[0,1,2],[0,1,2],[0,1,2]],\\\"name\\\":\\\"MULTI_TENANCY_TEST\\\",\\\"string_integer_map\\\":{\\\"first\\\":1,\\\"second\\\":2}}\";\n\n    /**\n     * A size of thread pool. Should be lesser than TOTAL_JOB_COUNT, so that threads are reused for different tasks,\n     * causing more likeness to fail ThreadLocal state managing.\n     */\n    private static final int THREAD_COUNT = 35;\n    /**\n     * A total count of marshalling / unmarshalling operations.\n     */\n    private static final int TOTAL_JOB_COUNT = 2000;\n\n    /**\n     * After results of marshalling / unmarshalling are checked this count is incremented.\n     * When test finishes, this count is required to be equal to TOTAL_JOB_COUNT.\n     */\n    private final AtomicLong resultsCheckedCount = new AtomicLong();\n\n    /**\n     * Latch firing first THREAD_COUNT tasks instantly.\n     */\n    private final static CountDownLatch fireJsonbProcessing = new CountDownLatch(1);\n\n    private static final Jsonb defaultJsonBinding;\n    private static final Jsonb customizedJsonBinding;\n\n    public enum ConfigurationType {\n        DEFAULT(defaultJsonBinding, DEFAULT_CONFIG_JSON_STRING),\n        CUSTOMIZED(customizedJsonBinding, CUSTOMIZED_CONFIG_JSON_STRING);\n\n        ConfigurationType(Jsonb jsonbInstance, String expectedJson) {\n            this.jsonbInstance = jsonbInstance;\n            this.expectedJson = expectedJson;\n        }\n\n        private Jsonb jsonbInstance;\n        private String expectedJson;\n\n        public Jsonb getJsonbInstance() {\n            return jsonbInstance;\n        }\n\n        public String getExpectedJson() {\n            return expectedJson;\n        }\n    }\n\n    /**\n     * Thread pool for JSONB processing.\n     */\n    private static ExecutorService jsonbProcessingThreadPool;\n    private static CompletionService<JsonProcessingResult<MarshallerTaskResult>> marshallingCompletion;\n    private static CompletionService<JsonProcessingResult<Customer>> unmarshallingCompletion;\n\n    /**\n     * Executor for checking results.\n     */\n    private static ExecutorService resultCheckService;\n\n    /**\n     * Jsonb instances configuration initialisation.\n     */\n    static {\n        JsonbConfig defaultConfig = new JsonbConfig();\n\n        JsonbConfig customizedConfig = new JsonbConfig();\n        customizedConfig.setProperty(JsonbConfig.PROPERTY_NAMING_STRATEGY, PropertyNamingStrategy.LOWER_CASE_WITH_UNDERSCORES);\n        customizedConfig.setProperty(JsonbConfig.PROPERTY_VISIBILITY_STRATEGY, new PropertyVisibilityStrategy() {\n            @Override\n            public boolean isVisible(Field field) {\n                final String name = field.getName();\n                return !(name.equals(\"strings\") || name.equals(\"integers\"));\n            }\n\n            @Override\n            public boolean isVisible(Method method) {\n                final String name = method.getName();\n                return !(name.equals(\"getStrings\") || name.equals(\"getIntegers\"));\n            }\n        });\n\n\n        defaultJsonBinding = JsonbBuilder.create(defaultConfig);\n        customizedJsonBinding = JsonbBuilder.create(customizedConfig);\n    }\n\n    @BeforeAll\n    public static void setUp() throws Exception {\n        jsonbProcessingThreadPool = Executors.newFixedThreadPool(THREAD_COUNT);\n        marshallingCompletion = new ExecutorCompletionService<>(jsonbProcessingThreadPool);\n        unmarshallingCompletion = new ExecutorCompletionService<>(jsonbProcessingThreadPool);\n        resultCheckService = Executors.newFixedThreadPool(2);\n    }\n\n    @Test\n    public void testDataConsistency() throws Exception {\n        submitJsonbProcessingTasks();\n        fireJsonbProcessing.countDown();\n        submitResultCheckingTasks();\n\n\n        jsonbProcessingThreadPool.shutdown();\n        jsonbProcessingThreadPool.awaitTermination(1000, TimeUnit.MILLISECONDS);\n        resultCheckService.shutdown();\n        resultCheckService.awaitTermination(5000, TimeUnit.MILLISECONDS);\n\n        //Final check, that successful task result check count matches count of tasks that were submitted.\n        assertEquals(TOTAL_JOB_COUNT, resultsCheckedCount.get());\n    }\n\n    /**\n     * Picks marshalling / unmarshalling results from completion service queue and check if they\n     * are equal their expected prototypes.\n     *\n     * If ThreadLocal JsonbContext is incorrectly shared between pooled threads, configuration of jsonb instances\n     * would be stale and results will not match.\n     */\n    private void submitResultCheckingTasks() {\n        resultCheckService.execute(new ResultChecker<>(marshallingCompletion) {\n            @Override\n            protected void checkResult(JsonProcessingResult<MarshallerTaskResult> result) {\n                MarshallerTaskResult marshallerResult = result.getResult();\n                //actual check, produced json by marshaller is equal to expected by configuration, which triggered marshalling task.\n                assertEquals(marshallerResult.getConfigurationType().getExpectedJson(), marshallerResult.getProducedJson());\n                resultsCheckedCount.incrementAndGet();\n                logger.fine(String.format(\"Job %-32s dispatched by thread %-16s completed successfully.\", result.getJobId(), result.getDispatcherThreadName()));\n            }\n        });\n\n        resultCheckService.execute(new ResultChecker<>(unmarshallingCompletion) {\n            @Override\n            protected void checkResult(JsonProcessingResult<Customer> result) {\n                //actual check, unmarshalled json result have all expected values.\n                //if JsonbConfig is stale, key names will not match, and this assert will not pass.\n                assertCustomerValues(result.getResult(), \"MULTI_TENANCY_TEST\");\n                resultsCheckedCount.incrementAndGet();\n                logger.fine(String.format(\"Job %-32s dispatched by thread %-16s completed successfully.\", result.getJobId(), result.getDispatcherThreadName()));\n            }\n        });\n    }\n\n    /**\n     * Chooses shared jsonb instance, either with default or customized key names\n     * and submits marshaller an unmarshaller task for it.\n     */\n    private static void submitJsonbProcessingTasks() {\n        for(int i = 0; i< TOTAL_JOB_COUNT; i+=2) {\n            boolean even = (i % 4 == 0);\n            ConfigurationType jsonbConfiguration = even ? ConfigurationType.DEFAULT : ConfigurationType.CUSTOMIZED;\n\n            final String unmarshallerJobId = jsonbConfiguration.name() + \"_Unmarshaller_ID_\" + i;\n            final UnmarshallerTask task = new UnmarshallerTask(fireJsonbProcessing, jsonbConfiguration.getExpectedJson(), jsonbConfiguration.getJsonbInstance(), unmarshallerJobId);\n            unmarshallingCompletion.submit(task);\n\n            final String marshallerJobId = jsonbConfiguration.name() + \"_Marshaller_ID_\" + i;\n            final MarshallerTask marshallerTask = new MarshallerTask(fireJsonbProcessing, jsonbConfiguration, marshallerJobId, createCustomer(\"MULTI_TENANCY_TEST\"));\n            marshallingCompletion.submit(marshallerTask);\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/concurrent/ResultChecker.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.concurrent;\n\nimport java.util.concurrent.CompletionService;\nimport java.util.concurrent.ExecutionException;\nimport java.util.concurrent.Future;\nimport java.util.concurrent.TimeUnit;\n\n/**\n * Checks result of marshalling / unmarshalling operation.\n */\nabstract class ResultChecker<T> implements Runnable {\n\n    private final CompletionService<JsonProcessingResult<T>> completionService;\n\n    public ResultChecker(CompletionService<JsonProcessingResult<T>> completionService) {\n        this.completionService = completionService;\n    }\n\n    /**\n     * Polls Callable results from CompletionService result queue and checks validity.\n     */\n    @Override\n    public void run() {\n        Future<JsonProcessingResult<T>> resultFuture;\n        try {\n            while ((resultFuture = completionService.poll(500, TimeUnit.MILLISECONDS)) != null) {\n                checkResult(resultFuture.get());\n            }\n        } catch (InterruptedException | ExecutionException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    protected abstract void checkResult(JsonProcessingResult<T> result);\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/concurrent/UnmarshallerTask.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.concurrent;\n\nimport org.eclipse.yasson.defaultmapping.specific.model.Customer;\n\nimport jakarta.json.bind.Jsonb;\nimport java.util.concurrent.Callable;\nimport java.util.concurrent.CountDownLatch;\n\n/**\n * Runs Jsonb unmarshaller, returns result.\n */\nclass UnmarshallerTask implements Callable<JsonProcessingResult<Customer>> {\n\n    private final String json;\n\n    private final Jsonb jsonb;\n\n    private final String jobId;\n\n    private final CountDownLatch latch;\n\n    public UnmarshallerTask(CountDownLatch latch, String json, Jsonb jsonb, String jobId) {\n        this.json = json;\n        this.jsonb = jsonb;\n        this.jobId = jobId;\n        this.latch = latch;\n    }\n\n    @Override\n    public JsonProcessingResult<Customer> call() throws Exception {\n        latch.await();\n        //unmarshalling will fail if JsonbConfig in ThreadLocal JsonbContext will not match expected json\n        Customer customer = jsonb.fromJson(json, Customer.class);\n        return new JsonProcessingResult<>(customer, Thread.currentThread().getName(), jobId);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/model/ModulesUtil.java",
    "content": "/*\n * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model;\n\nimport java.lang.invoke.MethodHandles;\n\n/**\n * Why is this class here?.\n *\n * This class is here to replace existing classes in test-runtime:\n * - src/main/java/org/eclipse/yasson/internal/model/ModulesUtil.java\n * - src/main/java9/org/eclipse/yasson/internal/model/ModulesUtil.java\n *\n * When tests are executed with maven-surefire-plugin the content of\n * 'classes' is in a different module-path than 'test-classes'.\n *\n * This causes the MethodHandles#publicLookup to fail. The reason is that\n * test classes to serialize/deserialize are coming from module 'test-classes'\n * and the module 'classes' has no access to it. The 'publicLookup' makes some\n * validations and because of this different modules, it fails.\n *\n * It should work if 'classes' and 'test-classes' are merged in one unique module.\n *\n */\nclass ModulesUtil {\n\n\n    private ModulesUtil() {\n    }\n\n    static MethodHandles.Lookup lookup(){\n        return MethodHandles.lookup();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/model/customization/naming/NamingPojo.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model.customization.naming;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class NamingPojo {\n\n    public NamingPojo() {\n    }\n\n    public NamingPojo(String upperCasedProperty, String _startingWithUnderscoreProperty, String CAPS_UNDERSCORE_PROPERTY) {\n        this.upperCasedProperty = upperCasedProperty;\n        this._startingWithUnderscoreProperty = _startingWithUnderscoreProperty;\n        this.CAPS_UNDERSCORE_PROPERTY = CAPS_UNDERSCORE_PROPERTY;\n    }\n\n    public String upperCasedProperty;\n    public String _startingWithUnderscoreProperty;\n    public String CAPS_UNDERSCORE_PROPERTY;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/model/customization/naming/PropertyNamingStrategyTest.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.model.customization.naming;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.config.PropertyNamingStrategy;\n\nimport org.eclipse.yasson.internal.model.customization.StrategiesProvider;\n\n/**\n * Tests naming strategies.\n *\n * @author Roman Grigoriadi\n */\npublic class PropertyNamingStrategyTest {\n\n    private final NamingPojo pojo = new NamingPojo(\"abc\", \"def\", \"ghi\");\n\n    @Test\n    public void testLowerCase() throws Exception {\n        PropertyNamingStrategy strategy = StrategiesProvider.getPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CASE_WITH_UNDERSCORES);\n        assertEquals(\"camel_case_property\", strategy.translateName(\"camelCaseProperty\"));\n        assertEquals(\"camelcase_property\", strategy.translateName(\"CamelcaseProperty\"));\n        assertEquals(\"camel_case_property\", strategy.translateName(\"CamelCaseProperty\"));\n        assertEquals(\"_camel_case_property\", strategy.translateName(\"_camelCaseProperty\"));\n        assertEquals(\"_camel_case_property\", strategy.translateName(\"_CamelCaseProperty\"));\n\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CASE_WITH_UNDERSCORES));\n        String lowercaseUnderscoresJson = \"{\\\"_starting_with_underscore_property\\\":\\\"def\\\",\\\"caps_underscore_property\\\":\\\"ghi\\\",\\\"upper_cased_property\\\":\\\"abc\\\"}\";\n        assertEquals(lowercaseUnderscoresJson, jsonb.toJson(pojo));\n        NamingPojo result = jsonb.fromJson(lowercaseUnderscoresJson, NamingPojo.class);\n        assertResult(result);\n    }\n\n    @Test\n    public void testLowerDashes() throws Exception {\n        PropertyNamingStrategy strategy = StrategiesProvider.getPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CASE_WITH_DASHES);\n        assertEquals(\"camel-case-property\", strategy.translateName(\"camelCaseProperty\"));\n        assertEquals(\"camelcase-property\", strategy.translateName(\"CamelcaseProperty\"));\n        assertEquals(\"camel-case-property\", strategy.translateName(\"CamelCaseProperty\"));\n        assertEquals(\"-camel-case-property\", strategy.translateName(\"-camelCaseProperty\"));\n        assertEquals(\"-camel-case-property\", strategy.translateName(\"-CamelCaseProperty\"));\n\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CASE_WITH_DASHES));\n        String lowercaseDashesJson = \"{\\\"_starting-with-underscore-property\\\":\\\"def\\\",\\\"caps_underscore_property\\\":\\\"ghi\\\",\\\"upper-cased-property\\\":\\\"abc\\\"}\";\n        assertEquals(lowercaseDashesJson, jsonb.toJson(pojo));\n        NamingPojo result = jsonb.fromJson(lowercaseDashesJson, NamingPojo.class);\n        assertResult(result);\n    }\n\n    @Test\n    public void testUpperCase() {\n        PropertyNamingStrategy upperCaseStrategy = StrategiesProvider.getPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE);\n        assertEquals(\"UpperCamelCase\", upperCaseStrategy.translateName(\"upperCamelCase\"));\n        assertEquals(\"UpperCamelCase\", upperCaseStrategy.translateName(\"UpperCamelCase\"));\n\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE));\n        String upperCased = \"{\\\"CAPS_UNDERSCORE_PROPERTY\\\":\\\"ghi\\\",\\\"UpperCasedProperty\\\":\\\"abc\\\",\\\"_startingWithUnderscoreProperty\\\":\\\"def\\\"}\";\n        assertEquals(upperCased, jsonb.toJson(pojo));\n        NamingPojo result = jsonb.fromJson(upperCased, NamingPojo.class);\n        assertResult(result);\n    }\n\n    @Test\n    public void testUpperCaseWithSpaces() {\n        PropertyNamingStrategy upperCaseWithSpacesStrategy = StrategiesProvider.getPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE_WITH_SPACES);\n        assertEquals(\"Upper Camel Case\", upperCaseWithSpacesStrategy.translateName(\"upperCamelCase\"));\n        assertEquals(\"Upper Camel Case\", upperCaseWithSpacesStrategy.translateName(\"UpperCamelCase\"));\n\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE_WITH_SPACES));\n        String upperCased = \"{\\\"CAPS_UNDERSCORE_PROPERTY\\\":\\\"ghi\\\",\\\"Upper Cased Property\\\":\\\"abc\\\",\\\"_starting With Underscore Property\\\":\\\"def\\\"}\";\n        assertEquals(upperCased, jsonb.toJson(pojo));\n        NamingPojo result = jsonb.fromJson(upperCased, NamingPojo.class);\n        assertResult(result);\n    }\n\n    @Test\n    public void testCaseInsensitive() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyNamingStrategy(PropertyNamingStrategy.CASE_INSENSITIVE));\n        String upperCased = \"{\\\"CAPS_UNDERSCORE_PROPERTY\\\":\\\"ghi\\\",\\\"_startingWithUnderscoreProperty\\\":\\\"def\\\",\\\"upperCasedProperty\\\":\\\"abc\\\"}\";\n        assertEquals(upperCased, jsonb.toJson(pojo));\n        NamingPojo result = jsonb.fromJson(\"{\\\"caPS_unDERscore_prOPERty\\\":\\\"ghi\\\",\\\"_startingwithUndERSCorePrOPERTy\\\":\\\"def\\\",\\\"upPERCASedProPerty\\\":\\\"abc\\\"}\", NamingPojo.class);\n        assertResult(result);\n    }\n    \n    @Test\n    public void testIdentityCaseSensitive() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyNamingStrategy(PropertyNamingStrategy.IDENTITY));\n        NamingPojo result = jsonb.fromJson(\"{\\\"CAPS_UNDERSCORE_PROPERTY\\\":\\\"ghi\\\",\\\"_startingWithUnderscoreProperty\\\":\\\"def\\\",\\\"UPPERCASEDPROPERTY\\\":\\\"abc\\\"}\", NamingPojo.class);\n        assertEquals(\"ghi\", result.CAPS_UNDERSCORE_PROPERTY);\n        assertEquals(\"def\", result._startingWithUnderscoreProperty);\n        assertNull(result.upperCasedProperty);\n    }\n\n    @Test\n    public void testCustom() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyNamingStrategy(propertyName -> propertyName + \"_\" + propertyName.toUpperCase()));\n\n        String custom = \"{\\\"CAPS_UNDERSCORE_PROPERTY_CAPS_UNDERSCORE_PROPERTY\\\":\\\"ghi\\\",\\\"_startingWithUnderscoreProperty__STARTINGWITHUNDERSCOREPROPERTY\\\":\\\"def\\\",\\\"upperCasedProperty_UPPERCASEDPROPERTY\\\":\\\"abc\\\"}\";\n        assertEquals(custom, jsonb.toJson(pojo));\n        NamingPojo result = jsonb.fromJson(custom, NamingPojo.class);\n        assertResult(result);\n    }\n    \n    private static void assertResult(NamingPojo result) {\n        assertEquals(\"abc\", result.upperCasedProperty);\n        assertEquals(\"def\", result._startingWithUnderscoreProperty);\n        assertEquals(\"ghi\", result.CAPS_UNDERSCORE_PROPERTY);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/internal/serializer/ObjectDeserializerTest.java",
    "content": "/*\n * Copyright (c) 2019, 2023 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.internal.serializer;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport jakarta.json.bind.JsonbException;\n\npublic class ObjectDeserializerTest {\n\n    @Test\n    public void testGetInstanceExceptionShouldContainClassNameOnMissingConstructor() {\n        assertThrows(JsonbException.class, \n                () -> defaultJsonb.fromJson(\"{\\\"key\\\":\\\"value\\\"}\", DummyDeserializationClass.class),\n                DummyDeserializationClass.class::getName);\n    }\n\n    public static class DummyDeserializationClass {\n        private String key;\n\n        public DummyDeserializationClass(String key) {\n            this.key = key;\n        }\n\n        public String getKey() {\n            return key;\n        }\n\n        public void setKey(String key) {\n            this.key = key;\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/jsonpsubstitution/AdaptedJsonParser.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.jsonpsubstitution;\n\nimport jakarta.json.Json;\nimport jakarta.json.JsonArray;\nimport jakarta.json.JsonObject;\nimport jakarta.json.JsonValue;\nimport jakarta.json.stream.JsonLocation;\nimport jakarta.json.stream.JsonParser;\nimport java.io.InputStream;\nimport java.math.BigDecimal;\nimport java.util.Map;\nimport java.util.stream.Stream;\n\npublic class AdaptedJsonParser implements JsonParser {\n\n    /**\n     * Adapts every parsed string value.\n     */\n    public interface StringValueAdapter {\n        String adaptStringValue(String value);\n    }\n\n    private final StringValueAdapter adapter;\n\n    private final JsonParser jsonParser;\n\n    public AdaptedJsonParser(StringValueAdapter adapter, InputStream inputStream) {\n        this.adapter = adapter;\n        this.jsonParser = Json.createParser(inputStream);\n    }\n\n    @Override\n    public boolean hasNext() {\n        return jsonParser.hasNext();\n    }\n\n    @Override\n    public Event next() {\n        return jsonParser.next();\n    }\n\n    @Override\n    public String getString() {\n        return adapter.adaptStringValue(jsonParser.getString());\n    }\n\n    @Override\n    public boolean isIntegralNumber() {\n        return jsonParser.isIntegralNumber();\n    }\n\n    @Override\n    public int getInt() {\n        return jsonParser.getInt();\n    }\n\n    @Override\n    public long getLong() {\n        return jsonParser.getLong();\n    }\n\n    @Override\n    public BigDecimal getBigDecimal() {\n        return jsonParser.getBigDecimal();\n    }\n\n    @Override\n    public JsonLocation getLocation() {\n        return jsonParser.getLocation();\n    }\n\n    @Override\n    public JsonObject getObject() {\n        return jsonParser.getObject();\n    }\n\n    @Override\n    public JsonValue getValue() {\n        return jsonParser.getValue();\n    }\n\n    @Override\n    public JsonArray getArray() {\n        return jsonParser.getArray();\n    }\n\n    @Override\n    public Stream<JsonValue> getArrayStream() {\n        return jsonParser.getArrayStream();\n    }\n\n    @Override\n    public Stream<Map.Entry<String, JsonValue>> getObjectStream() {\n        return jsonParser.getObjectStream();\n    }\n\n    @Override\n    public Stream<JsonValue> getValueStream() {\n        return jsonParser.getValueStream();\n    }\n\n    @Override\n    public void skipArray() {\n        jsonParser.skipArray();\n    }\n\n    @Override\n    public void skipObject() {\n        jsonParser.skipObject();\n    }\n\n    @Override\n    public void close() {\n        jsonParser.close();\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/jsonpsubstitution/PreinstantiatedJsonpTest.java",
    "content": "/*\n * Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.jsonpsubstitution;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.Assertions;\nimport org.eclipse.yasson.TestTypeToken;\n\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.stream.JsonGenerator;\nimport jakarta.json.stream.JsonParser;\nimport java.io.ByteArrayInputStream;\nimport java.io.ByteArrayOutputStream;\nimport java.util.List;\n\npublic class PreinstantiatedJsonpTest {\n\n    public static class Dog {\n\n        public String name;\n        public int age;\n        public boolean goodDog = true;\n\n        public Dog() {\n        }\n\n        public Dog(String name, int age) {\n            this.name = name;\n            this.age = age;\n        }\n\n        @Override\n        public String toString() {\n            return \"Dog:\\nname: \" + name + \"\\nage: \" + age + \"\\ngoodDog: \" + goodDog;\n        }\n    }\n\n    public static class Wrapper<T> {\n        private T value;\n\n        public T getValue() {\n            return value;\n        }\n\n        public void setValue(T value) {\n            this.value = value;\n        }\n    }\n\n    private final String EXPECTED_JSON = \"{\\\"age\\\":4,\\\"goodDog\\\":true,\\\"name\\\":\\\"Falco\\\",\\\"suffix\\\":\\\"Best dog ever!\\\"}\";\n\n    private final String WRAPPED_JSON = \"{\\\"instance\\\":\" + EXPECTED_JSON + \"}\";\n\n    private Dog dog = new Dog(\"Falco\", 4);\n\n    @Test\n    public void testPreinstantiatedJsonGeneratorAndParser() {\n        ByteArrayOutputStream out = new ByteArrayOutputStream();\n        JsonGenerator generator = new SuffixJsonGenerator(\"Best dog ever!\", out);\n        bindingYassonJsonb.toJson(dog, generator);\n        generator.close();\n\n        assertEquals(EXPECTED_JSON, new String(out.toByteArray()));\n\n        ByteArrayInputStream in = new ByteArrayInputStream(EXPECTED_JSON.getBytes());\n        JsonParser parser = new AdaptedJsonParser((value) -> {\n            if (\"Falco\".equals(value)) {\n                return value + \", a best dog ever!\";\n            }\n            return value;\n        }, in);\n        Dog result = bindingYassonJsonb.fromJson(parser, Dog.class);\n\n        assertEquals(\"Falco, a best dog ever!\", result.name);\n        assertEquals(4, result.age);\n        assertTrue(result.goodDog);\n    }\n\n    @Test\n    public void testJsonParserAdvancedToCustomPosition() {\n        ByteArrayInputStream in = new ByteArrayInputStream(WRAPPED_JSON.getBytes());\n        JsonParser parser = new AdaptedJsonParser((value) -> {\n            if (\"Falco\".equals(value)) {\n                return value + \", a best dog ever!\";\n            }\n            return value;\n        }, in);\n\n        parser.next(); //START_OBJECT\n        parser.next(); //\"instance\" KEY\n\n        Dog result = bindingYassonJsonb.fromJson(parser, Dog.class);\n\n        parser.next(); //END_OJBECT\n\n        assertEquals(\"Falco, a best dog ever!\", result.name);\n        assertEquals(4, result.age);\n        assertTrue(result.goodDog);\n    }\n\n    @Test\n    public void testGeneratorWrappedWithUserInteraction() {\n        ByteArrayOutputStream out = new ByteArrayOutputStream();\n        JsonGenerator generator = new SuffixJsonGenerator(\"Best dog ever!\", out);\n\n        generator.writeStartObject();\n        generator.writeKey(\"instance\");\n        bindingYassonJsonb.toJson(dog, generator);\n        generator.writeEnd();\n        generator.close();\n\n        assertEquals(WRAPPED_JSON, new String(out.toByteArray()));\n    }\n\n    @Test\n    public void testInvalidJsonParserAdvancedToCustomPosition() {\n        ByteArrayInputStream in = new ByteArrayInputStream(WRAPPED_JSON.getBytes());\n        JsonParser parser = new AdaptedJsonParser((value) -> {\n            if (\"Falco\".equals(value)) {\n                return value + \", a best dog ever!\";\n            }\n            return value;\n        }, in);\n\n        parser.next(); //START_OBJECT\n        //should be advanced further\n\n        try {\n        \tbindingYassonJsonb.fromJson(parser, Dog.class);\n            fail(\"JsonbException not thrown\");\n        } catch (JsonbException e) {\n            //OK, parser in inconsistent state\n        }\n    }\n\n    @Test\n    public void testInvalidGeneratorWrappedWithUserInteraction() {\n        ByteArrayOutputStream out = new ByteArrayOutputStream();\n        JsonGenerator generator = new SuffixJsonGenerator(\"Best dog ever!\", out);\n\n        generator.writeStartObject();\n        //key not written\n\n        Assertions.shouldFail(() -> bindingYassonJsonb.toJson(dog, generator));\n    }\n\n    @Test\n    public void testRuntimeTypeParser() {\n        Wrapper<String> stringWrapper = new Wrapper<>();\n        stringWrapper.setValue(\"String value\");\n        ByteArrayInputStream in = new ByteArrayInputStream(\"{\\\"value\\\":\\\"String value\\\"}\".getBytes());\n        JsonParser parser = new AdaptedJsonParser((value) -> {\n            if (value.equals(\"String value\")) {\n                return \"Adapted string\";\n            }\n            return value;\n        }, in);\n        Wrapper<String> result = bindingYassonJsonb.fromJson(parser, new TestTypeToken<Wrapper<String>>() {}.getType());\n        assertEquals(\"Adapted string\", result.getValue());\n    }\n\n    /**\n     * This test tests that provided generator is actually used.\n     */\n    @Test\n    public void testRuntimeTypeGenerator() {\n        Wrapper<String> stringWrapper = new Wrapper<>();\n        stringWrapper.setValue(\"String value\");\n        ByteArrayOutputStream out = new ByteArrayOutputStream();\n        JsonGenerator generator = new SuffixJsonGenerator(\"Appended value.\", out);\n        bindingYassonJsonb.toJson(stringWrapper, new TestTypeToken<Wrapper<String>>(){}.getType(), generator);\n        generator.close();\n        assertEquals(\"{\\\"value\\\":\\\"String value\\\",\\\"suffix\\\":\\\"Appended value.\\\"}\", out.toString());\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/jsonpsubstitution/SuffixJsonGenerator.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.jsonpsubstitution;\n\nimport jakarta.json.Json;\nimport jakarta.json.JsonValue;\nimport jakarta.json.stream.JsonGenerator;\nimport java.io.OutputStream;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\n\n/**\n * Test purpose generator appending a suffix key-value to end of object.\n */\npublic class SuffixJsonGenerator implements JsonGenerator {\n\n    private final JsonGenerator generator;\n\n    /**\n     * Create key-value pair for each object at its end.\n     */\n    private final String objSuffix;\n\n    private boolean written;\n\n    public SuffixJsonGenerator(String objSuffix, OutputStream out) {\n        this.objSuffix = objSuffix;\n        this.generator = Json.createGenerator(out);\n    }\n\n    @Override\n    public JsonGenerator writeStartObject() {\n        return generator.writeStartObject();\n    }\n\n    @Override\n    public JsonGenerator writeStartObject(String name) {\n        return generator.writeStartObject(name);\n    }\n\n    @Override\n    public JsonGenerator writeKey(String name) {\n        return generator.writeKey(name);\n    }\n\n    @Override\n    public JsonGenerator writeStartArray() {\n        return generator.writeStartArray();\n    }\n\n    @Override\n    public JsonGenerator writeStartArray(String name) {\n        return generator.writeStartArray(name);\n    }\n\n    @Override\n    public JsonGenerator write(String name, JsonValue value) {\n        return generator.write(name, value);\n    }\n\n    @Override\n    public JsonGenerator write(String name, String value) {\n        return generator.write(name, value);\n    }\n\n    @Override\n    public JsonGenerator write(String name, BigInteger value) {\n        return generator.write(name, value);\n    }\n\n    @Override\n    public JsonGenerator write(String name, BigDecimal value) {\n        return generator.write(name, value);\n    }\n\n    @Override\n    public JsonGenerator write(String name, int value) {\n        return generator.write(name, value);\n    }\n\n    @Override\n    public JsonGenerator write(String name, long value) {\n        return generator.write(name, value);\n    }\n\n    @Override\n    public JsonGenerator write(String name, double value) {\n        return generator.write(name, value);\n    }\n\n    @Override\n    public JsonGenerator write(String name, boolean value) {\n        return generator.write(name, value);\n    }\n\n    @Override\n    public JsonGenerator writeNull(String name) {\n        return generator.writeNull(name);\n    }\n\n    @Override\n    public JsonGenerator writeEnd() {\n        if (!written) {\n            generator.write(\"suffix\", objSuffix);\n            written = true;\n        }\n        return generator.writeEnd();\n    }\n\n    @Override\n    public JsonGenerator write(JsonValue value) {\n        return generator.write(value);\n    }\n\n    @Override\n    public JsonGenerator write(String value) {\n        return generator.write(value);\n    }\n\n    @Override\n    public JsonGenerator write(BigDecimal value) {\n        return generator.write(value);\n    }\n\n    @Override\n    public JsonGenerator write(BigInteger value) {\n        return generator.write(value);\n    }\n\n    @Override\n    public JsonGenerator write(int value) {\n        return generator.write(value);\n    }\n\n    @Override\n    public JsonGenerator write(long value) {\n        return generator.write(value);\n    }\n\n    @Override\n    public JsonGenerator write(double value) {\n        return generator.write(value);\n    }\n\n    @Override\n    public JsonGenerator write(boolean value) {\n        return generator.write(value);\n    }\n\n    @Override\n    public JsonGenerator writeNull() {\n        return generator.writeNull();\n    }\n\n    @Override\n    public void close() {\n        generator.close();\n    }\n\n    @Override\n    public void flush() {\n        generator.flush();\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/jsonstructure/InnerPojo.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.jsonstructure;\n\npublic final class InnerPojo {\n    private String innerFirst;\n    private String innerSecond;\n\n    public String getInnerFirst() {\n        return innerFirst;\n    }\n\n    public void setInnerFirst(String innerFirst) {\n        this.innerFirst = innerFirst;\n    }\n\n    public String getInnerSecond() {\n        return innerSecond;\n    }\n\n    public void setInnerSecond(String innerSecond) {\n        this.innerSecond = innerSecond;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/jsonstructure/InnerPojoDeserializer.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.jsonstructure;\n\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.stream.JsonParser;\nimport java.lang.reflect.Type;\n\npublic class InnerPojoDeserializer implements JsonbDeserializer<InnerPojo> {\n    @Override\n    public InnerPojo deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {\n        InnerPojo innerPojo = new InnerPojo();\n        //KEY first\n        parser.next();\n        //VALUE\n        parser.next();\n        innerPojo.setInnerFirst(parser.getString());\n        //KEY second\n        parser.next();\n        //VALUE\n        parser.next();\n        innerPojo.setInnerSecond(parser.getString());\n        //END_OBJECT\n        parser.next();\n        return innerPojo;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/jsonstructure/InnerPojoSerializer.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.jsonstructure;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\n\npublic class InnerPojoSerializer implements JsonbSerializer<InnerPojo> {\n\n    @Override\n    public void serialize(InnerPojo obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.writeStartObject();\n        generator.write(\"first\", obj.getInnerFirst());\n        generator.write(\"second\", obj.getInnerSecond());\n        generator.writeEnd();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/jsonstructure/Issue673.java",
    "content": "/*\n * Copyright (c) 2026 Contributors to the Eclipse Foundation\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.jsonstructure;\n\nimport jakarta.json.Json;\nimport jakarta.json.JsonArray;\nimport jakarta.json.JsonObject;\nimport jakarta.json.JsonString;\nimport jakarta.json.JsonValue;\nimport jakarta.json.bind.annotation.JsonbSubtype;\nimport jakarta.json.bind.annotation.JsonbTypeDeserializer;\nimport jakarta.json.bind.annotation.JsonbTypeInfo;\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.stream.JsonParser;\nimport java.lang.reflect.Type;\nimport java.util.Collections;\nimport java.util.stream.Collectors;\n\n/**\n * Test case for Issue #673: Custom deserializers with polymorphic types and JSON structure API.\n *\n * <p>This test validates the interaction between:\n * <ul>\n *   <li>Custom {@link JsonbDeserializer} implementations</li>\n *   <li>Polymorphic type handling via {@link JsonbTypeInfo} and {@link JsonbSubtype}</li>\n *   <li>JSON-P structure API ({@link JsonArray}, {@link JsonObject}, {@link JsonValue})</li>\n * </ul>\n *\n * <p>The test ensures that custom deserializers can properly access and process JSON structure\n * objects when deserializing complex types with polymorphic behavior.\n *\n * @see <a href=\"https://github.com/eclipse-ee4j/yasson/issues/673\">Issue #673</a>\n */\npublic class Issue673 {\n    \n    /**\n     * Marker interface for objects that can be referenced.\n     * Implemented by both {@link Reference} and {@link IRIReference}.\n     */\n    public static interface Referenceable {\n\n    }\n\n    /**\n     * A reference object with a description field.\n     * Deserialized from JSON objects containing a \"description\" property.\n     */\n    public static class Reference implements Referenceable {\n\n        private String description;\n\n        public String getDescription() {\n            return description;\n        }\n\n        public void setDescription(String description) {\n            this.description = description;\n        }\n    }\n\n    /**\n     * An IRI (Internationalized Resource Identifier) reference.\n     * Deserialized from JSON string values representing URIs.\n     */\n    public static class IRIReference implements Referenceable {\n\n        private String value;\n\n        public IRIReference() {}\n\n        public IRIReference(String value) {\n            this.value = value;\n        }\n\n        public String getValue() {\n            return value;\n        }\n\n        public void setValue(String value) {\n            this.value = value;\n        }\n    }\n\n    /**\n     * Interface for location types with polymorphic deserialization support.\n     * Uses {@link JsonbTypeInfo} to determine concrete type based on \"type\" field in JSON.\n     */\n    @JsonbTypeInfo(key = \"type\", value = {\n        @JsonbSubtype(alias = Location.TYPE,\n                      type = Location.class)\n    })\n    public static interface LocationInterface {\n\n    }\n\n    /**\n     * Concrete location implementation with custom deserializers for complex fields.\n     *\n     * <p>Demonstrates:\n     * <ul>\n     *   <li>Array-to-string conversion via {@link TagsDeserializer}</li>\n     *   <li>Polymorphic reference deserialization via {@link ReferenceableDeserializer}</li>\n     * </ul>\n     */\n    public static class Location implements LocationInterface {\n\n        public final static String TYPE = \"Location\";\n\n        private String tags;\n        private Referenceable referenceable;\n\n        /**\n         * Gets the tags as a comma-separated string.\n         * Uses custom deserializer to convert JSON array to string.\n         *\n         * @return comma-separated tag string\n         */\n        @JsonbTypeDeserializer(TagsDeserializer.class)\n        public String getTags() {\n            return tags;\n        }\n\n        public void setTags(String tags) {\n            this.tags = tags;\n        }\n        \n        /**\n         * Gets the reference object.\n         * Uses custom deserializer to handle polymorphic deserialization\n         * from either string (IRI) or object (Reference) JSON values.\n         *\n         * @return the referenceable object\n         */\n        @JsonbTypeDeserializer(ReferenceableDeserializer.class)\n        public Referenceable getReference() {\n            return referenceable;\n        }\n\n        public void setReference(Referenceable referenceable) {\n            this.referenceable = referenceable;\n        }\n    }\n\n    /**\n     * Custom deserializer that converts a JSON array of strings into a comma-separated string.\n     *\n     * <p>Example JSON: {@code [\"tag1\", \"tag2\", \"tag3\"]} → {@code \"tag1, tag2, tag3\"}\n     *\n     * <p>This tests the ability to use {@link JsonParser#getArray()} to access\n     * JSON structure objects during deserialization.\n     */\n    public static class TagsDeserializer implements JsonbDeserializer<String> {\n        @Override\n        public String deserialize(JsonParser jp, DeserializationContext dc, Type type) {\n            final JsonValue v = jp.getArray();\n            if (v instanceof JsonArray) {\n                JsonArray arr = (JsonArray) v;\n                return arr.stream()\n                        .filter(JsonString.class::isInstance)\n                        .map(JsonString.class::cast)\n                        .map(JsonString::getString)\n                        .collect(Collectors.joining(\", \"));\n            }\n            return null;\n        }\n\n    }\n    \n    /**\n     * Custom deserializer that handles polymorphic deserialization of {@link Referenceable} objects.\n     *\n     * <p>Supports two JSON representations:\n     * <ul>\n     *   <li>String value → {@link IRIReference} (e.g., {@code \"http://example.com\"})</li>\n     *   <li>Object value → {@link Reference} (e.g., {@code {\"description\": \"...\"}})</li>\n     * </ul>\n     *\n     * <p>This tests the ability to:\n     * <ul>\n     *   <li>Use {@link JsonParser#getValue()} to access JSON structure objects</li>\n     *   <li>Recursively deserialize nested objects using {@link DeserializationContext#deserialize}</li>\n     *   <li>Create new parsers from JSON-P structure objects</li>\n     * </ul>\n     */\n    public static class ReferenceableDeserializer implements JsonbDeserializer<Referenceable> {\n\n        @Override\n        public Referenceable deserialize(JsonParser jp, DeserializationContext dc, Type type) {\n            final JsonValue v = jp.getValue();\n            if (v instanceof JsonString) {\n                JsonString str = (JsonString) v;\n                return new IRIReference(str.getString());\n            }\n            if (v instanceof JsonObject) {\n                JsonObject obj = (JsonObject) v;\n                return dc.deserialize(Reference.class,\n                        Json.createParserFactory(Collections.emptyMap())\n                                .createParser(obj));\n            }\n            return null;\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/jsonstructure/JsonGeneratorToStructureAdapterTest.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.jsonstructure;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.YassonJsonb;\n\nimport jakarta.json.JsonArray;\nimport jakarta.json.JsonNumber;\nimport jakarta.json.JsonObject;\nimport jakarta.json.JsonString;\nimport jakarta.json.JsonStructure;\nimport jakarta.json.JsonValue;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport java.math.BigDecimal;\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class JsonGeneratorToStructureAdapterTest {\n\n    @Test\n    public void testSimplePojo() {\n        Pojo pojo = new Pojo();\n        pojo.setBigDecimalProperty(BigDecimal.TEN);\n        pojo.setLongProperty(10L);\n        pojo.setStringProperty(\"String value\");\n\n        JsonObject result = (JsonObject) yassonJsonb.toJsonStructure(pojo);\n\n        assertEquals(\"String value\", getString(result.get(\"stringProperty\")));\n        JsonValue bigDecimalProperty = result.get(\"bigDecimalProperty\");\n        assertEquals(JsonValue.ValueType.NUMBER, bigDecimalProperty.getValueType());\n        assertEquals(BigDecimal.TEN, ((JsonNumber) bigDecimalProperty).bigDecimalValue());\n        JsonValue longProperty = result.get(\"longProperty\");\n        assertEquals(JsonValue.ValueType.NUMBER, longProperty.getValueType());\n        assertEquals(10L, ((JsonNumber) longProperty).longValueExact());\n    }\n\n    @Test\n    public void testInnerObjects() {\n        Pojo pojo = new Pojo();\n        pojo.setBigDecimalProperty(BigDecimal.TEN);\n        pojo.setLongProperty(10L);\n        pojo.setStringProperty(\"String value\");\n        pojo.setInner(new InnerPojo());\n        pojo.getInner().setInnerFirst(\"First\");\n        pojo.getInner().setInnerSecond(\"Second\");\n\n        JsonObject result = (JsonObject) yassonJsonb.toJsonStructure(pojo, Pojo.class);\n        assertEquals(\"String value\", getString(result.get(\"stringProperty\")));\n        JsonValue bigDecimalProperty = result.get(\"bigDecimalProperty\");\n        assertTrue(bigDecimalProperty instanceof JsonNumber);\n        assertEquals(BigDecimal.TEN, ((JsonNumber) bigDecimalProperty).bigDecimalValue());\n        JsonValue longProperty = result.get(\"longProperty\");\n        assertTrue(longProperty instanceof JsonNumber);\n        assertEquals(10L, ((JsonNumber) longProperty).longValueExact());\n\n        JsonValue inner = result.get(\"inner\");\n        assertEquals(JsonValue.ValueType.OBJECT, inner.getValueType());\n        assertEquals(\"First\", ((JsonObject)inner).getString(\"innerFirst\"));\n        assertEquals(\"Second\", ((JsonObject)inner).getString(\"innerSecond\"));\n    }\n\n    @Test\n    public void testSimpleJsonArray() {\n        List<Object> objList = new ArrayList<>();\n        objList.add(\"First\");\n        objList.add(10L);\n        objList.add(BigDecimal.ONE);\n        objList.add(Boolean.TRUE);\n        objList.add(null);\n\n        JsonArray result = (JsonArray) yassonJsonb.toJsonStructure(objList);\n        assertEquals(\"First\", result.getString(0));\n        assertEquals(10L, result.getJsonNumber(1).longValueExact());\n        assertEquals(BigDecimal.ONE, result.getJsonNumber(2).bigDecimalValue());\n        assertEquals(Boolean.TRUE, result.getBoolean(3));\n        assertEquals(JsonValue.ValueType.NULL, result.get(4).getValueType());\n    }\n\n    @Test\n    public void testJsonArrayInJsonObject() {\n        Pojo pojo = new Pojo();\n        pojo.setStrings(new ArrayList<>());\n        pojo.setBigDecimals(new ArrayList<>());\n        pojo.setBooleans(new ArrayList<>());\n        pojo.getStrings().add(\"First\");\n        pojo.getBigDecimals().add(BigDecimal.TEN);\n        pojo.getBooleans().add(Boolean.TRUE);\n\n        JsonObject result = (JsonObject) yassonJsonb.toJsonStructure(pojo);\n        assertEquals(JsonValue.ValueType.ARRAY, result.get(\"strings\").getValueType());\n        assertEquals(JsonValue.ValueType.ARRAY, result.get(\"bigDecimals\").getValueType());\n        assertEquals(JsonValue.ValueType.ARRAY, result.get(\"booleans\").getValueType());\n        assertEquals(\"First\", result.getJsonArray(\"strings\").getString(0));\n        assertEquals(BigDecimal.TEN, result.getJsonArray(\"bigDecimals\").getJsonNumber(0).bigDecimalValue());\n        assertEquals(Boolean.TRUE, result.getJsonArray(\"booleans\").getBoolean(0));\n    }\n\n    @Test\n    public void testNestedJsonArrays() {\n        List<List<Object>> outer = new ArrayList<>();\n        List<Object> inner = new ArrayList<>();\n        inner.add(\"First\");\n        inner.add(10L);\n        inner.add(BigDecimal.ONE);\n        inner.add(Boolean.TRUE);\n        inner.add(null);\n        outer.add(inner);\n\n        JsonArray result = (JsonArray) yassonJsonb.toJsonStructure(outer);\n        assertEquals(JsonValue.ValueType.ARRAY, result.get(0).getValueType());\n        JsonArray resultInner = result.getJsonArray(0);\n\n        assertEquals(\"First\", resultInner.getString(0));\n        assertEquals(10L, resultInner.getJsonNumber(1).longValueExact());\n        assertEquals(BigDecimal.ONE, resultInner.getJsonNumber(2).bigDecimalValue());\n        assertEquals(Boolean.TRUE, resultInner.getBoolean(3));\n        assertEquals(JsonValue.ValueType.NULL, resultInner.get(4).getValueType());\n    }\n\n    @Test\n    public void testCustomJsonbSerializer() {\n        Pojo pojo = new Pojo();\n        pojo.setInner(new InnerPojo());\n        pojo.getInner().setInnerFirst(\"First value\");\n        pojo.getInner().setInnerSecond(\"Second value\");\n        YassonJsonb jsonb = (YassonJsonb) JsonbBuilder.create(new JsonbConfig().withSerializers(new InnerPojoSerializer()));\n        JsonStructure result = jsonb.toJsonStructure(pojo);\n        assertEquals(JsonValue.ValueType.OBJECT, result.getValueType());\n        assertEquals(JsonValue.ValueType.OBJECT, ((JsonObject) result).get(\"inner\").getValueType());\n        JsonObject inner = (JsonObject) ((JsonObject) result).get(\"inner\");\n        assertEquals(JsonValue.ValueType.STRING, inner.get(\"first\").getValueType());\n        assertEquals(\"First value\", ((JsonString) inner.get(\"first\")).getString());\n        assertEquals(JsonValue.ValueType.STRING, inner.get(\"second\").getValueType());\n        assertEquals(\"Second value\", ((JsonString) inner.get(\"second\")).getString());\n    }\n\n    private static String getString(JsonValue value) {\n        if (value instanceof JsonString) {\n            return ((JsonString) value).getString();\n        }\n        return value.toString();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/jsonstructure/JsonStructureToParserAdapterTest.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n * Copyright (c) 2026 Contributors to the Eclipse Foundation.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.jsonstructure;\n\nimport org.junit.jupiter.api.*;\nimport static org.junit.jupiter.api.Assertions.*;\nimport static org.eclipse.yasson.Jsonbs.*;\n\nimport org.eclipse.yasson.TestTypeToken;\nimport org.eclipse.yasson.YassonJsonb;\n\nimport jakarta.json.JsonArray;\nimport jakarta.json.JsonArrayBuilder;\nimport jakarta.json.JsonObject;\nimport jakarta.json.JsonObjectBuilder;\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.spi.JsonProvider;\nimport java.math.BigDecimal;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\n\npublic class JsonStructureToParserAdapterTest {\n    private final JsonProvider jsonProvider = JsonProvider.provider();\n\n    @Test\n    public void testBasicJsonObject() {\n        JsonObjectBuilder objectBuilder = jsonProvider.createObjectBuilder();\n        objectBuilder.add(\"stringProperty\", \"value 1\");\n        objectBuilder.add(\"bigDecimalProperty\", new BigDecimal(\"1.1\"));\n        objectBuilder.add(\"longProperty\", 10L);\n        JsonObject jsonObject = objectBuilder.build();\n        Pojo result = yassonJsonb.fromJsonStructure(jsonObject, Pojo.class);\n        assertEquals(\"value 1\", result.getStringProperty());\n        assertEquals(new BigDecimal(\"1.1\"), result.getBigDecimalProperty());\n        assertEquals(Long.valueOf(10), result.getLongProperty());\n    }\n\n    @Test\n    public void testNullValues() {\n        JsonObjectBuilder objectBuilder = jsonProvider.createObjectBuilder();\n        objectBuilder.addNull(\"stringProperty\");\n        objectBuilder.addNull(\"bigDecimalProperty\");\n        objectBuilder.add(\"longProperty\", 10L);\n        JsonObject jsonObject = objectBuilder.build();\n        Pojo result = yassonJsonb.fromJsonStructure(jsonObject, Pojo.class);\n        assertNull(result.getStringProperty());\n        assertNull(result.getBigDecimalProperty());\n        assertEquals(Long.valueOf(10), result.getLongProperty());\n    }\n\n    @Test\n    public void testInnerJsonObjectWrappedWithProperties() {\n        JsonObjectBuilder innerBuilder = jsonProvider.createObjectBuilder();\n        innerBuilder.add(\"innerFirst\", \"Inner value 1\");\n        innerBuilder.add(\"innerSecond\", \"Inner value 2\");\n\n        JsonObjectBuilder objectBuilder = jsonProvider.createObjectBuilder();\n\n        objectBuilder.add(\"stringProperty\", \"value 1\");\n        objectBuilder.add(\"inner\", innerBuilder.build());\n        objectBuilder.add(\"bigDecimalProperty\", new BigDecimal(\"1.1\"));\n        objectBuilder.add(\"longProperty\", 10L);\n        JsonObject jsonObject = objectBuilder.build();\n        Pojo result = yassonJsonb.fromJsonStructure(jsonObject, Pojo.class);\n\n        assertEquals(\"value 1\", result.getStringProperty());\n        assertEquals(new BigDecimal(\"1.1\"), result.getBigDecimalProperty());\n        assertEquals(Long.valueOf(10), result.getLongProperty());\n        assertEquals(\"Inner value 1\", result.getInner().getInnerFirst());\n        assertEquals(\"Inner value 2\", result.getInner().getInnerSecond());\n    }\n\n    @Test\n    public void testInnerJsonObjectAtEndProperty() {\n        JsonObjectBuilder innerBuilder = jsonProvider.createObjectBuilder();\n        innerBuilder.add(\"innerFirst\", \"Inner value 1\");\n        innerBuilder.add(\"innerSecond\", \"Inner value 2\");\n\n        JsonObjectBuilder objectBuilder = jsonProvider.createObjectBuilder();\n\n        objectBuilder.add(\"stringProperty\", \"value 1\");\n        objectBuilder.add(\"bigDecimalProperty\", new BigDecimal(\"1.1\"));\n        objectBuilder.add(\"longProperty\", 10L);\n        objectBuilder.add(\"inner\", innerBuilder.build());\n\n        JsonObject jsonObject = objectBuilder.build();\n        Pojo result = yassonJsonb.fromJsonStructure(jsonObject, Pojo.class);\n\n        assertEquals(\"value 1\", result.getStringProperty());\n        assertEquals(new BigDecimal(\"1.1\"), result.getBigDecimalProperty());\n        assertEquals(Long.valueOf(10), result.getLongProperty());\n        assertEquals(\"Inner value 1\", result.getInner().getInnerFirst());\n        assertEquals(\"Inner value 2\", result.getInner().getInnerSecond());\n\n    }\n\n    @Test\n    public void testEmptyJsonObject() {\n        JsonObjectBuilder objectBuilder = jsonProvider.createObjectBuilder();\n        JsonObject jsonObject = objectBuilder.build();\n        Pojo result = yassonJsonb.fromJsonStructure(jsonObject, Pojo.class);\n        assertNull(result.getStringProperty());\n        assertNull(result.getBigDecimalProperty());\n        assertNull(result.getLongProperty());\n    }\n\n    @Test\n    public void testEmptyInnerJsonObject() {\n        JsonObjectBuilder objectBuilder = jsonProvider.createObjectBuilder();\n\n        JsonObjectBuilder innerBuilder = jsonProvider.createObjectBuilder();\n        JsonObject innerObject = innerBuilder.build();\n\n        objectBuilder.add(\"inner\", innerObject);\n\n        JsonObject jsonObject = objectBuilder.build();\n\n        Pojo result = yassonJsonb.fromJsonStructure(jsonObject, Pojo.class);\n        assertNull(result.getStringProperty());\n        assertNull(result.getBigDecimalProperty());\n        assertNull(result.getLongProperty());\n\n        assertNotNull(result.getInner());\n        assertNull(result.getInner().getInnerFirst());\n        assertNull(result.getInner().getInnerSecond());\n    }\n\n    @Test\n    public void testSimpleArray() {\n        JsonArrayBuilder arrayBuilder = jsonProvider.createArrayBuilder();\n        arrayBuilder.add(BigDecimal.TEN).add(\"String value\").addNull();\n        JsonArray jsonArray = arrayBuilder.build();\n        List result = yassonJsonb.fromJsonStructure(jsonArray, ArrayList.class);\n        assertEquals(3, result.size());\n        assertEquals(BigDecimal.TEN, result.get(0));\n        assertEquals(\"String value\", result.get(1));\n        assertNull(result.get(2));\n    }\n\n    @Test\n    public void testArraysInsideObject() {\n        JsonArrayBuilder bigDecBuilder = jsonProvider.createArrayBuilder();\n        JsonArrayBuilder strBuilder = jsonProvider.createArrayBuilder();\n        JsonArrayBuilder blnBuilder = jsonProvider.createArrayBuilder();\n\n        bigDecBuilder.add(BigDecimal.TEN);\n        strBuilder.add(\"String value 1\");\n        blnBuilder.add(Boolean.TRUE);\n\n        JsonObjectBuilder pojoBuilder = jsonProvider.createObjectBuilder();\n        pojoBuilder.add(\"strings\", strBuilder.build());\n        pojoBuilder.add(\"bigDecimals\", bigDecBuilder.build());\n        pojoBuilder.add(\"booleans\", blnBuilder.build());\n\n        JsonObject jsonObject = pojoBuilder.build();\n        Pojo pojo = yassonJsonb.fromJsonStructure(jsonObject, Pojo.class);\n\n        assertEquals(1, pojo.getBigDecimals().size());\n        assertEquals(1, pojo.getStrings().size());\n        assertEquals(1, pojo.getBooleans().size());\n    }\n\n    @Test\n    public void testNestedArrays() {\n        JsonArrayBuilder arrayBuilder = jsonProvider.createArrayBuilder();\n        JsonArrayBuilder innerArrBuilder = jsonProvider.createArrayBuilder();\n        innerArrBuilder.add(\"first\").add(\"second\");\n        arrayBuilder.add(BigDecimal.TEN);\n        arrayBuilder.add(innerArrBuilder.build());\n\n        JsonArray jsonArray = arrayBuilder.build();\n\n        ArrayList result = yassonJsonb.fromJsonStructure(jsonArray, ArrayList.class);\n        assertEquals(2, result.size());\n        assertEquals(BigDecimal.TEN, result.get(0));\n        assertTrue(result.get(1) instanceof List);\n        List inner = (List) result.get(1);\n        assertEquals(2, inner.size());\n        assertEquals(\"first\", inner.get(0));\n        assertEquals(\"second\", inner.get(1));\n    }\n\n    @Test\n    public void testObjectsNestedInArrays() {\n        JsonObjectBuilder objectBuilder = jsonProvider.createObjectBuilder();\n        objectBuilder.add(\"stringProperty\", \"value 1\");\n        objectBuilder.add(\"bigDecimalProperty\", new BigDecimal(\"1.1\"));\n        objectBuilder.add(\"longProperty\", 10L);\n\n        JsonArrayBuilder innerArrayBuilder = jsonProvider.createArrayBuilder();\n        innerArrayBuilder.add(\"String value 1\");\n        objectBuilder.add(\"strings\", innerArrayBuilder.build());\n\n        JsonArrayBuilder arrayBuilder = jsonProvider.createArrayBuilder();\n        arrayBuilder.add(objectBuilder.build());\n\n        JsonArray rootArray = arrayBuilder.build();\n\n        List<Object> result = yassonJsonb.fromJsonStructure(rootArray, new TestTypeToken<List<Pojo>>(){}.getType());\n        assertTrue(result.get(0) instanceof Pojo);\n        Pojo pojo = (Pojo) result.get(0);\n        assertNotNull(pojo);\n        assertEquals(\"value 1\", pojo.getStringProperty());\n        assertEquals(new BigDecimal(\"1.1\"), pojo.getBigDecimalProperty());\n        assertEquals(Long.valueOf(10), pojo.getLongProperty());\n        assertNotNull(pojo.getStrings());\n        assertEquals(1, pojo.getStrings().size());\n        assertEquals(\"String value 1\", pojo.getStrings().get(0));\n    }\n\n    @Test\n    public void testObjectsNestedInArraysRaw() {\n        JsonObjectBuilder objectBuilder = jsonProvider.createObjectBuilder();\n        objectBuilder.add(\"stringProperty\", \"value 1\");\n        objectBuilder.add(\"bigDecimalProperty\", new BigDecimal(\"1.1\"));\n        objectBuilder.add(\"longProperty\", 10L);\n\n        JsonArrayBuilder innerArrayBuilder = jsonProvider.createArrayBuilder();\n        innerArrayBuilder.add(\"String value 1\");\n\n        objectBuilder.add(\"strings\", innerArrayBuilder.build());\n\n        JsonArrayBuilder arrayBuilder = jsonProvider.createArrayBuilder();\n        arrayBuilder.add(10L);\n        arrayBuilder.add(objectBuilder.build());\n        arrayBuilder.add(\"10\");\n\n        JsonArray rootArray = arrayBuilder.build();\n\n        List<Object> result = yassonJsonb.fromJsonStructure(rootArray, new TestTypeToken<List<Object>>(){}.getType());\n        assertEquals(new BigDecimal(\"10\"), result.get(0));\n        assertTrue(result.get(1) instanceof Map);\n        Map pojo = (Map) result.get(1);\n        assertNotNull(pojo);\n        assertEquals(\"value 1\", pojo.get(\"stringProperty\"));\n        assertEquals(new BigDecimal(\"1.1\"), pojo.get(\"bigDecimalProperty\"));\n        assertEquals(new BigDecimal(10), pojo.get(\"longProperty\"));\n        assertTrue(pojo.get(\"strings\") instanceof List);\n        List strings = (List) pojo.get(\"strings\");\n        assertNotNull(strings);\n        assertEquals(1, strings.size());\n        assertEquals(\"String value 1\", strings.get(0));\n    }\n\n\n    @Test\n    public void testCustomJsonbDeserializer() {\n        JsonObjectBuilder outerBuilder = jsonProvider.createObjectBuilder();\n        JsonObjectBuilder innerBuilder = jsonProvider.createObjectBuilder();\n        innerBuilder.add(\"first\", \"String value 1\");\n        innerBuilder.add(\"second\", \"String value 2\");\n        outerBuilder.add(\"inner\", innerBuilder.build());\n        JsonObject object = outerBuilder.build();\n\n        YassonJsonb jsonb = (YassonJsonb) JsonbBuilder.create(new JsonbConfig().withDeserializers(new InnerPojoDeserializer()));\n        Pojo result = jsonb.fromJsonStructure(object, Pojo.class);\n        assertNotNull(result.getInner());\n        assertEquals(\"String value 1\", result.getInner().getInnerFirst());\n        assertEquals(\"String value 2\", result.getInner().getInnerSecond());\n    }\n    \n    @Test\n    public void testGetValue() {\n        final String json = \n        \"\"\"\n        {\n            \"type\": \"Location\",\n            \"reference\": \"dummy reference\"\n        }\n        \"\"\";\n        \n        Jsonb jsonb = JsonbBuilder.create();\n        Issue673.LocationInterface result = jsonb.fromJson(json, Issue673.LocationInterface.class);\n            \n        assertNotNull(result);\n        assertTrue(result instanceof Issue673.Location);\n        Issue673.Location location = (Issue673.Location) result;\n\n        Issue673.Referenceable refAble = location.getReference();\n        assertNotNull(refAble);\n        assertFalse(refAble instanceof Issue673.Reference);\n        assertTrue(refAble instanceof Issue673.IRIReference);\n        Issue673.IRIReference ref = (Issue673.IRIReference) refAble;\n\n        assertEquals(\"dummy reference\", ref.getValue());\n    }\n    \n    @Test\n    public void testGetArray() {\n        final String json = \n        \"\"\"\n        {\n            \"type\": \"Location\",\n            \"tags\": [\"test1\", \"test2\"]\n        }\n        \"\"\";\n        \n        Jsonb jsonb = JsonbBuilder.create();\n        Issue673.LocationInterface result = jsonb.fromJson(json, Issue673.LocationInterface.class);\n        \n        assertNotNull(result);\n        assertTrue(result instanceof Issue673.Location);\n        Issue673.Location location = (Issue673.Location) result;\n        \n        String tags = location.getTags();\n        assertNotNull(tags);\n\n        assertEquals(\"test1, test2\", tags);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/jsonstructure/Pojo.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.jsonstructure;\n\nimport java.math.BigDecimal;\nimport java.util.List;\n\npublic final class Pojo {\n\n    private String stringProperty;\n    private InnerPojo inner;\n    private BigDecimal bigDecimalProperty;\n    private Long longProperty;\n\n    private List<String> strings;\n    private List<BigDecimal> bigDecimals;\n    private List<Boolean> booleans;\n\n    public String getStringProperty() {\n        return stringProperty;\n    }\n\n    public void setStringProperty(String stringProperty) {\n        this.stringProperty = stringProperty;\n    }\n\n    public BigDecimal getBigDecimalProperty() {\n        return bigDecimalProperty;\n    }\n\n    public void setBigDecimalProperty(BigDecimal bigDecimalProperty) {\n        this.bigDecimalProperty = bigDecimalProperty;\n    }\n\n    public InnerPojo getInner() {\n        return inner;\n    }\n\n    public void setInner(InnerPojo inner) {\n        this.inner = inner;\n    }\n\n    public Long getLongProperty() {\n        return longProperty;\n    }\n\n    public void setLongProperty(Long longProperty) {\n        this.longProperty = longProperty;\n    }\n\n    public List<String> getStrings() {\n        return strings;\n    }\n\n    public void setStrings(List<String> strings) {\n        this.strings = strings;\n    }\n\n    public List<BigDecimal> getBigDecimals() {\n        return bigDecimals;\n    }\n\n    public void setBigDecimals(List<BigDecimal> bigDecimals) {\n        this.bigDecimals = bigDecimals;\n    }\n\n    public List<Boolean> getBooleans() {\n        return booleans;\n    }\n\n    public void setBooleans(List<Boolean> booleans) {\n        this.booleans = booleans;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/logger/JsonbLoggerFormatter.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.logger;\n\nimport java.util.logging.LogRecord;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class JsonbLoggerFormatter extends java.util.logging.Formatter {\n    @Override\n    public String format(LogRecord record) {\n        return String.format(\"%-8s\",record.getLevel()) + \" =>  \" + record.getMessage()+\"\\n\";\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/records/Car.java",
    "content": "/*\n * Copyright (c) 2021, 2024 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.records;\n\nimport jakarta.json.bind.annotation.JsonbProperty;\n\npublic record Car(@JsonbProperty(\"typeChanged\") String type, @JsonbProperty(\"colorChanged\") String color) {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/records/CarWithCreateNamingStrategyTest.java",
    "content": "/*\n * Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\npackage org.eclipse.yasson.records;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.config.PropertyNamingStrategy;\nimport org.junit.jupiter.api.Test;\n\nimport static java.util.Objects.requireNonNull;\nimport static org.junit.jupiter.api.Assertions.assertEquals;\n\npublic class CarWithCreateNamingStrategyTest {\n\n    // camel case is intentional for this test case\n    public record Car(String brandName, String colorName) {\n\n        @JsonbCreator\n        public Car {\n            requireNonNull(brandName, \"brandName\");\n            requireNonNull(colorName, \"colorName\");\n        }\n    }\n\n    @Test\n    public void testRecordJsonbCreatorWithNamingStrategy() {\n        // given\n        final JsonbConfig config = new JsonbConfig()\n                .withPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CASE_WITH_UNDERSCORES);\n        final Jsonb jsonb = JsonbBuilder.create(config);\n\n        var json = \"\"\"\n                {\n                  \"brand_name\": \"Volkswagen\",\n                  \"color_name\": \"Piano black\"\n                }\n                \"\"\";\n\n        // when\n        final Car car = jsonb.fromJson(json, Car.class);\n\n        // then\n        assertEquals(\"Volkswagen\", car.brandName());\n        assertEquals(\"Piano black\", car.colorName());\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/records/CarWithCreator.java",
    "content": "/*\n * Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.records;\n\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbProperty;\n\npublic record CarWithCreator(String type, String color) {\n\n    @JsonbCreator\n    public static CarWithCreator create(@JsonbProperty(\"type\") String type, @JsonbProperty(\"color\") String color) {\n        return new CarWithCreator(type, color);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/records/CarWithDefaultConstructor.java",
    "content": "/*\n * Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.records;\n\npublic record CarWithDefaultConstructor(String type, String color) {\n\n    public CarWithDefaultConstructor() {\n        this(\"some\", \"other\");\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/records/CarWithExtraMethod.java",
    "content": "/*\n * Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.records;\n\npublic record CarWithExtraMethod(String type, String color) {\n\n    public String type() {\n        return type;\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/records/CarWithGenerics.java",
    "content": "/*\n * Copyright (c) 2025 IBM and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.records;\n\npublic record CarWithGenerics<T> (String type, T color)  {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/records/CarWithMultipleConstructors.java",
    "content": "/*\n * Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.records;\n\npublic record CarWithMultipleConstructors(String type, String color) {\n\n    public CarWithMultipleConstructors(String type) {\n        this(type, \"red\");\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/records/CarWithMultipleConstructorsAndCreator.java",
    "content": "/*\n * Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.records;\n\nimport jakarta.json.bind.annotation.JsonbCreator;\nimport jakarta.json.bind.annotation.JsonbProperty;\n\npublic record CarWithMultipleConstructorsAndCreator(String type, String color) {\n\n    @JsonbCreator\n    public CarWithMultipleConstructorsAndCreator(@JsonbProperty(\"type\") String type) {\n        this(type, \"red\");\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/records/CarWithoutAnnotations.java",
    "content": "/*\n * Copyright (c) 2021, 2024 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.records;\n\npublic record CarWithoutAnnotations(String type, String color) {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/records/Color.java",
    "content": "/*\n * Copyright (c) 2025 IBM and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.records;\n    \npublic record Color(String name, String code) {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/records/RecordTest.java",
    "content": "/*\n * Copyright (c) 2021, 2025 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.records;\n\nimport jakarta.json.bind.JsonbException;\n\nimport org.eclipse.yasson.Jsonbs;\nimport org.eclipse.yasson.TestTypeToken;\nimport org.eclipse.yasson.internal.properties.MessageKeys;\nimport org.eclipse.yasson.internal.properties.Messages;\nimport org.junit.jupiter.api.Test;\n\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.is;\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.assertThrows;\n\npublic class RecordTest {\n\n    @Test\n    public void testRecordProcessing() {\n        Car car = new Car(\"skoda\", \"green\");\n        String expected = \"{\\\"colorChanged\\\":\\\"green\\\",\\\"typeChanged\\\":\\\"skoda\\\"}\";\n\n        String json = Jsonbs.defaultJsonb.toJson(car);\n        assertEquals(expected, json);\n        Car deserialized = Jsonbs.defaultJsonb.fromJson(expected, Car.class);\n        assertEquals(car, deserialized);\n    }\n\n    @Test\n    public void testRecordProcessingWithoutJsonbProperties() {\n        CarWithoutAnnotations car = new CarWithoutAnnotations(\"skoda\", \"green\");\n        String expected = \"{\\\"color\\\":\\\"green\\\",\\\"type\\\":\\\"skoda\\\"}\";\n\n        String json = Jsonbs.defaultJsonb.toJson(car);\n        assertEquals(expected, json);\n        CarWithoutAnnotations deserialized = Jsonbs.defaultJsonb.fromJson(expected, CarWithoutAnnotations.class);\n        assertEquals(car, deserialized);\n    }\n\n    @Test\n    public void testRecordProcessingWithExtraMethod() {\n        CarWithExtraMethod car = new CarWithExtraMethod(\"skoda\", \"green\");\n        String expected = \"{\\\"color\\\":\\\"green\\\",\\\"type\\\":\\\"skoda\\\"}\";\n\n        String json = Jsonbs.defaultJsonb.toJson(car);\n        assertThat(json, is(expected));\n        CarWithExtraMethod deserialized = Jsonbs.defaultJsonb.fromJson(expected, CarWithExtraMethod.class);\n        assertThat(deserialized, is(car));\n    }\n\n    @Test\n    public void testRecordMultipleConstructors() {\n        CarWithMultipleConstructors car = new CarWithMultipleConstructors(\"skoda\");\n        String expected = \"{\\\"color\\\":\\\"red\\\",\\\"type\\\":\\\"skoda\\\"}\";\n\n        String json = Jsonbs.defaultJsonb.toJson(car);\n        assertThat(json, is(expected));\n        JsonbException jsonbException = assertThrows(JsonbException.class,\n                                                     () -> Jsonbs.defaultJsonb.fromJson(expected,\n                                                                                        CarWithMultipleConstructors.class));\n        String expectedMessage = Messages.getMessage(MessageKeys.RECORD_MULTIPLE_CONSTRUCTORS, CarWithMultipleConstructors.class);\n        assertThat(jsonbException.getMessage(), is(expectedMessage));\n    }\n\n    @Test\n    public void testRecordMultipleConstructorsWithJsonbCreator() {\n        CarWithMultipleConstructorsAndCreator car = new CarWithMultipleConstructorsAndCreator(\"skoda\");\n        String expected = \"{\\\"color\\\":\\\"red\\\",\\\"type\\\":\\\"skoda\\\"}\";\n\n        String json = Jsonbs.defaultJsonb.toJson(car);\n        assertThat(json, is(expected));\n        CarWithMultipleConstructorsAndCreator deserialized =  Jsonbs.defaultJsonb\n                .fromJson(expected, CarWithMultipleConstructorsAndCreator.class);\n        assertThat(car, is(deserialized));\n    }\n\n    @Test\n    public void testRecordJsonbCreator() {\n        CarWithCreator car = new CarWithCreator(\"skoda\", \"red\");\n        String expected = \"{\\\"color\\\":\\\"red\\\",\\\"type\\\":\\\"skoda\\\"}\";\n\n        String json = Jsonbs.defaultJsonb.toJson(car);\n        assertThat(json, is(expected));\n        CarWithCreator deserialized = Jsonbs.defaultJsonb.fromJson(expected, CarWithCreator.class);\n        assertThat(deserialized, is(car));\n    }\n\n    @Test\n    public void testRecordWithDefaultConstructor() {\n        CarWithDefaultConstructor car = new CarWithDefaultConstructor(\"skoda\", \"red\");\n        String expected = \"{\\\"color\\\":\\\"red\\\",\\\"type\\\":\\\"skoda\\\"}\";\n\n        String json = Jsonbs.defaultJsonb.toJson(car);\n        assertThat(json, is(expected));\n        assertThrows(JsonbException.class, () -> Jsonbs.defaultJsonb.fromJson(expected, CarWithDefaultConstructor.class));\n    }\n\n    @Test\n    public void testRecordWithGenerics() {\n        CarWithGenerics<Color> car = new CarWithGenerics<>(\"skoda\", new Color(\"green\", \"#00FF00\"));\n        String expected = \"{\\\"color\\\":{\\\"code\\\":\\\"#00FF00\\\",\\\"name\\\":\\\"green\\\"},\\\"type\\\":\\\"skoda\\\"}\";\n\n        String json = Jsonbs.defaultJsonb.toJson(car);\n        assertThat(json, is(expected));\n        \n        CarWithGenerics<Color> deserialized = Jsonbs.defaultJsonb\n                .fromJson(expected, new TestTypeToken<CarWithGenerics<Color>>() {}.getType());\n        assertThat(deserialized, is(car));  \n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/MapToEntriesArraySerializerTest.java",
    "content": "/*\n * Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers;\n\nimport org.junit.jupiter.api.*;\nimport static org.hamcrest.CoreMatchers.instanceOf;\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport java.io.StringReader;\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.math.BigDecimal;\nimport java.time.LocalDate;\nimport java.time.format.DateTimeFormatter;\nimport java.time.format.FormatStyle;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.Locale;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.Set;\n\nimport jakarta.json.Json;\nimport jakarta.json.JsonArray;\nimport jakarta.json.JsonObject;\nimport jakarta.json.JsonValue;\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.serializers.model.Pokemon;\nimport org.eclipse.yasson.serializers.model.Trainer;\n\n/**\n * Test various use-cases with {@code Map} serializer and de-serializer which\n * stores Map.Entries as JSON objects in 1:1 relation.\n */\npublic class MapToEntriesArraySerializerTest {\n\n    /**\n     * Comparator that allows to compare at least some similar Number instances.\n     * Does not work for everything, but it's sufficient for used test cases.\n     */\n    private static final class NumberComparator implements Comparator<Number> {\n\n        @Override\n        public int compare(Number n1, Number n2) {\n            if (n1 != null && n2 != null) {\n                if (((n1 instanceof Float) || (n1 instanceof Double))\n                    && ((n2 instanceof Float) || (n2 instanceof Double))) {\n                    return Double.compare(n1.doubleValue(), n2.doubleValue());\n                }\n                return Long.compare(n1.longValue(), n2.longValue());\n            }\n            if (n1 == null) {\n                return n2 == null ? 0 : -1;\n            } else {\n                return 1;\n            }\n        }\n    }\n\n    /** NumberComparator instance to be used. */\n    private static final Comparator<Number> CMP_NUM = new NumberComparator();\n\n    // Verification code for serialization: Covers only use-cases used in jUnit tests.\n    // * Key JsonObject is always mapped to Trainer PoJo.\n    // * Value JsonObject is always mapped to Pokemon Pojo.\n\n    /**\n     * Verify that source Map value and parsed Map entry JsonObject value are equals.\n     *\n     * @param jentry parsed Map entry as JsonObject\n     * @param source source Map for value verification\n     * @param key Map key used to retrieve value\n     */\n    private static final <K,V> void verifyMapValues(JsonObject jentry, Map<K,V> source, K key) {\n        assertNotNull(jentry);\n        assertNotNull(source);\n        assertNotNull(key);\n        V sourceValue = source.get(key);\n        assertNotNull(sourceValue);\n        switch (jentry.getValue(\"/value\").getValueType()) {\n            // Value contains JSON object: it shall be Pokemon PoJo\n            case OBJECT:\n                JsonObject valueObject = jentry.getJsonObject(\"value\");\n                Pokemon sourcePoJo = (Pokemon) source.get(key);\n                Pokemon valuePojo = new Pokemon(\n                        valueObject.getString(\"name\"), valueObject.getString(\"type\"), valueObject.getInt(\"cp\"));\n                assertEquals(sourcePoJo, valuePojo);\n                break;\n            case STRING:\n                String valueString = jentry.getString(\"value\");\n                String sourceString = (String) source.get(key);\n                assertEquals(sourceString, valueString);\n                break;\n            case NUMBER:\n                Number valueNumber = jentry.getJsonNumber(\"value\").numberValue();\n                Number sourceNumber = (Number) source.get(key);\n                // Number comparator shall be used here because values may not be of the same type.\n                assertEquals(0, CMP_NUM.compare(sourceNumber, valueNumber));\n                break;\n            case TRUE:\n            case FALSE:\n                Boolean valueBool = jentry.getBoolean(\"value\");\n                Boolean sourceBool = (Boolean) source.get(key);\n                assertEquals(sourceBool, valueBool);\n                break;\n            default:\n                throw new IllegalStateException(jentry.getValue(\"/value\").getValueType() + \"was not expected\");\n        }\n    }\n\n    /**\n     * Verify that source Map value and parsed Map entry JsonObject value are equals.\n     *\n     * @param jentry parsed Map entry as JsonObject\n     * @param sourceEntry source Map entry for value verification\n     */\n    private static final <K,V> void verifyMapValues(JsonObject jentry, Map.Entry<K[],V> sourceEntry) {\n        assertNotNull(jentry);\n        assertNotNull(sourceEntry);\n        switch (jentry.getValue(\"/value\").getValueType()) {\n            // Value contains JSON object: it shall be Pokemon PoJo\n            case OBJECT:\n                JsonObject valueObject = jentry.getJsonObject(\"value\");\n                Pokemon sourcePoJo = (Pokemon) sourceEntry.getValue();\n                Pokemon valuePojo = new Pokemon(\n                        valueObject.getString(\"name\"), valueObject.getString(\"type\"), valueObject.getInt(\"cp\"));\n                assertEquals(sourcePoJo, valuePojo);\n                break;\n            case ARRAY:\n                JsonArray valueArray = jentry.getJsonArray(\"value\");\n                assertTrue(valueArray.size() > 0);\n                verifyMapArrayValue(jentry, valueArray, sourceEntry);\n                break;\n            case STRING:\n                String valueString = jentry.getString(\"value\");\n                String sourceString = (String) sourceEntry.getValue();\n                assertEquals(sourceString, valueString);\n                break;\n            case NUMBER:\n                Number valueNumber = jentry.getJsonNumber(\"value\").numberValue();\n                Number sourceNumber = (Number) sourceEntry.getValue();\n                // Number comparator shall be used here because values may not be of the same type.\n                assertEquals(0, CMP_NUM.compare(sourceNumber, valueNumber));\n                break;\n            case TRUE:\n            case FALSE:\n                Boolean valueBool = jentry.getBoolean(\"value\");\n                Boolean sourceBool = (Boolean) sourceEntry.getValue();\n                assertEquals(sourceBool, valueBool);\n                break;\n            default:\n                throw new IllegalStateException(jentry.getValue(\"/value\").getValueType() + \"was not expected\");\n        }\n    }\n\n    /**\n     * Retrieve Map.Entry with matching array key from source Map.\n     *\n     * @param source source Map\n     * @param key array key to search for\n     * @param cmp optional comparator to use for search\n     * @param keys source map key Set used to check whether all keys were processed. Key will be removed from set on successful match\n     * @return Map.Entry matching provided key\n     */\n    private static final <K,V> Map.Entry<K[], V> getMapEntryForArrayKey(Map<K[], V> source, K[] key, Comparator<K> cmp, Set<K> keys) {\n        for (Map.Entry<K[], V> entry : source.entrySet()) {\n            K[] sourceKey = entry.getKey();\n            boolean match = key.length == sourceKey.length;\n            if (match) {\n                for (int i = 0; i < key.length && match; i++) {\n                    if (cmp != null) {\n                        match = (cmp.compare(key[i], sourceKey[i]) == 0);\n                    } else {\n                        match = key[i].equals(sourceKey[i]);\n                    }\n                }\n                // Matching key is removed from Set for key processing check\n                if (match) {\n                    keys.remove(entry.getKey());\n                    return entry;\n                }\n            }\n        }\n        return null;\n    }\n\n    /**\n     * Verify that source Map array value and parsed map array value are the same.\n     *\n     * @param value parsed value\n     * @param sourceValue source Map value\n     * @param cmp optional comparator to use for verification\n     */\n    private static final <V> void verifyMapArrayValues(V[] value, V[] sourceValue, Comparator<V> cmp) {\n        assertEquals(sourceValue.length, value.length);\n        for (int i = 0; i < sourceValue.length; i++) {\n            if (cmp != null) {\n                assertTrue(cmp.compare(sourceValue[i], value[i]) == 0);\n            } else {\n                assertEquals(sourceValue[i], value[i]);\n            }\n        }\n    }\n\n    /**\n     * Build Map key as an array. Get corresponding key from source Map.\n     *\n     * @param jentry Map key parsed as JsonArray\n     * @param sourceEntry source Map\n     */\n    @SuppressWarnings(\"unchecked\")\n    private static final <K,V> void verifyMapArrayValue(JsonObject jentry, final JsonArray valueArray, Map.Entry<K[],V> sourceEntry) {\n        int size = valueArray.size();\n        // All array elements in the tests are of the same type.\n        switch (valueArray.get(0).getValueType()) {\n            case OBJECT:\n                V[] keyPoJo = (V[]) new Pokemon[size];\n                for (int i = 0; i < size; i++) {\n                    JsonObject keyItem = valueArray.getJsonObject(i);\n                    keyPoJo[i] = (V) new Pokemon(keyItem.getString(\"name\"), keyItem.getString(\"type\"), keyItem.getInt(\"cp\"));\n                }\n                verifyMapArrayValues(keyPoJo, (V[]) sourceEntry.getValue(), null);\n                break;\n            case STRING:\n                V[] keyString = (V[]) new String[size];\n                for (int i = 0; i < size; i++) {\n                    keyString[i] = (V) valueArray.getString(i);\n                }\n                verifyMapArrayValues(keyString, (V[]) sourceEntry.getValue(), null);\n                break;\n            case NUMBER:\n                V[] keyNumber = (V[]) new Number[size];\n                for (int i = 0; i < size; i++) {\n                    keyNumber[i] = (V) valueArray.getJsonNumber(i).numberValue();\n                }\n                verifyMapArrayValues(keyNumber, (V[]) sourceEntry.getValue(), (Comparator<V>) CMP_NUM);\n                break;\n            case TRUE:\n            case FALSE:\n                V[] keyBool = (V[]) new Boolean[size];\n                for (int i = 0; i < size; i++) {\n                    keyBool[i] = (V) Boolean.valueOf(valueArray.getBoolean(i));\n                }\n                verifyMapArrayValues(keyBool, (V[]) sourceEntry.getValue(), null);\n                break;\n            default:\n                throw new IllegalStateException(valueArray.getValueType() + \"was not expected\");\n        }\n    }\n\n    /**\n     * Build Map key as an array. Get corresponding key from source Map.\n     *\n     * @param keyArray Map key parsed as JsonArray\n     * @param source source Map\n     */\n    @SuppressWarnings(\"unchecked\")\n    private static final <K,V> void verifyMapArrayKey(JsonObject jentry, final JsonArray keyArray, Map<K,V> source, Set<K> keys) {\n        int size = keyArray.size();\n        // All array elements in the tests are of the same type.\n        switch (keyArray.get(0).getValueType()) {\n            case OBJECT:\n                K[] keyPoJo = (K[]) new Trainer[size];\n                for (int i = 0; i < size; i++) {\n                    JsonObject keyItem = keyArray.getJsonObject(i);\n                    keyPoJo[i] = (K) new Trainer(keyItem.getString(\"name\"), keyItem.getInt(\"age\"));\n                }\n                Map.Entry<K[],V> entryObject = getMapEntryForArrayKey((Map<K[],V>) source, keyPoJo, null, keys);\n                verifyMapValues(jentry, entryObject);\n                break;\n            case STRING:\n                K[] keyString = (K[]) new String[size];\n                for (int i = 0; i < size; i++) {\n                    keyString[i] = (K) keyArray.getString(i);\n                }\n                Map.Entry<K[],V> entryString = getMapEntryForArrayKey((Map<K[],V>) source, keyString, null, keys);\n                verifyMapValues(jentry, entryString);\n                break;\n            case NUMBER:\n                K[] keyNumber = (K[]) new Number[size];\n                for (int i = 0; i < size; i++) {\n                    keyNumber[i] = (K) keyArray.getJsonNumber(i).numberValue();\n                }\n                Map.Entry<K[],V> entryNumber = getMapEntryForArrayKey((Map<K[],V>) source, keyNumber, (Comparator<K>) CMP_NUM, keys);\n                verifyMapValues(jentry, entryNumber);\n                break;\n            case TRUE:\n            case FALSE:\n                K[] keyBool = (K[]) new Boolean[size];\n                for (int i = 0; i < size; i++) {\n                    keyBool[i] = (K) Boolean.valueOf(keyArray.getBoolean(i));\n                }\n                Map.Entry<K[],V> entryBool = getMapEntryForArrayKey((Map<K[],V>) source, keyBool, null, keys);\n                verifyMapValues(jentry, entryBool);\n                break;\n            default:\n                throw new IllegalStateException(keyArray.getValueType() + \"was not expected\");\n        }\n    }\n\n    /**\n     * Verify that serialized Map provided as JsonArray matches source Map.\n     *\n     * @param source source Map\n     * @param array  serialized Map parsed and provided as JsonArray\n     */\n    @SuppressWarnings(\"unchecked\")\n    private static final <K,V> void verifySerialization(Map<K, V> source, JsonArray array) {\n        assertEquals(source.size(), array.size());\n        Set<K> keys = source.keySet();\n        array.forEach(entry -> {\n            JsonObject jentry = entry.asJsonObject();\n            //JsonValue key = jentry.getValue(\"/key\");\n            switch (jentry.getValue(\"/key\").getValueType()) {\n                // Key contains JSON object: it shall be Trainer PoJo\n                case OBJECT: {\n                    JsonObject keyValue = jentry.getJsonObject(\"key\");\n                    Trainer keyPoJo = new Trainer(keyValue.getString(\"name\"), keyValue.getInt(\"age\"));\n                    verifyMapValues(jentry, source, (K) keyPoJo);\n                    keys.remove((K) keyPoJo);\n                }\n                    break;\n                case ARRAY: {\n                    JsonArray keyArray = jentry.getJsonArray(\"key\");\n                    assertTrue(keyArray.size() > 0);\n                    verifyMapArrayKey(jentry, keyArray, source, keys);\n                }\n                    break;\n                case STRING: {\n                    String keyValue = jentry.getString(\"key\");\n                    verifyMapValues(jentry, source, (K) keyValue);\n                    keys.remove((K) keyValue);\n                }\n                    break;\n                case NUMBER: {\n                    Number keyValue = jentry.getJsonNumber(\"key\").numberValue();\n                    verifyMapValues(jentry, source, (K) keyValue);\n                    keys.remove((K) keyValue);\n                }\n                    break;\n                case TRUE:\n                case FALSE: {\n                    Boolean keyValue = jentry.getBoolean(\"key\");\n                    verifyMapValues(jentry, source, (K) keyValue);\n                    keys.remove((K) keyValue);\n                }\n                    break;\n                default:\n                    throw new IllegalStateException(jentry.getValue(\"/value\").getValueType() + \"was not expected\");\n            }\n        });\n        // Verify that all keys were processed.\n        assertTrue(keys.isEmpty());\n    }\n\n//No longer valid test\n//    /**\n//     * Test serialization of Map with Number keys and String values.\n//     */\n//    @Test\n//    public void testSerializeNumberStringMapToEntriesArray() {\n//        Map<Number, String> map = new TreeMap<>(CMP_NUM);\n//        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withFormatting(true));\n//        map.put(Integer.valueOf(12), \"twelve\");\n//        map.put(Short.valueOf((short)48), \"forty eight\");\n//        map.put(Long.valueOf(256), \"two hundred fifty-six\");\n//        String json = jsonb.toJson(map);\n//        JsonArray jarr = Json.createReader(new StringReader(json)).read().asJsonArray();\n//        verifySerialization(map, jarr);\n//    }\n\n    /**\n     * Test serialization of Map with PoJo keys and PoJo values.\n     */\n    @Test\n    public void testSerializePoJoPoJoMapToEntriesArray() {\n        Map<Trainer, Pokemon> map = new HashMap<>();\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withFormatting(true));\n        map.put(new Trainer(\"John Smith\", 35), new Pokemon(\"Charmander\", \"fire\", 980));\n        map.put(new Trainer(\"Tom Jones\", 24), new Pokemon(\"Caterpie\", \"bug\", 437));\n        map.put(new Trainer(\"Peter Wright\", 27), new Pokemon(\"Houndour\", \"dark\", 1234));\n        map.put(new Trainer(\"Bob Parker\", 19), new Pokemon(\"Sneasel\", \"ice\", 2051));\n        String json = jsonb.toJson(map);\n        JsonArray jarr = Json.createReader(new StringReader(json)).read().asJsonArray();\n        verifySerialization(map, jarr);\n    }\n\n    /**\n     * Test serialization of Map with mixed simple keys and mixed simple values.\n     */\n    @Test\n    public void testSerializeSimpleSimpleMapToEntriesArray() {\n        String expected = \"{\\\"false\\\":true,\\\"10\\\":24,\\\"Name\\\":\\\"John Smith\\\"}\";\n        Map<Object, Object> map = new HashMap<>();\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig());\n        map.put(\"Name\", \"John Smith\");\n        map.put(Integer.valueOf(10), Long.valueOf(24l));\n        map.put(Boolean.FALSE, Boolean.TRUE);\n        String json = jsonb.toJson(map);\n        assertEquals(expected, json);\n    }\n\n    /**\n     * Test serialization of Map with arrays of simple values.\n     */\n    @Test\n    public void testSerializeSimpleArraySimpleArrayMapToEntriesArray() {\n        Map<Object, Object> map = new HashMap<>();\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withFormatting(true));\n        map.put(new String[] {\"John\", \"Smith\"}, new String[] {\"first name\", \"second name\"});\n        map.put(new String[] {\"Pikachu\", \"electric\"}, new String[] {\"pokemon name\", \"pokemon type\"});\n        map.put(\n                new Trainer[] {new Trainer(\"Bob\", 15), new Trainer(\"Ash\", 12)},\n                new Pokemon[] {new Pokemon(\"Charmander\", \"fire\", 1245), new Pokemon(\"Kyogre\", \"water\", 3056)});\n        String json = jsonb.toJson(map);\n        JsonArray jarr = Json.createReader(new StringReader(json)).read().asJsonArray();\n        verifySerialization(map, jarr);\n    }\n\n    /**\n     * Test de-serialization of Map<?, ?> with various simple values as keys and\n     * values. Map is stored as an JsonArray of map entries represented as\n     * JsonObjects.\n     */\n    @Test\n    public void testDeSerializePrimitivesMapToEntriesArray() {\n        String jsonString = \"[\" +\n            \"    {\" +\n            \"        \\\"key\\\": \\\"first\\\",\" +\n            \"        \\\"value\\\": \\\"Peter Parker\\\"\"  +\n            \"    },\" +\n            \"    {\" +\n            \"        \\\"key\\\": 42,\" +\n            \"        \\\"value\\\": true\" +\n            \"    },\" +\n            \"    {\" +\n            \"        \\\"key\\\": false,\" +\n            \"        \\\"value\\\": 21\" +\n            \"    }\" +\n            \"]\";\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig());\n        Map<?, ?> map = jsonb.fromJson(jsonString, Map.class);\n        assertEquals(3, map.size());\n        // Make sure that all 3 pokemons were checked.\n        int valueCheck = 0x00;\n        for (Map.Entry<?, ?> entry : map.entrySet()) {\n            if ((entry.getKey() instanceof String) && \"first\".equals(entry.getKey())) {\n                assertEquals(\"Peter Parker\", entry.getValue());\n                valueCheck |= 0x01;\n            }\n            if ((entry.getKey() instanceof Number) && entry.getKey().equals(new BigDecimal(42))) {\n                assertEquals(true, entry.getValue());\n                valueCheck |= 0x02;\n            }\n            if ((entry.getKey() instanceof Boolean) && entry.getKey().equals(false)) {\n                assertEquals(new BigDecimal(21), entry.getValue());\n                valueCheck |= 0x04;\n            }\n        }\n        if ((valueCheck & 0x01) == 0) {\n            fail(\"Did not find key \\\"first\\\" in the Map\");\n        }\n        if ((valueCheck & 0x02) == 0) {\n            fail(\"Did not find key 42 in the Map\");\n        }\n        if ((valueCheck & 0x04) == 0) {\n            fail(\"Did not find key false in the Map\");\n        }\n    }\n\n    /**\n     * Test de-serialization of Map<String, Pokemon> with various classes instances\n     * as keys. Map is stored as an JsonArray of map entries represented as\n     * JsonObjects.\n     */\n    @Test\n    public void testDeSerializeStringPoJoMapToEntriesArray() {\n        String jsonString = \"[\" +\n            \"    {\" +\n            \"        \\\"key\\\": \\\"Pikachu\\\",\" +\n            \"        \\\"value\\\": {\" +\n            \"            \\\"name\\\": \\\"Pikachu\\\",\" +\n            \"            \\\"type\\\": \\\"electric\\\",\" +\n            \"            \\\"cp\\\": 456\" + \"         }\" +\n            \"    },\" +\n            \"    {\" +\n            \"        \\\"key\\\": \\\"Squirtle\\\",\" +\n            \"        \\\"value\\\": {\" +\n            \"            \\\"name\\\": \\\"Squirtle\\\",\" +\n            \"            \\\"type\\\": \\\"water\\\",\" +\n            \"            \\\"cp\\\": 124\" +\n            \"         }\" +\n            \"    },\" +\n            \"    {\" +\n            \"        \\\"key\\\": \\\"Rayquaza\\\",\" +\n            \"        \\\"value\\\": {\" +\n            \"            \\\"name\\\": \\\"Rayquaza\\\",\" +\n            \"            \\\"type\\\": \\\"dragon\\\",\" +\n            \"            \\\"cp\\\": 3273\" +\n            \"        }\" +\n            \"    }\" +\n            \"]\";\n        ParameterizedType pt = new ParameterizedType() {\n            @Override\n            public Type[] getActualTypeArguments() {\n                return new Type[] { String.class, Pokemon.class };\n            }\n\n            @Override\n            public Type getRawType() {\n                return Map.class;\n            }\n\n            @Override\n            public Type getOwnerType() {\n                return null;\n            }\n        };\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig());\n        Map<String, Pokemon> map = jsonb.fromJson(jsonString, pt);\n        assertEquals(3, map.size());\n        // Make sure that all 3 pokemons were checked.\n        int valueCheck = 0x00;\n        for (Map.Entry<String, Pokemon> entry : map.entrySet()) {\n            Pokemon pokemon = entry.getValue();\n            if (\"Pikachu\".equals(entry.getKey())) {\n                assertEquals(\"Pikachu\", pokemon.name);\n                assertEquals(\"electric\", pokemon.type);\n                assertEquals(456, pokemon.cp);\n                valueCheck |= 0x01;\n            }\n            if (\"Squirtle\".equals(entry.getKey())) {\n                assertEquals(\"Squirtle\", pokemon.name);\n                assertEquals(\"water\", pokemon.type);\n                assertEquals(124, pokemon.cp);\n                valueCheck |= 0x02;\n            }\n            if (\"Rayquaza\".equals(entry.getKey())) {\n                assertEquals(\"Rayquaza\", pokemon.name);\n                assertEquals(\"dragon\", pokemon.type);\n                assertEquals(3273, pokemon.cp);\n                valueCheck |= 0x04;\n            }\n        }\n        if ((valueCheck & 0x01) == 0) {\n            fail(\"Did not find key \\\"Pikachu\\\" in the Map\");\n        }\n        if ((valueCheck & 0x02) == 0) {\n            fail(\"Did not find key \\\"Squirtle\\\" in the Map\");\n        }\n        if ((valueCheck & 0x04) == 0) {\n            fail(\"Did not find key \\\"Rayquaza\\\" in the Map\");\n        }\n    }\n\n    /**\n     * Test de-serialization of Map<Trainer, Pokemon> with various classes instances\n     * as keys. Map is stored as an JsonArray of map entries represented as\n     * JsonObjects.\n     */\n    @Test\n    public void testDeSerializePoJoPoJoMapToEntriesArray() {\n        String jsonString = \"[\" +\n            \"    {\" +\n            \"        \\\"key\\\": {\" +\n            \"            \\\"name\\\": \\\"Bob\\\",\" +\n            \"            \\\"age\\\": 12\" + \"        },\" +\n            \"        \\\"value\\\": {\" +\n            \"            \\\"name\\\": \\\"Pikachu\\\",\" +\n            \"            \\\"type\\\": \\\"electric\\\",\" +\n            \"            \\\"cp\\\": 456\" + \"         }\" +\n            \"    },\" +\n            \"    {\" +\n            \"        \\\"key\\\": {\" +\n            \"            \\\"name\\\": \\\"Ash\\\",\" +\n            \"            \\\"age\\\": 10\" +\n            \"        },\" +\n            \"        \\\"value\\\": {\" +\n            \"            \\\"name\\\": \\\"Squirtle\\\",\" +\n            \"            \\\"type\\\": \\\"water\\\",\" +\n            \"            \\\"cp\\\": 124\" +\n            \"         }\" +\n            \"    },\" +\n            \"    {\" +\n            \"        \\\"key\\\": {\" +\n            \"            \\\"name\\\": \\\"Joe\\\",\" +\n            \"            \\\"age\\\": 15\" +\n            \"        },\" +\n            \"        \\\"value\\\": {\" +\n            \"            \\\"name\\\": \\\"Rayquaza\\\",\" +\n            \"            \\\"type\\\": \\\"dragon\\\",\" +\n            \"            \\\"cp\\\": 3273\" +\n            \"        }\" +\n            \"    }\" +\n            \"]\";\n        ParameterizedType pt = new ParameterizedType() {\n            @Override\n            public Type[] getActualTypeArguments() {\n                return new Type[] { Trainer.class, Pokemon.class };\n            }\n\n            @Override\n            public Type getRawType() {\n                return Map.class;\n            }\n\n            @Override\n            public Type getOwnerType() {\n                return null;\n            }\n        };\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig());\n        Map<Trainer, Pokemon> map = jsonb.fromJson(jsonString, pt);\n        assertEquals(3, map.size());\n        // Make sure that all 3 pokemons were checked.\n        int valueCheck = 0x00;\n        for (Map.Entry<Trainer, Pokemon> entry : map.entrySet()) {\n            Trainer trainer = entry.getKey();\n            Pokemon pokemon = entry.getValue();\n            if (\"Bob\".equals(trainer.name)) {\n                assertEquals(12, trainer.age);\n                assertEquals(\"Pikachu\", pokemon.name);\n                assertEquals(\"electric\", pokemon.type);\n                assertEquals(456, pokemon.cp);\n                valueCheck |= 0x01;\n            }\n            if (\"Ash\".equals(trainer.name)) {\n                assertEquals(10, trainer.age);\n                assertEquals(\"Squirtle\", pokemon.name);\n                assertEquals(\"water\", pokemon.type);\n                assertEquals(124, pokemon.cp);\n                valueCheck |= 0x02;\n            }\n            if (\"Joe\".equals(trainer.name)) {\n                assertEquals(15, trainer.age);\n                assertEquals(\"Rayquaza\", pokemon.name);\n                assertEquals(\"dragon\", pokemon.type);\n                assertEquals(3273, pokemon.cp);\n                valueCheck |= 0x04;\n            }\n        }\n        if ((valueCheck & 0x01) == 0) {\n            fail(\"Did not find key \\\"Bob\\\" in the Map\");\n        }\n        if ((valueCheck & 0x02) == 0) {\n            fail(\"Did not find key \\\"Ash\\\" in the Map\");\n        }\n        if ((valueCheck & 0x04) == 0) {\n            fail(\"Did not find key \\\"Joe\\\" in the Map\");\n        }\n    }\n\n    /**\n     * Test de-serialization of Map<Integer[], String[]>.\n     * Map is stored as an JsonArray of map entries represented as JsonObjects.\n     */\n    @Test\n    public void testDeSerializeIntegerArrayStringArrayMapToEntriesArray() {\n        String jsonString = \"[\" +\n            \"    {\" +\n            \"        \\\"key\\\": [1,2],\" +\n            \"        \\\"value\\\": [\" +\n            \"            \\\"Bob\\\",\" +\n            \"            \\\"Tom\\\"\" +\n            \"        ]\" +\n            \"    },\" +\n            \"    {\" +\n            \"        \\\"key\\\": [3,4],\" +\n            \"        \\\"value\\\": [\" +\n            \"            \\\"John\\\",\" +\n            \"            \\\"Greg\\\"\" +\n            \"        ]\" +\n            \"    }\" +\n           \"]\";\n        ParameterizedType pt = new ParameterizedType() {\n            @Override\n            public Type[] getActualTypeArguments() {\n                return new Type[] { Integer[].class, String[].class };\n            }\n\n            @Override\n            public Type getRawType() {\n                return Map.class;\n            }\n\n            @Override\n            public Type getOwnerType() {\n                return null;\n            }\n        };\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig());\n        Map<Integer[], String[]> map = jsonb.fromJson(jsonString, pt);\n        assertEquals(2, map.size());\n        // Make sure that all map entries were checked.\n        int valueCheck = 0x00;\n        for (Map.Entry<Integer[], String[]> entry : map.entrySet()) {\n            Integer[] key = entry.getKey();\n            String[] value = entry.getValue();\n            if (key[0] == 1 && key[1] == 2) {\n                assertEquals(\"Bob\" ,value[0]);\n                assertEquals(\"Tom\" ,value[1]);\n                valueCheck |= 0x01;\n            }\n            if (key[0] == 3 && key[1] == 4) {\n                assertEquals(\"John\" ,value[0]);\n                assertEquals(\"Greg\" ,value[1]);\n                valueCheck |= 0x02;\n            }\n        }\n        if ((valueCheck & 0x01) == 0) {\n            fail(\"Did not find key [1,2] in the Map\");\n        }\n        if ((valueCheck & 0x02) == 0) {\n            fail(\"Did not find key [3,4] in the Map\");\n        }\n    }\n\n    /**\n     * Test de-serialization of Map<Trainer[], Pokemon[]>.\n     * Map is stored as an JsonArray of map entries represented as JsonObjects.\n     */\n    @Test\n    public void testDeSerializePoJoArrayPoJoArrayMapToEntriesArray() {\n        String jsonString = \"[\" +\n                \"    {\" +\n                \"        \\\"key\\\": [\" +\n                \"            {\" +\n                \"                \\\"name\\\": \\\"Ash\\\",\" +\n                \"                \\\"age\\\": 12\" +\n                \"            },{\" +\n                \"                \\\"name\\\": \\\"Joe\\\",\" +\n                \"                \\\"age\\\": 14\" +\n                \"            }\" +\n                \"        ],\" +\n                \"        \\\"value\\\": [\" +\n                \"            {\" +\n                \"                \\\"name\\\": \\\"Rayquaza\\\",\" +\n                \"                \\\"type\\\": \\\"dragon\\\",\" +\n                \"                \\\"cp\\\": 3273\" +\n                \"            },{\" +\n                \"                \\\"name\\\": \\\"Tyranitar\\\",\" +\n                \"                \\\"type\\\": \\\"dark\\\",\" +\n                \"                \\\"cp\\\": 3181\" +\n                \"            }\" +\n                \"        ]\" +\n                \"    },{\" +\n                \"        \\\"key\\\": [\" +\n                \"            {\" +\n                \"                \\\"name\\\": \\\"Bob\\\",\" +\n                \"                \\\"age\\\": 13\" +\n                \"            },{\" +\n                \"                \\\"name\\\": \\\"Maggie\\\",\" +\n                \"                \\\"age\\\": 15\" +\n                \"            }\" +\n                \"        ],\" +\n                \"        \\\"value\\\": [\" +\n                \"            {\" +\n                \"                \\\"name\\\": \\\"Raikou\\\",\" +\n                \"                \\\"type\\\": \\\"electric\\\",\" +\n                \"                \\\"cp\\\": 3095\" +\n                \"            },{\" +\n                \"                \\\"name\\\": \\\"Mamoswine\\\",\" +\n                \"                \\\"type\\\": \\\"ice\\\",\" +\n                \"                \\\"cp\\\": 3055\" +\n                \"            }\" +\n                \"        ]\" +\n                \"    }\" +\n                \"]\";\n        ParameterizedType pt = new ParameterizedType() {\n            @Override\n            public Type[] getActualTypeArguments() {\n                return new Type[] { Trainer[].class, Pokemon[].class };\n            }\n\n            @Override\n            public Type getRawType() {\n                return Map.class;\n            }\n\n            @Override\n            public Type getOwnerType() {\n                return null;\n            }\n        };\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig());\n        Map<Trainer[], Pokemon[]> map = jsonb.fromJson(jsonString, pt);\n        assertEquals(2, map.size());\n        int valueCheck = 0x00;\n        for (Map.Entry<Trainer[], Pokemon[]> entry : map.entrySet()) {\n            Trainer[] key = entry.getKey();\n            Pokemon[] value = entry.getValue();\n            if (key[0].name.equals(\"Ash\") && key[1].name.equals(\"Joe\")) {\n                assertEquals(12, key[0].age);\n                assertEquals(14, key[1].age);\n                assertEquals(\"Rayquaza\", value[0].name);\n                assertEquals(\"dragon\", value[0].type);\n                assertEquals(3273, value[0].cp);\n                assertEquals(\"Tyranitar\", value[1].name);\n                assertEquals(\"dark\", value[1].type);\n                assertEquals(3181, value[1].cp);\n                valueCheck |= 0x01;\n            }\n            if (key[0].name.equals(\"Bob\") && key[1].name.equals(\"Maggie\")) {\n                assertEquals(13, key[0].age);\n                assertEquals(15, key[1].age);\n                assertEquals(\"Raikou\", value[0].name);\n                assertEquals(\"electric\", value[0].type);\n                assertEquals(3095, value[0].cp);\n                assertEquals(\"Mamoswine\", value[1].name);\n                assertEquals(\"ice\", value[1].type);\n                assertEquals(3055, value[1].cp);\n                valueCheck |= 0x02;\n            }\n        }\n        if ((valueCheck & 0x01) == 0) {\n            fail(\"Did not find key with \\\"Ash\\\" and \\\"Joe\\\" in the Map\");\n        }\n        if ((valueCheck & 0x02) == 0) {\n            fail(\"Did not find key with \\\"Bob\\\" and \\\"Maggie\\\" in the Map\");\n        }\n    }\n\n    public static class LocaleSerializer implements JsonbSerializer<Locale> {\n\n        @Override\n        public void serialize(Locale obj, JsonGenerator generator, SerializationContext ctx) {\n            generator.write(obj.toLanguageTag());\n        }\n    }\n\n    public static class LocaleDeserializer implements JsonbDeserializer<Locale> {\n\n        @Override\n        public Locale deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {\n            return Locale.forLanguageTag(parser.getString());\n        }\n    }\n\n    public static class LocalDateSerializer implements JsonbSerializer<LocalDate> {\n\n        private static final DateTimeFormatter SHORT_FORMAT = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT);\n\n        @Override\n        public void serialize(LocalDate obj, JsonGenerator generator, SerializationContext ctx) {\n            generator.write(SHORT_FORMAT.format(obj));\n        }\n    }\n\n    public static class LocalDateDeserializer implements JsonbDeserializer<LocalDate> {\n\n        private static final DateTimeFormatter SHORT_FORMAT = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT);\n\n        @Override\n        public LocalDate deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {\n            return LocalDate.parse(parser.getString(), SHORT_FORMAT);\n        }\n    }\n\n    public static class MapObject<K, V> {\n\n        private Map<K, V> values;\n\n        public MapObject() {\n            this.values = new HashMap<>();\n        }\n\n        public Map<K, V> getValues() {\n            return values;\n        }\n\n        public void setValues(Map<K, V> values) {\n            if (values == null) {\n                throw new IllegalArgumentException(\"values cannot be null\");\n            }\n            this.values = values;\n        }\n\n        @Override\n        public boolean equals(Object o) {\n            if (o instanceof MapObject) {\n                MapObject<?,?> to = (MapObject<?,?>) o;\n                return values.equals(to.values);\n            }\n            return false;\n        }\n\n        @Override\n        public int hashCode() {\n            return Objects.hashCode(this.values);\n        }\n\n        @Override\n        public String toString() {\n            return values.toString();\n        }\n    }\n\n    public static class MapObjectLocaleString extends MapObject<Locale, String> {};\n\n    private void verifyMapObjectLocaleStringSerialization(JsonObject jsonObject, MapObjectLocaleString mapObject) {\n        // Expected serialization is: {\"values\":[{\"key\":\"lang-tag\",\"value\":\"string\"},...]}\n        assertEquals(1, jsonObject.size());\n        assertNotNull(jsonObject.get(\"values\"));\n        assertEquals(JsonValue.ValueType.ARRAY, jsonObject.get(\"values\").getValueType());\n        JsonArray jsonArray = jsonObject.getJsonArray(\"values\");\n        assertEquals(mapObject.getValues().size(), jsonArray.size());\n        MapObjectLocaleString resObject = new MapObjectLocaleString();\n        for (JsonValue jsonValue : jsonArray) {\n            assertEquals(JsonValue.ValueType.OBJECT, jsonValue.getValueType());\n            JsonObject entry = jsonValue.asJsonObject();\n            assertEquals(2, entry.size());\n            assertNotNull(entry.get(\"key\"));\n            assertEquals(JsonValue.ValueType.STRING, entry.get(\"key\").getValueType());\n            assertNotNull(entry.get(\"value\"));\n            assertEquals(JsonValue.ValueType.STRING, entry.get(\"value\").getValueType());\n            resObject.getValues().put(Locale.forLanguageTag(entry.getString(\"key\")), entry.getString(\"value\"));\n        }\n        assertEquals(mapObject, resObject);\n    }\n\n    /**\n     * Test a Locale/String map with custom Locale serializer and deserializer.\n     */\n    @Test\n    public void testMapLocaleString() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig()\n                .withSerializers(new LocaleSerializer())\n                .withDeserializers(new LocaleDeserializer()));\n\n        MapObjectLocaleString mapObject = new MapObjectLocaleString();\n        mapObject.getValues().put(Locale.US, \"us\");\n        mapObject.getValues().put(Locale.ENGLISH, \"en\");\n        mapObject.getValues().put(Locale.JAPAN, \"jp\");\n\n        String json = jsonb.toJson(mapObject);\n        JsonObject jsonObject = Json.createReader(new StringReader(json)).read().asJsonObject();\n        verifyMapObjectLocaleStringSerialization(jsonObject, mapObject);\n\n        MapObjectLocaleString resObject = jsonb.fromJson(json, MapObjectLocaleString.class);\n        assertEquals(mapObject, resObject);\n    }\n\n    public static class MapObjectLocalDateString extends MapObject<LocalDate, String> {};\n\n    private void verifyMapObjectCustomLocalDateStringSerialization(JsonObject jsonObject, MapObjectLocalDateString mapObject) {\n\n        // Expected serialization is: {\"values\":[{\"key\":\"short-local-date\",\"value\":\"string\"},...]}\n        assertEquals(1, jsonObject.size());\n        assertNotNull(jsonObject.get(\"values\"));\n        assertEquals(JsonValue.ValueType.ARRAY, jsonObject.get(\"values\").getValueType());\n        JsonArray jsonArray = jsonObject.getJsonArray(\"values\");\n        assertEquals(mapObject.getValues().size(), jsonArray.size());\n        MapObjectLocalDateString resObject = new MapObjectLocalDateString();\n        for (JsonValue jsonValue : jsonArray) {\n            assertEquals(JsonValue.ValueType.OBJECT, jsonValue.getValueType());\n            JsonObject entry = jsonValue.asJsonObject();\n            assertEquals(2, entry.size());\n            assertNotNull(entry.get(\"key\"));\n            assertEquals(JsonValue.ValueType.STRING, entry.get(\"key\").getValueType());\n            assertNotNull(entry.get(\"value\"));\n            assertEquals(JsonValue.ValueType.STRING, entry.get(\"value\").getValueType());\n            resObject.getValues().put(LocalDate.parse(entry.getString(\"key\"), DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT)), entry.getString(\"value\"));\n        }\n        assertEquals(mapObject, resObject);\n    }\n\n    /**\n     * Test for issue #663...\n     * Test a LocalDate/String map as member in a custom class, using a custom LocalDate serializer and deserializer,\n     * even though there's a build-in {@link org.eclipse.yasson.internal.serializer.types.TypeSerializers#isSupportedMapKey(Class)}\n     */\n    @Test\n    public void testMapLocalDateKeyStringValueAsMember() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig()\n                .withSerializers(new LocalDateSerializer())\n                .withDeserializers(new LocalDateDeserializer()));\n\n        MapObjectLocalDateString mapObject = new MapObjectLocalDateString();\n        mapObject.getValues().put(LocalDate.now(), \"today\");\n        mapObject.getValues().put(LocalDate.now().plusDays(1), \"tomorrow\");\n\n        String json = jsonb.toJson(mapObject);\n\n        JsonObject jsonObject = Json.createReader(new StringReader(json)).read().asJsonObject();\n        verifyMapObjectCustomLocalDateStringSerialization(jsonObject, mapObject);\n        MapObjectLocalDateString resObject = jsonb.fromJson(json, MapObjectLocalDateString.class);\n        assertEquals(mapObject, resObject);\n        // ensure the keys are of type java.time.LocalDate\n        assertThat(resObject.getValues().keySet().iterator().next(), instanceOf(LocalDate.class));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/MapToObjectSerializerTest.java",
    "content": "/*\n * Copyright (c) 2019, 2021 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\n\nimport org.junit.jupiter.api.Test;\n\nimport static org.eclipse.yasson.Assertions.shouldFail;\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.assertTrue;\n\nimport java.math.BigInteger;\nimport java.util.EnumMap;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Objects;\n\n/**\n * Test various use-cases with {@code Map} serializer which\n * stores Map as JSON object.\n */\npublic class MapToObjectSerializerTest {\n\n    /**\n     * Enum used as key in maps during tests\n     */\n    enum TestEnum {\n        ONE, TWO;\n\n        @Override\n        /**\n         * Force to lower case to check toString is not used during serialization of maps\n         */\n        public String toString() {\n            return this.name().toLowerCase();\n        }\n    }\n\n    /**\n     * MapObject to test different parametrized maps.\n     * @param <K> The map key\n     * @param <V>The map value\n     */\n    public static class MapObject<K, V> {\n\n        private Map<K, V> values;\n\n        public MapObject() {\n            this.values = new HashMap<>();\n        }\n\n        public Map<K, V> getValues() {\n            return values;\n        }\n\n        public void setValues(Map<K, V> values) {\n            this.values = values;\n        }\n\n        @Override\n        public boolean equals(Object o) {\n            if (o instanceof MapObject) {\n                MapObject<?,?> to = (MapObject<?,?>) o;\n                return values.equals(to.values);\n            }\n            return false;\n        }\n\n        @Override\n        public int hashCode() {\n            return Objects.hashCode(this.values);\n        }\n\n        @Override\n        public String toString() {\n            return values.toString();\n        }\n    }\n\n    public static class MapObjectIntegerString extends MapObject<Integer, String> {};\n\n    public static class MapObjectBigIntegerString extends MapObject<BigInteger, String> {};\n\n    public static class MapObjectEnumString extends MapObject<TestEnum, String> {};\n\n    public static class MapObjectStringString extends MapObject<String, String> {};\n\n    public static class MapObjectBooleanString extends MapObject<Boolean, String> {};\n\n    /**\n     * Test serialization of Map with Number keys and String values.\n     */\n    @Test\n    public void testSerializeEnumMapToObject() {\n        Map<TestEnum, Object> map = new EnumMap<>(TestEnum.class);\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withFormatting(true));\n        map.put(TestEnum.ONE, \"value1\");\n        map.put(TestEnum.TWO, \"value2\");\n        String json = jsonb.toJson(map);\n        for (TestEnum e : TestEnum.values()) {\n            assertTrue(json.contains(e.name()), \"Enumeration not well serialized\");\n        }\n    }\n\n    /**\n     * Test for Integer/String map.\n     */\n    @Test\n    public void testIntegerString() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig());\n\n        MapObjectIntegerString mapObject = new MapObjectIntegerString();\n        mapObject.getValues().put(12, \"twelve\");\n        mapObject.getValues().put(48, \"forty eight\");\n        mapObject.getValues().put(256, \"two hundred fifty-six\");\n\n        String json = jsonb.toJson(mapObject);\n        MapObjectIntegerString resObject = jsonb.fromJson(json, MapObjectIntegerString.class);\n        assertEquals(mapObject, resObject);\n    }\n\n    /**\n     * Test for BigInteger/String map.\n     */\n    @Test\n    public void testBigIntegerString() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig());\n\n        MapObjectBigIntegerString mapObject = new MapObjectBigIntegerString();\n        mapObject.getValues().put(new BigInteger(\"12\"), \"twelve\");\n        mapObject.getValues().put(new BigInteger(\"48\"), \"forty eight\");\n        mapObject.getValues().put(new BigInteger(\"256\"), \"two hundred fifty-six\");\n\n        String json = jsonb.toJson(mapObject);\n        MapObjectBigIntegerString resObject = jsonb.fromJson(json, MapObjectBigIntegerString.class);\n        assertEquals(mapObject, resObject);\n    }\n\n    /**\n     * Test for Enum/String map.\n     */\n    @Test\n    public void testEnumString() {\n        Jsonb jsonb = JsonbBuilder.create();\n\n        MapObjectEnumString mapObject = new MapObjectEnumString();\n        mapObject.getValues().put(TestEnum.ONE, \"one\");\n        mapObject.getValues().put(TestEnum.TWO, \"two\");\n\n        String json = jsonb.toJson(mapObject);\n        MapObjectEnumString resObject = jsonb.fromJson(json, MapObjectEnumString.class);\n        assertEquals(mapObject, resObject);\n    }\n\n    /**\n     * Test for String/String map.\n     */\n    @Test\n    public void testStringString() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().setProperty(\"lala\", \"lala\"));\n\n        MapObjectStringString mapObject = new MapObjectStringString();\n        mapObject.getValues().put(\"one\", \"one\");\n        mapObject.getValues().put(\"two\", \"two\");\n\n        String json = jsonb.toJson(mapObject);\n        MapObjectStringString resObject = jsonb.fromJson(json, MapObjectStringString.class);\n        assertEquals(mapObject, resObject);\n    }\n\n    /**\n     * Test for a non parametrized map that should use Strings as keys.\n     */\n    @Test\n    public void testNotParametrizedMap() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig());\n\n        Map<Integer, String> mapObject = new HashMap<>();\n        mapObject.put(12, \"twelve\");\n        mapObject.put(48, \"forty eight\");\n        mapObject.put(256, \"two hundred fifty-six\");\n\n        String json = jsonb.toJson(mapObject);\n        Map resObject = jsonb.fromJson(json, Map.class);\n        assertEquals(3, resObject.size());\n        assertTrue(resObject.keySet().iterator().next() instanceof String);\n    }\n\n    /**\n     * Test for Boolean/String map. This map is not even generated by the\n     * MapToObjectSerializer as a boolean is not managed by that serializer.\n     * But the json string should be deserialized in the same way.\n     */\n    @Test\n    public void testBooleanStringMapToObjectSerializer() {\n        Jsonb jsonb = JsonbBuilder.create();\n\n        String json = \"{\\\"values\\\":{\\\"true\\\":\\\"TRUE\\\",\\\"false\\\":\\\"FALSE\\\"}}\";\n        MapObjectBooleanString resObject = jsonb.fromJson(json, MapObjectBooleanString.class);\n        assertEquals(2, resObject.getValues().size());\n        assertEquals(\"TRUE\", resObject.getValues().get(true));\n        assertEquals(\"FALSE\", resObject.getValues().get(false));\n    }\n\n    /**\n     * Test for Integer/String map but giving an incorrect integer key.\n     * JsonbException is expected.\n     */\n    @Test\n    public void testIncorrectTypeMapToObjectSerializer() {\n        Jsonb jsonb = JsonbBuilder.create();\n\n        String json = \"{\\\"values\\\":{\\\"1\\\":\\\"OK\\\",\\\"error\\\":\\\"KO\\\"}}\";\n        shouldFail(() -> jsonb.fromJson(json, MapObjectIntegerString.class));\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/SerializersTest.java",
    "content": "/*\n * Copyright (c) 2016, 2023 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers;\n\nimport java.io.StringReader;\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.math.BigDecimal;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Calendar;\nimport java.util.Collection;\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.SortedMap;\nimport java.util.TimeZone;\nimport java.util.TreeMap;\n\nimport jakarta.json.Json;\nimport jakarta.json.JsonObject;\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.annotation.JsonbTypeSerializer;\nimport jakarta.json.bind.config.PropertyOrderStrategy;\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\nimport jakarta.json.stream.JsonParser;\n\nimport org.eclipse.yasson.TestTypeToken;\nimport org.eclipse.yasson.YassonConfig;\nimport org.eclipse.yasson.internal.model.ReverseTreeMap;\nimport org.eclipse.yasson.serializers.model.AnnotatedGenericWithSerializerType;\nimport org.eclipse.yasson.serializers.model.AnnotatedWithSerializerType;\nimport org.eclipse.yasson.serializers.model.Author;\nimport org.eclipse.yasson.serializers.model.Box;\nimport org.eclipse.yasson.serializers.model.BoxWithAnnotations;\nimport org.eclipse.yasson.serializers.model.Containee;\nimport org.eclipse.yasson.serializers.model.Container;\nimport org.eclipse.yasson.serializers.model.Crate;\nimport org.eclipse.yasson.serializers.model.CrateDeserializer;\nimport org.eclipse.yasson.serializers.model.CrateDeserializerWithConversion;\nimport org.eclipse.yasson.serializers.model.CrateInner;\nimport org.eclipse.yasson.serializers.model.CrateJsonObjectDeserializer;\nimport org.eclipse.yasson.serializers.model.CrateSerializer;\nimport org.eclipse.yasson.serializers.model.CrateSerializerWithConversion;\nimport org.eclipse.yasson.serializers.model.ExplicitJsonbSerializer;\nimport org.eclipse.yasson.serializers.model.GenericPropertyPojo;\nimport org.eclipse.yasson.serializers.model.ImplicitJsonbSerializer;\nimport org.eclipse.yasson.serializers.model.NumberDeserializer;\nimport org.eclipse.yasson.serializers.model.NumberSerializer;\nimport org.eclipse.yasson.serializers.model.RecursiveDeserializer;\nimport org.eclipse.yasson.serializers.model.RecursiveSerializer;\nimport org.eclipse.yasson.serializers.model.SimpleAnnotatedSerializedArrayContainer;\nimport org.eclipse.yasson.serializers.model.SimpleContainer;\nimport org.eclipse.yasson.serializers.model.StringWrapper;\nimport org.eclipse.yasson.serializers.model.SupertypeSerializerPojo;\nimport org.junit.jupiter.api.Test;\n\nimport static java.util.Collections.singletonMap;\n\nimport static org.eclipse.yasson.Jsonbs.defaultJsonb;\nimport static org.eclipse.yasson.Jsonbs.nullableJsonb;\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.assertInstanceOf;\nimport static org.junit.jupiter.api.Assertions.assertNull;\nimport static org.junit.jupiter.api.Assertions.assertTrue;\nimport static org.junit.jupiter.api.Assertions.fail;\nimport static org.hamcrest.CoreMatchers.is;\nimport static org.hamcrest.MatcherAssert.assertThat;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class SerializersTest {\n\n    private static final JsonbSerializer<Box> BOX_ARRAY_SERIALIZER_CHAINED = new JsonbSerializer<>() {\n        public void serialize(Box box, JsonGenerator out, SerializationContext ctx) {\n            out.writeStartArray()\n                    .write(box.boxStr)\n                    .write(box.secondBoxStr)\n                    .writeEnd();\n        }\n    };\n\n    private static final JsonbSerializer<Box> BOX_ARRAY_SERIALIZER = new JsonbSerializer<>() {\n        public void serialize(Box box, JsonGenerator out, SerializationContext ctx) {\n            out.writeStartArray();\n            out.write(box.boxStr);\n            out.write(box.secondBoxStr);\n            out.writeEnd();\n        }\n    };\n\n    @Test\n    public void testClassLevelAnnotation() {\n        Crate crate = new Crate();\n        crate.crateBigDec = BigDecimal.TEN;\n        crate.crateStr = \"crateStr\";\n\n        crate.annotatedType = new AnnotatedWithSerializerType();\n        crate.annotatedType.value = \"abc\";\n        crate.annotatedGenericType = new AnnotatedGenericWithSerializerType<>();\n        crate.annotatedGenericType.value = new Crate();\n        crate.annotatedGenericType.value.crateStr = \"inside generic\";\n        crate.annotatedTypeOverriddenOnProperty = new AnnotatedWithSerializerType();\n        crate.annotatedTypeOverriddenOnProperty.value = \"def\";\n        String expected = \"{\\\"annotatedGenericType\\\":{\\\"generic\\\":{\\\"crate_str\\\":\\\"inside generic\\\"}},\\\"annotatedType\\\":{\\\"valueField\\\":\\\"replaced value\\\"},\\\"annotatedTypeOverriddenOnProperty\\\":{\\\"valueField\\\":\\\"overridden value\\\"},\\\"crateBigDec\\\":10,\\\"crate_str\\\":\\\"crateStr\\\"}\";\n\n        assertEquals(expected, defaultJsonb.toJson(crate));\n\n        Crate result = defaultJsonb.fromJson(expected, Crate.class);\n        assertEquals(\"replaced value\", result.annotatedType.value);\n        assertEquals(\"overridden value\", result.annotatedTypeOverriddenOnProperty.value);\n        assertEquals(\"inside generic\", result.annotatedGenericType.value.crateStr);\n    }\n\n    @Test\n    public void testClassLevelAnnotationOnRoot() {\n        AnnotatedWithSerializerType annotatedType = new AnnotatedWithSerializerType();\n        annotatedType.value = \"abc\";\n        String expected = \"{\\\"valueField\\\":\\\"replaced value\\\"}\";\n\n        assertEquals(expected, defaultJsonb.toJson(annotatedType));\n\n        AnnotatedWithSerializerType result = defaultJsonb.fromJson(expected, AnnotatedWithSerializerType.class);\n        assertEquals(\"replaced value\", result.value);\n    }\n\n    @Test\n    public void testClassLevelAnnotationOnGenericRoot() {\n        AnnotatedGenericWithSerializerType<Crate> annotatedType = new AnnotatedGenericWithSerializerType<>();\n        annotatedType.value = new Crate();\n        annotatedType.value.crateStr = \"inside generic\";\n        String expected = \"{\\\"generic\\\":{\\\"crate_str\\\":\\\"inside generic\\\"}}\";\n\n        assertEquals(expected, defaultJsonb.toJson(annotatedType));\n\n        AnnotatedGenericWithSerializerType<Crate> result = defaultJsonb.fromJson(expected, new AnnotatedGenericWithSerializerType<Crate>(){}.getClass().getGenericSuperclass());\n        assertEquals(\"inside generic\", result.value.crateStr);\n    }\n\n    /**\n     * Tests JSONB deserialization of arbitrary type invoked from a Deserializer.\n     */\n    @Test\n    public void testDeserializerDeserializationByType() {\n        JsonbConfig config = new JsonbConfig().withDeserializers(new CrateDeserializer());\n        Jsonb jsonb = JsonbBuilder.create(config);\n\n        Box box = createPojoWithDates();\n\n        String expected = \"{\\\"boxStr\\\":\\\"Box string\\\",\\\"crate\\\":{\\\"crateInner\\\":{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"Single inner\\\",\\\"date\\\":\\\"14.05.2015 || 11:10:01\\\"},\\\"crateInnerList\\\":[{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"List inner 0\\\"},{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"List inner 1\\\"}],\\\"date\\\":\\\"2015-05-14T11:10:01\\\"},\\\"secondBoxStr\\\":\\\"Second box string\\\"}\";\n\n        Box result = jsonb.fromJson(expected, Box.class);\n\n        //deserialized by deserializationContext.deserialize(Class c)\n        assertEquals(box.crate.crateInner.crateInnerBigDec, result.crate.crateInner.crateInnerBigDec);\n        assertEquals(box.crate.crateInner.crateInnerStr, result.crate.crateInner.crateInnerStr);\n\n        assertEquals(\"List inner 0\", result.crate.crateInnerList.get(0).crateInnerStr);\n        assertEquals(\"List inner 1\", result.crate.crateInnerList.get(1).crateInnerStr);\n\n        //set by deserializer statically\n        assertEquals(new BigDecimal(\"123\"), result.crate.crateBigDec);\n        assertEquals(\"abc\", result.crate.crateStr);\n    }\n\n    /**\n     * Tests JSONB serialization of arbitrary type invoked from a Serializer.\n     */\n    @Test\n    public void testSerializerSerializationOfType() {\n        JsonbConfig config = new JsonbConfig().withSerializers(new CrateSerializer());\n        Jsonb jsonb = JsonbBuilder.create(config);\n        String expected = \"{\\\"boxStr\\\":\\\"Box string\\\",\\\"crate\\\":{\\\"crateStr\\\":\\\"REPLACED crate str\\\",\\\"crateInner\\\":{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"Single inner\\\"},\\\"crateInnerList\\\":[{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"List inner 0\\\"},{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"List inner 1\\\"}],\\\"crateBigDec\\\":54321},\\\"secondBoxStr\\\":\\\"Second box string\\\"}\";\n        Box pojo = createPojo();\n\n        assertEquals(expected, jsonb.toJson(pojo));\n\n        Box result = jsonb.fromJson(expected, Box.class);\n        assertEquals(new BigDecimal(\"54321\"), result.crate.crateBigDec);\n        //result.crate.crateStr is mapped to crate_str by jsonb property\n        assertNull(result.crate.crateStr);\n        assertEquals(pojo.crate.crateInner.crateInnerStr, result.crate.crateInner.crateInnerStr);\n        assertEquals(pojo.crate.crateInner.crateInnerBigDec, result.crate.crateInner.crateInnerBigDec);\n    }\n\n    @Test\n    public void testSerializerSerializationOfTypeWithExplicitType() {\n        JsonbConfig config = new JsonbConfig().withSerializers(new CrateSerializer());\n        Jsonb jsonb = JsonbBuilder.create(config);\n        String expected = \"{\\\"boxStr\\\":\\\"Box string\\\",\\\"crate\\\":{\\\"crateStr\\\":\\\"REPLACED crate str\\\",\\\"crateInner\\\":{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"Single inner\\\"},\\\"crateInnerList\\\":[{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"List inner 0\\\"},{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"List inner 1\\\"}],\\\"crateBigDec\\\":54321},\\\"secondBoxStr\\\":\\\"Second box string\\\"}\";\n        Box pojo = createPojo();\n\n        assertEquals(expected, jsonb.toJson(pojo, Box.class));\n\n        Box result = jsonb.fromJson(expected, Box.class);\n        assertEquals(new BigDecimal(\"54321\"), result.crate.crateBigDec);\n        //result.crate.crateStr is mapped to crate_str by jsonb property\n        assertNull(result.crate.crateStr);\n        assertEquals(pojo.crate.crateInner.crateInnerStr, result.crate.crateInner.crateInnerStr);\n        assertEquals(pojo.crate.crateInner.crateInnerBigDec, result.crate.crateInner.crateInnerBigDec);\n    }\n\n    /**\n     * Tests jsonb type conversion, including property customization.\n     */\n    @Test\n    public void testDeserializersUsingConversion() {\n        JsonbConfig config = new JsonbConfig().withDeserializers(new CrateDeserializerWithConversion());\n        Jsonb jsonb = JsonbBuilder.create(config);\n\n        String json = \"{\\\"boxStr\\\":\\\"Box string\\\",\\\"crate\\\":{\\\"date-converted\\\":\\\"2015-05-14T11:10:01\\\",\\\"crateStr\\\":\\\"REPLACED crate str\\\",\\\"crateInner\\\":{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"Single inner\\\",\\\"date\\\":\\\"14.05.2015 || 11:10:01\\\"},\\\"crateBigDec\\\":54321},\\\"secondBoxStr\\\":\\\"Second box string\\\"}\";\n        Box result = jsonb.fromJson(json, Box.class);\n        final Date expected = getExpectedDate();\n        assertEquals(expected, result.crate.date);\n        assertEquals(\"Box string\", result.boxStr);\n        assertEquals(\"Second box string\", result.secondBoxStr);\n    }\n\n    @Test\n    public void testCrateJsonObjectDeserializer() {\n        JsonbConfig config = new JsonbConfig().withDeserializers(new CrateJsonObjectDeserializer());\n        Jsonb jsonb = JsonbBuilder.create(config);\n        String expected = \"{\\\"boxStr\\\":\\\"Box string\\\",\\\"crate\\\":{\\\"date-converted\\\":\\\"2015-05-14T11:10:01\\\",\\\"crateStr\\\":\\\"REPLACED crate str\\\",\\\"crateInner\\\":{\\\"crateInnerBigDec\\\":10,\\\"crateInnerStr\\\":\\\"Single inner\\\"},\\\"crateInnerList\\\":[{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"List inner 0\\\"},{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"List inner 1\\\"}],\\\"crateBigDec\\\":54321},\\\"secondBoxStr\\\":\\\"Second box string\\\"}\";\n        Box result = jsonb.fromJson(expected, Box.class);\n        assertEquals(new BigDecimal(\"54321\"), result.crate.crateBigDec);\n        assertEquals(\"REPLACED crate str\", result.crate.crateStr);\n        assertEquals(\"Single inner\", result.crate.crateInner.crateInnerStr);\n        assertEquals(BigDecimal.TEN, result.crate.crateInner.crateInnerBigDec);\n    }\n\n    private static Date getExpectedDate() {\n        return new Calendar.Builder().setDate(2015, 4, 14).setTimeOfDay(11, 10, 1).setTimeZone(TimeZone.getTimeZone(\"Z\")).build().getTime();\n    }\n\n    @Test\n    public void testSerializationUsingConversion() {\n        JsonbConfig config = new JsonbConfig().withSerializers(new CrateSerializerWithConversion());\n        Jsonb jsonb = JsonbBuilder.create(config);\n\n        String json = \"{\\\"boxStr\\\":\\\"Box string\\\",\\\"crate\\\":{\\\"crateStr\\\":\\\"REPLACED crate str\\\",\\\"crateInner\\\":{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"Single inner\\\",\\\"date\\\":\\\"14.05.2015 || 11:10:01\\\"},\\\"crateInnerList\\\":[{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"List inner 0\\\"},{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"List inner 1\\\"}],\\\"crateBigDec\\\":54321,\\\"date-converted\\\":\\\"2015-05-14T11:10:01Z[UTC]\\\"},\\\"secondBoxStr\\\":\\\"Second box string\\\"}\";\n        assertEquals(json, jsonb.toJson(createPojoWithDates()));\n    }\n\n    @Test\n    public void testAnnotations() {\n        BoxWithAnnotations box = new BoxWithAnnotations();\n        box.boxStr = \"Box string\";\n        box.secondBoxStr = \"Second box string\";\n        box.crate = new Crate();\n        box.crate.date = getExpectedDate();\n        box.crate.crateInner = createCrateInner(\"Single inner\");\n\n        box.crate.crateInnerList = new ArrayList<>();\n        box.crate.crateInnerList.add(createCrateInner(\"List inner 0\"));\n        box.crate.crateInnerList.add(createCrateInner(\"List inner 1\"));\n\n        String expected = \"{\\\"boxStr\\\":\\\"Box string\\\",\\\"crate\\\":{\\\"crateStr\\\":\\\"REPLACED crate str\\\",\\\"crateInner\\\":{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"Single inner\\\"},\\\"crateInnerList\\\":[{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"List inner 0\\\"},{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"List inner 1\\\"}],\\\"crateBigDec\\\":54321,\\\"date-converted\\\":\\\"2015-05-14T11:10:01Z[UTC]\\\"},\\\"secondBoxStr\\\":\\\"Second box string\\\"}\";\n\n        assertEquals(expected, defaultJsonb.toJson(box));\n\n        BoxWithAnnotations result = defaultJsonb.fromJson(expected, BoxWithAnnotations.class);\n\n        //deserialized by deserializationContext.deserialize(Class c)\n        assertEquals(box.crate.crateInner.crateInnerBigDec, result.crate.crateInner.crateInnerBigDec);\n        assertEquals(box.crate.crateInner.crateInnerStr, result.crate.crateInner.crateInnerStr);\n\n        assertEquals(2L, result.crate.crateInnerList.size());\n        assertEquals(\"List inner 0\", result.crate.crateInnerList.get(0).crateInnerStr);\n        assertEquals(\"List inner 1\", result.crate.crateInnerList.get(1).crateInnerStr);\n\n        //set by deserializer statically\n        assertEquals(new BigDecimal(\"123\"), result.crate.crateBigDec);\n        assertEquals(\"abc\", result.crate.crateStr);\n    }\n\n    @Test\n    public void testAnnotationsOverride() {\n        JsonbConfig config = new JsonbConfig().withDeserializers(new CrateJsonObjectDeserializer()).withSerializers(new CrateSerializer());\n        Jsonb jsonb = JsonbBuilder.create(config);\n\n        BoxWithAnnotations box = new BoxWithAnnotations();\n        box.boxStr = \"Box string\";\n        box.secondBoxStr = \"Second box string\";\n        box.crate = new Crate();\n        box.crate.crateInner = createCrateInner(\"Single inner\");\n        box.crate.date = getExpectedDate();\n\n        box.crate.crateInnerList = new ArrayList<>();\n        box.crate.crateInnerList.add(createCrateInner(\"List inner 0\"));\n        box.crate.crateInnerList.add(createCrateInner(\"List inner 1\"));\n\n        String expected = \"{\\\"boxStr\\\":\\\"Box string\\\",\\\"crate\\\":{\\\"crateStr\\\":\\\"REPLACED crate str\\\",\\\"crateInner\\\":{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"Single inner\\\"},\\\"crateInnerList\\\":[{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"List inner 0\\\"},{\\\"crateInnerBigDec\\\":10,\\\"crate_inner_str\\\":\\\"List inner 1\\\"}],\\\"crateBigDec\\\":54321,\\\"date-converted\\\":\\\"2015-05-14T11:10:01Z[UTC]\\\"},\\\"secondBoxStr\\\":\\\"Second box string\\\"}\";\n\n        assertEquals(expected, jsonb.toJson(box));\n\n        BoxWithAnnotations result = jsonb.fromJson(expected, BoxWithAnnotations.class);\n\n        //deserialized by deserializationContext.deserialize(Class c)\n        assertEquals(box.crate.crateInner.crateInnerBigDec, result.crate.crateInner.crateInnerBigDec);\n        assertEquals(box.crate.crateInner.crateInnerStr, result.crate.crateInner.crateInnerStr);\n\n        assertEquals(2L, result.crate.crateInnerList.size());\n        assertEquals(\"List inner 0\", result.crate.crateInnerList.get(0).crateInnerStr);\n        assertEquals(\"List inner 1\", result.crate.crateInnerList.get(1).crateInnerStr);\n\n        //set by deserializer statically\n        assertEquals(new BigDecimal(\"123\"), result.crate.crateBigDec);\n        assertEquals(\"abc\", result.crate.crateStr);\n    }\n\n    @Test\n    public void testStringField() {\n        StringWrapper pojo = new StringWrapper();\n        pojo.strField = \"abc\";\n        final String result = defaultJsonb.toJson(pojo);\n        assertEquals(\"{\\\"strField\\\":\\\"   abc\\\"}\", result);\n    }\n\n    @Test\n    public void testContainerSerializer() {\n        SimpleAnnotatedSerializedArrayContainer container = new SimpleAnnotatedSerializedArrayContainer();\n        SimpleContainer instance1 = new SimpleContainer();\n        instance1.setInstance(\"Test String 1\");\n        SimpleContainer instance2 = new SimpleContainer();\n        instance2.setInstance(\"Test String 2\");\n        container.setArrayInstance(new SimpleContainer[] {instance1, instance2});\n\n        container.setListInstance(new ArrayList<>());\n        container.getListInstance().add(new SimpleContainer(\"Test List 1\"));\n        container.getListInstance().add(new SimpleContainer(\"Test List 2\"));\n\n        String jsonString = defaultJsonb.toJson(container);\n        assertEquals(\"{\\\"arrayInstance\\\":[{\\\"instance\\\":\\\"Test String 1\\\"},{\\\"instance\\\":\\\"Test String 2\\\"}],\\\"listInstance\\\":[{\\\"instance\\\":\\\"Test List 1\\\"},{\\\"instance\\\":\\\"Test List 2\\\"}]}\", jsonString);\n\n        SimpleAnnotatedSerializedArrayContainer unmarshalledObject = defaultJsonb.fromJson(\"{\\\"arrayInstance\\\":[{\\\"instance\\\":\\\"Test String 1\\\"},{\\\"instance\\\":\\\"Test String 2\\\"}],\\\"listInstance\\\":[{\\\"instance\\\":\\\"Test List 1\\\"},{\\\"instance\\\":\\\"Test List 2\\\"}]}\", SimpleAnnotatedSerializedArrayContainer.class);\n\n        assertEquals(\"Test String 1\", unmarshalledObject.getArrayInstance()[0].getInstance());\n        assertEquals(\"Test String 2\", unmarshalledObject.getArrayInstance()[1].getInstance());\n\n        assertEquals(\"Test List 1\", unmarshalledObject.getListInstance().get(0).getInstance());\n        assertEquals(\"Test List 2\", unmarshalledObject.getListInstance().get(1).getInstance());\n    }\n\n    /**\n     * Tests avoiding StackOverflowError.\n     */\n    @Test\n    public void testRecursiveSerializer() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withSerializers(new RecursiveSerializer()).withDeserializers(new RecursiveDeserializer()));\n\n        Box box = new Box();\n        box.boxStr = \"Box to serialize\";\n        try {\n            jsonb.toJson(box);\n            fail();\n        } catch (JsonbException ex) {\n        }\n\n        try {\n            jsonb.fromJson(\"{\\\"boxStr\\\":\\\"Box to deserialize\\\"}\", Box.class);\n            fail();\n        } catch (StackOverflowError error){\n        }\n    }\n\n    @Test\n    public void testAuthor() {\n        Author author = new Author(\"Sarah\", \"Connor\");\n        String expected = \"{\\\"firstName\\\":\\\"S\\\",\\\"lastName\\\":\\\"Connor\\\"}\";\n        String json = defaultJsonb.toJson(author);\n\n        assertEquals(expected, json);\n\n        Author result = defaultJsonb.fromJson(expected, Author.class);\n        assertEquals(\"John\", result.getFirstName());\n        assertEquals(\"Connor\", result.getLastName());\n    }\n\n    @Test\n    public void testSupertypeSerializer() {\n        Jsonb jsonb = JsonbBuilder.create(\n                new JsonbConfig().withSerializers(new NumberSerializer())\n                        .withDeserializers(new NumberDeserializer()));\n        SupertypeSerializerPojo pojo = new SupertypeSerializerPojo();\n        pojo.setNumberInteger(10);\n        pojo.setAnotherNumberInteger(11);\n        assertEquals(\"{\\\"anotherNumberInteger\\\":\\\"12\\\",\\\"numberInteger\\\":\\\"11\\\"}\", jsonb.toJson(pojo));\n\n        pojo = jsonb.fromJson(\"{\\\"anotherNumberInteger\\\":\\\"12\\\",\\\"numberInteger\\\":\\\"11\\\"}\", SupertypeSerializerPojo.class);\n        assertEquals(Integer.valueOf(10), pojo.getNumberInteger());\n        assertEquals(Integer.valueOf(11), pojo.getAnotherNumberInteger());\n    }\n    \n    @Test\n    public void testObjectDeserializerWithLexOrderStrategy() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyOrderStrategy(PropertyOrderStrategy.LEXICOGRAPHICAL));\n        Object pojo = jsonb.fromJson(\"{\\\"first\\\":{},\\\"third\\\":{},\\\"second\\\":{\\\"second\\\":2,\\\"first\\\":1}}\", Object.class);\n        assertTrue(pojo instanceof TreeMap, \"Pojo is not of type TreeMap\");\n        @SuppressWarnings(\"unchecked\")\n        SortedMap<String, Object> pojoAsMap = (SortedMap<String, Object>) pojo;\n        assertTrue(pojoAsMap.get(\"second\") instanceof TreeMap, \"Pojo inner object is not of type TreeMap\");\n        assertEquals(\"{\\\"first\\\":{},\\\"second\\\":{\\\"first\\\":1,\\\"second\\\":2},\\\"third\\\":{}}\", jsonb.toJson(pojo));\n    }\n    \n    @Test\n    public void testObjectDeserializerWithReverseOrderStrategy() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyOrderStrategy(PropertyOrderStrategy.REVERSE));\n        Object pojo = jsonb.fromJson(\"{\\\"first\\\":{},\\\"second\\\":{\\\"first\\\":1,\\\"second\\\":2},\\\"third\\\":{}}\", Object.class);\n        assertTrue(pojo instanceof ReverseTreeMap, \"Pojo is not of type ReverseTreeMap\");\n        @SuppressWarnings(\"unchecked\")\n        SortedMap<String, Object> pojoAsMap = (SortedMap<String, Object>) pojo;\n        assertTrue(pojoAsMap.get(\"second\") instanceof TreeMap, \"Pojo inner object is not of type TreeMap\");\n        assertEquals(\"{\\\"third\\\":{},\\\"second\\\":{\\\"second\\\":2,\\\"first\\\":1},\\\"first\\\":{}}\", jsonb.toJson(pojo));\n    }\n\n    @Test\n    public void testObjectDeserializerWithAnyOrNoneOrderStrategy() {\n        String json = \"{\\\"first\\\":{},\\\"second\\\":{\\\"first\\\":1,\\\"second\\\":2},\\\"third\\\":{}}\";\n        // ANY\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyOrderStrategy(PropertyOrderStrategy.ANY));\n        Object pojo = jsonb.fromJson(json, Object.class);\n        assertTrue(pojo instanceof HashMap, \"Pojo is not of type HashMap with \\\"ANY\\\" strategy\");\n        // none\n        pojo = defaultJsonb.fromJson(json, Object.class);\n        assertTrue(pojo instanceof HashMap, \"Pojo is not of type HashMap with no strategy\");\n    }\n\n    @Test\n    public void testSortedMapDerializer() {\n        String json = \"{\\\"first\\\":1,\\\"third\\\":3,\\\"second\\\":2}\";\n\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyOrderStrategy(PropertyOrderStrategy.ANY));\n        SortedMap<?, ?> pojo = jsonb.fromJson(json, SortedMap.class);\n        assertTrue(pojo instanceof TreeMap, \"Pojo is not of type TreeMap with \\\"ANY\\\" strategy\");\n\n        jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyOrderStrategy(PropertyOrderStrategy.LEXICOGRAPHICAL));\n        pojo = jsonb.fromJson(json, SortedMap.class);\n        assertTrue(pojo instanceof TreeMap, \"Pojo is not of type TreeMap with no strategy\");\n        assertEquals(\"{\\\"first\\\":1,\\\"second\\\":2,\\\"third\\\":3}\", jsonb.toJson(pojo));\n\n        jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyOrderStrategy(PropertyOrderStrategy.REVERSE));\n        pojo = jsonb.fromJson(json, SortedMap.class);\n        assertTrue(pojo instanceof ReverseTreeMap, \"Pojo is not of type ReverseTreeMap with no strategy\");\n        assertEquals(\"{\\\"third\\\":3,\\\"second\\\":2,\\\"first\\\":1}\", jsonb.toJson(pojo));\n\n        pojo = defaultJsonb.fromJson(json, SortedMap.class);\n        assertTrue(pojo instanceof TreeMap, \"Pojo is not of type TreeMap with no strategy\");\n        assertEquals(\"{\\\"first\\\":1,\\\"second\\\":2,\\\"third\\\":3}\", defaultJsonb.toJson(pojo));\n    }\n\n    @Test\n    public void testGenericPropertyPojoSerializer() {\n        GenericPropertyPojo<Number> numberPojo = new GenericPropertyPojo<>();\n        numberPojo.setProperty(10L);\n        GenericPropertyPojo<String> stringPojo = new GenericPropertyPojo<>();\n        stringPojo.setProperty(\"String property\");\n\n        String numResult = defaultJsonb.toJson(numberPojo, new TestTypeToken<GenericPropertyPojo<Number>>(){}.getType());\n        assertEquals(\"{\\\"propertyByUserSerializer\\\":\\\"Number value [10]\\\"}\", numResult);\n\n        String strResult = defaultJsonb.toJson(stringPojo, new TestTypeToken<GenericPropertyPojo<String>>(){}.getType());\n        // because GenericPropertyPojo is annotated to use GenericPropertyPojoSerializer, it will always be\n        // used, despite the fact that the runtime type supplied does not match the serializer type\n        assertEquals(\"{\\\"propertyByUserSerializer\\\":\\\"Number value [String property]\\\"}\", strResult);\n    }\n\n    @Test\n    public void testSerializeMapWithNulls() {\n        assertEquals(\"{\\\"null\\\":null}\", nullableJsonb.toJson(singletonMap(null, null)));\n        assertEquals(\"{\\\"key\\\":null}\", nullableJsonb.toJson(singletonMap(\"key\", null)));\n        assertEquals(\"{\\\"null\\\":\\\"value\\\"}\", nullableJsonb.toJson(singletonMap(null, \"value\")));\n    }\n\n    @Test\n    public void testSerializeMapWithNullsForceArraySerializer() {\n        Jsonb jsonb = JsonbBuilder.create(new YassonConfig()\n                .withForceMapArraySerializerForNullKeys(Boolean.TRUE)\n                .withNullValues(Boolean.TRUE));\n        assertEquals(\"[{\\\"key\\\":null,\\\"value\\\":null}]\", jsonb.toJson(singletonMap(null, null)));\n        assertEquals(\"{\\\"key\\\":null}\", jsonb.toJson(singletonMap(\"key\", null)));\n        assertEquals(\"[{\\\"key\\\":null,\\\"value\\\":\\\"value\\\"}]\", jsonb.toJson(singletonMap(null, \"value\")));\n    }\n\n    /**\n     * Test serialization of Map with String keys only.\n     * Map shall be stored as a single JsonObject with keys as object properties names.\n     */\n    @Test\n    public void testSerializeMapToJsonObject() {\n        Map<String, Object> map = new HashMap<>();\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig());\n        map.put(\"name\", \"John SMith\");\n        map.put(\"age\", 35);\n        map.put(\"married\", true);\n        String json = jsonb.toJson(map);\n        JsonObject jobj = Json.createReader(new StringReader(json)).read().asJsonObject();\n        assertEquals(\"John SMith\", jobj.getString(\"name\"));\n        assertEquals(35, jobj.getInt(\"age\"));\n        assertEquals(true, jobj.getBoolean(\"married\"));\n    }\n\n    @Test\n    public void testDeserializeArrayWithAdvancingParserAfterObjectEnd() {\n        String json = \"[{\\\"stringProperty\\\":\\\"Property 1 value\\\"},{\\\"stringProperty\\\":\\\"Property 2 value\\\"}]\";\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withDeserializers(new SimplePojoDeserializer()));\n        SimplePojo[] result = jsonb.fromJson(json, SimplePojo[].class);\n        assertEquals(2, result.length);\n    }\n\n    public class SimplePojoDeserializer implements JsonbDeserializer<SimplePojo> {\n        @Override\n        public SimplePojo deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {\n            //parser.getObject advances the parser to END_OBJECT.\n            JsonObject json = parser.getObject();\n            SimplePojo simplePojo = new SimplePojo();\n            simplePojo.setStringProperty(json.getString(\"stringProperty\"));\n            return simplePojo;\n        }\n    }\n\n    @Test\n    public void testDeserializeArrayWithAdvancingParserAfterObjectEndUsingValue() {\n        String json = \"[{\\\"stringProperty\\\":\\\"Property 1 value\\\"},{\\\"stringProperty\\\":\\\"Property 2 value\\\"}]\";\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withDeserializers(new SimplePojoValueDeserializer()));\n        SimplePojo[] result = jsonb.fromJson(json, SimplePojo[].class);\n        assertEquals(2, result.length);\n    }\n\n    public class SimplePojoValueDeserializer implements JsonbDeserializer<SimplePojo> {\n        @Override\n        public SimplePojo deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {\n            //parser.getValue advances the parser to END_OBJECT in case of object.\n            JsonObject json = parser.getValue().asJsonObject();\n            SimplePojo simplePojo = new SimplePojo();\n            simplePojo.setStringProperty(json.getString(\"stringProperty\"));\n            return simplePojo;\n        }\n    }\n\n    public class SimplePojo {\n        private String stringProperty;\n\n        public String getStringProperty() {\n            return stringProperty;\n        }\n\n        public void setStringProperty(String stringProperty) {\n            this.stringProperty = stringProperty;\n        }\n    }\n\n    private static Box createPojoWithDates() {\n        Date date = getExpectedDate();\n        Box box = createPojo();\n        box.crate.date = date;\n        box.crate.crateInner.date = date;\n        return box;\n    }\n\n    private static Box createPojo() {\n        Box box = new Box();\n        box.boxStr = \"Box string\";\n        box.crate = new Crate();\n        box.secondBoxStr = \"Second box string\";\n\n\n        box.crate.crateInner = createCrateInner(\"Single inner\");\n\n        box.crate.crateInnerList = new ArrayList<>();\n        box.crate.crateInnerList.add(createCrateInner(\"List inner 0\"));\n        box.crate.crateInnerList.add(createCrateInner(\"List inner 1\"));\n\n        return box;\n    }\n\n    private static CrateInner createCrateInner(String name) {\n        final CrateInner crateInner = new CrateInner();\n        crateInner.crateInnerStr = name;\n        crateInner.crateInnerBigDec = BigDecimal.TEN;\n        return crateInner;\n    }\n    \n    public static class Foo { }\n\n    public static class Bar extends Foo { }\n    \n    public static class Baz extends Bar { }\n\n    public static class FooSerializer implements JsonbSerializer<Foo> {\n      public void serialize(Foo obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.write(\"foo\");\n      }\n    }\n\n    public static class BazSerializer implements JsonbSerializer<Baz> {\n      public void serialize(Baz obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.write(\"baz\");\n      }\n    }\n    \n    /**\n     * Test for issue: https://github.com/quarkusio/quarkus/issues/8925\n     * Ensure that if multiple customizations (serializer, deserializer, or adapter) are applied \n     * for different types in the same class hierarchy, we use the customization for the most \n     * specific type in the class hierarchy.\n     */\n    @Test\n    public void testSerializerMatching() {\n      Jsonb jsonb = JsonbBuilder.create(new JsonbConfig()\n          .withSerializers(new FooSerializer(), new BazSerializer()));\n      assertEquals(\"\\\"foo\\\"\", jsonb.toJson(new Foo()));\n      // Since 'Bar' does not have its own serializer, it should use \n      // the next serializer in the tree (FooSerializer)\n      assertEquals(\"\\\"foo\\\"\", jsonb.toJson(new Bar()));\n      assertEquals(\"\\\"baz\\\"\", jsonb.toJson(new Baz()));\n    }\n    \n    public static interface One { }\n    public static interface Two { }\n\n    public static interface Three { }\n    \n    public static class OneTwo implements One, Two { }\n    public static class OneTwoThree implements One, Two, Three { }\n    \n    public static class OneSerializer implements JsonbSerializer<One> {\n      public void serialize(One obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.write(\"one\");\n      }\n    }\n    \n    public static class TwoSerializer implements JsonbSerializer<Two> {\n      public void serialize(Two obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.write(\"two\");\n      }\n    }\n    \n    public static class ThreeSerializer implements JsonbSerializer<Three> {\n      public void serialize(Three obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.write(\"three\");\n      }\n    }\n    \n    @Test\n    public void testSerializerMatchingInterfaces01() {\n      Jsonb jsonb = JsonbBuilder.create(new JsonbConfig()\n          .withSerializers(new OneSerializer(), new TwoSerializer(), new ThreeSerializer()));\n      assertEquals(\"\\\"one\\\"\", jsonb.toJson(new OneTwo()));\n      assertEquals(\"\\\"one\\\"\", jsonb.toJson(new OneTwoThree()));\n    }\n    \n    @Test\n    public void testSerializerMatchingInterfaces02() {\n      Jsonb jsonb = JsonbBuilder.create(new JsonbConfig()\n          .withSerializers(new ThreeSerializer(), new TwoSerializer()));\n      assertEquals(\"\\\"two\\\"\", jsonb.toJson(new OneTwo()));\n      assertEquals(\"\\\"two\\\"\", jsonb.toJson(new OneTwoThree()));\n    }\n\n    public class GenericBean<T> {\n\n        public T value;\n\n        @Override\n        public boolean equals(Object obj) {\n            if (obj instanceof GenericBean){\n                return Objects.equals(GenericBean.class.cast(obj).value, this.value);\n            }\n            return Boolean.FALSE;\n        }\n\n    }\n\n    public class GenericBeanSerializer implements JsonbSerializer<GenericBean> {\n\n        private Boolean called = Boolean.FALSE;\n\n        @Override\n        public void serialize(GenericBean t, JsonGenerator jg, SerializationContext sc) {\n            called = Boolean.TRUE;\n            jg.writeStartObject();\n            sc.serialize(\"value\", t.value, jg);\n            jg.writeEnd();\n        }\n    }\n\n    public class GenericBeanDeserializer implements JsonbDeserializer<GenericBean> {\n\n        private Boolean called = Boolean.FALSE;\n\n        @Override\n        public GenericBean deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {\n            called = Boolean.TRUE;\n            JsonObject json = parser.getObject();\n            GenericBean<String> bean = new GenericBean<>();\n            bean.value = json.getString(\"value\");\n            return bean;\n        }\n    }\n\n    @Test\n    public void testCustomDeserializerWithParameterizedType() {\n\n        GenericBeanSerializer genericBeanSerializer = new GenericBeanSerializer();\n        GenericBeanDeserializer genericBeanDeserializer = new GenericBeanDeserializer();\n\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withDeserializers(genericBeanDeserializer).withSerializers(genericBeanSerializer));\n\n        GenericBean<String> bean1 = new GenericBean<>();\n        bean1.value = \"test1\";\n        GenericBean<String> bean2 = new GenericBean<>();\n        bean2.value = \"test2\";\n        GenericBean<String> bean3 = new GenericBean<>();\n        bean3.value = \"test3\";\n\n        Collection<GenericBean<String>> asList = Arrays.asList(bean1, bean2, bean3);\n\n        String toJson = jsonb.toJson(asList);\n\n        assertEquals(toJson, \"[{\\\"value\\\":\\\"test1\\\"},{\\\"value\\\":\\\"test2\\\"},{\\\"value\\\":\\\"test3\\\"}]\");\n        assertTrue(genericBeanSerializer.called);\n\n        List<GenericBean<String>> fromJson = jsonb.fromJson(\n                toJson,\n                new ParameterizedType() {\n            @Override\n            public Type[] getActualTypeArguments() {\n                return new Type[]{GenericBean.class};\n            }\n\n            @Override\n            public Type getRawType() {\n                return Collection.class;\n            }\n\n            @Override\n            public Type getOwnerType() {\n                return null;\n            }\n        }\n        );\n\n        assertEquals(asList, fromJson);\n        assertTrue(genericBeanDeserializer.called);\n\n    }\n\n    @Test\n    public void testImplicitJsonbSerializers() {\n        Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withSerializers(new ExplicitJsonbSerializer()));\n        String expected = \"{\\\"value\\\":\\\"123\\\"}\";\n        Box box = new Box();\n        box.boxStr = \"Box\";\n        assertEquals(expected, jsonb.toJson(box));\n\n        jsonb = JsonbBuilder.create(new JsonbConfig().withSerializers(new ImplicitJsonbSerializer()));\n        assertEquals(expected, jsonb.toJson(box));\n    }\n\n    @Test\n    public void testBoxToArrayChained() {\n        JsonbConfig cfg = new JsonbConfig().withSerializers(BOX_ARRAY_SERIALIZER_CHAINED);\n        Jsonb jsonb = JsonbBuilder.create(cfg);\n        Box box = new Box();\n        box.boxStr = \"str1\";\n        box.secondBoxStr = \"str2\";\n        String expected = \"[\\\"str1\\\",\\\"str2\\\"]\";\n\n        assertThat(jsonb.toJson(box), is(expected));\n    }\n\n    @Test\n    public void testBoxToArray() {\n        JsonbConfig cfg = new JsonbConfig().withSerializers(BOX_ARRAY_SERIALIZER);\n        Jsonb jsonb = JsonbBuilder.create(cfg);\n        Box box = new Box();\n        box.boxStr = \"str1\";\n        box.secondBoxStr = \"str2\";\n        String expected = \"[\\\"str1\\\",\\\"str2\\\"]\";\n\n        assertThat(jsonb.toJson(box), is(expected));\n    }\n\n    @Test\n    public void testCustomSerializersInContainer(){\n        Jsonb jsonb = JsonbBuilder.create();\n\n        Container expected = new Container(List.of(new Containee(\"k\", \"v\")));\n\n        String expectedJson = jsonb.toJson(expected);\n        System.out.println(expectedJson);\n\n        assertEquals(expected, jsonb.fromJson(expectedJson, Container.class));\n\n    }\n\n    /**\n     * Test that annotation-based serializers work when property is declared as Object\n     * but the runtime type has @JsonbTypeSerializer annotation.\n     * This is a regression test for issue #689.\n     */\n    @Test\n    public void testAnnotationBasedSerializerWithObjectTypedProperty() throws Exception {\n        try (Jsonb jsonb = JsonbBuilder.create()) {\n\n            final ObjectPropertyContainer container = new ObjectPropertyContainer();\n            final AnnotatedWithSerializerType objectInstance = new AnnotatedWithSerializerType();\n            objectInstance.value = \"test\";\n            container.annotatedAsObject = objectInstance;\n            container.annotatedConcrete = new AnnotatedWithSerializerType();\n            container.annotatedConcrete.value = \"test2\";\n\n            final String result = jsonb.toJson(container);\n\n            // Both properties should use the annotation-based serializer\n            final String expected = \"{\\\"annotatedAsObject\\\":{\\\"valueField\\\":\\\"replaced value\\\"},\\\"annotatedConcrete\\\":{\\\"valueField\\\":\\\"replaced value\\\"}}\";\n            assertEquals(expected, result);\n\n            // Deserialization: annotatedConcrete uses annotation-based deserializer\n            // annotatedAsObject is declared as Object so JSON-B creates a HashMap (expected behavior)\n            final ObjectPropertyContainer deserialized = jsonb.fromJson(expected, ObjectPropertyContainer.class);\n            //  In the JSON, the type looks like an object and therefore is a map\n            assertInstanceOf(Map.class, deserialized.annotatedAsObject, \"Object property deserializes to Map\");\n            final Map<?, ?> map =  (Map<?, ?>) deserialized.annotatedAsObject;\n            assertTrue(map.containsKey(\"valueField\"));\n            assertEquals(\"replaced value\", map.get(\"valueField\"));\n            assertEquals(\"replaced value\", deserialized.annotatedConcrete.value);\n        }\n    }\n\n    /**\n     * Test that field-level and method-level @JsonbTypeSerializer annotations work on Object-typed properties.\n     * This tests existing AnnotationIntrospector code (not runtime discovery).\n     */\n    @Test\n    public void testFieldAndMethodLevelSerializerOnObjectType() throws Exception {\n        try (Jsonb jsonb = JsonbBuilder.create()) {\n            final ObjectWithAnnotatedFields container = new ObjectWithAnnotatedFields();\n            container.fieldAnnotated = \"test field\";\n            container.setMethodAnnotated(\"test method\");\n\n            final String result = jsonb.toJson(container);\n\n            // Both should use their respective serializers\n            final String expected = \"{\\\"fieldAnnotated\\\":\\\"FIELD:test field\\\",\\\"methodAnnotated\\\":\\\"METHOD:test method\\\"}\";\n            assertEquals(expected, result);\n        }\n    }\n\n    public static class ObjectWithAnnotatedFields {\n        @JsonbTypeSerializer(ObjectFieldSerializer.class)\n        public Object fieldAnnotated;\n\n        private Object methodAnnotated;\n\n        @JsonbTypeSerializer(ObjectMethodSerializer.class)\n        public Object getMethodAnnotated() {\n            return methodAnnotated;\n        }\n\n        public void setMethodAnnotated(Object methodAnnotated) {\n            this.methodAnnotated = methodAnnotated;\n        }\n    }\n\n    public static class ObjectFieldSerializer implements JsonbSerializer<Object> {\n        @Override\n        public void serialize(Object obj, JsonGenerator generator, SerializationContext ctx) {\n            generator.write(\"FIELD:\" + obj.toString());\n        }\n    }\n\n    public static class ObjectMethodSerializer implements JsonbSerializer<Object> {\n        @Override\n        public void serialize(Object obj, JsonGenerator generator, SerializationContext ctx) {\n            generator.write(\"METHOD:\" + obj.toString());\n        }\n    }\n\n    public static class ObjectPropertyContainer {\n        public Object annotatedAsObject;  // Declared as Object - this was the bug scenario\n        public AnnotatedWithSerializerType annotatedConcrete;  // Declared concretely - should always work\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/TypeDeserializerOnContainersTest.java",
    "content": "/*\n * Copyright (c) 2025 IBM and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers;\n\nimport java.lang.reflect.Type;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbConfig;\nimport jakarta.json.bind.annotation.JsonbTypeDeserializer;\nimport jakarta.json.bind.config.BinaryDataStrategy;\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.stream.JsonParser;\nimport org.junit.jupiter.api.AfterEach;\nimport org.junit.jupiter.api.Assertions;\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Tests that {@link jakarta.json.bind.annotation.JsonbTypeDeserializer @JsonbTypeDeserializer} annotated types are\n * properly detected and used when those types are used as elements/values in containers (Maps, Collections,\n * Arrays, Optionals).\n *\n * @author <a href=\"mailto:jperkins@ibm.com\">James R. Perkins</a>\n */\npublic class TypeDeserializerOnContainersTest {\n\n    // Test interface with type-level deserializer annotation\n    @JsonbTypeDeserializer(TestInterfaceDeserializer.class)\n    public interface TestInterface {\n        String getValue();\n    }\n\n    // Implementation of the test interface\n    public static class TestImpl implements TestInterface {\n        private final String value;\n\n        public TestImpl(final String value) {\n            this.value = value;\n        }\n\n        @Override\n        public String getValue() {\n            return value;\n        }\n    }\n\n    // Custom deserializer for TestInterface\n    public static class TestInterfaceDeserializer implements JsonbDeserializer<TestInterface> {\n        @Override\n        public TestInterface deserialize(final JsonParser parser, final DeserializationContext ctx, final Type rtType) {\n            // Parse the JSON object to get the value field\n            Assertions.assertTrue(parser.hasNext(), \"Expected the key name\");\n            parser.next();\n            Assertions.assertTrue(parser.hasNext(), \"Expected the value\");\n            parser.next();\n            final String value = parser.getString();\n            Assertions.assertTrue(parser.hasNext(), \"Expected the end of an object\");\n            parser.next();\n            return new TestImpl(\"DESERIALIZED:\" + value);\n        }\n    }\n\n    // Container classes for testing\n    public static class MapContainer {\n        public Map<String, TestInterface> map;\n        public Map<?, ?> questionKeyMap;\n        public Map<String, ?> questionValueMap;\n    }\n\n    public static class ListContainer {\n        public List<TestInterface> list;\n        public List<?> questionList;\n    }\n\n    public static class ArrayContainer {\n        public TestInterface[] array;\n    }\n\n    @SuppressWarnings(\"OptionalUsedAsFieldOrParameterType\")\n    public static class OptionalContainer {\n        public Optional<TestInterface> optional;\n        public Optional<?> questionOptional;\n    }\n\n    public static class ByteArrayContainer {\n        public byte[] data;\n    }\n\n    private Jsonb jsonb;\n\n    @BeforeEach\n    public void createJsonb() {\n        // Create a new Jsonb for each test to avoid type caching\n        jsonb = JsonbBuilder.create();\n    }\n\n    @AfterEach\n    public void closeJsonb() throws Exception {\n        if (jsonb != null) {\n            jsonb.close();\n        }\n    }\n\n    @Test\n    public void testTypeDeserializerOnMapValues() {\n        final String json = \"{\\\"map\\\":{\\\"key1\\\":{\\\"value\\\":\\\"value1\\\"},\\\"key2\\\":{\\\"value\\\":\\\"value2\\\"}}, \\\"questionKeyMap\\\":{\\\"qKey1\\\":\\\"value1\\\",\\\"qKey2\\\":\\\"value2\\\"},\\\"questionValueMap\\\":{\\\"key1\\\":\\\"qValue1\\\",\\\"key2\\\":\\\"qValue2\\\"}}\";\n\n        final MapContainer result = jsonb.fromJson(json, MapContainer.class);\n\n        Assertions.assertNotNull(result.map);\n        Assertions.assertEquals(2, result.map.size(), () -> String.format(\"Expected two entries got %s\", result.map));\n        Assertions.assertEquals(\"DESERIALIZED:value1\", result.map.get(\"key1\").getValue());\n        Assertions.assertEquals(\"DESERIALIZED:value2\", result.map.get(\"key2\").getValue());\n\n        Assertions.assertNotNull(result.questionKeyMap);\n        Assertions.assertEquals(2, result.questionKeyMap.size(), () -> String.format(\"Expected two entries got %s\", result.questionKeyMap));\n        Assertions.assertEquals(\"value1\", result.questionKeyMap.get(\"qKey1\"));\n        Assertions.assertEquals(\"value2\", result.questionKeyMap.get(\"qKey2\"));\n\n        Assertions.assertNotNull(result.questionValueMap);\n        Assertions.assertEquals(2, result.questionValueMap.size(), () -> String.format(\"Expected two entries got %s\", result.questionValueMap));\n        Assertions.assertEquals(\"qValue1\", result.questionValueMap.get(\"key1\"));\n        Assertions.assertEquals(\"qValue2\", result.questionValueMap.get(\"key2\"));\n    }\n\n    @Test\n    public void testTypeDeserializerOnListElements() {\n        final String json = \"{\\\"list\\\":[{\\\"value\\\":\\\"value1\\\"},{\\\"value\\\":\\\"value2\\\"}], \\\"questionList\\\": [\\\"value1\\\", \\\"value2\\\"]}\";\n\n        final ListContainer result = jsonb.fromJson(json, ListContainer.class);\n\n        Assertions.assertNotNull(result.list);\n        Assertions.assertEquals(2, result.list.size(), () -> String.format(\"Expected two entries got %s\", result.list));\n        Assertions.assertEquals(\"DESERIALIZED:value1\", result.list.get(0).getValue());\n        Assertions.assertEquals(\"DESERIALIZED:value2\", result.list.get(1).getValue());\n\n        Assertions.assertNotNull(result.questionList);\n        Assertions.assertEquals(2, result.questionList.size(), () -> String.format(\"Expected two entries got %s\", result.questionList));\n        Assertions.assertEquals(\"value1\", result.questionList.get(0));\n        Assertions.assertEquals(\"value2\", result.questionList.get(1));\n    }\n\n    @Test\n    public void testTypeDeserializerOnArrayElements() {\n        final String json = \"{\\\"array\\\":[{\\\"value\\\":\\\"value1\\\"},{\\\"value\\\":\\\"value2\\\"}]}\";\n\n        final ArrayContainer result = jsonb.fromJson(json, ArrayContainer.class);\n\n        Assertions.assertNotNull(result.array);\n        Assertions.assertEquals(2, result.array.length, () -> String.format(\"Expected two entries got %s\", Arrays.toString(result.array)));\n        Assertions.assertEquals(\"DESERIALIZED:value1\", result.array[0].getValue());\n        Assertions.assertEquals(\"DESERIALIZED:value2\", result.array[1].getValue());\n    }\n\n    @Test\n    public void testTypeDeserializerOnOptionalValue() {\n        final String json = \"{\\\"optional\\\":{\\\"value\\\":\\\"value1\\\"},\\\"questionOptional\\\":\\\"value2\\\"}\";\n\n        final OptionalContainer result = jsonb.fromJson(json, OptionalContainer.class);\n\n        Assertions.assertNotNull(result.optional);\n        Assertions.assertTrue(result.optional.isPresent(), \"Expected value to be present, but the optional was empty.\");\n        Assertions.assertEquals(\"DESERIALIZED:value1\", result.optional.get().getValue());\n\n        Assertions.assertNotNull(result.questionOptional);\n        Assertions.assertTrue(result.questionOptional.isPresent(), \"Expected value to be present, but the optional was empty.\");\n        Assertions.assertEquals(\"value2\", result.questionOptional.get());\n    }\n\n    @Test\n    public void testTypeDeserializerOnByteArray() {\n        final String json = \"{\\\"data\\\":[1,2,3,4,5]}\";\n\n        final ByteArrayContainer result = jsonb.fromJson(json, ByteArrayContainer.class);\n\n        Assertions.assertNotNull(result.data);\n        Assertions.assertEquals(5, result.data.length);\n        Assertions.assertArrayEquals(new byte[]{1, 2, 3, 4, 5}, result.data);\n    }\n\n    @Test\n    public void testTypeDeserializerOnByteArrayWithBase64() throws Exception {\n        try (Jsonb base64Jsonb = JsonbBuilder.create(new JsonbConfig()\n                .withBinaryDataStrategy(BinaryDataStrategy.BASE_64))) {\n\n            // \"SGVsbG8=\" is \"Hello\" in base64\n            final String json = \"{\\\"data\\\":\\\"SGVsbG8=\\\"}\";\n\n            final ByteArrayContainer result = base64Jsonb.fromJson(json, ByteArrayContainer.class);\n\n            Assertions.assertNotNull(result.data);\n            Assertions.assertArrayEquals(\"Hello\".getBytes(), result.data);\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/TypeSerializerOnContainersTest.java",
    "content": "/*\n * Copyright (c) 2025 IBM and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers;\n\nimport java.io.StringReader;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.function.Supplier;\n\nimport jakarta.json.Json;\nimport jakarta.json.JsonArray;\nimport jakarta.json.JsonObject;\nimport jakarta.json.JsonReader;\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport jakarta.json.bind.JsonbException;\nimport jakarta.json.bind.annotation.JsonbTypeSerializer;\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\nimport org.junit.jupiter.api.AfterEach;\nimport org.junit.jupiter.api.Assertions;\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Tests that {@link jakarta.json.bind.annotation.JsonbTypeSerializer @JsonbTypeSerializer} annotated types are\n * properly detected and used when those types are used as elements/values in containers (Maps, Collections,\n * Arrays, Optionals).\n *\n * @author <a href=\"mailto:jperkins@ibm.com\">James R. Perkins</a>\n */\npublic class TypeSerializerOnContainersTest {\n\n    // Test interface with type-level serializer annotation\n    @JsonbTypeSerializer(TestInterfaceSerializer.class)\n    public interface TestInterface {\n        String getValue();\n    }\n\n    // Implementation of the test interface\n    public static class TestImpl implements TestInterface {\n        private final String value;\n\n        public TestImpl(final String value) {\n            this.value = value;\n        }\n\n        @Override\n        public String getValue() {\n            return value;\n        }\n    }\n\n    // Custom serializer for TestInterface\n    public static class TestInterfaceSerializer implements JsonbSerializer<TestInterface> {\n        @Override\n        public void serialize(final TestInterface obj, final JsonGenerator generator, final SerializationContext ctx) {\n            generator.write(\"SERIALIZED:\" + obj.getValue());\n        }\n    }\n\n    // Container classes for testing\n    public static class MapContainer {\n        public final Map<String, TestInterface> map;\n        public final Map<?, ?> questionKeyMap;\n        public final Map<String, ?> questionValueMap;\n\n        public MapContainer(final Map<String, TestInterface> map, final Map<?, ?> questionKeyMap, final Map<String, ?> questionValueMap) {\n            this.map = map;\n            this.questionKeyMap = questionKeyMap;\n            this.questionValueMap = questionValueMap;\n        }\n    }\n\n    public static class ListContainer {\n        public final List<TestInterface> list;\n        public final List<?> questionList;\n\n        public ListContainer(final List<TestInterface> list, final List<?> questionList) {\n            this.list = list;\n            this.questionList = questionList;\n        }\n    }\n\n    public static class ArrayContainer {\n        public final TestInterface[] array;\n\n        public ArrayContainer(TestInterface[] array) {\n            this.array = array;\n        }\n    }\n\n    @SuppressWarnings(\"OptionalUsedAsFieldOrParameterType\")\n    public static class OptionalContainer {\n        public final Optional<TestInterface> optional;\n        public final Optional<?> questionOptional;\n\n        public OptionalContainer(final Optional<TestInterface> optional, final Optional<?> questionOptional) {\n            this.optional = optional;\n            this.questionOptional = questionOptional;\n        }\n    }\n\n    private Jsonb jsonb;\n\n    @BeforeEach\n    public void createJsonb() {\n        // Create a new Jsonb for each test to avoid type caching\n        jsonb = JsonbBuilder.create();\n    }\n\n    @AfterEach\n    public void closeJsonb() throws Exception {\n        if (jsonb != null) {\n            jsonb.close();\n        }\n    }\n\n    @Test\n    public void testTypeSerializerOnMapValues() {\n        final MapContainer container = new MapContainer(Map.of(\n                \"key1\", new TestImpl(\"value1\"),\n                \"key2\", new TestImpl(\"value2\")\n        ), Map.of(\"qKey1\", \"value1\", \"qKey2\", \"value2\"),\n                Map.of(\"key1\", \"qValue1\", \"key2\", \"qValue2\")\n        );\n\n        final JsonObject json = toJsonObject(container);\n        final JsonObject map = json.getJsonObject(\"map\");\n        final JsonObject questionKeyMap = json.getJsonObject(\"questionKeyMap\");\n        final JsonObject questionValueMap = json.getJsonObject(\"questionValueMap\");\n\n        Supplier<String> errorMessage = () -> String.format(\"Expected value not found in %s\", map);\n        Assertions.assertEquals(\"SERIALIZED:value1\", map.getString(\"key1\"), errorMessage);\n        Assertions.assertEquals(\"SERIALIZED:value2\", map.getString(\"key2\"), errorMessage);\n\n\n        errorMessage = () -> String.format(\"Expected value not found in %s\", questionKeyMap);\n        Assertions.assertEquals(\"value1\", questionKeyMap.getString(\"qKey1\"), errorMessage);\n        Assertions.assertEquals(\"value2\", questionKeyMap.getString(\"qKey2\"), errorMessage);\n\n\n        errorMessage = () -> String.format(\"Expected value not found in %s\", questionValueMap);\n        Assertions.assertEquals(\"qValue1\", questionValueMap.getString(\"key1\"), errorMessage);\n        Assertions.assertEquals(\"qValue2\", questionValueMap.getString(\"key2\"), errorMessage);\n    }\n\n    @Test\n    public void testTypeSerializerOnListElements() {\n        final ListContainer container = new ListContainer(List.of(\n                new TestImpl(\"value1\"),\n                new TestImpl(\"value2\")\n        ), List.of(\"qValue1\", \"qValue2\"));\n\n        final JsonObject json = toJsonObject(container);\n        final JsonArray list = json.getJsonArray(\"list\");\n        final JsonArray questionList = json.getJsonArray(\"questionList\");\n\n        Supplier<String> errorMessage = () -> String.format(\"Expected value not found in %s\", list);\n        Assertions.assertEquals(2, list.size(), () -> String.format(\"Expected a size of 2 in %s\", list));\n        Assertions.assertEquals(\"SERIALIZED:value1\", list.getString(0), errorMessage);\n        Assertions.assertEquals(\"SERIALIZED:value2\", list.getString(1), errorMessage);\n\n        errorMessage = () -> String.format(\"Expected value not found in %s\", questionList);\n        Assertions.assertEquals(2, questionList.size(), () -> String.format(\"Expected a size of 2 in %s\", questionList));\n        Assertions.assertEquals(\"qValue1\", questionList.getString(0), errorMessage);\n        Assertions.assertEquals(\"qValue2\", questionList.getString(1), errorMessage);\n    }\n\n    @Test\n    public void testTypeSerializerOnArrayElements() {\n        final ArrayContainer container = new ArrayContainer(new TestInterface[] {\n                new TestImpl(\"value1\"),\n                new TestImpl(\"value2\")\n        });\n\n        final String json = jsonb.toJson(container);\n\n        Assertions.assertEquals(\"{\\\"array\\\":[\\\"SERIALIZED:value1\\\",\\\"SERIALIZED:value2\\\"]}\", json);\n    }\n\n    @Test\n    public void testTypeSerializerOnOptionalValue() {\n        final OptionalContainer container = new OptionalContainer(Optional.of(new TestImpl(\"value1\")), Optional.of(\"value2\"));\n\n        final JsonObject json = toJsonObject(container);\n\n        Assertions.assertEquals(\"SERIALIZED:value1\", json.getString(\"optional\"));\n        Assertions.assertEquals(\"value2\", json.getString(\"questionOptional\"));\n    }\n\n    private JsonObject toJsonObject(final Object object) throws JsonbException {\n        final String value = jsonb.toJson(object);\n        try (\n                StringReader reader = new StringReader(value);\n                JsonReader jsonReader = Json.createReader(reader)\n        ) {\n            return jsonReader.readObject();\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/AbstractJsonbSerializer.java",
    "content": "/*\n * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.Json;\nimport jakarta.json.JsonStructure;\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\n\n/**\n * Abstract serializer.\n */\npublic class AbstractJsonbSerializer<T> implements JsonbSerializer<T> {\n    @Override\n    public void serialize(T obj, JsonGenerator generator, SerializationContext ctx) {\n        JsonStructure json = Json.createObjectBuilder().add(\"value\", \"123\").build();\n        generator.write(json);\n    }\n}"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/AnnotatedGenericWithSerializerType.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.annotation.JsonbTypeDeserializer;\nimport jakarta.json.bind.annotation.JsonbTypeSerializer;\n\n@JsonbTypeSerializer(AnnotatedGenericWithSerializerTypeSerializer.class)\n@JsonbTypeDeserializer(AnnotatedGenericWithSerializerTypeDeserializer.class)\npublic class AnnotatedGenericWithSerializerType<T> {\n\n    public T value;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/AnnotatedGenericWithSerializerTypeDeserializer.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport static org.junit.jupiter.api.Assertions.*;\n\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.stream.JsonParser;\nimport jakarta.json.stream.JsonParser.Event;\n\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\n\npublic class AnnotatedGenericWithSerializerTypeDeserializer implements JsonbDeserializer<AnnotatedGenericWithSerializerType<?>> {\n\n    @Override\n    public AnnotatedGenericWithSerializerType<?> deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {\n        AnnotatedGenericWithSerializerType<?> result = new AnnotatedGenericWithSerializerType<>();\n        assertEquals(Event.KEY_NAME, parser.next());\n        assertEquals(\"generic\", parser.getString());\n        result.value = ctx.deserialize(((ParameterizedType) rtType).getActualTypeArguments()[0], parser);\n        return result;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/AnnotatedGenericWithSerializerTypeSerializer.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\n\npublic class AnnotatedGenericWithSerializerTypeSerializer implements JsonbSerializer<AnnotatedGenericWithSerializerType<?>> {\n\n    @Override\n    public void serialize(AnnotatedGenericWithSerializerType<?> obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.writeStartObject();\n        ctx.serialize(\"generic\", obj.value, generator);\n        generator.writeEnd();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/AnnotatedWithSerializerType.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.annotation.JsonbTypeDeserializer;\nimport jakarta.json.bind.annotation.JsonbTypeSerializer;\n\n/**\n * @author Roman Grigoriadi\n */\n@JsonbTypeSerializer(AnnotatedWithSerializerTypeSerializer.class)\n@JsonbTypeDeserializer(AnnotatedWithSerializerTypeDeserializer.class)\npublic class AnnotatedWithSerializerType {\n\n    public String value;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/AnnotatedWithSerializerTypeDeserializer.java",
    "content": "/*\n * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.stream.JsonParser;\nimport java.lang.reflect.Type;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class AnnotatedWithSerializerTypeDeserializer implements JsonbDeserializer<AnnotatedWithSerializerType> {\n    /**\n     * Deserialize an object from JSON.\n     * Cursor of JsonParser is at START_OBJECT.\n     *\n     * @param parser Json parser\n     * @param ctx    Deserialization context\n     * @param rtType type of returned object\n     * @return deserialized instance\n     */\n    @Override\n    public AnnotatedWithSerializerType deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {\n        AnnotatedWithSerializerType result = new AnnotatedWithSerializerType();\n        parser.next();\n        parser.next();\n        result.value = parser.getString();\n        return result;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/AnnotatedWithSerializerTypeSerializer.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class AnnotatedWithSerializerTypeSerializer implements JsonbSerializer<AnnotatedWithSerializerType> {\n\n    @Override\n    public void serialize(AnnotatedWithSerializerType obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.writeStartObject();\n        generator.write(\"valueField\", \"replaced value\");\n        generator.writeEnd();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/AnnotatedWithSerializerTypeSerializerOverride.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class AnnotatedWithSerializerTypeSerializerOverride implements JsonbSerializer<AnnotatedWithSerializerType> {\n\n    @Override\n    public void serialize(AnnotatedWithSerializerType obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.writeStartObject();\n        generator.write(\"valueField\", \"overridden value\");\n        generator.writeEnd();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/Author.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.annotation.JsonbTypeDeserializer;\nimport jakarta.json.bind.annotation.JsonbTypeSerializer;\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\nimport jakarta.json.stream.JsonParser;\nimport java.lang.reflect.Type;\n\npublic class Author {\n\n    public static final class FirstNameSerializer implements JsonbSerializer<String> {\n\n        @Override\n        public void serialize(String obj, JsonGenerator generator, SerializationContext ctx) {\n            generator.write(obj.substring(0, 1));\n        }\n    }\n\n    public static final class FirstNameDeserializer implements JsonbDeserializer<String> {\n        @Override\n        public String deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {\n            return \"John\";\n        }\n    }\n\n\n    @JsonbTypeSerializer(FirstNameSerializer.class)\n    @JsonbTypeDeserializer(FirstNameDeserializer.class)\n    private String firstName;\n\n    private String lastName;\n\n    public Author() {\n    }\n\n    public Author(String firstName, String lastName) {\n        this.firstName = firstName;\n        this.lastName = lastName;\n    }\n\n    public String getFirstName() {\n        return firstName;\n    }\n\n    public void setFirstName(String firstName) {\n        this.firstName = firstName;\n    }\n\n    public String getLastName() {\n        return lastName;\n    }\n\n    public void setLastName(String lastName) {\n        this.lastName = lastName;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/Box.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class Box {\n\n    public String boxStr;\n\n    public Crate crate;\n\n    public String secondBoxStr;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/BoxWithAnnotations.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.annotation.JsonbTypeDeserializer;\nimport jakarta.json.bind.annotation.JsonbTypeSerializer;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class BoxWithAnnotations {\n\n    public String boxStr;\n\n    @JsonbTypeSerializer(CrateSerializerWithConversion.class)\n    @JsonbTypeDeserializer(CrateDeserializer.class)\n    public Crate crate;\n\n\n    public String secondBoxStr;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/Containee.java",
    "content": "/*\n * Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport java.util.Objects;\n\nimport jakarta.json.bind.annotation.JsonbTypeDeserializer;\nimport jakarta.json.bind.annotation.JsonbTypeSerializer;\n\n@JsonbTypeDeserializer(ContaineeDeserializer.class)\n@JsonbTypeSerializer(ContaineeSerializer.class)\npublic class Containee {\n    final String key;\n    final String value;\n\n    public Containee(String key, String value) {\n        this.key = key;\n        this.value = value;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        Containee containee = (Containee) o;\n        return Objects.equals(key, containee.key) && Objects.equals(value, containee.value);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(key, value);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/ContaineeDeserializer.java",
    "content": "/*\n * Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport java.lang.reflect.Type;\n\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.stream.JsonParser;\n\npublic class ContaineeDeserializer implements JsonbDeserializer<Containee> {\n\n    @Override\n    public Containee deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {\n        String key = null;\n        String value = \"\";\n        while (parser.hasNext()) {\n            var event = parser.next();\n            if (event == JsonParser.Event.KEY_NAME && parser.getString().equals(\"key\")) {\n                parser.next(); // move to VALUE\n                key = parser.getString();\n            } else if (event == JsonParser.Event.KEY_NAME && parser.getString().equals(\"value\")) {\n                parser.next(); // move to VALUE\n                value = parser.getString();\n            }\n        }\n        assert key != null;\n        return new Containee(key, value);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/ContaineeSerializer.java",
    "content": "/*\n * Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\n\npublic class ContaineeSerializer implements JsonbSerializer<Containee> {\n\n    @Override\n    public void serialize(Containee obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.writeStartObject();\n        generator.write(\"key\", obj.key);\n        generator.write(\"value\", obj.value);\n        generator.writeEnd();\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/Container.java",
    "content": "/*\n * Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Objects;\n\npublic class Container {\n\n    private List<Containee> containees;\n\n    public Container() {\n        containees = new ArrayList<>();\n    }\n\n    public Container(List<Containee> containees) {\n        this.containees = containees;\n    }\n\n    public void setContainees(List<Containee> containees) {\n        this.containees = containees;\n    }\n\n    public List<Containee> getContainees() {\n        return containees;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        Container container = (Container) o;\n        return Objects.equals(containees, container.containees);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(containees);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/Crate.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport jakarta.json.bind.annotation.JsonbTypeSerializer;\nimport java.math.BigDecimal;\nimport java.util.Date;\nimport java.util.List;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class Crate {\n\n    @JsonbProperty(\"crate_str\")\n    public String crateStr;\n\n    public CrateInner crateInner;\n\n    public List<CrateInner> crateInnerList;\n\n    public BigDecimal crateBigDec;\n\n    @JsonbDateFormat(\"dd.MM.yyy ^ HH:mm:ss\")\n    public Date date;\n\n    public AnnotatedWithSerializerType annotatedType;\n\n    public AnnotatedGenericWithSerializerType<Crate> annotatedGenericType;\n\n    @JsonbTypeSerializer(AnnotatedWithSerializerTypeSerializerOverride.class)\n    public AnnotatedWithSerializerType annotatedTypeOverriddenOnProperty;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/CrateDeserializer.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport org.eclipse.yasson.TestTypeToken;\n\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.stream.JsonParser;\nimport java.lang.reflect.Type;\nimport java.math.BigDecimal;\nimport java.util.ArrayList;\nimport java.util.Date;\n\n\npublic class CrateDeserializer implements JsonbDeserializer<Crate> {\n\n    @Override\n    public Crate deserialize(JsonParser jsonParser, DeserializationContext ctx, Type rtType) {\n        Crate crate = new Crate();\n        crate.crateStr = \"abc\";\n        crate.crateBigDec = new BigDecimal(\"123\");\n\n        while (jsonParser.hasNext()) {\n            JsonParser.Event next = jsonParser.next();\n            if (next.equals(JsonParser.Event.KEY_NAME) && jsonParser.getString().equals(\"crateInner\")) {\n                //invokes JSONB processing for a CrateInner as a root type with \"shared\" instance of JsonParser\n                crate.crateInner = ctx.deserialize(CrateInner.class, jsonParser);\n                continue;\n            }\n            if (next.equals(JsonParser.Event.KEY_NAME) && jsonParser.getString().equals(\"crateInnerList\")) {\n                //invokes JSONB processing for a CrateInner as a root type with \"shared\" instance of JsonParser\n                crate.crateInnerList = ctx.deserialize(new TestTypeToken<ArrayList<CrateInner>>(){}.getType(), jsonParser);\n                continue;\n            }\n            if (next.equals(JsonParser.Event.KEY_NAME) && jsonParser.getString().equals(\"date\")) {\n                //move to value\n                jsonParser.next();\n                //don't have context of processing here, no annotation customizations applied.\n//                crate.date = ctx.convertDefault(Date.class, jsonParser.getString());\n                ctx.deserialize(Date.class, jsonParser);\n            }\n\n        }\n\n        return crate;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/CrateDeserializerWithConversion.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.stream.JsonParser;\nimport java.lang.reflect.Type;\nimport java.util.Date;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class CrateDeserializerWithConversion implements JsonbDeserializer<Crate> {\n\n    @Override\n    public Crate deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {\n        Crate result = new Crate();\n        while (parser.hasNext()) {\n            final JsonParser.Event next = parser.next();\n            if (next.equals(JsonParser.Event.KEY_NAME) && parser.getString().equals(\"date-converted\")) {\n                parser.next();\n                result.date = ctx.deserialize(Date.class, parser);\n                break;\n            }\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/CrateInner.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.annotation.JsonbDateFormat;\nimport jakarta.json.bind.annotation.JsonbProperty;\nimport java.math.BigDecimal;\nimport java.util.Date;\n\n/**\n * @author Roman Grigoriadi\n */\n@JsonbDateFormat(\"dd.MM.yyyy || HH:mm:ss\")\npublic class CrateInner {\n\n    @JsonbProperty(\"crate_inner_str\")\n    public String crateInnerStr;\n\n    public BigDecimal crateInnerBigDec;\n\n    public Date date;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/CrateJsonObjectDeserializer.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.JsonObject;\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.stream.JsonParser;\nimport java.lang.reflect.Type;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class CrateJsonObjectDeserializer implements JsonbDeserializer<Crate> {\n\n    /**\n     * Deserialize an object from JSON.\n     * Cursor of JsonParser is at START_OBJECT.\n     *\n     * @param parser Json parser\n     * @param ctx    Deserialization context\n     * @param rtType type of returned object\n     * @return deserialized instance\n     */\n    @Override\n    public Crate deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {\n        JsonObject crateJsonObject = ctx.deserialize(JsonObject.class, parser);\n        Crate crate = new Crate();\n        crate.crateInner = new CrateInner();\n        crate.crateInner.crateInnerStr = crateJsonObject.getJsonObject(\"crateInner\").getString(\"crateInnerStr\");\n        crate.crateInner.crateInnerBigDec = crateJsonObject.getJsonObject(\"crateInner\").getJsonNumber(\"crateInnerBigDec\").bigDecimalValue();\n        crate.crateStr = crateJsonObject.getString(\"crateStr\");\n        crate.crateBigDec = crateJsonObject.getJsonNumber(\"crateBigDec\").bigDecimalValue();\n        return crate;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/CrateSerializer.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\nimport java.math.BigDecimal;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class CrateSerializer implements JsonbSerializer<Crate> {\n\n    @Override\n    public void serialize(Crate obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.writeStartObject();\n        generator.write(\"crateStr\", \"REPLACED crate str\");\n        ctx.serialize(\"crateInner\", obj.crateInner, generator);\n        ctx.serialize(\"crateInnerList\", obj.crateInnerList, generator);\n        generator.write(\"crateBigDec\", new BigDecimal(\"54321\"));\n        generator.writeEnd();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/CrateSerializerWithConversion.java",
    "content": "/*\n * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\nimport java.math.BigDecimal;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class CrateSerializerWithConversion extends CrateSerializer {\n\n    @Override\n    public void serialize(Crate obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.writeStartObject();\n        generator.write(\"crateStr\", \"REPLACED crate str\");\n        ctx.serialize(\"crateInner\", obj.crateInner, generator);\n        ctx.serialize(\"crateInnerList\", obj.crateInnerList, generator);\n        generator.write(\"crateBigDec\", new BigDecimal(\"54321\"));\n        ctx.serialize(\"date-converted\", obj.date, generator);\n        generator.writeEnd();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/ExplicitJsonbSerializer.java",
    "content": "/*\n * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\n\n/**\n * Explicit serializer.\n */\npublic class ExplicitJsonbSerializer extends AbstractJsonbSerializer<Box> implements JsonbSerializer<Box> {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/GenericPropertyPojo.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.annotation.JsonbTypeSerializer;\n\n@JsonbTypeSerializer(GenericPropertyPojoSerializer.class)\npublic class GenericPropertyPojo<T> {\n    private T property;\n\n    public T getProperty() {\n        return property;\n    }\n\n    public void setProperty(T property) {\n        this.property = property;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/GenericPropertyPojoSerializer.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\n\npublic class GenericPropertyPojoSerializer implements JsonbSerializer<GenericPropertyPojo<Number>> {\n    @Override\n    public void serialize(GenericPropertyPojo<Number> obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.writeStartObject();\n        generator.writeKey(\"propertyByUserSerializer\");\n        generator.write(\"Number value [\" + obj.getProperty() + \"]\");\n        generator.writeEnd();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/ImplicitJsonbSerializer.java",
    "content": "/*\n * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\n/**\n * Implicit serializer.\n */\npublic class ImplicitJsonbSerializer extends AbstractJsonbSerializer<Box> {\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/NumberDeserializer.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.stream.JsonParser;\nimport java.lang.reflect.Type;\n\npublic class NumberDeserializer implements JsonbDeserializer<Number> {\n    @Override\n    public Number deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {\n        return Integer.valueOf(parser.getString()) - 1;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/NumberSerializer.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\n\npublic class NumberSerializer implements JsonbSerializer<Number> {\n    @Override\n    public void serialize(Number obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.write(Integer.valueOf(obj.intValue() + 1).toString());\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/Pokemon.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport java.util.Objects;\n\n/**\n * Serialization and de-serialization test model: {@code Pokemon}.\n */\npublic final class Pokemon {\n\tpublic String name;\n\tpublic String type;\n\tpublic int cp;\n\n\tpublic Pokemon() {\n\t\tthis.name = null;\n\t\tthis.type = null;\n\t\tthis.cp = -1;\n\t}\n\n\tpublic Pokemon(String name, String type, int cp) {\n\t\tthis.name = name;\n\t\tthis.type = type;\n\t\tthis.cp = cp;\n\t}\n\n    @Override\n    public boolean equals(Object other) {\n        if (this == other) {\n            return true;\n        }\n        if (!(other instanceof Pokemon)) {\n            return false;\n        }\n        Pokemon pokemon = (Pokemon)other;\n        return cp == pokemon.cp\n                && Objects.equals(name, pokemon.name)\n                && Objects.equals(type, pokemon.type);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(cp, name, type);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/RecursiveDeserializer.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.stream.JsonParser;\nimport java.lang.reflect.Type;\n\n/**\n * Causes {@link StackOverflowError} if recursive calls of user components are not checked by runtime.\n */\npublic class RecursiveDeserializer implements JsonbDeserializer<Box> {\n    @Override\n    public Box deserialize(JsonParser jsonParser, DeserializationContext deserializationContext, Type type) {\n        return deserializationContext.deserialize(type, jsonParser);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/RecursiveSerializer.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\n\n/**\n * Causes {@link StackOverflowError} if recursive calls of user components are not checked by runtime.\n */\npublic class RecursiveSerializer implements JsonbSerializer<Box> {\n    @Override\n    public void serialize(Box box, JsonGenerator jsonGenerator, SerializationContext serializationContext) {\n        jsonGenerator.writeStartObject();\n        serializationContext.serialize(\"boxFieldName\", box, jsonGenerator);\n        jsonGenerator.writeEnd();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/SimpleAnnotatedSerializedArrayContainer.java",
    "content": "/*\n * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\n/*\n * $Id$\n */\n\npackage org.eclipse.yasson.serializers.model;\n\n\n\nimport jakarta.json.bind.annotation.JsonbTypeDeserializer;\nimport jakarta.json.bind.annotation.JsonbTypeSerializer;\nimport java.util.List;\n\npublic class SimpleAnnotatedSerializedArrayContainer {\n    @JsonbTypeSerializer(SimpleContainerArraySerializer.class)\n    @JsonbTypeDeserializer(SimpleContainerArrayDeserializer.class)\n    private SimpleContainer[] arrayInstance;\n\n    private List<SimpleContainer> listInstance;\n\n    public SimpleContainer[] getArrayInstance() {\n        return arrayInstance;\n    }\n\n    public void setArrayInstance(SimpleContainer[] arrayInstance) {\n        this.arrayInstance = arrayInstance;\n    }\n\n    public List<SimpleContainer> getListInstance() {\n        return listInstance;\n    }\n\n    public void setListInstance(List<SimpleContainer> listInstance) {\n        this.listInstance = listInstance;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/SimpleContainer.java",
    "content": "/*\n * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\n/*\n * $Id$\n */\n\npackage org.eclipse.yasson.serializers.model;\n\n\n\npublic class SimpleContainer {\n    private String instance = \"Test\";\n\n    public SimpleContainer() {\n    }\n\n    public SimpleContainer(String instance) {\n        this.instance = instance;\n    }\n\n    public String getInstance() {\n        return instance;\n    }\n\n    public void setInstance(String instance) {\n        this.instance = instance;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/SimpleContainerArrayDeserializer.java",
    "content": "/*\n * Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\n/*\n * $Id$\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.DeserializationContext;\nimport jakarta.json.bind.serializer.JsonbDeserializer;\nimport jakarta.json.stream.JsonParser;\nimport java.lang.reflect.Type;\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class SimpleContainerArrayDeserializer implements JsonbDeserializer<SimpleContainer[]> {\n    public SimpleContainer[] deserialize(JsonParser jsonParser, DeserializationContext deserializationContext, Type type) {\n        List<SimpleContainer> containers = new ArrayList<>();\n\n        while (jsonParser.hasNext()) {\n            JsonParser.Event event = jsonParser.next();\n            if (event == JsonParser.Event.START_OBJECT) {\n                containers.add(deserializationContext.deserialize(new SimpleContainer(){}.getClass().getGenericSuperclass(), jsonParser));\n            }\n            if (event == JsonParser.Event.END_OBJECT) {\n                break;\n            }\n        }\n\n        return containers.toArray(new SimpleContainer[0]);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/SimpleContainerArraySerializer.java",
    "content": "/*\n * Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\n/*\n * $Id$\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\n\npublic class SimpleContainerArraySerializer implements JsonbSerializer<SimpleContainer[]> {\n    @Override\n    public void serialize(SimpleContainer[] containers, JsonGenerator jsonGenerator, SerializationContext serializationContext) {\n        jsonGenerator.writeStartArray();\n        for (SimpleContainer container : containers) {\n            serializationContext.serialize(container, jsonGenerator);\n        }\n        jsonGenerator.writeEnd();\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/StringPaddingSerializer.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.serializer.JsonbSerializer;\nimport jakarta.json.bind.serializer.SerializationContext;\nimport jakarta.json.stream.JsonGenerator;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class StringPaddingSerializer implements JsonbSerializer<String> {\n    @Override\n    public void serialize(String obj, JsonGenerator generator, SerializationContext ctx) {\n        generator.write(\"   \"+obj);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/StringWrapper.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.annotation.JsonbTypeSerializer;\n\n/**\n * @author Roman Grigoriadi\n */\npublic class StringWrapper {\n\n    @JsonbTypeSerializer(StringPaddingSerializer.class)\n    public String strField;\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/SupertypeSerializerPojo.java",
    "content": "/*\n * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport jakarta.json.bind.annotation.JsonbTypeDeserializer;\nimport jakarta.json.bind.annotation.JsonbTypeSerializer;\n\npublic class SupertypeSerializerPojo {\n\n\n    @JsonbTypeSerializer(NumberSerializer.class)\n    @JsonbTypeDeserializer(NumberDeserializer.class)\n    private Integer numberInteger;\n\n    //Serializers bound with JsonbConfig for this one.\n    private Integer anotherNumberInteger;\n\n    public Integer getNumberInteger() {\n        return numberInteger;\n    }\n\n    public void setNumberInteger(Integer numberInteger) {\n        this.numberInteger = numberInteger;\n    }\n\n    public Integer getAnotherNumberInteger() {\n        return anotherNumberInteger;\n    }\n\n    public void setAnotherNumberInteger(Integer anotherNumberInteger) {\n        this.anotherNumberInteger = anotherNumberInteger;\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/eclipse/yasson/serializers/model/Trainer.java",
    "content": "/*\n * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0,\n * or the Eclipse Distribution License v. 1.0 which is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n */\n\npackage org.eclipse.yasson.serializers.model;\n\nimport java.util.Objects;\n\n/**\n * Serialization and de-serialization test model: pokemon {@code Trainer}.\n */\npublic final class Trainer {\n    public String name;\n    public int age;\n\n    public Trainer() {\n        this.name = null;\n        this.age = -1;\n    }\n\n    public Trainer(String name, int age) {\n        this.name = name;\n        this.age = age;\n\t}\n\n\t@Override\n\tpublic boolean equals(Object other) {\n\t    if (this == other) {\n\t        return true;\n\t    }\n\t    if (!(other instanceof Trainer)) {\n\t        return false;\n\t    }\n\t    Trainer trainer = (Trainer)other;\n\t    return age == trainer.age && Objects.equals(name, trainer.name);\n\t}\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(age, name);\n    }\n\n}\n"
  },
  {
    "path": "src/test/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n\n    Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n\n    This program and the accompanying materials are made available under the\n    terms of the Eclipse Public License v. 2.0 which is available at\n    http://www.eclipse.org/legal/epl-2.0,\n    or the Eclipse Distribution License v. 1.0 which is available at\n    http://www.eclipse.org/org/documents/edl-v10.php.\n\n    SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n\n-->\n\n<beans xmlns=\"http://java.sun.com/xml/ns/javaee\" />\n"
  },
  {
    "path": "src/test/resources/jndi.properties",
    "content": "#\n# Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n#\n# This program and the accompanying materials are made available under the\n# terms of the Eclipse Public License v. 2.0 which is available at\n# http://www.eclipse.org/legal/epl-2.0,\n# or the Eclipse Distribution License v. 1.0 which is available at\n# http://www.eclipse.org/org/documents/edl-v10.php.\n#\n# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n#\n\njava.naming.factory.initial=org.eclipse.yasson.internal.cdi.MockJndiContextFactory\n"
  },
  {
    "path": "src/test/resources/logging.properties",
    "content": "#\n# Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n#\n# This program and the accompanying materials are made available under the\n# terms of the Eclipse Public License v. 2.0 which is available at\n# http://www.eclipse.org/legal/epl-2.0,\n# or the Eclipse Distribution License v. 1.0 which is available at\n# http://www.eclipse.org/org/documents/edl-v10.php.\n#\n# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n#\n\nhandlers=java.util.logging.ConsoleHandler\n.level=INFO\n\njava.util.logging.ConsoleHandler.level=INFO\njava.util.logging.ConsoleHandler.formatter=org.eclipse.yasson.logger.JsonbLoggerFormatter\n"
  },
  {
    "path": "src/test/resources/test.policy",
    "content": "grant {\n      //needed to be able to read all files including META-INF entries\n      permission \"java.io.FilePermission\" \"<<ALL FILES>>\", \"read\";\n\n      permission \"java.lang.reflect.ReflectPermission\" \"suppressAccessChecks\";\n      permission \"java.lang.RuntimePermission\" \"accessDeclaredMembers\";\n\n      permission \"java.lang.RuntimePermission\" \"createSecurityManager\";\n      permission java.lang.RuntimePermission \"setSecurityManager\";\n      permission \"java.lang.RuntimePermission\" \"getProtectionDomain\";\n      permission \"java.lang.RuntimePermission\" \"getClassLoader\";\n      permission \"java.util.PropertyPermission\" \"*\", \"write\";\n\n      permission \"java.util.PropertyPermission\" \"jsonb.creator-parameters-required\", \"read\";\n      permission \"java.util.PropertyPermission\" \"yasson.time-in-millis-as-a-string\", \"read\";\n      permission \"java.util.PropertyPermission\" \"jakarta.json.provider\", \"read\";\n};"
  },
  {
    "path": "src/test/resources/yasson-messages_cs.properties",
    "content": "#\n# Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.\n#\n# This program and the accompanying materials are made available under the\n# terms of the Eclipse Public License v. 2.0 which is available at\n# http://www.eclipse.org/legal/epl-2.0,\n# or the Eclipse Distribution License v. 1.0 which is available at\n# http://www.eclipse.org/org/documents/edl-v10.php.\n#\n# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause\n#\n\nprocessFromJson = Zpracovávám třídu: {0} z jsonu za použití convertoru: {1}\nprocessToJson = Zpracovávám třídu: {0} do jsonu za použití convertoru: {1}\n\ndiacriticsTest=p\\u0159\\u00edli\\u0161,\\u017elu\\u0165ou\\u010dk\\u00fd,k\\u016f\\u0148,\\u00fap\\u011bl,\\u010f\\u00e1belsk\\u00e9,\\u00f3dy\n"
  },
  {
    "path": "yasson-jmh/.gitignore",
    "content": "target/\n"
  },
  {
    "path": "yasson-jmh/README.md",
    "content": "#JMH performance tests for Yasson.\n\nBinaries for performance testing should never be uploaded into Maven repository.\n\nUse of JMH dependency is approved for testing purposes only as \"Works with\" CQ type, see:\n\n[jmh-core CQ](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18908),  \n[jmh-generator-annprocess CQ](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18909)\n\nTo run tests:\n - build it with maven\n - run from commandline\n\nFor all JMH options available:\n```\njava -jar target/yasson-jmh.jar -h\n```\n\nRun examples:\n```\njava -jar target/yasson-jmh.jar\njava -jar target/yasson-jmh.jar -i 3 -t 5 -f 3 -prof stack\njava -jar target/yasson-jmh.jar ScalarDataTest.testDeserialize\n```"
  },
  {
    "path": "yasson-jmh/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n\n    <modelVersion>4.0.0</modelVersion>\n\n    <groupId>org.eclipse.yasson</groupId>\n    <artifactId>yasson-jmh</artifactId>\n    <version>1.0-SNAPSHOT</version>\n    <description>This is a performance testing project for Yasson. It leverages a JMH technology.\n        See https://openjdk.java.net/projects/code-tools/jmh/.\n    </description>\n\n    <properties>\n        <jmh.version>1.21</jmh.version>\n        <yasson.version>2.0.2-SNAPSHOT</yasson.version>\n    </properties>\n\n\n    <dependencies>\n        <dependency>\n            <groupId>org.openjdk.jmh</groupId>\n            <artifactId>jmh-core</artifactId>\n            <version>${jmh.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.openjdk.jmh</groupId>\n            <artifactId>jmh-generator-annprocess</artifactId>\n            <version>${jmh.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.eclipse</groupId>\n            <artifactId>yasson</artifactId>\n            <version>${yasson.version}</version>\n        </dependency>\n    </dependencies>\n\n    <build>\n        <plugins>\n            <!-- Don't upload any files from these project. JMH dependencies are approved only for testing purposes. -->\n            <plugin>\n                <artifactId>maven-deploy-plugin</artifactId>\n                <configuration>\n                    <skip>true</skip>\n                </configuration>\n            </plugin>\n            <plugin>\n                <artifactId>maven-javadoc-plugin</artifactId>\n                <configuration>\n                    <skip>true</skip>\n                </configuration>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-compiler-plugin</artifactId>\n                <configuration>\n                    <source>11</source>\n                    <target>11</target>\n                </configuration>\n            </plugin>\n            <!--run `java -jar yasson-jmh.jar -h` for help -->\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-shade-plugin</artifactId>\n                <version>3.2.1</version>\n                <executions>\n                    <execution>\n                        <phase>package</phase>\n                        <goals>\n                            <goal>shade</goal>\n                        </goals>\n                        <configuration>\n                            <finalName>yasson-jmh</finalName>\n                            <transformers>\n                                <transformer\n                                        implementation=\"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer\">\n                                    <mainClass>org.openjdk.jmh.Main</mainClass>\n                                </transformer>\n                            </transformers>\n                            <filters>\n                                <filter>\n                                    <!--\n                                        Shading signed JARs will fail without this.\n                                        http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar\n                                    -->\n                                    <artifact>*:*</artifact>\n                                    <excludes>\n                                        <exclude>META-INF/*.SF</exclude>\n                                        <exclude>META-INF/*.DSA</exclude>\n                                        <exclude>META-INF/*.RSA</exclude>\n                                    </excludes>\n                                </filter>\n                            </filters>\n                        </configuration>\n                    </execution>\n                </executions>\n            </plugin>\n        </plugins>\n    </build>\n</project>\n"
  },
  {
    "path": "yasson-jmh/src/main/java/org/eclipse/yasson/jmh/CollectionsTest.java",
    "content": "package org.eclipse.yasson.jmh;\n\nimport org.eclipse.yasson.jmh.model.CollectionsData;\nimport org.eclipse.yasson.jmh.model.ScalarData;\nimport org.openjdk.jmh.annotations.*;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.concurrent.TimeUnit;\n\n/**\n * Tests for collections processing performance.\n */\n@BenchmarkMode(Mode.Throughput)\n@Timeout(time = 20)\n@State(Scope.Benchmark)\n@Warmup(iterations = 3)\n@OutputTimeUnit(TimeUnit.MILLISECONDS)\npublic class CollectionsTest {\n\n    private CollectionsData data;\n\n    private Jsonb jsonb;\n\n    private String json;\n\n    @Setup(Level.Trial)\n    public void setUp() {\n        data = new CollectionsData();\n        data.setListData(new ArrayList<>());\n        data.setSetData(new HashSet<>());\n        for (int i = 0; i < 50; i++) {\n            data.getListData().add(new ScalarData(\"strValue\" + i, i));\n            data.getSetData().add(new ScalarData(\"strValue\" + i, i));\n        }\n        jsonb = JsonbBuilder.create();\n        json = \"{\\\"listData\\\":[{\\\"integerValue\\\":0,\\\"stringValue\\\":\\\"strValue0\\\"},{\\\"integerValue\\\":1,\\\"stringValue\\\":\\\"strValue1\\\"},{\\\"integerValue\\\":2,\\\"stringValue\\\":\\\"strValue2\\\"},{\\\"integerValue\\\":3,\\\"stringValue\\\":\\\"strValue3\\\"},{\\\"integerValue\\\":4,\\\"stringValue\\\":\\\"strValue4\\\"},{\\\"integerValue\\\":5,\\\"stringValue\\\":\\\"strValue5\\\"},{\\\"integerValue\\\":6,\\\"stringValue\\\":\\\"strValue6\\\"},{\\\"integerValue\\\":7,\\\"stringValue\\\":\\\"strValue7\\\"},{\\\"integerValue\\\":8,\\\"stringValue\\\":\\\"strValue8\\\"},{\\\"integerValue\\\":9,\\\"stringValue\\\":\\\"strValue9\\\"},{\\\"integerValue\\\":10,\\\"stringValue\\\":\\\"strValue10\\\"},{\\\"integerValue\\\":11,\\\"stringValue\\\":\\\"strValue11\\\"},{\\\"integerValue\\\":12,\\\"stringValue\\\":\\\"strValue12\\\"},{\\\"integerValue\\\":13,\\\"stringValue\\\":\\\"strValue13\\\"},{\\\"integerValue\\\":14,\\\"stringValue\\\":\\\"strValue14\\\"},{\\\"integerValue\\\":15,\\\"stringValue\\\":\\\"strValue15\\\"},{\\\"integerValue\\\":16,\\\"stringValue\\\":\\\"strValue16\\\"},{\\\"integerValue\\\":17,\\\"stringValue\\\":\\\"strValue17\\\"},{\\\"integerValue\\\":18,\\\"stringValue\\\":\\\"strValue18\\\"},{\\\"integerValue\\\":19,\\\"stringValue\\\":\\\"strValue19\\\"},{\\\"integerValue\\\":20,\\\"stringValue\\\":\\\"strValue20\\\"},{\\\"integerValue\\\":21,\\\"stringValue\\\":\\\"strValue21\\\"},{\\\"integerValue\\\":22,\\\"stringValue\\\":\\\"strValue22\\\"},{\\\"integerValue\\\":23,\\\"stringValue\\\":\\\"strValue23\\\"},{\\\"integerValue\\\":24,\\\"stringValue\\\":\\\"strValue24\\\"},{\\\"integerValue\\\":25,\\\"stringValue\\\":\\\"strValue25\\\"},{\\\"integerValue\\\":26,\\\"stringValue\\\":\\\"strValue26\\\"},{\\\"integerValue\\\":27,\\\"stringValue\\\":\\\"strValue27\\\"},{\\\"integerValue\\\":28,\\\"stringValue\\\":\\\"strValue28\\\"},{\\\"integerValue\\\":29,\\\"stringValue\\\":\\\"strValue29\\\"},{\\\"integerValue\\\":30,\\\"stringValue\\\":\\\"strValue30\\\"},{\\\"integerValue\\\":31,\\\"stringValue\\\":\\\"strValue31\\\"},{\\\"integerValue\\\":32,\\\"stringValue\\\":\\\"strValue32\\\"},{\\\"integerValue\\\":33,\\\"stringValue\\\":\\\"strValue33\\\"},{\\\"integerValue\\\":34,\\\"stringValue\\\":\\\"strValue34\\\"},{\\\"integerValue\\\":35,\\\"stringValue\\\":\\\"strValue35\\\"},{\\\"integerValue\\\":36,\\\"stringValue\\\":\\\"strValue36\\\"},{\\\"integerValue\\\":37,\\\"stringValue\\\":\\\"strValue37\\\"},{\\\"integerValue\\\":38,\\\"stringValue\\\":\\\"strValue38\\\"},{\\\"integerValue\\\":39,\\\"stringValue\\\":\\\"strValue39\\\"},{\\\"integerValue\\\":40,\\\"stringValue\\\":\\\"strValue40\\\"},{\\\"integerValue\\\":41,\\\"stringValue\\\":\\\"strValue41\\\"},{\\\"integerValue\\\":42,\\\"stringValue\\\":\\\"strValue42\\\"},{\\\"integerValue\\\":43,\\\"stringValue\\\":\\\"strValue43\\\"},{\\\"integerValue\\\":44,\\\"stringValue\\\":\\\"strValue44\\\"},{\\\"integerValue\\\":45,\\\"stringValue\\\":\\\"strValue45\\\"},{\\\"integerValue\\\":46,\\\"stringValue\\\":\\\"strValue46\\\"},{\\\"integerValue\\\":47,\\\"stringValue\\\":\\\"strValue47\\\"},{\\\"integerValue\\\":48,\\\"stringValue\\\":\\\"strValue48\\\"},{\\\"integerValue\\\":49,\\\"stringValue\\\":\\\"strValue49\\\"}],\\\"setData\\\":[{\\\"integerValue\\\":36,\\\"stringValue\\\":\\\"strValue36\\\"},{\\\"integerValue\\\":21,\\\"stringValue\\\":\\\"strValue21\\\"},{\\\"integerValue\\\":38,\\\"stringValue\\\":\\\"strValue38\\\"},{\\\"integerValue\\\":25,\\\"stringValue\\\":\\\"strValue25\\\"},{\\\"integerValue\\\":32,\\\"stringValue\\\":\\\"strValue32\\\"},{\\\"integerValue\\\":9,\\\"stringValue\\\":\\\"strValue9\\\"},{\\\"integerValue\\\":42,\\\"stringValue\\\":\\\"strValue42\\\"},{\\\"integerValue\\\":35,\\\"stringValue\\\":\\\"strValue35\\\"},{\\\"integerValue\\\":6,\\\"stringValue\\\":\\\"strValue6\\\"},{\\\"integerValue\\\":43,\\\"stringValue\\\":\\\"strValue43\\\"},{\\\"integerValue\\\":37,\\\"stringValue\\\":\\\"strValue37\\\"},{\\\"integerValue\\\":27,\\\"stringValue\\\":\\\"strValue27\\\"},{\\\"integerValue\\\":2,\\\"stringValue\\\":\\\"strValue2\\\"},{\\\"integerValue\\\":1,\\\"stringValue\\\":\\\"strValue1\\\"},{\\\"integerValue\\\":24,\\\"stringValue\\\":\\\"strValue24\\\"},{\\\"integerValue\\\":28,\\\"stringValue\\\":\\\"strValue28\\\"},{\\\"integerValue\\\":29,\\\"stringValue\\\":\\\"strValue29\\\"},{\\\"integerValue\\\":23,\\\"stringValue\\\":\\\"strValue23\\\"},{\\\"integerValue\\\":12,\\\"stringValue\\\":\\\"strValue12\\\"},{\\\"integerValue\\\":22,\\\"stringValue\\\":\\\"strValue22\\\"},{\\\"integerValue\\\":49,\\\"stringValue\\\":\\\"strValue49\\\"},{\\\"integerValue\\\":5,\\\"stringValue\\\":\\\"strValue5\\\"},{\\\"integerValue\\\":44,\\\"stringValue\\\":\\\"strValue44\\\"},{\\\"integerValue\\\":41,\\\"stringValue\\\":\\\"strValue41\\\"},{\\\"integerValue\\\":45,\\\"stringValue\\\":\\\"strValue45\\\"},{\\\"integerValue\\\":0,\\\"stringValue\\\":\\\"strValue0\\\"},{\\\"integerValue\\\":18,\\\"stringValue\\\":\\\"strValue18\\\"},{\\\"integerValue\\\":8,\\\"stringValue\\\":\\\"strValue8\\\"},{\\\"integerValue\\\":10,\\\"stringValue\\\":\\\"strValue10\\\"},{\\\"integerValue\\\":33,\\\"stringValue\\\":\\\"strValue33\\\"},{\\\"integerValue\\\":30,\\\"stringValue\\\":\\\"strValue30\\\"},{\\\"integerValue\\\":13,\\\"stringValue\\\":\\\"strValue13\\\"},{\\\"integerValue\\\":16,\\\"stringValue\\\":\\\"strValue16\\\"},{\\\"integerValue\\\":48,\\\"stringValue\\\":\\\"strValue48\\\"},{\\\"integerValue\\\":3,\\\"stringValue\\\":\\\"strValue3\\\"},{\\\"integerValue\\\":31,\\\"stringValue\\\":\\\"strValue31\\\"},{\\\"integerValue\\\":40,\\\"stringValue\\\":\\\"strValue40\\\"},{\\\"integerValue\\\":15,\\\"stringValue\\\":\\\"strValue15\\\"},{\\\"integerValue\\\":39,\\\"stringValue\\\":\\\"strValue39\\\"},{\\\"integerValue\\\":14,\\\"stringValue\\\":\\\"strValue14\\\"},{\\\"integerValue\\\":46,\\\"stringValue\\\":\\\"strValue46\\\"},{\\\"integerValue\\\":34,\\\"stringValue\\\":\\\"strValue34\\\"},{\\\"integerValue\\\":17,\\\"stringValue\\\":\\\"strValue17\\\"},{\\\"integerValue\\\":7,\\\"stringValue\\\":\\\"strValue7\\\"},{\\\"integerValue\\\":20,\\\"stringValue\\\":\\\"strValue20\\\"},{\\\"integerValue\\\":4,\\\"stringValue\\\":\\\"strValue4\\\"},{\\\"integerValue\\\":11,\\\"stringValue\\\":\\\"strValue11\\\"},{\\\"integerValue\\\":19,\\\"stringValue\\\":\\\"strValue19\\\"},{\\\"integerValue\\\":47,\\\"stringValue\\\":\\\"strValue47\\\"},{\\\"integerValue\\\":26,\\\"stringValue\\\":\\\"strValue26\\\"}]}\";\n    }\n\n    @Benchmark\n    public String testSerialize() {\n        return jsonb.toJson(data);\n    }\n\n    @Benchmark\n    public CollectionsData testDeserialize() {\n        return jsonb.fromJson(json, CollectionsData.class);\n    }\n}\n"
  },
  {
    "path": "yasson-jmh/src/main/java/org/eclipse/yasson/jmh/ScalarDataTest.java",
    "content": "package org.eclipse.yasson.jmh;\n\nimport org.eclipse.yasson.jmh.model.ScalarData;\nimport org.openjdk.jmh.annotations.*;\n\nimport jakarta.json.bind.Jsonb;\nimport jakarta.json.bind.JsonbBuilder;\nimport java.util.concurrent.TimeUnit;\n\n\n/**\n * Tests for simple data, which does not have inner object references or collections.\n */\n@BenchmarkMode(Mode.Throughput)\n@Timeout(time = 20)\n@State(Scope.Benchmark)\n@Warmup(iterations = 3)\n@OutputTimeUnit(TimeUnit.MILLISECONDS)\npublic class ScalarDataTest {\n\n    private Jsonb jsonb;\n\n    private ScalarData data;\n\n    private String json;\n\n    @Setup(Level.Trial)\n    public void setUp() {\n        this.jsonb = JsonbBuilder.create();\n        this.data = new ScalarData();\n        this.json = \"{\\\"integerValue\\\":10,\\\"stringValue\\\":\\\"Short string\\\"}\";\n    }\n\n    @Benchmark\n    public String testSerialize() {\n        return jsonb.toJson(data);\n    }\n\n    @Benchmark\n    public ScalarData testDeserialize() {\n        return jsonb.fromJson(json, ScalarData.class);\n    }\n\n}\n"
  },
  {
    "path": "yasson-jmh/src/main/java/org/eclipse/yasson/jmh/TenPropertySerializationTest.java",
    "content": "package org.eclipse.yasson.jmh;\r\n\r\nimport org.eclipse.yasson.jmh.model.TenPropertyData;\r\nimport org.openjdk.jmh.annotations.*;\r\n\r\nimport jakarta.json.bind.*;\r\nimport java.util.List;\r\nimport java.util.concurrent.TimeUnit;\r\n\r\n/**\r\n * Test for serializing a pojo with 10 properties\r\n */\r\n@BenchmarkMode(Mode.Throughput)\r\n@Timeout(time = 20)\r\n@State(Scope.Benchmark)\r\n@Warmup(iterations = 3)\r\n@OutputTimeUnit(TimeUnit.MILLISECONDS)\r\npublic class TenPropertySerializationTest {\r\n\tprivate Jsonb json;\r\n\tprivate TenPropertyData testData;\r\n\t\r\n\t@Setup\r\n\tpublic void setup() {\r\n\t\tjson = JsonbBuilder.create();\r\n\t\ttestData = new TenPropertyData(\"prop1\", \"prop2\", 42, 3.14, new String[] {\"props\", \"propsss\", \"psssss\"}, \r\n\t\t\t\t\t\t\t\t\t   List.of(5, 1, 3), \"prop7\", 800, new int[] {5555, 6666, 7777, 8888}, Long.MAX_VALUE);\r\n\t}\r\n\t\r\n\t@Benchmark\r\n\tpublic String testSerialize() {\r\n\t\treturn json.toJson(testData);\r\n\t}\r\n}"
  },
  {
    "path": "yasson-jmh/src/main/java/org/eclipse/yasson/jmh/model/CollectionsData.java",
    "content": "package org.eclipse.yasson.jmh.model;\n\nimport java.util.List;\nimport java.util.Set;\n\npublic class CollectionsData {\n\n    private List<ScalarData> listData;\n\n    private Set<ScalarData> setData;\n\n    public List<ScalarData> getListData() {\n        return listData;\n    }\n\n    public void setListData(List<ScalarData> listData) {\n        this.listData = listData;\n    }\n\n    public Set<ScalarData> getSetData() {\n        return setData;\n    }\n\n    public void setSetData(Set<ScalarData> setData) {\n        this.setData = setData;\n    }\n}\n"
  },
  {
    "path": "yasson-jmh/src/main/java/org/eclipse/yasson/jmh/model/ScalarData.java",
    "content": "package org.eclipse.yasson.jmh.model;\n\npublic class ScalarData {\n\n    private String stringValue;\n\n    private Integer integerValue;\n\n    public ScalarData(String stringValue, Integer integerValue) {\n        this.stringValue = stringValue;\n        this.integerValue = integerValue;\n    }\n\n    public ScalarData() {\n        this.stringValue = \"Short string\";\n        this.integerValue = 10;\n    }\n\n    public String getStringValue() {\n        return stringValue;\n    }\n\n    public void setStringValue(String stringValue) {\n        this.stringValue = stringValue;\n    }\n\n    public Integer getIntegerValue() {\n        return integerValue;\n    }\n\n    public void setIntegerValue(Integer integerValue) {\n        this.integerValue = integerValue;\n    }\n}\n"
  },
  {
    "path": "yasson-jmh/src/main/java/org/eclipse/yasson/jmh/model/TenPropertyData.java",
    "content": "package org.eclipse.yasson.jmh.model;\r\n\r\nimport java.util.*;\r\n\r\npublic class TenPropertyData{\r\n\tprivate final String prop1;\r\n\tprivate final String prop2;\r\n\tprivate final int prop3;\r\n\tprivate final double prop4;\r\n\tprivate final String[] prop5;\r\n\tprivate final List<Integer> prop6;\r\n\tprivate final String prop7;\r\n\tprivate final int prop8;\r\n\tprivate final int[] prop9;\r\n\tprivate final long prop10;\r\n\t\r\n\tpublic TenPropertyData(String prop1, String prop2, int prop3, double prop4, String[] prop5, List<Integer> prop6,\r\n\t\t\tString prop7, int prop8, int[] prop9, long prop10) {\r\n\t\tthis.prop1 = prop1;\r\n\t\tthis.prop2 = prop2;\r\n\t\tthis.prop3 = prop3;\r\n\t\tthis.prop4 = prop4;\r\n\t\tthis.prop5 = prop5;\r\n\t\tthis.prop6 = prop6;\r\n\t\tthis.prop7 = prop7;\r\n\t\tthis.prop8 = prop8;\r\n\t\tthis.prop9 = prop9;\r\n\t\tthis.prop10 = prop10;\r\n\t}\r\n\r\n\tpublic String getProp1() {\r\n\t\treturn prop1;\r\n\t}\r\n\r\n\tpublic String getProp2() {\r\n\t\treturn prop2;\r\n\t}\r\n\r\n\tpublic int getProp3() {\r\n\t\treturn prop3;\r\n\t}\r\n\r\n\tpublic double getProp4() {\r\n\t\treturn prop4;\r\n\t}\r\n\r\n\tpublic String[] getProp5() {\r\n\t\treturn prop5;\r\n\t}\r\n\r\n\tpublic List<Integer> getProp6() {\r\n\t\treturn prop6;\r\n\t}\r\n\r\n\tpublic String getProp7() {\r\n\t\treturn prop7;\r\n\t}\r\n\r\n\tpublic int getProp8() {\r\n\t\treturn prop8;\r\n\t}\r\n\r\n\tpublic int[] getProp9() {\r\n\t\treturn prop9;\r\n\t}\r\n\r\n\tpublic long getProp10() {\r\n\t\treturn prop10;\r\n\t}\r\n}"
  },
  {
    "path": "yasson-tck/.gitignore",
    "content": "/target/\n"
  },
  {
    "path": "yasson-tck/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n        xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n        xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n\n    <modelVersion>4.0.0</modelVersion>\n\n    <groupId>org.eclipse</groupId>\n    <artifactId>yasson-tck</artifactId>\n    <version>1.0.0-SNAPSHOT</version>\n\n    <properties>\n        <jsonb.tck.version>3.0.0</jsonb.tck.version>\n        <yasson.version>3.0.5-SNAPSHOT</yasson.version>\n        <jakarta.json.bind.version>3.0.1</jakarta.json.bind.version>\n        <jakarta.json.version>2.1.3</jakarta.json.version>\n        <maven.compiler.source>11</maven.compiler.source>\n        <maven.compiler.target>11</maven.compiler.target>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>jakarta.json.bind</groupId>\n            <artifactId>jakarta.json.bind-tck</artifactId>\n            <version>${jsonb.tck.version}</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.json.bind</groupId>\n            <artifactId>jakarta.json.bind-api</artifactId>\n            <version>${jakarta.json.bind.version}</version>\n            <scope>provided</scope>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.json</groupId>\n            <artifactId>jakarta.json-api</artifactId>\n            <version>${jakarta.json.version}</version>\n            <scope>provided</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.eclipse</groupId>\n            <artifactId>yasson</artifactId>\n            <version>${yasson.version}</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.jboss.weld.se</groupId>\n            <artifactId>weld-se-core</artifactId>\n            <version>6.0.0.Beta1</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.jboss.arquillian.junit5</groupId>\n            <artifactId>arquillian-junit5-container</artifactId>\n            <version>1.8.0.Final</version>\n        </dependency>\n    </dependencies>\n\n    <build>\n        <plugins>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-dependency-plugin</artifactId>\n                <version>3.6.1</version>\n                <executions>\n                    <execution>\n                        <id>copy</id>\n                        <phase>generate-test-sources</phase>\n                        <goals>\n                            <goal>copy</goal>\n                        </goals>\n                        <configuration>\n                            <artifactItems>\n                                <artifactItem>\n                                    <groupId>jakarta.json.bind</groupId>\n                                    <artifactId>jakarta.json.bind-api</artifactId>\n                                    <version>${jakarta.json.bind.version}</version>\n                                    <type>jar</type>\n                                    <overWrite>true</overWrite>\n                                    <outputDirectory>${project.build.directory}/signaturedirectory</outputDirectory>\n                                    <destFileName>jakarta.json.bind-api.jar</destFileName>\n                                </artifactItem>\n                                <artifactItem>\n                                    <groupId>jakarta.json</groupId>\n                                    <artifactId>jakarta.json-api</artifactId>\n                                    <version>${jakarta.json.version}</version>\n                                    <type>jar</type>\n                                    <overWrite>true</overWrite>\n                                    <outputDirectory>${project.build.directory}/signaturedirectory</outputDirectory>\n                                    <destFileName>jakarta.json-api.jar</destFileName>\n                                </artifactItem>\n                            </artifactItems>\n                        </configuration>\n                    </execution>\n                </executions>\n            </plugin>\n            <plugin>\n                <artifactId>maven-surefire-plugin</artifactId>\n                <version>3.2.5</version>\n                <configuration>\n                    <trimStackTrace>false</trimStackTrace>\n                    <failIfNoTests>true</failIfNoTests>\n                    <dependenciesToScan>jakarta.json.bind:jakarta.json.bind-tck</dependenciesToScan>\n                    <systemPropertyVariables>\n                        <jimage.dir>${project.build.directory}/jdk-bundle</jimage.dir>\n                        <signature.sigTestClasspath>\n                            ${project.build.directory}/signaturedirectory/jakarta.json.bind-api.jar:${project.build.directory}/jdk-bundle/java.base:${project.build.directory}/jdk-bundle/java.rmi:${project.build.directory}/jdk-bundle/java.sql:${project.build.directory}/jdk-bundle/java.naming\n                        </signature.sigTestClasspath>\n                    </systemPropertyVariables>\n                </configuration>\n            </plugin>\n            <plugin>\n                <artifactId>maven-surefire-report-plugin</artifactId>\n                <version>3.2.5</version>\n                <executions>\n                    <execution>\n                        <id>post-unit-test</id>\n                        <phase>test</phase>\n                        <goals>\n                            <goal>report</goal>\n                        </goals>\n                    </execution>\n                </executions>\n            </plugin>\n        </plugins>\n    </build>\n</project>\n"
  }
]