[
  {
    "path": ".coderabbit.yaml",
    "content": "language: en-GB\ntone_instructions: ''\nearly_access: false\nenable_free_tier: true\nreviews:\n  profile: chill\n  request_changes_workflow: true\n  high_level_summary: true\n  high_level_summary_placeholder: '@coderabbitai summary'\n  auto_title_placeholder: '@coderabbitai'\n  review_status: true\n  commit_status: true\n  poem: false\n  collapse_walkthrough: true\n  sequence_diagrams: false\n  changed_files_summary: true\n  labeling_instructions: []\n  path_filters:\n    - '**/*'\n    - '**/gen/**'\n    - '!**/test/**/gen/**'\n    - '!**/.git/**'\n    - '!**/target/**'\n  path_instructions:\n    - path: '**/*.java'\n      instructions: |\n        - Review code using Java 21 standards, taking into account the rules defined by `src/main/checkstyle/checkstyle.xml`.\n        - Validate that code indentation uses spaces, not tabs, with an indent of multiple of 4.\n        - Validate that immutable local variables are not annotated with `final` unless the variable is required for use in an inner class.\n        - Favour use of `var` keyword for type declarations. `var` may also be used when the value is a cast `null`.\n        - Use a coding standard where multi-line expressions have operators and tenary separators at the end of line.\n        - Propose changes that only use the Java 21 API, not the API of Guava.\n        - The pattern matching `instanceof` expression safely handles `null`, returning `false`.\n    - path: '**/main/java/**/*.java'\n      instructions: |\n        - This project is mature and must provide a stable backwards-compatible public Java API.\n        - In the 'Walkthrough' section, you must always provide a list of up to 25 changes to the public Java API that will affect end users.\n          If there are no changes, you must explicitly state that there are no changes to the public Java API in this PR.\n          The public Java API is defined as public and protected methods on public classes, plus the file `module-info.java`.\n          Provide the list by deeply analysing code flow, which incudes analysing code flow through private methods and calls to Guava and Java 21.\n          Changes to be reported on include:\n          - New or removed methods in the public Java API\n          - Changes to method return types or parameter types in the public Java API\n          - Changes to method behaviour in the public Java API that might affect consumers\n        - This project uses `System.out.println` instead of logging\n        - This project tends to prefer `for` loops to streams for performance reasons, however either form is acceptable.\n          Do not make suggestions to change between streams and for loops or vice versa.\n    - path: '**/test/java/**/*.java'\n      instructions: |\n        For test code, focus on:\n        - Correctness of test assertions\n        - Test coverage of edge cases\n        - Clear test naming and documentation\n        - Encourage test methods to be package-scoped where possible\n        - Be more lenient with code style and minor optimisations\n  abort_on_close: true\n  auto_review:\n    enabled: true\n    auto_incremental_review: true\n    ignore_title_keywords: []\n    labels: []\n    drafts: false\n    base_branches:\n      - 'main'\n  tools:\n    shellcheck:\n      enabled: true\n    ruff:\n      enabled: false\n    markdownlint:\n      enabled: true\n    github-checks:\n      enabled: true\n      timeout_ms: 90000\n    languagetool:\n      enabled: true\n      enabled_only: false\n      level: default\n      enabled_rules: []\n      disabled_rules:\n        - EN_UNPAIRED_BRACKETS\n      enabled_categories: []\n      disabled_categories:\n        - TYPOS\n        - TYPOGRAPHY\n        - CASING\n    biome:\n      enabled: true\n    hadolint:\n      enabled: false\n    swiftlint:\n      enabled: true\n    phpstan:\n      enabled: false\n      level: default\n    golangci-lint:\n      enabled: false\n    yamllint:\n      enabled: true\n    gitleaks:\n      enabled: true\n    checkov:\n      enabled: false\n    detekt:\n      enabled: false\n    eslint:\n      enabled: true\n    rubocop:\n      enabled: false\n    buf:\n      enabled: false\n    regal:\n      enabled: false\n    actionlint:\n      enabled: true\n    pmd:\n      enabled: true\n    cppcheck:\n      enabled: false\n    semgrep:\n      enabled: true\n    circleci:\n      enabled: true\n    ast-grep:\n      packages: []\n      rule_dirs: []\n      util_dirs: []\n      essential_rules: true\nchat:\n  auto_reply: true\nknowledge_base:\n  opt_out: false\n  learnings:\n    scope: auto\n  issues:\n    scope: auto\n  jira:\n    project_keys: []\n  linear:\n    team_keys: []\n  pull_requests:\n    scope: auto\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "github: jodastephen\nopen_collective: joda\ntidelift: maven/org.joda:joda-beans\n\n# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository\n"
  },
  {
    "path": ".github/SECURITY.md",
    "content": "# Security Policy\n\n## Supported Versions\n\nIf a security issue occurs, only the latest versions of v3.x and v2.x are guaranteed to be patched.\nConsideration will be given to updating the v1.x line, however this is not guaranteed.\n\n## Reporting a Vulnerability\n\nTo report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).\nTidelift will coordinate the fix and disclosure.\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "# Dependabot config\n\nversion: 2\nupdates:\n- package-ecosystem: \"maven\"\n  directory: \"/\"\n  schedule:\n    interval: weekly\n    time: \"02:30\"\n  open-pull-requests-limit: 20\n"
  },
  {
    "path": ".github/maven-settings.xml",
    "content": "<settings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\"\n      xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n      xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0\n                          https://maven.apache.org/xsd/settings-1.0.0.xsd\">\n  <servers>\n    <server>\n      <id>central-publish</id>\n      <username>${env.MAVEN_CENTRAL_USERNAME}</username>\n      <password>${env.MAVEN_CENTRAL_PASSWORD}</password>\n    </server>\n    <server>\n      <id>github</id>\n      <privateKey>${env.GITHUB_TOKEN}</privateKey>\n    </server>\n  </servers>\n</settings>\n"
  },
  {
    "path": ".github/workflows/build.yml",
    "content": "name: Build\n\non: \n  push:\n    branches:\n      - '*'\n  pull_request:\n    branches:\n      - 'main'\n  schedule:\n    - cron: '41 19 * * 2'\n\npermissions:\n  contents: read\n\njobs:\n  build:\n    permissions:\n      security-events: write  # for github/codeql-action\n    runs-on: ubuntu-latest\n    steps:\n    - name: Checkout\n      uses: actions/checkout@v4\n\n    - name: Set up JDK\n      uses: actions/setup-java@v4\n      with:\n        java-version: 21\n        distribution: 'temurin'\n        cache: 'maven'\n\n    - name: Maven version\n      run: |\n        mkdir -p ./.mvn\n        echo \"-e\" >> ./.mvn/maven.config\n        echo \"-B\" >> ./.mvn/maven.config\n        echo \"-ntp\" >> ./.mvn/maven.config\n        echo \"-DtrimStackTrace=false\" >> ./.mvn/maven.config\n        echo \"--settings\" >> ./.mvn/maven.config\n        echo \"$( pwd )/.github/maven-settings.xml\" >> ./.mvn/maven.config\n        mvn --version\n        mkdir -p target\n\n    #------------------------------------------------------------------------\n    - name: Initialize CodeQL\n      uses: github/codeql-action/init@v3\n      with:\n        languages: java\n\n    - name: Maven build\n      run: |\n        mvn install site -Doss.build\n\n    - name: Perform CodeQL Analysis\n      uses: github/codeql-action/analyze@v3\n"
  },
  {
    "path": ".github/workflows/release.yml",
    "content": "name: Release\n\non:\n  push:\n    tags:\n      - 'release*'\n\npermissions:\n  contents: write\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n    - name: Checkout\n      uses: actions/checkout@v4\n      with:\n        token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}\n        ref: \"main\"\n        fetch-tags: true\n\n    - name: Setup git\n      run: |\n        git config --global user.name \"Stephen Colebourne (CI)\"\n        git config --global user.email \"scolebourne@joda.org\"\n\n    - name: Set up JDK\n      uses: actions/setup-java@v4\n      with:\n        java-version: 21\n        distribution: 'temurin'\n        cache: 'maven'\n\n    - name: Maven version\n      run: |\n        mkdir -p ./.mvn\n        echo \"-e\" >> ./.mvn/maven.config\n        echo \"-B\" >> ./.mvn/maven.config\n        echo \"-ntp\" >> ./.mvn/maven.config\n        echo \"-DtrimStackTrace=false\" >> ./.mvn/maven.config\n        echo \"--settings\" >> ./.mvn/maven.config\n        echo \"$( pwd )/.github/maven-settings.xml\" >> ./.mvn/maven.config\n        mvn --version\n        mkdir -p target\n\n    #------------------------------------------------------------------------\n    - name: Maven install\n      run: |\n        mvn clean install\n\n    - name: Maven release\n      env:\n        MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}\n        MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}\n        MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}\n        MAVEN_GPG_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}\n        GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}\n      run: |\n        mvn release:clean release:prepare release:perform\n\n    - name: Update website\n      run: |\n        git tag websiterelease\n        git push origin websiterelease\n\n    - name: Delete release tag\n      if: \"always()\"\n      run: |\n        git tag --delete \"${GITHUB_REF_NAME}\" || true\n        git push --delete origin \"${GITHUB_REF_NAME}\" || true\n"
  },
  {
    "path": ".github/workflows/website.yml",
    "content": "name: Website\n\non: \n  push:\n    tags:\n      - 'website*'\n\npermissions:\n  contents: write\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n    - name: Checkout\n      uses: actions/checkout@v4\n      with:\n        token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}\n        ref: ${{ github.ref }}\n        fetch-tags: true\n\n    - name: Setup git\n      run: |\n        git config --global user.name \"Stephen Colebourne (CI)\"\n        git config --global user.email \"scolebourne@joda.org\"\n\n    - name: Set up JDK\n      uses: actions/setup-java@v4\n      with:\n        java-version: 21\n        distribution: 'temurin'\n        cache: 'maven'\n\n    - name: Maven version\n      run: |\n        mkdir -p ./.mvn\n        echo \"-e\" >> ./.mvn/maven.config\n        echo \"-B\" >> ./.mvn/maven.config\n        echo \"-ntp\" >> ./.mvn/maven.config\n        echo \"-DtrimStackTrace=false\" >> ./.mvn/maven.config\n        echo \"--settings\" >> ./.mvn/maven.config\n        echo \"$( pwd )/.github/maven-settings.xml\" >> ./.mvn/maven.config\n        mvn --version\n        mkdir -p target\n\n    #------------------------------------------------------------------------\n    - name: Maven site\n      run: |\n        mvn install site\n\n    - name: Checkout website\n      uses: actions/checkout@v4\n      with:\n        token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}\n        repository: JodaOrg/jodaorg.github.io\n        path: target/jodaorg.github.io\n        ref: \"main\"\n\n    - name: Update website\n      run: |\n        cd target/jodaorg.github.io\n        git status\n  \n        rm -rf joda-beans/\n        cp -R ../site joda-beans/\n  \n        git add -A\n        git status\n        git commit --message \"Update joda-beans from CI: $GITHUB_ACTION\"\n  \n        git push origin main\n\n    - name: Delete website tag\n      if: \"always()\"\n      run: |\n        git tag --delete \"${GITHUB_REF_NAME}\" || true\n        git push --delete origin \"${GITHUB_REF_NAME}\" || true\n"
  },
  {
    "path": ".gitignore",
    "content": "/bin/\n/target/\n*.log\n/tests/\n/test-output/\n.checkstyle\n.classpath\n.project\n/.settings/\n.idea\n*.iml\n*.class\n"
  },
  {
    "path": "LICENSE.txt",
    "content": "\r\n                                 Apache License\r\n                           Version 2.0, January 2004\r\n                        http://www.apache.org/licenses/\r\n\r\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r\n\r\n   1. Definitions.\r\n\r\n      \"License\" shall mean the terms and conditions for use, reproduction,\r\n      and distribution as defined by Sections 1 through 9 of this document.\r\n\r\n      \"Licensor\" shall mean the copyright owner or entity authorized by\r\n      the copyright owner that is granting the License.\r\n\r\n      \"Legal Entity\" shall mean the union of the acting entity and all\r\n      other entities that control, are controlled by, or are under common\r\n      control with that entity. For the purposes of this definition,\r\n      \"control\" means (i) the power, direct or indirect, to cause the\r\n      direction or management of such entity, whether by contract or\r\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\r\n      outstanding shares, or (iii) beneficial ownership of such entity.\r\n\r\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\r\n      exercising permissions granted by this License.\r\n\r\n      \"Source\" form shall mean the preferred form for making modifications,\r\n      including but not limited to software source code, documentation\r\n      source, and configuration files.\r\n\r\n      \"Object\" form shall mean any form resulting from mechanical\r\n      transformation or translation of a Source form, including but\r\n      not limited to compiled object code, generated documentation,\r\n      and conversions to other media types.\r\n\r\n      \"Work\" shall mean the work of authorship, whether in Source or\r\n      Object form, made available under the License, as indicated by a\r\n      copyright notice that is included in or attached to the work\r\n      (an example is provided in the Appendix below).\r\n\r\n      \"Derivative Works\" shall mean any work, whether in Source or Object\r\n      form, that is based on (or derived from) the Work and for which the\r\n      editorial revisions, annotations, elaborations, or other modifications\r\n      represent, as a whole, an original work of authorship. For the purposes\r\n      of this License, Derivative Works shall not include works that remain\r\n      separable from, or merely link (or bind by name) to the interfaces of,\r\n      the Work and Derivative Works thereof.\r\n\r\n      \"Contribution\" shall mean any work of authorship, including\r\n      the original version of the Work and any modifications or additions\r\n      to that Work or Derivative Works thereof, that is intentionally\r\n      submitted to Licensor for inclusion in the Work by the copyright owner\r\n      or by an individual or Legal Entity authorized to submit on behalf of\r\n      the copyright owner. For the purposes of this definition, \"submitted\"\r\n      means any form of electronic, verbal, or written communication sent\r\n      to the Licensor or its representatives, including but not limited to\r\n      communication on electronic mailing lists, source code control systems,\r\n      and issue tracking systems that are managed by, or on behalf of, the\r\n      Licensor for the purpose of discussing and improving the Work, but\r\n      excluding communication that is conspicuously marked or otherwise\r\n      designated in writing by the copyright owner as \"Not a Contribution.\"\r\n\r\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\r\n      on behalf of whom a Contribution has been received by Licensor and\r\n      subsequently incorporated within the Work.\r\n\r\n   2. Grant of Copyright License. Subject to the terms and conditions of\r\n      this License, each Contributor hereby grants to You a perpetual,\r\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r\n      copyright license to reproduce, prepare Derivative Works of,\r\n      publicly display, publicly perform, sublicense, and distribute the\r\n      Work and such Derivative Works in Source or Object form.\r\n\r\n   3. Grant of Patent License. Subject to the terms and conditions of\r\n      this License, each Contributor hereby grants to You a perpetual,\r\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r\n      (except as stated in this section) patent license to make, have made,\r\n      use, offer to sell, sell, import, and otherwise transfer the Work,\r\n      where such license applies only to those patent claims licensable\r\n      by such Contributor that are necessarily infringed by their\r\n      Contribution(s) alone or by combination of their Contribution(s)\r\n      with the Work to which such Contribution(s) was submitted. If You\r\n      institute patent litigation against any entity (including a\r\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\r\n      or a Contribution incorporated within the Work constitutes direct\r\n      or contributory patent infringement, then any patent licenses\r\n      granted to You under this License for that Work shall terminate\r\n      as of the date such litigation is filed.\r\n\r\n   4. Redistribution. You may reproduce and distribute copies of the\r\n      Work or Derivative Works thereof in any medium, with or without\r\n      modifications, and in Source or Object form, provided that You\r\n      meet the following conditions:\r\n\r\n      (a) You must give any other recipients of the Work or\r\n          Derivative Works a copy of this License; and\r\n\r\n      (b) You must cause any modified files to carry prominent notices\r\n          stating that You changed the files; and\r\n\r\n      (c) You must retain, in the Source form of any Derivative Works\r\n          that You distribute, all copyright, patent, trademark, and\r\n          attribution notices from the Source form of the Work,\r\n          excluding those notices that do not pertain to any part of\r\n          the Derivative Works; and\r\n\r\n      (d) If the Work includes a \"NOTICE\" text file as part of its\r\n          distribution, then any Derivative Works that You distribute must\r\n          include a readable copy of the attribution notices contained\r\n          within such NOTICE file, excluding those notices that do not\r\n          pertain to any part of the Derivative Works, in at least one\r\n          of the following places: within a NOTICE text file distributed\r\n          as part of the Derivative Works; within the Source form or\r\n          documentation, if provided along with the Derivative Works; or,\r\n          within a display generated by the Derivative Works, if and\r\n          wherever such third-party notices normally appear. The contents\r\n          of the NOTICE file are for informational purposes only and\r\n          do not modify the License. You may add Your own attribution\r\n          notices within Derivative Works that You distribute, alongside\r\n          or as an addendum to the NOTICE text from the Work, provided\r\n          that such additional attribution notices cannot be construed\r\n          as modifying the License.\r\n\r\n      You may add Your own copyright statement to Your modifications and\r\n      may provide additional or different license terms and conditions\r\n      for use, reproduction, or distribution of Your modifications, or\r\n      for any such Derivative Works as a whole, provided Your use,\r\n      reproduction, and distribution of the Work otherwise complies with\r\n      the conditions stated in this License.\r\n\r\n   5. Submission of Contributions. Unless You explicitly state otherwise,\r\n      any Contribution intentionally submitted for inclusion in the Work\r\n      by You to the Licensor shall be under the terms and conditions of\r\n      this License, without any additional terms or conditions.\r\n      Notwithstanding the above, nothing herein shall supersede or modify\r\n      the terms of any separate license agreement you may have executed\r\n      with Licensor regarding such Contributions.\r\n\r\n   6. Trademarks. This License does not grant permission to use the trade\r\n      names, trademarks, service marks, or product names of the Licensor,\r\n      except as required for reasonable and customary use in describing the\r\n      origin of the Work and reproducing the content of the NOTICE file.\r\n\r\n   7. Disclaimer of Warranty. Unless required by applicable law or\r\n      agreed to in writing, Licensor provides the Work (and each\r\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\r\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r\n      implied, including, without limitation, any warranties or conditions\r\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r\n      PARTICULAR PURPOSE. You are solely responsible for determining the\r\n      appropriateness of using or redistributing the Work and assume any\r\n      risks associated with Your exercise of permissions under this License.\r\n\r\n   8. Limitation of Liability. In no event and under no legal theory,\r\n      whether in tort (including negligence), contract, or otherwise,\r\n      unless required by applicable law (such as deliberate and grossly\r\n      negligent acts) or agreed to in writing, shall any Contributor be\r\n      liable to You for damages, including any direct, indirect, special,\r\n      incidental, or consequential damages of any character arising as a\r\n      result of this License or out of the use or inability to use the\r\n      Work (including but not limited to damages for loss of goodwill,\r\n      work stoppage, computer failure or malfunction, or any and all\r\n      other commercial damages or losses), even if such Contributor\r\n      has been advised of the possibility of such damages.\r\n\r\n   9. Accepting Warranty or Additional Liability. While redistributing\r\n      the Work or Derivative Works thereof, You may choose to offer,\r\n      and charge a fee for, acceptance of support, warranty, indemnity,\r\n      or other liability obligations and/or rights consistent with this\r\n      License. However, in accepting such obligations, You may act only\r\n      on Your own behalf and on Your sole responsibility, not on behalf\r\n      of any other Contributor, and only if You agree to indemnify,\r\n      defend, and hold each Contributor harmless for any liability\r\n      incurred by, or claims asserted against, such Contributor by reason\r\n      of your accepting any such warranty or additional liability.\r\n\r\n   END OF TERMS AND CONDITIONS\r\n\r\n   APPENDIX: How to apply the Apache License to your work.\r\n\r\n      To apply the Apache License to your work, attach the following\r\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\r\n      replaced with your own identifying information. (Don't include\r\n      the brackets!)  The text should be enclosed in the appropriate\r\n      comment syntax for the file format. We also recommend that a\r\n      file or class name and description of purpose be included on the\r\n      same \"printed page\" as the copyright notice for easier\r\n      identification within third-party archives.\r\n\r\n   Copyright [yyyy] [name of copyright owner]\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n"
  },
  {
    "path": "NOTICE.txt",
    "content": "Joda Beans\r\nCopyright 2001-present Stephen Colebourne\r\n\r\nThis product includes software developed by\r\nJoda.org (https://www.joda.org/).\r\n"
  },
  {
    "path": "README.md",
    "content": "Joda-Beans\n------------\n\nJoda-Beans provides a small framework that adds properties to Java, greatly enhancing JavaBeans.\nAn API is provided that defines a bean and property model, together with a code generator to make it work in practice.\n\nThe key concept is to allow each property on a bean to be accessed as an object.\nThis enables technologies such as XPath, XML conversion, DB mappings, WebApp validation and Swing bindings.\n\nJoda-Beans is licensed under the business-friendly [Apache 2.0 licence](https://www.joda.org/joda-beans/licenses.html).\n\n\n### Why Joda Beans?\n\nJoda-Beans has been created to plug a gap in the Java language - properties.\nThe concept of properties is familiar to those coding in almost every other modern language.\nJava stands alone in its pursuit of the terrible JavaBean approach, and personally I believe that\nproperties should have been added to Java before generics and closures.\n\nJavaBeans are typically created by manual coding or one-off IDE generation, such as by Eclipse.\nThe same approach is taken to the creation of equals and hashCode methods.\nHowever, none of these approaches provides for a simple and fast mechanism to query a bean for the properties it exposes.\n\nJoda-Beans provides a solution. As a developer, you just write the fields much as you would today.\nThen you add annotations to the bean and properties.\nFinally, you run a code generator, which creates the get/set methods plus framework methods that allow the properties\nto be effectively queried.\nIf you use Eclipse and the Joda-Beans Maven plugin, the bean will be regenerated automatically on save.\n\nA key point is that the code generator may be run again and again on the Java file, and is non-destructive.\nSee these sample classes used for testing -\n[a simple user account class](https://github.com/JodaOrg/joda-beans/blob/v2.0/src/test/java/org/joda/beans/gen/UserAccount.java#L32),\n[example usage](https://github.com/JodaOrg/joda-beans/blob/v2.0/src/test/java/org/joda/beans/Examples.java#L22),\n[example of validation](https://github.com/JodaOrg/joda-beans/blob/v2.0/src/test/java/org/joda/beans/gen/ValidateBean.java#L33).\n\n\n### Documentation\nVarious documentation is available:\n\n* The [home page](https://www.joda.org/joda-beans/)\n* The helpful [user guide](https://www.joda.org/joda-beans/userguide.html)\n* The [Javadoc](https://www.joda.org/joda-beans/apidocs/index.html)\n* The change notes for the [releases](https://www.joda.org/joda-beans/changes-report.html)\n* The [related projects](related.html) including Maven, Gradle and IntelliJ integration\n\n\n### Releases\nThe 3.x branch is compatible with Java SE 21 or later.\n\nThe 2.x branch is compatible with Java SE 8 or later.\n\nv3.x releases are mostly compatible with v2.x releases,\nsee the [releases notes](https://www.joda.org/joda-beans/changes-report.html) for details.\nDeprecated methods have been removed.\n\nJoda-Beans depends on [Joda-Convert](https://www.joda.org/joda-convert/).\nThere are a number of [optional dependencies](https://www.joda.org/joda-beans/dependencies.html) which help with integration.\n\nAvailable in the [Maven Central repository](https://search.maven.org/search?q=g:org.joda%20AND%20a:joda-beans&core=gav)\n\nFor Java SE 6 compatibility, use [release 1.14](https://github.com/JodaOrg/joda-beans/releases/tag/v1.14).\nThere are only [minor incompatibilities](https://www.joda.org/joda-beans/migration.html) with the 1.x codebase.\n\n![Tidelift dependency check](https://tidelift.com/badges/github/JodaOrg/joda-beans)\n\n\n### For enterprise\nAvailable as part of the Tidelift Subscription.\n\nJoda and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.\n\nIf you want the flexibility of open source and the confidence of commercial-grade software, this is for you.\n\n[Learn more](https://tidelift.com/subscription/pkg/maven-org-joda-joda-beans?utm_source=maven-org-joda-joda-beans&utm_medium=github)\n\n\n### Support\nPlease use [Stack Overflow](https://stackoverflow.com/search?q=joda-beans) for general usage questions.\nGitHub [issues](https://github.com/JodaOrg/joda-beans/issues) and [pull requests](https://github.com/JodaOrg/joda-beans/pulls)\nshould be used when you want to help advance the project.\n\nAny donations to support the project are accepted via [OpenCollective](https://opencollective.com/joda).\n\nTo report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).\nTidelift will coordinate the fix and disclosure.\n\n\n### Release process\n\n* Update version (index.md, changes.xml)\n* Commit and push\n* `git push origin HEAD:refs/tags/release`\n* Code and Website will be built and released by GitHub Actions\n\nRelease from local:\n\n* Ensure `gpg-agent` is running\n* `mvn clean release:clean release:prepare release:perform`\n"
  },
  {
    "path": "RELEASE-NOTES.txt",
    "content": "\r\nJoda-Beans\r\n================================================\r\nJoda-Beans is a library that provides full bean and property support for the JDK.\r\n\r\nThe release runs on Java 21 or later.\r\n\r\nSee https://www.joda.org/joda-beans/changes-report.html for changes\r\n\r\n\r\nFeedback\r\n--------\r\nFeedback is best received using GitHub issues and Pull Requests.\r\nhttps://github.com/JodaOrg/joda-beans/\r\n\r\nThe Joda team\r\n"
  },
  {
    "path": "pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <!-- ==================================================================== -->\n  <!-- Build requires Java SE 21 or later -->\n  <!-- ==================================================================== -->\n  <modelVersion>4.0.0</modelVersion>\n  <groupId>org.joda</groupId>\n  <artifactId>joda-beans</artifactId>\n  <packaging>jar</packaging>\n  <name>Joda-Beans</name>\n  <version>3.0.0-SNAPSHOT</version>\n  <description>Beans and Properties, compatible with Java 21+</description>\n  <url>https://www.joda.org/joda-beans/</url>\n\n  <!-- ==================================================================== -->\n  <inceptionYear>2007</inceptionYear>\n  <licenses>\n    <license>\n      <name>Apache License, Version 2.0</name>\n      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>\n      <distribution>repo</distribution>\n    </license>\n  </licenses>\n  <organization>\n    <name>Joda.org</name>\n    <url>https://www.joda.org</url>\n  </organization>\n  <issueManagement>\n    <system>GitHub</system>\n    <url>https://github.com/JodaOrg/joda-beans/issues/</url>\n  </issueManagement>\n  <scm>\n    <connection>scm:git:https://github.com/JodaOrg/joda-beans.git</connection>\n    <developerConnection>scm:git:https://github.com/JodaOrg/joda-beans.git</developerConnection>\n    <url>https://github.com/JodaOrg/joda-beans</url>\n    <tag>HEAD</tag>\n  </scm>\n\n  <!-- ==================================================================== -->\n  <developers>\n    <developer>\n      <id>jodastephen</id>\n      <name>Stephen Colebourne</name>\n      <roles>\n        <role>Project Lead</role>\n      </roles>\n      <timezone>0</timezone>\n      <url>https://github.com/jodastephen</url>\n    </developer>\n  </developers>\n  <contributors>\n    <contributor>\n      <name>bcamel</name>\n      <url>https://github.com/bcamel</url>\n    </contributor>\n    <contributor>\n      <name>biteytech</name>\n      <url>https://github.com/biteytech</url>\n    </contributor>\n    <contributor>\n      <name>Hack Kampbjorn</name>\n      <url>https://github.com/hackmann</url>\n    </contributor>\n    <contributor>\n      <name>Chris Kent</name>\n      <url>https://github.com/cjkent</url>\n    </contributor>\n    <contributor>\n      <name>mediahype</name>\n      <url>https://github.com/mediahype</url>\n    </contributor>\n    <contributor>\n      <name>Will Nicholson</name>\n      <url>https://github.com/wjnicholson</url>\n    </contributor>\n    <contributor>\n      <name>Martynas Sateika</name>\n      <url>https://github.com/martynassateika</url>\n    </contributor>\n    <contributor>\n      <name>Andreas Schilling</name>\n      <url>https://github.com/andreas-schilling</url>\n    </contributor>\n    <contributor>\n      <name>troshanin</name>\n      <url>https://github.com/troshanin</url>\n    </contributor>\n    <contributor>\n      <name>Kevin Vella</name>\n      <url>https://github.com/lega</url>\n    </contributor>\n  </contributors>\n\n  <!-- ==================================================================== -->\n  <build>\n    <resources>\n      <resource>\n        <directory>src/main/resources</directory>\n      </resource>\n      <resource>\n        <targetPath>META-INF</targetPath>\n        <directory>${project.basedir}</directory>\n        <includes>\n          <include>LICENSE.txt</include>\n          <include>NOTICE.txt</include>\n        </includes>\n      </resource>\n    </resources>\n    <!-- define build -->\n    <plugins>\n      <!-- Enforce Maven 3.8.0 and Java 21+ -->\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-enforcer-plugin</artifactId>\n        <executions>\n          <execution>\n            <id>enforce-maven</id>\n            <goals>\n              <goal>enforce</goal>\n            </goals>\n            <configuration>\n              <rules>\n                <requireMavenVersion>\n                  <version>3.8.0</version>\n                </requireMavenVersion>\n                <requireJavaVersion>\n                  <version>[21,)</version>\n                </requireJavaVersion>\n              </rules>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n      <!-- Tests need access to an extra module. -->\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              <compilerArgs>\n                <arg>--add-modules</arg>\n                <arg>java.desktop</arg>\n                <arg>--add-reads</arg>\n                <arg>org.joda.beans=java.desktop</arg>\n              </compilerArgs>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n      <!-- Tests need access to an extra module. -->\n      <!-- Package org.joda.beans.sample is only for tests, this it must be explicitly exported. -->\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-surefire-plugin</artifactId>\n        <executions>\n          <execution>\n            <id>default-test</id>\n            <configuration>\n              <useModulePath>true</useModulePath>\n              <argLine>--add-modules java.desktop --add-reads org.joda.beans=java.desktop --add-exports org.joda.beans/org.joda.beans.sample=org.joda.convert</argLine>\n            </configuration>\n          </execution>\n          <execution>\n            <id>test-without-modules</id>\n            <phase>test</phase>\n            <goals>\n              <goal>test</goal>\n            </goals>\n            <configuration>\n              <useModulePath>false</useModulePath>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n      <!-- Release to GitHub -->\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-release-plugin</artifactId>\n        <configuration>\n          <arguments>-Doss.build -Doss.repo</arguments>\n          <autoVersionSubmodules>true</autoVersionSubmodules>\n          <tagNameFormat>v@{project.version}</tagNameFormat>\n          <localCheckout>true</localCheckout>\n        </configuration>\n        <dependencies>\n          <dependency>\n            <groupId>org.kohsuke</groupId>\n            <artifactId>github-api</artifactId>\n            <version>${github-api.version}</version>\n          </dependency>\n        </dependencies>\n      </plugin>\n    </plugins>\n    <!-- Manage plugin versions -->\n    <pluginManagement>\n      <plugins>\n        <!-- Maven build and reporting plugins (alphabetical) -->\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-assembly-plugin</artifactId>\n          <version>${maven-assembly-plugin.version}</version>\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        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-changes-plugin</artifactId>\n          <version>${maven-changes-plugin.version}</version>\n        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-clean-plugin</artifactId>\n          <version>${maven-clean-plugin.version}</version>\n        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-compiler-plugin</artifactId>\n          <version>${maven-compiler-plugin.version}</version>\n        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-deploy-plugin</artifactId>\n          <version>${maven-deploy-plugin.version}</version>\n        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-dependency-plugin</artifactId>\n          <version>${maven-dependency-plugin.version}</version>\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        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-gpg-plugin</artifactId>\n          <version>${maven-gpg-plugin.version}</version>\n        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-install-plugin</artifactId>\n          <version>${maven-install-plugin.version}</version>\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        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-javadoc-plugin</artifactId>\n          <version>${maven-javadoc-plugin.version}</version>\n        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-jxr-plugin</artifactId>\n          <version>${maven-jxr-plugin.version}</version>\n        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-plugin-plugin</artifactId>\n          <version>${maven-plugin-plugin.version}</version>\n        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-pmd-plugin</artifactId>\n          <version>${maven-pmd-plugin.version}</version>\n        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-project-info-reports-plugin</artifactId>\n          <version>${maven-project-info-reports-plugin.version}</version>\n        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-release-plugin</artifactId>\n          <version>${maven-release-plugin.version}</version>\n        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-repository-plugin</artifactId>\n          <version>${maven-repository-plugin.version}</version>\n        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-resources-plugin</artifactId>\n          <version>${maven-resources-plugin.version}</version>\n        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-source-plugin</artifactId>\n          <version>${maven-source-plugin.version}</version>\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        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-surefire-report-plugin</artifactId>\n          <version>${maven-surefire-report-plugin.version}</version>\n        </plugin>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-toolchains-plugin</artifactId>\n          <version>${maven-toolchains-plugin.version}</version>\n        </plugin>\n        <plugin>\n          <groupId>org.jacoco</groupId>\n          <artifactId>jacoco-maven-plugin</artifactId>\n          <version>${jacoco-maven-plugin.version}</version>\n        </plugin>\n        <plugin>\n          <groupId>com.github.spotbugs</groupId>\n          <artifactId>spotbugs-maven-plugin</artifactId>\n          <version>${spotbugs-maven-plugin.version}</version>\n        </plugin>\n        <!-- Setup site with reflow maven skin -->\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-site-plugin</artifactId>\n          <version>${maven-site-plugin.version}</version>\n          <configuration>\n            <skipDeploy>true</skipDeploy>\n          </configuration>\n          <executions>\n            <execution>\n              <id>attach-descriptor</id>\n              <goals>\n                <goal>attach-descriptor</goal>\n              </goals>\n              <!-- https://issues.apache.org/jira/browse/MSITE-639 -->\n              <configuration>\n                <locales>en,de</locales>\n              </configuration>\n            </execution>\n          </executions>\n          <dependencies>\n            <dependency>\n              <groupId>org.joda.external</groupId>\n              <artifactId>reflow-velocity-tools</artifactId>\n              <version>1.2</version>\n            </dependency>\n          </dependencies>\n        </plugin>\n      </plugins>\n    </pluginManagement>\n  </build>\n\n  <!-- ==================================================================== -->\n  <dependencies>\n    <dependency>\n      <groupId>org.joda</groupId>\n      <artifactId>joda-convert</artifactId>\n      <version>${joda-convert.version}</version>\n    </dependency>\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n      <version>${guava.version}</version>\n      <optional>true</optional>\n      <exclusions>\n        <exclusion>\n          <groupId>com.google.guava</groupId>\n          <artifactId>listenablefuture</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>com.google.errorprone</groupId>\n          <artifactId>error_prone_annotations</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>com.google.j2objc</groupId>\n          <artifactId>j2objc-annotations</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>org.checkerframework</groupId>\n          <artifactId>checker-qual</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>com.google.code.findbugs</groupId>\n          <artifactId>jsr305</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n    <dependency>\n      <groupId>org.joda</groupId>\n      <artifactId>joda-collect</artifactId>\n      <version>${joda-collect.version}</version>\n      <optional>true</optional>\n    </dependency>\n    <dependency>\n      <groupId>org.junit.jupiter</groupId>\n      <artifactId>junit-jupiter</artifactId>\n      <version>${junit.version}</version>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.assertj</groupId>\n      <artifactId>assertj-core</artifactId>\n      <version>${assertj.version}</version>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n\n  <!-- ==================================================================== -->\n  <reporting>\n    <plugins>\n      <!-- Setup standard project info reports -->\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-project-info-reports-plugin</artifactId>\n        <version>${maven-project-info-reports-plugin.version}</version>\n        <reportSets>\n          <reportSet>\n            <reports>\n              <report>ci-management</report>\n              <report>dependencies</report>\n              <report>dependency-info</report>\n              <report>issue-management</report>\n              <report>licenses</report>\n              <report>team</report>\n              <report>scm</report>\n              <report>summary</report>\n            </reports>\n          </reportSet>\n        </reportSets>\n      </plugin>\n      <!-- Setup Checkstyle report, excluding module-info -->\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          <includeResources>false</includeResources>\n          <includeTestResources>false</includeTestResources>\n          <includeTestSourceDirectory>false</includeTestSourceDirectory>\n          <excludes>module-info.java</excludes>\n        </configuration>\n      </plugin>\n      <!-- Setup Javadoc report -->\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-javadoc-plugin</artifactId>\n        <version>${maven-javadoc-plugin.version}</version>\n        <reportSets>\n          <reportSet>\n            <reports>\n              <report>javadoc</report>\n            </reports>\n          </reportSet>\n        </reportSets>\n        <configuration>\n          <source>21</source>\n        </configuration>\n      </plugin>\n      <!-- Setup Surefire report -->\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-surefire-report-plugin</artifactId>\n        <version>${maven-surefire-report-plugin.version}</version>\n        <configuration>\n          <showSuccess>true</showSuccess>\n        </configuration>\n      </plugin>\n      <!-- Setup changes (release notes) -->\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-changes-plugin</artifactId>\n        <version>${maven-changes-plugin.version}</version>\n        <reportSets>\n          <reportSet>\n            <reports>\n              <report>changes-report</report>\n            </reports>\n          </reportSet>\n        </reportSets>\n      </plugin>\n      <!-- Setup PMD report, excluding module-info -->\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-pmd-plugin</artifactId>\n        <version>${maven-pmd-plugin.version}</version>\n        <configuration>\n          <minimumTokens>100</minimumTokens>\n          <targetJdk>${maven.compiler.release}</targetJdk>\n          <excludes>\n            <exclude>module-info.java</exclude>\n          </excludes>\n        </configuration>\n      </plugin>\n      <!-- Setup spotbugs report -->\n      <plugin>\n        <groupId>com.github.spotbugs</groupId>\n        <artifactId>spotbugs-maven-plugin</artifactId>\n        <version>${spotbugs-maven-plugin.version}</version>\n      </plugin>\n      <!-- Setup JaCoCo report -->\n      <plugin>\n        <groupId>org.jacoco</groupId>\n        <artifactId>jacoco-maven-plugin</artifactId>\n        <version>${jacoco-maven-plugin.version}</version>\n        <reportSets>\n          <reportSet>\n            <reports>\n              <report>report</report>\n            </reports>\n          </reportSet>\n        </reportSets>\n      </plugin>\n    </plugins>\n  </reporting>\n\n  <!-- ==================================================================== -->\n  <profiles>\n    <!-- Main profile for command line builds -->\n    <profile>\n      <id>oss-build</id>\n      <activation>\n        <property>\n          <name>oss.build</name>\n        </property>\n      </activation>\n      <build>\n        <plugins>\n          <!-- Setup OSGi bundle data -->\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>bundle-manifest</id>\n                <phase>process-classes</phase>\n                <goals>\n                  <goal>manifest</goal>\n                </goals>\n                <configuration>\n                  <instructions>\n                    <Specification-Version>${project.version}</Specification-Version>\n                    <Export-Package>${joda.osgi.packages}</Export-Package>\n                    <Require-Capability>${joda.osgi.require.capability}</Require-Capability>\n                    <_fixupmessages>\"Classes found in the wrong directory\"; restrict:=error; is:=ignore</_fixupmessages>\n                  </instructions>\n                  <supportIncrementalBuild>true</supportIncrementalBuild>\n                </configuration>\n              </execution>\n            </executions>\n          </plugin>\n          <!-- Setup Jar file manifest entries -->\n          <plugin>\n            <groupId>org.apache.maven.plugins</groupId>\n            <artifactId>maven-jar-plugin</artifactId>\n            <configuration>\n              <archive>\n                <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>\n                <manifest>\n                  <addDefaultImplementationEntries>true</addDefaultImplementationEntries>\n                  <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>\n                </manifest>\n              </archive>\n            </configuration>\n          </plugin>\n          <!-- Setup Javadoc jar -->\n          <plugin>\n            <groupId>org.apache.maven.plugins</groupId>\n            <artifactId>maven-javadoc-plugin</artifactId>\n            <executions>\n              <execution>\n                <id>attach-javadocs</id>\n                <phase>package</phase>\n                <goals>\n                  <goal>jar</goal>\n                </goals>\n              </execution>\n            </executions>\n            <!-- Javadoc uses source 21 to pickup the module settings -->\n            <configuration>\n              <source>21</source>\n            </configuration>\n          </plugin>\n          <!-- Setup source jar -->\n          <plugin>\n            <groupId>org.apache.maven.plugins</groupId>\n            <artifactId>maven-source-plugin</artifactId>\n            <executions>\n              <execution>\n                <id>attach-sources</id>\n                <phase>package</phase>\n                <goals>\n                  <goal>jar-no-fork</goal>\n                </goals>\n              </execution>\n            </executions>\n          </plugin>\n          <!-- Setup Checkstyle, excluding module-info -->\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                <phase>process-sources</phase>\n                <goals>\n                  <goal>checkstyle</goal>\n                </goals>\n              </execution>\n            </executions>\n            <configuration>\n              <excludes>module-info.java</excludes>\n            </configuration>\n            <dependencies>\n              <dependency>\n                <groupId>com.puppycrawl.tools</groupId>\n                <artifactId>checkstyle</artifactId>\n                <version>${checkstyle.version}</version>\n              </dependency>\n            </dependencies>\n          </plugin>\n          <!-- Setup JaCoCo code coverage -->\n          <plugin>\n            <groupId>org.jacoco</groupId>\n            <artifactId>jacoco-maven-plugin</artifactId>\n            <executions>\n              <execution>\n                <id>jacoco-initialize</id>\n                <goals>\n                  <goal>prepare-agent</goal>\n                </goals>\n              </execution>\n              <execution>\n                <id>jacoco-site</id>\n                <phase>package</phase>\n                <goals>\n                  <goal>report</goal>\n                </goals>\n              </execution>\n            </executions>\n          </plugin>\n        </plugins>\n      </build>\n    </profile>\n    <!-- Set environment when running on GitHub Actions -->\n    <profile>\n      <id>github-action</id>\n      <activation>\n        <property>\n          <name>env.GITHUB_ACTIONS</name>\n          <value>true</value>\n        </property>\n      </activation>\n      <properties>\n        <gpg.signer>bc</gpg.signer>\n      </properties>\n    </profile>\n    <!-- Main deployment profile, activated by -Doss.repo -->\n    <profile>\n      <id>release-artifacts</id>\n      <activation>\n        <property>\n          <name>oss.repo</name>\n        </property>\n      </activation>\n      <build>\n        <plugins>\n          <!-- Create dist files -->\n          <plugin>\n            <groupId>org.apache.maven.plugins</groupId>\n            <artifactId>maven-assembly-plugin</artifactId>\n            <configuration>\n              <attach>false</attach>\n              <descriptors>\n                <descriptor>src/main/assembly/dist.xml</descriptor>\n              </descriptors>\n              <tarLongFileMode>gnu</tarLongFileMode>\n            </configuration>\n            <executions>\n              <execution>\n                <id>make-assembly</id>\n                <phase>install</phase>\n                <goals>\n                  <goal>single</goal>\n                </goals>\n              </execution>\n            </executions>\n          </plugin>\n          <!-- Sign artifacts -->\n          <plugin>\n            <groupId>org.apache.maven.plugins</groupId>\n            <artifactId>maven-gpg-plugin</artifactId>\n            <executions>\n              <execution>\n                <id>sign-artifacts</id>\n                <phase>verify</phase>\n                <goals>\n                  <goal>sign</goal>\n                </goals>\n              </execution>\n            </executions>\n          </plugin>\n          <!-- Use central plugin to directly release -->\n          <plugin>\n            <groupId>org.sonatype.central</groupId>\n            <artifactId>central-publishing-maven-plugin</artifactId>\n            <version>${central-publishing-maven-plugin.version}</version>\n            <extensions>true</extensions>\n            <configuration>\n              <publishingServerId>central-publish</publishingServerId>\n              <deploymentName>${project.name}</deploymentName>\n              <autoPublish>${joda.publish.auto}</autoPublish>\n              <waitUntil>${joda.publish.wait}</waitUntil>\n            </configuration>\n          </plugin>\n          <!-- Release dist files to GitHub -->\n          <!-- This will create a tag on GitHub on deploy -->\n          <!-- The release commit must have been pushed first -->\n          <plugin>\n            <groupId>de.jutzig</groupId>\n            <artifactId>github-release-plugin</artifactId>\n            <version>${github-release-plugin.version}</version>\n            <configuration>\n              <releaseName>Release v${project.version}</releaseName>\n              <description>See the [change notes](https://www.joda.org/joda-beans/changes-report.html#a${project.version}) for more information.</description>\n              <tag>v${project.version}</tag>\n              <overwriteArtifact>true</overwriteArtifact>\n              <fileSets>\n                <fileSet>\n                  <directory>${project.build.directory}</directory>\n                  <includes>\n                    <include>joda-beans*-dist.tar.gz</include>\n                    <include>joda-beans*-dist.zip</include>\n                  </includes>\n                </fileSet>\n              </fileSets>\n            </configuration>\n            <executions>\n              <execution>\n                <id>github-releases</id>\n                <phase>deploy</phase>\n                <goals>\n                  <goal>release</goal>\n                </goals>\n              </execution>\n            </executions>\n          </plugin>\n        </plugins>\n      </build>\n    </profile>\n  </profiles>\n\n  <!-- ==================================================================== -->\n  <properties>\n    <!-- Dependencies -->\n    <assertj.version>3.27.3</assertj.version>\n    <guava.version>33.4.8-jre</guava.version>\n    <joda-collect.version>2.0.0</joda-collect.version>\n    <joda-convert.version>3.0.1</joda-convert.version>\n    <junit.version>5.13.4</junit.version>\n\n    <!-- Common control parameters -->\n    <joda.osgi.packages>org.joda.beans.*</joda.osgi.packages>\n    <joda.osgi.require.capability>osgi.ee;filter:=\"(&amp;(osgi.ee=JavaSE)(version=${maven.compiler.release}))\"</joda.osgi.require.capability>\n    <joda.publish.auto>false</joda.publish.auto><!-- false/true -->\n    <joda.publish.wait>validated</joda.publish.wait><!-- validated/published -->\n\n    <!-- Plugin version numbers -->\n    <maven-assembly-plugin.version>3.7.1</maven-assembly-plugin.version>\n    <maven-bundle-plugin.version>6.0.0</maven-bundle-plugin.version>\n    <maven-changes-plugin.version>2.12.1</maven-changes-plugin.version>\n    <maven-checkstyle-plugin.version>3.4.0</maven-checkstyle-plugin.version><!-- 3.6.0 fails in reporting -->\n    <maven-clean-plugin.version>3.4.0</maven-clean-plugin.version>\n    <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>\n    <maven-dependency-plugin.version>3.8.1</maven-dependency-plugin.version>\n    <maven-deploy-plugin.version>3.1.3</maven-deploy-plugin.version>\n    <maven-enforcer-plugin.version>3.5.0</maven-enforcer-plugin.version>\n    <maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>\n    <maven-install-plugin.version>3.1.3</maven-install-plugin.version>\n    <maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>\n    <maven-javadoc-plugin.version>3.11.2</maven-javadoc-plugin.version>\n    <maven-jxr-plugin.version>3.6.0</maven-jxr-plugin.version>\n    <maven-plugin-plugin.version>3.15.1</maven-plugin-plugin.version>\n    <maven-pmd-plugin.version>3.24.0</maven-pmd-plugin.version><!-- 3.25.0/3.26.0 throws NoSuchMethodException -->\n    <maven-project-info-reports-plugin.version>3.6.2</maven-project-info-reports-plugin.version><!-- 3.7.0/3.8.0 has error -->\n    <maven-release-plugin.version>3.1.1</maven-release-plugin.version>\n    <maven-repository-plugin.version>2.4</maven-repository-plugin.version>\n    <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>\n    <maven-site-plugin.version>3.12.1</maven-site-plugin.version><!-- 3.20.0/3.21.0 throws ComponentLookupException -->\n    <maven-source-plugin.version>3.3.1</maven-source-plugin.version>\n    <maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version>\n    <maven-surefire-report-plugin.version>3.5.3</maven-surefire-report-plugin.version>\n    <maven-toolchains-plugin.version>3.2.0</maven-toolchains-plugin.version>\n    <central-publishing-maven-plugin.version>0.8.0</central-publishing-maven-plugin.version>\n    <github-api.version>1.326</github-api.version>\n    <github-release-plugin.version>1.6.0</github-release-plugin.version>\n    <jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>\n    <revapi-maven-plugin.version>0.11.1</revapi-maven-plugin.version>\n    <revapi-java.version>0.15.1</revapi-java.version>\n    <spotbugs-maven-plugin.version>4.8.6.6</spotbugs-maven-plugin.version>\n\n    <!-- Properties for maven-compiler-plugin -->\n    <maven.compiler.release>21</maven.compiler.release>\n    <maven.compiler.fork>true</maven.compiler.fork>\n\n    <!-- Properties for maven-javadoc-plugin -->\n    <author>false</author>\n    <notimestamp>true</notimestamp>\n    <doclint>none</doclint>\n\n    <!-- Properties for maven-checkstyle-plugin -->\n    <checkstyle.version>10.23.1</checkstyle.version>\n    <checkstyle.config.location>src/main/checkstyle/checkstyle.xml</checkstyle.config.location>\n    <linkXRef>false</linkXRef>\n\n    <!-- Other properties -->\n    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>\n  </properties>\n</project>\n"
  },
  {
    "path": "src/changes/changes.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<document>\n  <properties>\n    <title>Changes</title>\n    <author>Stephen Colebourne</author>\n  </properties>\n  <body>\n\n    <!-- types are add, fix, remove, update -->\n    <release version=\"3.0.0-RC1\" date=\"SNAPSHOT\" description=\"Version 3.0.0-RC1\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Major version based on Java SE 21.\n        Mostly compatible with v2.x.\n        Deprecated methods have been removed.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Allow Java records to become beans.\n        Add `RecordBean` interface that can be implemented by records.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add `LinkedByteArrayOutputStream`, which is like `ByteArrayOutputStream` but faster.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add `ResolvedType`, which allows generic type information to be managed in a simple way.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\" issue=\"232\">\n        Potentially incompatible change:\n        Manual equals, hashCode and toString methods must now be located *before* the autogenerated block.\n        This change allows nested classes to be written with their own equals, hashCode and toString methods,\n        so long as the nested class is written *after* the autogenerated block.\n        It is expected that most uses of Joda-Beans already have the equals, hashCode and toString methods\n        before the autogenerated block and therefore will be unaffected.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\" issue=\"445\">\n        Add a new binary format.\n        This change adds a third binary format, with a focus on size and performance.\n        In testing it produces binary files similar or slightly smaller than the referencing binary format,\n        but with faster serialization and deserialization. This solves a performance problem with the referencing\n        format whereby it tried to deduplicate all beans, even those with very large hash codes.\n        As part of this change, callers should now explicitly select which binary format they want using `JodaBeanBinFormat`.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\" issue=\"446\">\n        Potentially incompatible change:\n        The standard and referencing binary formats now support null as a map key.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\" issue=\"230\">\n        Potentially incompatible change:\n        The referencing binary format no longer deduplicates collections.\n        The old format can still be parsed successfully.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\" issue=\"446\">\n        Potentially incompatible change:\n        The standard binary and JSON formats now handle `Iterable` as a collection type.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Incompatible change:\n        The JSON serialization formats have changed for primitive arrays.\n        Instead of a Joda-Convert formatted string, the array is output as a list of primitives.\n        This also applies to multi-dimensional arrays.\n        This is a much more natural JSON format.\n        The old format can still be parsed successfully.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Incompatible change:\n        The JSON serialization formats have changed requiring fewer @meta and @type annotations.\n        For example, where the type of the collection is Object,\n        previously a String value was explicitly typed as a String, now the type is implicit.\n        This is a much more natural JSON format.\n        The old format can still be parsed successfully.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\" issue=\"192\">\n        Incompatible change:\n        The simple JSON serialization format now uses a string instead of null for NaN for consistency.\n        The new configuration 'JodaBeanJsonNumberFormat' can be used to control how NaN and Infinity are output.\n        As part of this change, the extended literals from 'The JSON5 Data Interchange Format' can be used if desired.\n      </action>\n    </release>\n    <release version=\"2.12.0\" date=\"SNAPSHOT\" description=\"v2.12.0\">\n      <action dev=\"jodastephen\" type=\"fix\" issue=\"424\">\n        Potentially incompatible bug fix:\n        Properties of type 'boolean[]' and 2-dimensional arrays are now cloned by default in immutable beans\n        in line with existing behaviour. Cloning is opt-in for mutable beans using new settings on `PropertyDefinition`.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" issue=\"424\">\n        Potentially incompatible bug fix:\n        Binary and JSON parsers now accept the formats produced by v3.x.\n        Certain edge cases now succeed when previously an exception would have been thrown.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" issue=\"405\">\n        Fix code generation for property names that clash with code generated method parameters.\n        Properties named `obj`, `other` or `propertyName` caused problems.\n        These are now prefixed by `this` to avoid the clash.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix `BeanAssert` to output the correct message.\n        Previously there was no check for equals at the property level, nor were arrays properly converted to `String`.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" issue=\"410\">\n        Fix code generation of light beans for `short`, `byte` and `char` fields.\n      </action>\n    </release>\n    <release version=\"2.11.1\" date=\"2024-08-01\" description=\"v2.11.1\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Allow deserialization to handle numbers greater than the capacity of an int.\n      </action>\n    </release>\n    <release version=\"2.11.0\" date=\"2024-05-23\" description=\"v2.11.0\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Add `PropertyPath` class, allowing multi-stage property lookups.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        New methods on MetaBean and MetaProperty to query an annotation, returning Optional.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        DirectBean annotation lookup now handles derived properties correctly.\n      </action>\n    </release>\n    <release version=\"2.10.0\" date=\"2023-09-11\" description=\"v2.10.0\">\n      <action dev=\"jodastephen\" type=\"update\">\n        The jar file is now a multi-release jar file, with the module-info file moved.\n      </action>\n      <action dev=\"jodastephen\" type=\"remove\">\n        The classic jar file (without module-info.class) is no longer produced.\n      </action>\n    </release>\n    <release version=\"2.9.2\" date=\"2023-05-29\" description=\"v2.9.2\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Allow generics in metaImplements.\n      </action>\n    </release>\n    <release version=\"2.9.1\" date=\"2023-05-25\" description=\"v2.9.1\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Remove erroneous assertj dependency.\n      </action>\n    </release>\n    <release version=\"2.9.0\" date=\"2023-05-24\" description=\"v2.9.0\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Add 'metaImplements' bean definition option that allows meta beans to implement an interface.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Allow IDEs to generate @Override tags without Joda-Beans removing them on regeneration.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Switch master to main.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Switch LGTM to CodeQL.\n      </action>\n    </release>\n    <release version=\"2.8.3\" date=\"2022-08-02\" description=\"Version 2.8.3\">\n      <action dev=\"martynassateika\" type=\"fix\" issue=\"235\">\n        Fix bug in referencing deserialization.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Update dependencies.\n      </action>\n    </release>\n    <release version=\"2.8.2\" date=\"2022-04-20\" description=\"Version 2.8.2\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Avoid NPE in `MetaBeans`.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Update Guava dependency.\n      </action>\n    </release>\n    <release version=\"2.8.1\" date=\"2020-10-20\" description=\"Version 2.8.1\">\n      <action dev=\"biteytech\" type=\"add\" issue=\"227\">\n        Add 'eol' command line argument to control the end-of-line character.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" issue=\"226\">\n        Ensure meta-bean only registered once.\n      </action>\n    </release>\n    <release version=\"2.8.0\" date=\"2020-02-26\" description=\"Version 2.8.0\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Provide ability to copy a bean to a builder of a different type.\n        See JodaBeanUtils.copy(Bean, Class).\n      </action>\n      <action dev=\"cjkent\" type=\"add\">\n        Add MetaBeanProvider annotation for more flexible meta-bean lookup.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix mutable beans where the subclass has no properties.\n        Fixes #210, #221.\n      </action>\n      <action dev=\"wjnicholson\" type=\"fix\" issue=\"224\">\n        Fix binary serialization of Joda-Convert types with intermediate interfaces in referencing format.\n      </action>\n      <action dev=\"wjnicholson\" type=\"fix\" issue=\"220\">\n        Fix toString() to include derived properties.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" issue=\"211\">\n        Handle repeated annotations more cleanly.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Call JodaBeansUtils.toString() on all properties, not just the last.\n      </action>\n    </release>\n    <release version=\"2.7.1\" date=\"2019-06-04\" description=\"Version 2.7.1\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix manual builders when used with minimal style.\n      </action>\n    </release>\n    <release version=\"2.7.0\" date=\"2019-06-03\" description=\"Version 2.7.0\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Add smart reader, that dynamically works out the format of the input.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Provide the ability to manually write a builder.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        New command line flag -generated to add @Generated annotation.\n        Fixes #209, #149\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Change XML parsing to share factory.\n        The JDK bug was fixed many years ago now, please use JDK 8u20 or later to avoid issues.\n      </action>\n      <action dev=\"wjnicholson\" type=\"fix\" issue=\"207\">\n        Fix referencing binary format for serialized nulls.\n      </action>\n    </release>\n    <release version=\"2.6.2\" date=\"2019-05-15\" description=\"Version 2.6.2\">\n      <action dev=\"wjnicholson\" type=\"fix\" issue=\"205\">\n        Fix referencing binary format for serialized nulls.\n      </action>\n    </release>\n    <release version=\"2.6.1\" date=\"2019-05-08\" description=\"Version 2.6.1\">\n      <action dev=\"wjnicholson\" type=\"fix\" issue=\"204\">\n        Fix referencing binary format for interfaces serialized via Joda-Convert.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Update Joda-Convert version.\n      </action>\n    </release>\n    <release version=\"2.6.0\" date=\"2019-04-05\" description=\"Version 2.6.0\">\n      <action dev=\"wjnicholson\" type=\"add\" issue=\"203\">\n        Add referencing binary format that typically uses less space.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Ensure that annotations are parsed correctly on fields.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Ensure that all annotations are available at runtime.\n      </action>\n    </release>\n    <release version=\"2.5.0\" date=\"2019-02-28\" description=\"Version 2.5.0\">\n      <action dev=\"jodastephen\" type=\"add\" issue=\"200\">\n        Ensure that builders on mutable beans are handled correctly.\n        Create `toBuilder()` methods and fix case where empty parent bean didn't compile.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" issue=\"201\">\n        Fix handling of deprecated properties.\n        Ensure that Javadoc tag is not output twice.\n        Move the tag to be output last, after other tags.\n      </action>\n    </release>\n    <release version=\"2.4.0\" date=\"2019-01-17\" description=\"Version 2.4.0\">\n      <action dev=\"wjnicholson\" type=\"add\">\n        Add ability to serialize XML to an `Appendable`.\n        Deprecate existing `writeToBuffer()` methods.\n        See #196.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add Tidelift commercial support and security policy.\n      </action>\n    </release>\n    <release version=\"2.3\" date=\"2018-08-10\" description=\"Version 2.3\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Allow deserializers to be registered in config files.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Avoid NullPointerException in finally block.\n      </action>\n    </release>\n    <release version=\"2.2.2\" date=\"2018-06-13\" description=\"Version 2.2.2\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Parse class headers spread over multiple lines.\n        Fixes #191.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Update Guava and Joda-Collect versions.\n      </action>\n    </release>\n    <release version=\"2.2.1\" date=\"2018-06-08\" description=\"Version 2.2.1\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Allow primitive integral types to be deserialized into floating point properties.\n        Fixes #190.\n      </action>\n    </release>\n    <release version=\"2.2\" date=\"2018-03-13\" description=\"Version 2.2\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Ensure tests and functionality work correctly on Java 9.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix light and minimal beans to respect aliases.\n        Aliases are useful for handling the rename of properties.\n        Fixes #187.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Add classic jar file for those that can't handle module-info.class.\n        Fixes #188.\n      </action>\n    </release>\n    <release version=\"2.1\" date=\"2018-02-19\" description=\"Version 2.1\">\n      <action dev=\"jodastephen\" type=\"remove\">\n        Remove integration projects - Freemarker, Kryo, Mongo.\n        These are now available as separate Maven artifacts, see https://github.com/JodaOrg/joda-beans-integrate.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add module-info for Java 9.\n        Fixes #180.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Allow serialization of derived properties.\n        Use JodaBeanSer::withIncludeDerived(true).\n        Fixes #183.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Change serialization format of simple JSON.\n        Primitive arrays are now output in standard JSON format, not as a string.\n        Any byte arrays are still output as base-64.\n        Simple map format was also changed to retain the arrays.\n        Fixes #186.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Handle double space in field definitions.\n        Fixes #182.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Handle wildcards better when looking up generic types.\n        Fixes #185.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Avoid NPE when parsing JSON.\n        If the generic type of the key could not be decoded, NPE could result.\n        Fixes #184.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix error message for table/grid.\n        Fixes #179.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix serialization issues for collections.\n        ImmutableSortedMap now works.\n        Collections where the generic is `Comparable` now work.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Update and redesign build to support Java 9.\n      </action>\n    </release>\n    <release version=\"2.0.2\" date=\"2017-10-05\" description=\"Version 2.0.2\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix cached hash code to be transient.\n        It must not be serialized.\n        Fixes #177.\n      </action>\n    </release>\n    <release version=\"2.0.1\" date=\"2017-09-26\" description=\"Version 2.0.1\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix minimal and light beans.\n        Code erroneously assumed reflection returns fields in source code order.\n        Fixes #176.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Ensure that properties stay in order.\n        Use LinkedHashMap instead of HashMap where necessary.\n      </action>\n    </release>\n    <release version=\"2.0\" date=\"2017-09-20\" description=\"Version 2.0\">\n      <action dev=\"jodastephen\" type=\"update\">\n        Move to Java 8.\n        Change light beans from reflection to method handles.\n        Change minimal beans to not have generated meta-bean class and disallow subclasses.\n        Fixes #155.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Use diamond operators in generated code.\n        Fixes #5.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Add @SafeVarargs annotation.\n        Fixes #156.\n      </action>\n      <action dev=\"hackmann\" type=\"update\">\n        Change BeanBuilder.get to use meta property type.\n        Fixes #152.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Remove comments for Clover ON/OFF.\n        Use the AUTOGENERATED START/END comments instead.\n        Fixes #157.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        MetaBean must pass type of bean to builder.\n        This is needed when the meta-bean is not generated.\n        Fixes #158.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Ensure light beans default empty collections.\n        Fixes #148.\n      </action>\n      <action dev=\"jodastephen\" type=\"remove\">\n        Remove deprecated methods.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Additional meta-bean methods - isBuildable(), of(Class), annotations(), annotation(Class).\n        Fixes #161.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Register meta-beans via MetaBean.register(). Deprecate old way on JodaBeanUtils.\n        Fixes #166.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add methods to assist with test coverage.\n        Force coverage of Joda-Beans branches so the coverage percentage is more meaningful.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add `Automatic-Module-Name` into `MANIFEST.MF`.\n        Locks in module name for Java SE 9.\n        Fixes #175.\n      </action>\n    </release>\n    <release version=\"1.14\" date=\"2017-09-20\" description=\"Version 1.14\">\n      <action dev=\"mediahype\" type=\"fix\" >\n        Generate property change as `final transient`.\n        Fixes #173.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" >\n        Handle multi-line annotations after `@PropertyDefinition`.\n        This simply looks for a comma at the end of the previous line, which isn't perfect but better than nothing.\n        Fixes #174.\n      </action>\n    </release>\n    <release version=\"1.13\" date=\"2017-05-04\" description=\"Version 1.13\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Add lenient mode for deserialization, see `SerDeserializers`.\n        This allows unknown properties and some invalid types to be ignored.\n        Fixes #170.\n      </action>\n    </release>\n    <release version=\"1.12\" date=\"2017-04-10\" description=\"Version 1.12\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Support derived properties on light and minimal beans.\n        Fixes #169.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Avoid warnings with generated code setString() and setAll().\n        Fixes #168.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add notBlank validation.\n        Fixes #167.\n      </action>\n    </release>\n    <release version=\"1.11\" date=\"2017-03-29\" description=\"Version 1.11\">\n      <action dev=\"hackmann\" type=\"fix\">\n        Ensure builder calls super constructor in hierarchy.\n        Fixes #150.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Rename config file from \"jdk6\" to \"jdk\".\n        Fixes #163.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        ToString style of 'omit' did not affect builder.\n        Fixes #164.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Serialize to/from a Map of Maps.\n        Fixes #159.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Deprecate PropertyMap, use JodaBeanUtils.flatten(bean) or BasicPropertyMap.of(bean).\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Deprecate BeanQuery, use functional interfaces in Java SE 8.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Deprecate BeanBuilder methods - setString() and setAll().\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Redesign reflective meta-bean.\n        Fixes #160.\n      </action>\n    </release>\n    <release version=\"1.10.1\" date=\"2017-01-23\" description=\"Version 1.10.1\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        JSON/binary serialization fails to read in a double[][] written with meta type.\n        Fixes #147.\n      </action>\n    </release>\n    <release version=\"1.10\" date=\"2017-01-16\" description=\"Version 1.10\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Allow mutable light beans to control constructor scope.\n        Fixes #145.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Generated factory methods do not have Javadoc @return.\n        Fixes #146.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Ensure light bean builder handles arbitrary meta property implementations.\n        Fixes #144.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Avoid generating methods that have no advantage in private builders.\n        Fixes #143.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Light bean setters fail to work via bean abstraction.\n        Fixes #142.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Light meta bean field should be final.\n        Fixes #141.\n      </action>\n    </release>\n    <release version=\"1.9.1\" date=\"2017-01-11\" description=\"Version 1.9.1\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Scope of meta bean and builder should match scope of main bean.\n        Fixes #140.\n      </action>\n    </release>\n    <release version=\"1.9\" date=\"2016-12-19\" description=\"Version 1.9\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Add deserializer providers, to allow more extensibility in deserialization.\n        Fixes #128.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Extend concept of \"light\" beans to mutable.\n        Light beans generate minimal code - no meta bean or builder.\n        Fixes #139.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Avoid NPE for mutable beans with builder.\n        Fixes #138.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n         Allow clone methods on immutable beans.\n      </action>\n      <action dev=\"bcamel\" type=\"add\">\n         Allow clone methods to be skipped during generation.\n         Fixes #135.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n         Enhance Guava deserialization when using certain immutable collection types.\n         Fixes #131.\n      </action>\n      <action dev=\"andreas-schilling\" type=\"fix\">\n         Incorrect config file for JDK 6.\n         Fixes #134.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n         Provide integration with Kryo serialization.\n         Fixes #130.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n         Add generation of static factory method.\n         Fixes #123.\n      </action>\n    </release>\n    <release version=\"1.8\" date=\"2016-07-28\" description=\"Version 1.8\">\n      <action dev=\"jodastephen\" type=\"add\">\n         Allow scope of meta-bean to be controlled.\n         Fixes #127.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n         Optional properties on light beans did not report the correct property type.\n         This caused serialization to fail.\n         Also fix field-based access problems due to lack of setAccessible.\n         Fixes #126.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n         Handle JSON parsing where integer can be converted safely to double or float.\n         Fixes #122.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n         Add support for EnumSet.\n         Fixes #125.\n      </action>\n    </release>\n    <release version=\"1.7\" date=\"2015-11-12\" description=\"Version 1.7\">\n      <action dev=\"jodastephen\" type=\"add\">\n         Change equals/hashCode/toString to use fields, not getters, for immutable beans.\n         Allow equals/hashCode/toString to be controlled , including selectively omitted.\n         Fixes #118, #121.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n         Provide ability to generate ConstructorProperties annotation.\n         Fixes #120.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n         Allow tolerance to be set when comparing beans using BeanAssert.\n         Additional methods on JodaBeanUtils provides tools for manual equals() methods.\n         Fixes #117.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n         Make bean parser more lenient.\n         Handle open brace immediately following Bean or ImmutableBean in an implements clause.\n         Fixes #116.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n         Use configured prefix for cachedHashCode and propertyChangeSupport.\n         Fixes #115.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n         Avoid null check in array clone getters where possible.\n         Fixes #114.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n         Fix light-weight immutable bean generation.\n         Generation needs to add call to register the meta-bean.\n         Constructor location logic is now more lenient to handle interface/class separation.\n         Fixes #111.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n         Fix XML to read/write interface base keys.\n         Handle case where interface does note extend Bean interface.\n         Fixes #119.\n      </action>\n    </release>\n    <release version=\"1.6\" date=\"2015-07-24\" description=\"Version 1.6\">\n      <action dev=\"jodastephen\" type=\"add\">\n         Add light-weight immutable bean generation.\n         Light-weight code generation using reflection to implement the bean methods.\n         No Meta class or Builder is generated.\n         Fixes #111.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n         Add basic support for bound properties.\n         Implementation only handles non-final properties on mutable beans.\n         Fixes #78.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n         Support package, protected and public scoped immutable constructors.\n         Fixes #107.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n         Support package-scoped builder classes.\n         Fixes #109.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n         Support package-scoped getters/setters.\n         Fixes #108.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n         Allow immutable builder property type to be manually controlled.\n         Fixes #103.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n         Enhance generation of varargs builder methods.\n         Support \"List&lt;? extends Foo&gt;\" and \"List&lt;?&gt;\"\n         Fixes #104.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n         Generate documentation for builder methods based on user-written docs.\n         Fixes #106.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n         Fix code generation for immutable beans where there are two generic types and the types are linked.\n         For example, Foo&lt;A, B extends Comparable&lt;A&gt;&gt;.\n         Fixes #110.\n      </action>\n    </release>\n    <release version=\"1.5.1\" date=\"2015-02-12\" description=\"Version 1.5.1\">\n      <action dev=\"jodastephen\" type=\"fix\">\n         Enable better test coverage.\n         Fixes #102.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n         Optimise JodaBeanUtils for hotspot inlining.\n         Fixes #101.\n      </action>\n    </release>\n    <release version=\"1.5\" date=\"2015-01-05\" description=\"Version 1.5\">\n      <action dev=\"jodastephen\" type=\"fix\">\n         Optimise internals of generated builders to use immutable collections.\n         This avoids unnecessary copying and object creation.\n         Fixes #96.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n         Provide details of files changed by code generation.\n         This allows tooling, such as the maven plugin, to be enhanced.\n         Fixes #99.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n         Standard format for exceptions in code generation.\n         Dedicated exception type allows tooling, such as the maven plugin, to be enhanced.\n         Fixes #98.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add related projects page to website.\n      </action>\n      <action dev=\"andreas-schilling\" type=\"fix\">\n        Fixed parsing of verbose command line flag.\n        Fixes #97.\n      </action>\n    </release>\n    <release version=\"1.4\" date=\"2014-12-10\" description=\"Version 1.4\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Add ImmutablePreBuild annotation.\n        This handles the case where a property needs to be defaulted from the value of another property.\n        In most cases, ImmutableDefaults and/or ImmutableValidator are sufficient.\n        Fixes #95.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Generate serialization version id.\n        If the class implements Serializable and there is no manual serialVersionUID, then one will be generated.\n        Fixes #94.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Support Optional properties in serialization.\n        If an optional property is used, support it in serialization.\n        This works for everything except collection types.\n        Fixes #93.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Support Optional return type for getters of nullable properties.\n        Allows the instance variable of a property to remain nullable (as recommended for Java 8)\n        but with the getter returning an Optional wrapper.\n        Simply declare the PropertyDefinition with 'get=\"optional\"'.\n        Fixes #92.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Avoid including derived properties in equals/hashCode.\n        Fixes #91.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add support for protected scope getters and setters.\n        Fixes #90.\n      </action>\n    </release>\n    <release version=\"1.3\" date=\"2014-12-01\" description=\"Version 1.3\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix bean generation to handle a lack of spaces in field initializers.\n        Fixes #87.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix bean generation to handle a property of a wildcard list type.\n        While the need for this is rare, better processing is needed.\n        The fix requires use of the PropertyDefinition \"type\" attribute in certain cases.\n        Fixes #88.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        The generated hash codes had a flaw and the algorithm has been changed.\n        Previously, they used (h += h * 31 + value.hashCode).\n        Now, they use (h = h * 31 + value.hashCode).\n        The incorrect version failed to generate unique hash codes when a bean\n        mostly contained null properties.\n        This causes all beans to regenerate.\n        Fixes #89.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Add varargs overrides for collections in immutable builders.\n        Fixes #85.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix code generation of immutable package-scoped beans.\n        Fixes #86.\n      </action>\n    </release>\n    <release version=\"1.2\" date=\"2014-10-10\" description=\"Version 1.2\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Add ability to iterate over all the beans within a bean.\n        Depth-first iteration handling collections.\n        Fixes #84.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix parsing of class name with extends clause union types.\n        Generic parameters on second and subsequent union types are not supported.\n        Fixes #83.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add alias support to PropertyDefinition.\n        A simple mechanism to handle property renames.\n        Fixes #82.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix parsing of class name with extends clause generics of type with two generic parameters.\n        Fixes #81.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add option to allow property values to be defaulted on immutable beans.\n        New annotation @ImmutableDefaults allows default values to be set.\n        Fixes #80.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add option to allow hash codes to be cached.\n        New attribute on @BeanDefinition allows caching of hash codes.\n        Fixes #79.\n      </action>\n    </release>\n    <release version=\"1.1\" date=\"2014-08-07\" description=\"Version 1.1\">\n      <action dev=\"jodastephen\" type=\"remove\">\n        Reduce scope of serialization helper classes.\n        MsgPack, MsgPackInput, MsgPackOutput and JodaBeanXml.\n        Backwards incompatible, but should not have been used.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add JSON round-trip serialization.\n        Fixes #75.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Use effective type exposed by Joda-Convert.\n        Joda-Convert v1.7 exposes the effective type of the converted string.\n        This can be more useful to use in serialization than the value type.\n        For example, where a public interface has the `FromString` annotation and non-public subclass has the `ToString`.\n        Fixes #76.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Better documentation.\n        Fixes #74.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix to add @Override annotation on toBuilder().\n        Fixes #73.\n      </action>\n    </release>\n    <release version=\"1.0.2\" date=\"2014-07-17\" description=\"Version 1.0.2\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix serialization to handle subclasses of enums.\n        Fixes #72.\n      </action>\n    </release>\n    <release version=\"1.0.1\" date=\"2014-06-27\" description=\"Version 1.0.1\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix immutable beans with private builders.\n        Meta-Bean builder() method returned the private buidler.\n        Fixes #70.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix immutable builder setString() method to actually convert from a string.\n        Fixes #69.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add JodaBeansUtils.notEmpty(Collection) and JodaBeansUtils.notEmpty(Map).\n        Fixes #71.\n      </action>\n    </release>\n    <release version=\"1.0\" date=\"2014-06-26\" description=\"Version 1.0\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Update docs for v1.0.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Provide @ImmutableValidator to allow immutable constructors to be manually validated.\n        Fixes #65.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Generate Javadoc param tags for generic types in meta/builder.\n        Fixes #68.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add getter/setter style of \"field\".\n        As all access is direct to the field, a weird getter/setter can be used.\n        Fixes #67.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Remove Bean.clone().\n        Clashes with generic union types.\n        Immutable beans no longer generate a clone method.\n        Use JodaBeanUtils.clone(bean) instead.\n        Fixes #66.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Block immutable beans from using EnumBiMap, EnumHashBiMap, HashBiMap,\n        EnumMultiset, HashMultiset, LinkedHashMultiset, TreeMultiset,\n        ArrayListMultimap, LinkedListMultimap, HashMultimap, LinkedHashMultimap, TreeMultimap, SortedSetMultimap\n        SparseGrid, DenseGrid.\n        Change Multimap interface to use ArrayListMultimap, not HashMultimap, because ImmutableMultimap is list based.\n        Fixes #64.\n      </action>\n    </release>\n    <release version=\"0.9.8\" date=\"2014-05-12\" description=\"Version 0.9.8\">\n      <action dev=\"jodastephen\" type=\"add\">\n       Enable selective use of Override annotation.\n       Fixes #63.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n       Undo deprecation of BasicImmutableBeanBuilder.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n       Fix immutable beans builder method comment.\n       Fixes #62.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n       Enhance and fix 2D array support in serialization.\n       Fixes #61.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n       Enhance and fix meta-type support in serialization.\n       Fixes #60.\n      </action>\n    </release>\n    <release version=\"0.9.7\" date=\"2014-03-04\" description=\"Version 0.9.7\">\n      <action dev=\"jodastephen\" type=\"add\">\n       Add support for Joda-Collect Grid interface.\n       Fixes #59.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n       Add support for Guava BiMap interface.\n       Fixes #58.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n       Handle collections in clone().\n       Fixes #55.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n       Do not clone in getters of mutable beans for arrays and java.util.Date.\n       Fixes #57.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n       Add mime types for serialized formats.\n       Fixes #56.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n       Add support for Guava Table interface.\n       Fixes #54.\n      </action>\n    </release>\n    <release version=\"0.9.6\" date=\"2014-02-13\" description=\"Version 0.9.6\">\n      <action dev=\"jodastephen\" type=\"add\">\n       Immutable subclass builders do not work.\n       Immutable and builder-based beans will regenerate.\n       Fixes #53.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n       Bean builder should have getters.\n       Immutable and builder-based beans will regenerate.\n       Fixes #52.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n       Deprecate BasicImmutableBeanBuilder.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n       Support three generic parameters.\n       Fixes #51.\n      </action>\n    </release>\n    <release version=\"0.9.5\" date=\"2014-02-11\" description=\"Version 0.9.5\">\n      <action dev=\"jodastephen\" type=\"fix\">\n       More secure XML parsing.\n      </action>\n    </release>\n    <release version=\"0.9.4\" date=\"2014-02-07\" description=\"Version 0.9.4\">\n      <action dev=\"jodastephen\" type=\"add\">\n       Add Joda-Bean binary serialization based on MessagePack.\n       Fixes #49.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n       More flexible XML parsing wrt Joda-Convert.\n       Handle a bean that has Joda-Convert annotations added, or vice versa.\n       Fixes #50.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n       Invalid code generated for an abstract @ImmutableBean.\n       Fixes #48.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Guava MultiSet serialized incorrectly.\n        Was serializing using the set size, not the unique elements size.\n        Fixes #47.\n      </action>\n    </release>\n    <release version=\"0.9.3\" date=\"2014-01-28\" description=\"Version 0.9.3\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Choose known types in serialization carefully.\n        Reduce the set from v0.9.2 as that set of types was too large.\n        Fixes #46.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix BeanComparisonError.\n        Fixes #45.\n      </action>\n    </release>\n    <release version=\"0.9.2\" date=\"2014-01-27\" description=\"Version 0.9.2\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Remove encodeClass/decodeClass from main serialization API.\n        Fixes #44.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Handle refactored beans in deserialization.\n        Fixes #43.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        BasicBeanBuilder get(String) returns builder rather than the requested data.\n        Backwards incompatible, but the old code is useless so will never have been used.\n        Fixes #42.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Ensure XML reader property closed.\n        Fixes #41.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Handle type renames in deserialization.\n        Fixes #40.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Short types flag not being used in JodaBeanSer.\n        Fixes #39.\n      </action>\n    </release>\n    <release version=\"0.9.1\" date=\"2014-01-20\" description=\"Version 0.9.1\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix immutable collection copies to preserve comparators.\n        Affects SortedSet and SortedMap.\n        Fixes #37.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Remove incorrect suppress unchecked in immutable generic beans.\n        Fixes #38.\n      </action>\n    </release>\n    <release version=\"0.9.0\" date=\"2013-12-14\" description=\"Version 0.9.0\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Support partially final beans and immutable subclasses.\n        This support is complex and not recommended, but sometimes necessary.\n        Fixes #24.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Recreate XMLInputFactory each time due to JDK bug JDK-8028111.\n        Fixes #36.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix to ensure nested class constructors are private if the type is final.\n        May cause beans to regenerate.\n        Fixes #35.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Extend notNull validation to collection properties.\n        May cause beans to regenerate.\n        Fixes #34.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Enhance PropertyStyle. Add isReadOnly().\n        Fixes #33.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add 'equalIgnoring' utility to compare two beans ignoring one or more properties.\n        Fixes #32.\n      </action>\n    </release>\n    <release version=\"0.8.6\" date=\"2013-11-06\" description=\"Version 0.8.6\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        XML generation of beans with no fields broken.\n        Affected COMPACT mode, not PRETTY mode.\n        Fixes #30.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        FlexiMap should retain the order of properties.\n        Use LinkedHashMap not HashMap. \n        Fixes #31.\n      </action>\n    </release>\n    <release version=\"0.8.5\" date=\"2013-10-22\" description=\"Version 0.8.5\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix code generation unchecked annotation when no writable properties.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Allow beans to have two generic type parameters. Fixes #21.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix code generation of private immutable builders. Fixes #26.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Parse trailing comments on property definitions. Fixes #27.\n      </action>\n    </release>\n    <release version=\"0.8.4\" date=\"2013-10-14\" description=\"Version 0.8.4\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Add setting to allow immutable builders to be private. Fixes #26.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Avoid code generating two lines next to one another.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Handle extra spaces in class/extends definitions. Fixes #25.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix code generation for properties of generic type array.\n        Where bean is Foo&lt;T&gt; and property is T[].\n        Also where immutable bean and property is T.\n        Fixes #22.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Bean toString should process arrays correctly. Fixes #23.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Enhance handling of non-null and non-empty fields especially in immutable beans. See #20.\n      </action>\n    </release>\n    <release version=\"0.8.3\" date=\"2013-10-09\" description=\"Version 0.8.3\">\n      <action dev=\"jodastephen\" type=\"fix\" >\n        Immutable beans should handle nullable fields. Fixes #20.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" >\n        Generate an immutable bean with no properties correctly.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" >\n        Handle classes that are loaded but not initialized. Fixes #19.\n      </action>\n    </release>\n    <release version=\"0.8.2\" date=\"2013-10-04\" description=\"Version 0.8.2\">\n      <action dev=\"jodastephen\" type=\"fix\" >\n        Fix XML parsing of complex map entries.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" >\n        Handle multi-line class definition. Fixes #17.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" >\n        Fix FlexiBean serialization. Fixes #18.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" >\n        SerIteratorFactory off by one bug.\n      </action>\n    </release>\n    <release version=\"0.8.1\" date=\"2013-10-03\" description=\"Version 0.8.1\">\n      <action dev=\"jodastephen\" type=\"add\" >\n        XML format no longer encodes tabs and newlines in elements.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\" >\n        Allow private getters/setters using PropertyDefinition.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\" >\n        Rename XML format map items to 'entry'.\n        Allow map keys to be beans, using two 'item' elements beneath 'entry'.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\" >\n        Extend analysis of collection/map generic types.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\" >\n        Allow short types to be switched off.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" >\n        Handle simple types better when defined by unknown interface.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" >\n        Generate correct Javadoc for builder static method with generics.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\" >\n        Allow known types to be built up during serialization.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\" >\n        Permit XML format to omit root type.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\" >\n        Output Joda-Convert data whenever available.\n      </action>\n    </release>\n    <release version=\"0.8\" date=\"2013-09-30\" description=\"Version 0.8\">\n      <action dev=\"jodastephen\" type=\"update\" >\n        Move to OSGi generation via Maven plugin.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\" >\n        Add XML round-trip serialization. Fixes #16.\n        Allows the bean to be converted to and from XML in a human readable format.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\" >\n        Enhance FlexiBean and MapBean. Fixes #15.\n        These now work more like the original intention.\n        Properties are always created on demand.\n        FlexiBean property names are now validated to a minimal format.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" >\n        Identify Derived and Immutable properties at runtime. Fixes #14.\n        Rename readWrite() to style() and PropertyReadWrite to ProperyStyle.\n        Some existing beans may regenerate.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" >\n        Generate final classes for final beans. Fixes #13.\n        Some existing beans may regenerate.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\" >\n        Parse annotations above @PropertyDefinition as well as those below. Fixes #10.\n        Some existing beans may regenerate.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\" >\n        Add support for clone on beans.. Fixes #12.\n        All existing beans will regenerate.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\" >\n        Add support for immutable beans. Fixes #11.\n        All existing beans will regenerate.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\" >\n        Move location of equals/hashCode/toString methods in generation.\n        All existing beans will regenerate.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\" >\n        Allow generated beans to implement interface, rather than extend class. Fixes #9.\n        Move propertyGet/propertySet/validate into meta-bean\n        All existing beans will regenerate.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\" >\n        Generate toString() methods. Fixes #8.\n        All existing beans will regenerate.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\" >\n        Optimize performance of generated equals for primitive numbers.\n        Some existing beans will regenerate.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\" >\n        Home page at GitHub.\n      </action>\n    </release>\n    <release version=\"0.7.1\" date=\"2013-07-22\" description=\"Version 0.7.1\">\n      <action dev=\"jodastephen\" type=\"update\">\n        Adjust code generation so can reformat in Eclipse without changing generated code.\n        Existing beans will regenerate, even though the only change is one blank line.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add checkstyle\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Change to use m2e Maven Eclipse\n      </action>\n    </release>\n    <release version=\"0.7\" date=\"2013-02-20\" description=\"Version 0.7\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix indentation issue in metaPropertyMap field.\n        Existing beans will regenerate, even though the only change is indentation.\n      </action>\n      <action dev=\"jodastephen\" type=\"update\">\n        Refactor BeanCodeGen to allow it to be used from tools.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix command line arguments - -v -> -verbose.\n      </action>\n    </release>\n    <release version=\"0.6.2\" date=\"2013-01-21\" description=\"Version 0.6.2\">\n      <action dev=\"cjkent\" type=\"add\">\n        Add getString() and setString() overrides that take a StringConvert instance.\n      </action>\n    </release>\n    <release version=\"0.6.1\" date=\"2013-01-08\" description=\"Version 0.6.1\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Add metaXxx(Class) method to work around Eclipse/javac/Intellij generics compiler issues.\n        Existing beans will need regenerating.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Allow derived property to be abstract or final.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Set correct read/write flag for final fields.\n      </action>\n    </release>\n    <release version=\"0.6\" date=\"2012-03-12\" description=\"Version 0.6\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Make generics more correct.\n      </action>\n      <action dev=\"jodastephen\" type=\"add\">\n        Add builder methods based on meta-property.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Move example code to correct location.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Allow a property to be named 'map'.\n      </action>\n      <action dev=\"jodastephen\" type=\"fix\">\n        Handle empty comments correctly.\n      </action>\n      <action dev=\"lega\" type=\"add\">\n        Extend builder to support setting by string.\n      </action>\n    </release>\n    <release version=\"0.5\" date=\"2011-10-27\" description=\"Version 0.5\">\n      <action dev=\"jodastephen\" type=\"update\">\n        Update to Joda-Convert v1.2 and use new feature to improve string conversion.\n      </action>              \n      <action dev=\"jodastephen\" type=\"update\">\n        DirectBean no longer extends BasicBean to simplify the hierarchy.\n      </action>              \n      <action dev=\"jodastephen\" type=\"add\">\n        Add BeanQuery and comparator support.\n      </action>              \n    </release>\n    <release version=\"0.4.5\" date=\"2011-10-05\" description=\"Version 0.4.5\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Handle generic subclasses better in JodaBeanUtils collection/map type extraction.\n      </action>              \n      <action dev=\"jodastephen\" type=\"fix\">\n        Handle arrays in JodaBeanUtils equals method.\n      </action>              \n    </release>\n    <release version=\"0.4.4\" date=\"2011-09-08\" description=\"Version 0.4.4\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix JodaBeanUtils to handle collections and sets as well as lists.\n      </action>              \n    </release>\n    <release version=\"0.4.3\" date=\"2011-07-26\" description=\"Version 0.4.3\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Fix generation of non-collection final properties.\n      </action>              \n    </release>\n    <release version=\"0.4.2\" date=\"2011-07-26\" description=\"Version 0.4.2\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Add JodaBeanUtils.clone().\n      </action>              \n      <action dev=\"jodastephen\" type=\"add\">\n        Add JodaBeanUtils.metaBean(), to lookup meta-bean by class.\n        This requires regeneration of direct beans.\n      </action>              \n      <action dev=\"jodastephen\" type=\"update\">\n        Improve generation of imports.\n        This may require regeneration of direct beans.\n      </action>              \n      <action dev=\"jodastephen\" type=\"update\">\n        Handle write-only properties better.\n        This requires regeneration of direct beans.\n      </action>              \n      <action dev=\"jodastephen\" type=\"add\">\n        Allow conversion to and from a standard format string from meta-property.\n      </action>              \n    </release>\n    <release version=\"0.4\" date=\"2011-06-03\" description=\"Version 0.4\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Add basic validation support.\n      </action>              \n      <action dev=\"jodastephen\" type=\"add\">\n        Add derived property annotation and support.\n      </action>              \n      <action dev=\"jodastephen\" type=\"add\">\n        Add BeanBuilder concept.\n      </action>              \n      <action dev=\"jodastephen\" type=\"add\">\n        Refactor to improve equals/hashCode performance.\n      </action>              \n      <action dev=\"jodastephen\" type=\"fix\">\n        Fix property/meta-property equals/hashCode.\n      </action>              \n      <action dev=\"jodastephen\" type=\"add\">\n        Enhance meta-property map.\n      </action>              \n    </release>\n    <release version=\"0.3.2\" date=\"2011-04-06\" description=\"Version 0.3.2\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Minor fixes.\n      </action>              \n    </release>\n    <release version=\"0.3\" date=\"2010-12-13\" description=\"Version 0.3\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Handle generic subclass of a generic class.\n      </action>              \n    </release>\n    <release version=\"0.2.20101111\" date=\"2010-11-11\" description=\"Version 0.2.20101111\">\n      <action dev=\"jodastephen\" type=\"fix\">\n        Handle subclass of a generic class.\n      </action>              \n    </release>\n    <release version=\"0.2\" date=\"2010-06-30\" description=\"Initial version\">\n      <action dev=\"jodastephen\" type=\"add\">\n        Initial version.\n      </action>              \n    </release>\n\n  </body>\n</document>\n"
  },
  {
    "path": "src/main/assembly/dist.xml",
    "content": "<assembly>\r\n    <id>dist</id>\r\n    <formats>\r\n        <format>tar.gz</format>\r\n        <format>zip</format>\r\n    </formats>\r\n    <baseDirectory>${artifactId}-${version}</baseDirectory>\r\n    <fileSets>\r\n        <fileSet>\r\n            <includes>\r\n                <include>checkstyle.xml</include>\r\n                <include>LICENSE.txt</include>\r\n                <include>NOTICE.txt</include>\r\n                <include>pom.xml</include>\r\n                <include>RELEASE-NOTES.txt</include>\r\n            </includes>\r\n        </fileSet>\r\n        <fileSet>\r\n            <directory>src</directory>\r\n        </fileSet>\r\n        <fileSet>\r\n            <directory>target</directory>\r\n            <outputDirectory></outputDirectory>\r\n            <includes>\r\n                <include>*.jar</include>\r\n            </includes>\r\n        </fileSet>\r\n    </fileSets>\r\n</assembly>\r\n"
  },
  {
    "path": "src/main/checkstyle/checkstyle.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE module PUBLIC \"-//Puppy Crawl//DTD Check Configuration 1.3//EN\" \"http://www.puppycrawl.com/dtds/configuration_1_3.dtd\">\n\n<module name=\"Checker\">\n  <property name=\"severity\" value=\"warning\"/>\n  <property name=\"tabWidth\" value=\"4\"/>\n  <module name=\"TreeWalker\">\n    <module name=\"ConstantName\">\n      <property name=\"format\" value=\"^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$|^[a-z][a-zA-Z0-9]*$\"/>\n    </module>\n    <module name=\"AvoidStarImport\">\n      <property name=\"severity\" value=\"error\"/>\n    </module>\n    <module name=\"EmptyBlock\">\n      <property name=\"tokens\" value=\"LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_IF,LITERAL_FOR,LITERAL_TRY,LITERAL_WHILE,STATIC_INIT\"/>\n    </module>\n    <module name=\"EmptyForInitializerPad\">\n      <property name=\"option\" value=\"space\"/>\n    </module>\n    <module name=\"EmptyForIteratorPad\">\n      <property name=\"option\" value=\"space\"/>\n    </module>\n    <module name=\"EqualsHashCode\"/>\n    <module name=\"IllegalImport\"/>\n    <module name=\"IllegalInstantiation\">\n      <property name=\"classes\" value=\"Boolean\"/>\n    </module>\n    <module name=\"JavadocType\">\n      <property name=\"scope\" value=\"protected\"/>\n    </module>\n    <module name=\"JavadocMethod\">\n      <property name=\"accessModifiers\" value=\"public,protected\"/>\n    </module>\n    <module name=\"JavadocVariable\">\n      <property name=\"accessModifiers\" value=\"public,protected\"/>\n    </module>\n    <module name=\"LeftCurly\">\n      <property name=\"severity\" value=\"error\"/>\n    </module>\n    <module name=\"LocalFinalVariableName\"/>\n    <module name=\"LocalVariableName\"/>\n    <module name=\"MemberName\">\n      <property name=\"format\" value=\"^[a-z][a-zA-Z0-9$]*$\"/>\n    </module>\n    <module name=\"MethodLength\">\n      <property name=\"max\" value=\"300\"/>\n    </module>\n    <module name=\"MethodName\"/>\n    <module name=\"MissingJavadocMethodCheck\">\n      <property name=\"allowMissingPropertyJavadoc\" value=\"true\"/>\n    </module>\n    <module name=\"ModifierOrder\">\n      <property name=\"severity\" value=\"error\"/>\n    </module>\n    <module name=\"NeedBraces\">\n      <property name=\"severity\" value=\"error\"/>\n    </module>\n    <module name=\"NoWhitespaceAfter\"/>\n    <module name=\"NoWhitespaceBefore\">\n      <property name=\"allowLineBreaks\" value=\"true\"/>\n      <property name=\"tokens\" value=\"SEMI,DOT,POST_DEC,POST_INC\"/>\n    </module>\n    <module name=\"OperatorWrap\">\n      <property name=\"option\" value=\"eol\"/>\n      <property name=\"tokens\" value=\"ASSIGN, DIV_ASSIGN, PLUS_ASSIGN, MINUS_ASSIGN, STAR_ASSIGN, MOD_ASSIGN, SR_ASSIGN, BSR_ASSIGN, SL_ASSIGN, BXOR_ASSIGN, BOR_ASSIGN, BAND_ASSIGN\"/>\n    </module>\n    <module name=\"PackageName\"/>\n    <module name=\"ParameterName\"/>\n    <module name=\"ParameterNumber\">\n      <property name=\"max\" value=\"20\"/>\n    </module>\n    <module name=\"ParenPad\"/>\n    <module name=\"RedundantImport\"/>\n    <module name=\"RightCurly\">\n      <property name=\"severity\" value=\"error\"/>\n    </module>\n    <module name=\"StaticVariableName\">\n      <property name=\"format\" value=\"^[a-z][a-zA-Z0-9]*$\"/>\n    </module>\n    <module name=\"TypeName\"/>\n    <module name=\"TypecastParenPad\"/>\n    <module name=\"UpperEll\">\n      <property name=\"severity\" value=\"error\"/>\n    </module>\n    <module name=\"VisibilityModifier\"/>\n    <module name=\"WhitespaceAfter\"/>\n    <module name=\"WhitespaceAround\">\n      <property name=\"tokens\" value=\"ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,EQUAL,GE,GT,LAND,LCURLY,LE,LITERAL_ASSERT,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,LOR,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,QUESTION,RCURLY,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,LITERAL_ASSERT,TYPE_EXTENSION_AND\"/>\n      <property name=\"allowEmptyConstructors\" value=\"true\"/>\n      <property name=\"allowEmptyMethods\" value=\"true\"/>\n    </module>\n    <module name=\"MissingDeprecated\"/>\n    <module name=\"MissingOverride\"/>\n    <module name=\"PackageAnnotation\"/>\n    <module name=\"CovariantEquals\"/>\n    <module name=\"DefaultComesLast\"/>\n    <module name=\"ExplicitInitialization\"/>\n    <module name=\"FallThrough\"/>\n    <module name=\"InnerAssignment\"/>\n    <module name=\"StringLiteralEquality\"/>\n    <module name=\"GenericWhitespace\"/>\n    <module name=\"MethodParamPad\"/>\n    <module name=\"FinalClass\"/>\n    <module name=\"MutableException\"/>\n    <module name=\"ArrayTypeStyle\">\n      <property name=\"severity\" value=\"error\"/>\n    </module>\n    <module name=\"Indentation\">\n      <property name=\"basicOffset\" value=\"4\"/>\n      <property name=\"caseIndent\" value=\"4\"/>\n    </module>\n    <module name=\"SuppressWithNearbyCommentFilter\">\n      <property name=\"commentFormat\" value=\"CSIGNORE\"/>\n      <property name=\"checkFormat\" value=\".*\"/>\n      <property name=\"checkC\" value=\"false\"/>\n    </module>\n  </module>\n  <!-- Header inlined due to m2e -->\n  <module name=\"RegexpHeader\">\n    <property name=\"header\" value=\"^/\\*[*]?\\n^ \\*  Copyright 2001[-]present Stephen Colebourne\"/>\n    <property name=\"fileExtensions\" value=\"java\"/>\n  </module>\n  <module name=\"SuppressWithPlainTextCommentFilter\">\n    <property name=\"offCommentFormat\" value=\"CSOFF\"/>\n    <property name=\"onCommentFormat\" value=\"CSON\"/>\n  </module>\n  <module name=\"FileLength\"/>\n  <module name=\"FileTabCharacter\">\n    <property name=\"eachLine\" value=\"true\"/>\n    <property name=\"severity\" value=\"error\"/>\n  </module>\n  <module name=\"LineLength\">\n    <property name=\"ignorePattern\" value=\"^ *\\* *[^ ]+$\"/>\n    <property name=\"max\" value=\"200\"/>\n  </module>\n  <module name=\"NewlineAtEndOfFile\"/>\n</module>\n"
  },
  {
    "path": "src/main/java/module-info.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n\n/**\n * Joda-Beans is a small framework that adds properties to Java, greatly enhancing JavaBeans.\n * <p>\n * The key concept is to allow each property on a bean to be accessed as an object in its own right.\n * This provides the hook for other technologies to build on, such as serialization, mapping,\n * expression languages and validation.\n */\nmodule org.joda.beans {\n\n    // dependency on Joda-Convert\n    requires transitive org.joda.convert;\n    // dependency on XML parser\n    requires java.xml;\n    // optional dependency on Guava\n    requires static com.google.common;\n    // optional dependency on Joda-Collect\n    requires static org.joda.collect;\n\n    // export all packages\n    exports org.joda.beans;\n    exports org.joda.beans.gen;\n    exports org.joda.beans.impl;\n    exports org.joda.beans.impl.direct;\n    exports org.joda.beans.impl.flexi;\n    exports org.joda.beans.impl.light;\n    exports org.joda.beans.impl.map;\n    exports org.joda.beans.impl.reflection;\n    exports org.joda.beans.ser;\n    exports org.joda.beans.ser.bin;\n    exports org.joda.beans.ser.json;\n    exports org.joda.beans.ser.map;\n    exports org.joda.beans.ser.xml;\n    exports org.joda.beans.test;\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/Bean.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans;\r\n\r\nimport java.util.NoSuchElementException;\r\nimport java.util.Set;\r\n\r\n/**\r\n * A bean consisting of a set of properties.\r\n * <p>\r\n * The implementation may be any class, but is typically a standard JavaBean\r\n * with get/set methods. Alternate implementations might store the properties\r\n * in another data structure such as a map.\r\n */\r\npublic interface Bean {\r\n\r\n    /**\r\n     * Gets the meta-bean representing the parts of the bean that are\r\n     * common across all instances, such as the set of meta-properties.\r\n     * <p>\r\n     * The meta-bean can be thought of as the equivalent of {@link Class} but for beans.\r\n     * \r\n     * @return the meta-bean, not null\r\n     */\r\n    public abstract MetaBean metaBean();\r\n\r\n    /**\r\n     * Gets a property by name.\r\n     * <p>\r\n     * Each bean consists of a known set of properties.\r\n     * This method checks whether there is a property with the specified name.\r\n     * <p>\r\n     * The base interface throws an exception if the name is not recognised.\r\n     * By contrast, the {@code DynamicBean} interface creates the property on demand.\r\n     * \r\n     * @param <R>  the property type, optional, enabling auto-casting\r\n     * @param propertyName  the property name to retrieve, not null\r\n     * @return the property, not null\r\n     * @throws NoSuchElementException if the property name is invalid\r\n     */\r\n    public default <R> Property<R> property(String propertyName) {\r\n        return metaBean().<R>metaProperty(propertyName).createProperty(this);\r\n    }\r\n\r\n    /**\r\n     * Gets the set of property names.\r\n     * <p>\r\n     * Each bean consists of a known set of properties.\r\n     * This method returns the known property names.\r\n     * \r\n     * @return the unmodifiable set of property names, not null\r\n     */\r\n    public default Set<String> propertyNames() {\r\n        return metaBean().metaPropertyMap().keySet();\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/BeanBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\n/**\n * A builder for a bean, providing a safe way to create it.\n * <p>\n * This interface allows a bean to be created even if it is immutable.\n * \n * @param <T>  the type of the bean\n */\npublic interface BeanBuilder<T extends Bean> {\n\n    /**\n     * Gets the value of a single property previously added to the builder.\n     * \n     * @param propertyName  the property name to query, not null\n     * @return the previously set value, null if none\n     * @throws RuntimeException thrown if the property name is invalid\n     */\n    public abstract Object get(String propertyName);\n\n    /**\n     * Gets the value of a single property previously added to the builder.\n     * \n     * @param metaProperty  the meta-property to query, not null\n     * @return the previously set value, null if none\n     * @throws RuntimeException thrown if the property is invalid\n     * @param <P> the type of the property.\n     */\n    public abstract <P> P get(MetaProperty<P> metaProperty);\n\n    /**\n     * Sets the value of a single property into the builder.\n     * <p>\n     * This will normally behave as per a {@code Map}, however it may not\n     * and as a general rule callers should only set each property once.\n     * \n     * @param propertyName  the property name to set, not null\n     * @param value  the property value, may be null\n     * @return {@code this}, for chaining, not null\n     * @throws RuntimeException optionally thrown if the property name is invalid\n     */\n    public abstract BeanBuilder<T> set(String propertyName, Object value);\n\n    /**\n     * Sets the value of a single property into the builder.\n     * <p>\n     * This will normally behave as per a {@code Map}, however it may not\n     * and as a general rule callers should only set each property once.\n     * \n     * @param metaProperty  the meta-property to set, not null\n     * @param value  the property value, may be null\n     * @return {@code this}, for chaining, not null\n     * @throws RuntimeException optionally thrown if the property is invalid\n     */\n    public abstract BeanBuilder<T> set(MetaProperty<?> metaProperty, Object value);\n\n    /**\n     * Builds the bean from the state of the builder.\n     * <p>\n     * Once this method has been called, the builder is in an invalid state.\n     * The effect of further method calls is undetermined.\n     * \n     * @return the created bean, not null\n     */\n    public abstract T build();\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/BeanIterator.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Deque;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.ser.SerIteratorFactory;\n\n/**\n * An iterator over beans.\n */\nfinal class BeanIterator implements Iterator<Bean> {\n\n    /**\n     * The stack of beans.\n     */\n    private final List<Bean> stack = new ArrayList<>(32);\n\n    /**\n     * Creates an instance.\n     * \n     * @param root  the bean to iterate over\n     */\n    BeanIterator(Bean root) {\n        this.stack.add(root);\n    }\n\n    @Override\n    public boolean hasNext() {\n        return !stack.isEmpty();\n    }\n\n    @Override\n    public Bean next() {\n        if (!hasNext()) {\n            throw new NoSuchElementException(\"No more elements in the iterator\");\n        }\n        // next bean to return is head of the stack\n        var currentBean = stack.remove(stack.size() - 1);\n        // temp used to reverse the order of child beans to match depth-first order\n        // alternative is to insert into stack at a fixed index (lots of array copying)\n        var temp = new ArrayDeque<Bean>(32);\n        for (var mp : currentBean.metaBean().metaPropertyIterable()) {\n            findChildBeans(mp.get(currentBean), mp, currentBean.getClass(), temp);\n        }\n        stack.addAll(temp);\n        return currentBean;\n    }\n\n    // find child beans, including those in collections\n    private void findChildBeans(Object obj, MetaProperty<?> mp, Class<?> beanClass, Deque<Bean> temp) {\n        if (obj != null) {\n            if (obj instanceof Bean bean) {\n                temp.addFirst(bean);\n            } else {\n                var it = SerIteratorFactory.INSTANCE.create(obj, mp, beanClass);\n                if (it != null) {\n                    while (it.hasNext()) {\n                        it.next();\n                        findChildBeans(it.key(), mp, Object.class, temp);\n                        findChildBeans(it.value(), mp, Object.class, temp);\n                        findChildBeans(it.column(), mp, Object.class, temp);\n                    }\n                }\n            }\n        }\n    }\n\n    @Override\n    public void remove() {\n        throw new UnsupportedOperationException(\"BeanIterator does not support remove()\");\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/DynamicBean.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans;\r\n\r\n/**\r\n * A dynamic bean that allows properties to be added and removed.\r\n * <p>\r\n * A JavaBean is defined at compile-time and cannot have additional properties added.\r\n * Instances of this interface allow additional properties to be added and removed\r\n * probably by wrapping a map\r\n */\r\npublic interface DynamicBean extends Bean {\r\n\r\n    /**\r\n     * Gets the meta-bean representing the parts of the bean that are\r\n     * common across all instances, such as the set of meta-properties.\r\n     * \r\n     * @return the meta-bean, not null\r\n     */\r\n    @Override\r\n    public abstract DynamicMetaBean metaBean();\r\n\r\n    /**\r\n     * Gets a property by name.\r\n     * <p>\r\n     * This will not throw an exception if the property name does not exist.\r\n     * Whether a property is immediately created or not is implementation dependent.\r\n     * \r\n     * @param <R>  the property type, optional, enabling auto-casting\r\n     * @param propertyName  the property name to retrieve, not null\r\n     * @return the property, not null\r\n     */\r\n    @Override\r\n    public abstract <R> Property<R> property(String propertyName);\r\n\r\n    /**\r\n     * Adds a property to those allowed to be stored in the bean.\r\n     * <p>\r\n     * Some implementations will automatically add properties, in which case this\r\n     * method will have no effect.\r\n     * \r\n     * @param propertyName  the property name to check, not empty, not null\r\n     * @param propertyType  the property type, not null\r\n     */\r\n    public abstract void propertyDefine(String propertyName, Class<?> propertyType);\r\n\r\n    /**\r\n     * Removes a property by name.\r\n     * \r\n     * @param propertyName  the property name to remove, null ignored\r\n     */\r\n    public abstract void propertyRemove(String propertyName);\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/DynamicMetaBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\n/**\n * A dynamic meta-bean which works with {@code DynamicBean}.\n * <p>\n * A dynamic bean can have properties added or removed at any time.\n * As such, there is a different meta-bean for each dynamic bean.\n * The meta-bean allows meta-properties to be created on demand.\n */\npublic interface DynamicMetaBean extends MetaBean {\n\n    /**\n     * Creates a bean builder that can be used to create an instance of this bean.\n     * <p>\n     * All properties added to the builder will be created and appear in the result. \n     * \n     * @return the bean builder, not null\n     * @throws UnsupportedOperationException if the bean cannot be created\n     */\n    @Override\n    public abstract BeanBuilder<? extends DynamicBean> builder();\n\n    /**\n     * Get the type of the bean represented as a {@code Class}.\n     * \n     * @return the type of the bean, not null\n     */\n    @Override\n    public abstract Class<? extends DynamicBean> beanType();\n\n    /**\n     * Gets a meta-property by name.\n     * <p>\n     * This will not throw an exception if the meta-property name does not exist.\n     * Whether a meta-property is immediately created or not is implementation dependent.\n     * \n     * @param <R>  the property type, optional, enabling auto-casting\n     * @param propertyName  the property name to retrieve, not null\n     * @return the meta property, not null\n     */\n    @Override\n    public abstract <R> MetaProperty<R> metaProperty(String propertyName);\n\n    //-----------------------------------------------------------------------\n    /**\n     * Defines a property for the bean.\n     * <p>\n     * Some implementations will automatically add properties, in which case this\n     * method will have no effect.\n     * \n     * @param propertyName  the property name to check, not empty, not null\n     * @param propertyType  the property type, not null\n     */\n    public abstract void metaPropertyDefine(String propertyName, Class<?> propertyType);\n\n    /**\n     * Removes a property by name.\n     * \n     * @param propertyName  the property name to remove, null ignored\n     */\n    public abstract void metaPropertyRemove(String propertyName);\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ImmutableBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\n/**\n * An immutable bean consisting of a set of properties.\n * <p>\n * This marker interface allows immutable beans to be identified.\n */\npublic interface ImmutableBean extends Bean {\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/JodaBeanUtils.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport java.lang.reflect.Array;\nimport java.lang.reflect.GenericArrayType;\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.lang.reflect.TypeVariable;\nimport java.lang.reflect.WildcardType;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.LinkedHashMap;\nimport java.util.LinkedHashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.util.Objects;\nimport java.util.Set;\nimport java.util.SortedMap;\nimport java.util.SortedSet;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\nimport java.util.function.Function;\n\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.flexi.FlexiBean;\nimport org.joda.collect.grid.DenseGrid;\nimport org.joda.collect.grid.Grid;\nimport org.joda.collect.grid.ImmutableGrid;\nimport org.joda.collect.grid.SparseGrid;\nimport org.joda.convert.StringConvert;\n\nimport com.google.common.collect.ArrayListMultimap;\nimport com.google.common.collect.BiMap;\nimport com.google.common.collect.HashBasedTable;\nimport com.google.common.collect.HashBiMap;\nimport com.google.common.collect.ImmutableCollection;\nimport com.google.common.collect.ImmutableMap;\nimport com.google.common.collect.ImmutableMultimap;\nimport com.google.common.collect.ImmutableMultiset;\nimport com.google.common.collect.ImmutableTable;\nimport com.google.common.collect.LinkedHashMultimap;\nimport com.google.common.collect.LinkedHashMultiset;\nimport com.google.common.collect.ListMultimap;\nimport com.google.common.collect.Multimap;\nimport com.google.common.collect.Multiset;\nimport com.google.common.collect.SetMultimap;\nimport com.google.common.collect.SortedMultiset;\nimport com.google.common.collect.Table;\nimport com.google.common.collect.TreeMultiset;\n\n/**\n * A set of utilities to assist when working with beans and properties.\n */\npublic final class JodaBeanUtils {\n\n    /**\n     * The cache of meta-beans.\n     */\n    private static final StringConvert converter = new StringConvert();\n\n    /**\n     * Restricted constructor.\n     */\n    private JodaBeanUtils() {\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the standard string format converter.\n     * <p>\n     * This returns a singleton that may be mutated (holds a concurrent map).\n     * New conversions should be registered at program startup.\n     * \n     * @return the standard string converter, not null\n     */\n    public static StringConvert stringConverter() {\n        return converter;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Checks if two objects are equal handling null.\n     * \n     * @param obj1  the first object, may be null\n     * @param obj2  the second object, may be null\n     * @return true if equal\n     */\n    public static boolean equal(Object obj1, Object obj2) {\n        if (obj1 == obj2) {\n            return true;\n        }\n        if (obj1 == null || obj2 == null) {\n            return false;\n        }\n        if (obj1.getClass().isArray()) {\n            return equalsArray(obj1, obj2);\n        }\n        // this does not handle arrays embedded in objects, such as in lists/maps,\n        // but you shouldn't use arrays like that, should you?\n        return obj1.equals(obj2);\n    }\n\n    // extracted from equal(Object,Object) to aid hotspot inlining\n    private static boolean equalsArray(Object obj1, Object obj2) {\n        if (obj1.getClass() != obj2.getClass()) {\n            return false;\n        }\n        return switch (obj1) {\n            case Object[] objects -> Arrays.deepEquals(objects, (Object[]) obj2);\n            case int[] ints -> Arrays.equals(ints, (int[]) obj2);\n            case long[] longs -> Arrays.equals(longs, (long[]) obj2);\n            case byte[] bytes -> Arrays.equals(bytes, (byte[]) obj2);\n            case double[] doubles -> Arrays.equals(doubles, (double[]) obj2);\n            case float[] floats -> Arrays.equals(floats, (float[]) obj2);\n            case char[] chars -> Arrays.equals(chars, (char[]) obj2);\n            case short[] shorts -> Arrays.equals(shorts, (short[]) obj2);\n            case boolean[] booleans -> Arrays.equals(booleans, (boolean[]) obj2);\n            default -> false;  // unreachable?\n        };\n    }\n\n    /**\n     * Checks if two floats are equal based on identity.\n     * <p>\n     * This performs the same check as {@link Float#equals(Object)}.\n     * \n     * @param val1  the first value, may be null\n     * @param val2  the second value, may be null\n     * @return true if equal\n     */\n    public static boolean equal(float val1, float val2) {\n        return Float.floatToIntBits(val1) == Float.floatToIntBits(val2);\n    }\n\n    /**\n     * Checks if two floats are equal within the specified tolerance.\n     * <p>\n     * Two NaN values are equal. Positive and negative infinity are only equal with themselves.\n     * Otherwise, the difference between the values is compared to the tolerance.\n     * \n     * @param val1  the first value, may be null\n     * @param val2  the second value, may be null\n     * @param tolerance  the tolerance used to compare equal\n     * @return true if equal\n     */\n    public static boolean equalWithTolerance(float val1, float val2, double tolerance) {\n        return (Float.floatToIntBits(val1) == Float.floatToIntBits(val2)) || Math.abs(val1 - val2) <= tolerance;\n    }\n\n    /**\n     * Checks if two doubles are equal based on identity.\n     * <p>\n     * This performs the same check as {@link Double#equals(Object)}.\n     * \n     * @param val1  the first value, may be null\n     * @param val2  the second value, may be null\n     * @return true if equal\n     */\n    public static boolean equal(double val1, double val2) {\n        return Double.doubleToLongBits(val1) == Double.doubleToLongBits(val2);\n    }\n\n    /**\n     * Checks if two doubles are equal within the specified tolerance.\n     * <p>\n     * Two NaN values are equal. Positive and negative infinity are only equal with themselves.\n     * Otherwise, the difference between the values is compared to the tolerance.\n     * The tolerance is expected to be a finite value, not NaN or infinity.\n     * \n     * @param val1  the first value, may be null\n     * @param val2  the second value, may be null\n     * @param tolerance  the tolerance used to compare equal\n     * @return true if equal\n     */\n    public static boolean equalWithTolerance(double val1, double val2, double tolerance) {\n        return (Double.doubleToLongBits(val1) == Double.doubleToLongBits(val2)) || Math.abs(val1 - val2) <= tolerance;\n    }\n\n    /**\n     * Returns a hash code for an object handling null.\n     * \n     * @param obj  the object, may be null\n     * @return the hash code\n     */\n    public static int hashCode(Object obj) {\n        if (obj == null) {\n            return 0;\n        }\n        if (obj.getClass().isArray()) {\n            return hashCodeArray(obj);\n        }\n        return obj.hashCode();\n    }\n\n    // extracted from hashCode(Object) to aid hotspot inlining\n    private static int hashCodeArray(Object obj) {\n        return switch (obj) {\n            case Object[] objects -> Arrays.deepHashCode(objects);\n            case int[] ints -> Arrays.hashCode(ints);\n            case long[] longs -> Arrays.hashCode(longs);\n            case byte[] bytes -> Arrays.hashCode(bytes);\n            case double[] doubles -> Arrays.hashCode(doubles);\n            case float[] floats -> Arrays.hashCode(floats);\n            case char[] chars -> Arrays.hashCode(chars);\n            case short[] shorts -> Arrays.hashCode(shorts);\n            case boolean[] booleans -> Arrays.hashCode(booleans);\n            default -> obj.hashCode();  // unreachable?\n        };\n    }\n\n    /**\n     * Returns a hash code for a {@code boolean}.\n     * \n     * @param value  the value to convert to a hash code\n     * @return the hash code\n     */\n    public static int hashCode(boolean value) {\n        return value ? 1231 : 1237;\n    }\n\n    /**\n     * Returns a hash code for an {@code int}.\n     * \n     * @param value  the value to convert to a hash code\n     * @return the hash code\n     */\n    public static int hashCode(int value) {\n        return value;\n    }\n\n    /**\n     * Returns a hash code for a {@code long}.\n     * \n     * @param value  the value to convert to a hash code\n     * @return the hash code\n     */\n    public static int hashCode(long value) {\n        return Long.hashCode(value);\n    }\n\n    /**\n     * Returns a hash code for a {@code float}.\n     * \n     * @param value  the value to convert to a hash code\n     * @return the hash code\n     */\n    public static int hashCode(float value) {\n        return Float.hashCode(value);\n    }\n\n    /**\n     * Returns a hash code for a {@code double}.\n     * \n     * @param value  the value to convert to a hash code\n     * @return the hash code\n     */\n    public static int hashCode(double value) {\n        return Double.hashCode(value);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns the {@code toString} value handling arrays.\n     * \n     * @param obj  the object, may be null\n     * @return the string, not null\n     */\n    public static String toString(Object obj) {\n        if (obj == null) {\n            return \"null\";\n        }\n        if (obj.getClass().isArray()) {\n            return toStringArray(obj);\n        }\n        return obj.toString();\n    }\n\n    // extracted from toString(Object) to aid hotspot inlining\n    private static String toStringArray(Object obj) {\n        return switch (obj) {\n            case Object[] objects -> Arrays.deepToString(objects);\n            case int[] ints -> Arrays.toString(ints);\n            case long[] longs -> Arrays.toString(longs);\n            case byte[] bytes -> Arrays.toString(bytes);\n            case double[] doubles -> Arrays.toString(doubles);\n            case float[] floats -> Arrays.toString(floats);\n            case char[] chars -> Arrays.toString(chars);\n            case short[] shorts -> Arrays.toString(shorts);\n            case boolean[] booleans -> Arrays.toString(booleans);\n            default -> obj.toString(); // unreachable?\n        };\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Checks if the two beans have the same set of properties.\n     * <p>\n     * This comparison checks that both beans have the same set of property names\n     * and that the value of each property name is also equal.\n     * It does not check the bean type, thus a {@link FlexiBean} may be equal\n     * to a {@link DirectBean}.\n     * <p>\n     * This comparison is usable with the {@link #propertiesHashCode} method.\n     * The result is the same as that if each bean was converted to a {@code Map}\n     * from name to value.\n     * \n     * @param bean1  the first bean to compare, not null\n     * @param bean2  the second bean to compare, not null\n     * @return true if equal\n     */\n    public static boolean propertiesEqual(Bean bean1, Bean bean2) {\n        var names = bean1.propertyNames();\n        if (!names.equals(bean2.propertyNames())) {\n            return false;\n        }\n        for (var name : names) {\n            var value1 = bean1.property(name).get();\n            var value2 = bean2.property(name).get();\n            if (!equal(value1, value2)) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /**\n     * Returns a hash code based on the set of properties on a bean.\n     * <p>\n     * This hash code is usable with the {@link #propertiesEqual} method.\n     * The result is the same as that if each bean was converted to a {@code Map}\n     * from name to value.\n     * \n     * @param bean  the bean to generate a hash code for, not null\n     * @return the hash code\n     */\n    public static int propertiesHashCode(Bean bean) {\n        var hash = 7;\n        var names = bean.propertyNames();\n        for (var name : names) {\n            var value = bean.property(name).get();\n            hash += hashCode(value);\n        }\n        return hash;\n    }\n\n    /**\n     * Returns a string describing the set of properties on a bean.\n     * <p>\n     * The result is the same as that if the bean was converted to a {@code Map}\n     * from name to value.\n     * \n     * @param bean  the bean to generate a string for, not null\n     * @param prefix  the prefix to use, null ignored\n     * @return the string form of the bean, not null\n     */\n    public static String propertiesToString(Bean bean, String prefix) {\n        if (prefix == null) {\n            return propertiesToString(bean, \"\");\n        }\n        var names = bean.propertyNames();\n        var buf = new StringBuilder((names.size()) * 32 + prefix.length()).append(prefix);\n        buf.append('{');\n        if (!names.isEmpty()) {\n            for (var name : names) {\n                var value = bean.property(name).get();\n                buf.append(name).append('=').append(value).append(',').append(' ');\n            }\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    /**\n     * Flattens a bean to a {@code Map}.\n     * <p>\n     * The returned map will contain all the properties from the bean with their actual values.\n     * \n     * @param bean  the bean to generate a string for, not null\n     * @return the bean as a map, not null\n     */\n    public static Map<String, Object> flatten(Bean bean) {\n        var propertyMap = bean.metaBean().metaPropertyMap();\n        var map = new LinkedHashMap<String, Object>(propertyMap.size());\n        for (var entry : propertyMap.entrySet()) {\n            map.put(entry.getKey(), entry.getValue().get(bean));\n        }\n        return Collections.unmodifiableMap(map);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Copies properties from a bean to a different bean type.\n     * <p>\n     * This copies each non-null property value from the source bean to the destination builder\n     * provided that the destination builder supports the property name and the type is compatible.\n     * \n     * @param <T>  the type of the bean to create\n     * @param sourceBean  the bean to copy from, not null\n     * @param destType  the type of the destination bean, not null\n     * @return the copied bean as a builder\n     * @throws RuntimeException if unable to copy a property\n     */\n    public static <T extends Bean> BeanBuilder<T> copy(Bean sourceBean, Class<T> destType) {\n        var destMeta = MetaBean.of(destType);\n        @SuppressWarnings(\"unchecked\")\n        var destBuilder = (BeanBuilder<T>) destMeta.builder();\n        return copyInto(sourceBean, destMeta, destBuilder);\n    }\n\n    /**\n     * Copies properties from a bean to a builder, which may be for a different type.\n     * <p>\n     * This copies each non-null property value from the source bean to the destination builder\n     * provided that the destination builder supports the property name and the type is compatible.\n     * \n     * @param <T>  the type of the bean to create\n     * @param sourceBean  the bean to copy from, not null\n     * @param destMeta  the meta bean of the destination, not null\n     * @param destBuilder  the builder to populate, not null\n     * @return the updated builder\n     * @throws RuntimeException if unable to copy a property\n     */\n    public static <T extends Bean> BeanBuilder<T> copyInto(Bean sourceBean, MetaBean destMeta, BeanBuilder<T> destBuilder) {\n        var sourceMeta = sourceBean.metaBean();\n        for (var sourceProp : sourceMeta.metaPropertyIterable()) {\n            if (destMeta.metaPropertyExists(sourceProp.name())) {\n                var destProp = destMeta.metaProperty(sourceProp.name());\n                if (destProp.propertyType().isAssignableFrom(sourceProp.propertyType())) {\n                    var sourceValue = sourceProp.get(sourceBean);\n                    if (sourceValue != null) {\n                        destBuilder.set(destProp, sourceValue);\n                    }\n                }\n            }\n        }\n        return destBuilder;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Deep clones an array.\n     * <p>\n     * This performs a deep clone and handles multi-dimensional arrays.\n     * There is no protection against cycles in the object graph beyond {@code StackOverflowError}.\n     * <p>\n     * Unfortunately, primitive arrays don't play nicely with generics, thus callers must cast the result.\n     * \n     * @param original  the original array to clone, null returns null\n     * @return the cloned array, null if null input\n     * @throws IllegalArgumentException if the original object is not an array\n     * @since 2.12.0\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static Object cloneArray(Object original) {\n        if (original == null) {\n            return null;\n        }\n        int len = Array.getLength(original);\n        Class<?> arrayType = original.getClass().getComponentType();\n        Object copy = Array.newInstance(arrayType, len);\n        for (int i = 0; i < len; i++) {\n            Array.set(copy, i, Cloner.INSTANCE.clone(Array.get(original, i)));\n        }\n        return copy;\n    }\n\n    /**\n     * Deep clones a bean, without cloning an {@code ImmutableBean}.\n     * <p>\n     * This performs a deep clone. There is no protection against cycles in\n     * the object graph beyond {@code StackOverflowError}.\n     * \n     * @param <T>  the type of the bean\n     * @param original  the original bean to clone, null returns null\n     * @return the cloned bean, null if null input\n     */\n    public static <T extends Bean> T clone(T original) {\n        if (original == null || original instanceof ImmutableBean) {\n            return original;\n        }\n        return cloneAlways(original);\n    }\n\n    /**\n     * Deep clones a bean always.\n     * <p>\n     * This performs a deep clone. There is no protection against cycles in\n     * the object graph beyond {@code StackOverflowError}.\n     * This differs from {@link #clone()} in that immutable beans are also cloned.\n     * \n     * @param <T>  the type of the bean\n     * @param original  the original bean to clone, not null\n     * @return the cloned bean, not null\n     */\n    public static <T extends Bean> T cloneAlways(T original) {\n        @SuppressWarnings(\"unchecked\")\n        var builder = (BeanBuilder<T>) original.metaBean().builder();\n        for (var mp : original.metaBean().metaPropertyIterable()) {\n            if (mp.style().isBuildable()) {\n                var value = mp.get(original);\n                builder.set(mp.name(), Cloner.INSTANCE.clone(value));\n            }\n        }\n        return builder.build();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Checks if the value is not null, throwing an exception if it is.\n     * \n     * @param value  the value to check, may be null\n     * @param propertyName  the property name, should not be null\n     * @throws IllegalArgumentException if the value is null\n     */\n    public static void notNull(Object value, String propertyName) {\n        if (value == null) {\n            throw new IllegalArgumentException(notNullMsg(propertyName));\n        }\n    }\n\n    // extracted from notNull(Object,String) to aid hotspot inlining\n    private static String notNullMsg(String propertyName) {\n        return \"Argument '\" + propertyName + \"' must not be null\";\n    }\n\n    /**\n     * Checks if the value is not blank, throwing an exception if it is.\n     * <p>\n     * Validate that the specified argument is not null and has at least one non-whitespace character.\n     * \n     * @param value  the value to check, may be null\n     * @param propertyName  the property name, should not be null\n     * @throws IllegalArgumentException if the value is null or empty\n     */\n    public static void notBlank(String value, String propertyName) {\n        if (value == null || value.isBlank()) {\n            throw new IllegalArgumentException(notEmpty(propertyName));\n        }\n    }\n\n    /**\n     * Checks if the value is not empty, throwing an exception if it is.\n     * \n     * @param value  the value to check, may be null\n     * @param propertyName  the property name, should not be null\n     * @throws IllegalArgumentException if the value is null or empty\n     */\n    public static void notEmpty(String value, String propertyName) {\n        if (value == null || value.isEmpty()) {\n            throw new IllegalArgumentException(notEmpty(propertyName));\n        }\n    }\n\n    // extracted from notEmpty(?,String) to aid hotspot inlining\n    private static String notEmpty(String propertyName) {\n        return \"Argument '\" + propertyName + \"' must not be empty\";\n    }\n\n    /**\n     * Checks if the collection value is not empty, throwing an exception if it is.\n     * \n     * @param value  the value to check, may be null\n     * @param propertyName  the property name, should not be null\n     * @throws IllegalArgumentException if the value is null or empty\n     */\n    public static void notEmpty(Collection<?> value, String propertyName) {\n        if (value == null || value.isEmpty()) {\n            throw new IllegalArgumentException(notEmpty(propertyName));\n        }\n    }\n\n    /**\n     * Checks if the map value is not empty, throwing an exception if it is.\n     * \n     * @param value  the value to check, may be null\n     * @param propertyName  the property name, should not be null\n     * @throws IllegalArgumentException if the value is null or empty\n     */\n    public static void notEmpty(Map<?, ?> value, String propertyName) {\n        if (value == null || value.isEmpty()) {\n            throw new IllegalArgumentException(notEmpty(propertyName));\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Extracts the collection content type as a {@code Class} from a property.\n     * <p>\n     * This method allows the resolution of generics in certain cases.\n     * \n     * @param prop  the property to examine, not null\n     * @return the collection content type, null if unable to determine or type has no generic parameters\n     */\n    public static Class<?> collectionType(Property<?> prop) {\n        return collectionType(prop.metaProperty(), prop.bean().getClass());\n    }\n\n    /**\n     * Extracts the collection content type as a {@code Class} from a meta-property.\n     * <p>\n     * The target type is the type of the object, not the declaring type of the meta-property.\n     * \n     * @param prop  the property to examine, not null\n     * @param contextClass  the context class to evaluate against, not null\n     * @return the collection content type, null if unable to determine or type has no generic parameters\n     */\n    public static Class<?> collectionType(MetaProperty<?> prop, Class<?> contextClass) {\n        return extractTypeClass(prop, contextClass, 1, 0);\n    }\n\n    /**\n     * Extracts the map value type generic type parameters as a {@code Class} from a meta-property.\n     * <p>\n     * The target type is the type of the object, not the declaring type of the meta-property.\n     * <p>\n     * This is used when the collection generic parameter is a map or collection.\n     * \n     * @param prop  the property to examine, not null\n     * @param contextClass  the context class to evaluate against, not null\n     * @return the collection content type generic parameters, empty if unable to determine, no nulls\n     */\n    public static List<Class<?>> collectionTypeTypes(MetaProperty<?> prop, Class<?> contextClass) {\n        var type = extractType(prop, contextClass, 1, 0);\n        return extractTypeClasses(type, contextClass);\n    }\n\n    /**\n     * Extracts the map key type as a {@code Class} from a meta-property.\n     * \n     * @param prop  the property to examine, not null\n     * @return the map key type, null if unable to determine or type has no generic parameters\n     */\n    public static Class<?> mapKeyType(Property<?> prop) {\n        return mapKeyType(prop.metaProperty(), prop.bean().getClass());\n    }\n\n    /**\n     * Extracts the map key type as a {@code Class} from a meta-property.\n     * <p>\n     * The target type is the type of the object, not the declaring type of the meta-property.\n     * \n     * @param prop  the property to examine, not null\n     * @param contextClass  the context class to evaluate against, not null\n     * @return the map key type, null if unable to determine or type has no generic parameters\n     */\n    public static Class<?> mapKeyType(MetaProperty<?> prop, Class<?> contextClass) {\n        return extractTypeClass(prop, contextClass, 2, 0);\n    }\n\n    /**\n     * Extracts the map value type as a {@code Class} from a meta-property.\n     * \n     * @param prop  the property to examine, not null\n     * @return the map value type, null if unable to determine or type has no generic parameters\n     */\n    public static Class<?> mapValueType(Property<?> prop) {\n        return mapValueType(prop.metaProperty(), prop.bean().getClass());\n    }\n\n    /**\n     * Extracts the map value type as a {@code Class} from a meta-property.\n     * <p>\n     * The target type is the type of the object, not the declaring type of the meta-property.\n     * \n     * @param prop  the property to examine, not null\n     * @param contextClass  the context class to evaluate against, not null\n     * @return the map value type, null if unable to determine or type has no generic parameters\n     */\n    public static Class<?> mapValueType(MetaProperty<?> prop, Class<?> contextClass) {\n        return extractTypeClass(prop, contextClass, 2, 1);\n    }\n\n    /**\n     * Extracts the map value type generic type parameters as a {@code Class} from a meta-property.\n     * <p>\n     * The target type is the type of the object, not the declaring type of the meta-property.\n     * <p>\n     * This is used when the map value generic parameter is a map or collection.\n     * \n     * @param prop  the property to examine, not null\n     * @param contextClass  the context class to evaluate against, not null\n     * @return the map value type generic parameters, empty if unable to determine, no nulls\n     */\n    public static List<Class<?>> mapValueTypeTypes(MetaProperty<?> prop, Class<?> contextClass) {\n        var type = extractType(prop, contextClass, 2, 1);\n        return extractTypeClasses(type, contextClass);\n    }\n\n    /**\n     * Low-level method to extract generic type information.\n     * \n     * @param prop  the property to examine, not null\n     * @param contextClass  the context class to evaluate against, not null\n     * @param size  the number of generic parameters expected\n     * @param index  the index of the generic parameter\n     * @return the type, null if unable to determine or type has no generic parameters\n     */\n    public static Class<?> extractTypeClass(MetaProperty<?> prop, Class<?> contextClass, int size, int index) {\n        return eraseToClass(extractType(prop, contextClass, size, index));\n    }\n\n    private static Type extractType(MetaProperty<?> prop, Class<?> contextClass, int size, int index) {\n        var genType = prop.propertyGenericType();\n        if (genType instanceof ParameterizedType pt) {\n            var types = pt.getActualTypeArguments();\n            if (types.length == size) {\n                var type = types[index];\n                if (type instanceof WildcardType wtype) {\n                    if (wtype.getLowerBounds().length == 0 && wtype.getUpperBounds().length > 0) {\n                        type = wtype.getUpperBounds()[0];\n                    }\n                }\n                if (type instanceof TypeVariable<?> tvar) {\n                    type = resolveGenerics(tvar, contextClass);\n                }\n                return type;\n            }\n        }\n        return null;\n    }\n\n    private static List<Class<?>> extractTypeClasses(Type type, Class<?> contextClass) {\n        var result = new ArrayList<Class<?>>();\n        if (type != null) {\n            if (type instanceof ParameterizedType pt) {\n                var actualTypes = pt.getActualTypeArguments();\n                for (var actualType : actualTypes) {\n                    if (actualType instanceof TypeVariable<?> tvar) {\n                        actualType = resolveGenerics(tvar, contextClass);\n                    }\n                    var cls = eraseToClass(actualType);\n                    result.add(cls != null ? cls : Object.class);\n                }\n            }\n        }\n        return result;\n    }\n\n    // cache the type variable lookup by Class\n    private static final ClassValue<Map<Type, Type>> RESOLVED_TYPE_VARIABLES = new ClassValue<>() {\n        @Override\n        protected Map<Type, Type> computeValue(Class<?> contextClass) {\n            var resolved = new HashMap<Type, Type>();\n            findTypeVars(contextClass, resolved);\n            if (resolved.size() > 1) {\n                // simplify, eg 'T=N, N=String' is simplified to 'T=String, N=String'\n                for (var entry : resolved.entrySet()) {\n                    var value = entry.getValue();\n                    while (resolved.containsKey(value)) {\n                        value = resolved.get(value);\n                    }\n                    entry.setValue(value);\n                }\n            }\n            return Collections.unmodifiableMap(resolved);\n        }\n\n        private void findTypeVars(Type type, HashMap<Type, Type> resolved) {\n            if (type instanceof Class<?> cls) {\n                // check parent class and interfaces\n                findTypeVars(cls.getGenericSuperclass(), resolved);\n                for (var genInterface : cls.getGenericInterfaces()) {\n                    findTypeVars(genInterface, resolved);\n                }\n\n            } else if (type instanceof ParameterizedType pt) {\n                // find actual types that have been captured\n                var actualTypeArguments = pt.getActualTypeArguments();\n                // find type variables declared in source code\n                var rawType = eraseToClass(pt.getRawType());\n                var typeParameters = rawType.getTypeParameters();\n                for (var i = 0; i < actualTypeArguments.length; i++) {\n                    resolved.put(typeParameters[i], actualTypeArguments[i]);\n                }\n                findTypeVars(rawType, resolved);\n            }\n        }\n    };\n\n    // resolve generic type variables\n    // if a subclass is defined as 'extends Foo<String>' and the superclass is 'Foo<T>'\n    // then we know that 'T = String' in the context of the subclass\n    // NOTE: this may return a type variable\n    static Type resolveGenerics(TypeVariable<?> typevar, Class<?> contextClass) {\n        var resolved = RESOLVED_TYPE_VARIABLES.get(contextClass);\n        return resolved.getOrDefault(typevar, typevar);\n    }\n\n    // erases a Type to a Class\n    static Class<?> eraseToClass(Type type) {\n        return switch (type) {\n            case null -> null;\n            case Class<?> cls -> cls;\n            case ParameterizedType parameterizedType -> eraseToClass(parameterizedType.getRawType());\n            case GenericArrayType arrType -> {\n                var componentType = arrType.getGenericComponentType();\n                var componentClass = eraseToClass(componentType);\n                yield componentClass != null ? componentClass.arrayType() : null;\n            }\n            case TypeVariable<?> tvar -> {\n                var bounds = tvar.getBounds();\n                yield bounds.length == 0 ? Object.class : eraseToClass(bounds[0]);\n            }\n            case WildcardType wild -> {\n                var bounds = wild.getUpperBounds();\n                yield bounds.length == 0 ? Object.class : eraseToClass(bounds[0]);\n            }\n            default -> null;\n        };\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Checks if two beans are equal ignoring one or more properties.\n     * <p>\n     * This version of {@code equalIgnoring} only checks properties at the top level.\n     * For example, if a {@code Person} bean contains an {@code Address} bean then\n     * only properties on the {@code Person} bean will be checked against the ignore list.\n     * \n     * @param bean1  the first bean, not null\n     * @param bean2  the second bean, not null\n     * @param properties  the properties to ignore, not null\n     * @return true if equal\n     * @throws IllegalArgumentException if inputs are null\n     */\n    public static boolean equalIgnoring(Bean bean1, Bean bean2, MetaProperty<?>... properties) {\n        JodaBeanUtils.notNull(bean1, \"bean1\");\n        JodaBeanUtils.notNull(bean2, \"bean2\");\n        JodaBeanUtils.notNull(properties, \"properties\");\n        if (bean1 == bean2) {\n            return true;\n        }\n        if (bean1.getClass() != bean2.getClass()) {\n            return false;\n        }\n        return switch (properties.length) {\n            case 0 -> bean1.equals(bean2);\n            case 1 -> {\n                var ignored = properties[0];\n                for (var mp : bean1.metaBean().metaPropertyIterable()) {\n                    if (!ignored.equals(mp) && !JodaBeanUtils.equal(mp.get(bean1), mp.get(bean2))) {\n                        yield false;\n                    }\n                }\n                yield true;\n            }\n            default -> {\n                var ignored = Set.of(properties);\n                for (var mp : bean1.metaBean().metaPropertyIterable()) {\n                    if (!ignored.contains(mp) && !JodaBeanUtils.equal(mp.get(bean1), mp.get(bean2))) {\n                        yield false;\n                    }\n                }\n                yield true;\n            }\n        };\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns an iterator over all the beans contained within the bean.\n     * <p>\n     * The iterator is a depth-first traversal of the beans within the specified bean.\n     * The first returned bean is the specified bean.\n     * Beans within collections will be returned.\n     * <p>\n     * A cycle in the bean structure will cause an infinite loop.\n     * \n     * @param bean  the bean to iterate over, not null\n     * @return the iterator, not null\n     */\n    public static Iterator<Bean> beanIterator(Bean bean) {\n        return new BeanIterator(bean);\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Chains two meta-properties together.\n     * <p>\n     * The resulting function takes an instance of a bean, queries using the first\n     * meta-property, then queries the result using the second meta-property.\n     * If the first returns null, the result will be null.\n     * \n     * @param <P>  the type of the result of the chain\n     * @param mp1  the first meta-property, not null\n     * @param mp2  the second meta-property, not null\n     * @return the chain function, not null\n     */\n    public static <P> Function<Bean, P> chain(MetaProperty<? extends Bean> mp1, MetaProperty<P> mp2) {\n        notNull(mp1, \"MetaProperty 1\");\n        notNull(mp1, \"MetaProperty 2\");\n        return b -> {\n            var first = mp1.get(b);\n            return first != null ? mp2.get(first) : null;\n        };\n    }\n\n    /**\n     * Chains a function to a meta-property.\n     * <p>\n     * The resulting function takes an instance of a bean, queries using the first\n     * function, then queries the result using the second meta-property.\n     * If the first returns null, the result will be null.\n     * \n     * @param <P>  the type of the result of the chain\n     * @param fn1  the first meta-property, not null\n     * @param mp2  the second meta-property, not null\n     * @return the chain function, not null\n     */\n    public static <P> Function<Bean, P> chain(Function<Bean, ? extends Bean> fn1, MetaProperty<P> mp2) {\n        notNull(fn1, \"Function 1\");\n        notNull(fn1, \"MetaProperty 2\");\n        return b -> {\n            var first = fn1.apply(b);\n            return first != null ? mp2.get(first) : null;\n        };\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Obtains a comparator for the specified bean query.\n     * <p>\n     * The result of the query must be {@link Comparable}.\n     * <p>\n     * To use this with a meta-property append {@code ::get} to the meta-property,\n     * for example {@code Address.meta().street()::get}.\n     * \n     * @param query  the query to use, not null\n     * @param ascending  true for ascending, false for descending\n     * @return the comparator, not null\n     */\n    public static Comparator<Bean> comparator(Function<Bean, ?> query, boolean ascending) {\n        return (ascending ? comparatorAscending(query) : comparatorDescending(query));\n    }\n\n    /**\n     * Obtains an ascending comparator for the specified bean query.\n     * <p>\n     * The result of the query must be {@link Comparable}.\n     * \n     * @param query  the query to use, not null\n     * @return the comparator, not null\n     */\n    public static Comparator<Bean> comparatorAscending(Function<Bean, ?> query) {\n        Objects.requireNonNull(query, \"query must not be null\");\n        return new Comp(query);\n    }\n\n    /**\n     * Obtains a descending comparator for the specified bean query.\n     * <p>\n     * The result of the query must be {@link Comparable}.\n     * \n     * @param query  the query to use, not null\n     * @return the comparator, not null\n     */\n    public static Comparator<Bean> comparatorDescending(Function<Bean, ?> query) {\n        Objects.requireNonNull(query, \"query must not be null\");\n        return Collections.reverseOrder(new Comp(query));\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Comparator.\n     */\n    private static final class Comp implements Comparator<Bean> {\n        private final Function<Bean, ?> query;\n\n        private Comp(Function<Bean, ?> query) {\n            this.query = query;\n        }\n\n        @Override\n        public int compare(Bean bean1, Bean bean2) {\n            @SuppressWarnings(\"unchecked\")\n            var value1 = (Comparable<Object>) query.apply(bean1);\n            Object value2 = query.apply(bean2);\n            return value1.compareTo(value2);\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Clones an object.\n     */\n    @SuppressWarnings({\"rawtypes\", \"unchecked\"})\n    private static class Cloner {\n        public static final Cloner INSTANCE = getInstance();\n\n        private static Cloner getInstance() {\n            try {\n                ImmutableGrid.of();  // check if class is available\n                return new CollectCloner();\n            } catch (Exception | LinkageError ex) {\n                try {\n                    ImmutableMultiset.of();  // check if class is available\n                    return new GuavaCloner();\n                } catch (Exception | LinkageError ex2) {\n                    return new Cloner();\n                }\n            }\n        }\n\n        Cloner() {\n        }\n\n        Object clone(Object value) {\n            return switch (value) {\n                case null -> value;\n                case Bean bean -> cloneAlways(bean);\n                case SortedSet set -> cloneIterable(set, new TreeSet(set.comparator()));\n                case Set set -> cloneIterable(set, LinkedHashSet.newLinkedHashSet(set.size()));\n                case Collection coll -> cloneIterable(coll, new ArrayList(coll.size()));\n                case Iterable iterable -> cloneIterable(iterable, new ArrayList());\n                case SortedMap map -> cloneMap(map, new TreeMap(map.comparator()));\n                case Map map -> cloneMap(map, LinkedHashMap.newLinkedHashMap(map.size()));\n                case java.util.Date date -> date.clone();\n                case long[] array -> array.clone();\n                case int[] array -> array.clone();\n                case short[] array -> array.clone();\n                case byte[] array -> array.clone();\n                case char[] array -> array.clone();\n                case double[] array -> array.clone();\n                case float[] array -> array.clone();\n                case boolean[] array -> array.clone();\n                case Object[] array -> cloneArray(array);\n                default -> value;\n            };\n        }\n\n        Object cloneIterable(Iterable original, Collection cloned) {\n            for (var item : original) {\n                cloned.add(clone(item));\n            }\n            return cloned;\n        }\n\n        Object cloneMap(Map original, Map cloned) {\n            for (var item : original.entrySet()) {\n                var entry = (Entry) item;\n                cloned.put(clone(entry.getKey()), clone(entry.getValue()));\n            }\n            return cloned;\n        }\n\n        Object cloneArray(Object[] originalArray) {\n            var copy = originalArray.clone();\n            for (var i = 0; i < copy.length; i++) {\n                copy[i] = clone(originalArray[i]);\n            }\n            return copy;\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Clones an object.\n     */\n    @SuppressWarnings({\"rawtypes\", \"unchecked\"})\n    private static class GuavaCloner extends Cloner {\n        GuavaCloner() {\n        }\n\n        @Override\n        Object clone(Object value) {\n            return switch (value) {\n                case null -> value;\n                case ImmutableCollection coll -> coll;\n                case ImmutableMap map -> map;\n                case ImmutableMultimap map -> map;\n                case ImmutableTable table -> table;\n                case SortedMultiset set -> cloneIterable(set, TreeMultiset.create(set.comparator()));\n                case Multiset mset -> cloneIterable(mset, LinkedHashMultiset.create(mset.size()));\n                case SetMultimap mmap -> cloneMultimap(mmap, LinkedHashMultimap.create());\n                case ListMultimap mmap -> cloneMultimap(mmap, ArrayListMultimap.create());\n                case Multimap mmap -> cloneMultimap(mmap, ArrayListMultimap.create());\n                case BiMap bimap -> cloneMap(bimap, HashBiMap.create(bimap.size()));\n                case Table table -> cloneTable(table, HashBasedTable.create());\n                default -> super.clone(value);\n            };\n        }\n\n        Object cloneMultimap(Multimap original, Multimap cloned) {\n            for (var key : original.keySet()) {\n                var values = original.get(key);\n                for (var value : values) {\n                    cloned.put(clone(key), clone(value));\n                }\n            }\n            return cloned;\n        }\n\n        Object cloneTable(Table original, Table cloned) {\n            for (var item : original.cellSet()) {\n                var cell = (Table.Cell) item;\n                cloned.put(clone(cell.getRowKey()), clone(cell.getColumnKey()), clone(cell.getValue()));\n            }\n            return cloned;\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Clones an object.\n     */\n    @SuppressWarnings({\"rawtypes\", \"unchecked\"})\n    private static class CollectCloner extends GuavaCloner {\n        CollectCloner() {\n        }\n\n        @Override\n        Object clone(Object value) {\n            return switch (value) {\n                case null -> value;\n                case ImmutableGrid grid -> grid;\n                case DenseGrid grid -> cloneGrid(grid, DenseGrid.create(grid.rowCount(), grid.columnCount()));\n                case Grid grid -> cloneGrid(grid, SparseGrid.create(grid.rowCount(), grid.columnCount()));\n                default -> super.clone(value);\n            };\n        }\n\n        Object cloneGrid(Grid original, Grid cloned) {\n            for (var item : original.cells()) {\n                var cell = (Grid.Cell) item;\n                cloned.put(cell.getRow(), cell.getColumn(), clone(cell.getValue()));\n            }\n            return cloned;\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/MetaBean.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans;\r\n\r\nimport java.lang.annotation.Annotation;\r\nimport java.util.List;\r\nimport java.util.Map;\r\nimport java.util.NoSuchElementException;\r\nimport java.util.Optional;\r\n\r\n/**\r\n * A meta-bean, defining those aspects of a bean which are not specific\r\n * to a particular instance, such as the type and set of meta-properties.\r\n * <p>\r\n * This interface can be thought of as the equivalent of {@link Class} but for beans.\r\n * In most cases the meta-bean will be code generated and the concrete class will have additional methods.\r\n */\r\npublic interface MetaBean {\r\n\r\n    /**\r\n     * Obtains a meta-bean from a {@code Class}.\r\n     * <p>\r\n     * This will return a meta-bean if it has been registered, or if the class\r\n     * implements {@link DynamicBean} and has a no-args constructor.\r\n     * Note that the common case where the meta-bean is registered by a static initializer is handled.\r\n     * \r\n     * @param cls  the class to get the meta-bean for, not null\r\n     * @return the meta-bean associated with the class, not null\r\n     * @throws IllegalArgumentException if unable to obtain the meta-bean\r\n     */\r\n    public static MetaBean of(Class<?> cls) {\r\n        return MetaBeans.lookup(cls);\r\n    }\r\n\r\n    /**\r\n     * Registers a meta-bean.\r\n     * <p>\r\n     * This should be done for all beans in a static factory where possible.\r\n     * If the meta-bean is dynamic, this method should not be called.\r\n     * \r\n     * @param metaBean  the meta-bean, not null\r\n     * @throws IllegalArgumentException if unable to register\r\n     */\r\n    public static void register(MetaBean metaBean) {\r\n        MetaBeans.register(metaBean);\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Checks whether this bean is buildable or not.\r\n     * <p>\r\n     * A buildable bean can be constructed using {@link #builder()}.\r\n     * If this method returns true then {@code builder()} must return a valid builder.\r\n     * If this method returns false then {@code builder()} must throw {@link UnsupportedOperationException}.\r\n     * \r\n     * @return true if this bean is buildable\r\n     */\r\n    public abstract boolean isBuildable();\r\n\r\n    /**\r\n     * Creates a bean builder that can be used to create an instance of this bean.\r\n     * <p>\r\n     * The builder is used in two main ways.\r\n     * The first is to allow immutable beans to be constructed.\r\n     * The second is to enable automated tools like serialization/deserialization.\r\n     * <p>\r\n     * The builder can be thought of as a {@code Map} of {@link MetaProperty} to value.\r\n     * Note that the implementation is not necessarily an actual map.\r\n     * \r\n     * @return the bean builder, not null\r\n     * @throws UnsupportedOperationException if the bean cannot be created\r\n     */\r\n    public abstract BeanBuilder<? extends Bean> builder();\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Gets the bean name, which is normally the fully qualified class name of the bean.\r\n     * <p>\r\n     * This is primarily used for human-readable output.\r\n     * \r\n     * @return the name of the bean, not empty\r\n     */\r\n    public default String beanName() {\r\n        return beanType().getName();\r\n    }\r\n\r\n    /**\r\n     * Get the type of the bean, represented as a {@code Class}.\r\n     * <p>\r\n     * A {@code MetaBean} can be thought of as the equivalent of {@link Class} but for beans.\r\n     * This method allows the actual {@code Class} instance of the bean to be obtained.\r\n     * \r\n     * @return the type of the bean, not null\r\n     */\r\n    public abstract Class<? extends Bean> beanType();\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Counts the number of properties.\r\n     * <p>\r\n     * Each meta-bean manages a single bean with a known set of properties.\r\n     * This method returns the count of properties.\r\n     * \r\n     * @return the number of properties\r\n     */\r\n    public default int metaPropertyCount() {\r\n        return metaPropertyMap().size();\r\n    }\r\n\r\n    /**\r\n     * Checks if a property exists.\r\n     * <p>\r\n     * Each meta-bean manages a single bean with a known set of properties.\r\n     * This method checks whether there is a property with the specified name.\r\n     * \r\n     * @param propertyName  the property name to check, null returns false\r\n     * @return true if the property exists\r\n     */\r\n    public default boolean metaPropertyExists(String propertyName) {\r\n        return metaPropertyMap().containsKey(propertyName);\r\n    }\r\n\r\n    /**\r\n     * Gets a meta-property by name.\r\n     * <p>\r\n     * Each meta-bean manages a single bean with a known set of properties.\r\n     * This method returns the property with the specified name.\r\n     * <p>\r\n     * The base interface throws an exception if the name is not recognised.\r\n     * By contrast, the {@code DynamicMetaBean} interface creates the property on demand.\r\n     * \r\n     * @param <R>  the property type, optional, enabling auto-casting\r\n     * @param propertyName  the property name to retrieve, not null\r\n     * @return the meta property, not null\r\n     * @throws NoSuchElementException if the property name is invalid\r\n     */\r\n    @SuppressWarnings(\"unchecked\")\r\n    public default <R> MetaProperty<R> metaProperty(String propertyName) {\r\n        var mp = metaPropertyMap().get(propertyName);\r\n        if (mp == null) {\r\n            throw new NoSuchElementException(\"Unknown property: \" + propertyName);\r\n        }\r\n        return (MetaProperty<R>) mp;\r\n    }\r\n\r\n    /**\r\n     * Gets an iterator of meta-properties.\r\n     * <p>\r\n     * This method returns an {@code Iterable}, which is simpler than a {@code Map}.\r\n     * As a result, implementations may be able to optimise, and so this method should be\r\n     * preferred to {@link #metaPropertyMap()} where a choice is possible.\r\n     * \r\n     * @return the unmodifiable map of meta property objects, not null\r\n     */\r\n    public default Iterable<MetaProperty<?>> metaPropertyIterable() {\r\n        return metaPropertyMap().values();\r\n    }\r\n\r\n    /**\r\n     * Gets the map of meta-properties, keyed by property name.\r\n     * <p>\r\n     * Where possible, use {@link #metaPropertyIterable()} instead as it typically has better performance.\r\n     * \r\n     * @return the unmodifiable map of meta property objects, not null\r\n     */\r\n    public abstract Map<String, MetaProperty<?>> metaPropertyMap();\r\n\r\n    /**\r\n     * Gets the annotations associated with this bean.\r\n     * <p>\r\n     * The annotations are queried from the bean.\r\n     * This is typically accomplished by querying the annotations of an underlying\r\n     * {@link Class} however any strategy is permitted.\r\n     * <p>\r\n     * If the implementation has a mutable set of annotations, then the result of\r\n     * this method must stream over those annotations in existence when this method\r\n     * is called to avoid concurrency issues.\r\n     * <p>\r\n     * The default implementation uses the annotations from {@link #beanType()}.\r\n     * \r\n     * @return the annotations, unmodifiable, not null\r\n     */\r\n    public default List<Annotation> annotations() {\r\n        return List.of(beanType().getAnnotations());\r\n    }\r\n\r\n    /**\r\n     * Gets an annotation from the bean.\r\n     * <p>\r\n     * The annotations are queried from the bean.\r\n     * This is typically accomplished by querying the annotations of an underlying\r\n     * {@link Class} however any strategy is permitted.\r\n     * \r\n     * @param <A>  the annotation type\r\n     * @param annotationClass  the annotation class to find, not null\r\n     * @return the annotation, not null\r\n     * @throws NoSuchElementException if the annotation is not specified\r\n     */\r\n    @SuppressWarnings(\"unchecked\")\r\n    public default <A extends Annotation> A annotation(Class<A> annotationClass) {\r\n        var annotations = annotations();\r\n        for (var annotation : annotations) {\r\n            if (annotationClass.isInstance(annotation)) {\r\n                return (A) annotation;\r\n            }\r\n        }\r\n        throw new NoSuchElementException(\"Unknown annotation: \" + annotationClass.getName());\r\n    }\r\n\r\n    /**\r\n     * Finds an optional annotation from the property.\r\n     * <p>\r\n     * The annotations are queried from the property.\r\n     * This is typically accomplished by querying the annotations of the underlying\r\n     * instance variable however any strategy is permitted.\r\n     * \r\n     * @param <A>  the annotation type\r\n     * @param annotationClass  the annotation class to find, not null\r\n     * @return the annotation, empty if not found\r\n     * @since 2.11.0\r\n     */\r\n    @SuppressWarnings(\"unchecked\")\r\n    public default <A extends Annotation> Optional<A> annotationOpt(Class<A> annotationClass) {\r\n        var annotations = annotations();\r\n        for (var annotation : annotations) {\r\n            if (annotationClass.isInstance(annotation)) {\r\n                return Optional.of((A) annotation);\r\n            }\r\n        }\r\n        return Optional.empty();\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/MetaBeanProvider.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\n/**\n * A provider of {@link MetaBean} instances for bean classes.\n */\npublic interface MetaBeanProvider {\n\n    /**\n     * Returns the meta bean for the class or null if no meta bean can be found.\n     *\n     * @param cls the class for which the meta bean is required\n     * @return the meta bean for the class or null if no meta bean can be found\n     */\n    MetaBean findMetaBean(Class<?> cls);\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/MetaBeans.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport java.lang.invoke.MethodHandles;\nimport java.lang.reflect.InvocationTargetException;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\n\nimport org.joda.beans.impl.RecordBean;\nimport org.joda.beans.impl.flexi.FlexiBean;\nimport org.joda.beans.impl.map.MapBean;\n\n/**\n * Utilities for registered meta-beans.\n */\nfinal class MetaBeans {\n\n    /**\n     * The cache of meta-beans.\n     */\n    private static final ConcurrentHashMap<Class<?>, MetaBean> META_BEANS = new ConcurrentHashMap<>();\n    // not a ClassValue, as entries are registered manually\n\n    /**\n     * The cache of meta-bean providers; access is guarded by a lock on {@code MetaBeans.class}.\n     */\n    private static final Map<Class<?>, MetaBeanProvider> META_BEAN_PROVIDERS = new HashMap<>();\n    // not a ClassValue, as it is not on the fast path\n\n    /**\n     * Restricted constructor.\n     */\n    private MetaBeans() {\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the meta-bean for a class.\n     * <p>\n     * This only works for those beans that have registered their meta-beans.\n     * <p>\n     * A {@code Class} may use a static initializer block to call {@code register}.\n     * The edge case where the class is loaded but not initialized is handled\n     * by forcing the class to be initialized if necessary.\n     * \n     * @param cls  the class to get the meta-bean for, not null\n     * @return the meta-bean, not null\n     * @throws IllegalArgumentException if unable to obtain the meta-bean\n     */\n    static MetaBean lookup(Class<?> cls) {\n        var meta = META_BEANS.get(cls);\n        if (meta == null) {\n            return metaBeanLookup(cls);\n        }\n        return meta;\n    }\n\n    // lookup the MetaBean outside the fast path, aiding hotspot inlining\n    private static MetaBean metaBeanLookup(Class<?> cls) {\n        // handle dynamic beans\n        if (cls == FlexiBean.class) {\n            return new FlexiBean().metaBean();\n        } else if (cls == MapBean.class) {\n            return new MapBean().metaBean();\n        } else if (DynamicBean.class.isAssignableFrom(cls)) {\n            try {\n                return cls.asSubclass(DynamicBean.class).getDeclaredConstructor().newInstance().metaBean();\n            } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException ex) {\n                throw new IllegalArgumentException(\"Unable to find meta-bean for a DynamicBean: \" + cls.getName(), ex);\n            }\n        }\n        // a Class can be loaded without being initialized\n        // in this state, the static initializers have not run, and thus the metabean not registered\n        // here initialization is forced to handle that scenario\n        try {\n            cls = Class.forName(cls.getName(), true, cls.getClassLoader());\n        } catch (ClassNotFoundException | Error ex) {\n            // should be impossible\n            throw new IllegalArgumentException(\"Unable to find meta-bean: \" + cls.getName(), ex);\n        }\n        var meta = META_BEANS.get(cls);\n        if (meta != null) {\n            return meta;\n        }\n        // Synchronization is necessary to prevent a race condition where the same meta-bean is registered twice\n        synchronized (MetaBeans.class) {\n            // Re-check in case the meta-bean has been added by another thread since we checked above\n            meta = META_BEANS.get(cls);\n            if (meta != null) {\n                return meta;\n            }\n            // handle records\n            if (cls.isRecord() && ImmutableBean.class.isAssignableFrom(cls)) {\n                @SuppressWarnings({\"rawtypes\", \"unchecked\"})\n                var metaBean = RecordBean.register((Class) cls, MethodHandles.lookup());\n                return metaBean;\n            }\n            // handle provider annotations\n            var providerAnnotation = findProviderAnnotation(cls);\n            if (providerAnnotation != null) {\n                var providerClass = providerAnnotation.value();\n                try {\n                    var provider = META_BEAN_PROVIDERS.get(providerClass);\n                    if (provider == null) {\n                        provider = providerClass.getDeclaredConstructor().newInstance();\n                        META_BEAN_PROVIDERS.put(providerClass, provider);\n                    }\n                    meta = provider.findMetaBean(cls);\n                    if (meta == null) {\n                        throw new IllegalArgumentException(\"Unable to find meta-bean: \" + cls.getName());\n                    }\n                    register(meta);\n                    return meta;\n                } catch (Exception e) {\n                    throw new IllegalStateException(\"Unable to create instance of \" + providerClass.getName() +\n                        \" to provide meta bean for \" + cls.getName(), e);\n                }\n            }\n        }\n        throw new IllegalArgumentException(\"Unable to find meta-bean: \" + cls.getName());\n    }\n\n    // returns the MetaProvider annotation from the class or null if none can be found.\n    // the class and all its superclasses and interfaces are searched.\n    // if the annotation is found in multiple places then it is undefined which is returned.\n    private static MetaProvider findProviderAnnotation(Class<?> cls) {\n        var providerAnnotation = cls.getAnnotation(MetaProvider.class);\n        if (providerAnnotation != null) {\n            return providerAnnotation;\n        }\n        for (var implementedInterface : cls.getInterfaces()) {\n            providerAnnotation = implementedInterface.getAnnotation(MetaProvider.class);\n            if (providerAnnotation != null) {\n                return providerAnnotation;\n            }\n        }\n        var superclass = cls.getSuperclass();\n        if (superclass == null || superclass.equals(Object.class)) {\n            return null;\n        }\n        return findProviderAnnotation(superclass);\n    }\n\n    /**\n     * Registers a meta-bean.\n     * <p>\n     * This should be done for all beans in a static factory where possible.\n     * If the meta-bean is dynamic, this method should not be called.\n     * \n     * @param metaBean  the meta-bean, not null\n     * @throws IllegalArgumentException if unable to register\n     */\n    static void register(MetaBean metaBean) {\n        var type = metaBean.beanType();\n        if (META_BEANS.putIfAbsent(type, metaBean) != null) {\n            throw new IllegalArgumentException(\"Cannot register class twice: \" + type.getName());\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/MetaProperty.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans;\r\n\r\nimport java.lang.annotation.Annotation;\r\nimport java.lang.reflect.Type;\r\nimport java.util.List;\r\nimport java.util.NoSuchElementException;\r\nimport java.util.Optional;\r\n\r\nimport org.joda.beans.impl.BasicProperty;\r\nimport org.joda.convert.StringConvert;\r\n\r\n/**\r\n * A meta-property, defining those aspects of a property which are not specific\r\n * to a particular bean, such as the property type and name.\r\n * \r\n * @param <P>  the type of the property content\r\n */\r\npublic interface MetaProperty<P> {\r\n\r\n    /**\r\n     * Creates a property that binds this meta-property to a specific bean.\r\n     * <p>\r\n     * This method returns a {@code Property} instance that connects this meta-property to the specified bean.\r\n     * The result can be queried and passed around without further reference to the bean.\r\n     * \r\n     * @param bean  the bean to create the property for, not null\r\n     * @return the property, not null\r\n     */\r\n    public default Property<P> createProperty(Bean bean) {\r\n        return BasicProperty.of(bean, this);\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Gets the meta-bean which owns this meta-property.\r\n     * <p>\r\n     * Each meta-property is fully owned by a single bean.\r\n     * \r\n     * @return the meta-bean, not null\r\n     */\r\n    public abstract MetaBean metaBean();\r\n\r\n    /**\r\n     * Gets the property name.\r\n     * <p>\r\n     * The JavaBean style methods getFoo() and setFoo() will lead to a property\r\n     * name of 'foo' and so on.\r\n     * \r\n     * @return the name of the property, not empty\r\n     */\r\n    public abstract String name();\r\n\r\n    /**\r\n     * Get the type that declares the property, represented as a {@code Class}.\r\n     * <p>\r\n     * This is the type of the bean where the property is declared.\r\n     * \r\n     * @return the type declaring the property, not null\r\n     */\r\n    public abstract Class<?> declaringType();\r\n\r\n    /**\r\n     * Get the type of the property represented as a {@code Class}.\r\n     * <p>\r\n     * This is the type of the property.\r\n     * For example, the surname of a person would typically be a {@code String}.\r\n     * \r\n     * @return the type of the property, not null\r\n     */\r\n    public abstract Class<P> propertyType();\r\n\r\n    /**\r\n     * Gets the generic types of the property.\r\n     * <p>\r\n     * This provides access to the generic type declared in the source code.\r\n     * \r\n     * @return the full generic type of the property, not null\r\n     */\r\n    public abstract Type propertyGenericType();\r\n\r\n    /**\r\n     * Gets the resolved generic type of the property.\r\n     * <p>\r\n     * This provides access to the generic type resolved relative to the context class.\r\n     * \r\n     * @param contextClass  the context class, typically the bean implementation class\r\n     * @return the resolved generic type of the property, not null\r\n     */\r\n    public default ResolvedType propertyResolvedType(Class<?> contextClass) {\r\n        return ResolvedType.from(propertyGenericType(), contextClass);\r\n    }\r\n\r\n    /**\r\n     * Gets the style of the property, such as read-only, read-write or write-only.\r\n     * <p>\r\n     * Rather than testing against specific values, it is strongly recommended to\r\n     * call the helper methods on the returned style.\r\n     * \r\n     * @return the property style, not null\r\n     */\r\n    public abstract PropertyStyle style();\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Gets the annotations of the property.\r\n     * <p>\r\n     * The annotations are queried from the property.\r\n     * This is typically accomplished by querying the annotations of the underlying\r\n     * instance variable however any strategy is permitted. If the implementation\r\n     * does not support annotations, an empty list will be returned.\r\n     * \r\n     * @return the annotations, unmodifiable, not null\r\n     */\r\n    public abstract List<Annotation> annotations();\r\n\r\n    /**\r\n     * Gets an annotation from the property.\r\n     * <p>\r\n     * The annotations are queried from the property.\r\n     * This is typically accomplished by querying the annotations of the underlying\r\n     * instance variable however any strategy is permitted.\r\n     * \r\n     * @param <A>  the annotation type\r\n     * @param annotationClass  the annotation class to find, not null\r\n     * @return the annotation, not null\r\n     * @throws NoSuchElementException if the annotation is not found\r\n     */\r\n    @SuppressWarnings(\"unchecked\")\r\n    public default <A extends Annotation> A annotation(Class<A> annotationClass) {\r\n        var annotations = annotations();\r\n        for (var annotation : annotations) {\r\n            if (annotationClass.isInstance(annotation)) {\r\n                return (A) annotation;\r\n            }\r\n        }\r\n        throw new NoSuchElementException(\"Unknown annotation: \" + annotationClass.getName());\r\n    }\r\n\r\n    /**\r\n     * Finds an optional annotation from the property.\r\n     * <p>\r\n     * The annotations are queried from the property.\r\n     * This is typically accomplished by querying the annotations of the underlying\r\n     * instance variable however any strategy is permitted.\r\n     * \r\n     * @param <A>  the annotation type\r\n     * @param annotationClass  the annotation class to find, not null\r\n     * @return the annotation, empty if not found\r\n     * @since 2.11.0\r\n     */\r\n    @SuppressWarnings(\"unchecked\")\r\n    public default <A extends Annotation> Optional<A> annotationOpt(Class<A> annotationClass) {\r\n        var annotations = annotations();\r\n        for (var annotation : annotations) {\r\n            if (annotationClass.isInstance(annotation)) {\r\n                return Optional.of((A) annotation);\r\n            }\r\n        }\r\n        return Optional.empty();\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Gets the value of the property for the specified bean.\r\n     * <p>\r\n     * For a standard JavaBean, this is equivalent to calling <code>getFoo()</code> on the bean.\r\n     * Alternate implementations may perform any logic to obtain the value.\r\n     * \r\n     * @param bean  the bean to query, not null\r\n     * @return the value of the property on the specified bean, may be null\r\n     * @throws ClassCastException if the bean is of an incorrect type\r\n     * @throws UnsupportedOperationException if the property is write-only\r\n     */\r\n    public abstract P get(Bean bean);\r\n\r\n    /**\r\n     * Sets the value of the property on the specified bean.\r\n     * <p>\r\n     * The value must be of the correct type for the property.\r\n     * For a standard JavaBean, this is equivalent to calling <code>setFoo()</code> on the bean.\r\n     * Alternate implementations may perform any logic to change the value.\r\n     * \r\n     * @param bean  the bean to update, not null\r\n     * @param value  the value to set into the property on the specified bean, may be null\r\n     * @throws ClassCastException if the bean is of an incorrect type\r\n     * @throws ClassCastException if the value is of an invalid type for the property\r\n     * @throws UnsupportedOperationException if the property is read-only\r\n     * @throws RuntimeException if the value is rejected by the property (use appropriate subclasses)\r\n     */\r\n    public abstract void set(Bean bean, Object value);\r\n\r\n    /**\r\n     * Sets the value of the property on the associated bean and returns the previous value.\r\n     * <p>\r\n     * The value must be of the correct type for the property.\r\n     * This is a combination of the {@code get} and {@code set} methods that matches the definition\r\n     * of {@code put} in a {@code Map}.\r\n     * \r\n     * @param bean  the bean to update, not null\r\n     * @param value  the value to set into the property on the specified bean, may be null\r\n     * @return the old value of the property, may be null\r\n     * @throws ClassCastException if the bean is of an incorrect type\r\n     * @throws ClassCastException if the value is of an invalid type for the property\r\n     * @throws UnsupportedOperationException if the property is read-only\r\n     * @throws RuntimeException if the value is rejected by the property (use appropriate subclasses)\r\n     */\r\n    public default P put(Bean bean, Object value) {\r\n        var old = get(bean);\r\n        set(bean, value);\r\n        return old;\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Gets the value of the property for the specified bean converted to a string.\r\n     * <p>\r\n     * This converts the result of {@link #get(Bean)} to a standard format string.\r\n     * Conversion uses Joda-Convert.\r\n     * Not all object types can be converted to a string, see Joda-Convert.\r\n     * <p>\r\n     * For a standard JavaBean, this is equivalent to calling <code>getFoo()</code> on the bean.\r\n     * Alternate implementations may perform any logic to obtain the value.\r\n     * \r\n     * @param bean  the bean to query, not null\r\n     * @return the value of the property on the specified bean, may be null\r\n     * @throws ClassCastException if the bean is of an incorrect type\r\n     * @throws UnsupportedOperationException if the property is write-only\r\n     * @throws RuntimeException if the value cannot be converted to a string (use appropriate subclasses)\r\n     */\r\n    public default String getString(Bean bean) {\r\n        return getString(bean, JodaBeanUtils.stringConverter());\r\n    }\r\n\r\n    /**\r\n     * Gets the value of the property for the specified bean converted to a string.\r\n     * <p>\r\n     * This converts the result of {@link #get(Bean)} to a standard format string using the supplied converter.\r\n     * Not all object types can be converted to a string, see Joda-Convert.\r\n     * <p>\r\n     * For a standard JavaBean, this is equivalent to calling <code>getFoo()</code> on the bean.\r\n     * Alternate implementations may perform any logic to obtain the value.\r\n     *\r\n     * @param bean  the bean to query, not null\r\n     * @param stringConvert  the converter to use, not null\r\n     * @return the value of the property on the specified bean, may be null\r\n     * @throws ClassCastException if the bean is of an incorrect type\r\n     * @throws UnsupportedOperationException if the property is write-only\r\n     * @throws RuntimeException if the value cannot be converted to a string (use appropriate subclasses)\r\n     */\r\n    public default String getString(Bean bean, StringConvert stringConvert) {\r\n        var value = get(bean);\r\n        return stringConvert.convertToString(propertyType(), value);\r\n    }\r\n\r\n    /**\r\n     * Sets the value of the property on the specified bean from a string by conversion.\r\n     * <p>\r\n     * This converts the string to the correct type for the property and then sets it\r\n     * using {@link #set(Bean, Object)}. Conversion uses Joda-Convert.\r\n     * \r\n     * @param bean  the bean to update, not null\r\n     * @param value  the value to set into the property on the specified bean, may be null\r\n     * @throws ClassCastException if the bean is of an incorrect type\r\n     * @throws ClassCastException if the value is of an invalid type for the property\r\n     * @throws UnsupportedOperationException if the property is read-only\r\n     * @throws RuntimeException if the value is rejected by the property (use appropriate subclasses)\r\n     */\r\n    public default void setString(Bean bean, String value) {\r\n        setString(bean, value, JodaBeanUtils.stringConverter());\r\n    }\r\n\r\n    /**\r\n     * Sets the value of the property on the specified bean from a string by conversion.\r\n     * <p>\r\n     * This converts the string to the correct type for the property using the supplied converter and then sets it\r\n     * using {@link #set(Bean, Object)}.\r\n     *\r\n     * @param bean  the bean to update, not null\r\n     * @param value  the value to set into the property on the specified bean, may be null\r\n     * @param stringConvert  the converter, not null\r\n     * @throws ClassCastException if the bean is of an incorrect type\r\n     * @throws ClassCastException if the value is of an invalid type for the property\r\n     * @throws UnsupportedOperationException if the property is read-only\r\n     * @throws RuntimeException if the value is rejected by the property (use appropriate subclasses)\r\n     */\r\n    public default void setString(Bean bean, String value, StringConvert stringConvert) {\r\n        set(bean, stringConvert.convertFromString(propertyType(), value));\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Checks if this meta-property equals another.\r\n     * <p>\r\n     * This compares the property name and declaring type.\r\n     * It does not compare the property or bean types.\r\n     * \r\n     * @param obj  the other meta-property, null returns false\r\n     * @return true if equal\r\n     */\r\n    @Override\r\n    public abstract boolean equals(Object obj);\r\n\r\n    /**\r\n     * Returns a suitable hash code.\r\n     * \r\n     * @return the hash code\r\n     */\r\n    @Override\r\n    public abstract int hashCode();\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/MetaProvider.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Specifies the type of the {@link MetaBeanProvider} that can provide a {@link MetaBean}\n * for the annotated type.\n * <p>\n * The provider class must have a no-args constructor.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.TYPE)\n@Inherited\npublic @interface MetaProvider {\n\n    /**\n     * The class that provides the meta-bean.\n     * \n     * @return the class that provides the meta-bean\n     */\n    Class<? extends MetaBeanProvider> value();\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/Property.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans;\r\n\r\n/**\r\n * A property that is linked to a specific bean.\r\n * <p>\r\n * For a JavaBean, this will ultimately wrap a get/set method pair.\r\n * Alternate implementations may perform any logic to obtain the value.\r\n * \r\n * @param <P>  the type of the property content\r\n */\r\npublic interface Property<P> {\r\n\r\n    /**\r\n     * Gets the bean which owns this property.\r\n     * <p>\r\n     * Each property is fully owned by a single bean.\r\n     * \r\n     * @param <B>  the bean type\r\n     * @return the bean, not null\r\n     */\r\n    public abstract <B extends Bean> B bean();\r\n\r\n    /**\r\n     * Gets the meta-property representing the parts of the property that are\r\n     * common across all instances, such as the name.\r\n     * \r\n     * @return the meta-property, not null\r\n     */\r\n    public abstract MetaProperty<P> metaProperty();\r\n\r\n    /**\r\n     * Gets the property name.\r\n     * <p>\r\n     * The JavaBean style methods getFoo() and setFoo() will lead to a property\r\n     * name of 'foo' and so on.\r\n     * \r\n     * @return the name of the property, not empty\r\n     */\r\n    public default String name() {\r\n        return metaProperty().name();\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Gets the value of the property for the associated bean.\r\n     * <p>\r\n     * For a JavaBean, this is the equivalent to calling <code>getFoo()</code> on the bean itself.\r\n     * Alternate implementations may perform any logic to obtain the value.\r\n     * \r\n     * @return the value of the property on the bound bean, may be null\r\n     * @throws UnsupportedOperationException if the property is write-only\r\n     */\r\n    public default P get() {\r\n        return metaProperty().get(bean());\r\n    }\r\n\r\n    /**\r\n     * Sets the value of the property on the associated bean.\r\n     * <p>\r\n     * The value must be of the correct type for the property.\r\n     * See the meta-property for string conversion.\r\n     * For a standard JavaBean, this is equivalent to calling <code>setFoo()</code> on the bean.\r\n     * Alternate implementations may perform any logic to change the value.\r\n     * \r\n     * @param value  the value to set into the property on the bean\r\n     * @throws ClassCastException if the value is of an invalid type for the property\r\n     * @throws UnsupportedOperationException if the property is read-only\r\n     * @throws RuntimeException if the value is rejected by the property (use appropriate subclasses)\r\n     */\r\n    public default void set(Object value) {\r\n        metaProperty().set(bean(), value);\r\n    }\r\n\r\n    /**\r\n     * Sets the value of the property on the associated bean and returns the previous value.\r\n     * <p>\r\n     * This is a combination of the {@code get} and {@code set} methods that matches the definition\r\n     * of {@code put} in a {@code Map}.\r\n     * \r\n     * @param value  the value to set into the property on the bean\r\n     * @return the old value of the property, may be null\r\n     * @throws ClassCastException if the value is of an invalid type for the property\r\n     * @throws UnsupportedOperationException if the property is read-only\r\n     * @throws RuntimeException if the value is rejected by the property (use appropriate subclasses)\r\n     */\r\n    public default P put(Object value) {\r\n        return metaProperty().put(bean(), value);\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Checks if this property equals another.\r\n     * <p>\r\n     * This compares the meta-property and value.\r\n     * It does not consider the property or bean types.\r\n     * \r\n     * @param obj  the other property, null returns false\r\n     * @return true if equal\r\n     */\r\n    @Override\r\n    public abstract boolean equals(Object obj);\r\n\r\n    /**\r\n     * Returns a suitable hash code.\r\n     * \r\n     * @return the hash code\r\n     */\r\n    @Override\r\n    public abstract int hashCode();\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/PropertyPath.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static java.util.stream.Collectors.toList;\nimport static org.joda.beans.JodaBeanUtils.notNull;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.stream.Stream;\n\n/**\n * A multi-stage property path.\n * <p>\n * This accepts a dot-separated path and queries the bean.\n * Each dot-separated part of the path is resolved to a meta-property.\n * Thus the path \"foo.bar.baz\" is equivalent to {@code bean.getFoo().getBar().getBaz()}.\n * The path lookup works even if the methods are not public.\n * <p>\n * Each part of the path may contain a suffix, such as {@code [<iterableIndex>]} or {@code [<mapKey>]}.\n * The suffix {@code [<iterableIndex>]} accesses the specified numeric index of an {@code Iterable}.\n * The suffix {@code [<mapKey>]} accesses the specified numeric index of an {@code Map}.\n * \n * @param <P>  the type of the result\n * @since 2.11.0\n */\npublic final class PropertyPath<P> {\n\n    /**\n     * The path entries.\n     */\n    private final String propertyPath;\n    /**\n     * The result type.\n     */\n    private final Class<P> resultType;\n    /**\n     * The path entries.\n     */\n    private final List<PathEntry> pathEntries;\n\n    /**\n     * Restricted constructor.\n     */\n    private PropertyPath(String propertyPath, Class<P> resultType, List<PathEntry> pathEntries) {\n        this.propertyPath = propertyPath;\n        this.resultType = resultType;\n        this.pathEntries = pathEntries;\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Obtains an instance from the path.\n     * \n     * @param <P>  the type of the result\n     * @param propertyPath  the path, not null\n     * @param resultType  the result type, not null\n     * @return the path\n     * @throws IllegalArgumentException if the path has an invalid format\n     */\n    public static <P> PropertyPath<P> of(String propertyPath, Class<P> resultType) {\n        notNull(propertyPath, \"propertyPath\");\n        notNull(resultType, \"resultType\");\n        var split = PathEntry.parse(propertyPath);\n        return new PropertyPath<>(propertyPath, resultType, split);\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Gets a value by path from the specified  bean.\n     * <p>\n     * This uses the path to query the bean.\n     * There is special handling for {@code Iterable}, {@code Map} and {@code Optional}.\n     * If the path does not match the structure within the bean, optional empty is returned.\n     * If the path finds any nulls, empty lists or empty maps, optional empty is returned.\n     * \n     * @param bean  the bean to start from, not null\n     * @return the value, empty if the value is null or the path fails to evaluate correctly\n     */\n    public Optional<P> get(Bean bean) {\n        notNull(bean, \"bean\");\n        var currentBean = bean;\n        for (var i = 0; i < pathEntries.size() - 1; i++) {\n            var pathEntry = pathEntries.get(i);\n            var obj = pathEntry.get(currentBean);\n            obj = pathEntry.extract(obj);\n            if (obj instanceof Optional<?> optional) {\n                obj = optional.orElse(null);\n            }\n            if (!(obj instanceof Bean newBean)) {\n                return Optional.empty();\n            }\n            currentBean = newBean;\n        }\n        // last entry, which allows for possibility that resultType = Optional.class\n        var pathEntry = pathEntries.getLast();\n        var obj = pathEntry.get(currentBean);\n        obj = pathEntry.extract(obj);\n        if (obj == null) {\n            return Optional.empty();\n        }\n        if (resultType.isInstance(obj)) {\n            return Optional.of(resultType.cast(obj));\n        } else {\n            if (obj instanceof Optional<?> opt) {\n                obj = opt.orElse(null);\n            }\n            if (resultType.isInstance(obj)) {\n                return Optional.of(resultType.cast(obj));\n            }\n            return Optional.empty();\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Gets the property path.\n     * \n     * @return the property path\n     */\n    public String propertyPath() {\n        return propertyPath;\n    }\n\n    /**\n     * Gets the result type.\n     * \n     * @return the result type\n     */\n    public Class<P> resultType() {\n        return resultType;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        return obj instanceof PropertyPath<?> other &&\n                this.propertyPath.equals(other.propertyPath) &&\n                this.resultType.equals(other.resultType);\n    }\n\n    @Override\n    public int hashCode() {\n        return propertyPath.hashCode() ^ resultType.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        return propertyPath + \": \" + resultType.getName();\n    }\n\n    //-------------------------------------------------------------------------\n    private static final class PathEntry {\n        private final String propertyName;\n        private final String key;\n        private final int index;\n\n        static List<PathEntry> parse(String propertyPath) {\n            var split = propertyPath.split(\"\\\\.\");\n            return Stream.of(split)\n                    .map(entryStr -> extractEntry(propertyPath, entryStr))\n                    .collect(toList());\n        }\n\n        private static PathEntry extractEntry(String propertyPath, String entryStr) {\n            var propName = entryStr;\n            var key = (String) null;\n            var index = 0;\n            var start = entryStr.lastIndexOf('[');\n            if (entryStr.endsWith(\"]\") && start > 0) {\n                key = entryStr.substring(start + 1, entryStr.length() - 1);\n                if (key.isEmpty()) {\n                    throw new IllegalArgumentException(\"Invalid property path, empty key: \" + propertyPath);\n                }\n                var firstChar = key.charAt(0);\n                index = -1;\n                if (firstChar == '-' || (firstChar >= '0' && firstChar <= '9')) {\n                    try {\n                        index = Integer.parseInt(key);\n                    } catch (NumberFormatException ex) {\n                        // index = -1\n                    }\n                }\n                propName = entryStr.substring(0, start);\n            }\n            return new PathEntry(propName, key, index);\n        }\n\n        private PathEntry(String propertyName, String key, int index) {\n            this.propertyName = propertyName;\n            this.key = key;\n            this.index = index;\n        }\n\n        private Object get(Bean bean) {\n            try {\n                return bean.metaBean().metaProperty(propertyName).get(bean);\n            } catch (RuntimeException ex) {\n                return null;\n            }\n        }\n\n        private Object extract(Object obj) {\n            // maps can be queried using the [key] suffix if desired\n            // an [index] suffix will be queried as a key, not an index\n            if (obj instanceof Map<?, ?> map) {\n                if (key == null) {\n                    return extract(map.values());\n                } else {\n                    return map.get(key);\n                }\n            }\n\n            // lists/sets can be queried using the [index] suffix if desired\n            if (obj instanceof Iterable<?> itr) {\n                if (key != null && index < 0) {\n                    return null;\n                }\n                if (obj instanceof List<?> list) {\n                    if (index < list.size()) {\n                        return list.get(index);\n                    }\n                    return null;\n                }\n                var it = itr.iterator();\n                var i = 0;\n                while (it.hasNext() && i < index) {\n                    it.next();\n                    i++;\n                }\n                return it.hasNext() ? it.next() : null;\n            }\n\n            // not a collection\n            if (key != null && !\"0\".equals(key)) {\n                return null;\n            }\n            return obj;\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/PropertyStyle.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\n/**\n * An enumeration of property styles.\n * <p>\n * A property may be read-only, read-write or write-only.\n * This enumeration models those options.\n * <p>\n * It is strongly recommended to use the methods, not compare against the enum values.\n */\npublic enum PropertyStyle {\n\n    /**\n     * The property can be read and written.\n     */\n    READ_WRITE,\n    /**\n     * The property is read-only.\n     */\n    READ_ONLY,\n    /**\n     * The property is write-only.\n     */\n    WRITE_ONLY,\n    /**\n     * The property is read-only but can be written via the builder.\n     */\n    READ_ONLY_BUILDABLE,\n    /**\n     * The property is derived.\n     * It is read-only.\n     */\n    DERIVED,\n    /**\n     * The property is immutable.\n     * It can be read and written via the builder.\n     */\n    IMMUTABLE;\n\n    //-----------------------------------------------------------------------\n    /**\n     * Checks whether the property is readable.\n     * <p>\n     * This checks if the property get method will succeed.\n     * \n     * @return true if the property can be read\n     */\n    public boolean isReadable() {\n        return this == READ_WRITE || this == READ_ONLY || this == READ_ONLY_BUILDABLE || this == DERIVED || this == IMMUTABLE;\n    }\n\n    /**\n     * Checks whether the property is writable.\n     * <p>\n     * This checks if the property set method will succeed.\n     * \n     * @return true if the property can be written\n     */\n    public boolean isWritable() {\n        return this == READ_WRITE || this == WRITE_ONLY;\n    }\n\n    /**\n     * Checks whether the property is read-only.\n     * <p>\n     * This checks if the property get method will succeed and the set method fail.\n     * Read-only, derived and immutable properties will return true.\n     * Note that an immutable property can be written via the builder.\n     * \n     * @return true if the property is derived\n     */\n    public boolean isReadOnly() {\n        return this == READ_ONLY || this == READ_ONLY_BUILDABLE || this == DERIVED || this == IMMUTABLE;\n    }\n\n    /**\n     * Checks whether the property can be used in the builder.\n     * <p>\n     * To check for round-trip behavior, use {@link #isSerializable()}.\n     * \n     * @return true if the property can be used in the builder\n     */\n    public boolean isBuildable() {\n        return this == READ_WRITE || this == WRITE_ONLY || this == READ_ONLY_BUILDABLE || this == IMMUTABLE;\n    }\n\n    /**\n     * Checks whether the property is derived.\n     * <p>\n     * A derived property has no instance variable.\n     * \n     * @return true if the property is derived\n     */\n    public boolean isDerived() {\n        return this == DERIVED;\n    }\n\n    /**\n     * Checks whether the property can be serialized in a round-trip.\n     * <p>\n     * A property that is read-write or immutable can be round-trip serialized.\n     * \n     * @return true if the property is serializable\n     */\n    public boolean isSerializable() {\n        return this == READ_WRITE || this == READ_ONLY_BUILDABLE || this == IMMUTABLE;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ResolvedType.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static java.util.stream.Collectors.toMap;\n\nimport java.lang.reflect.GenericArrayType;\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.lang.reflect.TypeVariable;\nimport java.lang.reflect.WildcardType;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NavigableMap;\nimport java.util.NavigableSet;\nimport java.util.Objects;\nimport java.util.SequencedCollection;\nimport java.util.SequencedMap;\nimport java.util.SequencedSet;\nimport java.util.Set;\nimport java.util.SortedMap;\nimport java.util.SortedSet;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\nimport org.joda.convert.FromString;\nimport org.joda.convert.ToString;\n\n/**\n * A resolved generic type.\n * <p>\n * This stores a generic type, where any type variables or wildcards have been resolved.\n * The process of resolving uses a context class to resolve type variables like {@code <T>}.\n * <p>\n * Where type variables cannot be resolved, the type parameter upper bound will be used.\n * For example, {@code ResolvedType.from(List.class)} returns {@code List<Object>} unless a context\n * class is passed in that extends {@code List} and constrains the type, such as an imaginary class\n * {@code StringList implements List<String>}.\n * <p>\n * Note that special cases like anonymous classes, hidden classes and specialized enum subclasses\n * may not be resolved correctly, and validation is deliberately incomplete.\n * For example, you can create an instance representing {@code List<int>}.\n * <p>\n * The state of this class consists of two parts.\n * Firstly, there is a {@code Class} representing the raw type, which may be an array.\n * Secondaly, there is a list of {@code ResolvedType} representing the type arguments.\n * For example, {@code List<String>[]} will be represented by a {@code Class} of {@code List[]} and\n * a list of type arguments representing {@code String}.\n * \n * @since 3.0.0\n */\npublic final class ResolvedType {\n\n    /**\n     * The resolved type for {@code Object.class}.\n     */\n    public static final ResolvedType OBJECT = new ResolvedType(Object.class);\n    /**\n     * The resolved type for {@code String.class}.\n     */\n    public static final ResolvedType STRING = new ResolvedType(String.class);\n\n    /**\n     * Pattern for class name.\n     */\n    private static final Pattern PARSE_CLASS_NAME = Pattern.compile(\"([^<>, \\\\[]+)\");\n    /**\n     * Pattern for separator.\n     */\n    private static final Pattern PARSE_SEPARATOR = Pattern.compile(\"(([^<>, \\\\[]+)|<|>|, *|(?:\\\\[\\\\])+)\");\n    /**\n     * The short class names.\n     */\n    private static final Map<String, Class<?>> NAMES = Set.of(\n            Object.class,\n            String.class,\n            Number.class,\n            Long.class,\n            Integer.class,\n            Short.class,\n            Byte.class,\n            Double.class,\n            Float.class,\n            Character.class,\n            Boolean.class,\n            Void.class,\n            long.class,\n            int.class,\n            short.class,\n            byte.class,\n            double.class,\n            float.class,\n            char.class,\n            boolean.class,\n            void.class,\n            Collection.class,\n            SequencedCollection.class,\n            Set.class,\n            SortedSet.class,\n            NavigableSet.class,\n            SequencedSet.class,\n            List.class,\n            Map.class,\n            SortedMap.class,\n            NavigableMap.class,\n            SequencedMap.class).stream()\n            .collect(toMap(cls -> cls.getSimpleName(), cls -> cls));\n\n    /**\n     * The raw type.\n     */\n    private final Class<?> rawType;\n    /**\n     * The type arguments.\n     */\n    private final List<ResolvedType> arguments;\n\n    /**\n     * Restricted constructor.\n     */\n    private ResolvedType(Class<?> rawType) {\n        // validation occurs in the calling code\n        this.rawType = rawType;\n        this.arguments = List.of();\n    }\n\n    /**\n     * Restricted constructor.\n     */\n    private ResolvedType(Class<?> rawType, List<ResolvedType> arguments) {\n        // validation occurs in the calling code\n        this.rawType = rawType;\n        this.arguments = arguments;\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Parses a {@code ResolvedType} from a formal string.\n     * \n     * @param str  the string to parse, not null\n     * @return the resolved type\n     * @throws NullPointerException if null is passed in\n     * @throws IllegalArgumentException if the string cannot be parsed\n     */\n    @FromString\n    public static ResolvedType parse(String str) {\n        Objects.requireNonNull(str, \"str must not be null\");\n        var matcher = PARSE_CLASS_NAME.matcher(str);\n        return parse(matcher, str, 0);\n    }\n\n    // recursively parse using a matcher that retains the current state\n    private static ResolvedType parse(Matcher matcher, String str, int depth) {\n        if (depth > 255) {\n            throw invalidFormat(str); // no specific error message for infinite recursion guard\n        }\n        // first parse the class name\n        matcher.usePattern(PARSE_CLASS_NAME);\n        if (!matcher.find()) {\n            throw invalidFormat(str);\n        }\n        var name = matcher.group(1);\n        var parsedRawType = parseClassName(name);\n        var typeArgs = new ArrayList<ResolvedType>();\n        // then parse any trailing separators\n        matcher.usePattern(PARSE_SEPARATOR);\n        while (matcher.find()) {\n            var separator = matcher.group(1);\n            // parse type arguments, which may be comma separated\n            if (separator.equals(\"<\")) {\n                if (!typeArgs.isEmpty()) {\n                    throw invalidFormat(str);\n                }\n                typeArgs.add(parse(matcher, str, depth + 1));\n                if (!matcher.hasMatch()) {\n                    throw invalidFormat(str);\n                }\n                separator = matcher.group(1);\n                while (separator.startsWith(\",\")) {\n                    typeArgs.add(parse(matcher, str, depth + 1));\n                    separator = matcher.group(1);\n                }\n                continue;\n            }\n            // ends the current type argument, at the root level it is an error\n            if (separator.startsWith(\",\") | separator.equals(\">\")) {\n                if (depth == 0) {\n                    throw invalidFormat(str);\n                }\n                return of(parsedRawType, typeArgs);\n            }\n            // handle an array\n            if (separator.startsWith(\"[\")) {\n                for (var i = 0; i < separator.length() / 2; i++) {\n                    parsedRawType = parsedRawType.arrayType();\n                }\n                continue;\n            }\n            // found some unexpected text\n            throw invalidFormat(str);\n        }\n        return of(parsedRawType, typeArgs);\n    }\n\n    private static Class<?> parseClassName(String name) {\n        var parsedRawType = NAMES.get(name);\n        if (parsedRawType == null) {\n            try {\n                parsedRawType = Class.forName(name);\n            } catch (ClassNotFoundException ex) {\n                throw new IllegalArgumentException(\"Unable to parse ResolvedType, class not found: \" + name);\n            }\n        }\n        return parsedRawType;\n    }\n\n    private static IllegalArgumentException invalidFormat(String str) {\n        return new IllegalArgumentException(\"Unable to parse ResolvedType from '\" + str + \"', invalid format\");\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Obtains an instance from a raw type.\n     * <p>\n     * This factory method is most useful for wrapping types that are not generic, such as {@code String}.\n     * If the input class has generic type parameters, the result will represent the raw type, and the arguments will be empty.\n     * Use {@link #from(Class)} if you want a method that defaults the type parameters to their upper bounds.\n     * <p>\n     * For example, passing {@code Map.class} to this method will simply wrap the input returning \"Map\",\n     * and not \"Map&lt;Object, Object&gt;\".\n     * \n     * @param rawType  the raw type, not null\n     * @return the resolved type\n     * @throws NullPointerException if null is passed in\n     */\n    public static ResolvedType of(Class<?> rawType) {\n        Objects.requireNonNull(rawType, \"rawType must not be null\");\n        return new ResolvedType(rawType);\n    }\n\n    /**\n     * Obtains an instance from a raw type and type arguments.\n     * <p>\n     * The number of type arguments must match the number of type parameters on the raw type or be empty.\n     * For example, calling this method with {@code Map.class} requires the type arguments to either be\n     * size 2 (generified) or size 0 (raw).\n     * \n     * @param rawType  the raw type, not null\n     * @param arguments  the type arguments, not null\n     * @return the resolved type\n     * @throws NullPointerException if null is passed in\n     * @throws IllegalArgumentException if the number of arguments do not match the number of generics type parameters or zero\n     */\n    public static ResolvedType of(Class<?> rawType, ResolvedType... arguments) {\n        Objects.requireNonNull(rawType, \"rawType must not be null\");\n        Objects.requireNonNull(arguments, \"arguments must not be null\");\n        return of(rawType, List.of(arguments));\n    }\n\n    /**\n     * Obtains an instance from a raw type and type arguments.\n     * <p>\n     * The number of type arguments must match the number of type parameters on the raw type or be empty.\n     * For example, calling this method with {@code Map.class} requires the type arguments to either be\n     * size 2 (generified) or size 0 (raw).\n     * \n     * @param rawType  the raw type, not null\n     * @param arguments  the type arguments, not null\n     * @return the resolved type\n     * @throws NullPointerException if null is passed in\n     * @throws IllegalArgumentException if the number of arguments do not match the number of generics type parameters or zero\n     */\n    public static ResolvedType of(Class<?> rawType, List<ResolvedType> arguments) {\n        Objects.requireNonNull(rawType, \"rawType must not be null\");\n        Objects.requireNonNull(arguments, \"arguments must not be null\");\n        if (arguments.isEmpty()) {\n            return new ResolvedType(rawType);\n        }\n        var baseType = extractBaseComponentType(rawType);\n        var actualTypeParamCount = baseType.getTypeParameters().length;\n        if (actualTypeParamCount != arguments.size()) {\n            throw invalidTypeParamCount(rawType, actualTypeParamCount, arguments.size());\n        }\n        return new ResolvedType(rawType, List.copyOf(arguments));\n    }\n\n    private static IllegalArgumentException invalidTypeParamCount(Class<?> rawType, int actualCount, int inputCount) {\n        return new IllegalArgumentException(\n                \"Class \" + rawType.getName() + \" has \" + actualCount + \" type parameters, but \" + inputCount + \" were supplied\");\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Obtains an instance from a single-level flat list of raw types.\n     * <p>\n     * This factory method is most useful for wrapping types with single-level generics like {@code List<String>},\n     * simply call {@code ofFlat(List.class, String.class)}.\n     * <p>\n     * Multi-level generic classes can be created, however the nested classes will be raw.\n     * For example, {@code ofFlat(List.class, Optional.class} will resolve to \"List&lt;Optional&gt;\",\n     * and not \"List&lt;Optional&lt;Object&gt;&gt;\".\n     * To provide nested generics for {@code Optional} use {@link #of(Class, ResolvedType...)}.\n     * \n     * @param rawType  the raw type, not null\n     * @param arguments  the type arguments, not null\n     * @return the resolved type\n     * @throws NullPointerException if null is passed in\n     * @throws IllegalArgumentException if the number of arguments do not match the number of generics type parameters or zero\n     */\n    public static ResolvedType ofFlat(Class<?> rawType, Class<?>... arguments) {\n        Objects.requireNonNull(rawType, \"rawType must not be null\");\n        Objects.requireNonNull(arguments, \"arguments must not be null\");\n        if (arguments.length == 0) {\n            return new ResolvedType(rawType);\n        }\n        var resolvedArgs = new ResolvedType[arguments.length];\n        for (var i = 0; i < arguments.length; i++) {\n            resolvedArgs[i] = new ResolvedType(arguments[i]);\n        }\n        return of(rawType, List.of(resolvedArgs));\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Obtains an instance from a raw type, providing a default type argument for where the argument is missing.\n     * <p>\n     * If the input class has generic type parameters, they will be resolved to their upper bound,\n     * typically {@code Object.class}. Use {@link #of(Class)} if you simply want to obtain a wrapper around the raw type.\n     * <p>\n     * For example, passing {@code Map.class} to this method will determine the upper bounds, returning \"Map&lt;Object, Object&gt;\".\n     * \n     * @param rawType  the raw type, not null\n     * @return the resolved type\n     * @throws NullPointerException if null is passed in\n     */\n    public static ResolvedType from(Class<?> rawType) {\n        Objects.requireNonNull(rawType, \"rawType must not be null\");\n        return resolveClass(rawType, Object.class, false);\n    }\n\n    /**\n     * Obtains an instance from a type and context class, providing a default type argument for where the argument is missing.\n     * <p>\n     * The type is typically obtained from reflection, such as from {@link MetaProperty#propertyGenericType()}.\n     * The context class represents the {@code Class} associated with the object being queried,\n     * which is used to resolve type variables like {@code <T>}.\n     * \n     * @param javaType  the Java type to resolve, not null\n     * @param contextClass  the context class to evaluate against, not null\n     *  \n     * @return the resolved type\n     * @throws NullPointerException if null is passed in\n     */\n    public static ResolvedType from(Type javaType, Class<?> contextClass) {\n        return from(javaType, contextClass, false);\n    }\n\n    /**\n     * Obtains an instance from a type and context class, where missing type arguments are not defaulted.\n     * <p>\n     * The type is typically obtained from reflection, such as from {@link MetaProperty#propertyGenericType()}.\n     * The context class represents the {@code Class} associated with the object being queried,\n     * which is used to resolve type variables like {@code <T>}.\n     * \n     * @param javaType  the Java type to resolve, not null\n     * @param contextClass  the context class to evaluate against, not null\n     *  \n     * @return the resolved type\n     * @throws NullPointerException if null is passed in\n     */\n    public static ResolvedType fromAllowRaw(Type javaType, Class<?> contextClass) {\n        return from(javaType, contextClass, true);\n    }\n\n    // resolves from the Java Type, optionally resolving raw types\n    private static ResolvedType from(Type javaType, Class<?> contextClass, boolean allowRaw) {\n        Objects.requireNonNull(javaType, \"type must not be null\");\n        Objects.requireNonNull(contextClass, \"contextClass must not be null\");\n        return switch (javaType) {\n            case Class<?> cls -> resolveClass(cls, contextClass, allowRaw);\n            case ParameterizedType parameterizedType -> resolveParameterizedType(parameterizedType, contextClass, allowRaw);\n            case GenericArrayType arrType -> resolveGenericArrayType(arrType, contextClass, allowRaw);\n            case TypeVariable<?> tvar -> resolveTypeVariable(tvar, contextClass, allowRaw);\n            case WildcardType wild -> resolveWildcard(wild, contextClass, allowRaw);\n            default -> throw unknownGenericTypeClass(javaType);\n        };\n    }\n\n    // should never happen, but might do if someone implements Type manually, or the JDK adds a new kind of Type\n    private static IllegalArgumentException unknownGenericTypeClass(Type type) {\n        return new IllegalArgumentException(\"Unknown generic type class: \" + type);\n    }\n\n    // resolve a Class, either returning the raw type, or selecting the best available type arguments\n    private static ResolvedType resolveClass(Class<?> cls, Class<?> contextClass, boolean allowRaw) {\n        if (allowRaw) {\n            return new ResolvedType(cls);\n        }\n        var baseType = extractBaseComponentType(cls);\n        var typeVariables = baseType.getTypeParameters();\n        var typeArguments = new ResolvedType[typeVariables.length];\n        for (var i = 0; i < typeArguments.length; i++) {\n            typeArguments[i] = resolveTypeVariable(typeVariables[i], contextClass, allowRaw);\n        }\n        return new ResolvedType(cls, List.of(typeArguments));\n    }\n\n    // resolve things like List<String>\n    private static ResolvedType resolveParameterizedType(ParameterizedType parameterizedType, Class<?> contextClass, boolean allowRaw) {\n        var actualTypeArguments = parameterizedType.getActualTypeArguments();\n        var typeArguments = new ResolvedType[actualTypeArguments.length];\n        for (var i = 0; i < typeArguments.length; i++) {\n            typeArguments[i] = from(actualTypeArguments[i], contextClass, allowRaw);\n        }\n        // all known instances of ParameterizedType return Class\n        return new ResolvedType((Class<?>) parameterizedType.getRawType(), List.of(typeArguments));\n    }\n\n    // resolve things like Optional<String>[]\n    private static ResolvedType resolveGenericArrayType(GenericArrayType arrType, Class<?> contextClass, boolean allowRaw) {\n        var componentType = arrType.getGenericComponentType();  // Optional<String>\n        var componentResolvedType = from(componentType, contextClass, allowRaw);  // Optional<String>\n        var rawType = componentResolvedType.getRawType();  // Optional\n        return new ResolvedType(rawType.arrayType(), componentResolvedType.getArguments());\n    }\n\n    // resolve things like <T extends Comparable<T>>\n    private static ResolvedType resolveTypeVariable(TypeVariable<?> tvar, Class<?> contextClass, boolean allowRaw) {\n        var resolved = JodaBeanUtils.resolveGenerics(tvar, contextClass);\n        if (resolved instanceof TypeVariable<?> unresolved) {\n            var bounds = unresolved.getBounds();\n            return bounds.length > 0 ? resolveGenericBound(bounds[0], allowRaw) : OBJECT;\n        }\n        return from(resolved, contextClass, allowRaw);\n    }\n\n    // resolve things like <T extends Comparable<T>>\n    private static ResolvedType resolveGenericBound(Type bound, boolean allowRaw) {\n        return switch (bound) {\n            case Class<?> cls -> resolveClass(cls, Object.class, allowRaw);\n            case ParameterizedType pt -> {\n                var rawType = JodaBeanUtils.eraseToClass(pt.getRawType());\n                var typeArgs = pt.getActualTypeArguments();\n                var resolvedTypeArgs = new ResolvedType[typeArgs.length];\n                if (typeArgs.length == 0) {\n                    yield resolveClass(rawType, Object.class, allowRaw);  // ignore weird situations\n                }\n                for (var i = 0; i < typeArgs.length; i++) {\n                    resolvedTypeArgs[i] = typeArgs[i] instanceof TypeVariable<?> ?\n                            OBJECT :  // resolve <T extends Comparable<T>> into Comparable<Object>\n                            resolveGenericBound(typeArgs[i], allowRaw);\n                }\n                yield of(rawType, resolvedTypeArgs);\n            }\n            default -> resolveClass(JodaBeanUtils.eraseToClass(bound), Object.class, allowRaw);  // ignore weird situations\n        };\n    }\n\n    // resolves a wildcard\n    private static ResolvedType resolveWildcard(WildcardType wild, Class<?> contextClass, boolean allowRaw) {\n        var bounds = wild.getUpperBounds();\n        return bounds.length == 0 ? OBJECT : from(bounds[0], contextClass, allowRaw);\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Gets the raw type.\n     * <p>\n     * Gets the {@code Class} object representing the resolved type without generic type arguments.\n     * For example, {@code Optional<String>} will return {@code Optional},\n     * and {@code List<String>[]} will return {@code List[]}.\n     * \n     * @return the raw type, may be a primitive type or an array type, not null\n     */\n    public Class<?> getRawType() {\n        return rawType;\n    }\n\n    /**\n     * Gets the type arguments, empty if the type is not a parameterized type or a generic array type.\n     * \n     * @return the type arguments, not null\n     */\n    public List<ResolvedType> getArguments() {\n        return arguments;\n    }\n\n    /**\n     * Gets the matching type argument or the default value of {@code Object}.\n     * <p>\n     * No check is performed to see if the index is valid for the raw type.\n     * For example, you could request index 3 from a {@code Map}.\n     * \n     * @param index  the index of the generic parameter\n     * @return the type, defaulted to Object\n     */\n    public ResolvedType getArgumentOrDefault(int index) {\n        if (index < 0 || index >= arguments.size()) {\n            return OBJECT;\n        }\n        return arguments.get(index);\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Checks whether this is a parameterized generic type, irrespective of whether the type arguments are known.\n     * <p>\n     * For example, {@code List} and {@code List<String>} return true, while {@code String} returns false.\n     * <p>\n     * If this type is an array, the result is based on the {@linkplain #toBaseComponentType() base component type}.\n     * \n     * @return true if this is a type with generic type parameters\n     */\n    public boolean isParameterized() {\n        return extractBaseComponentType(rawType).getTypeParameters().length != 0;\n    }\n\n    /**\n     * Checks whether this type is raw, which is a type that has missing type arguments.\n     * <p>\n     * For example, {@code List} returns true, while {@code List<String>} and {@code String} return false.\n     * <p>\n     * If this type is an array, the result is based on the {@linkplain #toBaseComponentType() base component type}.\n     * \n     * @return true if this is a parameterized generic type but the type arguments are empty\n     */\n    public boolean isRaw() {\n        return arguments.isEmpty() && extractBaseComponentType(rawType).getTypeParameters().length != 0;\n    }\n\n    /**\n     * Checks whether this type is a primitive type.\n     * <p>\n     * An array of primitives will return false.\n     * Consider calling {@link #toBaseComponentType()} first to check for primitive arrays.\n     * \n     * @return true if this is one of the 8 primitive types or void\n     */\n    public boolean isPrimitive() {\n        return rawType.isPrimitive();\n    }\n\n    /**\n     * Checks whether this type is an array type.\n     * \n     * @return true if this is an array type\n     */\n    public boolean isArray() {\n        return rawType.isArray();\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Converts this type to be raw, effectively dropping the generics.\n     * <p>\n     * This operates on all kinds of {@code ResolvedType}, including arrays and primitives.\n     * If this type has type arguments, the result does not.\n     * \n     * @return the underlying raw type, as a {@code ResolvedType}\n     */\n    public ResolvedType toRaw() {\n        return arguments.isEmpty() ? this : new ResolvedType(rawType);\n    }\n\n    /**\n     * Converts this type to the boxed equivalent.\n     * <p>\n     * If this type is one of the nine primitive types, the equivalent box is returned.\n     * Otherwise, {@code this} is returned.\n     * \n     * @return the equivalent boxed type\n     */\n    public ResolvedType toBoxed() {\n        return rawType.isPrimitive() ? boxed() : this;\n    }\n\n    private ResolvedType boxed() {\n        if (rawType == int.class) {\n            return ResolvedType.of(Integer.class);\n        } else if (rawType == long.class) {\n            return ResolvedType.of(Long.class);\n        } else if (rawType == double.class) {\n            return ResolvedType.of(Double.class);\n        } else if (rawType == boolean.class) {\n            return ResolvedType.of(Boolean.class);\n        } else if (rawType == byte.class) {\n            return ResolvedType.of(Byte.class);\n        } else if (rawType == char.class) {\n            return ResolvedType.of(Character.class);\n        } else if (rawType == short.class) {\n            return ResolvedType.of(Short.class);\n        } else if (rawType == float.class) {\n            return ResolvedType.of(Float.class);\n        } else {\n            return ResolvedType.of(Void.class);\n        }\n    }\n\n    /**\n     * Converts this type to the equivalent Java {@code Type}.\n     * <p>\n     * The resulting {@code Type} will be a {@code Class}, {@code ParameterizedType} or {@code GenericArrayType}.\n     * If this represents a raw parameterized type, the result will be the raw {@code Class}.\n     * \n     * @return the equivalent Java type\n     */\n    public Type toJavaType() {\n        if (arguments.isEmpty()) {\n            return rawType;\n        }\n        if (rawType.isArray()) {\n            var componentType = toComponentType().toJavaType();\n            return new DynamicGenericArrayType(componentType);\n        } else {\n            var argumentList = arguments.stream()\n                    .map(ResolvedType::toJavaType)\n                    .toArray(Type[]::new);\n            return new DynamicParameterizedType(rawType, argumentList);\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Returns the component type, dropping the first array dimension if present.\n     * <p>\n     * The result of this method consists of the component type of the raw type, with the same type arguments.\n     * For example, calling this method on {@code List<String>[][]} will return {@code List<String>[]}.\n     * If this type is not an array, the result is the equivalent to {@code this}.\n     * \n     * @return the component type, or {@code this} if not an array\n     */\n    public ResolvedType toComponentType() {\n        var componentType = rawType.getComponentType();\n        if (componentType == null) {\n            return this;\n        }\n        return new ResolvedType(componentType, arguments);\n    }\n\n    /**\n     * Returns the base component type, dropping all array dimensions.\n     * <p>\n     * The result of this method consists of the base component type of the raw type, with the same type arguments.\n     * For example, calling this method on {@code List<String>[][]} will return {@code List<String>}.\n     * If this type is not an array, the result is the equivalent to {@code this}.\n     * \n     * @return the base component type, or {@code this} if not an array\n     */\n    public ResolvedType toBaseComponentType() {\n        var componentType = rawType.getComponentType();\n        if (componentType == null) {\n            return this;\n        }\n        return new ResolvedType(extractBaseComponentType(componentType), arguments);\n    }\n\n    /**\n     * Returns this type as an array type.\n     * <p>\n     * This returns a new instance with the raw type as an array type, and the same type arguments.\n     * For example, {@code Optional<String>} will be returned as {@code Optional<String>[]}.\n     * \n     * @return the array type\n     * @throws UnsupportedOperationException if this type represents {@code void}\n     *   or if the array would have too many dimensions\n     */\n    public ResolvedType toArrayType() {\n        return new ResolvedType(rawType.arrayType(), arguments);\n    }\n\n    //-------------------------------------------------------------------------\n    private static Class<?> extractBaseComponentType(Class<?> cls) {\n        var nonArrayType = cls;\n        while (nonArrayType.isArray()) {\n            nonArrayType = nonArrayType.getComponentType();\n        }\n        return nonArrayType;\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Checks if this object equals another.\n     * \n     * @param obj  the other object\n     * @return true if equal\n     */\n    @Override\n    public boolean equals(Object obj) {\n        return obj instanceof ResolvedType other &&\n                this.rawType == other.rawType &&\n                arguments.equals(other.arguments);\n    }\n\n    /**\n     * Returns a hash code compatible with equals.\n     * \n     * @return the hash code\n     */\n    @Override\n    public int hashCode() {\n        return rawType.hashCode() ^ arguments.hashCode();\n    }\n\n    /**\n     * Returns a formal string representation of the type.\n     * \n     * @return the formal string\n     */\n    @Override\n    @ToString\n    public String toString() {\n        var baseType = rawType;\n        var suffix = \"\";\n        while (baseType.isArray()) {\n            baseType = baseType.getComponentType();\n            suffix += \"[]\";\n        }\n        var shortenedClassName = shortenedClassName(baseType);\n        if (arguments.isEmpty()) {\n            return shortenedClassName + suffix;\n        } else {\n            var builder = new StringBuilder(shortenedClassName).append('<');\n            for (var i = 0; i < arguments.size(); i++) {\n                if (i > 0) {\n                    builder.append(\", \");\n                }\n                builder.append(arguments.get(i));\n            }\n            builder.append('>');\n            if (rawType.isArray()) {\n                builder.append(suffix);\n            }\n            return builder.toString();\n        }\n    }\n\n    private String shortenedClassName(Class<?> cls) {\n        var name = cls.getName();\n        if (cls.isPrimitive()) {\n            return name;\n        }\n        if (NAMES.containsValue(cls)) {\n            return cls.getSimpleName();\n        }\n        return name;\n    }\n\n    //-------------------------------------------------------------------------\n    // the JDK should have a public implementation for this\n    private static final class DynamicParameterizedType implements ParameterizedType {\n\n        private final Class<?> rawClass;\n        private final Type[] argumentsList;\n\n        private DynamicParameterizedType(Class<?> rawClass, Type[] typeArguments) {\n            this.rawClass = Objects.requireNonNull(rawClass);\n            this.argumentsList = Objects.requireNonNull(typeArguments).clone();\n            for (var type : typeArguments) {\n                Objects.requireNonNull(type);\n            }\n            if (typeArguments.length != rawClass.getTypeParameters().length) {\n                throw new IllegalArgumentException(\"Type parameters do not match\");\n            }\n        }\n\n        @Override\n        public Type[] getActualTypeArguments() {\n            return argumentsList.clone();\n        }\n\n        @Override\n        public Type getRawType() {\n            return rawClass;\n        }\n\n        @Override\n        public Type getOwnerType() {\n            if (rawClass.isLocalClass()) {\n                return null;\n            } else {\n                return rawClass.getEnclosingClass();\n            }\n        }\n\n        @Override\n        public boolean equals(Object obj) {\n            return obj instanceof ParameterizedType other &&\n                    getRawType().equals(other.getRawType()) &&\n                    Objects.equals(getOwnerType(), other.getOwnerType()) &&\n                    Arrays.equals(getActualTypeArguments(), other.getActualTypeArguments());\n        }\n\n        @Override\n        public int hashCode() {\n            return Objects.hash(rawClass, Arrays.hashCode(argumentsList));\n        }\n\n        @Override\n        public String toString() {\n            var builder = new StringBuilder(rawClass.getName()).append('<');\n            for (var i = 0; i < argumentsList.length; i++) {\n                if (i > 0) {\n                    builder.append(\", \");\n                }\n                builder.append(typeToString(argumentsList[i]));\n            }\n            return builder.append('>').toString();\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    // the JDK should have a public implementation for this\n    private static final class DynamicGenericArrayType implements GenericArrayType {\n\n        private final Type componentType;\n\n        private DynamicGenericArrayType(Type componentType) {\n            this.componentType = Objects.requireNonNull(componentType);\n        }\n\n        @Override\n        public Type getGenericComponentType() {\n            return componentType;\n        }\n\n        @Override\n        public boolean equals(Object obj) {\n            return obj instanceof GenericArrayType other &&\n                    Objects.equals(getGenericComponentType(), other.getGenericComponentType());\n        }\n\n        @Override\n        public int hashCode() {\n            return Objects.hashCode(componentType);\n        }\n\n        @Override\n        public String toString() {\n            return typeToString(componentType) + \"[]\";\n        }\n    }\n\n    private static String typeToString(Type type) {\n        return type instanceof Class cls ? cls.getName() : type.toString();\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/TypedMetaBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\n/**\n * A meta-bean that captures the type of the bean.\n * <p>\n * It is not possible to add the generic type to all beans, as the type cannot be\n * refined in hierarchies. This interface is thus useful when there are no subclasses.\n * \n * @param <T>  the type of the bean\n */\npublic interface TypedMetaBean<T extends Bean> extends MetaBean {\n\n    @Override\n    public abstract BeanBuilder<T> builder();\n\n    @Override\n    public abstract Class<T> beanType();\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/BeanCodeGen.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.gen;\r\n\r\nimport java.io.File;\r\nimport java.io.FileWriter;\r\nimport java.io.IOException;\r\nimport java.io.UncheckedIOException;\r\nimport java.nio.charset.StandardCharsets;\r\nimport java.nio.file.Files;\r\nimport java.nio.file.Path;\r\nimport java.util.ArrayList;\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\nimport java.util.regex.Pattern;\r\n\r\nimport org.joda.beans.JodaBeanUtils;\r\n\r\n/**\r\n * Code generator for the beans.\r\n * <p>\r\n * This reads in a {@code .java} file, parses it, and writes out an updated version.\r\n */\r\npublic class BeanCodeGen {\r\n\r\n    private static final Pattern PATTERN_OVERRIDE = Pattern.compile(\" *[@]Override\");\r\n\r\n    /**\r\n     * Main method.\r\n     * <p>\r\n     * This calls {@code System.exit}.\r\n     * \r\n     * @param args  the arguments, not null\r\n     */\r\n    public static void main(String[] args) {\r\n        BeanCodeGen gen;\r\n        try {\r\n            gen = createFromArgs(args);\r\n        } catch (RuntimeException ex) {\r\n            System.out.println(ex.getMessage());\r\n            System.out.println();\r\n            System.out.println(\"Code generator\");\r\n            System.out.println(\"  Usage java org.joda.beans.gen.BeanCodeGen [file]\");\r\n            System.out.println(\"  Options\");\r\n            System.out.println(\"    -R                process all files recursively, default false\");\r\n            System.out.println(\"    -indent=tab       use a tab for indenting, default 4 spaces\");\r\n            System.out.println(\"    -indent=[n]       use n spaces for indenting, default 4\");\r\n            System.out.println(\"    -prefix=[p]       field prefix of p should be removed, no default\");\r\n            System.out.println(\"    -eol=[e]          end of line: 'lf'/'crlf'/'cr', default System.lineSeparator\");\r\n            System.out.println(\"    -generated        add @Generated annotation to generated code\");\r\n            System.out.println(\"    -config=[f]       config file: 'jdk'/'guava', default guava\");\r\n            System.out.println(\"    -style=[s]        default bean style: 'light'/'minimal'/'full', default smart\");\r\n            System.out.println(\"    -verbose=[v]      output logging with verbosity from 0 to 3, default 1\");\r\n            System.out.println(\"    -nowrite          output messages rather than writing, default is to write\");\r\n            System.exit(0);\r\n            throw new InternalError(\"Unreachable\");\r\n        }\r\n        try {\r\n            var changed = gen.process();\r\n            System.out.println(\"Finished, found \" + changed + \" changed files\");\r\n            System.exit(0);\r\n        } catch (Exception ex) {\r\n            System.out.println();\r\n            ex.printStackTrace(System.out);\r\n            System.exit(1);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of {@code BeanCodeGen} from arguments.\r\n     * <p>\r\n     * This is intended for tools and does not call {@code System.exit}.\r\n     * \r\n     * @param args  the arguments, not null\r\n     * @return the code generator, not null\r\n     * @throws RuntimeException if unable to create\r\n     */\r\n    public static BeanCodeGen createFromArgs(String[] args) {\r\n        if (args == null) {\r\n            throw new IllegalArgumentException(\"Arguments must not be null\");\r\n        }\r\n        var indent = \"    \";\r\n        var prefix = \"\";\r\n        var eol = System.lineSeparator();\r\n        var defaultStyle = (String) null;\r\n        var recurse = false;\r\n        var generatedAnno = false;\r\n        var verbosity = 1;\r\n        var write = true;\r\n        var config = (BeanGenConfig) null;\r\n        if (args.length == 0) {\r\n            throw new IllegalArgumentException(\"No arguments specified\");\r\n        }\r\n        for (var i = 0; i < args.length - 1; i++) {\r\n            var arg = args[i];\r\n            if (arg == null) {\r\n                throw new IllegalArgumentException(\"Argument must not be null: \" + Arrays.toString(args));\r\n            }\r\n            if (arg.startsWith(\"-indent=tab\")) {\r\n                indent = \"\\t\";\r\n            } else if (arg.startsWith(\"-indent=\")) {\r\n                indent = \"          \".substring(0, Integer.parseInt(arg.substring(8)));\r\n            } else if (arg.startsWith(\"-prefix=\")) {\r\n                prefix = arg.substring(8);\r\n            } else if (arg.startsWith(\"-eol=\")) {\r\n                eol = switch (arg.substring(5)) {\r\n                    case \"lf\" -> \"\\n\";\r\n                    case \"crlf\" -> \"\\r\\n\";\r\n                    case \"cr\" -> \"\\r\";\r\n                    case \"system\" -> System.lineSeparator();\r\n                    default -> throw new IllegalArgumentException(\"Value of 'eol' must be one of: 'lf', 'crlf', 'cr', 'system'\");\r\n                };\r\n            } else if (arg.equals(\"-R\")) {\r\n                recurse = true;\r\n            } else if (arg.equals(\"-generated\")) {\r\n                if (generatedAnno) {\r\n                    throw new IllegalArgumentException(\"Argument 'generated' must not be specified twice: \" + Arrays.toString(args));\r\n                }\r\n                generatedAnno = true;\r\n            } else if (arg.startsWith(\"-config=\")) {\r\n                if (config != null) {\r\n                    throw new IllegalArgumentException(\"Argument 'config' must not be specified twice: \" + Arrays.toString(args));\r\n                }\r\n                config = BeanGenConfig.parse(arg.substring(8));\r\n            } else if (arg.startsWith(\"-style=\")) {\r\n                if (defaultStyle != null) {\r\n                    throw new IllegalArgumentException(\"Argument 'style' must not be specified twice: \" + Arrays.toString(args));\r\n                }\r\n                defaultStyle = arg.substring(7);\r\n            } else if (arg.startsWith(\"-verbose=\")) {\r\n                verbosity = Integer.parseInt(arg.substring(9));\r\n            } else if (arg.equals(\"-nowrite\")) {\r\n                write = false;\r\n            } else {\r\n                throw new IllegalArgumentException(\"Unknown argument: \" + arg);\r\n            }\r\n        }\r\n        var file = Path.of(args[args.length - 1]);\r\n        var files = findFiles(file, recurse);\r\n        \r\n        if (config == null) {\r\n            config = BeanGenConfig.parse(\"guava\");\r\n        }\r\n        config.setIndent(indent);\r\n        config.setPrefix(prefix);\r\n        config.setEol(eol);\r\n        if (defaultStyle != null) {\r\n            config.setDefaultStyle(defaultStyle);\r\n        }\r\n        config.setGeneratedAnno(generatedAnno);\r\n        return new BeanCodeGen(files, config, verbosity, write);\r\n    }\r\n\r\n    /**\r\n     * Finds the set of files to process.\r\n     * \r\n     * @param parent  the root, not null\r\n     * @param recurse  whether to recurse\r\n     * @return the files, not null\r\n     */\r\n    private static List<File> findFiles(Path parent, boolean recurse) {\r\n        try (var pathStream = Files.walk(parent, recurse ? Integer.MAX_VALUE : 1)) {\r\n            return pathStream\r\n                    .filter(path -> path.toString().endsWith(\".java\"))\r\n                    .map(path -> path.toFile())\r\n                    .toList();\r\n        } catch (IOException ex) {\r\n            throw new UncheckedIOException(ex);\r\n        }\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /** The files to process. */\r\n    private final List<File> files;\r\n    /** The configuration to use. */\r\n    private final BeanGenConfig config;\r\n    /** The verbosity level. */\r\n    private final int verbosity;\r\n    /** Whether to write or not. */\r\n    private final boolean write;\r\n\r\n    /**\r\n     * Creates the generator for a single bean.\r\n     * <p>\r\n     * To generate, use {@link #process()}.\r\n     * \r\n     * @param files  the files to process, not null\r\n     * @param config  the configuration to use, not null\r\n     * @param verbosity  the verbosity, from 0 to 3\r\n     * @param write  whether to write or not\r\n     */\r\n    public BeanCodeGen(List<File> files, BeanGenConfig config, int verbosity, boolean write) {\r\n        JodaBeanUtils.notNull(files, \"files\");\r\n        JodaBeanUtils.notNull(config, \"config\");\r\n        if (verbosity < 0 || verbosity > 3) {\r\n            throw new IllegalArgumentException(\"Invalid verbosity: \" + verbosity);\r\n        }\r\n        this.files = files;\r\n        this.config = config;\r\n        this.verbosity = verbosity;\r\n        this.write = write;\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Processes the file, recursing as necessary, generating the source code.\r\n     * <p>\r\n     * The number of altered files is returned.\r\n     * \r\n     * @return the number of changed files\r\n     * @throws Exception if an error occurs\r\n     */\r\n    public int process() throws Exception {\r\n        var changed = 0;\r\n        for (var file : files) {\r\n            changed += (processFile(file) != null ? 1 : 0);\r\n        }\r\n        return changed;\r\n    }\r\n\r\n    /**\r\n     * Processes the file, recursing as necessary, generating the source code.\r\n     * <p>\r\n     * The list of altered files is returned.\r\n     * \r\n     * @return the list of changed files, not null\r\n     * @throws Exception if an error occurs\r\n     */\r\n    public List<File> processFiles() throws Exception {\r\n        var changed = new ArrayList<File>();\r\n        for (var file : files) {\r\n            var processedFile = processFile(file);\r\n            if (processedFile != null) {\r\n                changed.add(processedFile);\r\n            }\r\n        }\r\n        return changed;\r\n    }\r\n\r\n    /**\r\n     * Processes the bean, generating the code.\r\n     * \r\n     * @param file  the file to process, not null\r\n     * @return not-null if changed\r\n     * @throws IOException if an error occurs\r\n     */\r\n    private File processFile(File file) throws IOException {\r\n        var original = Files.readAllLines(file.toPath());\r\n        var content = new ArrayList<>(original);\r\n        var gen = parse(file, content);\r\n        if (gen.isBean()) {\r\n            if (verbosity >= 2) {\r\n                System.out.print(file + \"  [processing]\");\r\n            }\r\n            gen.process();\r\n            if (contentDiffers(content, original)) {\r\n                return writeFileWithLogging(file, content);\r\n            } else if (verbosity >= 2) {\r\n                System.out.println(\" [no change]\");\r\n            }\r\n        } else {\r\n            gen.processNonBean();\r\n            if (contentDiffers(content, original)) {\r\n                return writeFileWithLogging(file, content);\r\n            } else if (verbosity == 3) {\r\n                System.out.println(file + \"  [ignored]\");\r\n            }\r\n        }\r\n        return null;\r\n    }\r\n\r\n    // parses the file\r\n    private BeanGen parse(File file, ArrayList<String> content) {\r\n        try {\r\n            var parser = new BeanParser(file, content, config);\r\n            return parser.parse();\r\n        } catch (BeanCodeGenException ex) {\r\n            throw ex;\r\n        } catch (Exception ex) {\r\n            throw new BeanCodeGenException(ex.getMessage(), ex, file);\r\n        }\r\n    }\r\n\r\n    // checks to see if the content differs from the original\r\n    // if the files differ only by @Override lines then they are considered to be equal\r\n    private boolean contentDiffers(List<String> content, List<String> original) {\r\n        var contentIndex = 0;\r\n        var originalIndex = 0;\r\n        while (contentIndex < content.size() && originalIndex < original.size()) {\r\n            var contentLine = content.get(contentIndex);\r\n            var originalLine = original.get(originalIndex);\r\n            if (contentLine.equals(originalLine)) {\r\n                // lines match\r\n                contentIndex++;\r\n                originalIndex++;\r\n            } else if (PATTERN_OVERRIDE.matcher(originalLine).matches()) {\r\n                // original is an @Override line\r\n                originalIndex++;\r\n            } else {\r\n                return true;\r\n            }\r\n        }\r\n        return contentIndex < content.size() || originalIndex < original.size();\r\n    }\r\n\r\n    // writes the file with appropriate logging\r\n    private File writeFileWithLogging(File file, ArrayList<String> content) throws IOException {\r\n        if (write) {\r\n            if (verbosity >= 2) {\r\n                System.out.println(\" [writing]\");\r\n            } else if (verbosity == 1) {\r\n                System.out.println(file + \"  [writing]\");\r\n            }\r\n            writeFile(file, content);\r\n        } else {\r\n            if (verbosity >= 2) {\r\n                System.out.println(\" [changed not written]\");\r\n            } else if (verbosity == 1) {\r\n                System.out.println(file + \"  [changed not written]\");\r\n            }\r\n        }\r\n        return file;\r\n    }\r\n\r\n    // this uses a customizable EOL character\r\n    private void writeFile(File file, List<String> content) throws IOException {\r\n        try (var writer = new FileWriter(file, StandardCharsets.UTF_8)) {\r\n            for (var line : content) {\r\n                writer.write(line);\r\n                writer.write(config.getEol());\r\n            }\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/BeanCodeGenException.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.gen;\n\nimport java.io.File;\nimport java.io.Serial;\n\n/**\n * Exception thrown by the code generator.\n */\npublic final class BeanCodeGenException extends RuntimeException {\n\n    /**\n     * Serialization version.\n     */\n    @Serial\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * The line number.\n     */\n    private final int line;\n    /**\n     * The file.\n     */\n    private final File file;\n\n    /**\n     * Creates the exception.\n     * \n     * @param message  the message\n     * @param file  the file that caused the error\n     * @param line  the line number\n     */\n    public BeanCodeGenException(String message, File file, int line) {\n        super(\"Error in bean: \" + file + \", Line: \" + line + \", Message: \" + message);\n        this.file = file;\n        this.line = line;\n    }\n\n    /**\n     * Creates the exception.\n     * \n     * @param message  the message\n     * @param cause  the cause\n     * @param file  the file that caused the error\n     */\n    public BeanCodeGenException(String message, Throwable cause, File file) {\n        super(\"Error in bean: \" + file + \", Line: 0, Message: \" + message, cause);\n        this.file = file;\n        this.line = 0;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the line number.\n     * \n     * @return the line number\n     */\n    public File getFile() {\n        return file;\n    }\n\n    /**\n     * Gets the line number.\n     * \n     * @return the line number\n     */\n    public int getLine() {\n        return line;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/BeanData.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.gen;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.SortedSet;\nimport java.util.TreeSet;\n\n/**\n * A bean that can be generated.\n */\nclass BeanData {\n\n    /** The list of current imports. */\n    private final SortedSet<String> currentImports = new TreeSet<>();\n    /** The list of new imports. */\n    private final SortedSet<String> newImports = new TreeSet<>();\n    /** The last import line. */\n    private int lastImportLine;\n    /** The bean style. */\n    private String beanStyle;\n    /** The bean meta scope. */\n    private String beanMetaScope;\n    /** The bean meta implements. */\n    private String beanMetaImplements;\n    /** The bean builder scope. */\n    private String beanBuilderScope;\n    /** The bean builder style. */\n    private String beanBuilderName;\n    /** The factory method name. */\n    private String factoryName;\n    /** Whether to cache the hash code. */\n    private boolean cacheHashCode;\n    /** Whether the class is immutable. */\n    private boolean immutable;\n    /** Whether the class can be constructed. */\n    private boolean constructable;\n    /** Whether the class has a manual constructor for immutable beans. */\n    private int immutableConstructor;\n    /** The method name of the immutable validator. */\n    private String immutableValidator;\n    /** The method name of the immutable defaults. */\n    private String immutableDefaults;\n    /** The method name of the immutable pre-build. */\n    private String immutablePreBuild;\n    /** The style of constructor to generate. */\n    private int constructorStyle;\n    /** The generated constructor scope. */\n    private String constructorScope;\n    /** The full type of the bean class. */\n    private String typeFull;\n    /** The simple name of the bean class. */\n    private String typeRaw;\n    /** The name clause of the generic. */\n    private String[] typeGenericName;\n    /** The extends clause of the generic. */\n    private String[] typeGenericExtends;\n    /** Whether the type is final with no subclasses. */\n    private boolean typeFinal;\n    /** The scope of the type. */\n    private String typeScope;\n    /** Whether the type is a root with no bean super-classes. */\n    private boolean root;\n    /** The full name of the bean superclass. */\n    private String superTypeFull;\n    /** The simple name of the bean superclass. */\n    private String superTypeRaw;\n    /** The generic argument of the bean superclass. */\n    private String superTypeGeneric;\n    /** The list of properties, in the order they are declared. */\n    private final List<PropertyData> properties = new ArrayList<>();\n    /** The serializable flag. */\n    private boolean serializable;\n    /** The manual serialization version id flag. */\n    private boolean manualSerVersionId;\n    /** Does the class have a manual clone. */\n    private boolean manualClone;\n    /** Does the class have a manual equals or hash code. */\n    private boolean manualEqualsHashCode;\n    /** Does the class have a manual toString. */\n    private boolean manualToStringCode;\n    /** The style for Object#clone */\n    private String cloneStyle;\n\n    /**\n     * Constructor.\n     */\n    BeanData() {\n    }\n\n    /**\n     * Gets the current set of imports.\n     * @return the imports\n     */\n    public SortedSet<String> getCurrentImports() {\n        return currentImports;\n    }\n\n    /**\n     * Gets the new imports.\n     * @return the imports\n     */\n    public SortedSet<String> getNewImports() {\n        return newImports;\n    }\n\n    /**\n     * Ensures an import is present.\n     * @param cls  the class, not null\n     */\n    public void ensureImport(Class<?> cls) {\n        ensureImport(cls.getName());\n    }\n\n    /**\n     * Ensures an import is present.\n     * @param className  the class name, not null\n     */\n    void ensureImport(String className) {\n        if (!currentImports.contains(className)) {\n            newImports.add(className);\n        }\n    }\n\n    /**\n     * Gets the import insert location.\n     * @return the insert location\n     */\n    public int getImportInsertLocation() {\n        return lastImportLine;\n    }\n\n    /**\n     * Sets the import insert location.\n     * @param location  the insert location\n     */\n    public void setImportInsertLocation(int location) {\n        lastImportLine = location;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the bean style.\n     * @return the flag\n     */\n    public String getBeanStyle() {\n        return beanStyle;\n    }\n\n    /**\n     * Sets the bean style.\n     * @param beanStyle  the flag\n     */\n    public void setBeanStyle(String beanStyle) {\n        this.beanStyle = beanStyle;\n    }\n\n    /**\n     * Resolves the bean style.\n     * @param defaultStyle  the default style\n     */\n    public void resolveBeanStyle(String defaultStyle) {\n        if (\"smart\".equals(beanStyle)) {\n            setBeanStyle(defaultStyle);\n        }\n    }\n\n    /**\n     * Is the bean style indicating that properties should be generated.\n     * @return the flag\n     */\n    public boolean isBeanStyleValid() {\n        return \"full\".equals(beanStyle) || \"smart\".equals(beanStyle) ||\n                \"minimal\".equals(beanStyle) || \"light\".equals(beanStyle);\n    }\n\n    /**\n     * Is the bean style indicating that no meta and builder should be generated.\n     * @return the flag\n     */\n    public boolean isBeanStyleLight() {\n        return \"light\".equals(beanStyle);\n    }\n\n    /**\n     * Is the bean style minimal.\n     * @return the flag\n     */\n    public boolean isBeanStyleMinimal() {\n        return \"minimal\".equals(beanStyle);\n    }\n\n    /**\n     * Is the bean style indicating that no meta and builder should be generated.\n     * @return the flag\n     */\n    public boolean isBeanStyleLightOrMinimal() {\n        return isBeanStyleLight() || isBeanStyleMinimal();\n    }\n\n    /**\n     * Is the bean style indicating that properties should be generated.\n     * @return the flag\n     */\n    public boolean isBeanStyleGenerateProperties() {\n        return \"full\".equals(beanStyle) || (\"smart\".equals(beanStyle) && !isImmutable());\n    }\n\n    /**\n     * Is the bean style indicating that properties should be generated.\n     * @return the flag\n     */\n    public boolean isBeanStyleGenerateMetaProperties() {\n        return (\"full\".equals(beanStyle) || \"smart\".equals(beanStyle)) && !isMetaScopePrivate();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the bean meta scope.\n     * @return the scope\n     */\n    public String getBeanMetaScope() {\n        return beanMetaScope;\n    }\n\n    /**\n     * Sets the bean meta scope.\n     * @param metaScope  the scope\n     */\n    public void setBeanMetaScope(String metaScope) {\n        this.beanMetaScope = metaScope;\n    }\n\n    /**\n     * Is the meta scope valid.\n     * @return the flag\n     */\n    public boolean isBeanMetaScopeValid() {\n        return \"smart\".equals(beanMetaScope) ||\n                \"private\".equals(beanMetaScope) ||\n                \"package\".equals(beanMetaScope) ||\n                \"public\".equals(beanMetaScope);\n    }\n\n    /**\n     * Gets the effective scope to use in the meta.\n     * @return the scope\n     */\n    public String getEffectiveMetaScope() {\n        var scope = beanMetaScope;\n        if (\"smart\".equals(scope)) {\n            scope = typeScope;\n        }\n        return \"package\".equals(scope) ? \"\" : scope + \" \";\n    }\n\n    /**\n     * Checks the meta-bean scope.\n     * @return the scope\n     */\n    public boolean isMetaScopePrivate() {\n        return \"private\".equals(beanMetaScope) || isBeanStyleLight();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the bean meta implements.\n     * @return the meta implements\n     */\n    public String getBeanMetaImplements() {\n        return beanMetaImplements;\n    }\n\n    /**\n     * Sets the bean meta implements.\n     * @param metaImplements  the meta implements\n     */\n    public void setBeanMetaImplements(String metaImplements) {\n        this.beanMetaImplements = metaImplements;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the bean builder scope.\n     * @return the scope\n     */\n    public String getBeanBuilderScope() {\n        return beanBuilderScope;\n    }\n\n    /**\n     * Sets the bean builder scope.\n     * @param builderScope  the scope\n     */\n    public void setBeanBuilderScope(String builderScope) {\n        this.beanBuilderScope = builderScope;\n    }\n\n    /**\n     * Is the builder scope valid.\n     * @return the flag\n     */\n    public boolean isBeanBuilderScopeValid() {\n        return \"smart\".equals(beanBuilderScope) ||\n                \"private\".equals(beanBuilderScope) ||\n                \"package\".equals(beanBuilderScope) ||\n                \"public\".equals(beanBuilderScope);\n    }\n\n    /**\n     * Gets the effective scope to use in the builder.\n     * @return the scope\n     */\n    public String getEffectiveBuilderScope() {\n        var scope = beanBuilderScope;\n        if (\"smart\".equals(scope)) {\n            scope = typeScope;\n        }\n        return \"package\".equals(scope) ? \"\" : scope + \" \";\n    }\n\n    /**\n     * Is the effective scope to use in the builder public.\n     * @return the scope\n     */\n    public boolean isEffectiveBuilderScopeVisible() {\n        return (\"smart\".equals(beanBuilderScope) || \"public\".equals(beanBuilderScope) || \"package\".equals(beanBuilderScope)) &&\n                !isBeanStyleLight();\n    }\n\n    /**\n     * Is the scope to use in the builder public.\n     * @return the scope\n     */\n    public boolean isBuilderScopeVisible() {\n        return \"public\".equals(beanBuilderScope) || \"package\".equals(beanBuilderScope);\n    }\n\n    /**\n     * Is the builder generated\n     * @return true if generated\n     */\n    public boolean isBuilderGenerated() {\n        return (isImmutable() && isEffectiveBuilderScopeVisible()) || (isMutable() && isBuilderScopeVisible());\n    }\n\n    /**\n     * Is the builder generated\n     * @return true if generated\n     */\n    public boolean isSkipBuilderGeneration() {\n        return (isMutable() && !isBuilderScopeVisible()) || isBeanStyleLight() || isBeanBuilderManual();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the bean builder class name.\n     * @return the class name\n     */\n    public String getBeanBuilderName() {\n        return beanBuilderName;\n    }\n\n    /**\n     * Sets the bean builder class name.\n     * @param builderName  the class name\n     */\n    public void setBeanBuilderName(String builderName) {\n        this.beanBuilderName = builderName;\n    }\n\n    /**\n     * Is the builder style manual.\n     * @return the flag\n     */\n    public boolean isBeanBuilderManual() {\n        return !beanBuilderName.isEmpty();\n    }\n\n    /**\n     * Gets the effective bean builder.\n     * @return the name\n     */\n    public String getEffectiveBeanBuilderName() {\n        return beanBuilderName.isEmpty() ? getTypeRaw() + \".Builder\" : beanBuilderName;\n    }\n\n    /**\n     * Gets the effective bean builder.\n     * @return the name\n     */\n    public String getEffectiveMinimalBeanBuilderName() {\n        return beanBuilderName.isEmpty() ? \"Builder\" : beanBuilderName;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the factory name.\n     * @return the factory name\n     */\n    public boolean isFactoryRequired() {\n        return !factoryName.isEmpty();\n    }\n\n    /**\n     * Gets the factory name.\n     * @return the factory name\n     */\n    public String getFactoryName() {\n        return factoryName;\n    }\n\n    /**\n     * Sets the factory name.\n     * @param name  the factory name\n     */\n    public void setFactoryName(String name) {\n        factoryName = name;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets whether to cache the hash code.\n     * @return the flag\n     */\n    public boolean isCacheHashCode() {\n        return cacheHashCode;\n    }\n\n    /**\n     * Sets whether to cache the hash code.\n     * @param cacheHashCode  the flag\n     */\n    public void setCacheHashCode(boolean cacheHashCode) {\n        this.cacheHashCode = cacheHashCode;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets whether property change support is needed.\n     * @return the flag\n     */\n    public boolean isPropertyChangeSupport() {\n        return properties.stream().anyMatch(PropertyData::isBound);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets whether the bean is immutable.\n     * @return the flag\n     */\n    public boolean isImmutable() {\n        return immutable;\n    }\n\n    /**\n     * Gets whether the bean is mutable.\n     * @return the flag\n     */\n    public boolean isMutable() {\n        return !immutable;\n    }\n\n    /**\n     * Sets whether the bean is immutable.\n     * @param immutable  the flag\n     */\n    public void setImmutable(boolean immutable) {\n        this.immutable = immutable;\n    }\n\n    /**\n     * Checks whether the bean can be constructed.\n     * @return the flag\n     */\n    public boolean isConstructable() {\n        return constructable;\n    }\n\n    /**\n     * Sets whether the bean can be constructed.\n     * @param constructable  the flag\n     */\n    public void setConstructable(boolean constructable) {\n        this.constructable = constructable;\n    }\n\n    /**\n     * Gets whether the bean has a manual constructor to use.\n     * @return the flag, zero for none, one for builder based, two for argument based\n     */\n    public int getImmutableConstructor() {\n        return immutableConstructor;\n    }\n\n    /**\n     * Sets whether the bean has a manual constructor to use.\n     * @param manualConstructor  the flag\n     */\n    public void setImmutableConstructor(int manualConstructor) {\n        this.immutableConstructor = manualConstructor;\n    }\n\n    /**\n     * Gets whether the bean has a validator.\n     * @return the method name\n     */\n    public String getImmutableValidator() {\n        return immutableValidator;\n    }\n\n    /**\n     * Sets whether the bean has a validator.\n     * @param immutableValidator  the method name\n     */\n    public void setImmutableValidator(String immutableValidator) {\n        this.immutableValidator = immutableValidator;\n    }\n\n    /**\n     * Gets whether the bean has an apply defaults method.\n     * @return the method name\n     */\n    public String getImmutableDefaults() {\n        return immutableDefaults;\n    }\n\n    /**\n     * Sets whether the bean has an apply defaults method.\n     * @param immutableDefaults  the method name\n     */\n    public void setImmutableDefaults(String immutableDefaults) {\n        this.immutableDefaults = immutableDefaults;\n    }\n\n    /**\n     * Gets whether the bean has a pre-build method.\n     * @return the method name\n     */\n    public String getImmutablePreBuild() {\n        return immutablePreBuild;\n    }\n\n    /**\n     * Sets whether the bean has a pre-build method.\n     * @param immutablePreBuild  the method name\n     */\n    public void setImmutablePreBuild(String immutablePreBuild) {\n        this.immutablePreBuild = immutablePreBuild;\n    }\n\n    /**\n     * Gets the constructor style to generate.\n     * @return the flag, zero for none, one for builder based, two for argument based\n     */\n    public int getConstructorStyle() {\n        return constructorStyle;\n    }\n\n    /**\n     * Sets the constructor style to generate.\n     * @param constructorStyle  the constructor style\n     */\n    public void setConstructorStyle(int constructorStyle) {\n        this.constructorStyle = constructorStyle;\n    }\n\n    /**\n     * Gets the constructor scope to generate.\n     * @return the scope\n     */\n    public String getConstructorScope() {\n        return constructorScope;\n    }\n\n    /**\n     * Sets the constructor scope to generate.\n     * @param constructorScope  the constructor scope\n     */\n    public void setConstructorScope(String constructorScope) {\n        this.constructorScope = constructorScope;\n    }\n\n    /**\n     * Is the constructor scope valid.\n     * @return true if valid\n     */\n    public boolean isConstructorScopeValid() {\n        return \"smart\".equals(constructorScope) ||\n                \"private\".equals(constructorScope) ||\n                \"package\".equals(constructorScope) ||\n                \"protected\".equals(constructorScope) ||\n                \"public\".equals(constructorScope) ||\n                \"public@ConstructorProperties\".equals(constructorScope);\n    }\n\n    /**\n     * Gets the effective scope to use in the constructor.\n     * @return the scope\n     */\n    public String getEffectiveConstructorScope() {\n        if (\"smart\".equals(constructorScope)) {\n            return isTypeFinal() ? \"private \" : \"protected \";\n        } else if (\"package\".equals(constructorScope)) {\n            return \"\";\n        } else if (\"public@ConstructorProperties\".equals(constructorScope)) {\n            return \"public \";\n        }\n        return constructorScope + \" \";\n    }\n\n    /**\n     * Checks if the scope indicates the need for the ConstructorProperties annotation.\n     * @return true if the annotation is needed\n     */\n    public boolean isConstructorPropertiesAnnotation() {\n        return \"public@ConstructorProperties\".equals(constructorScope);\n    }\n\n    /**\n     * Checks whether the bean is serializable.\n     * @return the flag\n     */\n    public boolean isSerializable() {\n        return serializable;\n    }\n\n    /**\n     * Sets whether the bean is serializable.\n     * @param serializable  the flag\n     */\n    public void setSerializable(boolean serializable) {\n        this.serializable = serializable;\n    }\n\n    /**\n     * Checks whether the bean has a manual serialization id.\n     * @return the flag\n     */\n    public boolean isManualSerializationId() {\n        return manualSerVersionId;\n    }\n\n    /**\n     * Sets whether the bean has a manual serialization id.\n     * @param manualSerVersionId  the flag\n     */\n    public void setManualSerializationId(boolean manualSerVersionId) {\n        this.manualSerVersionId = manualSerVersionId;\n    }\n\n    /**\n     * Checks if the clone is manual.\n     * @return true if manual\n     */\n    public boolean isManualClone() {\n        return manualClone;\n    }\n\n    /**\n     * Sets if the clone is manual.\n     * @param manualClone  true if manual\n     */\n    public void setManualClone(boolean manualClone) {\n        this.manualClone = manualClone;\n    }\n\n    /**\n     * Checks if the equals/hashCode is manual.\n     * @return true if manual\n     */\n    public boolean isManualEqualsHashCode() {\n        return manualEqualsHashCode;\n    }\n\n    /**\n     * Sets if the equals/hashCode is manual.\n     * @param manualEqualsHashCode  true if manual\n     */\n    public void setManualEqualsHashCode(boolean manualEqualsHashCode) {\n        this.manualEqualsHashCode = manualEqualsHashCode;\n    }\n\n    /**\n     * Checks if the toString is manual.\n     * @return true if manual\n     */\n    public boolean isManualToStringCode() {\n        return manualToStringCode;\n    }\n\n    /**\n     * Sets if the toString is manual.\n     * @param manualToStringCode  true if manual\n     */\n    public void setManualToStringCode(boolean manualToStringCode) {\n        this.manualToStringCode = manualToStringCode;\n    }\n\n    /**\n     * Gets the clone style.\n     * @return the clone style\n     */\n    public String getCloneStyle() {\n        return cloneStyle;\n    }\n\n    /**\n     * Sets the clone style.\n     * @param cloneStyle  the clone style\n     */\n    public void setCloneStyle(String cloneStyle) {\n        this.cloneStyle = cloneStyle;\n    }\n\n    /**\n     * Is the clone style valid.\n     * @return true if valid\n     */\n    public boolean isCloneStyleValid() {\n        return \"smart\".equals(cloneStyle) ||\n                \"omit\".equals(cloneStyle) ||\n                \"generate\".equals(cloneStyle);\n    }\n\n    /**\n     * Is the clone method to be skipped.\n     * @return true to generate\n     */\n    public boolean isSkipCloneGeneration() {\n        return (\"smart\".equals(cloneStyle) && isImmutable()) || \"omit\".equals(cloneStyle);\n    }\n\n    /**\n     * Sets the bean type.\n     * @param parts  the type to set\n     */\n    public void setTypeParts(String[] parts) {\n        this.typeFinal = parts[0] != null;\n        this.typeScope = parts[1];\n        this.typeFull = parts[2];\n        this.typeRaw = parts[3];\n        if (parts[8] != null) {\n            this.typeGenericName = new String[] {parts[4], parts[6], parts[8]};\n            this.typeGenericExtends = new String[3];\n            this.typeGenericExtends[0] = parts[5] != null ? parts[5] : \"\";\n            this.typeGenericExtends[1] = parts[7] != null ? parts[7] : \"\";\n            this.typeGenericExtends[2] = parts[9] != null ? parts[9] : \"\";\n        } else if (parts[6] != null) {\n            this.typeGenericName = new String[] {parts[4], parts[6]};\n            this.typeGenericExtends = new String[2];\n            this.typeGenericExtends[0] = parts[5] != null ? parts[5] : \"\";\n            this.typeGenericExtends[1] = parts[7] != null ? parts[7] : \"\";\n        } else if (parts[4] != null) {\n            this.typeGenericName = new String[] {parts[4]};\n            this.typeGenericExtends = new String[1];\n            this.typeGenericExtends[0] = parts[5] != null ? parts[5] : \"\";\n        } else {\n            this.typeGenericName = new String[0];\n            this.typeGenericExtends = new String[0];\n        }\n    }\n\n    /**\n     * Sets the bean superclass type.\n     * @param parts  the superclass to set\n     */\n    public void setSuperTypeParts(String[] parts) {\n        if (parts.length == 1) {\n            this.root = true;\n            this.immutable = \"ImmutableBean\".equals(parts[0]);\n            this.superTypeFull = \"\";\n            this.superTypeRaw = \"\";\n            this.superTypeGeneric = \"\";\n        } else {\n            this.root = \"DirectBean\".equals(parts[0]);\n            this.immutable = false;\n            this.superTypeFull = parts[0];\n            this.superTypeRaw = parts[1];\n            if (parts[4] != null) {\n                this.superTypeGeneric = parts[2] + \", \" + parts[3] + \", \" + parts[4];\n            } else if (parts[3] != null) {\n                this.superTypeGeneric = parts[2] + \", \" + parts[3];\n            } else if (parts[2] != null) {\n                this.superTypeGeneric = parts[2];\n            } else {\n                this.superTypeGeneric = \"\";\n            }\n        }\n    }\n\n    /**\n     * Gets the modifiable list of properties.\n     * @return the properties, not null\n     */\n    public List<PropertyData> getProperties() {\n        return properties;\n    }\n\n    /**\n     * Checks if the type is final.\n     * @return true if manual\n     */\n    public boolean isTypeFinal() {\n        return typeFinal;\n    }\n\n    /**\n     * Sets if the type is final.\n     * @param typeFinal  true if final, false if subclassable\n     */\n    public void setTypeFinal(boolean typeFinal) {\n        this.typeFinal = typeFinal;\n    }\n\n    /**\n     * Gets the scope of the type.\n     * @return the scope\n     */\n    public String getTypeScope() {\n        return typeScope;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Checks if this bean is a superclass.\n     * @return true if this is a subclass of another bean\n     */\n    public boolean isSubClass() {\n        return !root;\n    }\n\n    /**\n     * Checks if this bean is the root class in a hierarchy.\n     * @return true if this is the root class with no bean superclasses\n     */\n    public boolean isRootClass() {\n        return root;\n    }\n\n    /**\n     * Checks if this bean directly extends {@code DirectBean}.\n     * @return true if this extends DirectBean\n     */\n    public boolean isExtendsDirectBean() {\n        return \"DirectBean\".equals(superTypeFull);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Checks if the bean is parameterised with generics.\n     * @return true if generified\n     */\n    public boolean isTypeGeneric() {\n        return typeGenericName.length > 0;\n    }\n\n    /**\n     * Gets the number of generic type parameters.\n     * @return zero if no type parameters, one or two if it has type parameters\n     */\n    public int getTypeGenericCount() {\n        return typeGenericName.length;\n    }\n\n    /**\n     * Gets the bean type, such as '{@code Foo<T extends Bar>}'.\n     * @return the type\n     */\n    public String getType() {\n        return typeFull;\n    }\n\n    /**\n     * Gets the parameterisation of the bean including extends clause, such as '{@code <T extends Bar>}'.\n     * @param includeBrackets  whether to include the brackets\n     * @return the generic type, or a blank string if not generic, not null\n     */\n    public String getTypeGeneric(boolean includeBrackets) {\n        if (!isTypeGeneric()) {\n            return \"\";\n        }\n        var result = typeGenericName[0] + typeGenericExtends[0];\n        if (typeGenericExtends.length > 1) {\n            result += \", \" + typeGenericName[1] + typeGenericExtends[1];\n            if (typeGenericExtends.length > 2) {\n                result += \", \" + typeGenericName[2] + typeGenericExtends[2];\n            }\n        }\n        return includeBrackets && !result.isEmpty() ? '<' + result + '>' : result;\n    }\n\n    /**\n     * Gets the name of the parameterisation of the bean, such as '{@code <T, U>}'.\n     * @param includeBrackets  whether to include the brackets\n     * @return the generic type name, or a blank string if not generic, not null\n     */\n    public String getTypeGenericName(boolean includeBrackets) {\n        if (!isTypeGeneric()) {\n            return \"\";\n        }\n        var result = typeGenericName[0];\n        if (typeGenericExtends.length > 1) {\n            result += \", \" + typeGenericName[1];\n            if (typeGenericExtends.length > 2) {\n                result += \", \" + typeGenericName[2];\n            }\n        }\n        return includeBrackets && !result.isEmpty() ? '<' + result + '>' : result;\n    }\n\n    /**\n     * Gets the diamond operator if generic.\n     * @return the generic type name, or a blank string if not generic, not null\n     */\n    public String getTypeGenericDiamond() {\n        return isTypeGeneric() ? \"<>\" : \"\";\n    }\n\n    /**\n     * Gets the type with the diamond operator if generic.\n     * @return the type name, with generic diamond if necessary, not null\n     */\n    public String getTypeWithDiamond() {\n        return isTypeGeneric() ? getTypeRaw() + \"<>\" : getTypeRaw();\n    }\n\n    /**\n     * Gets the name of the parameterisation of the bean, such as '{@code <T>}'.\n     * @param typeParamIndex  the zero-based index of the type parameter\n     * @param includeBrackets  whether to include brackets\n     * @return the generic type name, not null\n     */\n    public String getTypeGenericName(int typeParamIndex, boolean includeBrackets) {\n        var result = typeGenericName[typeParamIndex];\n        return includeBrackets && !result.isEmpty() ? '<' + result + '>' : result;\n    }\n\n    /**\n     * Gets the extends clause of the parameterisation of the bean, such as '{@code  extends Foo}'.\n     * @param typeParamIndex  the zero-based index of the type parameter\n     * @return the generic type extends clause, or a blank string if not generic or no extends, not null\n     */\n    public String getTypeGenericErased(int typeParamIndex) {\n        var extend = typeGenericExtends[typeParamIndex];\n        return extend.startsWith(\" extends \") ? extend.substring(9) : \"Object\";\n    }\n\n    /**\n     * Gets the extends clause of the parameterisation of the bean, such as '{@code  extends Foo}'.\n     * @param typeParamIndex  the zero-based index of the type parameter\n     * @return the generic type extends clause, or a blank string if not generic or no extends, not null\n     */\n    public String getTypeGenericExtends(int typeParamIndex) {\n        return typeGenericExtends[typeParamIndex];\n    }\n\n    /**\n     * Gets the extends clause of the parameterisation of the bean, such as '{@code  extends Foo}'.\n     * @param typeParamIndex  the zero-based index of the type parameter\n     * @param typeParamNames  the type parameter names\n     * @return the generic type extends clause, or a blank string if not generic or no extends, not null\n     */\n    public String getTypeGenericExtends(int typeParamIndex, String[] typeParamNames) {\n        var genericClause = typeGenericExtends[typeParamIndex];\n        genericClause = genericClause.replace(\"<\" + typeGenericName[typeParamIndex] + \">\", \"<\" + typeParamNames[typeParamIndex] + \">\");\n        for (var i = 0; i < typeGenericName.length; i++) {\n            genericClause = genericClause.replace(\"<\" + typeGenericName[i] + \">\", \"<\" + typeParamNames[i] + \">\");\n            genericClause = genericClause.replace(\" extends \" + typeGenericName[i] + \">\", \" extends \" + typeParamNames[i] + \">\");\n            genericClause = genericClause.replace(\" super \" + typeGenericName[i] + \">\", \" super \" + typeParamNames[i] + \">\");\n        }\n        return genericClause;\n    }\n\n    /**\n     * Gets the full type of the bean with simple parameterization, such as '{@code Foo<T>}'.\n     * @return the generic type extends clause, or a blank string if not generic or no extends, not null\n     */\n    public String getTypeNoExtends() {\n        return typeRaw + getTypeGenericName(true);\n    }\n\n    /**\n     * Gets the raw type of the bean without generics, such as '{@code Foo}'.\n     * @return the raw type, not null\n     */\n    public String getTypeRaw() {\n        return typeRaw;\n    }\n\n    /**\n     * Gets the full type of the bean with wildcarded parameterization, such as '{@code Foo<?>}'.\n     * @return the wildcarded type, not null\n     */\n    public String getTypeWildcard() {\n        if (!isTypeGeneric()) {\n            return typeRaw;\n        }\n        var result = \"?\";\n        if (typeGenericExtends.length > 1) {\n            result += \", ?\";\n            if (typeGenericExtends.length > 2) {\n                result += \", ?\";\n            }\n        }\n        return typeRaw + '<' + result + '>';\n    }\n\n    /**\n     * Checks if the type specified is one of the bean's type parameters.\n     * @param type  the type\n     * @return true if a type parameter of this bean\n     */\n    public boolean isTypeGenerifiedBy(String type) {\n        if ((typeGenericName.length > 2 && typeGenericName[2].equals(type)) || (typeGenericName.length > 1 && typeGenericName[1].equals(type))) {\n            return true;\n        }\n        if (typeGenericName.length > 0 && typeGenericName[0].equals(type)) {\n            return true;\n        }\n        return false;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Checks if the super bean is parameterised with generics.\n     * @return true if generified\n     */\n    public boolean isSuperTypeGeneric() {\n        return !superTypeGeneric.isEmpty();\n    }\n\n    /**\n     * Gets the bean superclass type.\n     * @return the superclass\n     */\n    public String getSuperType() {\n        return superTypeFull;\n    }\n\n    /**\n     * Gets the parameterisation of the super bean.\n     * @param includeBrackets  whether to include the brackets\n     * @return the generic type, or a blank string if not generic, not null\n     */\n    public String getSuperTypeGeneric(boolean includeBrackets) {\n        return includeBrackets && !superTypeGeneric.isEmpty() ? '<' + superTypeGeneric + '>' : superTypeGeneric;\n    }\n\n    /**\n     * Gets the raw type of the super bean without generics.\n     * @return the raw type, not null\n     */\n    public String getSuperTypeRaw() {\n        return superTypeRaw;\n    }\n\n    /**\n     * Checks if any property is validated.\n     * @return true if validated\n     */\n    public boolean isValidated() {\n        return properties.stream().anyMatch(PropertyData::isValidated);\n    }\n\n    /**\n     * Gets the scope of nested Meta and Builder classes.\n     * @return the scope, not null\n     */\n    public String getNestedClassConstructorScope() {\n        return (isTypeFinal() ? \"private\" : \"protected\");\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/BeanDefinition.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.gen;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Annotation defining a bean for code generation.\n * <p>\n * This annotation must be used on classes that should be treated as beans.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.TYPE)\npublic @interface BeanDefinition {\n\n    /**\n     * The style of bean generation.\n     * <p>\n     * By default, this follows 'smart' rules.\n     * Set to 'minimal' to generate a minimal amount of code.\n     * Set to 'full' to generate the full code.\n     * Set to 'light' to generate a light immutable bean using reflection internally.\n     * \n     * @return the style, defaulted to 'smart'\n     */\n    String style() default \"smart\";\n\n    /**\n     * The scope of the generated constructor.\n     * <p>\n     * Only applicable to immutable beans. By default, this follows 'smart'\n     * rules, which generate a private constructor when needed by the builder.\n     * Set to 'private' to generate a private constructor.\n     * Set to 'package' to generate a package-scoped constructor.\n     * Set to 'protected' to generate a protected constructor.\n     * Set to 'public' to generate a public constructor.\n     * Set to 'public@ConstructorProperties' to generate an annotated public constructor.\n     * \n     * @return the constructor scope, defaulted to 'smart'\n     */\n    String constructorScope() default \"smart\";\n\n    /**\n     * The scope of the meta-bean class.\n     * <p>\n     * By default, this follows 'smart' rules, which generate a public meta-bean.\n     * Set to 'private' to generate a private meta-bean.\n     * Set to 'package' to generate a package-scoped meta-bean.\n     * Set to 'public' to generate a public meta-bean.\n     * \n     * @return the meta scope, defaulted to 'smart'\n     */\n    String metaScope() default \"smart\";\n\n    /**\n     * The interfaces to add to the meta-bean class declaration.\n     * <p>\n     * By default, this adds no interfaces to the implements clause.\n     * This option is only useful if the meta bean is a generated class.\n     * \n     * @return the meta scope, defaulted to ''\n     */\n    String metaImplements() default \"\";\n\n    /**\n     * The scope of the builder class.\n     * <p>\n     * By default, this follows 'smart' rules, which generate a public builder for\n     * immutable beans and no builder for mutable beans.\n     * Set to 'private' to generate a private builder.\n     * Set to 'package' to generate a package-scoped builder.\n     * Set to 'public' to generate a public builder.\n     * \n     * @return the builder scope, defaulted to 'smart'\n     */\n    String builderScope() default \"smart\";\n\n    /**\n     * The name of the manual builder class.\n     * <p>\n     * This is used when there is a desire to manually write the builder.\n     * By default, this is not set, and a builder is generated based on the scope.\n     * Set to 'FooBuilder' to generate code that expects a manually written builder named FooBuilder\n     * (which may be an inner class or a top-level class).\n     * \n     * @return the builder scope, defaulted to ''\n     */\n    String builderName() default \"\";\n\n    /**\n     * The name of the factory method.\n     * <p>\n     * By default, this is an empty string and no factory is generated.\n     * Set to 'of' to generate a factory method named 'of'.\n     * \n     * @return the factory name, defaulted to ''\n     */\n    String factoryName() default \"\";\n\n    /**\n     * Information about the bean hierarchy.\n     * <p>\n     * This is needed to add information that cannot be derived.\n     * Set to 'immutable' for a subclass of an immutable bean.\n     * \n     * @return the hierarchy, defaulted to ''\n     */\n    String hierarchy() default \"\";\n\n    /**\n     * The configuration for generating clone methods.\n     * <p>\n     * This flag controls generation of the {@code clone} method.\n     * The default is 'smart'.\n     * <p>\n     * The valid values are:\n     * <ul>\n     * <li>'omit' - omit the clone method\n     * <li>'smart' - process intelligently, generating it for mutable and not generating for immutable\n     * <li>'generate' - generate the clone method\n     * </ul>\n     * \n     * @return the clone style, defaulted to 'smart'\n     */\n    String cloneStyle() default \"smart\";\n\n    /**\n     * Whether to generate code to cache the hash code.\n     * <p>\n     * Setting this to true will cause the hash code to be cached using the racy single check idiom.\n     * The setting only applies to immutable beans.\n     * \n     * @return true if the hash code is to be cached\n     */\n    boolean cacheHashCode() default false;\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/BeanGen.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.gen;\n\nimport java.io.File;\nimport java.lang.invoke.MethodHandles;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\nimport java.util.Set;\nimport java.util.SortedSet;\nimport java.util.TreeSet;\nimport java.util.function.BiConsumer;\nimport java.util.function.Function;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.impl.BasicBeanBuilder;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\nimport org.joda.beans.impl.direct.DirectPrivateBeanBuilder;\nimport org.joda.beans.impl.direct.MinimalMetaBean;\nimport org.joda.beans.impl.light.LightMetaBean;\n\n/**\n * Code generator for a bean.\n */\nclass BeanGen {\n\n    /** Constructor style for none. */\n    static final int CONSTRUCTOR_NONE = 0;\n    /** Constructor style for builder-based. */\n    static final int CONSTRUCTOR_BY_BUILDER = 1;\n    /** Constructor style for argument-based. */\n    static final int CONSTRUCTOR_BY_ARGS = 2;\n    /** Class name - this avoids a Class.class reference to the java.desktop module. */\n    private static final String CLASS_CONSTRUCTOR_PROPERTIES = \"java.beans.ConstructorProperties\";\n    /** Class name - this avoids a Class.class reference to the java.desktop module. */\n    private static final String CLASS_PROPERTY_CHANGE_SUPPORT = \"java.beans.PropertyChangeSupport\";\n    /** Line separator. */\n    private static final String LINE_SEPARATOR = \"\\t//-----------------------------------------------------------------------\";\n    /** Line separator. */\n    private static final String LINE_SEPARATOR_INDENTED = \"\\t\\t//-----------------------------------------------------------------------\";\n    /** Types with primitive equals. */\n    private static final Set<String> PRIMITIVE_EQUALS = new HashSet<>();\n    static {\n        PRIMITIVE_EQUALS.add(\"boolean\");\n        PRIMITIVE_EQUALS.add(\"char\");\n        PRIMITIVE_EQUALS.add(\"byte\");\n        PRIMITIVE_EQUALS.add(\"short\");\n        PRIMITIVE_EQUALS.add(\"int\");\n        PRIMITIVE_EQUALS.add(\"long\");\n        // not float or double, as Double.equals is not the same as double ==\n    }\n\n    /** The content to process. */\n    private final File file;\n    /** The content to process. */\n    private final List<String> content;\n    /** The config. */\n    private final BeanGenConfig config;\n    /** The data model of the bean. */\n    private final BeanData data;\n    /** The list of property generators. */\n    private final List<PropertyGen> properties;\n    /** The region to insert into. */\n    private final List<String> insertRegion;\n    /** The list of removed imports. */\n    private final SortedSet<String> removedImports = new TreeSet<>();\n\n    /**\n     * Constructor used when file is not a bean.\n     * @param file  the file, not null\n     * @param content  the content to process, not null\n     * @param config  the config to use, not null\n     * @param data  the parsed data\n     */\n    BeanGen(File file, List<String> content, BeanGenConfig config, BeanData data) {\n        this.file = file;\n        this.content = content;\n        this.config = config;\n        this.data = data;\n        this.properties = null;\n        this.insertRegion = null;\n    }\n\n    /**\n     * Constructor used when file is a parsed bean.\n     * @param file  the file, not null\n     * @param content  the content to process, not null\n     * @param config  the config to use, not null\n     * @param data  the parsed data\n     * @param properties  the parsed properties\n     * @param autoEndIndex  the start of the autogen area\n     * @param autoStartIndex   the end of the autogen area\n     */\n    BeanGen(\n            File file, List<String> content, BeanGenConfig config,\n            BeanData data, List<PropertyGen> properties, int autoStartIndex, int autoEndIndex) {\n        this.file = file;\n        this.content = content;\n        this.config = config;\n        this.data = data;\n        this.properties = properties;\n        this.insertRegion = content.subList(autoStartIndex + 1, autoEndIndex);\n    }\n\n    //-----------------------------------------------------------------------\n    void process() {\n        fixImports();\n        if (insertRegion != null) {\n            data.ensureImport(BeanDefinition.class);\n            if (!properties.isEmpty()) {\n                data.ensureImport(PropertyDefinition.class);\n            }\n            removeOld();\n            if (data.isRootClass() && data.isExtendsDirectBean()) {\n                data.ensureImport(DirectBean.class);\n            }\n            generateMeta();\n            generateSerializationVersionId();\n            generatePropertyChangeSupportField();\n            generateHashCodeField();\n            generateFactory();\n            generateImmutableBuilderMethod();\n            generateArgBasedConstructor();\n            generateBuilderBasedConstructor();\n            generateMetaBean();\n            generateGettersSetters();\n            generateSeparator();\n            generateImmutableToBuilder();\n            generateClone();\n            generateEquals();\n            generateHashCode();\n            generateToString();\n            generateMetaClass();\n            generateBuilderClass();\n            resolveImports();\n            resolveIndents();\n        }\n    }\n\n    void processNonBean() {\n        fixImports();\n        resolveImports();\n    }\n\n    private void fixImports() {\n        renameImport(\"org.joda.beans.BeanDefinition\", BeanDefinition.class);\n        renameImport(\"org.joda.beans.DerivedProperty\", DerivedProperty.class);\n        renameImport(\"org.joda.beans.ImmutableConstructor\", ImmutableConstructor.class);\n        renameImport(\"org.joda.beans.ImmutableDefaults\", ImmutableDefaults.class);\n        renameImport(\"org.joda.beans.ImmutablePreBuild\", ImmutablePreBuild.class);\n        renameImport(\"org.joda.beans.ImmutableValidator\", ImmutableValidator.class);\n        renameImport(\"org.joda.beans.PropertyDefinition\", PropertyDefinition.class);\n    }\n\n    private void renameImport(String old, Class<?> cls) {\n        if (data.getCurrentImports().contains(old)) {\n            removedImports.add(old);\n            data.ensureImport(cls);\n        }\n    }\n\n    private void resolveImports() {\n        if (!data.getNewImports().isEmpty()) {\n            var pos = data.getImportInsertLocation() + 1;\n            for (var imp : data.getNewImports()) {\n                content.add(pos++, \"import \" + imp + \";\");\n            }\n        }\n        if (!removedImports.isEmpty()) {\n            for (var it = content.listIterator(); it.hasNext(); ) {\n                var line = it.next().trim();\n                if (line.startsWith(\"import \")) {\n                    var imported = line.substring(7).trim().replace(\" \", \"\").replace(\";\", \"\");\n                    if (removedImports.contains(imported)) {\n                        it.remove();\n                    }\n                }\n            }\n        }\n    }\n\n    private void resolveIndents() {\n        for (var it = content.listIterator(); it.hasNext(); ) {\n            it.set(it.next().replace(\"\\t\", config.getIndent()));\n        }\n    }\n\n    private void removeOld() {\n        insertRegion.clear();\n    }\n\n    //-----------------------------------------------------------------------\n    private void generateSeparator() {\n        if (!insertRegion.isEmpty() && insertRegion.get(insertRegion.size() - 1).equals(LINE_SEPARATOR)) {\n            return;\n        }\n        addLine(0, LINE_SEPARATOR);\n    }\n\n    private void generateIndentedSeparator() {\n        if (!insertRegion.isEmpty() && insertRegion.get(insertRegion.size() - 1).equals(LINE_SEPARATOR_INDENTED)) {\n            return;\n        }\n        addLine(0, LINE_SEPARATOR_INDENTED);\n    }\n\n    private void generateGenerated(int tabCount) {\n        if (config.isGeneratedAnno()) {\n            addLine(tabCount, \"@Generated(\\\"org.joda.beans.gen.BeanCodeGen\\\")\");\n        }\n    }\n\n    private void generateFactory() {\n        if (data.isFactoryRequired()) {\n            var nonDerived = nonDerivedProperties();\n            addLine(1, \"/**\");\n            addLine(1, \" * Obtains an instance.\");\n            if (!nonDerived.isEmpty()) {\n                if (data.isTypeGeneric()) {\n                    for (var j = 0; j < data.getTypeGenericCount(); j++) {\n                        addLine(1, \" * @param \" + data.getTypeGenericName(j, true) + \"  the type\");\n                    }\n                }\n                for (var propertyGen : nonDerived) {\n                    var prop = propertyGen.getData();\n                    addLine(1, \" * @param \" + prop.getPropertyName() + \"  the value of the property\" + prop.getNotNullJavadoc());\n                }\n            }\n            addLine(1, \" * @return the instance\");\n            addLine(1, \" */\");\n            if (nonDerived.isEmpty()) {\n                addLine(1, \"public static \" + data.getTypeNoExtends() + \" \" + data.getFactoryName() + \"() {\");\n                addLine(2, \"return new \" + data.getTypeNoExtends() + \"();\");\n                \n            } else {\n                if (data.isTypeGeneric()) {\n                    addLine(1, \"public static \" + data.getTypeGeneric(true) + \" \" +\n                                    data.getTypeNoExtends() + \" \" + data.getFactoryName() + \"(\");\n                } else {\n                    addLine(1, \"public static \" + data.getTypeNoExtends() + \" \" + data.getFactoryName() + \"(\");\n                }\n                for (var i = 0; i < nonDerived.size(); i++) {\n                    var prop = nonDerived.get(i);\n                    addLine(3, prop.getBuilderType() + \" \" + prop.getData().getPropertyName() + joinComma(i, nonDerived, \") {\"));\n                }\n                addLine(2, \"return new \" + data.getTypeWithDiamond() + \"(\");\n                for (var i = 0; i < nonDerived.size(); i++) {\n                    addLine(3, nonDerived.get(i).generateBuilderFieldName() + joinComma(i, nonDerived, \");\"));\n                }\n            }\n            addLine(1, \"}\");\n            addBlankLine();\n        }\n    }\n\n    private void generateImmutableBuilderMethod() {\n        if (data.isConstructable() && data.isBuilderGenerated()) {\n            addLine(1, \"/**\");\n            addLine(1, \" * Returns a builder used to create an instance of the bean.\");\n            if (data.isTypeGeneric()) {\n                for (var j = 0; j < data.getTypeGenericCount(); j++) {\n                    addLine(1, \" * @param \" + data.getTypeGenericName(j, true) + \"  the type\");\n                }\n            }\n            addLine(1, \" * @return the builder, not null\");\n            addLine(1, \" */\");\n            if (data.isTypeGeneric()) {\n                addLine(1, data.getEffectiveBuilderScope() + \"static \" + data.getTypeGeneric(true) +\n                                \" \" + data.getEffectiveBeanBuilderName() + data.getTypeGenericName(true) + \" builder() {\");\n            } else {\n                addLine(1, data.getEffectiveBuilderScope() + \"static \" + data.getEffectiveBeanBuilderName() + \" builder() {\");\n            }\n            addLine(2, \"return new \" + data.getEffectiveBeanBuilderName() + data.getTypeGenericDiamond() + \"();\");\n            addLine(1, \"}\");\n            addBlankLine();\n        }\n    }\n\n    private void generateBuilderBasedConstructor() {\n        if (data.getConstructorStyle() == CONSTRUCTOR_BY_BUILDER && data.getImmutableConstructor() == CONSTRUCTOR_NONE && \n                ((data.isMutable() && data.isBuilderScopeVisible()) || data.isImmutable())) {\n            var nonDerived = nonDerivedProperties();\n            var scope = (data.isTypeFinal() ? \"private\" : \"protected\");\n            // signature\n            addLine(1, \"/**\");\n            addLine(1, \" * Restricted constructor.\");\n            addLine(1, \" * @param builder  the builder to copy from, not null\");\n            addLine(1, \" */\");\n            addLine(1, scope + \" \" + data.getTypeRaw() + \"(\" + data.getEffectiveBeanBuilderName() + data.getTypeGenericName(true) + \" builder) {\");\n            // super\n            if (data.isSubClass()) {\n                addLine(2, \"super(builder);\");\n            }\n            // validate\n            for (var prop : properties) {\n                if (prop.getData().isValidated()) {\n                    addLine(2, prop.getData().getValidationMethodName() +\n                            \"(builder.\" + prop.generateBuilderFieldName() +\n                            \", \\\"\" + prop.getData().getPropertyName() + \"\\\");\");\n                }\n            }\n            // assign\n            if (data.isImmutable()) {\n                // assign\n                for (var propertyGen : nonDerived) {\n                    addLines(propertyGen.generateConstructorAssign(\"builder.\"));\n                }\n            } else {\n                for (var propGen : nonDerived) {\n                    var prop = propGen.getData();\n                    if (prop.isCollectionType()) {\n                        if (prop.isNotNull()) {\n                            addLine(2, \"this.\" + prop.getPropertyName() + \".addAll(builder.\" + propGen.generateBuilderFieldName() + \");\");\n                        } else {\n                            addLine(2, \"this.\" + prop.getPropertyName() + \" = builder.\" + propGen.generateBuilderFieldName() + \";\");\n                        }\n                    } else if (prop.isMapType()) {\n                        if (prop.isNotNull()) {\n                            addLine(2, \"this.\" + prop.getPropertyName() + \".putAll(builder.\" + propGen.generateBuilderFieldName() + \");\");\n                        } else {\n                            addLine(2, \"this.\" + prop.getPropertyName() + \" = builder.\" + propGen.generateBuilderFieldName() + \";\");\n                        }\n                    } else {\n                        addLine(2, \"this.\" + prop.getPropertyName() + \" = builder.\" + propGen.generateBuilderFieldName() + \";\");\n                    }\n                }\n            }\n            if (data.getImmutableValidator() != null) {\n                addLine(2, data.getImmutableValidator() + \"();\");\n            }\n            addLine(1, \"}\");\n            addBlankLine();\n        }\n    }\n\n    private void generateArgBasedConstructor() {\n        if (isArgBasedConstructor()) {\n            var scope = data.getEffectiveConstructorScope();\n            var generateAnnotation = data.isConstructorPropertiesAnnotation();\n            var generateJavadoc = !\"private \".equals(scope);\n            var nonDerived = nonDerivedProperties();\n            if (nonDerived.isEmpty()) {\n                if (generateJavadoc) {\n                    addLine(1, \"/**\");\n                    addLine(1, \" * Creates an instance.\");\n                    addLine(1, \" */\");\n                }\n                if (generateAnnotation) {\n                    data.ensureImport(CLASS_CONSTRUCTOR_PROPERTIES);\n                    addLine(1, \"@ConstructorProperties({})\");\n                }\n                addLine(1, scope + data.getTypeRaw() + \"() {\");\n            } else {\n                // signature\n                if (generateJavadoc) {\n                    addLine(1, \"/**\");\n                    addLine(1, \" * Creates an instance.\");\n                    for (var propertyGen : nonDerived) {\n                        var prop = propertyGen.getData();\n                        addLine(1, \" * @param \" + prop.getPropertyName() + \"  the value of the property\" + prop.getNotNullJavadoc());\n                    }\n                    addLine(1, \" */\");\n                }\n                if (generateAnnotation) {\n                    data.ensureImport(CLASS_CONSTRUCTOR_PROPERTIES);\n                    var buf = new StringBuilder();\n                    for (var i = 0; i < nonDerived.size(); i++) {\n                        buf.append('\"').append(nonDerived.get(i).getData().getPropertyName()).append('\"');\n                        buf.append(join(i, nonDerived, \", \", \"\"));\n                    }\n                    addLine(1, \"@ConstructorProperties({\" + buf + \"})\");\n                }\n                addLine(1, scope + data.getTypeRaw() + \"(\");\n                for (var i = 0; i < nonDerived.size(); i++) {\n                    var prop = nonDerived.get(i);\n                    addLine(3, prop.getBuilderType() + \" \" + prop.getData().getPropertyName() + joinComma(i, nonDerived, \") {\"));\n                }\n                // validate (mutable light beans call setters which validate)\n                if (!(data.isMutable() && data.isBeanStyleLight())) {\n                    for (var prop : properties) {\n                        if (prop.getData().isValidated()) {\n                            addLine(2, prop.getData().getValidationMethodName() +\n                                    \"(\" + prop.getData().getPropertyName() +\n                                    \", \\\"\" + prop.getData().getPropertyName() + \"\\\");\");\n                        }\n                    }\n                }\n                // assign\n                for (var prop : nonDerived) {\n                    if (data.isMutable() && data.isBeanStyleLight()) {\n                        var generateSetInvoke = prop.getData().getSetterGen().generateSetInvoke(\n                                prop.getData(), prop.getData().getPropertyName());\n                        addLine(2, generateSetInvoke + \";\");\n                    } else {\n                        addLines(prop.generateConstructorAssign(\"\"));\n                    }\n                }\n            }\n            if (data.getImmutableValidator() != null) {\n                addLine(2, data.getImmutableValidator() + \"();\");\n            }\n            addLine(1, \"}\");\n            addBlankLine();\n        }\n    }\n\n    private boolean isArgBasedConstructor() {\n        if (data.getConstructorStyle() == CONSTRUCTOR_BY_ARGS &&\n                data.getImmutableConstructor() == CONSTRUCTOR_NONE &&\n                ((data.isMutable() && (data.isBuilderScopeVisible() || data.isBeanStyleLight())) || data.isImmutable())) {\n            return true;\n        }\n        return data.getConstructorStyle() == CONSTRUCTOR_BY_BUILDER &&\n                data.getImmutableConstructor() == CONSTRUCTOR_NONE &&\n                data.isImmutable() &&\n                !data.isTypeFinal() &&\n                !\"smart\".equals(data.getConstructorScope());\n    }\n\n    //-----------------------------------------------------------------------\n    private void generateMeta() {\n        if (data.isBeanStyleLightOrMinimal()) {\n            addLine(1, \"/**\");\n            addLine(1, \" * The meta-bean for {@code \" + data.getTypeRaw() + \"}.\");\n            addLine(1, \" */\");\n            var genericProps = data.getProperties().stream()\n                    .anyMatch(p -> p.isGeneric());\n            var unchecked = data.isBeanStyleMinimal() && data.isMutable() && genericProps;\n            unchecked |= data.isBeanStyleMinimal() && data.isTypeGeneric() && !data.isSkipBuilderGeneration();\n            var rawtypes = data.isBeanStyleMinimal() && data.isTypeGeneric();\n            if (unchecked && rawtypes) {\n                addLine(1, \"@SuppressWarnings({\\\"unchecked\\\", \\\"rawtypes\\\" })\");\n            } else if (rawtypes) {\n                addLine(1, \"@SuppressWarnings(\\\"rawtypes\\\")\");\n            } else if (unchecked) {\n                addLine(1, \"@SuppressWarnings(\\\"unchecked\\\")\");\n            }\n            if (data.isTypeGeneric()) {\n                data.ensureImport(MetaBean.class);\n                addLine(1, \"private static final MetaBean META_BEAN =\");\n            } else {\n                data.ensureImport(TypedMetaBean.class);\n                addLine(1, \"private static final TypedMetaBean<\" + data.getTypeNoExtends() + \"> META_BEAN =\");\n            }\n            var nonDerived = nonDerivedProperties();\n            var aliases = nonDerived.stream().filter(p -> p.getData().getAlias() != null).toList();\n            var hasAliases = aliases.isEmpty();\n            if (data.isBeanStyleLight()) {\n                // light\n                data.ensureImport(LightMetaBean.class);\n                data.ensureImport(MethodHandles.class);\n                var specialInit = nonDerived.stream().anyMatch(p -> p.isSpecialInit());\n                if (nonDerived.isEmpty()) {\n                    addLine(3, \"LightMetaBean.of(\" + data.getTypeRaw() + \".class, MethodHandles.lookup());\");\n                } else {\n                    addLine(3, \"LightMetaBean.of(\");\n                    addLine(5, data.getTypeRaw() + \".class,\");\n                    addLine(5, \"MethodHandles.lookup(),\");\n                    generateFieldNames(nonDerived);\n                    if (specialInit) {\n                        for (var i = 0; i < nonDerived.size(); i++) {\n                            addLine(5, nonDerived.get(i).generateInit() +\n                                    joinComma(i, nonDerived, \")\" + (hasAliases ? \";\" : \"\")));\n                        }\n                    } else {\n                        addLine(5, \"new Object[0])\" + (hasAliases ? \";\" : \"\"));\n                    }\n                    for (var i = 0; i < aliases.size(); i++) {\n                        var prop = aliases.get(i);\n                        addLine(5, \".withAlias(\\\"\" + prop.getData().getAlias() + \"\\\", \\\"\" +\n                                prop.getData().getPropertyName() + \"\\\")\" + join(i, aliases, \"\", \";\"));\n                    }\n                }\n            } else {\n                // minimal\n                data.ensureImport(MinimalMetaBean.class);\n                addLine(3, \"MinimalMetaBean.of(\");\n                addLine(5, data.getTypeRaw() + \".class,\");\n                generateFieldNames(nonDerived);\n                var builderLambda = \"() -> new \" + data.getEffectiveBeanBuilderName() + \"()\";\n                if (data.isSkipBuilderGeneration()) {\n                    if (data.isBeanBuilderManual()) {\n                        builderLambda = \"() -> new \" + data.getEffectiveMinimalBeanBuilderName() + \"()\";\n                    } else {\n                        data.ensureImport(BasicBeanBuilder.class);\n                        builderLambda = \"() -> new BasicBeanBuilder<>(new \" + data.getTypeWithDiamond() + \"())\";\n                    }\n                }\n                if (nonDerived.isEmpty()) {\n                    if (data.isImmutable()) {\n                        addLine(5, builderLambda + \");\");\n                    } else {\n                        data.ensureImport(Collections.class);\n                        data.ensureImport(Function.class);\n                        data.ensureImport(BiConsumer.class);\n                        addLine(5, builderLambda + \",\");\n                        addLine(5, \"Collections.<Function<\" + data.getTypeRaw() + \", Object>>emptyList(),\");\n                        addLine(5, \"Collections.<BiConsumer<\" + data.getTypeRaw() + \", Object>>emptyList());\");\n                    }\n                } else {\n                    addLine(5, builderLambda + \",\");\n                    if (data.isImmutable()) {\n                        for (var i = 0; i < nonDerived.size(); i++) {\n                            addLine(5, nonDerived.get(i).generateLambdaGetter() + joinComma(i, nonDerived, \")\" +\n                                    (hasAliases ? \";\" : \"\")));\n                        }\n                    } else {\n                        data.ensureImport(Arrays.class);\n                        data.ensureImport(Function.class);\n                        data.ensureImport(BiConsumer.class);\n                        addLine(5, \"Arrays.<Function<\" + data.getTypeRaw() + \", Object>>asList(\");\n                        for (var i = 0; i < nonDerived.size(); i++) {\n                            addLine(7, nonDerived.get(i).generateLambdaGetter() + joinComma(i, nonDerived, \"),\"));\n                        }\n                        addLine(5, \"Arrays.<BiConsumer<\" + data.getTypeRaw() + \", Object>>asList(\");\n                        for (var i = 0; i < nonDerived.size(); i++) {\n                            addLine(7, nonDerived.get(i).generateLambdaSetter() +\n                                    joinComma(i, nonDerived, \"))\" + (hasAliases ? \";\" : \"\")));\n                        }\n                    }\n                    for (var i = 0; i < aliases.size(); i++) {\n                        var prop = aliases.get(i);\n                        addLine(5, \".withAlias(\\\"\" + prop.getData().getAlias() + \"\\\", \\\"\" +\n                                prop.getData().getPropertyName() + \"\\\")\" + join(i, aliases, \"\", \";\"));\n                    }\n                }\n            }\n            addBlankLine();\n            addLine(1, \"/**\");\n            addLine(1, \" * The meta-bean for {@code \" + data.getTypeRaw() + \"}.\");\n            addLine(1, \" * @return the meta-bean, not null\");\n            addLine(1, \" */\");\n            if (data.isTypeGeneric()) {\n                addLine(1, \"public static MetaBean meta() {\");\n            } else {\n                addLine(1, \"public static TypedMetaBean<\" + data.getTypeNoExtends() + \"> meta() {\");\n            }\n            addLine(2, \"return META_BEAN;\");\n            addLine(1, \"}\");\n            addBlankLine();\n            addLine(1, \"static {\");\n            data.ensureImport(MetaBean.class);\n            addLine(2, \"MetaBean.register(META_BEAN);\");\n            addLine(1, \"}\");\n            addBlankLine();\n            \n        } else {\n            // this cannot be generified without either Eclipse or javac complaining\n            // raw types forever\n            addLine(1, \"/**\");\n            addLine(1, \" * The meta-bean for {@code \" + data.getTypeRaw() + \"}.\");\n            addLine(1, \" * @return the meta-bean, not null\");\n            if (data.isMetaScopePrivate()) {\n                data.ensureImport(MetaBean.class);\n                addLine(1, \" */\");\n                addLine(1, \"public static MetaBean meta() {\");\n            } else if (data.isTypeGeneric()) {\n                addLine(1, \" */\");\n                addLine(1, \"@SuppressWarnings(\\\"rawtypes\\\")\");\n                addLine(1, \"public static \" + data.getTypeRaw() + \".Meta meta() {\");\n            } else {\n                addLine(1, \" */\");\n                addLine(1, \"public static \" + data.getTypeRaw() + \".Meta meta() {\");\n            }\n            addLine(2, \"return \" + data.getTypeRaw() + \".Meta.INSTANCE;\");\n            addLine(1, \"}\");\n            \n            if (data.isTypeGeneric()) {\n                generateMetaForGenericType();\n            }\n            \n            addBlankLine();\n            addLine(1, \"static {\");\n            data.ensureImport(MetaBean.class);\n            addLine(2, \"MetaBean.register(\" + data.getTypeRaw() + \".Meta.INSTANCE);\");\n            addLine(1, \"}\");\n            addBlankLine();\n        }\n    }\n\n    private void generateFieldNames(List<PropertyGen> nonDerived) {\n        if (nonDerived.isEmpty()) {\n            addLine(5, \"new String[0],\");\n        } else {\n            addLine(5, \"new String[] {\");\n            for (var i = 0; i < nonDerived.size(); i++) {\n                addLine(7, \"\\\"\" + nonDerived.get(i).getData().getFieldName() + join(i, nonDerived, \"\\\",\", \"\\\"},\"));\n            }\n        }\n    }\n\n    private void generateMetaForGenericType() {\n        // this works around an Eclipse bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=397462\n        // long name needed for uniqueness as static overriding is borked\n        addBlankLine();\n        addLine(1, \"/**\");\n        addLine(1, \" * The meta-bean for {@code \" + data.getTypeRaw() + \"}.\");\n        if (data.getTypeGenericCount() == 1) {\n            addLine(1, \" * @param <R>  the bean's generic type\");\n            addLine(1, \" * @param cls  the bean's generic type\");\n        } else if (data.getTypeGenericCount() == 2) {\n            addLine(1, \" * @param <R>  the first generic type\");\n            addLine(1, \" * @param <S>  the second generic type\");\n            addLine(1, \" * @param cls1  the first generic type\");\n            addLine(1, \" * @param cls2  the second generic type\");\n        } else if (data.getTypeGenericCount() == 3) {\n            addLine(1, \" * @param <R>  the first generic type\");\n            addLine(1, \" * @param <S>  the second generic type\");\n            addLine(1, \" * @param <T>  the second generic type\");\n            addLine(1, \" * @param cls1  the first generic type\");\n            addLine(1, \" * @param cls2  the second generic type\");\n            addLine(1, \" * @param cls3  the third generic type\");\n        }\n        addLine(1, \" * @return the meta-bean, not null\");\n        addLine(1, \" */\");\n        addLine(1, \"@SuppressWarnings(\\\"unchecked\\\")\");\n        var typeNames = new String[] {\"R\", \"S\", \"T\"};\n        if (data.getTypeGenericCount() == 1) {\n            addLine(1, \"public static <R\" + data.getTypeGenericExtends(0, typeNames) +\n                    \"> \" + data.getTypeRaw() + \".Meta<R> meta\" + data.getTypeRaw() + \"(Class<R> cls) {\");\n        } else if (data.getTypeGenericCount() == 2) {\n            addLine(1, \"public static <R\" + data.getTypeGenericExtends(0, typeNames) +\n                    \", S\" + data.getTypeGenericExtends(1, typeNames) + \"> \" + data.getTypeRaw() +\n                    \".Meta<R, S> meta\" + data.getTypeRaw() + \"(Class<R> cls1, Class<S> cls2) {\");\n        } else if (data.getTypeGenericCount() == 3) {\n            addLine(1, \"public static <R\" + data.getTypeGenericExtends(0, typeNames) +\n                    \", S\" + data.getTypeGenericExtends(1, typeNames) +\n                    \", T\" + data.getTypeGenericExtends(2, typeNames) +\n                    \"> \" + data.getTypeRaw() +\n                    \".Meta<R, S, T> meta\" + data.getTypeRaw() + \"(Class<R> cls1, Class<S> cls2, Class<T> cls3) {\");\n        }\n        addLine(2, \"return \" + data.getTypeRaw() + \".Meta.INSTANCE;\");\n        addLine(1, \"}\");\n    }\n\n    private void generateSerializationVersionId() {\n        if (data.isSerializable() && !data.isManualSerializationId()) {\n            addLine(1, \"/**\");\n            addLine(1, \" * The serialization version id.\");\n            addLine(1, \" */\");\n            addLine(1, \"private static final long serialVersionUID = 1L;\");\n            addBlankLine();\n        }\n    }\n\n    private void generatePropertyChangeSupportField() {\n        if (data.isPropertyChangeSupport()) {\n            data.ensureImport(CLASS_PROPERTY_CHANGE_SUPPORT);\n            addLine(1, \"/**\");\n            addLine(1, \" * The property change support field.\");\n            addLine(1, \" */\");\n            addLine(1, \"private final transient PropertyChangeSupport \" + config.getPrefix() + \"propertyChangeSupport = new PropertyChangeSupport(this);\");\n            addBlankLine();\n        }\n    }\n\n    private void generateHashCodeField() {\n        if (data.isCacheHashCode()) {\n            addLine(1, \"/**\");\n            addLine(1, \" * The cached hash code, using the racy single-check idiom.\");\n            addLine(1, \" */\");\n            addLine(1, \"private transient int \" + config.getPrefix() + \"cacheHashCode;\");\n            addBlankLine();\n        }\n    }\n\n    private void generateMetaBean() {\n        if (data.isMetaScopePrivate() || data.isBeanStyleMinimal()) {\n            addLine(1, \"@Override\");\n            if (data.isBeanStyleLightOrMinimal()) {\n                data.ensureImport(TypedMetaBean.class);\n                if (data.isTypeGeneric()) {\n                    addLine(1, \"@SuppressWarnings(\\\"unchecked\\\")\");\n                }\n                addLine(1, \"public TypedMetaBean<\" + data.getTypeNoExtends() + \"> metaBean() {\");\n                if (data.isTypeGeneric()) {\n                    addLine(2, \"return (TypedMetaBean<\" + data.getTypeNoExtends() + \">) META_BEAN;\");\n                } else {\n                    addLine(2, \"return META_BEAN;\");\n                }\n            } else {\n                data.ensureImport(MetaBean.class);\n                addLine(1, \"public MetaBean metaBean() {\");\n                addLine(2, \"return \" + data.getTypeRaw() + \".Meta.INSTANCE;\");\n            }\n            addLine(1, \"}\");\n            addBlankLine();\n        } else {\n            if (data.isTypeGeneric()) {\n                addLine(1, \"@SuppressWarnings(\\\"unchecked\\\")\");\n            }\n            addLine(1, \"@Override\");\n            addLine(1, \"public \" + data.getTypeRaw() +\n                    \".Meta\" + data.getTypeGenericName(true) + \" metaBean() {\");\n            addLine(2, \"return \" + data.getTypeRaw() + \".Meta.INSTANCE;\");\n            addLine(1, \"}\");\n            addBlankLine();\n        }\n    }\n\n    private void generateGettersSetters() {\n        for (var prop : properties) {\n            generateSeparator();\n            addLines(prop.generateGetter());\n            if (data.isMutable()) {\n                addLines(prop.generateSetter());\n            }\n            if (data.isBeanStyleGenerateProperties()) {\n                addLines(prop.generateProperty());\n            }\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    private void generateImmutableToBuilder() {\n        if (data.isBuilderGenerated()) {\n            if (data.isConstructable()) {\n                var nonDerived = nonDerivedProperties();\n                if (!nonDerived.isEmpty() || !data.isTypeFinal()) {\n                    addLine(1, \"/**\");\n                    addLine(1, \" * Returns a builder that allows this bean to be mutated.\");\n                    addLine(1, \" * @return the mutable builder, not null\");\n                    addLine(1, \" */\");\n                    if (!data.isRootClass()) {\n                        addLine(1, \"@Override\");\n                    }\n                    addLine(1, data.getEffectiveBuilderScope() + data.getEffectiveMinimalBeanBuilderName() + data.getTypeGenericName(true) + \" toBuilder() {\");\n                    addLine(2, \"return new \" + data.getEffectiveMinimalBeanBuilderName() + data.getTypeGenericDiamond() + \"(this);\");\n                    addLine(1, \"}\");\n                    addBlankLine();\n                }\n            } else {\n                addLine(1, \"/**\");\n                addLine(1, \" * Returns a builder that allows this bean to be mutated.\");\n                addLine(1, \" * @return the mutable builder, not null\");\n                addLine(1, \" */\");\n                if (!data.isRootClass()) {\n                    addLine(1, \"@Override\");\n                }\n                addLine(1, \"public abstract \" + data.getEffectiveMinimalBeanBuilderName() + data.getTypeGenericName(true) + \" toBuilder();\");\n                addBlankLine();\n            }\n        }\n    }\n\n    private void generateClone() {\n        if (data.isSkipCloneGeneration() ||\n                data.isManualClone() ||\n                (!data.isRootClass() && !data.isConstructable())) {\n            return;\n        }\n        addLine(1, \"@Override\");\n        if (data.isImmutable()) {\n            addLine(1, \"public \" + data.getTypeNoExtends() + \" clone() {\");\n            addLine(2, \"return this;\");\n        } else {\n            data.ensureImport(JodaBeanUtils.class);\n            addLine(1, \"public \" + data.getTypeNoExtends() + \" clone() {\");\n            addLine(2, \"return JodaBeanUtils.cloneAlways(this);\");\n        }\n        addLine(1, \"}\");\n        addBlankLine();\n    }\n\n    private void generateEquals() {\n        if (data.isManualEqualsHashCode()) {\n            return;\n        }\n        addLine(1, \"@Override\");\n        generateGenerated(1);\n        addLine(1, \"public boolean equals(Object obj) {\");\n        addLine(2, \"if (obj == this) {\");\n        addLine(3, \"return true;\");\n        addLine(2, \"}\");\n        addLine(2, \"if (obj != null && obj.getClass() == this.getClass()) {\");\n        var nonDerived = nonDerivedEqualsHashCodeProperties();\n        if (nonDerived.isEmpty()) {\n            if (data.isSubClass()) {\n                addLine(3, \"return super.equals(obj);\");\n            } else {\n                addLine(3, \"return true;\");\n            }\n        } else {\n            addLine(3, data.getTypeWildcard() + \" other = (\" + data.getTypeWildcard() + \") obj;\");\n            for (var i = 0; i < nonDerived.size(); i++) {\n                var prop = nonDerived.get(i);\n                var getter = equalsHashCodeFieldAccessor(prop);\n                data.ensureImport(JodaBeanUtils.class);\n                var equals = \"JodaBeanUtils.equal(this.\" + getter + \", other.\" + getter + \")\";\n                if (PRIMITIVE_EQUALS.contains(prop.getData().getType())) {\n                    equals = \"(this.\" + getter + \" == other.\" + getter + \")\";\n                }\n                addLine(\n                        0, (i == 0 ? \"\\t\\t\\treturn \" : \"\\t\\t\\t\\t\\t\") + equals +\n                        (data.isSubClass() || i < nonDerived.size() - 1 ? \" &&\" : \";\"));\n            }\n            if (data.isSubClass()) {\n                addLine(5, \"super.equals(obj);\");\n            }\n        }\n        addLine(2, \"}\");\n        addLine(2, \"return false;\");\n        addLine(1, \"}\");\n        addBlankLine();\n    }\n\n    private void generateHashCode() {\n        if (data.isManualEqualsHashCode()) {\n            return;\n        }\n        addLine(1, \"@Override\");\n        generateGenerated(1);\n        addLine(1, \"public int hashCode() {\");\n        if (data.isCacheHashCode()) {\n            addLine(2, \"int hash = \" + config.getPrefix() + \"cacheHashCode;\");\n            addLine(2, \"if (hash == 0) {\");\n            if (data.isSubClass()) {\n                addLine(3, \"hash = 7;\");\n            } else {\n                addLine(3, \"hash = getClass().hashCode();\");\n            }\n            generateHashCodeContent(\"\\t\\t\\t\");\n            if (data.isSubClass()) {\n                addLine(3, \"hash = hash ^ super.hashCode();\");\n            }\n            addLine(3, config.getPrefix() + \"cacheHashCode = hash;\");\n            addLine(2, \"}\");\n            addLine(2, \"return hash;\");\n        } else {\n            if (data.isSubClass()) {\n                addLine(2, \"int hash = 7;\");\n            } else {\n                addLine(2, \"int hash = getClass().hashCode();\");\n            }\n            generateHashCodeContent(\"\\t\\t\");\n            if (data.isSubClass()) {\n                addLine(2, \"return hash ^ super.hashCode();\");\n            } else {\n                addLine(2, \"return hash;\");\n            }\n        }\n        addLine(1, \"}\");\n        addBlankLine();\n    }\n\n    private void generateHashCodeContent(String indent) {\n        var nonDerived = nonDerivedEqualsHashCodeProperties();\n        for (var prop : nonDerived) {\n            var getter = equalsHashCodeFieldAccessor(prop);\n            data.ensureImport(JodaBeanUtils.class);\n            addLine(0, indent + \"hash = hash * 31 + JodaBeanUtils.hashCode(\" + getter + \");\");\n        }\n    }\n\n    private String equalsHashCodeFieldAccessor(PropertyGen prop) {\n        if (prop.getData().getEqualsHashCodeStyle().equals(\"field\")) {\n            return prop.getData().getFieldName();\n        } else {\n            return prop.getData().getGetterGen().generateGetInvoke(prop.getData());\n        }\n    }\n\n    private void generateToString() {\n        if (data.isManualToStringCode()) {\n            return;\n        }\n        var props = toStringProperties();\n        if (data.isRootClass() && data.isTypeFinal()) {\n            addLine(1, \"@Override\");\n            generateGenerated(1);\n            addLine(1, \"public String toString() {\");\n            addLine(2, \"StringBuilder buf = new StringBuilder(\" + (props.size() * 32 + 32) + \");\");\n            addLine(2, \"buf.append(\\\"\" + data.getTypeRaw() + \"{\\\");\");\n            if (!props.isEmpty()) {\n                data.ensureImport(JodaBeanUtils.class);\n                for (var i = 0; i < props.size(); i++) {\n                    var prop = props.get(i);\n                    var getter = toStringFieldAccessor(prop);\n                    addLine(2, \"buf.append(\\\"\" + prop.getData().getPropertyName() + \"\\\").append('=')\" + \n                            join(i, props,\n                                    \".append(JodaBeanUtils.toString(\" + getter + \")).append(',').append(' ');\",\n                                    \".append(JodaBeanUtils.toString(\" + getter + \"));\"));\n                }\n            }\n            addLine(2, \"buf.append('}');\");\n            addLine(2, \"return buf.toString();\");\n            addLine(1, \"}\");\n            addBlankLine();\n            return;\n        }\n        \n        addLine(1, \"@Override\");\n        generateGenerated(1);\n        addLine(1, \"public String toString() {\");\n        addLine(2, \"StringBuilder buf = new StringBuilder(\" + (props.size() * 32 + 32) + \");\");\n        addLine(2, \"buf.append(\\\"\" + data.getTypeRaw() + \"{\\\");\");\n        addLine(2, \"int len = buf.length();\");\n        addLine(2, \"toString(buf);\");\n        addLine(2, \"if (buf.length() > len) {\");\n        addLine(3, \"buf.setLength(buf.length() - 2);\");\n        addLine(2, \"}\");\n        addLine(2, \"buf.append('}');\");\n        addLine(2, \"return buf.toString();\");\n        addLine(1, \"}\");\n        addBlankLine();\n        \n        if (data.isSubClass()) {\n            addLine(1, \"@Override\");\n        }\n        generateGenerated(1);\n        addLine(1, \"protected void toString(StringBuilder buf) {\");\n        if (data.isSubClass()) {\n            addLine(2, \"super.toString(buf);\");\n        }\n        for (var prop : props) {\n            var getter = toStringFieldAccessor(prop);\n            data.ensureImport(JodaBeanUtils.class);\n            addLine(2, \"buf.append(\\\"\" + prop.getData().getPropertyName() +\n                    \"\\\").append('=').append(JodaBeanUtils.toString(\" + getter + \")).append(',').append(' ');\");\n        }\n        addLine(1, \"}\");\n        addBlankLine();\n    }\n\n    private String toStringFieldAccessor(PropertyGen prop) {\n        if (prop.getData().isDerived()) {\n            return prop.getData().getGetterGen().generateGetInvoke(prop.getData());\n        } else if (prop.getData().getToStringStyle().equals(\"field\")) {\n            return prop.getData().getFieldName();\n        } else {\n            return prop.getData().getGetterGen().generateGetInvoke(prop.getData());\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    private void generateMetaClass() {\n        if (data.isBeanStyleLightOrMinimal()) {\n            return;\n        }\n        generateSeparator();\n        addLine(1, \"/**\");\n        addLine(1, \" * The meta-bean for {@code \" + data.getTypeRaw() + \"}.\");\n        if (data.isTypeGeneric()) {\n            for (var j = 0; j < data.getTypeGenericCount(); j++) {\n                addLine(1, \" * @param \" + data.getTypeGenericName(j, true) + \"  the type\");\n            }\n        }\n        addLine(1, \" */\");\n        generateGenerated(1);\n        String superMeta;\n        if (data.isSubClass()) {\n            superMeta = data.getSuperTypeRaw() + \".Meta\" + data.getSuperTypeGeneric(true);\n        } else {\n            data.ensureImport(DirectMetaBean.class);\n            superMeta = \"DirectMetaBean\";\n        }\n        var finalType = data.isTypeFinal() ? \"final \" : \"\";\n        var implementClause = data.getBeanMetaImplements().isEmpty() ? \"\" : \" implements \" + data.getBeanMetaImplements();\n        if (data.isTypeGeneric()) {\n            addLine(1, data.getEffectiveMetaScope() + \"static \" + finalType + \n                    \"class Meta\" + data.getTypeGeneric(true) + \" extends \" + superMeta + implementClause + \" {\");\n        } else {\n            addLine(1, data.getEffectiveMetaScope() + \"static \" + finalType + \n                    \"class Meta extends \" + superMeta + implementClause + \" {\");\n        }\n        addLine(2, \"/**\");\n        addLine(2, \" * The singleton instance of the meta-bean.\");\n        addLine(2, \" */\");\n        if (data.isTypeGeneric()) {\n            addLine(2, \"@SuppressWarnings(\\\"rawtypes\\\")\");\n        }\n        addLine(2, \"static final Meta INSTANCE = new Meta();\");\n        addBlankLine();\n        generateMetaPropertyConstants();\n        generateMetaPropertyMapSetup();\n        addLine(2, \"/**\");\n        addLine(2, \" * Restricted constructor.\");\n        addLine(2, \" */\");\n        addLine(2, data.getNestedClassConstructorScope() + \" Meta() {\");\n        addLine(2, \"}\");\n        addBlankLine();\n        generateMetaPropertyGet();\n        generateMetaBuilder();\n        generateMetaBeanType();\n        generateMetaPropertyMap();\n        generateIndentedSeparator();\n        generateMetaPropertyMethods();\n        generateIndentedSeparator();\n        generateMetaGetPropertyValue();\n        generateMetaSetPropertyValue();\n        generateMetaValidate();\n        addLine(1, \"}\");\n        addBlankLine();\n    }\n\n    private void generateMetaPropertyConstants() {\n        for (var prop : properties) {\n            addLines(prop.generateMetaPropertyConstant());\n        }\n    }\n\n    private void generateMetaPropertyMapSetup() {\n        data.ensureImport(MetaProperty.class);\n        data.ensureImport(DirectMetaPropertyMap.class);\n        addLine(2, \"/**\");\n        addLine(2, \" * The meta-properties.\");\n        addLine(2, \" */\");\n        addLine(2, \"private final Map<String, MetaProperty<?>> \" + config.getPrefix() + \"metaPropertyMap$ = new DirectMetaPropertyMap(\");\n        if (data.isSubClass()) {\n            addLine(4, \"this, (DirectMetaPropertyMap) super.metaPropertyMap()\" + (properties.isEmpty() ? \");\" : \",\"));\n        } else {\n            addLine(4, \"this, null\" + (properties.isEmpty() ? \");\" : \",\"));\n        }\n        for (var i = 0; i < properties.size(); i++) {\n            addLine(4, \"\\\"\" + properties.get(i).getData().getPropertyName() + \"\\\"\" + joinComma(i, properties, \");\"));\n        }\n        addBlankLine();\n    }\n\n    private void generateMetaBuilder() {\n        if (!data.isConstructable()) {\n            addLine(2, \"@Override\");\n            addLine(2, \"public boolean isBuildable() {\");\n            addLine(3, \"return false;\");\n            addLine(2, \"}\");\n            addBlankLine();\n        }\n        addLine(2, \"@Override\");\n        if (data.isImmutable() && !data.isEffectiveBuilderScopeVisible()) {\n            data.ensureImport(BeanBuilder.class);\n            addLine(2, \"public BeanBuilder<? extends \" + data.getTypeNoExtends() + \"> builder() {\");\n            if (data.isConstructable()) {\n                addLine(3, \"return new \" + data.getEffectiveBeanBuilderName() + data.getTypeGenericDiamond() + \"();\");\n            } else {\n                addLine(3, \"throw new UnsupportedOperationException(\\\"\" + data.getTypeRaw() + \" is an abstract class\\\");\");\n            }\n        } else if (data.isImmutable() || (data.isMutable() && data.isBuilderScopeVisible())) {\n            addLine(2, \"public \" + data.getEffectiveBeanBuilderName() + data.getTypeGenericName(true) + \" builder() {\");\n            if (data.isConstructable()) {\n                addLine(3, \"return new \" + data.getEffectiveBeanBuilderName() + data.getTypeGenericDiamond() + \"();\");\n            } else {\n                addLine(3, \"throw new UnsupportedOperationException(\\\"\" + data.getTypeRaw() + \" is an abstract class\\\");\");\n            }\n        } else {\n            data.ensureImport(BeanBuilder.class);\n            addLine(2, \"public BeanBuilder<? extends \" + data.getTypeNoExtends() + \"> builder() {\");\n            if (data.isConstructable()) {\n                data.ensureImport(DirectBeanBuilder.class);\n                addLine(3, \"return new DirectBeanBuilder<>(new \" + data.getTypeNoExtends() + \"());\");\n            } else {\n                addLine(3, \"throw new UnsupportedOperationException(\\\"\" + data.getTypeRaw() + \" is an abstract class\\\");\");\n            }\n        }\n        addLine(2, \"}\");\n        addBlankLine();\n    }\n\n    private void generateMetaBeanType() {\n        if (data.isTypeGeneric()) {\n            addLine(2, \"@SuppressWarnings({\\\"unchecked\\\", \\\"rawtypes\\\" })\");\n        }\n        addLine(2, \"@Override\");\n        addLine(2, \"public Class<? extends \" + data.getTypeNoExtends() + \"> beanType() {\");\n        if (data.isTypeGeneric()) {\n            addLine(3, \"return (Class) \" + data.getTypeRaw() + \".class;\");\n        } else {\n            addLine(3, \"return \" + data.getTypeNoExtends() + \".class;\");\n        }\n        addLine(2, \"}\");\n        addBlankLine();\n    }\n\n    private void generateMetaPropertyGet() {\n        if (!properties.isEmpty()) {\n            data.ensureImport(MetaProperty.class);\n            addLine(2, \"@Override\");\n            addLine(2, \"protected MetaProperty<?> metaPropertyGet(String propertyName) {\");\n            addLine(3, \"switch (propertyName.hashCode()) {\");\n            for (var prop : properties) {\n                addLines(prop.generateMetaPropertyGetCase());\n            }\n            addLine(3, \"}\");\n            addLine(3, \"return super.metaPropertyGet(propertyName);\");\n            addLine(2, \"}\");\n            addBlankLine();\n        }\n    }\n\n    private void generateMetaPropertyMap() {\n        data.ensureImport(Map.class);\n        addLine(2, \"@Override\");\n        addLine(2, \"public Map<String, MetaProperty<?>> metaPropertyMap() {\");\n        addLine(3, \"return \" + config.getPrefix() + \"metaPropertyMap$;\");\n        addLine(2, \"}\");\n        addBlankLine();\n    }\n\n    private void generateMetaPropertyMethods() {\n        if (data.isBeanStyleGenerateMetaProperties()) {\n            for (var prop : properties) {\n                addLines(prop.generateMetaProperty());\n            }\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    private void generateMetaGetPropertyValue() {\n        if (properties.isEmpty()) {\n            return;\n        }\n        data.ensureImport(Bean.class);\n        addLine(2, \"@Override\");\n        addLine(2, \"protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\");\n        addLine(3, \"switch (propertyName.hashCode()) {\");\n        for (var prop : properties) {\n            addLines(prop.generatePropertyGetCase());\n        }\n        addLine(3, \"}\");\n        addLine(3, \"return super.propertyGet(bean, propertyName, quiet);\");\n        addLine(2, \"}\");\n        addBlankLine();\n    }\n\n    private void generateMetaSetPropertyValue() {\n        if (properties.isEmpty()) {\n            return;\n        }\n        data.ensureImport(Bean.class);\n        if (data.isImmutable()) {\n            addLine(2, \"@Override\");\n            addLine(2, \"protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\");\n            addLine(3, \"metaProperty(propertyName);\");\n            addLine(3, \"if (quiet) {\");\n            addLine(4, \"return;\");\n            addLine(3, \"}\");\n            addLine(3, \"throw new UnsupportedOperationException(\\\"Property cannot be written: \\\" + propertyName);\");\n            addLine(2, \"}\");\n            addBlankLine();\n            return;\n        }\n        \n        var generics = false;\n        for (var prop : data.getProperties()) {\n            generics |= (prop.getStyle().isWritable() &&\n                    ((prop.isGeneric() && !prop.isGenericWildcardParamType()) || data.isTypeGeneric()));\n        }\n        if (generics) {\n            addLine(2, \"@SuppressWarnings(\\\"unchecked\\\")\");\n        }\n        addLine(2, \"@Override\");\n        addLine(2, \"protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\");\n        addLine(3, \"switch (propertyName.hashCode()) {\");\n        for (var prop : properties) {\n            addLines(prop.generatePropertySetCase());\n        }\n        addLine(3, \"}\");\n        addLine(3, \"super.propertySet(bean, propertyName, newValue, quiet);\");\n        addLine(2, \"}\");\n        addBlankLine();\n    }\n\n    private void generateMetaValidate() {\n        if (!data.isValidated() || data.isImmutable()) {\n            return;\n        }\n        data.ensureImport(Bean.class);\n        addLine(2, \"@Override\");\n        addLine(2, \"protected void validate(Bean bean) {\");\n        if (data.isValidated()) {\n            for (var prop : properties) {\n                if (prop.getData().isValidated()) {\n                    addLine(3, prop.getData().getValidationMethodName() +\n                            \"(((\" + data.getTypeWildcard() + \") bean).\" + prop.getData().getFieldName() +\n                            \", \\\"\" + prop.getData().getPropertyName() + \"\\\");\");\n                }\n            }\n        }\n        if (data.isSubClass()) {\n            addLine(3, \"super.validate(bean);\");\n        }\n        addLine(2, \"}\");\n        addBlankLine();\n    }\n\n    //-----------------------------------------------------------------------\n    private void generateBuilderClass() {\n        if (data.isSkipBuilderGeneration()) {\n            return;\n        }\n        var nonDerived = nonDerivedProperties();\n        generateSeparator();\n        var finalType = data.isTypeFinal() ? \"final \" : \"\";\n        addLine(1, \"/**\");\n        addLine(1, \" * The bean-builder for {@code \" + data.getTypeRaw() + \"}.\");\n        if (data.isTypeGeneric()) {\n            for (var j = 0; j < data.getTypeGenericCount(); j++) {\n                addLine(1, \" * @param \" + data.getTypeGenericName(j, true) + \"  the type\");\n            }\n        }\n        addLine(1, \" */\");\n        generateGenerated(1);\n        String superBuilder;\n        if (data.isSubClass()) {\n            superBuilder = data.getSuperTypeRaw() + \".Builder\" + data.getSuperTypeGeneric(true);\n        } else if (data.isEffectiveBuilderScopeVisible()) {\n            data.ensureImport(DirectFieldsBeanBuilder.class);\n            superBuilder = \"DirectFieldsBeanBuilder<\" + data.getTypeNoExtends() + \">\";\n        } else {\n            data.ensureImport(DirectPrivateBeanBuilder.class);\n            superBuilder = \"DirectPrivateBeanBuilder<\" + data.getTypeNoExtends() + \">\";\n        }\n        if (data.isConstructable()) {\n            addLine(1, data.getEffectiveBuilderScope() + \"static \" + finalType +\n                    \"class Builder\" + data.getTypeGeneric(true) + \" extends \" + superBuilder + \" {\");\n        } else {\n            addLine(1, data.getEffectiveBuilderScope() + \"abstract static \" + finalType +\n                    \"class Builder\" + data.getTypeGeneric(true) + \" extends \" + superBuilder + \" {\");\n        }\n        if (!nonDerived.isEmpty()) {\n            addBlankLine();\n            generateBuilderProperties();\n        }\n        addBlankLine();\n        generateBuilderConstructorNoArgs();\n        generateBuilderConstructorCopy();\n        generateIndentedSeparator();\n        generateBuilderGet();\n        generateBuilderSet();\n        generateBuilderOtherSets();\n        if (data.isConstructable()) {\n            generateBuilderBuild();\n        }\n        generateIndentedSeparator();\n        generateBuilderPropertySetMethods();\n        generateIndentedSeparator();\n        generateBuilderToString();\n        addLine(1, \"}\");\n        addBlankLine();\n    }\n\n    private void generateBuilderConstructorNoArgs() {\n        addLine(2, \"/**\");\n        addLine(2, \" * Restricted constructor.\");\n        addLine(2, \" */\");\n        addLine(2, data.getNestedClassConstructorScope() + \" Builder() {\");\n        if (data.getImmutableDefaults() != null) {\n            addLine(3, data.getImmutableDefaults() + \"(this);\");\n        }\n        addLine(2, \"}\");\n        addBlankLine();\n    }\n\n    private void generateBuilderConstructorCopy() {\n        if (data.isBuilderGenerated()) {\n            var nonDerived = nonDerivedProperties();\n            if (!nonDerived.isEmpty() || !data.isTypeFinal()) {\n                addLine(2, \"/**\");\n                addLine(2, \" * Restricted copy constructor.\");\n                addLine(2, \" * @param beanToCopy  the bean to copy from, not null\");\n                addLine(2, \" */\");\n                addLine(2, data.getNestedClassConstructorScope() + \" Builder(\" + data.getTypeNoExtends() + \" beanToCopy) {\");\n                if (data.isSubClass()) {\n                    addLine(3, \"super(beanToCopy);\");\n                }\n                for (var propertyGen : nonDerived) {\n                    addLines(propertyGen.generateBuilderConstructorAssign(\"beanToCopy\"));\n                }\n                addLine(2, \"}\");\n                addBlankLine();\n            }\n        }\n    }\n\n    private void generateBuilderProperties() {\n        for (var prop : nonDerivedProperties()) {\n            addLines(prop.generateBuilderField());\n        }\n    }\n\n    private void generateBuilderGet() {\n        var nonDerived = nonDerivedProperties();\n        addLine(2, \"@Override\");\n        addLine(2, \"public Object get(String propertyName) {\");\n        if (!nonDerived.isEmpty()) {\n            addLine(3, \"switch (propertyName.hashCode()) {\");\n            for (var prop : nonDerived) {\n                addLines(prop.generateBuilderFieldGet());\n            }\n            addLine(4, \"default:\");\n            if (data.isRootClass()) {\n                data.ensureImport(NoSuchElementException.class);\n                addLine(5, \"throw new NoSuchElementException(\\\"Unknown property: \\\" + propertyName);\");\n            } else {\n                addLine(5, \"return super.get(propertyName);\");\n            }\n            addLine(3, \"}\");\n        } else {\n            if (!data.isRootClass()) {\n                addLine(3, \"return super.get(propertyName);\");\n            } else {\n                data.ensureImport(NoSuchElementException.class);\n                addLine(3, \"throw new NoSuchElementException(\\\"Unknown property: \\\" + propertyName);\");\n            }\n        }\n        addLine(2, \"}\");\n        addBlankLine();\n    }\n\n    private void generateBuilderSet() {\n        var nonDerived = nonDerivedProperties();\n        var generics = data.getProperties().stream()\n                .anyMatch(p -> p.isGeneric() && !p.isGenericWildcardParamType());\n        if (generics) {\n            addLine(2, \"@SuppressWarnings(\\\"unchecked\\\")\");\n        }\n        addLine(2, \"@Override\");\n        addLine(2, \"public Builder\" + data.getTypeGenericName(true) + \" set(String propertyName, Object newValue) {\");\n        if (!nonDerived.isEmpty()) {\n            addLine(3, \"switch (propertyName.hashCode()) {\");\n            for (var prop : nonDerived) {\n                addLines(prop.generateBuilderFieldSet());\n            }\n            addLine(4, \"default:\");\n            if (data.isRootClass()) {\n                data.ensureImport(NoSuchElementException.class);\n                addLine(5, \"throw new NoSuchElementException(\\\"Unknown property: \\\" + propertyName);\");\n            } else {\n                addLine(5, \"super.set(propertyName, newValue);\");\n                addLine(5, \"break;\");\n            }\n            addLine(3, \"}\");\n            addLine(3, \"return this;\");\n        } else {\n            if (!data.isRootClass()) {\n                addLine(3, \"super.set(propertyName, newValue);\");\n                addLine(3, \"return this;\");\n            } else {\n                data.ensureImport(NoSuchElementException.class);\n                addLine(3, \"throw new NoSuchElementException(\\\"Unknown property: \\\" + propertyName);\");\n            }\n        }\n        addLine(2, \"}\");\n        addBlankLine();\n    }\n\n    private void generateBuilderOtherSets() {\n        if (data.isEffectiveBuilderScopeVisible()) {\n            addLine(2, \"@Override\");\n            addLine(2, \"public Builder\" + data.getTypeGenericName(true) + \" set(MetaProperty<?> property, Object value) {\");\n            addLine(3, \"super.set(property, value);\");\n            addLine(3, \"return this;\");\n            addLine(2, \"}\");\n            addBlankLine();\n        }\n    }\n\n    private void generateBuilderBuild() {\n        var nonDerived = nonDerivedProperties();\n        addLine(2, \"@Override\");\n        addLine(2, \"public \" + data.getTypeRaw() + data.getTypeGenericName(true) + \" build() {\");\n        if (data.getImmutablePreBuild() != null) {\n            addLine(3, data.getImmutablePreBuild() + \"(this);\");\n        }\n        if (data.getConstructorStyle() == CONSTRUCTOR_BY_ARGS) {\n            if (nonDerived.isEmpty()) {\n                addLine(3, \"return new \" + data.getTypeWithDiamond() + \"();\");\n            } else {\n                addLine(3, \"return new \" + data.getTypeWithDiamond() + \"(\");\n                for (var i = 0; i < nonDerived.size(); i++) {\n                    addLine(5, nonDerived.get(i).generateBuilderFieldName() + joinComma(i, nonDerived, \");\"));\n                }\n            }\n        } else if (data.getConstructorStyle() == CONSTRUCTOR_BY_BUILDER) {\n            addLine(3, \"return new \" + data.getTypeWithDiamond() + \"(this);\");\n        }\n        addLine(2, \"}\");\n        addBlankLine();\n    }\n\n    private void generateBuilderPropertySetMethods() {\n        if (data.isEffectiveBuilderScopeVisible()) {\n            for (var prop : nonDerivedProperties()) {\n                addLines(prop.generateBuilderSetMethod());\n            }\n        }\n    }\n\n    private void generateBuilderToString() {\n        var nonDerived = toStringProperties();\n        if (data.isImmutable() && data.isTypeFinal()) {\n            addLine(2, \"@Override\");\n            addLine(2, \"public String toString() {\");\n            if (nonDerived.isEmpty()) {\n                addLine(3, \"return \\\"\" + data.getEffectiveBeanBuilderName() + \"{}\\\";\");\n            } else {\n                addLine(3, \"StringBuilder buf = new StringBuilder(\" + (nonDerived.size() * 32 + 32) + \");\");\n                addLine(3, \"buf.append(\\\"\" + data.getEffectiveBeanBuilderName() + \"{\\\");\");\n                for (var i = 0; i < nonDerived.size(); i++) {\n                    var prop = nonDerived.get(i);\n                    var getter = nonDerived.get(i).generateBuilderFieldName();\n                    data.ensureImport(JodaBeanUtils.class);\n                    var base = \"\\t\\t\\tbuf.append(\\\"\" + prop.getData().getPropertyName() +\n                            \"\\\").append('=').append(JodaBeanUtils.toString(\" + getter + \"))\";\n                    addLine(0, base + join(i, nonDerived, \".append(',').append(' ');\", \";\"));\n                }\n                addLine(3, \"buf.append('}');\");\n                addLine(3, \"return buf.toString();\");\n            }\n            addLine(2, \"}\");\n            addBlankLine();\n            return;\n        }\n        \n        addLine(2, \"@Override\");\n        addLine(2, \"public String toString() {\");\n        addLine(3, \"StringBuilder buf = new StringBuilder(\" + (nonDerived.size() * 32 + 32) + \");\");\n        addLine(3, \"buf.append(\\\"\" + data.getEffectiveBeanBuilderName() + \"{\\\");\");\n        addLine(3, \"int len = buf.length();\");\n        addLine(3, \"toString(buf);\");\n        addLine(3, \"if (buf.length() > len) {\");\n        addLine(4, \"buf.setLength(buf.length() - 2);\");\n        addLine(3, \"}\");\n        addLine(3, \"buf.append('}');\");\n        addLine(3, \"return buf.toString();\");\n        addLine(2, \"}\");\n        addBlankLine();\n        \n        if (data.isSubClass()) {\n            addLine(2, \"@Override\");\n        }\n        addLine(2, \"protected void toString(StringBuilder buf) {\");\n        if (data.isSubClass()) {\n            addLine(3, \"super.toString(buf);\");\n        }\n        for (var prop : nonDerived) {\n            var getter = prop.generateBuilderFieldName();\n            data.ensureImport(JodaBeanUtils.class);\n            addLine(3, \"buf.append(\\\"\" + prop.getData().getPropertyName() +\n                    \"\\\").append('=').append(JodaBeanUtils.toString(\" + getter + \")).append(',').append(' ');\");\n        }\n        addLine(2, \"}\");\n        addBlankLine();\n    }\n\n    //-----------------------------------------------------------------------\n    private void addLines(List<String> lines) {\n        insertRegion.addAll(lines);\n    }\n\n    private void addLine(int tabCount, String line) {\n        insertRegion.add(\"\\t\".repeat(tabCount) + line);\n    }\n\n    private void addBlankLine() {\n        insertRegion.add(\"\");\n    }\n\n    private static String join(int i, List<?> list, String join, String end) {\n        return (i < list.size() - 1 ? join : end);\n    }\n\n    private static String joinComma(int i, List<?> list, String end) {\n        return join(i, list, \",\", end);\n    }\n\n    boolean isBean() {\n        return properties != null;\n    }\n\n    BeanData getData() {\n        return data;\n    }\n\n    BeanGenConfig getConfig() {\n        return config;\n    }\n\n    File getFile() {\n        return file;\n    }\n\n    String getFieldPrefix() {\n        return config.getPrefix();\n    }\n\n    private List<PropertyGen> nonDerivedProperties() {\n        List<PropertyGen> nonDerived = new ArrayList<>();\n        for (var prop : properties) {\n            if (!prop.getData().isDerived()) {\n                nonDerived.add(prop);\n            }\n        }\n        return nonDerived;\n    }\n\n    private List<PropertyGen> nonDerivedEqualsHashCodeProperties() {\n        List<PropertyGen> nonDerived = new ArrayList<>();\n        for (var prop : properties) {\n            if (!prop.getData().isDerived() && !prop.getData().getEqualsHashCodeStyle().equals(\"omit\")) {\n                nonDerived.add(prop);\n            }\n        }\n        return nonDerived;\n    }\n\n    private List<PropertyGen> toStringProperties() {\n        List<PropertyGen> props = new ArrayList<>();\n        for (var prop : properties) {\n            if (!\"omit\".equals(prop.getData().getToStringStyle())) {\n                props.add(prop);\n            }\n        }\n        return props;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/BeanGenConfig.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.gen;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.nio.charset.StandardCharsets;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.ListIterator;\nimport java.util.Map;\nimport java.util.Set;\n\n/**\n * Configuration for the code generator.\n */\npublic final class BeanGenConfig {\n\n    /**\n     * The copy generators.\n     */\n    private final Map<String, CopyGen> copyGenerators;\n    /**\n     * The builder types.\n     */\n    private final Map<String, String> builderTypes;\n    /**\n     * The builder generators.\n     */\n    private final Map<String, BuilderGen> builderGenerators;\n    /**\n     * The invalid immutable types.\n     */\n    private final Set<String> invalidImmutableTypes;\n    /**\n     * The immutable varargs code.\n     */\n    private final Map<String, String> immutableVarArgs;\n    /**\n     * The immutable get clones.\n     */\n    private final Map<String, String> immutableGetClones;\n    /**\n     * The indent to use.\n     */\n    private String indent = \"    \";\n    /**\n     * The field prefix to use.\n     */\n    private String prefix = \"\";\n    /**\n     * The end of line separator\n     */\n    private String eol = System.lineSeparator();\n    /**\n     * The default style to use.\n     */\n    private String defaultStyle = \"smart\";\n    /**\n     * Whether to add the generated annotation.\n     */\n    private boolean generatedAnno;\n\n    /**\n     * Parses the configuration file.\n     * <p>\n     * This loads the file as an ini file in this package.\n     * \n     * @param resourceLocator  the configuration resource locator, not null\n     * @return the configuration\n     */\n    public static BeanGenConfig parse(String resourceLocator) {\n        var fileName = createConfigFileName(resourceLocator);\n        try (var in = BeanGenConfig.class.getResourceAsStream(fileName)) {\n            if (in == null) {\n                throw new IllegalArgumentException(\"Configuration file not found in classpath: \" + fileName);\n            }\n            try (var reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8))) {\n                var lines = reader.lines()\n                        .filter(line -> !line.trim().startsWith(\"#\") && !line.trim().isEmpty())\n                        .toList();\n                return parse(lines);\n            }\n        } catch (IOException ex) {\n            throw new RuntimeException(ex.getMessage(), ex);\n        }\n    }\n\n    private static String createConfigFileName(String resourceLocator) {\n        if (resourceLocator.contains(\"/\") || resourceLocator.endsWith(\".ini\")) {\n            return resourceLocator.startsWith(\"/\") ? resourceLocator : \"/\" + resourceLocator;\n        } else if (resourceLocator.equals(\"jdk6\")) {  // compatibility\n            return \"/org/joda/beans/gen/jdk.ini\";\n        } else {\n            return \"/org/joda/beans/gen/\" + resourceLocator + \".ini\";\n        }\n    }\n\n    private static BeanGenConfig parse(List<String> lines) {\n        var immutableCopiers = new HashMap<String, String>();\n        var mutableCopiers = new HashMap<String, String>();\n        var immutableGetClones = new HashMap<String, String>();\n        var immutableVarArgs = new HashMap<String, String>();\n        var builderInits = new HashMap<String, String>();\n        var builderTypes = new HashMap<String, String>();\n        var invalidImmutableTypes = new HashSet<String>();\n        for (var iterator = lines.listIterator(); iterator.hasNext();) {  // CSIGNORE\n            var line = iterator.next().trim();\n            switch (line) {\n                case \"[immutable.builder.to.immutable]\" -> {\n                    parseConfig(iterator, immutableCopiers);\n                }\n                case \"[immutable.builder.to.mutable]\" -> {\n                    parseConfig(iterator, mutableCopiers);\n                }\n                case \"[immutable.invalid.type]\" -> {\n                    while (iterator.hasNext()) {\n                        line = iterator.next().trim();\n                        var pos = line.indexOf('=');\n                        if (pos <= 0) {\n                            throw new IllegalArgumentException(\"Invalid ini file line: \" + line);\n                        }\n                        var key = line.substring(0, pos).trim();\n                        invalidImmutableTypes.add(key);\n                    }\n                }\n                case \"[immutable.get.clone]\" -> {\n                    while (iterator.hasNext()) {\n                        line = iterator.next().trim();\n                        if (line.startsWith(\"[\")) {\n                            iterator.previous();\n                            break;\n                        }\n                        var pos = line.indexOf('=');\n                        if (pos <= 0) {\n                            throw new IllegalArgumentException(\"Invalid ini file line: \" + line);\n                        }\n                        var key = line.substring(0, pos).trim();\n                        var value = line.substring(pos + 1).trim();\n                        if (!value.equals(\"clone\") && !value.equals(\"cloneCast\") && !value.equals(\"cloneArray\")) {\n                            throw new IllegalArgumentException(\"Value for [immutable.get.clone] must be 'clone', 'cloneCast' or 'cloneArray'\");\n                        }\n                        immutableGetClones.put(key, value);\n                    }\n                }\n                case \"[immutable.builder.varargs]\" -> {\n                    parseConfig(iterator, immutableVarArgs);\n                }\n                case \"[immutable.builder.type]\" -> {\n                    parseConfig(iterator, builderTypes);\n                }\n                case \"[immutable.builder.init]\" -> {\n                    parseConfig(iterator, builderInits);\n                }\n                default -> throw new IllegalArgumentException(\"Invalid ini file section: \" + line);\n            }\n        }\n        // adjust to results\n        var builderGenerators = new HashMap<String, BuilderGen>();\n        for (var entry : builderInits.entrySet()) {\n            var type = builderTypes.get(entry.getKey());\n            if (type == null) {\n                type = entry.getKey() + \"<>\";\n            }\n            builderGenerators.put(entry.getKey(), new BuilderGen.PatternBuilderGen(type, entry.getValue()));\n        }\n        var copyGenerators = new HashMap<String, CopyGen>();\n        for (var entry : immutableCopiers.entrySet()) {\n            var fieldType = entry.getKey();\n            var immutableCopier = entry.getValue();\n            var mutableCopier = mutableCopiers.get(fieldType);\n            if (mutableCopier == null) {\n                throw new IllegalArgumentException(\"[immutable.builder.to.immutable] and [immutable.builder.to.mutable] entries must match: \" + fieldType);\n            }\n            copyGenerators.put(fieldType, new CopyGen.PatternCopyGen(immutableCopier, mutableCopier, false));\n        }\n        return new BeanGenConfig(copyGenerators, builderGenerators, builderTypes, invalidImmutableTypes, immutableVarArgs, immutableGetClones);\n    }\n\n    private static void parseConfig(ListIterator<String> iterator, HashMap<String, String> mutableMap) {\n        while (iterator.hasNext()) {\n            var line = iterator.next().trim();\n            if (line.startsWith(\"[\")) {\n                iterator.previous();\n                break;\n            }\n            var pos = line.indexOf('=');\n            if (pos <= 0) {\n                throw new IllegalArgumentException(\"Invalid ini file line: \" + line);\n            }\n            var key = line.substring(0, pos).trim();\n            var value = line.substring(pos + 1).trim();\n            mutableMap.put(key, value);\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates an instance.\n     * \n     * @param copyGenerators  the copy generators, not null\n     * @param builderGenerators  the builder generators, not null\n     * @param builderTypes  the builder types, not null\n     * @param invalidImmutableTypes  the invalid immutable types, not null\n     * @param immutableVarArgs  the varargs code\n     * @param immutableGetClones  the get clone code\n     */\n    private BeanGenConfig(\n            Map<String, CopyGen> copyGenerators,\n            Map<String, BuilderGen> builderGenerators,\n            Map<String, String> builderTypes,\n            Set<String> invalidImmutableTypes,\n            Map<String, String> immutableVarArgs,\n            Map<String, String> immutableGetClones) {\n        this.copyGenerators = copyGenerators;\n        this.builderGenerators = builderGenerators;\n        this.builderTypes = builderTypes;\n        this.invalidImmutableTypes = invalidImmutableTypes;\n        this.immutableVarArgs = immutableVarArgs;\n        this.immutableGetClones = immutableGetClones;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The copy generators.\n     * \n     * @return the generators, not null\n     */\n    Map<String, CopyGen> getCopyGenerators() {\n        return copyGenerators;\n    }\n\n    /**\n     * The builder generators.\n     * \n     * @return the generators, not null\n     */\n    Map<String, BuilderGen> getBuilderGenerators() {\n        return builderGenerators;\n    }\n\n    /**\n     * The builder types.\n     * \n     * @return the types, not null\n     */\n    public Map<String, String> getBuilderTypes() {\n        return builderTypes;\n    }\n\n    /**\n     * The invalid immutable types.\n     * \n     * @return the invalid immutable types, not null\n     */\n    public Set<String> getInvalidImmutableTypes() {\n        return invalidImmutableTypes;\n    }\n\n    /**\n     * The builder varargs code.\n     * \n     * @return the varargs, not null\n     */\n    public Map<String, String> getImmutableVarArgs() {\n        return immutableVarArgs;\n    }\n\n    /**\n     * The builder types.\n     * \n     * @return the types, not null\n     */\n    public Map<String, String> getImmutableGetClones() {\n        return immutableGetClones;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the indent to use.\n     * \n     * @return the indent, not null\n     */\n    public String getIndent() {\n        return indent;\n    }\n\n    /**\n     * Sets the indent to use.\n     * \n     * @param indent  the indent to use, not null\n     */\n    public void setIndent(String indent) {\n        this.indent = indent;\n    }\n\n    /**\n     * Gets the prefix to use.\n     * \n     * @return the prefix, not null\n     */\n    public String getPrefix() {\n        return prefix;\n    }\n\n    /**\n     * Sets the prefix to use.\n     * \n     * @param prefix  the prefix to use, not null\n     */\n    public void setPrefix(String prefix) {\n        this.prefix = prefix;\n    }\n\n    /**\n     * Gets the end of line separator to use.\n     * \n     * @return the end of line, not null\n     */\n    public String getEol() {\n        return eol;\n    }\n\n    /**\n     * Sets the end of line separator to use.\n     * \n     * @param eol  the end of line separator to use, not null\n     */\n    public void setEol(String eol) {\n        this.eol = eol;\n    }\n\n    /**\n     * Gets the default style to use.\n     * \n     * @return the default style, not null\n     */\n    public String getDefaultStyle() {\n        return defaultStyle;\n    }\n\n    /**\n     * Sets the default style to use.\n     * \n     * @param defaultStyle  the default style to use, not null\n     */\n    public void setDefaultStyle(String defaultStyle) {\n        this.defaultStyle = defaultStyle;\n    }\n\n    /**\n     * Gets whether to add the generated annotation.\n     * \n     * @return whether to add the generated annotation, not null\n     */\n    public boolean isGeneratedAnno() {\n        return generatedAnno;\n    }\n\n    /**\n     * Sets whether to add the generated annotation.\n     * \n     * @param generatedAnno  whether to add the generated annotation\n     */\n    public void setGeneratedAnno(boolean generatedAnno) {\n        this.generatedAnno = generatedAnno;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/BeanParser.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.gen;\n\nimport static org.joda.beans.gen.BeanGen.CONSTRUCTOR_BY_ARGS;\nimport static org.joda.beans.gen.BeanGen.CONSTRUCTOR_BY_BUILDER;\nimport static org.joda.beans.gen.BeanGen.CONSTRUCTOR_NONE;\n\nimport java.io.File;\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.regex.Pattern;\n\n/**\n * Parse bean information from source file.\n */\nclass BeanParser {\n\n    /** Start marker. */\n    private static final String AUTOGENERATED_START_TEXT = \"AUTOGENERATED START\";\n    /** Start marker. */\n    private static final String AUTOGENERATED_START = \"\\t//------------------------- AUTOGENERATED START -------------------------\";\n    /** End marker. */\n    private static final String AUTOGENERATED_END = \"\\t//-------------------------- AUTOGENERATED END --------------------------\";\n    /** Pattern to find bean type. */\n    // handle three comma separated generic parameters\n    // handle generic parameter extends clause\n    // handle extends clause with further level of generic parameters\n    // handle extends clause union types without generic parameters\n    private static final Pattern BEAN_TYPE = Pattern.compile(\".*class +(\" +\n            \"([A-Z][A-Za-z0-9_]+)\" +\n                \"(?:<\" +\n                    \"([A-Z])( +extends +[A-Za-z0-9_]+(?:[<][A-Za-z0-9_, ?]+[>])?(?:[ ]+[&][ ]+[A-Za-z0-9]+)*)?\" +\n                    \"(?:[,] +\" +\n                        \"([A-Z])( +extends +[A-Za-z0-9_]+(?:[<][A-Za-z0-9_, ?]+[>])?(?:[ ]+[&][ ]+[A-Za-z0-9]+)*)?\" +\n                        \"(?:[,] +\" +\n                            \"([A-Z])( +extends +[A-Za-z0-9_]+(?:[<][A-Za-z0-9_, ?]+[>])?(?:[ ]+[&][ ]+[A-Za-z0-9]+)*)?\" +\n                        \")?\" +\n                    \")?\" +\n                \">)?\" +\n            \").*\");\n    /** Pattern to find super type. */\n    private static final Pattern SUPER_TYPE = Pattern.compile(\".*extends +(\" +\n            \"([A-Z][A-Za-z0-9_]+)\" +\n                \"(?:<\" +\n                    \"([A-Z][A-Za-z0-9_<> ]*)\" +\n                    \"(?:[,] +\" +\n                        \"([A-Z][A-Za-z0-9_<> ]*)?\" +\n                        \"(?:[,] +\" +\n                            \"([A-Z][A-Za-z0-9_<> ]*)?\" +\n                        \")?\" +\n                    \")?\" +\n                \">)?\" +\n            \").*\");\n    /** Pattern to find root type. */\n    private static final Pattern SUPER_IMPL_TYPE = Pattern.compile(\".*implements.*[ ,]((Immutable)?Bean)([ ,{]|$).*\");\n    /** Pattern to find serializable interface. */\n    private static final Pattern SERIALIZABLE_TYPE = Pattern.compile(\".*implements.*[ ,]Serializable([ ,{]|$).*\");\n    /** The style pattern. */\n    private static final Pattern STYLE_PATTERN = Pattern.compile(\".*[ ,(]style[ ]*[=][ ]*[\\\"]([a-zA-Z]*)[\\\"].*\");\n    /** The metaScope pattern. */\n    private static final Pattern META_SCOPE_PATTERN = Pattern.compile(\".*[ ,(]metaScope[ ]*[=][ ]*[\\\"]([a-zA-Z]*)[\\\"].*\");\n    /** The metaImplements pattern. */\n    private static final Pattern META_IMPLEMENTS_PATTERN = Pattern.compile(\".*[ ,(]metaImplements[ ]*[=][ ]*[\\\"]([a-zA-Z0-9_.<>]*)[\\\"].*\");\n    /** The builderScope pattern. */\n    private static final Pattern BUILDER_SCOPE_PATTERN = Pattern.compile(\".*[ ,(]builderScope[ ]*[=][ ]*[\\\"]([a-zA-Z]*)[\\\"].*\");\n    /** The builderStyle pattern. */\n    private static final Pattern BUILDER_NAME_PATTERN = Pattern.compile(\".*[ ,(]builderName[ ]*[=][ ]*[\\\"]([a-zA-Z]*)[\\\"].*\");\n    /** The constructorScope pattern. */\n    private static final Pattern CONSTRUCTOR_SCOPE_PATTERN = Pattern.compile(\".*[ ,(]constructorScope[ ]*[=][ ]*[\\\"]([a-zA-Z@]*)[\\\"].*\");\n    /** The factoryName pattern. */\n    private static final Pattern FACTORY_NAME_PATTERN = Pattern.compile(\".*[ ,(]factoryName[ ]*[=][ ]*[\\\"]([a-zA-Z]*)[\\\"].*\");\n    /** The hierarchy pattern. */\n    private static final Pattern HIERARCHY_PATTERN = Pattern.compile(\".*[ ,(]hierarchy[ ]*[=][ ]*[\\\"]([a-zA-Z]*)[\\\"].*\");\n    /** The cacheHashCode pattern. */\n    private static final Pattern CACHE_HASH_CODE_PATTERN = Pattern.compile(\".*[ ,(]cacheHashCode[ ]*[=][ ]*(true|false).*\");\n    /** The cloneStyle pattern. */\n    private static final Pattern CLONE_STYLE_PATTERN = Pattern.compile(\".*[ ,(]cloneStyle[ ]*[=][ ]*[\\\"]([a-zA-Z]*)[\\\"].*\");\n\n    /** The validator pattern. */\n    private static final Pattern VALIDATOR_PATTERN = Pattern.compile(\n            \".*private[ ]+void[ ]+\" +\n            \"([a-zA-Z][a-zA-Z0-9]*)[(][ ]*[)].*\");\n    /** The defaults pattern. */\n    private static final Pattern DEFAULTS_PATTERN = Pattern.compile(\n            \".*private[ ]+static[ ]+void[ ]+\" +\n            \"([a-zA-Z][a-zA-Z0-9]*)[(][ ]*Builder[ ]+[a-zA-Z][a-zA-Z0-9]*[ ]*[)].*\");\n\n    /** The content to process. */\n    private final File file;\n    /** The content to process. */\n    private final List<String> content;\n    /** The content to process. */\n    private final BeanGenConfig config;\n    /** The content to process. */\n    private int beanDefIndex;\n    /** The start position of auto-generation. */\n    private int autoStartIndex;\n    /** The end position of auto-generation. */\n    private int autoEndIndex;\n    /** The list of property generators. */\n    private List<PropertyGen> properties;\n\n    /**\n     * Constructor.\n     * @param file  the file to process, not null\n     * @param content  the content to process, not null\n     */\n    BeanParser(File file, List<String> content, BeanGenConfig config) {\n        this.file = file;\n        this.content = content;\n        this.config = config;\n    }\n\n    //-----------------------------------------------------------------------\n    File getFile() {\n        return file;\n    }\n\n    String getFieldPrefix() {\n        return config.getPrefix();\n    }\n\n    BeanGenConfig getConfig() {\n        return config;\n    }\n\n    //-----------------------------------------------------------------------\n    BeanGen parse() {\n        var data = new BeanData();\n        beanDefIndex = parseBeanDefinition();\n        data.getCurrentImports().addAll(parseImports(beanDefIndex));\n        data.setImportInsertLocation(parseImportLocation(beanDefIndex));\n        if (beanDefIndex < 0) {\n            return new BeanGen(file, content, config, data);\n        }\n        data.setBeanStyle(parseBeanStyle(beanDefIndex));\n        data.resolveBeanStyle(config.getDefaultStyle());\n        if (!data.isBeanStyleValid()) {\n            throw new BeanCodeGenException(\"Invalid bean style: \" + data.getBeanStyle(), file, beanDefIndex);\n        }\n        data.setConstructorScope(parseConstructorScope(beanDefIndex));\n        if (!data.isConstructorScopeValid()) {\n            throw new BeanCodeGenException(\"Invalid constructor scope: \" + data.getConstructorScope(), file, beanDefIndex);\n        }\n        data.setBeanMetaScope(parseBeanMetaScope(beanDefIndex));\n        if (!data.isBeanMetaScopeValid()) {\n            throw new BeanCodeGenException(\"Invalid meta-bean scope: \" + data.getBeanMetaScope(), file, beanDefIndex);\n        }\n        data.setBeanMetaImplements(parseBeanMetaImplements(beanDefIndex));\n        data.setBeanBuilderScope(parseBeanBuilderScope(beanDefIndex));\n        if (!data.isBeanBuilderScopeValid()) {\n            throw new BeanCodeGenException(\"Invalid bean builder scope: \" + data.getBeanBuilderScope(), file, beanDefIndex);\n        }\n        data.setBeanBuilderName(parseBeanBuilderName(beanDefIndex));\n        data.setFactoryName(parseFactoryName(beanDefIndex));\n        data.setCacheHashCode(parseCacheHashCode(beanDefIndex));\n        data.setCloneStyle(parseCloneStyle(beanDefIndex));\n        if (!data.isCloneStyleValid()) {\n            throw new BeanCodeGenException(\"Invalid clone style: \" + data.getCloneStyle(), file, beanDefIndex);\n        }\n        data.setImmutableConstructor(parseImmutableConstructor(beanDefIndex));\n        data.setConstructable(parseConstructable(beanDefIndex));\n        data.setTypeParts(parseBeanType(beanDefIndex));\n        var classHeaderAfterType = classHeaderAfterType(beanDefIndex, data.getType());\n        data.setSuperTypeParts(parseBeanSuperType(classHeaderAfterType));\n        data.setSerializable(parseSerializable(classHeaderAfterType));\n        if (parseBeanHierarchy(beanDefIndex).equals(\"immutable\")) {\n            data.setImmutable(true);\n            data.setConstructorStyle(CONSTRUCTOR_BY_BUILDER);\n        } else if (data.getImmutableConstructor() == CONSTRUCTOR_NONE) {\n            if (data.isImmutable()) {\n                if (data.isTypeFinal()) {\n                    data.setConstructorStyle(CONSTRUCTOR_BY_ARGS);\n                } else {\n                    data.setConstructorStyle(CONSTRUCTOR_BY_BUILDER);\n                }\n            } else {\n                if (data.isBeanStyleLight()) {\n                    data.setConstructorStyle(CONSTRUCTOR_BY_ARGS);\n                } else {\n                    data.setConstructorStyle(CONSTRUCTOR_BY_BUILDER);\n                }\n            }\n        } else {\n            data.setConstructorStyle(data.getImmutableConstructor());\n        }\n        if (data.isImmutable()) {\n            data.setImmutableValidator(parseImmutableValidator(beanDefIndex));\n            data.setImmutableDefaults(parseImmutableDefaults(beanDefIndex));\n            data.setImmutablePreBuild(parseImmutablePreBuild(beanDefIndex));\n            if (data.isBeanStyleLight() && !data.isTypeFinal()) {\n                throw new BeanCodeGenException(\n                        \"Invalid bean style: Light beans must be declared final\", file, beanDefIndex);\n            }\n            if (data.isBeanStyleMinimal() && !data.isTypeFinal()) {\n                throw new BeanCodeGenException(\n                        \"Invalid bean style: Minimal beans must be declared final\", file, beanDefIndex);\n            }\n            if (data.isFactoryRequired() && !data.isRootClass()) {\n                throw new BeanCodeGenException(\n                        \"Invalid bean style: Factory method only allowed when bean has no bean superclass\", file, beanDefIndex);\n            }\n            if (data.isFactoryRequired() && !data.isTypeFinal()) {\n                throw new BeanCodeGenException(\n                        \"Invalid bean style: Factory method only allowed when bean is final\", file, beanDefIndex);\n            }\n        } else {\n            if (data.isBeanStyleLight() && !data.isTypeFinal()) {\n                throw new BeanCodeGenException(\n                        \"Invalid bean style: Light beans must be declared final\", file, beanDefIndex);\n            }\n            if (data.isBeanStyleMinimal() && !data.isTypeFinal()) {\n                throw new BeanCodeGenException(\n                        \"Invalid bean style: Minimal beans must be declared final\", file, beanDefIndex);\n            }\n            if (data.isFactoryRequired()) {\n                throw new BeanCodeGenException(\n                        \"Invalid bean style: Factory method only allowed when bean is immutable\", file, beanDefIndex);\n            }\n        }\n        properties = parseProperties(data);\n        autoStartIndex = parseStartAutogen();\n        autoEndIndex = parseEndAutogen();\n        data.setManualSerializationId(parseManualSerializationId(beanDefIndex));\n        data.setManualClone(parseManualClone(beanDefIndex));\n        data.setManualEqualsHashCode(parseManualEqualsHashCode(beanDefIndex));\n        data.setManualToStringCode(parseManualToStringCode(beanDefIndex));\n        if (data.isImmutable()) {\n            for (var prop : properties) {\n                if (!prop.getData().isDerived() && !prop.getData().isFinal()) {\n                    throw new BeanCodeGenException(\"ImmutableBean must have final properties: \" +\n                            data.getTypeRaw() + \".\" + prop.getData().getFieldName(),\n                            file, prop.getData().getLineIndex());\n                }\n            }\n        } else {\n            if (data.getImmutableConstructor() > CONSTRUCTOR_NONE) {\n                throw new BeanCodeGenException(\"Mutable beans must not specify @ImmutableConstructor: \" +\n                        data.getTypeRaw(), file, beanDefIndex);\n            }\n            if (!\"smart\".equals(data.getConstructorScope()) && !data.isBeanStyleLight()) {\n                throw new BeanCodeGenException(\"Mutable beans must not specify @BeanDefinition(constructorScope): \" +\n                                data.getTypeRaw(), file, beanDefIndex);\n            }\n        }\n        if (data.isCacheHashCode()) {\n            data.setCacheHashCode(data.isImmutable() && !data.isManualEqualsHashCode());\n        }\n        return new BeanGen(file, content, config, data, properties, autoStartIndex, autoEndIndex);\n    }\n\n    private String classHeaderAfterType(int defLine, String fullType) {\n        var buf = new StringBuilder(128);\n        var matchedType = false;\n        for (var index = defLine; index < content.size(); index++) {\n            var line = content.get(index);\n            if (!matchedType) {\n                if (!line.contains(fullType)) {\n                    continue;\n                }\n                matchedType = true;\n                line = line.substring(line.indexOf(fullType) + fullType.length());\n            }\n            buf.append(line).append(' ');\n            if (line.trim().endsWith(\"{\") && !line.trim().startsWith(\"@\")) {\n                break;\n            }\n        }\n        return buf.toString().trim();\n    }\n\n    //-----------------------------------------------------------------------\n    private int parseBeanDefinition() {\n        for (var index = 0; index < content.size(); index++) {\n            var line = content.get(index).trim();\n            if (line.startsWith(\"@BeanDefinition\")) {\n                return index;\n            }\n        }\n        return -1;\n    }\n\n    private Set<String> parseImports(int defLine) {\n        var end = defLine < 0 ? content.size() : defLine;\n        Set<String> imports = new HashSet<>();\n        for (var index = 0; index < end; index++) {\n            if (content.get(index).startsWith(\"import \")) {\n                var imp = content.get(index).substring(7).trim();\n                imp = imp.substring(0, imp.indexOf(';'));\n                if (!imp.endsWith(\".*\")) {\n                    imports.add(imp);\n                }\n            }\n        }\n        return imports;\n    }\n\n    private int parseImportLocation(int defLine) {\n        var end = defLine < 0 ? content.size() : defLine;\n        var location = 0;\n        for (var index = 0; index < end; index++) {\n            if (content.get(index).startsWith(\"import \") || content.get(index).startsWith(\"package \")) {\n                location = index;\n            }\n        }\n        return location;\n    }\n\n    private String parseBeanStyle(int defLine) {\n        var line = content.get(defLine).trim();\n        var matcher = STYLE_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"smart\";\n    }\n\n    private String parseConstructorScope(int defLine) {\n        var line = content.get(defLine).trim();\n        var matcher = CONSTRUCTOR_SCOPE_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"smart\";\n    }\n\n    private String parseBeanMetaScope(int defLine) {\n        var line = content.get(defLine).trim();\n        var matcher = META_SCOPE_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"smart\";\n    }\n\n    private String parseBeanMetaImplements(int defLine) {\n        var line = content.get(defLine).trim();\n        var matcher = META_IMPLEMENTS_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"\";\n    }\n\n    private String parseBeanBuilderScope(int defLine) {\n        var line = content.get(defLine).trim();\n        var matcher = BUILDER_SCOPE_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"smart\";\n    }\n\n    private String parseBeanBuilderName(int defLine) {\n        var line = content.get(defLine).trim();\n        var matcher = BUILDER_NAME_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"\";\n    }\n\n    private String parseFactoryName(int defLine) {\n        var line = content.get(defLine).trim();\n        var matcher = FACTORY_NAME_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"\";\n    }\n\n    private String parseBeanHierarchy(int defLine) {\n        var line = content.get(defLine).trim();\n        var matcher = HIERARCHY_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"\";\n    }\n\n    private boolean parseCacheHashCode(int defLine) {\n        var line = content.get(defLine).trim();\n        var matcher = CACHE_HASH_CODE_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return Boolean.parseBoolean(matcher.group(1));\n        }\n        return false;\n    }\n\n    private String parseCloneStyle(int defLine) {\n        var line = content.get(defLine).trim();\n        var matcher = CLONE_STYLE_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"smart\";\n    }\n\n    private boolean parseConstructable(int defLine) {\n        for (var index = defLine; index < content.size(); index++) {\n            if (content.get(index).contains(\" abstract class \")) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    private String[] parseBeanType(int defLine) {\n        var matcher = BEAN_TYPE.matcher(\"\");\n        for (var index = defLine; index < content.size(); index++) {\n            var line = content.get(index);\n            matcher.reset(line);\n            if (matcher.matches()) {\n                var startStr = line.substring(0, matcher.start(1));\n                var fnl = startStr.contains(\" final \") || startStr.startsWith(\"final \") ? \"final\" : null;\n                var scope = startStr.contains(\"public \") ? \"public\" : \"package\";\n                scope = startStr.contains(\"protected \") ? \"protected\" : scope;\n                scope = startStr.contains(\"private \") ? \"private\" : scope;\n                return new String[] {fnl, scope, matcher.group(1), matcher.group(2), matcher.group(3),\n                        matcher.group(4), matcher.group(5), matcher.group(6), matcher.group(7), matcher.group(8)};\n            }\n            if (line.contains(AUTOGENERATED_START_TEXT)) {\n                break;\n            }\n        }\n        throw new BeanCodeGenException(\"Unable to locate bean class name\", file, beanDefIndex);\n    }\n\n    private String[] parseBeanSuperType(String classHeaderAfterType) {\n        // this uses classHeaderAfterType as extends has two meanings in class headers\n        // search for implements\n        var matcherImplements = SUPER_IMPL_TYPE.matcher(classHeaderAfterType);\n        if (matcherImplements.matches()) {\n            return new String[] {matcherImplements.group(1)};\n        }\n        // search for extends\n        var matcherExtends = SUPER_TYPE.matcher(classHeaderAfterType);\n        if (matcherExtends.matches()) {\n            return new String[] {matcherExtends.group(1), matcherExtends.group(2), matcherExtends.group(3),\n                    matcherExtends.group(4), matcherExtends.group(5)};\n        }\n        throw new BeanCodeGenException(\"Unable to locate bean superclass\", file, beanDefIndex);\n    }\n\n    private boolean parseSerializable(String classHeaderAfterType) {\n        return SERIALIZABLE_TYPE.matcher(classHeaderAfterType).matches();\n    }\n\n    private boolean parseManualSerializationId(int defLine) {\n        for (var index = defLine; index < autoStartIndex; index++) {\n            if (content.get(index).trim().startsWith(\"private static final long serialVersionUID\")) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private int parseImmutableConstructor(int defLine) {\n        var found = CONSTRUCTOR_NONE;\n        for (var index = defLine; index < content.size(); index++) {\n            if (content.get(index).trim().equals(\"@ImmutableConstructor\")) {\n                if (found > 0) {\n                    throw new BeanCodeGenException(\"Only one @ImmutableConstructor may be specified\", file, index);\n                }\n                found = CONSTRUCTOR_BY_ARGS;\n                if (index + 1 < content.size()) {\n                    var nextLine = content.get(index + 1);\n                    if (nextLine.contains(\"Builder \") || nextLine.contains(\"Builder<\")) {\n                        found = CONSTRUCTOR_BY_BUILDER;\n                    }\n                }\n            }\n        }\n        return found;\n    }\n\n    private String parseImmutableValidator(int defLine) {\n        var found = false;\n        for (var index = defLine; index < content.size(); index++) {\n            if (content.get(index).trim().equals(\"@ImmutableValidator\")) {\n                if (found) {\n                    throw new BeanCodeGenException(\"Only one @ImmutableValidator may be specified\", file, index);\n                }\n                found = true;\n                if (index + 1 < content.size()) {\n                    var nextLine = content.get(index + 1);\n                    var matcher = VALIDATOR_PATTERN.matcher(nextLine);\n                    if (matcher.matches()) {\n                        return matcher.group(1);\n                    }\n                    throw new BeanCodeGenException(\n                        \"@ImmutableValidator method must be private void and no-args\", file, index + 1);\n                }\n            }\n        }\n        return null;\n    }\n\n    private String parseImmutableDefaults(int defLine) {\n        var found = false;\n        for (var index = defLine; index < content.size(); index++) {\n            if (content.get(index).trim().equals(\"@ImmutableDefaults\")) {\n                if (found) {\n                    throw new BeanCodeGenException(\"Only one @ImmutableDefaults may be specified\", file, index);\n                }\n                found = true;\n                if (index + 1 < content.size()) {\n                    var nextLine = content.get(index + 1);\n                    var matcher = DEFAULTS_PATTERN.matcher(nextLine);\n                    if (matcher.matches()) {\n                        return matcher.group(1);\n                    }\n                    throw new BeanCodeGenException(\n                        \"@ImmutableDefaults method must be private static void and have one argument of type 'Builder'\",\n                        file, index + 1);\n                }\n            }\n        }\n        return null;\n    }\n\n    private String parseImmutablePreBuild(int defLine) {\n        var found = false;\n        for (var index = defLine; index < content.size(); index++) {\n            if (content.get(index).trim().equals(\"@ImmutablePreBuild\")) {\n                if (found) {\n                    throw new BeanCodeGenException(\"Only one @ImmutablePreBuild may be specified\", file, index);\n                }\n                found = true;\n                if (index + 1 < content.size()) {\n                    var nextLine = content.get(index + 1);\n                    var matcher = DEFAULTS_PATTERN.matcher(nextLine);\n                    if (matcher.matches()) {\n                        return matcher.group(1);\n                    }\n                    throw new BeanCodeGenException(\n                        \"@ImmutablePreBuild method must be private static void and have one argument of type 'Builder'\",\n                        file, index + 1);\n                }\n            }\n        }\n        return null;\n    }\n\n    private List<PropertyGen> parseProperties(BeanData data) {\n        List<PropertyGen> props = new ArrayList<>();\n        for (var index = 0; index < content.size(); index++) {\n            var line = content.get(index).trim();\n            var parser = new PropertyParser(this);\n            if (line.startsWith(\"@PropertyDefinition\")) {\n                var prop = parser.parse(data, content, index);\n                props.add(prop);\n                data.getProperties().add(prop.getData());\n            } else if (line.startsWith(\"@DerivedProperty\")) {\n                var prop = parser.parseDerived(data, content, index);\n                props.add(prop);\n                data.getProperties().add(prop.getData());\n            }\n        }\n        return props;\n    }\n\n    private int parseStartAutogen() {\n        for (var index = 0; index < content.size(); index++) {\n            var line = content.get(index).trim();\n            if (line.contains(\" AUTOGENERATED START \")) {\n                content.set(index, AUTOGENERATED_START);\n                return index;\n            }\n        }\n        for (var index = content.size() - 1; index >= 0; index--) {\n            var line = content.get(index).trim();\n            if (line.equals(\"}\")) {\n                content.add(index, AUTOGENERATED_START);\n                return index;\n            }\n            if (!line.isEmpty()) {\n                break;\n            }\n        }\n        throw new BeanCodeGenException(\"Unable to locate start autogeneration point\", file, beanDefIndex);\n    }\n\n    private int parseEndAutogen() {\n        for (var index = autoStartIndex; index < content.size(); index++) {\n            var line = content.get(index).trim();\n            if (line.contains(\" AUTOGENERATED END \")) {\n                content.set(index, AUTOGENERATED_END);\n                return index;\n            }\n        }\n        content.add(autoStartIndex + 1, AUTOGENERATED_END);\n        return autoStartIndex + 1;\n    }\n\n    private boolean parseManualClone(int defLine) {\n        for (var index = defLine; index < autoStartIndex; index++) {\n            var line = content.get(index).trim();\n            if (line.startsWith(\"public \") && line.endsWith(\" clone() {\")) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private boolean parseManualEqualsHashCode(int defLine) {\n        for (var index = defLine; index < autoStartIndex; index++) {\n            var line = content.get(index).trim();\n            if (line.equals(\"public int hashCode() {\") || (line.startsWith(\"public boolean equals(\") && line.endsWith(\") {\"))) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private boolean parseManualToStringCode(int defLine) {\n        for (var index = defLine; index < autoStartIndex; index++) {\n            var line = content.get(index).trim();\n            if (line.equals(\"public String toString() {\")) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/BuilderGen.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.gen;\n\nimport java.util.List;\n\n/**\n * A generator of builder code.\n */\nabstract class BuilderGen {\n\n    /**\n     * Generates the builder field.\n     * \n     * @param indent  the indent to use, not null\n     * @param prop  the property data, not null\n     * @return the generated code, not null\n     */\n    abstract List<String> generateField(String indent, PropertyData prop);\n\n    /**\n     * Is special initialization needed.\n     * \n     * @param prop  the property data, not null\n     * @return true if special\n     */\n    abstract boolean isSpecialInit(PropertyData prop);\n\n    /**\n     * Generates the init string.\n     * \n     * @param prop  the property data, not null\n     * @return the generated code, not null\n     */\n    abstract String generateInit(PropertyData prop);\n\n    /**\n     * Generates the builder exposed type.\n     * \n     * @param prop  the property data, not null\n     * @return the generated code, not null\n     */\n    String generateType(PropertyData prop) {\n        return prop.getBuilderType();\n    }\n\n    //-----------------------------------------------------------------------\n    static class PatternBuilderGen extends BuilderGen {\n        private final String type;\n        private final String init;\n        PatternBuilderGen(String type, String init) {\n            this.type = type;\n            this.init = init;\n        }\n        @Override\n        List<String> generateField(String indent, PropertyData prop) {\n            if (prop.isNotNull()) {\n                var init = this.init.replace(\"<>\", PropertyGen.resolveWildcard(prop.getTypeGenerics()));\n                return List.of(indent + \"private \" + generateType(prop) + \" \" + prop.getFieldName() + \" = \" + init + \";\");\n            } else {\n                return List.of(indent + \"private \" + generateType(prop) + \" \" + prop.getFieldName() + \";\");\n            }\n        }\n        @Override\n        boolean isSpecialInit(PropertyData prop) {\n            return true;\n        }\n        @Override\n        String generateInit(PropertyData prop) {\n            return init;\n        }\n        @Override\n        String generateType(PropertyData prop) {\n            if (!\"smart\".equals(prop.getBuilderTypeStyle())) {\n                return prop.getBuilderType().replace(\"<>\", prop.getTypeGenerics());\n            }\n            return type.replace(\"<>\", prop.getTypeGenerics());\n        }\n    }\n\n    static class SimpleBuilderGen extends BuilderGen {\n        SimpleBuilderGen() {\n        }\n        @Override\n        List<String> generateField(String indent, PropertyData prop) {\n            return List.of(indent + \"private \" + generateType(prop) + \" \" + prop.getFieldName() + \";\");\n        }\n        @Override\n        boolean isSpecialInit(PropertyData prop) {\n            return false;\n        }\n        @Override\n        String generateInit(PropertyData prop) {\n            return defaultType(prop);\n        }\n        @Override\n        String generateType(PropertyData prop) {\n            return prop.getBuilderType().replace(\"<>\", prop.getTypeGenerics());\n        }\n    }\n\n    static class NoBuilderGen extends BuilderGen {\n        static final BuilderGen INSTANCE = new NoBuilderGen();\n        @Override\n        List<String> generateField(String indent, PropertyData prop) {\n            return List.of();\n        }\n        @Override\n        boolean isSpecialInit(PropertyData prop) {\n            return false;\n        }\n        @Override\n        String generateInit(PropertyData prop) {\n            return defaultType(prop);\n        }\n    }\n\n    // default type (assigned to an Object)\n    private static String defaultType(PropertyData prop) {\n        return switch (prop.getType()) {\n            case \"long\" -> \"0L\";\n            case \"int\" -> \"0\";\n            case \"short\" -> \"(short) 0\";\n            case \"byte\" -> \"(byte) 0\";\n            case \"double\" -> \"0d\";\n            case \"float\" -> \"0f\";\n            case \"char\" -> \"'\\\\u0000'\";\n            case \"boolean\" -> \"Boolean.FALSE\";\n            default -> \"null\";\n        };\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/CopyGen.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.gen;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * A generator of copy code.\n */\nabstract class CopyGen {\n\n    /**\n     * Generates the copy to immutable lines.\n     * \n     * @param indent  the indent to use, not null\n     * @param fromBean  the source code for the bean to copy from, not null\n     * @param prop  the property data, not null\n     * @return the generated code, not null\n     */\n    abstract List<String> generateCopyToImmutable(String indent, String fromBean, PropertyData prop);\n\n    /**\n     * Generates the copy to mutable lines.\n     * \n     * @param indent  the indent to use, not null\n     * @param prop  the property data, not null\n     * @param beanToCopyFrom  the variable name of the bean, not null\n     * @return the generated code, not null\n     */\n    abstract List<String> generateCopyToMutable(String indent, PropertyData prop, String beanToCopyFrom);\n\n    //-----------------------------------------------------------------------\n    static class PatternCopyGen extends CopyGen {\n        static final CopyGen ASSIGN = new PatternCopyGen(\"$field = $value;\", true);\n        static final CopyGen CLONE = new PatternCopyGen(\"$value.clone()\", false);\n        static final CopyGen CLONE_CAST = new PatternCopyGen(\"($type) $value.clone()\", false);\n        static final CopyGen CLONE_ARRAY = new PatternCopyGen(\"($type) JodaBeanUtils.cloneArray($value)\", true);\n\n        private final String immutablePattern;\n        private final String mutablePattern;\n        private final boolean nullSafe;\n\n        PatternCopyGen(String pattern, boolean nullSafe) {\n            this(pattern, pattern, nullSafe);\n        }\n\n        PatternCopyGen(String immutablePattern, String mutablePattern, boolean nullSafe) {\n            this.immutablePattern = immutablePattern;\n            this.mutablePattern = mutablePattern;\n            this.nullSafe = nullSafe;\n        }\n        @Override\n        List<String> generateCopyToImmutable(String indent, String fromBean, PropertyData prop) {\n            var list = new ArrayList<String>();\n            var split = immutablePattern.split(\"\\n\");\n            for (var line : split) {\n                if (split.length == 1) {\n                    if (!line.startsWith(\"$field = \") && !line.endsWith(\";\")) {\n                        if (nullSafe || prop.isNotNull()) {\n                            line = \"$field = \" + line + \";\";\n                        } else {\n                            line = \"$field = ($value != null ? \" + line + \" : null);\";\n                        }\n                    }\n                    if (!line.startsWith(\"$field = \")) {\n                        line = \"$field = \" + line;\n                    }\n                }\n                line = line.replace(\"$field\", \"this.\" + prop.getFieldName());\n                line = line.replace(\"$value\", fromBean + (fromBean.isEmpty() ? prop.getPropertyName() : prop.getFieldName()));\n                line = line.replace(\"$type\", prop.getFieldType());\n                line = line.replace(\"$typeRaw\", prop.getTypeRaw());\n                line = line.replace(\"$generics\", prop.getTypeGenerics());\n                list.add(indent + line);\n            }\n            return list;\n        }\n        @Override\n        List<String> generateCopyToMutable(String indent, PropertyData prop, String beanToCopyFrom) {\n            var list = new ArrayList<String>();\n            var split = mutablePattern.split(\"\\n\");\n            for (var line : split) {\n                if (split.length == 1) {\n                    if (!line.startsWith(\"$field = \") && !line.endsWith(\";\")) {\n                        if (nullSafe || prop.isNotNull()) {\n                            line = \"$field = \" + line + \";\";\n                        } else {\n                            if (line.equals(\"$value\")) {\n                                line = \"$field = $value;\";\n                            } else {\n                                line = \"$field = ($value != null ? \" + line + \" : null);\";\n                            }\n                        }\n                    }\n                    if (!line.startsWith(\"$field = \")) {\n                        line = \"$field = \" + line;\n                    }\n                }\n                line = line.replace(\"$field\", \"this.\" + prop.getFieldName());\n                line = line.replace(\"$value\", beanToCopyFrom + \".\" + prop.getGetterGen().generateGetInvoke(prop));\n                line = line.replace(\"$type\", prop.getFieldType());\n                line = line.replace(\"$typeRaw\", prop.getTypeRaw());\n                line = line.replace(\"$generics\", prop.getTypeGenerics());\n                list.add(indent + line);\n            }\n            return list;\n        }\n    }\n\n    static class NoCopyGen extends CopyGen {\n        static final CopyGen INSTANCE = new NoCopyGen();\n        @Override\n        List<String> generateCopyToImmutable(String indent, String fromBean, PropertyData prop) {\n            return List.of();\n        }\n        @Override\n        List<String> generateCopyToMutable(String indent, PropertyData prop, String beanToCopyFrom) {\n            return List.of();\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/DerivedProperty.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.gen;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Annotation defining a derived property accessor for code generation.\n * <p>\n * This annotation is used on a getter to indicate that the method is used to\n * provide a derived property. A derived property has no instance variable.\n * A derived property will not form part of the {@code equals()} or {@code hashCode()}\n * methods, but will be included in {@code toString()}.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.METHOD)\npublic @interface DerivedProperty {\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/GetterGen.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.gen;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n/**\r\n * A generator of get methods.\r\n */\r\nabstract class GetterGen {\r\n\r\n    /**\r\n     * Generates the getter method.\r\n     * @param prop  the property data, not null\r\n     * @return the generated code, not null\r\n     */\r\n    abstract List<String> generateGetter(PropertyData prop);\r\n\r\n    /**\r\n     * Generates the getter method invocation.\r\n     * This is just the method name.\r\n     * @param prop  the property data, not null\r\n     * @return the generated code, not null\r\n     */\r\n    String generateGetInvoke(PropertyData prop) {\r\n        return \"get\" + prop.getUpperName() + \"()\";\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    static final class GetGetterGen extends GetterGen {\r\n        static final GetGetterGen PUBLIC = new GetGetterGen(\"public \");\r\n        static final GetGetterGen PROTECTED = new GetGetterGen(\"protected \");\r\n        static final GetGetterGen PACKAGE = new GetGetterGen(\"\");\r\n        static final GetGetterGen PRIVATE = new GetGetterGen(\"private \");\r\n        private final String access;\r\n        static GetGetterGen of(String access) {\r\n            return switch (access) {\r\n                case \"private\" -> PRIVATE;\r\n                case \"package\" -> PACKAGE;\r\n                case \"protected\" -> PROTECTED;\r\n                default -> PUBLIC;\r\n            };\r\n        }\r\n        private GetGetterGen(String access) {\r\n            this.access = access;\r\n        }\r\n        @Override\r\n        List<String> generateGetter(PropertyData prop) {\r\n            return doGenerateGetter(prop, access, \"get\", prop.getFieldName());\r\n        }\r\n    }\r\n\r\n    static final class IsGetterGen extends GetterGen {\r\n        static final IsGetterGen PUBLIC = new IsGetterGen(\"public \");\r\n        static final IsGetterGen PROTECTED = new IsGetterGen(\"protected \");\r\n        static final IsGetterGen PACKAGE = new IsGetterGen(\"\");\r\n        static final IsGetterGen PRIVATE = new IsGetterGen(\"private \");\r\n        private final String access;\r\n        static IsGetterGen of(String access) {\r\n            return switch (access) {\r\n                case \"private\" -> PRIVATE;\r\n                case \"package\" -> PACKAGE;\r\n                case \"protected\" -> PROTECTED;\r\n                default -> PUBLIC;\r\n            };\r\n        }\r\n        private IsGetterGen(String access) {\r\n            this.access = access;\r\n        }\r\n        @Override\r\n        List<String> generateGetter(PropertyData prop) {\r\n            return doGenerateGetter(prop, access, \"is\", prop.getFieldName());\r\n        }\r\n        @Override\r\n        String generateGetInvoke(PropertyData prop) {\r\n            return \"is\" + prop.getUpperName() + \"()\";\r\n        }\r\n    }\r\n\r\n    static final class CloneNNGetterGen extends GetterGen {\r\n        static final GetterGen PUBLIC = new CloneNNGetterGen(\"public \");\r\n        static final GetterGen PROTECTED = new CloneNNGetterGen(\"protected \");\r\n        static final GetterGen PACKAGE = new CloneNNGetterGen(\"\");\r\n        static final GetterGen PRIVATE = new CloneNNGetterGen(\"private \");\r\n        private final String access;\r\n        static GetterGen of(String access) {\r\n            return switch (access) {\r\n                case \"private\" -> PRIVATE;\r\n                case \"package\" -> PACKAGE;\r\n                case \"protected\" -> PROTECTED;\r\n                default -> PUBLIC;\r\n            };\r\n        }\r\n        private CloneNNGetterGen(String access) {\r\n            this.access = access;\r\n        }\r\n        @Override\r\n        List<String> generateGetter(PropertyData prop) {\r\n            return doGenerateGetter(prop, access, \"get\", prop.getFieldName() + \".clone()\");\r\n        }\r\n    }\r\n\r\n    static final class CloneGetterGen extends GetterGen {\r\n        static final GetterGen PUBLIC = new CloneGetterGen(\"public \");\r\n        static final GetterGen PROTECTED = new CloneGetterGen(\"protected \");\r\n        static final GetterGen PACKAGE = new CloneGetterGen(\"\");\r\n        static final GetterGen PRIVATE = new CloneGetterGen(\"private \");\r\n        private final String access;\r\n        static GetterGen of(String access) {\r\n            return switch (access) {\r\n                case \"private\" -> PRIVATE;\r\n                case \"package\" -> PACKAGE;\r\n                case \"protected\" -> PROTECTED;\r\n                default -> PUBLIC;\r\n            };\r\n        }\r\n        private CloneGetterGen(String access) {\r\n            this.access = access;\r\n        }\r\n        @Override\r\n        List<String> generateGetter(PropertyData prop) {\r\n            return doGenerateGetter(prop, access, \"get\", \"(\" + prop.getFieldName() + \" != null ? \" + prop.getFieldName() + \".clone() : null)\");\r\n        }\r\n    }\r\n\r\n    static final class CloneCastNNGetterGen extends GetterGen {\r\n        static final GetterGen PUBLIC = new CloneCastNNGetterGen(\"public \");\r\n        static final GetterGen PROTECTED = new CloneCastNNGetterGen(\"protected \");\r\n        static final GetterGen PACKAGE = new CloneCastNNGetterGen(\"\");\r\n        static final GetterGen PRIVATE = new CloneCastNNGetterGen(\"private \");\r\n        private final String access;\r\n        static GetterGen of(String access) {\r\n            return switch (access) {\r\n                case \"private\" -> PRIVATE;\r\n                case \"package\" -> PACKAGE;\r\n                case \"protected\" -> PROTECTED;\r\n                default -> PUBLIC;\r\n            };\r\n        }\r\n        private CloneCastNNGetterGen(String access) {\r\n            this.access = access;\r\n        }\r\n        @Override\r\n        List<String> generateGetter(PropertyData prop) {\r\n            return doGenerateGetter(prop, access, \"get\", \"(\" + prop.getFieldType() + \") \" + prop.getFieldName() + \".clone()\");\r\n        }\r\n    }\r\n\r\n    static final class CloneCastGetterGen extends GetterGen {\r\n        static final GetterGen PUBLIC = new CloneCastGetterGen(\"public \");\r\n        static final GetterGen PROTECTED = new CloneCastGetterGen(\"protected \");\r\n        static final GetterGen PACKAGE = new CloneCastGetterGen(\"\");\r\n        static final GetterGen PRIVATE = new CloneCastGetterGen(\"private \");\r\n        private final String access;\r\n        static GetterGen of(String access) {\r\n            return switch (access) {\r\n                case \"private\" -> PRIVATE;\r\n                case \"package\" -> PACKAGE;\r\n                case \"protected\" -> PROTECTED;\r\n                default -> PUBLIC;\r\n            };\r\n        }\r\n        private CloneCastGetterGen(String access) {\r\n            this.access = access;\r\n        }\r\n        @Override\r\n        List<String> generateGetter(PropertyData prop) {\r\n            return doGenerateGetter(prop, access, \"get\", \"(\" + prop.getFieldName() + \" != null ? (\" + prop.getFieldType() + \") \" + prop.getFieldName() + \".clone() : null)\");\r\n        }\r\n    }\r\n\r\n    static final class CloneArrayGetterGen extends GetterGen {\r\n        static final GetterGen PUBLIC = new CloneArrayGetterGen(\"public \");\r\n        static final GetterGen PROTECTED = new CloneArrayGetterGen(\"protected \");\r\n        static final GetterGen PACKAGE = new CloneArrayGetterGen(\"\");\r\n        static final GetterGen PRIVATE = new CloneArrayGetterGen(\"private \");\r\n        private final String access;\r\n\r\n        static GetterGen of(String access) {\r\n            return switch (access) {\r\n                case \"private\" -> PRIVATE;\r\n                case \"package\" -> PACKAGE;\r\n                case \"protected\" -> PROTECTED;\r\n                default -> PUBLIC;\r\n            };\r\n        }\r\n\r\n        private CloneArrayGetterGen(String access) {\r\n            this.access = access;\r\n        }\r\n\r\n        @Override\r\n        List<String> generateGetter(PropertyData prop) {\r\n            return doGenerateGetter(prop, access, \"get\",\r\n                    \"(\" + prop.getFieldType() + \") JodaBeanUtils.cloneArray(\" + prop.getFieldName() + \")\");\r\n        }\r\n    }\r\n\r\n    static final class Optional8GetterGen extends GetterGen {\r\n        static final GetterGen PUBLIC = new Optional8GetterGen();\r\n        @Override\r\n        List<String> generateGetter(PropertyData prop) {\r\n            var list = new ArrayList<String>();\r\n            list.add(\"\\t/**\");\r\n            list.add(\"\\t * Gets \" + prop.getFirstComment());\r\n            for (var comment : prop.getComments()) {\r\n                list.add(\"\\t * \" + comment);\r\n            }\r\n            list.add(\"\\t * @return the optional value of the property, not null\");\r\n            if (prop.getDeprecatedComment() != null) {\r\n                list.add(\"\\t * \" + prop.getDeprecatedComment());\r\n            }\r\n            list.add(\"\\t */\");\r\n            if (prop.isOverrideGet()) {\r\n                list.add(\"\\t@Override\");\r\n            }\r\n            if (prop.isDeprecated()) {\r\n                list.add(\"\\t@Deprecated\");\r\n            }\r\n            switch (prop.getType()) {\r\n                case \"Double\" -> {\r\n                    list.add(\"\\tpublic OptionalDouble get\" + prop.getUpperName() + \"() {\");\r\n                    list.add(\"\\t\\treturn \" + prop.getFieldName() + \" != null ? \" +\r\n                            \"OptionalDouble.of(\" + prop.getFieldName() + \") : OptionalDouble.empty();\");\r\n                }\r\n                case \"Integer\" -> {\r\n                    list.add(\"\\tpublic OptionalInt get\" + prop.getUpperName() + \"() {\");\r\n                    list.add(\"\\t\\treturn \" + prop.getFieldName() + \" != null ? \" +\r\n                            \"OptionalInt.of(\" + prop.getFieldName() + \") : OptionalInt.empty();\");\r\n                }\r\n                case \"Long\" -> {\r\n                    list.add(\"\\tpublic OptionalLong get\" + prop.getUpperName() + \"() {\");\r\n                    list.add(\"\\t\\treturn \" + prop.getFieldName() + \" != null ? \" +\r\n                            \"OptionalLong.of(\" + prop.getFieldName() + \") : OptionalLong.empty();\");\r\n                }\r\n                case null, default -> {\r\n                    list.add(\"\\tpublic Optional<\" + prop.getType() + \"> get\" + prop.getUpperName() + \"() {\");\r\n                    list.add(\"\\t\\treturn Optional.ofNullable(\" + prop.getFieldName() + \");\");\r\n                }\r\n            }\r\n            list.add(\"\\t}\");\r\n            list.add(\"\");\r\n            return list;\r\n        }\r\n        @Override\r\n        String generateGetInvoke(PropertyData prop) {\r\n            return prop.getFieldName();\r\n        }\r\n    }\r\n\r\n    static final class OptionalGuavaGetterGen extends GetterGen {\r\n        static final GetterGen PUBLIC = new OptionalGuavaGetterGen();\r\n        @Override\r\n        List<String> generateGetter(PropertyData prop) {\r\n            var list = new ArrayList<String>();\r\n            list.add(\"\\t/**\");\r\n            list.add(\"\\t * Gets \" + prop.getFirstComment());\r\n            for (var comment : prop.getComments()) {\r\n                list.add(\"\\t * \" + comment);\r\n            }\r\n            list.add(\"\\t * @return the optional value of the property, not null\");\r\n            if (prop.getDeprecatedComment() != null) {\r\n                list.add(\"\\t * \" + prop.getDeprecatedComment());\r\n            }\r\n            list.add(\"\\t */\");\r\n            if (prop.isOverrideGet()) {\r\n                list.add(\"\\t@Override\");\r\n            }\r\n            if (prop.isDeprecated()) {\r\n                list.add(\"\\t@Deprecated\");\r\n            }\r\n            list.add(\"\\tpublic Optional<\" + prop.getType() + \"> get\" + prop.getUpperName() + \"() {\");\r\n            list.add(\"\\t\\treturn Optional.fromNullable(\" + prop.getFieldName() + \");\");\r\n            list.add(\"\\t}\");\r\n            list.add(\"\");\r\n            return list;\r\n        }\r\n        @Override\r\n        String generateGetInvoke(PropertyData prop) {\r\n            return prop.getFieldName();\r\n        }\r\n    }\r\n\r\n    static class ManualGetterGen extends GetterGen {\r\n        static final GetterGen INSTANCE = new ManualGetterGen();\r\n        @Override\r\n        List<String> generateGetter(PropertyData prop) {\r\n            return List.of();\r\n        }\r\n    }\r\n\r\n    static class NoGetterGen extends GetterGen {\r\n        static final GetterGen INSTANCE = new NoGetterGen();\r\n        @Override\r\n        List<String> generateGetter(PropertyData prop) {\r\n            return List.of();\r\n        }\r\n        @Override\r\n        String generateGetInvoke(PropertyData prop) {\r\n            return prop.getFieldName();\r\n        }\r\n    }\r\n\r\n    private static List<String> doGenerateGetter(PropertyData prop, String access, String prefix, String expression) {\r\n        var list = new ArrayList<String>();\r\n        list.add(\"\\t/**\");\r\n        list.add(\"\\t * Gets \" + prop.getFirstComment());\r\n        for (var comment : prop.getComments()) {\r\n            list.add(\"\\t * \" + comment);\r\n        }\r\n        list.add(\"\\t * @return the value of the property\" + prop.getNotNullJavadoc());\r\n        if (prop.getDeprecatedComment() != null) {\r\n            list.add(\"\\t * \" + prop.getDeprecatedComment());\r\n        }\r\n        list.add(\"\\t */\");\r\n        if (prop.isOverrideGet()) {\r\n            list.add(\"\\t@Override\");\r\n        }\r\n        if (prop.isDeprecated()) {\r\n            list.add(\"\\t@Deprecated\");\r\n        }\r\n        list.add(\"\\t\" + access + prop.getType() + \" \" + prefix + prop.getUpperName() + \"() {\");\r\n        list.add(\"\\t\\treturn \" + expression + \";\");\r\n        list.add(\"\\t}\");\r\n        list.add(\"\");\r\n        return list;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/ImmutableConstructor.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.gen;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Annotation defining which constructor is to be used to create the object\n * in for code generation of immutable beans.\n * <p>\n * The constructor must have the same arguments and types as the properties\n * as exposed by the builder. They must also be in the same order.\n * The constructor is responsible for maintaining the invariants of the class,\n * such as validation.\n * <p>\n * For example, a property type of 'ImmutableList&lt;Foo&gt;' will have a builder\n * type of 'List&lt;Foo&gt;', thus the constructor must also use 'List'.\n * <p>\n * If no constructor specifies this annotation then a constructor will be generated.\n * In many cases it is easiest to generate the constructor, then move it outside\n * the autogenerated block and annotate it.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.CONSTRUCTOR)\npublic @interface ImmutableConstructor {\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/ImmutableDefaults.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.gen;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Annotation defining which method is to be used to apply the default property values\n * when code generating immutable beans.\n * <p>\n * Each non-collection property in an immutable bean normally has to be initialized before use.\n * This annotation allows default values to be set when creating the builder.\n * Note that the defaults apply to the builder, not to the constructor of the bean.\n * <p>\n * The method must be a private static void instance method that takes a single argument of the type 'Builder'.\n * Private is necessary as it is called from the builder constructor.\n * For example:\n * <pre>\n *   {@literal @}ImmutableDefaults\n *   private static void applyDefaults(Builder builder) {\n *     builder.group(Group.STANDARD);  // default the group property to 'STANDARD'\n *   }\n * </pre>\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.METHOD)\npublic @interface ImmutableDefaults {\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/ImmutablePreBuild.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.gen;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Annotation defining a method that is to be called just before a code generated immutable bean is built.\n * <p>\n * This is used when an immutable bean wants to perform an action on the builder just\n * before it is built into a bean. The action might include validation (normally done\n * using {@link ImmutableValidator}) and defaulting (normally done using {@link ImmutableDefaults}).\n * <p>\n * The special use case for this annotation is the ability to default the value of one property\n * from the value of another. For example, consider a bean with two dates, where one is derived\n * from the other (such as the second being the first adjusted to a valid business day).\n * Use of this annotation allows the second date to be set to the same as the first date if\n * a value is not set.\n * <p>\n * The method must be a private static void instance method that takes a single argument of the type 'Builder'.\n * The method will be called at the start of the {@code build()} method of the builder.\n * For example:\n * <pre>\n *   {@literal @}ImmutablePreBuild\n *   private static void preBuild(Builder builder) {\n *     if (builder.date2 == null) {\n *       builder.date2 = builder.date1;  // default date2 to be same as date1\n *     }\n *   }\n * </pre>\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.METHOD)\npublic @interface ImmutablePreBuild {\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/ImmutableValidator.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.gen;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Annotation defining which method is to be used to validate the bean\n * when code generating immutable beans.\n * <p>\n * Each property in a bean can be independently validated.\n * This annotation allows properties to be cross-checked at the end of the constructor.\n * <p>\n * The method must be a private void instance method and take no arguments.\n * Private is necessary as it is called from the constructor.\n * For example:\n * <pre>\n *   {@literal @}ImmutableValidator\n *   private void validate() {\n *     if (age != null &amp;&amp; age {@literal <} 0) {\n *       throw new IllegalArgumentException(\"Age must not be negative if specified\")\n *     }\n *   }\n * </pre>\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.METHOD)\npublic @interface ImmutableValidator {\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/PropertyData.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.gen;\n\nimport java.io.File;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.Set;\nimport java.util.StringTokenizer;\n\nimport org.joda.beans.PropertyStyle;\nimport org.joda.beans.gen.CopyGen.PatternCopyGen;\n\n/**\n * A bean that can be generated.\n */\nclass PropertyData {\n\n    /** Collection types. */\n    private static final Set<String> COLLECTIONS = Set.of(\n            \"Collection\", \"Set\", \"SortedSet\", \"NavigableSet\", \"List\",\n            \"ArrayList\", \"LinkedList\",\n            \"HashSet\", \"LinkedHashSet\", \"TreeSet\", \"ConcurrentSkipListSet, EnumSet\",\n            \"ImmutableCollection\", \"ImmutableList\", \"ImmutableSet\", \"ImmutableSortedSet\");\n    /** Set types. */\n    private static final Set<String> SETS = Set.of(\n            \"Set\", \"SortedSet\", \"NavigableSet\",\n            \"HashSet\", \"LinkedHashSet\", \"TreeSet\", \"ConcurrentSkipListSet, EnumSet\",\n            \"ImmutableSet\", \"ImmutableSortedSet\");\n    /** Set types. */\n    private static final Set<String> SORTED_SETS = Set.of(\n            \"SortedSet\", \"NavigableSet\",\n            \"TreeSet\", \"ConcurrentSkipListSet\",\n            \"ImmutableSortedSet\");\n    /** Map types. */\n    private static final Set<String> MAPS = Set.of(\n            \"Map\", \"SortedMap\", \"NavigableMap\", \"ConcurrentMap\", \"ConcurrentNavigableMap\",\n            \"HashMap\", \"LinkedHashMap\", \"TreeMap\", \"ConcurrentHashMap\", \"ConcurrentSkipListMap\",\n            \"BiMap\", \"HashBiMap\",\n            \"ImmutableMap\", \"ImmutableSortedMap\", \"ImmutableBiMap\");\n\n    /** Owning bean. */\n    private final BeanData bean;\n    /** Annotation line index for {@code PropertyDefinition} in input file. */\n    private final int lineIndex;\n    /** Property name. */\n    private String propertyName;\n    /** Field name. */\n    private String fieldName;\n    /** Meta field name. */\n    private String metaFieldName;\n    /** Upper property name. */\n    private String upperName;\n    /** Property type. */\n    private String type;\n    /** The builder type. */\n    private String builderType;\n    /** Property field type. */\n    private String fieldType;\n    /** Whether the field is declared final. */\n    private boolean isFinal;\n    /** The field initializer. */\n    private String initializer;\n    /** The alias. */\n    private String alias;\n    /** The getter style. */\n    private String getStyle;\n    /** The setter style. */\n    private String setStyle;\n    /** The override style. */\n    private boolean overrideGet;\n    /** The override style. */\n    private boolean overrideSet;\n    /** The type style. */\n    private String typeStyle;\n    /** The builder type style. */\n    private String builderTypeStyle;\n    /** The equals hashCode style. */\n    private String equalsHashCodeStyle;\n    /** The toString style. */\n    private String toStringStyle;\n    /** The validation string. */\n    private String validation;\n    /** Deprecated flag. */\n    private boolean deprecated;\n    /** First comment about the property. */\n    private String firstComment;\n    /** Other comments about the property. */\n    private final List<String> comments = new ArrayList<>();\n    /** Deprecated comment about the property, null if not deprecated. */\n    private String deprecatedComment;\n    /** The getter generator. */\n    private GetterGen getterGen;\n    /** The setter generator. */\n    private SetterGen setterGen;\n    /** The flag for bound properties. */\n    private boolean bound;\n    /** The copy generator. */\n    private CopyGen copyGen;\n    /** The builder generator. */\n    private BuilderGen builderGen;\n    /** The config. */\n    private BeanGenConfig config;\n\n    /**\n     * Constructor.\n     */\n    PropertyData(BeanData bean, BeanGenConfig config, int lineIndex) {\n        this.bean = bean;\n        this.config = config;\n        this.lineIndex = lineIndex;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the bean.\n     * @return the bean, not null\n     */\n    public BeanData getBean() {\n        return bean;\n    }\n\n    /**\n     * Gets the configuration.\n     * \n     * @return the configuration, not null\n     */\n    public BeanGenConfig getConfig() {\n        return config;\n    }\n\n    /**\n     * Sets the configuration.\n     * \n     * @param config  the new configuration, not null\n     */\n    public void setConfig(BeanGenConfig config) {\n        this.config = config;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the property line index.\n     * @return the property line index\n     */\n    public int getLineIndex() {\n        return lineIndex;\n    }\n\n    /**\n     * Gets the property name.\n     * @return the property name\n     */\n    public String getPropertyName() {\n        return propertyName;\n    }\n\n    /**\n     * Sets the property name.\n     * @param propertyName  the property name to set\n     */\n    public void setPropertyName(String propertyName) {\n        this.propertyName = propertyName;\n    }\n\n    /**\n     * Gets the field name.\n     * @return the field name\n     */\n    public String getFieldName() {\n        return fieldName;\n    }\n\n    /**\n     * Sets the field name.\n     * @param fieldName  the field name to set\n     */\n    public void setFieldName(String fieldName) {\n        this.fieldName = fieldName;\n    }\n\n    /**\n     * Gets the meta field name.\n     * @return the meta field name\n     */\n    public String getMetaFieldName() {\n        return metaFieldName;\n    }\n\n    /**\n     * Sets the meta field name.\n     * @param metaFieldName  the meta field name to set\n     */\n    public void setMetaFieldName(String metaFieldName) {\n        this.metaFieldName = metaFieldName;\n    }\n\n    /**\n     * Gets the upper property name.\n     * @return the upper name\n     */\n    public String getUpperName() {\n        return upperName;\n    }\n\n    /**\n     * Sets the upper property name.\n     * @param upperName  the upper name to set\n     */\n    public void setUpperName(String upperName) {\n        this.upperName = upperName;\n    }\n\n    /**\n     * Gets the type.\n     * @return the type\n     */\n    public String getType() {\n        return type;\n    }\n\n    /**\n     * Sets the type.\n     * @param type  the type to set\n     */\n    public void setType(String type) {\n        this.type = type;\n    }\n\n    /**\n     * Gets the builder type.\n     * @return the type\n     */\n    public String getBuilderType() {\n        return builderType;\n    }\n\n    /**\n     * Sets the builder type.\n     * @param builderType  the type to set\n     */\n    public void setBuilderType(String builderType) {\n        this.builderType = builderType;\n    }\n\n    /**\n     * Gets the field type.\n     * @return the field type\n     */\n    public String getFieldType() {\n        return fieldType;\n    }\n\n    /**\n     * Sets the field type.\n     * @param fieldType  the field type to set\n     */\n    public void setFieldType(String fieldType) {\n        this.fieldType = fieldType;\n    }\n\n    /**\n     * Resolves the field type.\n     */\n    public void resolveType() {\n        if (getTypeStyle() == null) {\n            setTypeStyle(\"\");\n        }\n        var fieldType = getFieldType();\n        var generics = \"\";\n        if (fieldType.contains(\"<\")) {\n            generics = fieldType.substring(fieldType.indexOf('<'));\n        }\n        if (getTypeStyle().equals(\"smart\")) {\n            setType(fieldType);\n        } else if (!getTypeStyle().isEmpty()) {\n            if (getTypeStyle().contains(\"<>\")) {\n                setType(getTypeStyle().replace(\"<>\", generics));\n            } else if (getTypeStyle().contains(\"<\")) {\n                setType(getTypeStyle());\n            } else {\n                setType(getTypeStyle() + generics);\n            }\n        } else {\n            setType(fieldType);\n        }\n    }\n\n    /**\n     * Resolves the field builder type.\n     */\n    public void resolveBuilderType() {\n        if (getBuilderTypeStyle() == null) {\n            setBuilderTypeStyle(\"\");\n        }\n        var fieldType = getFieldType();\n        var generics = \"\";\n        if (fieldType.contains(\"<\")) {\n            generics = fieldType.substring(fieldType.indexOf('<'));\n        }\n        if (getBuilderTypeStyle().equals(\"smart\")) {\n            setBuilderType(fieldType);\n        } else if (!getBuilderTypeStyle().isEmpty()) {\n            if (getBuilderTypeStyle().contains(\"<>\")) {\n                setBuilderType(getBuilderTypeStyle().replace(\"<>\", generics));\n            } else if (getBuilderTypeStyle().contains(\"<\")) {\n                setBuilderType(getBuilderTypeStyle());\n            } else {\n                setBuilderType(getBuilderTypeStyle() + generics);\n            }\n        } else {\n            setBuilderType(fieldType);\n        }\n    }\n\n    /**\n     * Gets whether the field is declared final.\n     * @return the type\n     */\n    public boolean isFinal() {\n        return isFinal;\n    }\n\n    /**\n     * Sets whether the field is declared final.\n     * @param isFinal  the field is final flag\n     */\n    public void setFinal(boolean isFinal) {\n        this.isFinal = isFinal;\n    }\n\n    /**\n     * Gets the field initializer.\n     * @return the initializer\n     */\n    public String getInitializer() {\n        return initializer;\n    }\n\n    /**\n     * Sets the field initializer.\n     * @param initializer  the field initializer\n     */\n    public void setInitializer(String initializer) {\n        this.initializer = initializer;\n    }\n\n    /**\n     * Gets the alias.\n     * @return the alias\n     */\n    public String getAlias() {\n        return alias;\n    }\n\n    /**\n     * Sets the alias.\n     * @param alias  the alias\n     */\n    public void setAlias(String alias) {\n        this.alias = (alias != null && !alias.isEmpty() ? alias : null);\n    }\n\n    /**\n     * Gets the getter style.\n     * @return the getter style\n     */\n    public String getGetStyle() {\n        return getStyle;\n    }\n\n    /**\n     * Sets the getter style.\n     * @param getStyle  the getter style to set\n     */\n    public void setGetStyle(String getStyle) {\n        this.getStyle = getStyle;\n    }\n\n    /**\n     * Gets the type style.\n     * @return the type style\n     */\n    public String getTypeStyle() {\n        return typeStyle;\n    }\n\n    /**\n     * Sets the type style.\n     * @param typeStyle  the type style to set\n     */\n    public void setTypeStyle(String typeStyle) {\n        this.typeStyle = typeStyle;\n    }\n\n    /**\n     * Gets the type builder type style.\n     * @return the builder type style\n     */\n    public String getBuilderTypeStyle() {\n        return builderTypeStyle;\n    }\n\n    /**\n     * Sets the builder type style.\n     * @param builderTypeStyle  the builder type style to set\n     */\n    public void setBuilderTypeStyle(String builderTypeStyle) {\n        this.builderTypeStyle = builderTypeStyle;\n    }\n\n    /**\n     * Gets the equals hashCode style.\n     * @return the equals hashCode style\n     */\n    public String getEqualsHashCodeStyle() {\n        return equalsHashCodeStyle;\n    }\n\n    /**\n     * Sets the equals hashCode style.\n     * @param equalsHashCodeStyle  the equals hashCode style\n     */\n    public void setEqualsHashCodeStyle(String equalsHashCodeStyle) {\n        this.equalsHashCodeStyle = equalsHashCodeStyle;\n    }\n\n    /**\n     * Resolves the equals hashCode generator.\n     * @param file  the file\n     * @param lineIndex  the line index\n     */\n    public void resolveEqualsHashCodeStyle(File file, int lineIndex) {\n        if (equalsHashCodeStyle.equals(\"smart\")) {\n            equalsHashCodeStyle = (bean.isImmutable() ? \"field\" : \"getter\");\n        }\n        if (equalsHashCodeStyle.equals(\"omit\") ||\n                equalsHashCodeStyle.equals(\"getter\") ||\n                equalsHashCodeStyle.equals(\"field\")) {\n            return;\n        }\n        throw new BeanCodeGenException(\"Invalid equals/hashCode style: \" + equalsHashCodeStyle +\n                \" in \" + getBean().getTypeRaw() + \".\" + getPropertyName(), file, lineIndex);\n    }\n\n    /**\n     * Gets the toString style.\n     * @return the toString style\n     */\n    public String getToStringStyle() {\n        return toStringStyle;\n    }\n\n    /**\n     * Sets the toString style.\n     * @param toStringStyle  the toString style\n     */\n    public void setToStringStyle(String toStringStyle) {\n        this.toStringStyle = toStringStyle;\n    }\n\n    /**\n     * Resolves the toString generator.\n     * @param file  the file\n     * @param lineIndex  the line index\n     */\n    public void resolveToStringStyle(File file, int lineIndex) {\n        if (toStringStyle.equals(\"smart\")) {\n            toStringStyle = (bean.isImmutable() ? \"field\" : \"getter\");\n        }\n        if (toStringStyle.equals(\"omit\") ||\n                toStringStyle.equals(\"getter\") ||\n                toStringStyle.equals(\"field\")) {\n            return;\n        }\n        throw new BeanCodeGenException(\"Invalid toString style: \" + toStringStyle +\n                \" in \" + getBean().getTypeRaw() + \".\" + getPropertyName(), file, lineIndex);\n    }\n\n    /**\n     * Gets the setter style.\n     * @return the setter style\n     */\n    public String getSetStyle() {\n        return setStyle;\n    }\n\n    /**\n     * Sets the setter style.\n     * @param setStyle  the setter style to set\n     */\n    public void setSetStyle(String setStyle) {\n        this.setStyle = setStyle;\n    }\n\n    /**\n     * Gets the override get flag.\n     * @return the setter style\n     */\n    public boolean isOverrideGet() {\n        return overrideGet;\n    }\n\n    /**\n     * Sets the override get flag.\n     * @param overrideGet  the setter style to set\n     */\n    public void setOverrideGet(boolean overrideGet) {\n        this.overrideGet = overrideGet;\n    }\n\n    /**\n     * Gets the override get flag.\n     * @return the setter style\n     */\n    public boolean isOverrideSet() {\n        return overrideSet;\n    }\n\n    /**\n     * Sets the override get flag.\n     * @param overrideSet  the setter style to set\n     */\n    public void setOverrideSet(boolean overrideSet) {\n        this.overrideSet = overrideSet;\n    }\n\n    /**\n     * Gets the validation.\n     * @return the validation\n     */\n    public String getValidation() {\n        return validation;\n    }\n\n    /**\n     * Sets the validation.\n     * @param validation  the validation to set\n     */\n    public void setValidation(String validation) {\n        this.validation = validation;\n    }\n\n    /**\n     * Resolves validation.\n     */\n    public void resolveValidation() {\n        if (isFinal() && !getInitializer().isEmpty() && getValidation().isEmpty()) {\n            setValidation(\"notNull\");\n        }\n    }\n\n    /**\n     * Checks if the property is deprecated.\n     * @return the deprecated flag\n     */\n    public boolean isDeprecated() {\n        return deprecated;\n    }\n\n    /**\n     * Sets if the property is deprecated.\n     * @param deprecated  the deprecated to set\n     */\n    public void setDeprecated(boolean deprecated) {\n        this.deprecated = deprecated;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the first comment line.\n     * @return the first comment\n     */\n    public String getFirstComment() {\n        return firstComment;\n    }\n\n    /**\n     * Sets the first comment line.\n     * @param firstComment  the first comment to set\n     */\n    public void setFirstComment(String firstComment) {\n        this.firstComment = firstComment;\n    }\n\n    /**\n     * Gets the remaining comments.\n     * @return the remaining comments, not null\n     */\n    public List<String> getComments() {\n        return comments;\n    }\n\n    /**\n     * Gets the deprecated comment line.\n     * @return the deprecated comment\n     */\n    public String getDeprecatedComment() {\n        return deprecatedComment;\n    }\n\n    /**\n     * Sets the deprecated comment line.\n     * @param deprecatedComment  the deprecated comment to set\n     */\n    public void setDeprecatedComment(String deprecatedComment) {\n        this.deprecatedComment = deprecatedComment;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Checks if the property is parameterised with generics.\n     * @return true if generified\n     */\n    public boolean isGenericParamType() {\n        return type.contains(\"<\");\n    }\n\n    /**\n     * Checks if the property is parameterised with generics.\n     * {@code Foo<?>} will return true, {@code Foo<? extends Number> will return false}.\n     * @return true if generified\n     */\n    public boolean isGenericWildcardParamType() {\n        return type.endsWith(\"<?>\");\n    }\n\n    /**\n     * Gets the parameterisation of the property.\n     * {@code Foo<String>} will return {@code String}.\n     * @return the generic type, or a blank string if not generic, not null\n     */\n    public String getGenericParamType() {\n        var pos = type.indexOf(\"<\");\n        return pos < 0 ? \"\" : type.substring(pos + 1, type.length() - 1);\n    }\n\n    /**\n     * Checks if the type is the generic type of the bean.\n     * For example, if the property is of type T or T[] in a bean of Foo[T].\n     * @return true if matches\n     */\n    public boolean isBeanGenericType() {\n        var stripped = isArrayType() ? type.substring(0, type.length() - 2) : type;\n        return bean.isTypeGenerifiedBy(stripped);\n    }\n\n    /**\n     * Checks if the property is generic in some way.\n     * @return true if generic\n     */\n    public boolean isGeneric() {\n        return isGenericParamType() || isBeanGenericType();\n    }\n\n    /**\n     * Gets the raw type of the property without generics.\n     * {@code Foo<String>} will return {@code Foo}.\n     * @return the raw type\n     */\n    public String getTypeRaw() {\n        var pos = type.indexOf(\"<\");\n        return (pos < 0 ? type : type.substring(0, pos));\n    }\n\n    /**\n     * Gets the raw type of the property.\n     * @return the raw type\n     */\n    public String getFieldTypeRaw() {\n        var pos = fieldType.indexOf(\"<\");\n        return (pos < 0 ? fieldType : fieldType.substring(0, pos));\n    }\n\n    /**\n     * Gets the generic part of the property type.\n     * <p>\n     * For example, \"{@literal Foo<String>}\" will return \"{@literal <String>}\".\n     * \n     * @return the generic part of the type, not null\n     */\n    public String getTypeGenerics() {\n        var type = getType();\n        return type.contains(\"<\") ? type.substring(type.indexOf('<')) : \"\";\n    }\n\n    /**\n     * Gets the generic part of the property type.\n     * <p>\n     * For example, \"{@literal Foo<String>}\" will return \"String\".\n     * \n     * @return the generic part of the type, empty if not generic, not null\n     */\n    public String getTypeGenericsSimple() {\n        var type = getType();\n        return type.contains(\"<\") ? type.substring(type.indexOf('<') + 1, type.length() - 1) : \"\";\n    }\n\n    /**\n     * Gets the type of the property, erasing generics attached to the bean.\n     * {@code Foo<T>} will return {@code Foo<Number>} where {@code T extends Number}.\n     * @return the raw type\n     */\n    public String getTypeBeanErased() {\n        if (isBeanGenericType()) {\n            for (var i = 0; i < bean.getTypeGenericCount(); i++) {\n                if (type.equals(bean.getTypeGenericName(i, false))) {\n                    return bean.getTypeGenericErased(i);\n                }\n            }\n        }\n        var generic = getTypeGenericsSimple();\n        if (generic.isEmpty()) {\n            return type;\n        }\n        var tkn = new StringTokenizer(generic, \",\");\n        List<String> altered = new ArrayList<>();\n        while (tkn.hasMoreTokens()) {\n            var genericType = tkn.nextToken().trim();\n            var erased = genericType;\n            if (bean.isTypeGenerifiedBy(genericType)) {\n                for (var i = 0; i < bean.getTypeGenericCount(); i++) {\n                    if (genericType.equals(bean.getTypeGenericName(i, false))) {\n                        erased = bean.getTypeGenericErased(i);\n                    }\n                }\n            }\n            altered.add(erased);\n        }\n        return getTypeRaw() + \"<\" + String.join(\", \", altered) + \">\";\n    }\n\n    /**\n     * Checks if the property is derived.\n     * @return true if derived\n     */\n    public boolean isDerived() {\n        return fieldName == null;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Resolves the getter generator.\n     * @param file  the file\n     * @param lineIndex  the line index\n     */\n    public void resolveGetterGen(File file, int lineIndex) {\n        if (getGetStyle() == null) {\n            setGetStyle(\"\");\n        }\n        var style = getGetStyle();\n        var access = \"public\";\n        switch (style) {\n            case \"private\" -> {\n                style = \"smart\";\n                access = \"private\";\n            }\n            case \"package\" -> {\n                style = \"smart\";\n                access = \"package\";\n            }\n            case \"protected\" -> {\n                style = \"smart\";\n                access = \"protected\";\n            }\n        }\n        if (style.equals(\"get\")) {\n            getterGen = GetterGen.GetGetterGen.PUBLIC;\n        } else if (style.equals(\"is\")) {\n            getterGen = GetterGen.IsGetterGen.PUBLIC;\n        } else if (style.equals(\"smart\")) {\n            if (bean.isImmutable()) {\n                var clone = config.getImmutableGetClones().get(getFieldTypeRaw());\n                if (\"clone\".equals(clone)) {\n                    getterGen = isNotNull() ?\n                            GetterGen.CloneNNGetterGen.of(access) :\n                            GetterGen.CloneGetterGen.of(access);\n                } else if (\"cloneCast\".equals(clone)) {\n                    getterGen = isNotNull() ?\n                            GetterGen.CloneCastNNGetterGen.of(access) :\n                            GetterGen.CloneCastGetterGen.of(access);\n                } else if (\"cloneArray\".equals(clone)) {\n                    getterGen = GetterGen.CloneArrayGetterGen.of(access);\n                } else if (getType().equals(\"boolean\")) {\n                    getterGen = GetterGen.IsGetterGen.of(access);\n                } else {\n                    getterGen = GetterGen.GetGetterGen.of(access);\n                }\n            } else if (getType().equals(\"boolean\")) {\n                getterGen = GetterGen.IsGetterGen.of(access);\n            } else {\n                getterGen = GetterGen.GetGetterGen.of(access);\n            }\n        } else if (style.isEmpty()) {\n            getterGen = GetterGen.NoGetterGen.INSTANCE;\n        } else if (style.equals(\"field\")) {\n            getterGen = GetterGen.NoGetterGen.INSTANCE;\n        } else if (style.equals(\"clone\")) {\n            getterGen = isNotNull() ? GetterGen.CloneNNGetterGen.PUBLIC : GetterGen.CloneGetterGen.PUBLIC;\n        } else if (style.equals(\"cloneCast\")) {\n            getterGen = isNotNull() ? GetterGen.CloneCastNNGetterGen.PUBLIC : GetterGen.CloneCastGetterGen.PUBLIC;\n        } else if (style.equals(\"cloneArray\")) {\n            getterGen = GetterGen.CloneArrayGetterGen.PUBLIC;\n        } else if (style.equals(\"optional\")) {\n            getterGen = GetterGen.Optional8GetterGen.PUBLIC;\n        } else if (style.equals(\"optionalGuava\")) {\n            getterGen = GetterGen.OptionalGuavaGetterGen.PUBLIC;\n        } else if (style.equals(\"manual\")) {\n            getterGen = GetterGen.ManualGetterGen.INSTANCE;\n        } else {\n            throw new BeanCodeGenException(\"Unable to locate getter generator '\" + style + \"'\" +\n                    \" in \" + getBean().getTypeRaw() + \".\" + getPropertyName(), file, lineIndex);\n        }\n    }\n\n    /**\n     * Gets the getter generator.\n     * @return the getter generator\n     */\n    public GetterGen getGetterGen() {\n        return getterGen;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Resolves the setter generator.\n     * @param file  the file\n     * @param lineIndex  the line index\n     */\n    public void resolveSetterGen(File file, int lineIndex) {\n        if (getSetStyle() == null) {\n            setSetStyle(\"\");\n        }\n        var style = getSetStyle().replace(\"\\\\n\", \"\\n\");\n        var access = \"public\";\n        switch (style) {\n            case \"private\" -> {\n                style = \"smart\";\n                access = \"private\";\n            }\n            case \"package\" -> {\n                style = \"smart\";\n                access = \"package\";\n            }\n            case \"protected\" -> {\n                style = \"smart\";\n                access = \"protected\";\n            }\n        }\n        if (style.equals(\"set\")) {\n            setterGen = SetterGen.SetSetterGen.PUBLIC;\n        } else if (style.equals(\"setClearAddAll\")) {\n            setterGen = new SetterGen.PatternSetterGen(\"$field.clear();\\n$field.addAll($value);\");\n        } else if (style.equals(\"setClearPutAll\")) {\n            setterGen = new SetterGen.PatternSetterGen(\"$field.clear();\\n$field.putAll($value);\");\n        } else if (style.equals(\"bound\")) {\n            if (isFinal()) {\n                throw new IllegalArgumentException(\"Final field must not have a bound setter\");\n            } else {\n                setterGen = SetterGen.ObservableSetterGen.PUBLIC;\n                bound = true;\n            }\n        } else if (style.equals(\"cloneArray\")) {\n            setterGen = new SetterGen.PatternSetterGen(\"$field = ($type) JodaBeanUtils.cloneArray($value);\");\n        } else if (style.equals(\"smart\")) {\n            if (isDerived()) {\n                setterGen = SetterGen.NoSetterGen.INSTANCE;\n            } else if (isFinal()) {\n                if (isCollectionType()) {\n                    setterGen = new SetterGen.PatternSetterGen(\"$field.clear();\\n$field.addAll($value);\", access);\n                } else if (isMapType()) {\n                    setterGen = new SetterGen.PatternSetterGen(\"$field.clear();\\n$field.putAll($value);\", access);\n                } else {\n                    setterGen = SetterGen.NoSetterGen.INSTANCE;\n                }\n            } else {\n                setterGen = SetterGen.SetSetterGen.of(access);\n            }\n        } else if (style.isEmpty()) {\n            setterGen = SetterGen.NoSetterGen.INSTANCE;\n        } else if (style.equals(\"field\")) {\n            setterGen = SetterGen.FieldSetterGen.INSTANCE;\n        } else if (style.equals(\"manual\")) {\n            setterGen = SetterGen.NoSetterGen.INSTANCE;\n        } else if (style.contains(\"$field\") || style.contains(\"$value\")) {\n            if (style.contains(\"$field\") || style.contains(\"\\n\")) {\n                setterGen = new SetterGen.PatternSetterGen(style);\n            } else {\n                setterGen = new SetterGen.PatternSetterGen(\"$field = \" + style);\n            }\n        } else {\n            throw new BeanCodeGenException(\"Unable to locate setter generator '\" + style + \"'\" +\n                    \" in \" + getBean().getTypeRaw() + \".\" + getPropertyName(), file, lineIndex);\n        }\n    }\n\n    /**\n     * Gets the setter generator.\n     * @return the setter generator\n     */\n    public SetterGen getSetterGen() {\n        return setterGen;\n    }\n\n    /**\n     * Gets the setter scope.\n     * @return the setter scope\n     */\n    public String getSetterScope() {\n        if (getSetStyle().equals(\"private\")) {\n            return \"private\";\n        }\n        return \"public\";\n    }\n\n    /**\n     * Gets whether the property is bound.\n     * @return true if bound\n     */\n    public boolean isBound() {\n        return bound;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Resolves the copy generator.\n     * @param file  the file\n     * @param lineIndex  the line index\n     */\n    public void resolveCopyGen(File file, int lineIndex) {\n        if (getBean().isMutable() && !getBean().isBuilderScopeVisible()) {\n            return;  // no copying\n        }\n        if (config.getInvalidImmutableTypes().contains(getFieldTypeRaw())) {\n            throw new BeanCodeGenException(\"Invalid collection type for immutable bean: \" + getFieldTypeRaw() +\n                    \" in \" + getBean().getTypeRaw() + \".\" + getPropertyName(), file, lineIndex);\n        }\n        if (isDerived()) {\n            copyGen = CopyGen.NoCopyGen.INSTANCE;\n        } else {\n            var copier = config.getCopyGenerators().get(getFieldTypeRaw());\n            if (copier != null) {\n                copyGen = copier;\n            } else {\n                var clone = config.getImmutableGetClones().get(getFieldTypeRaw());\n                if (clone != null) {\n                    if (clone.equals(\"cloneCast\")) {\n                        copyGen = PatternCopyGen.CLONE_CAST;\n                    } else if (clone.equals(\"cloneArray\")) {\n                        copyGen = PatternCopyGen.CLONE_ARRAY;\n                    } else {\n                        copyGen = PatternCopyGen.CLONE;\n                    }\n                } else {\n                    copyGen = PatternCopyGen.ASSIGN;\n                }\n            }\n        }\n    }\n\n    /**\n     * Gets the copy generator.\n     * @return the copy generator\n     */\n    public CopyGen getCopyGen() {\n        return copyGen;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Resolves the copy generator.\n     */\n    public void resolveBuilderGen() {\n        if (getBean().isMutable()) {\n            if (!getBean().isBuilderScopeVisible() && !getBean().isBeanStyleLightOrMinimal()) {\n                return;  // no builder\n            }\n        }\n        if (isDerived()) {\n            builderGen = BuilderGen.NoBuilderGen.INSTANCE;\n        } else {\n            var builder = config.getBuilderGenerators().get(getFieldTypeRaw());\n            builderGen = Objects.requireNonNullElseGet(builder, BuilderGen.SimpleBuilderGen::new);\n        }\n    }\n\n    /**\n     * Gets the builder generator.\n     * @return the builder generator\n     */\n    public BuilderGen getBuilderGen() {\n        return builderGen;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Checks if this property is an array type.\n     * \n     * @return true if it is an array type\n     */\n    public boolean isArrayType() {\n        return getType().endsWith(\"[]\");\n    }\n\n    /**\n     * Checks if this property is an array type.\n     * \n     * @return true if it is an array type\n     */\n    public boolean isGenericArrayType() {\n        return getType().endsWith(\"[]\") && getType().length() == 3;\n    }\n\n    /**\n     * Checks if this property is a known collection type.\n     * \n     * @return true if it is a known collection type\n     */\n    public boolean isCollectionType() {\n        return isGeneric() && COLLECTIONS.contains(getTypeRaw());\n    }\n\n    /**\n     * Checks if this property is a known set type.\n     * \n     * @return true if it is a known set type\n     */\n    public boolean isSetType() {\n        return isGeneric() && SETS.contains(getTypeRaw());\n    }\n\n    /**\n     * Checks if this property is a known sorted set type.\n     * \n     * @return true if it is a known set type\n     */\n    public boolean isSortedSetType() {\n        return isGeneric() && SORTED_SETS.contains(getTypeRaw());\n    }\n\n    /**\n     * Checks if this property is a known map type.\n     * \n     * @return true if it is a known map type\n     */\n    public boolean isMapType() {\n        return \"FlexiBean\".equals(getType()) || (isGeneric() && MAPS.contains(getTypeRaw()));\n    }\n\n    /**\n     * Gets the read-write flag.\n     * \n     * @return the read write\n     */\n    public PropertyStyle getStyle() {\n        if (isDerived()) {\n            return PropertyStyle.DERIVED;\n        }\n        if (getBean().isImmutable()) {\n            return PropertyStyle.IMMUTABLE;\n        }\n        if (!getGetStyle().isEmpty() && !getSetStyle().isEmpty() && (getSetterGen().isSetterGenerated(this) || getSetStyle().equals(\"manual\"))) {\n            return PropertyStyle.READ_WRITE;\n        }\n        if (!getGetStyle().isEmpty()) {\n            if (bean.isBuilderScopeVisible()) {\n                return PropertyStyle.READ_ONLY_BUILDABLE;\n            } else {\n                return PropertyStyle.READ_ONLY;\n            }\n        }\n        if (!getSetStyle().isEmpty()) {\n            return PropertyStyle.WRITE_ONLY;\n        }\n        throw new RuntimeException(\"Property must have a getter or setter: \" +\n                getBean().getTypeRaw() + \".\" + getPropertyName());\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Checks if the validation is non-null.\n     * @return true if non-null\n     */\n    public boolean isValidated() {\n        return getValidation() != null && !getValidation().isEmpty();\n    }\n\n    /**\n     * Checks if the validation is non-null.\n     * @return true if non-null\n     */\n    public boolean isNotNull() {\n        return getValidation().equals(\"notNull\") ||\n                getValidation().equals(\"notEmpty\") ||\n                getValidation().equals(\"notBlank\");\n    }\n\n    /**\n     * Gets the validation non-null Javadoc.\n     * @return the non-null text\n     */\n    public String getNotNullJavadoc() {\n        return switch (getValidation()) {\n            case \"notNull\" -> \", not null\";\n            case \"notEmpty\" -> \", not empty\";\n            case \"notBlank\" -> \", not blank\";\n            default -> \"\";\n        };\n    }\n\n    /**\n     * Gets the validation method name.\n     * @return the method name\n     */\n    public String getValidationMethodName() {\n        if (!isValidated()) {\n            throw new IllegalStateException();\n        }\n        if (getValidation().equals(\"notNull\") ||\n                getValidation().equals(\"notEmpty\") ||\n                getValidation().equals(\"notBlank\")) {\n            return \"JodaBeanUtils.\" + getValidation();\n        }\n        return getValidation();  // method in bean or static\n    }\n\n    /**\n     * Gets the varargs code.\n     * \n     * @return the varargs code, null if not applicable\n     */\n    public String getVarArgsCode() {\n        return config.getImmutableVarArgs().get(getTypeRaw());\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/PropertyDefinition.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.gen;\r\n\r\nimport java.lang.annotation.ElementType;\r\nimport java.lang.annotation.Retention;\r\nimport java.lang.annotation.RetentionPolicy;\r\nimport java.lang.annotation.Target;\r\n\r\n/**\r\n * Annotation defining a property for code generation.\r\n * <p>\r\n * This annotation must be used on all private instance variables that\r\n * should be treated as properties.\r\n */\r\n@Retention(RetentionPolicy.RUNTIME)\r\n@Target(ElementType.FIELD)\r\npublic @interface PropertyDefinition {\r\n\r\n    /**\r\n     * An alternative name for the property.\r\n     * <p>\r\n     * The property can be looked up using the specified alias.\r\n     * The primary name is unaffected, and the alias is only used in certain circumstances.\r\n     * For example, {@code bean.metaProperty(\"alias\")} and {@code bean.property(\"alias\")}\r\n     * will both work, as will getting and setting via an immutable bean builder.\r\n     * <p>\r\n     * This attribute is most useful in handling change from serialized forms.\r\n     * \r\n     * @return the alias of the property, defaulted to ''\r\n     */\r\n    String alias() default \"\";\r\n\r\n    /**\r\n     * The style of the method used to query the property.\r\n     * <p>\r\n     * The style is a string describing the getter, typically used for code generation.\r\n     * By default this is 'smart' which will use the source code knowledge to determine\r\n     * what to generate. This will be a method of the form {@code isXxx()} for {@code boolean}\r\n     * and {@code getXxx()} for all other types.\r\n     * <p>\r\n     * Supported style strings are:\r\n     * <ul>\r\n     * <li>'' - do not generate any form of getter\r\n     * <li>'smart' - process intelligently - 'is' for boolean and 'get' for other types\r\n     * <li>'private' - process as per 'smart' but set scope as private\r\n     * <li>'package' - process as per 'smart' but set scope as package/default\r\n     * <li>'protected' - process as per 'smart' but set scope as protected\r\n     * <li>'is' - generates isXxx()\r\n     * <li>'get' - generates getXxx()\r\n     * <li>'clone' - generates getXxx() with a clone of the field (assumed to be of the correct type)\r\n     * <li>'cloneCast' - generates getXxx() with a clone of the field with a cast to the property type\r\n     * <li>'cloneArray' - generates getXxx() with a deep clone of the array suitable for multi-dimensional arrays\r\n     * <li>'optional' - generate getXxx() returning a Java 8 {@code Optional} wrapper around the field,\r\n     *  where the field itself is nullable instead of optional. {@code OptionalDouble}, {@code OptionalInt}\r\n     *  and {@code OptionalLong} are also handled\r\n     * <li>'optionalGuava' - generate getXxx() returning a Guava {@code Optional} wrapper around the field,\r\n     *  where the field itself is nullable instead of optional\r\n     * <li>'field' - generates direct access to the field, enabling a weird manual getter\r\n     * <li>'manual' - a method named getXxx() must be manually provided at package scope or greater\r\n     * </ul>\r\n     * \r\n     * @return the getter style, defaulted to 'smart'\r\n     */\r\n    String get() default \"smart\";\r\n\r\n    /**\r\n     * The style of the method used to mutate the property.\r\n     * <p>\r\n     * The style is a string describing the mutator, typically used for code generation.\r\n     * By default this is 'smart' which will use the source code knowledge to determine\r\n     * what to generate. This will be a method of the form {@code setXxx()} for all types unless\r\n     * the field is {@code final}. If the field is a final {@code Collection} or {@code Map}\r\n     * of a known type then a set method is generated using {@code addAll} or {@code puAll}\r\n     * <p>\r\n     * Standard style strings are:\r\n     * <ul>\r\n     * <li>'' - do not generate any form of setter\r\n     * <li>'smart' - process intelligently - uses 'set' unless final, when it will use 'setClearAddAll'\r\n     *  for common list types or 'setClearPutAll' for common map types and FlexiBean\r\n     * <li>'private' - process as per 'smart' but set scope as private\r\n     * <li>'package' - process as per 'smart' but set scope as package/default\r\n     * <li>'protected' - process as per 'smart' but set scope as protected\r\n     * <li>'set' - generates setXxx()\r\n     * <li>'setClearAddAll' - generates setXxx() using field.clear() and field.addAll(newData)\r\n     * <li>'setClearPutAll' - generates setXxx() using field.clear() and field.putAll(newData)\r\n     * <li>'cloneArray' - generates setXxx() with a deep clone of the array suitable for multi-dimensional arrays\r\n     * <li>'bound' - generates a bound property with {@code PropertyChangeSupport}\r\n     * <li>'field' - generates direct access to the field, enabling a weird manual setter\r\n     * <li>'manual' - a method named setXxx() must be manually provided at package scope or greater\r\n     * <li>a pattern, see below\r\n     * </ul>\r\n     * <p>\r\n     * A pattern can be used for special behaviour.\r\n     * The pattern is a complete piece of code.\r\n     * For example, 'new Foo($value)' or '$field = $value.clone()'.<br/>\r\n     * '$field' for the field to copy into.<br/>\r\n     * '$value' for the value to copy from.<br/>\r\n     * '$type' for the type of the field.<br/>\r\n     * '&lt;&gt;' for the generics of the type including angle brackets.<br/>\r\n     * '\\n' for a new line (all lines must then include semicolons).<br/>\r\n     * \r\n     * @return the setter style, defaulted to 'smart'\r\n     */\r\n    String set() default \"smart\";\r\n\r\n    /**\r\n     * Whether the generated getter should be declared with the {@code Override} annotation.\r\n     * <p>\r\n     * By default, the annotation is not added.\r\n     * \r\n     * @return true to override the generated get method\r\n     */\r\n    boolean overrideGet() default false;\r\n\r\n    /**\r\n     * Whether the generated setter should be declared with the {@code Override} annotation.\r\n     * <p>\r\n     * By default, the annotation is not added.\r\n     * \r\n     * @return true to override the generated set method\r\n     */\r\n    boolean overrideSet() default false;\r\n\r\n    /**\r\n     * The exposed type of the property.\r\n     * <p>\r\n     * The style is used to control the exposed type of the property in\r\n     * getters and setters, or similar.\r\n     * <p>\r\n     * This is used when the type of the field is not the same as the type\r\n     * that should be used in public methods such as getters and setters.\r\n     * <p>\r\n     * By default, the declared type will be used as the exposed type.\r\n     * \r\n     * @return the exposed type, defaulted to 'smart'\r\n     */\r\n    String type() default \"smart\";\r\n\r\n    /**\r\n     * The exposed type of the property in the builder and associated constructor.\r\n     * <p>\r\n     * The style is used to control the exposed type of the property in\r\n     * immutable builders and associated constructors, or similar.\r\n     * <p>\r\n     * This is used when the type of the field is not the same as the type\r\n     * that should be used in public methods such as builder setters.\r\n     * <p>\r\n     * By default, the declared type will be used as the exposed type.\r\n     * <p>\r\n     * This is typically used to add '? extends' to collection types.\r\n     * \r\n     * @return the builder type, defaulted to 'smart'\r\n     */\r\n    String builderType() default \"smart\";\r\n\r\n    /**\r\n     * The configuration for equals and hash code.\r\n     * <p>\r\n     * This flag controls generation of the {@code equals} and {@code hashCode} methods.\r\n     * The default is 'smart'.\r\n     * <p>\r\n     * Standard strings are:\r\n     * <ul>\r\n     * <li>'omit' - omit this property from equals and hashCode\r\n     * <li>'smart' - process intelligently, equivalent to 'field' for immutable and 'getter' for mutable\r\n     * <li>'getter' - include in equals and hashCode using the getter\r\n     * <li>'field' - include in equals and hashCode using the field\r\n     * </ul>\r\n     * \r\n     * @return the equals/hashCode style, defaulted to 'smart'\r\n     */\r\n    String equalsHashCodeStyle() default \"smart\";\r\n\r\n    /**\r\n     * The configuration for toString.\r\n     * <p>\r\n     * This flag controls generation of the {@code toString} method.\r\n     * The default is 'smart'.\r\n     * <p>\r\n     * Standard strings are:\r\n     * <ul>\r\n     * <li>'omit' - omit this property from toString\r\n     * <li>'smart' - process intelligently, equivalent to 'field' for immutable and 'getter' for mutable\r\n     * <li>'getter' - include in toString using the getter\r\n     * <li>'field' - include in toString using the field\r\n     * </ul>\r\n     * \r\n     * @return the toString style, defaulted to 'smart'\r\n     */\r\n    String toStringStyle() default \"smart\";\r\n\r\n    /**\r\n     * The validator to use.\r\n     * <p>\r\n     * The property value may be validated by specifying this attribute.\r\n     * By default no validation is performed.\r\n     * The code generator places the validation into the set method and ensures that\r\n     * new objects are validated correctly.\r\n     * <p>\r\n     * Custom validations, are written by writing a static method and referring to it.\r\n     * For example, {@code public void checkMyValue(Integer val, String propertyName) ...}\r\n     * The method generally has a {@code void} return, throwing an exception if validation fails.\r\n     * There must be two arguments, the value and the property name. The value may be the\r\n     * property type or a superclass (like Object). The property name should be a String.\r\n     * <p>\r\n     * Standard validation strings are:\r\n     * <ul>\r\n     * <li>'' - do not generate any form of validation\r\n     * <li>'notNull' - suitable for checking that the value is non-null,\r\n     *  calls JodaBeanUtils.notNull() which throws an IllegalArgumentException\r\n     * <li>'notEmpty' - suitable for checking that a string/collection/map is non-null and non-empty,\r\n     *  calls JodaBeanUtils.notEmpty() which throws an IllegalArgumentException\r\n     * <li>'notBlank' - suitable for checking that a string is non-null and non-blank,\r\n     *  calls JodaBeanUtils.notBlank() which throws an IllegalArgumentException\r\n     * <li>'{className}.{staticMethodName}' - a custom validation method, described above\r\n     * </ul>\r\n     * \r\n     * @return the validation, defaulted to ''\r\n     */\r\n    String validate() default \"\";\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/PropertyGen.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.gen;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport org.joda.beans.MetaProperty;\r\nimport org.joda.beans.Property;\r\nimport org.joda.beans.impl.direct.DirectMetaProperty;\r\n\r\n/**\r\n * A property parsed from the source file.\r\n */\r\nclass PropertyGen {\r\n\r\n    /** The data model of the property. */\r\n    private final PropertyData data;\r\n\r\n    /**\r\n     * Constructor.\r\n     * @param propData  the property data\r\n     */\r\n    PropertyGen(PropertyData propData) {\r\n        this.data = propData;\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    List<String> generateConstructorAssign(String fromBean) {\r\n        return data.getCopyGen().generateCopyToImmutable(\"\\t\\t\", fromBean, data);\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    List<String> generateMetaPropertyConstant() {\r\n        data.getBean().ensureImport(MetaProperty.class);\r\n        data.getBean().ensureImport(DirectMetaProperty.class);\r\n        var list = new ArrayList<String>();\r\n        list.add(\"\\t\\t/**\");\r\n        list.add(\"\\t\\t * The meta-property for the {@code \" + data.getPropertyName() + \"} property.\");\r\n        list.add(\"\\t\\t */\");\r\n        if (data.isBeanGenericType()) {\r\n            list.add(\"\\t\\t@SuppressWarnings({\\\"unchecked\\\", \\\"rawtypes\\\" })\");\r\n            list.add(\"\\t\\tprivate final MetaProperty<\" + propertyType() + \"> \" + data.getMetaFieldName() +\r\n                \" = (DirectMetaProperty) DirectMetaProperty.of\" + readWrite() + \"(\");\r\n            list.add(\"\\t\\t\\t\\tthis, \\\"\" + data.getPropertyName() + \"\\\", \" +\r\n                data.getBean().getTypeRaw() + \".class, \" + actualType() + \");\");\r\n        } else {\r\n            var propertyType = propertyType();\r\n            if (propertyType.length() == 1) {\r\n                propertyType = \"Object\";\r\n            }\r\n            if (data.isGenericParamType()) {\r\n                list.add(\"\\t\\t@SuppressWarnings({\\\"unchecked\\\", \\\"rawtypes\\\" })\");\r\n            }\r\n            list.add(\"\\t\\tprivate final MetaProperty<\" + propertyType + \"> \" + data.getMetaFieldName() +\r\n                \" = DirectMetaProperty.of\" + readWrite() + \"(\");\r\n            list.add(\"\\t\\t\\t\\tthis, \\\"\" + data.getPropertyName() + \"\\\", \" +\r\n                data.getBean().getTypeRaw() + \".class, \" + actualType() + \");\");\r\n        }\r\n        return list;\r\n    }\r\n\r\n    List<String> generateMetaPropertyGetCase() {\r\n        var list = new ArrayList<String>();\r\n        list.add(\"\\t\\t\\t\\tcase \" + data.getPropertyName().hashCode() + \":  // \" + data.getPropertyName());\r\n        if (data.getAlias() != null) {\r\n            list.add(\"\\t\\t\\t\\tcase \" + data.getAlias().hashCode() + \":  // \" + data.getAlias() + \" (alias)\");\r\n        }\r\n        list.add(\"\\t\\t\\t\\t\\treturn this.\" + data.getMetaFieldName() + \";\");\r\n        return list;\r\n    }\r\n\r\n    List<String> generateGetter() {\r\n        return data.getGetterGen().generateGetter(data);\r\n    }\r\n\r\n    List<String> generateSetter() {\r\n        return data.getSetterGen().generateSetter(\"\\t\", data);\r\n    }\r\n\r\n    List<String> generateProperty() {\r\n        data.getBean().ensureImport(Property.class);\r\n        var list = new ArrayList<String>();\r\n        list.add(\"\\t/**\");\r\n        list.add(\"\\t * Gets the the {@code \" + data.getPropertyName() + \"} property.\");\r\n        for (var comment : data.getComments()) {\r\n            list.add(\"\\t * \" + comment);\r\n        }\r\n        list.add(\"\\t * @return the property, not null\");\r\n        if (data.getDeprecatedComment() != null) {\r\n            list.add(\"\\t * \" + data.getDeprecatedComment());\r\n        }\r\n        list.add(\"\\t */\");\r\n        if (data.isDeprecated()) {\r\n            list.add(\"\\t@Deprecated\");\r\n        }\r\n        list.add(\"\\tpublic \" + (data.getBean().isTypeFinal() ? \"\" : \"final \") + \"Property<\" + propertyType() + \"> \" + data.getPropertyName() + \"() {\");\r\n        list.add(\"\\t\\treturn metaBean().\" + data.getPropertyName() + \"().createProperty(this);\");\r\n        list.add(\"\\t}\");\r\n        list.add(\"\");\r\n        return list;\r\n    }\r\n\r\n    List<String> generateMetaProperty() {\r\n        var list = new ArrayList<String>();\r\n        var propertyType = propertyType();\r\n        list.add(\"\\t\\t/**\");\r\n        list.add(\"\\t\\t * The meta-property for the {@code \" + data.getPropertyName() + \"} property.\");\r\n        list.add(\"\\t\\t * @return the meta-property, not null\");\r\n        if (data.getDeprecatedComment() != null) {\r\n            list.add(\"\\t\\t * \" + data.getDeprecatedComment());\r\n        }\r\n        list.add(\"\\t\\t */\");\r\n        if (data.isDeprecated()) {\r\n            list.add(\"\\t\\t@Deprecated\");\r\n        }\r\n        list.add(\"\\t\\tpublic \" + (data.getBean().isTypeFinal() ? \"\" : \"final \") + \"MetaProperty<\" + propertyType + \"> \" + data.getPropertyName() + \"() {\");\r\n        list.add(\"\\t\\t\\treturn \" + data.getMetaFieldName() + \";\");\r\n        list.add(\"\\t\\t}\");\r\n        list.add(\"\");\r\n        return list;\r\n    }\r\n\r\n    List<String> generatePropertyGetCase() {\r\n        var list = new ArrayList<String>();\r\n        list.add(\"\\t\\t\\t\\tcase \" + data.getPropertyName().hashCode() + \":  // \" + data.getPropertyName());\r\n        if (data.getAlias() != null) {\r\n            list.add(\"\\t\\t\\t\\tcase \" + data.getAlias().hashCode() + \":  // \" + data.getAlias() + \" (alias)\");\r\n        }\r\n        if (data.getStyle().isReadable()) {\r\n            list.add(\"\\t\\t\\t\\t\\treturn ((\" + data.getBean().getTypeWildcard() + \") bean).\" + data.getGetterGen().generateGetInvoke(data) + \";\");\r\n        } else {\r\n            list.add(\"\\t\\t\\t\\t\\tif (quiet) {\");\r\n            list.add(\"\\t\\t\\t\\t\\t\\treturn null;\");\r\n            list.add(\"\\t\\t\\t\\t\\t}\");\r\n            list.add(\"\\t\\t\\t\\t\\tthrow new UnsupportedOperationException(\\\"Property cannot be read: \" + data.getPropertyName() + \"\\\");\");\r\n        }\r\n        return list;\r\n    }\r\n\r\n    List<String> generatePropertySetCase() {\r\n        var list = new ArrayList<String>();\r\n        list.add(\"\\t\\t\\t\\tcase \" + data.getPropertyName().hashCode() + \":  // \" + data.getPropertyName());\r\n        if (data.getAlias() != null) {\r\n            list.add(\"\\t\\t\\t\\tcase \" + data.getAlias().hashCode() + \":  // \" + data.getAlias() + \" (alias)\");\r\n        }\r\n        var setter = data.getSetterGen().generateSetInvoke(data, castObject() + \"newValue\");\r\n        if (data.getStyle().isWritable() && setter != null) {\r\n            list.add(\"\\t\\t\\t\\t\\t((\" + data.getBean().getTypeNoExtends() + \") bean).\" + setter + \";\");\r\n            list.add(\"\\t\\t\\t\\t\\treturn;\");\r\n        } else {\r\n            list.add(\"\\t\\t\\t\\t\\tif (quiet) {\");\r\n            list.add(\"\\t\\t\\t\\t\\t\\treturn;\");\r\n            list.add(\"\\t\\t\\t\\t\\t}\");\r\n            list.add(\"\\t\\t\\t\\t\\tthrow new UnsupportedOperationException(\\\"Property cannot be written: \" + data.getPropertyName() + \"\\\");\");\r\n        }\r\n        return list;\r\n    }\r\n\r\n    String generateLambdaGetter() {\r\n        return \"b -> b.\" + data.getGetterGen().generateGetInvoke(data);\r\n    }\r\n\r\n    String generateLambdaSetter() {\r\n        var propType = propertyType(data.getTypeBeanErased());\r\n        var cast = propType.equals(\"Object\") ? \"\" : \"(\" + propType + \") \";\r\n        return \"(b, v) -> b.\" + data.getSetterGen().generateSetInvoke(data, cast + \"v\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    boolean isSpecialInit() {\r\n        return data.getBuilderGen().isSpecialInit(data);\r\n    }\r\n\r\n    String generateInit() {\r\n        return data.getBuilderGen().generateInit(data);\r\n    }\r\n\r\n    List<String> generateBuilderField() {\r\n        return data.getBuilderGen().generateField(\"\\t\\t\", data);\r\n    }\r\n\r\n    List<String> generateBuilderConstructorAssign(String beanToCopyFrom) {\r\n        return data.getCopyGen().generateCopyToMutable(\"\\t\\t\\t\", data, beanToCopyFrom);\r\n    }\r\n\r\n    List<String> generateBuilderFieldGet() {\r\n        var list = new ArrayList<String>();\r\n        list.add(\"\\t\\t\\t\\tcase \" + data.getPropertyName().hashCode() + \":  // \" + data.getPropertyName());\r\n        if (data.getAlias() != null) {\r\n            list.add(\"\\t\\t\\t\\tcase \" + data.getAlias().hashCode() + \":  // \" + data.getAlias() + \" (alias)\");\r\n        }\r\n        list.add(\"\\t\\t\\t\\t\\treturn this.\" + generateBuilderFieldName() + \";\");\r\n        return list;\r\n    }\r\n\r\n    List<String> generateBuilderFieldSet() {\r\n        var list = new ArrayList<String>();\r\n        list.add(\"\\t\\t\\t\\tcase \" + data.getPropertyName().hashCode() + \":  // \" + data.getPropertyName());\r\n        if (data.getAlias() != null) {\r\n            list.add(\"\\t\\t\\t\\tcase \" + data.getAlias().hashCode() + \":  // \" + data.getAlias() + \" (alias)\");\r\n        }\r\n        list.add(\"\\t\\t\\t\\t\\tthis.\" + generateBuilderFieldName() + \" = (\" + propertyType(getBuilderType()) + \") newValue;\");\r\n        list.add(\"\\t\\t\\t\\t\\tbreak;\");\r\n        return list;\r\n    }\r\n\r\n    String generateBuilderFieldName() {\r\n        return data.getFieldName();\r\n    }\r\n\r\n    List<String> generateBuilderSetMethod() {\r\n        var list = new ArrayList<String>();\r\n        list.add(\"\\t\\t/**\");\r\n        list.add(\"\\t\\t * Sets \" + data.getFirstComment());\r\n        for (var comment : data.getComments()) {\r\n            list.add(\"\\t\\t * \" + comment);\r\n        }\r\n        list.add(\"\\t\\t * @param \" + data.getPropertyName() + \"  the new value\" + data.getNotNullJavadoc());\r\n        list.add(\"\\t\\t * @return this, for chaining, not null\");\r\n        if (data.getDeprecatedComment() != null) {\r\n            list.add(\"\\t\\t * \" + data.getDeprecatedComment());\r\n        }\r\n        list.add(\"\\t\\t */\");\r\n        if (data.isDeprecated()) {\r\n            list.add(\"\\t\\t@Deprecated\");\r\n        }\r\n        var builderType = getBuilderType();\r\n        if (builderType.endsWith(\"[]\") && !builderType.endsWith(\"[][]\") && !builderType.equals(\"byte[]\")) {\r\n            list.add(\"\\t\\tpublic Builder\" + data.getBean().getTypeGenericName(true) + \" \" + data.getPropertyName() +\r\n                    \"(\" + builderType.substring(0, builderType.length() - 2) + \"... \" + data.getPropertyName() + \") {\");\r\n        } else {\r\n            list.add(\"\\t\\tpublic Builder\" + data.getBean().getTypeGenericName(true) + \" \" + data.getPropertyName() +\r\n                    \"(\" + builderType + \" \" + data.getPropertyName() + \") {\");\r\n        }\r\n        if (data.isValidated()) {\r\n            list.add(\"\\t\\t\\t\" + data.getValidationMethodName() + \"(\" + data.getPropertyName() + \", \\\"\" + data.getPropertyName() + \"\\\");\");\r\n        }\r\n        list.add(\"\\t\\t\\tthis.\" + generateBuilderFieldName() + \" = \" + data.getPropertyName() + \";\");\r\n        list.add(\"\\t\\t\\treturn this;\");\r\n        list.add(\"\\t\\t}\");\r\n        list.add(\"\");\r\n        generateBuilderSetCollectionMethod(list);\r\n        return list;\r\n    }\r\n\r\n    String getBuilderType() {\r\n        return data.getBuilderGen().generateType(data);\r\n    }\r\n\r\n    private void generateBuilderSetCollectionMethod(List<String> list) {\r\n        var code = data.getVarArgsCode();\r\n        if (code == null) {\r\n            return;\r\n        }\r\n        var argType = data.getTypeGenericsSimple();\r\n        if (argType.equals(\"?\")) {\r\n            argType = \"Object\";\r\n        }\r\n        if (argType.startsWith(\"? extends \")) {\r\n            argType = argType.substring(10);\r\n        }\r\n        var safeVarargs = argType.length() == 1 || argType.contains(\"<\");\r\n        // generate based on varargs\r\n        list.add(\"\\t\\t/**\");\r\n        list.add(\"\\t\\t * Sets the {@code \" + data.getPropertyName() + \"} property in the builder\");\r\n        list.add(\"\\t\\t * from an array of objects.\");\r\n        list.add(\"\\t\\t * @param \" + data.getPropertyName() + \"  the new value\" + data.getNotNullJavadoc());\r\n        list.add(\"\\t\\t * @return this, for chaining, not null\");\r\n        if (data.getDeprecatedComment() != null) {\r\n            list.add(\"\\t\\t * \" + data.getDeprecatedComment());\r\n        }\r\n        list.add(\"\\t\\t */\");\r\n        if (data.isDeprecated()) {\r\n            list.add(\"\\t\\t@Deprecated\");\r\n        }\r\n        if (safeVarargs) {\r\n            list.add(\"\\t\\t@SafeVarargs\");\r\n        }\r\n        list.add(\"\\t\\tpublic \" + (safeVarargs ? \"final \" : \"\") +\r\n                \"Builder\" + data.getBean().getTypeGenericName(true) + \" \" + data.getPropertyName() +\r\n                \"(\" + argType + \"... \" + data.getPropertyName() + \") {\");\r\n        if (code.contains(\"Arrays.asList\")) {\r\n            data.getBean().ensureImport(Arrays.class);\r\n        }\r\n        code = code.replace(\"$value\", data.getPropertyName());\r\n        code = code.replace(\"<>\", data.getTypeGenerics());\r\n        list.add(\"\\t\\t\\treturn \" + data.getPropertyName() + \"(\" + code + \");\");\r\n        list.add(\"\\t\\t}\");\r\n        list.add(\"\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    private String readWrite() {\r\n        return switch (data.getStyle()) {\r\n            case READ_WRITE -> \"ReadWrite\";\r\n            case READ_ONLY -> \"ReadOnly\";\r\n            case WRITE_ONLY -> \"WriteOnly\";\r\n            case DERIVED -> \"Derived\";\r\n            case READ_ONLY_BUILDABLE -> \"ReadOnlyBuildable\";\r\n            case IMMUTABLE -> \"Immutable\";\r\n            default -> throw new RuntimeException(\"Invalid style\");\r\n        };\r\n    }\r\n\r\n    private String actualType() {\r\n        var pt = propertyType();\r\n        if (pt.equals(data.getType())) {\r\n            var genericStart = pt.indexOf('<');\r\n            if (genericStart >= 0) {\r\n                return \"(Class) \" + pt.substring(0, genericStart) + \".class\";\r\n            }\r\n            if (data.getType().length() == 1) {\r\n                return \"Object.class\";\r\n            }\r\n            if (data.isGenericArrayType()) {\r\n                return \"Object[].class\";\r\n            }\r\n            return pt + \".class\";\r\n        }\r\n        return pt + \".TYPE\";\r\n    }\r\n\r\n    private String castObject() {\r\n        var pt = propertyType();\r\n        return \"(\" + pt + \") \";\r\n    }\r\n\r\n    private String propertyType() {\r\n        return propertyType(data.getType());\r\n    }\r\n\r\n    private String propertyType(String type) {\r\n        return switch (type) {\r\n            case \"boolean\" -> \"Boolean\";\r\n            case \"byte\" -> \"Byte\";\r\n            case \"short\" -> \"Short\";\r\n            case \"char\" -> \"Character\";\r\n            case \"int\" -> \"Integer\";\r\n            case \"long\" -> \"Long\";\r\n            case \"float\" -> \"Float\";\r\n            case \"double\" -> \"Double\";\r\n            default -> type;\r\n        };\r\n    }\r\n\r\n    PropertyData getData() {\r\n        return data;\r\n    }\r\n\r\n    // resolves awkward generics\r\n    static String resolveWildcard(String input) {\r\n        return input.equals(\"<?>\") ? \"<Object>\" : input;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/PropertyParser.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.gen;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Locale;\nimport java.util.regex.Pattern;\n\n/**\n * A property parsed from the source file.\n */\nclass PropertyParser {\n\n    /** The getter pattern. */\n    private static final Pattern ALIAS_PATTERN = Pattern.compile(\".*[ ,(]alias[ ]*[=][ ]*[\\\"]([a-zA-Z_][a-zA-Z0-9_]*)[\\\"].*\");\n    /** The getter pattern. */\n    private static final Pattern GETTER_PATTERN = Pattern.compile(\".*[ ,(]get[ ]*[=][ ]*[\\\"]([a-zA-Z-]*)[\\\"].*\");\n    /** The setter pattern. */\n    private static final Pattern SETTER_PATTERN = Pattern.compile(\".*[ ,(]set[ ]*[=][ ]*[\\\"]([ !#-~]*)[\\\"].*\");\n    /** The override pattern. */\n    private static final Pattern OVERRIDE_GET_PATTERN = Pattern.compile(\".*[ ,(]overrideGet[ ]*[=][ ]*(true|false).*\");\n    /** The override pattern. */\n    private static final Pattern OVERRIDE_SET_PATTERN = Pattern.compile(\".*[ ,(]overrideSet[ ]*[=][ ]*(true|false).*\");\n    /** The type pattern. */\n    private static final Pattern TYPE_PATTERN = Pattern.compile(\".*[ ,(]type[ ]*[=][ ]*[\\\"]([a-zA-Z0-9 ,_<>?.]*)[\\\"].*\");\n    /** The type builder pattern. */\n    private static final Pattern BUILDER_TYPE_PATTERN = Pattern.compile(\".*[ ,(]builderType[ ]*[=][ ]*[\\\"]([a-zA-Z0-9 ,_<>?.]*)[\\\"].*\");\n    /** The equalsHashCode pattern. */\n    private static final Pattern EQ_HASH_PATTERN = Pattern.compile(\".*[ ,(]equalsHashCodeStyle[ ]*[=][ ]*[\\\"]([a-zA-Z]*)[\\\"].*\");\n    /** The toString pattern. */\n    private static final Pattern TO_STR_PATTERN = Pattern.compile(\".*[ ,(]toStringStyle[ ]*[=][ ]*[\\\"]([a-zA-Z]*)[\\\"].*\");\n    /** The validation pattern. */\n    private static final Pattern VALIDATION_PATTERN = Pattern.compile(\".*[ ,(]validate[ ]*[=][ ]*[\\\"]([a-zA-Z_.]*)[\\\"].*\");\n\n    /** The bean generator. */\n    private final BeanParser beanParser;\n    /** Annotation line index for {@code PropertyDefinition} in input file. */\n    private int propertyIndex;\n    /** Annotation line index in input file. */\n    private int annotationIndex;\n    /** Field line index in input file. */\n    private int fieldIndex;\n\n    /**\n     * Constructor.\n     * @param beanParser  the bean parser\n     */\n    PropertyParser(BeanParser beanParser) {\n        this.beanParser = beanParser;\n    }\n\n    //-----------------------------------------------------------------------\n    PropertyGen parse(BeanData beanData, List<String> content, int lineIndex) {\n        propertyIndex = lineIndex;\n        annotationIndex = parseAnnotationStart(content, lineIndex);\n        fieldIndex = parseCodeIndex(content);\n        var data = new PropertyData(beanData, beanParser.getConfig(), lineIndex);\n        data.setAlias(parseAlias(content));\n        data.setGetStyle(parseGetStyle(content));\n        data.setSetStyle(parseSetStyle(content));\n        data.setOverrideGet(parseOverrideGet(content));\n        data.setOverrideSet(parseOverrideSet(content));\n        data.setTypeStyle(parseTypeStyle(content));\n        data.setBuilderTypeStyle(parseBuilderTypeStyle(content));\n        data.setEqualsHashCodeStyle(parseEqualsHashCodeStyle(content));\n        data.setToStringStyle(parseToStringStyle(content));\n        data.setValidation(parseValidation(content));\n        data.setDeprecated(parseDeprecated(content));\n        data.setFieldName(parseFieldName(content));\n        data.setPropertyName(makePropertyName(data.getFieldName()));\n        data.setUpperName(makeUpperName(data.getPropertyName()));\n        data.setFinal(parseFinal(content));\n        data.setFieldType(parseFieldType(content));\n        data.setInitializer(parseFieldInitializer(content));\n        data.resolveType();\n        data.resolveBuilderType();\n        data.resolveValidation();\n        data.resolveGetterGen(beanParser.getFile(), lineIndex);\n        data.resolveSetterGen(beanParser.getFile(), lineIndex);\n        data.resolveCopyGen(beanParser.getFile(), lineIndex);\n        data.resolveBuilderGen();\n        data.resolveEqualsHashCodeStyle(beanParser.getFile(), lineIndex);\n        data.resolveToStringStyle(beanParser.getFile(), lineIndex);\n        data.setMetaFieldName(beanParser.getFieldPrefix() + data.getPropertyName());\n        parseComments(content, data);\n        if (beanData.isBeanStyleLightOrMinimal() && beanData.isMutable() && data.getSetterGen() instanceof SetterGen.NoSetterGen) {\n            throw new IllegalArgumentException(\"Light and Minimal style beans do not support final fields when mutable\");\n        }\n        return new PropertyGen(data);\n    }\n\n    PropertyGen parseDerived(BeanData beanData, List<String> content, int lineIndex) {\n        propertyIndex = lineIndex;\n        annotationIndex = parseAnnotationStart(content, lineIndex);\n        fieldIndex = parseCodeIndex(content);\n        var data = new PropertyData(beanData, beanParser.getConfig(), lineIndex);\n        data.setGetStyle(\"manual\");\n        data.setSetStyle(\"\");\n        data.setTypeStyle(\"\");\n        data.setBuilderTypeStyle(\"\");\n        data.setDeprecated(parseDeprecated(content));\n        data.setPropertyName(parseMethodNameAsPropertyName(content));\n        data.setUpperName(makeUpperName(data.getPropertyName()));\n        data.setFieldType(parseMethodType(content));\n        data.setInitializer(parseFieldInitializer(content));\n        data.resolveType();\n        data.resolveBuilderType();\n        data.resolveValidation();\n        data.resolveGetterGen(beanParser.getFile(), lineIndex);\n        data.resolveSetterGen(beanParser.getFile(), lineIndex);\n        data.resolveCopyGen(beanParser.getFile(), lineIndex);\n        data.resolveBuilderGen();\n        data.setMetaFieldName(beanParser.getFieldPrefix() + data.getPropertyName());\n        parseComments(content, data);\n        return new PropertyGen(data);\n    }\n\n    private void parseComments(List<String> content, PropertyData data) {\n        var comments = parseComment(content, data.getPropertyName());\n        data.setFirstComment(comments.get(0));\n        data.getComments().addAll(comments.subList(1, comments.size()));\n        for (var it = data.getComments().iterator(); it.hasNext(); ) {\n            var comment = it.next();\n            if (comment.trim().startsWith(\"@deprecated\")) {\n                data.setDeprecatedComment(comment.trim());\n                data.setDeprecated(true);\n                it.remove();\n            }\n        }\n        if (data.isDeprecated() && data.getDeprecatedComment() == null) {\n            data.setDeprecatedComment(\"@deprecated Deprecated\");\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    private String makePropertyName(String name) {\n        if (name.startsWith(beanParser.getFieldPrefix())) {\n            return name.substring(beanParser.getFieldPrefix().length());\n        }\n        return name;\n    }\n\n    private String makeUpperName(String name) {\n        return name.substring(0, 1).toUpperCase(Locale.ENGLISH) + name.substring(1);\n    }\n\n    //-----------------------------------------------------------------------\n    private int parseAnnotationStart(List<String> content, int lineIndex) {\n        var currentIndex = lineIndex;\n        while (currentIndex > 0 && content.get(currentIndex - 1).trim().startsWith(\"@\")) {\n            currentIndex = currentIndex - 1;\n        }\n        return currentIndex;\n    }\n\n    private int parseCodeIndex(List<String> content) {\n        for (var index = propertyIndex; index < content.size(); index++) {\n            var line = content.get(index).trim();\n            if (!line.startsWith(\"@\")) {\n                if (line.isEmpty() ||\n                        line.startsWith(\"//\") ||\n                        (index > propertyIndex && content.get(index - 1).endsWith(\",\"))) {\n                    continue;\n                }\n                return index;\n            }\n        }\n        throw new BeanCodeGenException(\n            \"Unable to locate field for property at line \" + (propertyIndex + 1),\n            beanParser.getFile(), propertyIndex + 1);\n    }\n\n    private String parseAlias(List<String> content) {\n        var line = content.get(propertyIndex).trim();\n        var matcher = ALIAS_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"\";\n    }\n\n    private String parseGetStyle(List<String> content) {\n        var line = content.get(propertyIndex).trim();\n        var matcher = GETTER_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"smart\";\n    }\n\n    private String parseSetStyle(List<String> content) {\n        var line = content.get(propertyIndex).trim();\n        var matcher = SETTER_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"smart\";\n    }\n\n    private boolean parseOverrideGet(List<String> content) {\n        var line = content.get(propertyIndex).trim();\n        var matcher = OVERRIDE_GET_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return \"true\".equals(matcher.group(1));\n        }\n        return false;\n    }\n\n    private boolean parseOverrideSet(List<String> content) {\n        var line = content.get(propertyIndex).trim();\n        var matcher = OVERRIDE_SET_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return \"true\".equals(matcher.group(1));\n        }\n        return false;\n    }\n\n    private String parseTypeStyle(List<String> content) {\n        var line = content.get(propertyIndex).trim();\n        var matcher = TYPE_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"smart\";\n    }\n\n    private String parseBuilderTypeStyle(List<String> content) {\n        var line = content.get(propertyIndex).trim();\n        var matcher = BUILDER_TYPE_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"smart\";\n    }\n\n    private String parseEqualsHashCodeStyle(List<String> content) {\n        var line = content.get(propertyIndex).trim();\n        var matcher = EQ_HASH_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"smart\";\n    }\n    \n    private String parseToStringStyle(List<String> content) {\n        var line = content.get(propertyIndex).trim();\n        var matcher = TO_STR_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"smart\";\n    }\n    \n    private String parseValidation(List<String> content) {\n        var line = content.get(propertyIndex).trim();\n        var matcher = VALIDATION_PATTERN.matcher(line);\n        if (matcher.matches()) {\n            return matcher.group(1);\n        }\n        return \"\";\n    }\n\n    private boolean parseDeprecated(List<String> content) {\n        for (var index = annotationIndex; index < fieldIndex; index++) {\n            var line = content.get(index).trim();\n            if (line.equals(\"@Deprecated\") || line.startsWith(\"@Deprecated \")) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    //-----------------------------------------------------------------------\n    private String parseFieldName(List<String> content) {\n        var line = parseFieldDefinition(content);\n        var parts = line.split(\" \");\n        var last = parts[parts.length - 1];\n        if (last.endsWith(\";\") && last.length() > 1) {\n            return last.substring(0, last.length() - 1);\n        }\n        throw new BeanCodeGenException(\n            \"Unable to locate field name at line \" + (propertyIndex + 1), beanParser.getFile(), propertyIndex + 1);\n    }\n\n    private boolean parseFinal(List<String> content) {\n        var line = parseFieldDefinition(content);\n        var parts = line.split(\" \");\n        if (parts.length < 2) {\n            throw new BeanCodeGenException(\n                \"Unable to locate field type at line \" + (propertyIndex + 1), beanParser.getFile(), propertyIndex + 1);\n        }\n        if (parts[0].equals(\"final\") || parts[1].equals(\"final\") ||\n                (parts.length >= 3 && parts[2].equals(\"final\"))) {\n            return true;\n        }\n        return false;\n    }\n\n    private String parseFieldType(List<String> content) {\n        var line = parseFieldDefinition(content);\n        var parts = line.split(\" \");\n        if (parts.length < 2) {\n            throw new BeanCodeGenException(\n                \"Unable to locate field type at line \" + (propertyIndex + 1), beanParser.getFile(), propertyIndex + 1);\n        }\n        var partsPos = parts.length - 2;\n        var type = parts[partsPos];\n        while (true) {\n            int open = 0, openPos = 0, close = 0, closePos = 0;\n            while ((openPos = type.indexOf('<', openPos)) >= 0) {\n                open++;\n                openPos++;\n            }\n            while ((closePos = type.indexOf('>', closePos)) >= 0) {\n                close++;\n                closePos++;\n            }\n            if (open == close) {\n                break;\n            }\n            if (partsPos == 0) {\n                throw new BeanCodeGenException(\n                    \"Unable to locate field type at line \" + (propertyIndex + 1) + \", mismatched generics\",\n                    beanParser.getFile(), propertyIndex + 1);\n            }\n            partsPos--;\n            type = parts[partsPos] + \" \" + type;\n        }\n        return type;\n    }\n\n    private String parseFieldDefinition(List<String> content) {\n        var line = content.get(fieldIndex).trim();\n        if (line.contains(\"//\")) {\n            line = line.substring(0, line.indexOf(\"//\")).trim();\n        }\n        if (line.contains(\"=\")) {\n            line = line.substring(0, line.indexOf(\"=\")).trim() + \";\";\n        }\n        return line.replace(\"  \", \" \");\n    }\n\n    private String parseFieldInitializer(List<String> content) {\n        var line = content.get(fieldIndex).trim();\n        if (line.contains(\"//\")) {\n            line = line.substring(0, line.indexOf(\"//\")).trim();\n        }\n        if (line.contains(\" = \")) {\n            line = line.substring(line.indexOf(\" = \") + 3).trim();\n            if (!line.endsWith(\";\")) {\n                throw new BeanCodeGenException(\"Field line does not end with semi-colon\", beanParser.getFile(), fieldIndex);\n            }\n            return line.substring(0, line.length() - 1).trim();\n        }\n        return \"\";\n    }\n\n    //-----------------------------------------------------------------------\n    private String parseMethodNameAsPropertyName(List<String> content) {\n        var name = parseMethodDefinition(content)[1];\n        if (name.isEmpty() || !Character.isUpperCase(name.charAt(0))) {\n            throw new BeanCodeGenException(\"@DerivedProperty method name invalid: '\" + name + \"'\", beanParser.getFile(), fieldIndex);\n        }\n        return Character.toLowerCase(name.charAt(0)) + name.substring(1);\n    }\n\n    private String parseMethodType(List<String> content) {\n        var parts = parseMethodDefinition(content);\n        return parts[0];\n    }\n\n    private String[] parseMethodDefinition(List<String> content) {\n        var line = content.get(fieldIndex).trim();\n        if (line.startsWith(\"public \")) {\n            line = line.substring(7).trim();\n        } else if (line.startsWith(\"private \")) {\n            line = line.substring(8).trim();\n        } else if (line.startsWith(\"protected \")) {\n            line = line.substring(10).trim();\n        }\n        var lineEnd = \"() {\";\n        if (line.startsWith(\"abstract \")) {\n            line = line.substring(9).trim();\n            lineEnd = \"();\";\n        } else if (line.startsWith(\"final \")) {\n            line = line.substring(6).trim();\n        } else if (line.startsWith(\"static \")) {\n            throw new BeanCodeGenException(\"@DerivedProperty method cannot be static\", beanParser.getFile(), fieldIndex);\n        }\n        var getIndex = line.indexOf(\" get\");\n        if (getIndex < 0) {\n            throw new BeanCodeGenException(\"@DerivedProperty method must start with 'get'\", beanParser.getFile(), fieldIndex);\n        }\n        if (!line.endsWith(lineEnd)) {\n            throw new BeanCodeGenException(\"@DerivedProperty method must end with '\" + lineEnd + \"'\", beanParser.getFile(), fieldIndex);\n        }\n        line = line.substring(0, line.length() - lineEnd.length());\n        var split = new String[2];\n        split[0] = line.substring(0, getIndex).trim();\n        split[1] = line.substring(getIndex + 4).trim();\n        return split;\n    }\n\n    //-----------------------------------------------------------------------\n    private List<String> parseComment(List<String> content, String propertyName) {\n        List<String> comments = new ArrayList<>();\n        var commentEnd = content.get(annotationIndex - 1).trim();\n        if (commentEnd.equals(\"*/\")) {\n            var startCommentIndex = -1;\n            for (var index = annotationIndex - 1; index >= 0; index--) {\n                var line = content.get(index).trim();\n                if (line.equals(\"/**\")) {\n                    startCommentIndex = index + 1;\n                    break;\n                }\n            }\n            if (startCommentIndex == -1) {\n                throw new BeanCodeGenException(\"Unable to locate comment start at line \" + annotationIndex, beanParser.getFile(), annotationIndex);\n            }\n            if (startCommentIndex < annotationIndex - 1) {\n                for (var i = startCommentIndex; i < annotationIndex - 1; i++) {\n                    var commentLine = content.get(i).trim();\n                    if (commentLine.startsWith(\"*\")) {\n                        commentLine = commentLine.substring(1).trim();\n                    }\n                    if (!commentLine.startsWith(\"@return\") && !commentLine.startsWith(\"@param\") &&\n                        !commentLine.startsWith(\"@throws\") && !commentLine.startsWith(\"@exception\")) {\n                        comments.add(commentLine);\n                    }\n                }\n                var firstLine = comments.get(0);\n                if (!firstLine.isEmpty()) {\n                    comments.set(0, firstLine.substring(0, 1).toLowerCase(Locale.ENGLISH) + firstLine.substring(1));\n                } else {\n                    comments.remove(0);\n                }\n            }\n        } else if (commentEnd.startsWith(\"/**\") && commentEnd.endsWith(\"*/\")) {\n            var startPos = commentEnd.indexOf(\"/**\") + 3;\n            var endPos = commentEnd.lastIndexOf(\"*/\");\n            var comment = commentEnd.substring(startPos, endPos).trim();\n            if (!comment.isEmpty()) {\n                comments.add(comment.substring(0, 1).toLowerCase(Locale.ENGLISH) + comment.substring(1));\n            }\n        }\n        if (comments.isEmpty()) {\n            comments.add(\"the \" + propertyName + \".\");\n        }\n        return comments;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/SetterGen.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.gen;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n/**\r\n * A generator of set methods.\r\n */\r\nabstract class SetterGen {\r\n\r\n    /**\r\n     * Checks if a setter method is possible.\r\n     * \r\n     * @param prop  the property data, not null\r\n     * @return true if a setter is possible\r\n     */\r\n    abstract boolean isSetterGenerated(PropertyData prop);\r\n\r\n    /**\r\n     * Generates the setter method.\r\n     * \r\n     * @param indent  the indent to use, not null\r\n     * @param prop  the property data, not null\r\n     * @return the generated code, not null\r\n     */\r\n    abstract List<String> generateSetter(String indent, PropertyData prop);\r\n\r\n    /**\r\n     * Generates the setter method invocation.\r\n     * This is just the method name.\r\n     * \r\n     * @param prop  the property data, not null\r\n     * @param newValue  the new value, not null\r\n     * @return the generated code, null if no setter\r\n     */\r\n    String generateSetInvoke(PropertyData prop, String newValue) {\r\n        return \"set\" + prop.getUpperName() + \"(\" + newValue + \")\";\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    static final class SetSetterGen extends SetterGen {\r\n        static final SetSetterGen PUBLIC = new SetSetterGen(\"public \");\r\n        static final SetSetterGen PROTECTED = new SetSetterGen(\"protected \");\r\n        static final SetSetterGen PACKAGE = new SetSetterGen(\"\");\r\n        static final SetSetterGen PRIVATE = new SetSetterGen(\"private \");\r\n        private final String access;\r\n        static SetSetterGen of(String access) {\r\n            return switch (access) {\r\n                case \"private\" -> PRIVATE;\r\n                case \"package\" -> PACKAGE;\r\n                case \"protected\" -> PROTECTED;\r\n                default -> PUBLIC;\r\n            };\r\n        }\r\n        private SetSetterGen(String access) {\r\n            this.access = access;\r\n        }\r\n        @Override\r\n        boolean isSetterGenerated(PropertyData prop) {\r\n            return true;\r\n        }\r\n        @Override\r\n        List<String> generateSetter(String indent, PropertyData prop) {\r\n            var list = new ArrayList<String>();\r\n            list.add(\"\\t/**\");\r\n            list.add(\"\\t * Sets \" + prop.getFirstComment());\r\n            for (var comment : prop.getComments()) {\r\n                list.add(\"\\t * \" + comment);\r\n            }\r\n            list.add(\"\\t * @param \" + prop.getPropertyName() + \"  the new value of the property\" + prop.getNotNullJavadoc());\r\n            if (prop.getDeprecatedComment() != null) {\r\n                list.add(\"\\t * \" + prop.getDeprecatedComment());\r\n            }\r\n            list.add(\"\\t */\");\r\n            if (prop.isOverrideSet()) {\r\n                list.add(\"\\t@Override\");\r\n            }\r\n            if (prop.isDeprecated()) {\r\n                list.add(\"\\t@Deprecated\");\r\n            }\r\n            list.add(\"\\t\" + access + \"void set\" + prop.getUpperName() + \"(\" + prop.getType() +  \" \" + prop.getPropertyName() + \") {\");\r\n            if (prop.isValidated()) {\r\n                list.add(\"\\t\\t\" + prop.getValidationMethodName() + \"(\" + prop.getPropertyName() + \", \\\"\" + prop.getPropertyName() + \"\\\");\");\r\n            }\r\n            list.add(\"\\t\\tthis.\" + prop.getFieldName() + \" = \" + prop.getPropertyName() + \";\");\r\n            list.add(\"\\t}\");\r\n            list.add(\"\");\r\n            return list;\r\n        }\r\n    }\r\n\r\n    static class PatternSetterGen extends SetterGen {\r\n        private final String setPattern;\r\n        private final String access;\r\n        PatternSetterGen(String setPattern) {\r\n            this(setPattern, \"public\");\r\n        }\r\n        PatternSetterGen(String setPattern, String access) {\r\n            this.setPattern = setPattern;\r\n            this.access = (access.equals(\"package\") ? \"\" : access + ' ');\r\n        }\r\n        @Override\r\n        boolean isSetterGenerated(PropertyData prop) {\r\n            return true;\r\n        }\r\n        @Override\r\n        List<String> generateSetter(String indent, PropertyData prop) {\r\n            var list = new ArrayList<String>();\r\n            list.add(indent + \"/**\");\r\n            list.add(indent + \" * Sets \" + prop.getFirstComment());\r\n            for (var comment : prop.getComments()) {\r\n                list.add(indent + \" * \" + comment);\r\n            }\r\n            list.add(indent + \" * @param \" + prop.getPropertyName() + \"  the new value of the property\" + prop.getNotNullJavadoc());\r\n            if (prop.getDeprecatedComment() != null) {\r\n                list.add(indent + \" * \" + prop.getDeprecatedComment());\r\n            }\r\n            list.add(indent + \" */\");\r\n            if (prop.isOverrideSet()) {\r\n                list.add(\"\\t@Override\");\r\n            }\r\n            if (prop.isDeprecated()) {\r\n                list.add(indent + \"@Deprecated\");\r\n            }\r\n            list.add(indent + access + \"void set\" + prop.getUpperName() + \"(\" + prop.getType() +  \" \" + prop.getPropertyName() + \") {\");\r\n            if (prop.isValidated()) {\r\n                list.add(\"\\t\\t\" + prop.getValidationMethodName() + \"(\" + prop.getPropertyName() + \", \\\"\" + prop.getPropertyName() + \"\\\");\");\r\n            }\r\n            var split = setPattern.split(\"\\n\");\r\n            for (var line : split) {\r\n                line = line.replace(\"$field\", \"this.\" + prop.getFieldName());\r\n                line = line.replace(\"$value\", prop.getPropertyName());\r\n                line = line.replace(\"$type\", prop.getFieldType());\r\n                if (split.length == 1 && !line.endsWith(\";\")) {\r\n                    line += \";\";\r\n                }\r\n                list.add(indent + \"\\t\" + line);\r\n            }\r\n            list.add(indent + \"}\");\r\n            list.add(\"\");\r\n            return list;\r\n        }\r\n    }\r\n\r\n    static class NoSetterGen extends SetterGen {\r\n        static final SetterGen INSTANCE = new NoSetterGen();\r\n        @Override\r\n        boolean isSetterGenerated(PropertyData prop) {\r\n            return false;\r\n        }\r\n        @Override\r\n        List<String> generateSetter(String indent, PropertyData prop) {\r\n            return List.of();\r\n        }\r\n    }\r\n\r\n    static class FieldSetterGen extends SetterGen {\r\n        static final SetterGen INSTANCE = new FieldSetterGen();\r\n        @Override\r\n        boolean isSetterGenerated(PropertyData prop) {\r\n            return true;\r\n        }\r\n        @Override\r\n        List<String> generateSetter(String indent, PropertyData prop) {\r\n            return List.of();\r\n        }\r\n        @Override\r\n        String generateSetInvoke(PropertyData prop, String newValue) {\r\n            return prop.getFieldName() + \" = \" + newValue;\r\n        }\r\n    }\r\n\r\n    static class ObservableSetterGen extends SetterGen {\r\n        static final SetterGen PUBLIC = new ObservableSetterGen();\r\n        @Override\r\n        boolean isSetterGenerated(PropertyData prop) {\r\n            return true;\r\n        }\r\n        @Override\r\n        List<String> generateSetter(String indent, PropertyData prop) {\r\n            var list = new ArrayList<String>();\r\n            list.add(\"\\t/**\");\r\n            list.add(\"\\t * Sets \" + prop.getFirstComment());\r\n            for (var comment : prop.getComments()) {\r\n                list.add(\"\\t * \" + comment);\r\n            }\r\n            list.add(\"\\t * @param \" + prop.getPropertyName() + \"  the new value of the property\" + prop.getNotNullJavadoc());\r\n            if (prop.getDeprecatedComment() != null) {\r\n                list.add(\"\\t * \" + prop.getDeprecatedComment());\r\n            }\r\n            list.add(\"\\t */\");\r\n            if (prop.isOverrideSet()) {\r\n                list.add(\"\\t@Override\");\r\n            }\r\n            if (prop.isDeprecated()) {\r\n                list.add(\"\\t@Deprecated\");\r\n            }\r\n            list.add(\"\\tpublic void set\" + prop.getUpperName() + \"(\" + prop.getType() +  \" \" + prop.getPropertyName() + \") {\");\r\n            if (prop.isValidated()) {\r\n                list.add(\"\\t\\t\" + prop.getValidationMethodName() + \"(\" + prop.getPropertyName() + \", \\\"\" + prop.getPropertyName() + \"\\\");\");\r\n            }\r\n            var old = \"old\" + prop.getUpperName();\r\n            list.add(\"\\t\\t\" + prop.getFieldType() + \" \" + old + \" = this.\" + prop.getFieldName() + \";\");\r\n            list.add(\"\\t\\tthis.\" + prop.getFieldName() + \" = \" + prop.getPropertyName() + \";\");\r\n            list.add(\"\\t\\tthis.\" + prop.getConfig().getPrefix() + \"propertyChangeSupport.firePropertyChange(\\\"\" +\r\n                prop.getPropertyName() + \"\\\", \" + old + \", \" + prop.getPropertyName() + \");\");\r\n            list.add(\"\\t}\");\r\n            list.add(\"\");\r\n            return list;\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/gen/package-info.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n\n/**\n * Code generator for Joda-Beans.\n * <p>\n * The main code generator class is {@code BeanCodeGen}, which is a command line tool.\n * <p>\n * Use of the code generator is optional with Joda-Beans, but it is the most common approach.\n * The code generator is <i>regenerative</i>. It may be run again and again on the same\n * file without damaging any changes made in the \"user\" part of the file.\n * Only the \"code-generated\" part of the file will be altered by the generator.\n */\npackage org.joda.beans.gen;\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/BasicBean.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.impl;\r\n\r\nimport org.joda.beans.Bean;\r\nimport org.joda.beans.JodaBeanUtils;\r\n\r\n/**\r\n * Basic implementation of {@code Bean} intended for applications to subclass.\r\n * <p>\r\n * The subclass must provide an implementation for {@link Bean#metaBean()}.\r\n * This returns the complete definition of the bean at the meta level.\r\n */\r\npublic abstract class BasicBean implements Bean {\r\n\r\n    /**\r\n     * Clones this bean, returning an independent copy.\r\n     * \r\n     * @return the clone, not null\r\n     */\r\n    @Override\r\n    public BasicBean clone() {\r\n        return JodaBeanUtils.clone(this);\r\n    }\r\n\r\n    /**\r\n     * Checks if this bean equals another.\r\n     * <p>\r\n     * This compares the class and all the properties of the bean.\r\n     * \r\n     * @param obj  the object to compare to, null returns false\r\n     * @return true if the beans are equal\r\n     */\r\n    @Override\r\n    public boolean equals(Object obj) {\r\n        return obj == this ||\r\n                (obj instanceof Bean bean &&\r\n                        getClass() == bean.getClass() &&\r\n                        JodaBeanUtils.propertiesEqual(this, bean));\r\n    }\r\n\r\n    /**\r\n     * Returns a suitable hash code.\r\n     * <p>\r\n     * The hash code is derived from all the properties of the bean.\r\n     * \r\n     * @return a suitable hash code\r\n     */\r\n    @Override\r\n    public int hashCode() {\r\n        return getClass().hashCode() ^ JodaBeanUtils.propertiesHashCode(this);\r\n    }\r\n\r\n    /**\r\n     * Returns a string that summarises the bean.\r\n     * <p>\r\n     * The string contains the class name and properties.\r\n     * \r\n     * @return a summary string, not null\r\n     */\r\n    @Override\r\n    public String toString() {\r\n        return JodaBeanUtils.propertiesToString(this, metaBean().beanType().getSimpleName());\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/BasicBeanBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl;\n\nimport java.util.Objects;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaProperty;\n\n/**\n * Basic implementation of {@code BeanBuilder} that wraps a real bean.\n * <p>\n * This approach saves creating a temporary map, but is only suitable if the\n * bean has a no-arg constructor and allows properties to be set.\n * \n * @param <T>  the bean type\n */\npublic class BasicBeanBuilder<T extends Bean>\n        implements BeanBuilder<T> {\n\n    /**\n     * The actual target bean.\n     */\n    private final T bean;\n\n    /**\n     * Constructs the builder wrapping the target bean.\n     * \n     * @param bean  the target bean, not null\n     */\n    public BasicBeanBuilder(T bean) {\n        this.bean = Objects.requireNonNull(bean, \"bean must not be null\");\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the target bean.\n     * \n     * @return the target bean, not null\n     */\n    protected T getTargetBean() {\n        return bean;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public Object get(String propertyName) {\n        return bean.property(propertyName).get();\n    }\n\n    @Override\n    public <P> P get(MetaProperty<P> metaProperty) {\n        return metaProperty.get(bean);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public BeanBuilder<T> set(String propertyName, Object value) {\n        return set(bean.metaBean().metaProperty(propertyName), value);\n    }\n\n    @Override\n    public BeanBuilder<T> set(MetaProperty<?> metaProperty, Object value) {\n        metaProperty.set(bean, value);\n        return this;\n    }\n\n    @Override\n    public T build() {\n        validate(bean);\n        return bean;\n    }\n\n    /**\n     * Hook to allow a subclass to validate the bean.\n     * \n     * @param bean  the bean to validate, not null\n     */\n    protected void validate(T bean) {\n        // override to validate the bean\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a string that summarises the builder.\n     * \n     * @return a summary string, not null\n     */\n    @Override\n    public String toString() {\n        return \"BeanBuilder for \" + bean.metaBean().beanName();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/BasicImmutableBeanBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\n\n/**\n * Basic implementation of {@code BeanBuilder} that wraps a {@code MetaBean}.\n * <p>\n * The subclass implementation generally has concrete fields for each property.\n * This class has effectively been replaced by {@link DirectFieldsBeanBuilder}.\n * It is retained for situations where the builder is being implemented manually.\n * \n * @param <T>  the bean type\n */\npublic abstract class BasicImmutableBeanBuilder<T extends Bean>\n        implements BeanBuilder<T> {\n\n    /**\n     * The meta bean.\n     */\n    private final MetaBean meta;\n\n    /**\n     * Constructs the builder.\n     * \n     * @param meta  the meta-bean, not null\n     */\n    public BasicImmutableBeanBuilder(MetaBean meta) {\n        this.meta = meta;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public Object get(String propertyName) {\n        return get(meta.metaProperty(propertyName));\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public <P> P get(MetaProperty<P> metaProperty) {\n        return (P) get(metaProperty.name());\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public BeanBuilder<T> set(MetaProperty<?> metaProperty, Object value) {\n        set(metaProperty.name(), value);\n        return this;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a string that summarises the builder.\n     * \n     * @return a summary string, not null\n     */\n    @Override\n    public String toString() {\n        return \"BeanBuilder\";\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/BasicMetaBean.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.impl;\r\n\r\nimport org.joda.beans.MetaBean;\r\n\r\n/**\r\n * Basic implementation of {@code MetaBean}.\r\n */\r\npublic abstract class BasicMetaBean implements MetaBean {\r\n\r\n    /**\r\n     * Returns a string that summarises the meta-bean.\r\n     * \r\n     * @return a summary string, not null\r\n     */\r\n    @Override\r\n    public String toString() {\r\n        return \"MetaBean:\" + beanType().getSimpleName();\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/BasicMetaProperty.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.impl;\r\n\r\nimport org.joda.beans.MetaProperty;\r\n\r\n/**\r\n * An abstract base meta-property.\r\n * \r\n * @param <P>  the type of the property content\r\n */\r\npublic abstract class BasicMetaProperty<P> implements MetaProperty<P> {\r\n\r\n    /** The name of the property. */\r\n    private final String name;\r\n\r\n    /**\r\n     * Constructor.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     */\r\n    protected BasicMetaProperty(String propertyName) {\r\n        if (propertyName == null || propertyName.isEmpty()) {\r\n            throw new NullPointerException(\"propertyName must not be null or empty\");\r\n        }\r\n        this.name = propertyName;\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Override\r\n    public String name() {\r\n        return name;\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Override\r\n    public boolean equals(Object obj) {\r\n        return obj instanceof MetaProperty<?> other &&\r\n                name().equals(other.name()) &&\r\n                declaringType().equals(other.declaringType());\r\n    }\r\n\r\n    @Override\r\n    public int hashCode() {\r\n        return name().hashCode() ^ declaringType().hashCode();\r\n    }\r\n\r\n    /**\r\n     * Returns a string that summarises the meta-property.\r\n     * \r\n     * @return a summary string, not null\r\n     */\r\n    @Override\r\n    public String toString() {\r\n        return declaringType().getSimpleName() + \":\" + name();\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/BasicProperty.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.impl;\r\n\r\nimport java.util.Objects;\r\n\r\nimport org.joda.beans.Bean;\r\nimport org.joda.beans.MetaProperty;\r\nimport org.joda.beans.Property;\r\n\r\n/**\r\n * A property that binds a {@code Bean} to a {@code MetaProperty}.\r\n * <p>\r\n * This is the standard implementation of a property.\r\n * It defers the strategy of getting and setting the value to the meta-property.\r\n * <p>\r\n * This implementation is also a map entry to aid performance in maps.\r\n * \r\n * @param <P>  the type of the property content\r\n */\r\npublic final class BasicProperty<P> implements Property<P> {\r\n\r\n    /** The bean that the property is bound to. */\r\n    private final Bean bean;\r\n    /** The meta-property that the property is bound to. */\r\n    private final MetaProperty<P> metaProperty;\r\n\r\n    /**\r\n     * Factory to create a property avoiding duplicate generics.\r\n     * \r\n     * @param <P>  the property type\r\n     * @param bean  the bean that the property is bound to, not null\r\n     * @param metaProperty  the meta property, not null\r\n     * @return the property, not null\r\n     */\r\n    public static <P> BasicProperty<P> of(Bean bean, MetaProperty<P> metaProperty) {\r\n        return new BasicProperty<>(bean, metaProperty);\r\n    }\r\n\r\n    /**\r\n     * Creates a property binding the bean to the meta-property.\r\n     * \r\n     * @param bean  the bean that the property is bound to, not null\r\n     * @param metaProperty  the meta property, not null\r\n     */\r\n    private BasicProperty(Bean bean, MetaProperty<P> metaProperty) {\r\n        this.bean = Objects.requireNonNull(bean, \"bean must not be null\");\r\n        this.metaProperty = Objects.requireNonNull(metaProperty, \"metaProperty must not be null\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @SuppressWarnings(\"unchecked\")\r\n    @Override\r\n    public <B extends Bean> B bean() {\r\n        return (B) bean;\r\n    }\r\n\r\n    @Override\r\n    public MetaProperty<P> metaProperty() {\r\n        return metaProperty;\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Override\r\n    public boolean equals(Object obj) {\r\n        return obj == this ||\r\n                (obj instanceof Property<?> other &&\r\n                        metaProperty.equals(other.metaProperty()) &&\r\n                        Objects.equals(get(), other.get()));\r\n    }\r\n\r\n    @Override\r\n    public int hashCode() {\r\n        return metaProperty.hashCode() ^ Objects.hashCode(get());\r\n    }\r\n\r\n    /**\r\n     * Returns a string that summarises the property.\r\n     * \r\n     * @return a summary string, not null\r\n     */\r\n    @Override\r\n    public String toString() {\r\n        return metaProperty + \"=\" + get();\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/BasicPropertyMap.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.impl;\r\n\r\nimport java.util.AbstractMap;\r\nimport java.util.AbstractSet;\r\nimport java.util.Iterator;\r\nimport java.util.Map;\r\nimport java.util.Objects;\r\nimport java.util.Set;\r\n\r\nimport org.joda.beans.Bean;\r\nimport org.joda.beans.JodaBeanUtils;\r\nimport org.joda.beans.Property;\r\n\r\n/**\r\n * A standard map of properties.\r\n * <p>\r\n * This is the standard implementation of a map of properties derived from a meta-bean.\r\n */\r\npublic final class BasicPropertyMap\r\n        extends AbstractMap<String, Property<?>> {\r\n\r\n    /** The bean. */\r\n    private final Bean bean;\r\n\r\n    /**\r\n     * Factory to create a property map avoiding duplicate generics.\r\n     * \r\n     * @param bean  the bean\r\n     * @return the property map, not null\r\n     */\r\n    public static BasicPropertyMap of(Bean bean) {\r\n        return new BasicPropertyMap(bean);\r\n    }\r\n\r\n    /**\r\n     * Creates a property map.\r\n     * \r\n     * @param bean  the bean that the property is bound to, not null\r\n     */\r\n    private BasicPropertyMap(Bean bean) {\r\n        this.bean = Objects.requireNonNull(bean, \"bean must not be null\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Override\r\n    public int size() {\r\n        return bean.metaBean().metaPropertyCount();\r\n    }\r\n\r\n    @Override\r\n    public boolean containsKey(Object obj) {\r\n        return obj instanceof String str && bean.metaBean().metaPropertyExists(str);\r\n    }\r\n\r\n    @Override\r\n    public Property<?> get(Object obj) {\r\n        return containsKey(obj) ? bean.metaBean().metaProperty(obj.toString()).createProperty(bean) : null;\r\n    }\r\n\r\n    @Override\r\n    public Set<String> keySet() {\r\n        return bean.metaBean().metaPropertyMap().keySet();\r\n    }\r\n\r\n    @Override\r\n    public Set<Entry<String, Property<?>>> entrySet() {\r\n        return new AbstractSet<>() {\r\n            // TODO: possibly override contains()\r\n            @Override\r\n            public int size() {\r\n                return bean.metaBean().metaPropertyCount();\r\n            }\r\n            @Override\r\n            public Iterator<Entry<String, Property<?>>> iterator() {\r\n                var it = bean.metaBean().metaPropertyMap().values().iterator();\r\n                return new Iterator<>() {\r\n                    @Override\r\n                    public boolean hasNext() {\r\n                        return it.hasNext();\r\n                    }\r\n                    @Override\r\n                    public Entry<String, Property<?>> next() {\r\n                        var meta = it.next();\r\n                        return Map.entry(meta.name(), BasicProperty.of(bean, meta));\r\n                    }\r\n                    @Override\r\n                    public void remove() {\r\n                        throw new UnsupportedOperationException(\"Unmodifiable\");\r\n                    }\r\n                };\r\n            }\r\n        };\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Flattens the contents of this property map to a {@code Map}.\r\n     * <p>\r\n     * The returned map will contain all the properties from the bean with their actual values.\r\n     * \r\n     * @return the unmodifiable map of property name to value, not null\r\n     */\r\n    public Map<String, Object> flatten() {\r\n        return JodaBeanUtils.flatten(bean);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/BufferingBeanBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl;\n\nimport java.util.Objects;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentMap;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\n\n/**\n * Implementation of {@code BeanBuilder} that buffers data in a local map.\n * <p>\n * This is useful for cases where the builder data might be manipulated before\n * the final build. The buffer can be directly mutated.\n * \n * @param <T>  the bean type\n */\npublic class BufferingBeanBuilder<T extends Bean>\n        implements BeanBuilder<T> {\n\n    /**\n     * The target meta-bean.\n     */\n    private final MetaBean metaBean;\n    /**\n     * The buffered data.\n     */\n    private final ConcurrentMap<MetaProperty<?>, Object> buffer = new ConcurrentHashMap<>();\n\n    //-----------------------------------------------------------------------\n    /**\n     * Constructs the builder wrapping the target bean.\n     * \n     * @param metaBean  the target meta-bean, not null\n     * @return a new untyped builder, not null\n     */\n    public static BufferingBeanBuilder<?> of(MetaBean metaBean) {\n        return new BufferingBeanBuilder<>(metaBean);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Constructs the builder wrapping the target bean.\n     * \n     * @param metaBean  the target meta-bean, not null\n     */\n    public BufferingBeanBuilder(MetaBean metaBean) {\n        this.metaBean = Objects.requireNonNull(metaBean, \"metaBean must not be null\");\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the meta-beans.\n     * \n     * @return the meta-bean, not null\n     */\n    public MetaBean getMetaBean() {\n        return metaBean;\n    }\n\n    /**\n     * Gets the buffer holding the state of the builder.\n     * <p>\n     * The buffer may be mutated.\n     * \n     * @return the mutable buffer, not null\n     */\n    public ConcurrentMap<MetaProperty<?>, Object> getBuffer() {\n        return buffer;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the buffered value associated with the specified property name.\n     * \n     * @param propertyName  the property name, not null\n     * @return the current value in the builder, null if not found or value is null\n     */\n    @Override\n    public Object get(String propertyName) {\n        return get(getMetaBean().metaProperty(propertyName));\n    }\n\n    /**\n     * Gets the buffered value associated with the specified property name.\n     * \n     * @param metaProperty  the meta-property, not null\n     * @return the current value in the builder, null if not found or value is null\n     */\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public <P> P get(MetaProperty<P> metaProperty) {\n        return (P) getBuffer().get(metaProperty);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public BeanBuilder<T> set(String propertyName, Object value) {\n        return set(getMetaBean().metaProperty(propertyName), value);\n    }\n\n    @Override\n    public BeanBuilder<T> set(MetaProperty<?> metaProperty, Object value) {\n        if (value != null) {\n            // ConcurrentHashMap does not allow null values and setting to null is equivalent to not setting\n            getBuffer().put(metaProperty, value);\n        }\n        return this;\n    }\n\n    @Override\n    public T build() {\n        @SuppressWarnings(\"unchecked\")\n        var builder = (BeanBuilder<T>) getMetaBean().builder();\n        for (var entry : getBuffer().entrySet()) {\n            builder.set(entry.getKey(), entry.getValue());\n        }\n        return builder.build();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a string that summarises the builder.\n     * \n     * @return a summary string, not null\n     */\n    @Override\n    public String toString() {\n        return \"BeanBuilder for \" + metaBean.beanName();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/RecordBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl;\n\nimport java.lang.invoke.MethodHandles;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\n\n/**\n * A bean that is implemented using the record language feature.\n * <p>\n * Simply add {@code implements RecordBean<MyRecord>} to the record to turn it into a bean.\n * There is no need to add annotations. Derived properties are not supported.\n * <p>\n * For public records, this is the approach to use:.\n * {@snippet lang=\"java\":\n *  public static record StringIntPair(String first, int second) implements RecordBean<StrngIntPair> {\n *  }\n * }\n * <p>\n * For non-public records, this is the approach to use:\n * {@snippet lang=\"java\":\n *  private static record StringLongPair(String first, long second) implements RecordBean<StringLongPair> {\n *    static {\n *      RecordBean.register(StringLongPair.class, MethodHandles.lookup());\n *    }\n *  }\n * }\n * <p>\n * Note that a public record within a module that doesn't export the record will need to adopt the\n * non-public approach.\n * \n * @param <T> the record bean type\n * @since 3.0.0\n */\npublic interface RecordBean<T extends RecordBean<T>> extends ImmutableBean {\n\n    /**\n     * Registers a meta-bean for the specified record.\n     * <p>\n     * See the class-level Javadoc to understand when this method should be used.\n     * <p>\n     * Note that this method must only be called once for each class, and never concurrently.\n     * If you follow one of the two patterns in the class-level Javadoc everything will be fine.\n     * \n     * @param <T>  the type of the record\n     * @param recordClass  the record class, not null\n     * @param lookup  the lookup object, granting permission to non-accessible methods\n     * @return the meta-bean\n     * @throws RuntimeException if unable to register the record\n     */\n    public static <T extends Record & ImmutableBean> MetaBean register(Class<T> recordClass, MethodHandles.Lookup lookup) {\n        JodaBeanUtils.notNull(recordClass, \"recordClass\");\n        JodaBeanUtils.notNull(lookup, \"lookup\");\n        validateRecordClass(recordClass);\n        var metaBean = new RecordMetaBean<>(recordClass, lookup);\n        MetaBean.register(metaBean);\n        return metaBean;\n    }\n\n    // Class could be erased, thus we double-check it\n    private static <T extends Record & ImmutableBean> void validateRecordClass(Class<T> recordClass) {\n        if (!recordClass.isRecord()) {\n            throw new IllegalArgumentException(\n                    \"RecordBean can only be used with records: \" + recordClass.getName());\n        }\n        if (!ImmutableBean.class.isAssignableFrom(recordClass)) {\n            throw new IllegalArgumentException(\n                    \"RecordBean can only be used with classes that implement ImmutableBean: \" + recordClass.getName());\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public default TypedMetaBean<T> metaBean() {\n        return (TypedMetaBean<T>) MetaBean.of(getClass());\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/RecordBeanBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.MetaProperty;\n\n/**\n * The RecordBean bean builder.\n * \n * @param <T>  the record bean type\n */\nfinal class RecordBeanBuilder<T extends ImmutableBean> implements BeanBuilder<T> {\n\n    private final RecordMetaBean<T> metaBean;\n    private final Object[] data;\n\n    RecordBeanBuilder(RecordMetaBean<T> metaBean, Object[] data) {\n        this.metaBean = metaBean;\n        this.data = data;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public Object get(String propertyName) {\n        return data[metaBean.index(propertyName)];\n    }\n\n    @Override\n    public <P> P get(MetaProperty<P> metaProperty) {\n        return metaProperty.propertyType().cast(get(metaProperty.name()));\n    }\n\n    @Override\n    public BeanBuilder<T> set(String propertyName, Object value) {\n        data[metaBean.index(propertyName)] = value;\n        return this;\n    }\n\n    @Override\n    public BeanBuilder<T> set(MetaProperty<?> metaProperty, Object value) {\n        return set(metaProperty.name(), value);\n    }\n\n    @Override\n    public T build() {\n        return metaBean.build(data);\n    }\n\n    /**\n     * Returns a string that summarises the builder.\n     * \n     * @return a summary string, not null\n     */\n    @Override\n    public String toString() {\n        return \"BeanBuilder: \" + metaBean.beanType().getSimpleName();\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/RecordMetaBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl;\n\nimport java.lang.invoke.MethodHandle;\nimport java.lang.invoke.MethodHandles;\nimport java.lang.invoke.MethodHandles.Lookup;\nimport java.lang.invoke.MethodType;\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.RecordComponent;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.LinkedHashMap;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.TypedMetaBean;\n\n/**\n * A meta-bean for beans implemented using the record language feature.\n * \n * @param <T>  the record bean type\n */\nfinal class RecordMetaBean<T extends ImmutableBean> extends BasicMetaBean implements TypedMetaBean<T> {\n\n    private static final MethodType GETTER_METHOD_TYPE = MethodType.methodType(Object.class, Bean.class);\n\n    private final Class<T> beanType;\n    private final Map<String, RecordMetaProperty<?>> metaPropertyMap;\n    private final MethodHandle constructorHandle;\n\n    RecordMetaBean(Class<T> beanType, MethodHandles.Lookup lookup) {\n        JodaBeanUtils.notNull(beanType, \"beanType\");\n        JodaBeanUtils.notNull(lookup, \"lookup\");\n        this.beanType = beanType;\n        var recordComponents = beanType.getRecordComponents();\n        var paramTypes = new Class<?>[recordComponents.length];\n        var properties = LinkedHashMap.<String, RecordMetaProperty<?>>newLinkedHashMap(recordComponents.length);\n        for (int i = 0; i < recordComponents.length; i++) {\n            var name = recordComponents[i].getName();\n            paramTypes[i] = recordComponents[i].getType();\n            var getterHandle = findGetterHandle(recordComponents[i], lookup);\n            properties.put(name, new RecordMetaProperty<Object>(this, recordComponents[i], getterHandle, i));\n        }\n        try {\n            var constructor = beanType.getDeclaredConstructor(paramTypes);\n            this.constructorHandle = findConstructorHandle(beanType, lookup, constructor);\n        } catch (NoSuchMethodException ex) {\n            throw new IllegalArgumentException(\"Invalid record\", ex);\n        }\n        this.metaPropertyMap = Collections.unmodifiableMap(properties);\n    }\n\n    // finds the getter handle\n    private MethodHandle findGetterHandle(RecordComponent recordComponent, Lookup lookup) {\n        try {\n            var handle = lookup.unreflect(recordComponent.getAccessor());\n            return handle.asType(GETTER_METHOD_TYPE);\n        } catch (IllegalAccessException ex) {\n            throw new IllegalArgumentException(\"Invalid record, method cannot be accessed: \" + recordComponent.getName(), ex);\n        }\n    }\n\n    // finds constructor which matches types exactly\n    private static MethodHandle findConstructorHandle(\n            Class<?> beanType,\n            MethodHandles.Lookup lookup,\n            Constructor<?> constructor) {\n\n        try {\n            // spreader allows an Object[] to invoke the positional arguments\n            var constructorType = MethodType.methodType(Void.TYPE, constructor.getParameterTypes());\n            var baseHandle = lookup.findConstructor(beanType, constructorType)\n                    .asSpreader(Object[].class, constructor.getParameterTypes().length);\n            // change the return type so caller can use invokeExact() - this is the erased type of T\n            return baseHandle.asType(baseHandle.type().changeReturnType(ImmutableBean.class));\n        } catch (NoSuchMethodException ex) {\n            throw new IllegalArgumentException(\"Invalid record, constructor cannot be found: \" + beanType.getSimpleName());\n        } catch (IllegalAccessException ex) {\n            throw new IllegalArgumentException(\"Invalid record, constructor cannot be accessed: \" + beanType.getSimpleName());\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    // finds the index of a property\n    int index(String propertyName) {\n        var metaProperty = metaPropertyMap.get(propertyName);\n        if (metaProperty == null) {\n            throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n        }\n        return metaProperty.getConstructorIndex();\n    }\n\n    // builds a new instance\n    T build(Object[] data) {\n        try {\n            return (T) constructorHandle.invokeExact(data);\n        } catch (Error ex) {\n            throw ex;\n        } catch (Throwable ex) {\n            throw new IllegalArgumentException(\n                    \"Bean cannot be created: \" + beanName() + \" from \" + Arrays.toString(data), ex);\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    @Override\n    public boolean isBuildable() {\n        return true;\n    }\n\n    @Override\n    public BeanBuilder<T> builder() {\n        var data = new Object[metaPropertyMap.size()];\n        return new RecordBeanBuilder<>(this, data);\n    }\n\n    @Override\n    public Class<T> beanType() {\n        return beanType;\n    }\n\n    @SuppressWarnings({\"rawtypes\", \"unchecked\"})\n    @Override\n    public Map<String, MetaProperty<?>> metaPropertyMap() {\n        return (Map) metaPropertyMap;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/RecordMetaProperty.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.invoke.MethodHandle;\nimport java.lang.reflect.RecordComponent;\nimport java.lang.reflect.Type;\nimport java.util.List;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.PropertyStyle;\n\nimport com.google.common.collect.ImmutableList;\n\n/**\n * The RecordBean meta-property.\n * \n * @param <P>  the property type\n */\nfinal class RecordMetaProperty<P> implements MetaProperty<P> {\n\n    private final MetaBean metaBean;\n    private final RecordComponent recordComponent;\n    private final MethodHandle getterHandle;\n    private final int constructorIndex;\n\n    RecordMetaProperty(\n            MetaBean metaBean,\n            RecordComponent recordComponent,\n            MethodHandle getterHandle,\n            int constructorIndex) {\n\n        this.metaBean = metaBean;\n        this.recordComponent = recordComponent;\n        this.getterHandle = getterHandle;\n        this.constructorIndex = constructorIndex;\n    }\n\n    //-------------------------------------------------------------------------\n    @Override\n    public MetaBean metaBean() {\n        return metaBean;\n    }\n\n    @Override\n    public String name() {\n        return recordComponent.getName();\n    }\n\n    @Override\n    public Class<?> declaringType() {\n        return recordComponent.getDeclaringRecord();\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public Class<P> propertyType() {\n        return (Class<P>) recordComponent.getType();\n    }\n\n    @Override\n    public Type propertyGenericType() {\n        return recordComponent.getGenericType();\n    }\n\n    @Override\n    public PropertyStyle style() {\n        return PropertyStyle.IMMUTABLE;\n    }\n\n    @Override\n    public List<Annotation> annotations() {\n        return ImmutableList.copyOf(recordComponent.getAnnotations());\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public P get(Bean bean) {\n        try {\n            return (P) getterHandle.invokeExact(bean);\n        } catch (Throwable ex) {\n            throw new RuntimeException(\"Property cannot be read: \" + name(), ex);\n        }\n    }\n\n    @Override\n    public void set(Bean bean, Object value) {\n        throw new UnsupportedOperationException(\"Property cannot be written: \" + name());\n    }\n\n    //-------------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        return obj instanceof MetaProperty<?> other &&\n                name().equals(other.name()) &&\n                declaringType().equals(other.declaringType());\n    }\n\n    @Override\n    public int hashCode() {\n        return name().hashCode() ^ declaringType().hashCode();\n    }\n\n    /**\n     * Returns a string that summarises the meta-property.\n     * \n     * @return a summary string, not null\n     */\n    @Override\n    public String toString() {\n        return declaringType().getSimpleName() + \":\" + name();\n    }\n\n    int getConstructorIndex() {\n        return constructorIndex;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/StandaloneMetaProperty.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Objects;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.PropertyStyle;\n\n/**\n * A meta-property that exists separate from a bean.\n * <p>\n * One use case for this is to handle renamed properties in {@code SerDeserializer}.\n * \n * @param <P>  the type of the property content\n */\npublic final class StandaloneMetaProperty<P> extends BasicMetaProperty<P> {\n\n    /**\n     * The meta-bean, which does not have to refer to this property.\n     */\n    private final MetaBean metaBean;\n    /**\n     * The type of the property.\n     */\n    private final Class<P> propertyType;\n    /**\n     * The type of the property.\n     */\n    private final Type type;\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates a non-generified property.\n     * \n     * @param <R>  the property type\n     * @param propertyName  the property name, not empty\n     * @param metaBean  the meta-bean, which does not have to refer to this property, not null\n     * @param propertyType  the type of the property, not null\n     * @return the meta-property, not null\n     */\n    public static <R> StandaloneMetaProperty<R> of(String propertyName, MetaBean metaBean, Class<R> propertyType) {\n        return new StandaloneMetaProperty<>(propertyName, metaBean, propertyType, propertyType);\n    }\n\n    /**\n     * Creates a property.\n     * \n     * @param <R>  the property type\n     * @param propertyName  the property name, not empty\n     * @param metaBean  the meta-bean, which does not have to refer to this property, not null\n     * @param propertyType  the type of the property, not null\n     * @param type  the type of the property, not null\n     * @return the meta-property, not null\n     */\n    public static <R> StandaloneMetaProperty<R> of(String propertyName, MetaBean metaBean, Class<R> propertyType, Type type) {\n        return new StandaloneMetaProperty<>(propertyName, metaBean, propertyType, type);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates an instance.\n     * \n     * @param propertyName  the property name, not empty\n     * @param metaBean  the meta-bean, which does not have to refer to this property, not null\n     * @param propertyType  the type of the property, not null\n     * @param type  the type of the property, not null\n     */\n    private StandaloneMetaProperty(String propertyName, MetaBean metaBean, Class<P> propertyType, Type type) {\n        super(propertyName);\n        Objects.requireNonNull(metaBean, \"metaBean must not be null\");\n        Objects.requireNonNull(propertyType, \"propertyType must not be null\");\n        Objects.requireNonNull(type, \"type must not be null\");\n        this.metaBean = metaBean;\n        this.propertyType = propertyType;\n        this.type = type;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MetaBean metaBean() {\n        return metaBean;\n    }\n\n    @Override\n    public Class<?> declaringType() {\n        return metaBean().beanType();\n    }\n\n    @Override\n    public Class<P> propertyType() {\n        return propertyType;\n    }\n\n    @Override\n    public Type propertyGenericType() {\n        return type;\n    }\n\n    @Override\n    public PropertyStyle style() {\n        return PropertyStyle.READ_WRITE;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public List<Annotation> annotations() {\n        return Collections.emptyList();\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public P get(Bean bean) {\n        return propertyType.cast(metaBean().metaProperty(name()).get(bean));\n    }\n\n    @Override\n    public void set(Bean bean, Object value) {\n        metaBean().metaProperty(name()).set(bean, value);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/direct/DirectBean.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.impl.direct;\r\n\r\nimport org.joda.beans.Bean;\r\n\r\n/**\r\n * A bean implementation designed for use by the code generator.\r\n * <p>\r\n * It used to be mandatory for code generated beans to extend this class.\r\n * Now, beans can simply implement the {@code Bean} interface.\r\n */\r\npublic abstract class DirectBean implements Bean {\r\n\r\n    @Override\r\n    public abstract DirectBean clone();\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/direct/DirectBeanBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl.direct;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.impl.BasicBeanBuilder;\n\n/**\n * A builder implementation designed for use by the code generator.\n * <p>\n * This implementation adds validation on top of basic builder functionality.\n * \n * @param <T> the bean type\n */\npublic class DirectBeanBuilder<T extends Bean> extends BasicBeanBuilder<T> {\n\n    /**\n     * Constructs the builder wrapping the target bean.\n     * \n     * @param bean  the target bean, not null\n     */\n    public DirectBeanBuilder(T bean) {\n        super(bean);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    protected void validate(T bean) {\n        ((DirectMetaBean) bean.metaBean()).validate(bean);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/direct/DirectFieldsBeanBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl.direct;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.test.JodaBeanTests;\n\n/**\n * A builder implementation designed for use by the code generator.\n * <p>\n * This implementation is intended to have fields generated in the subclass.\n * \n * @param <T> the bean type\n */\npublic abstract class DirectFieldsBeanBuilder<T extends Bean>\n        implements BeanBuilder<T> {\n\n    /**\n     * Constructs the builder.\n     */\n    protected DirectFieldsBeanBuilder() {\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public Object get(String propertyName) {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public <P> P get(MetaProperty<P> metaProperty) {\n        return (P) get(metaProperty.name());\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public BeanBuilder<T> set(MetaProperty<?> metaProperty, Object value) {\n        try {\n            set(metaProperty.name(), value);\n            return this;\n        } catch (RuntimeException ex) {\n            if (value == JodaBeanTests.TEST_COVERAGE_STRING) {\n                return this;\n            }\n            throw ex;\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a string that summarises the builder.\n     * \n     * @return a summary string, not null\n     */\n    @Override\n    public String toString() {\n        return \"BeanBuilder\";\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/direct/DirectMetaBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl.direct;\n\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.impl.StandaloneMetaProperty;\nimport org.joda.beans.test.JodaBeanTests;\n\n/**\n * A meta-bean implementation designed for use by the code generator.\n */\npublic abstract class DirectMetaBean implements MetaBean {\n    // overriding other methods has negligible effect considering DirectMetaPropertyMap\n\n    /**\n     * This constant can be used to pass into {@code setString()} to increase test coverage.\n     */\n    public static final String TEST_COVERAGE_STRING = \"!ConstantUsedForTestCoveragePurposes!\";\n\n    @Override\n    public boolean isBuildable() {\n        return true;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public <R> MetaProperty<R> metaProperty(String propertyName) {\n        var mp = metaPropertyGet(propertyName);\n        if (mp == null) {\n            return metaPropertyNotFound(propertyName);\n        }\n        return (MetaProperty<R>) mp;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private <R> MetaProperty<R> metaPropertyNotFound(String propertyName) {\n        if (propertyName == JodaBeanTests.TEST_COVERAGE_PROPERTY) {\n            // cast is unsafe unless R is String, but code only used in test coverage scenarios\n            return (MetaProperty<R>) StandaloneMetaProperty.of(propertyName, this, String.class);\n        }\n        throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n    }\n\n    /**\n     * Gets the meta-property by name.\n     * <p>\n     * This implementation returns null, and must be overridden in subclasses.\n     * \n     * @param propertyName  the property name, not null\n     * @return the meta-property, null if not found\n     */\n    protected MetaProperty<?> metaPropertyGet(String propertyName) {\n        return null;\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Gets the value of the property.\n     * \n     * @param bean  the bean to query, not null\n     * @param propertyName  the property name, not null\n     * @param quiet  true to return null if unable to read\n     * @return the value of the property, may be null\n     * @throws NoSuchElementException if the property name is invalid\n     */\n    protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n        // used to enable 100% test coverage in beans\n        if (quiet) {\n            return null;\n        }\n        throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n    }\n\n    /**\n     * Sets the value of the property.\n     * \n     * @param bean  the bean to update, not null\n     * @param propertyName  the property name, not null\n     * @param value  the value of the property, may be null\n     * @param quiet  true to take no action if unable to write\n     * @throws NoSuchElementException if the property name is invalid\n     */\n    protected void propertySet(Bean bean, String propertyName, Object value, boolean quiet) {\n        // used to enable 100% test coverage in beans\n        if (quiet) {\n            return;\n        }\n        throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n    }\n\n    /**\n     * Validates the values of the properties.\n     * \n     * @param bean  the bean to validate, not null\n     * @throws RuntimeException if a property is invalid\n     */\n    protected void validate(Bean bean) {\n    }\n\n    /**\n     * Returns a string that summarises the meta-bean.\n     * \n     * @return a summary string, not null\n     */\n    @Override\n    public String toString() {\n        return \"MetaBean:\" + beanType().getSimpleName();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/direct/DirectMetaProperty.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.impl.direct;\r\n\r\nimport java.lang.annotation.Annotation;\r\nimport java.lang.reflect.AccessibleObject;\r\nimport java.lang.reflect.Field;\r\nimport java.lang.reflect.Method;\r\nimport java.lang.reflect.Modifier;\r\nimport java.lang.reflect.Type;\r\nimport java.util.Arrays;\r\nimport java.util.Collections;\r\nimport java.util.List;\r\nimport java.util.Locale;\r\nimport java.util.NoSuchElementException;\r\nimport java.util.Objects;\r\nimport java.util.Optional;\r\nimport java.util.function.Function;\r\n\r\nimport org.joda.beans.Bean;\r\nimport org.joda.beans.MetaBean;\r\nimport org.joda.beans.PropertyStyle;\r\nimport org.joda.beans.ResolvedType;\r\nimport org.joda.beans.impl.BasicMetaProperty;\r\n\r\n/**\r\n * A meta-property implementation designed for use by the code generator.\r\n * <p>\r\n * This meta-property uses reflection to find the {@code Field} to obtain the annotations.\r\n * \r\n * @param <P>  the type of the property content\r\n */\r\npublic final class DirectMetaProperty<P> extends BasicMetaProperty<P> {\r\n\r\n    /** The meta-bean. */\r\n    private final MetaBean metaBean;\r\n    /** The property type. */\r\n    private final Class<P> propertyType;\r\n    /** The property generic type. */\r\n    private final Type propertyGenericType;\r\n    /** The function to create the resolved type of the property. */\r\n    private final Function<Class<?>, ResolvedType> propertyResolvedTypeFn;\r\n    /** The declaring type. */\r\n    private final Class<?> declaringType;\r\n    /** The field or method implementing the property. */\r\n    private final AccessibleObject fieldOrMethod;\r\n    /** The style. */\r\n    private final PropertyStyle style;\r\n\r\n    /**\r\n     * Factory to create a read-write meta-property avoiding duplicate generics.\r\n     * \r\n     * @param <P>  the property type\r\n     * @param metaBean  the meta-bean, not null\r\n     * @param propertyName  the property name, not empty\r\n     * @param declaringType  the type declaring the property, not null\r\n     * @param propertyType  the property type, not null\r\n     * @return the property, not null\r\n     */\r\n    public static <P> DirectMetaProperty<P> ofReadWrite(\r\n            MetaBean metaBean, String propertyName, Class<?> declaringType, Class<P> propertyType) {\r\n        var field = findField(metaBean, propertyName);\r\n        return new DirectMetaProperty<>(metaBean, propertyName, declaringType, propertyType, PropertyStyle.READ_WRITE, field);\r\n    }\r\n\r\n    /**\r\n     * Factory to create a read-only meta-property avoiding duplicate generics.\r\n     * \r\n     * @param <P>  the property type\r\n     * @param metaBean  the meta-bean, not null\r\n     * @param propertyName  the property name, not empty\r\n     * @param declaringType  the type declaring the property, not null\r\n     * @param propertyType  the property type, not null\r\n     * @return the property, not null\r\n     */\r\n    public static <P> DirectMetaProperty<P> ofReadOnly(\r\n            MetaBean metaBean, String propertyName, Class<?> declaringType, Class<P> propertyType) {\r\n        var field = findField(metaBean, propertyName);\r\n        return new DirectMetaProperty<>(metaBean, propertyName, declaringType, propertyType, PropertyStyle.READ_ONLY, field);\r\n    }\r\n\r\n    /**\r\n     * Factory to create a write-only meta-property avoiding duplicate generics.\r\n     * \r\n     * @param <P>  the property type\r\n     * @param metaBean  the meta-bean, not null\r\n     * @param propertyName  the property name, not empty\r\n     * @param declaringType  the type declaring the property, not null\r\n     * @param propertyType  the property type, not null\r\n     * @return the property, not null\r\n     */\r\n    public static <P> DirectMetaProperty<P> ofWriteOnly(\r\n            MetaBean metaBean, String propertyName, Class<?> declaringType, Class<P> propertyType) {\r\n        var field = findField(metaBean, propertyName);\r\n        return new DirectMetaProperty<>(metaBean, propertyName, declaringType, propertyType, PropertyStyle.WRITE_ONLY, field);\r\n    }\r\n\r\n    /**\r\n     * Factory to create a buildable read-only meta-property avoiding duplicate generics.\r\n     * \r\n     * @param <P>  the property type\r\n     * @param metaBean  the meta-bean, not null\r\n     * @param propertyName  the property name, not empty\r\n     * @param declaringType  the type declaring the property, not null\r\n     * @param propertyType  the property type, not null\r\n     * @return the property, not null\r\n     */\r\n    public static <P> DirectMetaProperty<P> ofReadOnlyBuildable(\r\n            MetaBean metaBean, String propertyName, Class<?> declaringType, Class<P> propertyType) {\r\n        var field = findField(metaBean, propertyName);\r\n        return new DirectMetaProperty<>(metaBean, propertyName, declaringType, propertyType, PropertyStyle.READ_ONLY_BUILDABLE, field);\r\n    }\r\n\r\n    /**\r\n     * Factory to create a derived read-only meta-property avoiding duplicate generics.\r\n     * \r\n     * @param <P>  the property type\r\n     * @param metaBean  the meta-bean, not null\r\n     * @param propertyName  the property name, not empty\r\n     * @param declaringType  the type declaring the property, not null\r\n     * @param propertyType  the property type, not null\r\n     * @return the property, not null\r\n     */\r\n    public static <P> DirectMetaProperty<P> ofDerived(\r\n            MetaBean metaBean, String propertyName, Class<?> declaringType, Class<P> propertyType) {\r\n        var method = findMethod(metaBean, propertyName);\r\n        return new DirectMetaProperty<>(metaBean, propertyName, declaringType, propertyType, PropertyStyle.DERIVED, method);\r\n    }\r\n\r\n    /**\r\n     * Factory to create an immutable meta-property avoiding duplicate generics.\r\n     * \r\n     * @param <P>  the property type\r\n     * @param metaBean  the meta-bean, not null\r\n     * @param propertyName  the property name, not empty\r\n     * @param declaringType  the type declaring the property, not null\r\n     * @param propertyType  the property type, not null\r\n     * @return the property, not null\r\n     */\r\n    public static <P> DirectMetaProperty<P> ofImmutable(\r\n            MetaBean metaBean, String propertyName, Class<?> declaringType, Class<P> propertyType) {\r\n        var field = findField(metaBean, propertyName);\r\n        return new DirectMetaProperty<>(metaBean, propertyName, declaringType, propertyType, PropertyStyle.IMMUTABLE, field);\r\n    }\r\n\r\n    private static Field findField(MetaBean metaBean, String propertyName) {\r\n        Class<?> cls = metaBean.beanType();\r\n        while (cls != DirectBean.class && cls != Object.class && cls != null) {\r\n            try {\r\n                return cls.getDeclaredField(propertyName);\r\n            } catch (NoSuchFieldException ex) {\r\n                try {\r\n                    return cls.getDeclaredField(\"_\" + propertyName);\r\n                } catch (NoSuchFieldException ex2) {\r\n                    cls = cls.getSuperclass();\r\n                }\r\n            }\r\n        }\r\n        return null;\r\n    }\r\n\r\n    private static AccessibleObject findMethod(MetaBean metaBean, String propertyName) {\r\n        var methodName = \"get\" + propertyName.substring(0, 1).toUpperCase(Locale.ENGLISH) + propertyName.substring(1);\r\n        Class<?> cls = metaBean.beanType();\r\n        while (cls != DirectBean.class && cls != Object.class && cls != null) {\r\n            try {\r\n                return cls.getDeclaredMethod(methodName);\r\n            } catch (NoSuchMethodException ex) {\r\n                cls = cls.getSuperclass();\r\n            }\r\n        }\r\n        return findField(metaBean, propertyName);  // backwards compatibility\r\n    }\r\n\r\n    /**\r\n     * Constructor.\r\n     * \r\n     * @param metaBean  the meta-bean, not null\r\n     * @param propertyName  the property name, not empty\r\n     * @param declaringType  the declaring type, not null\r\n     * @param propertyType  the property type, not null\r\n     * @param style  the style, not null\r\n     * @param fieldOrMethod  the reflected field or method, not null\r\n     */\r\n    private DirectMetaProperty(MetaBean metaBean, String propertyName, Class<?> declaringType,\r\n            Class<P> propertyType, PropertyStyle style, AccessibleObject fieldOrMethod) {\r\n        super(propertyName);\r\n        this.metaBean = Objects.requireNonNull(metaBean, \"metaBean must not be null\");\r\n        this.propertyType = Objects.requireNonNull(propertyType, \"propertyType must not be null\");\r\n        this.propertyGenericType = switch (fieldOrMethod) {\r\n            case Field field -> field.getGenericType();\r\n            case Method method -> method.getGenericReturnType();\r\n            case null, default -> propertyType;\r\n        };\r\n        this.declaringType = Objects.requireNonNull(declaringType, \"declaringType must not be null\");\r\n        this.style = Objects.requireNonNull(style, \"style must not be null\");\r\n        this.fieldOrMethod = fieldOrMethod;  // may be null\r\n        var beanType = metaBean.beanType();\r\n        var resolvedType = ResolvedType.from(propertyGenericType, beanType);\r\n        this.propertyResolvedTypeFn = !resolvedType.isParameterized() || Modifier.isFinal(beanType.getModifiers()) ?\r\n                contextClass -> resolvedType :\r\n                contextClass -> contextClass == beanType ? resolvedType : ResolvedType.from(propertyGenericType, contextClass);\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Override\r\n    public MetaBean metaBean() {\r\n        return metaBean;\r\n    }\r\n\r\n    @Override\r\n    public Class<?> declaringType() {\r\n        return declaringType;\r\n    }\r\n\r\n    @Override\r\n    public Class<P> propertyType() {\r\n        return propertyType;\r\n    }\r\n\r\n    @Override\r\n    public Type propertyGenericType() {\r\n        return propertyGenericType;\r\n    }\r\n\r\n    @Override\r\n    public ResolvedType propertyResolvedType(Class<?> contextClass) {\r\n        return propertyResolvedTypeFn.apply(contextClass);\r\n    }\r\n\r\n    @Override\r\n    public PropertyStyle style() {\r\n        return style;\r\n    }\r\n\r\n    @Override\r\n    public <A extends Annotation> A annotation(Class<A> annotationClass) {\r\n        if (fieldOrMethod == null) {\r\n            throw new UnsupportedOperationException(\"Field not found for property: \" + name());\r\n        }\r\n        var annotation = fieldOrMethod.getAnnotation(annotationClass);\r\n        if (annotation == null) {\r\n            throw new NoSuchElementException(\"Unknown annotation: \" + annotationClass.getName());\r\n        }\r\n        return annotation;\r\n    }\r\n\r\n    @Override\r\n    public <A extends Annotation> Optional<A> annotationOpt(Class<A> annotationClass) {\r\n        return fieldOrMethod == null ?\r\n                Optional.empty() :\r\n                Optional.ofNullable(fieldOrMethod.getAnnotation(annotationClass));\r\n    }\r\n\r\n    @Override\r\n    public List<Annotation> annotations() {\r\n        if (fieldOrMethod == null) {\r\n            return Collections.emptyList();\r\n        }\r\n        return Arrays.asList(fieldOrMethod.getDeclaredAnnotations());\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @SuppressWarnings(\"unchecked\")\r\n    @Override\r\n    public P get(Bean bean) {\r\n        var meta = (DirectMetaBean) bean.metaBean();\r\n        return (P) meta.propertyGet(bean, name(), false);\r\n    }\r\n\r\n    @Override\r\n    public void set(Bean bean, Object value) {\r\n        var meta = (DirectMetaBean) bean.metaBean();\r\n        meta.propertySet(bean, name(), value, false);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/direct/DirectMetaPropertyMap.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl.direct;\n\nimport java.util.AbstractCollection;\nimport java.util.AbstractSet;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.Set;\n\nimport org.joda.beans.MetaProperty;\n\n/**\n * A map of name to meta-property designed for use by the code generator.\n * <p>\n * This meta-property map implementation is designed primarily for code-generation.\n * It stores a reference to the meta-bean and the meta-properties.\n * The meta-properties are accessed using {@link DirectMetaBean#metaPropertyGet(String)}.\n * <p>\n * This class is immutable and thread-safe.\n */\n@SuppressWarnings(\"rawtypes\")\npublic final class DirectMetaPropertyMap implements Map<String, MetaProperty<?>> {\n\n    /** The meta-bean. */\n    private final DirectMetaBean metaBean;\n    /** The property names. */\n    private final Set<String> keys;\n    /** The meta-properties. */\n    private final Collection<MetaProperty<?>> values;\n    /** The map entries. */\n    private final Set<Entry<String, MetaProperty<?>>> entries;\n\n    /**\n     * Constructor.\n     * \n     * @param metaBean  the meta-bean, not null\n     * @param parent  the superclass parent, may be null\n     * @param propertyNames  the property names, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public DirectMetaPropertyMap(final DirectMetaBean metaBean, DirectMetaPropertyMap parent, String... propertyNames) {\n        this.metaBean = Objects.requireNonNull(metaBean, \"metaBean must not be null\");\n        var parentSize = 0;\n        Entry<String, MetaProperty<?>>[] metaProperties;\n        if (parent != null) {\n            parentSize = parent.size();\n            metaProperties = Arrays.copyOf(((Entries) parent.entries).metaProperties, parentSize + propertyNames.length);\n        } else {\n            metaProperties = new Entry[propertyNames.length];\n        }\n        for (var i = 0; i < propertyNames.length; i++) {\n            metaProperties[i + parentSize] = Map.entry(propertyNames[i], metaBean.metaPropertyGet(propertyNames[i]));\n        }\n        keys = new Keys(metaProperties);\n        values = new Values(metaProperties);\n        entries = new Entries(metaProperties);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public int size() {\n        return keys.size();\n    }\n\n    @Override\n    public boolean isEmpty() {\n        return size() == 0;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public MetaProperty<Object> get(Object propertyName) {\n        if (propertyName instanceof String propName) {\n            return (MetaProperty<Object>) metaBean.metaPropertyGet(propName);\n        }\n        return null;\n    }\n\n    @Override\n    public boolean containsKey(Object propertyName) {\n        return propertyName instanceof String propName &&\n                metaBean.metaPropertyGet(propName) != null;\n    }\n\n    @Override\n    public boolean containsValue(Object value) {\n        return value instanceof MetaProperty<?> mp &&\n                metaBean.metaPropertyGet(mp.name()) != null;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MetaProperty<?> put(String key, MetaProperty<?> value) {\n        throw new UnsupportedOperationException(\"DirectBean meta-property map cannot be modified\");\n    }\n\n    @Override\n    public MetaProperty<?> remove(Object key) {\n        throw new UnsupportedOperationException(\"DirectBean meta-property map cannot be modified\");\n    }\n\n    @Override\n    public void putAll(Map<? extends String, ? extends MetaProperty<?>> m) {\n        throw new UnsupportedOperationException(\"DirectBean meta-property map cannot be modified\");\n    }\n\n    @Override\n    public void clear() {\n        throw new UnsupportedOperationException(\"DirectBean meta-property map cannot be modified\");\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public Set<String> keySet() {\n        return keys;\n    }\n\n    @Override\n    public Collection<MetaProperty<?>> values() {\n        return values;\n    }\n\n    @Override\n    public Set<Entry<String, MetaProperty<?>>> entrySet() {\n        return entries;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Collection implementation for the keys.\n     */\n    private static final class Keys extends AbstractSet<String> {\n        private final Entry<String, MetaProperty<?>>[] metaProperties;\n\n        private Keys(Entry<String, MetaProperty<?>>[] metaProperties) {\n            this.metaProperties = metaProperties;\n        }\n\n        @Override\n        public Iterator<String> iterator() {\n            return new Iterator<>() {\n                private int index;\n                @Override\n                public boolean hasNext() {\n                    return index < metaProperties.length;\n                }\n                @Override\n                public String next() {\n                    return metaProperties[index++].getKey();\n                }\n                @Override\n                public void remove() {\n                    throw new UnsupportedOperationException();\n                }\n            };\n        }\n\n        @Override\n        public int size() {\n            return metaProperties.length;\n        }\n    }\n\n    /**\n     * Collection implementation for the values.\n     */\n    private static final class Values extends AbstractCollection<MetaProperty<?>> {\n        private final Entry<String, MetaProperty<?>>[] metaProperties;\n\n        private Values(Entry<String, MetaProperty<?>>[] metaProperties) {\n            this.metaProperties = metaProperties;\n        }\n\n        @Override\n        public Iterator<MetaProperty<?>> iterator() {\n            return new Iterator<>() {\n                private int index;\n                @Override\n                public boolean hasNext() {\n                    return index < metaProperties.length;\n                }\n                @Override\n                public MetaProperty<?> next() {\n                    return metaProperties[index++].getValue();\n                }\n                @Override\n                public void remove() {\n                    throw new UnsupportedOperationException();\n                }\n            };\n        }\n\n        @Override\n        public int size() {\n            return metaProperties.length;\n        }\n    }\n\n    /**\n     * Collection implementation for the entries.\n     */\n    private static final class Entries extends AbstractSet<Entry<String, MetaProperty<?>>> {\n        private final Entry<String, MetaProperty<?>>[] metaProperties;\n\n        private Entries(Entry<String, MetaProperty<?>>[] metaProperties) {\n            this.metaProperties = metaProperties;\n        }\n\n        @Override\n        public Iterator<Entry<String, MetaProperty<?>>> iterator() {\n            return new Iterator<>() {\n                private int index;\n                @Override\n                public boolean hasNext() {\n                    return index < metaProperties.length;\n                }\n                @Override\n                public Entry<String, MetaProperty<?>> next() {\n                    return metaProperties[index++];\n                }\n                @Override\n                public void remove() {\n                    throw new UnsupportedOperationException();\n                }\n            };\n        }\n\n        @Override\n        public int size() {\n            return metaProperties.length;\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/direct/DirectPrivateBeanBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl.direct;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.test.JodaBeanTests;\n\n/**\n * A builder implementation designed for use by the code generator.\n * <p>\n * This implementation is intended to have fields generated in the subclass.\n * \n * @param <T> the bean type\n */\npublic abstract class DirectPrivateBeanBuilder<T extends Bean>\n        implements BeanBuilder<T> {\n\n    /**\n     * Constructs the builder.\n     */\n    protected DirectPrivateBeanBuilder() {\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public Object get(String propertyName) {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public <P> P get(MetaProperty<P> metaProperty) {\n        return (P) get(metaProperty.name());\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public BeanBuilder<T> set(MetaProperty<?> metaProperty, Object value) {\n        try {\n            set(metaProperty.name(), value);\n            return this;\n        } catch (RuntimeException ex) {\n            if (value == JodaBeanTests.TEST_COVERAGE_STRING) {\n                return this;\n            }\n            throw ex;\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a string that summarises the builder.\n     * \n     * @return a summary string, not null\n     */\n    @Override\n    public String toString() {\n        return \"BeanBuilder\";\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/direct/MinimalMetaBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl.direct;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Modifier;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.LinkedHashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\nimport java.util.Objects;\nimport java.util.function.BiConsumer;\nimport java.util.function.Function;\nimport java.util.function.Supplier;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.DerivedProperty;\nimport org.joda.beans.gen.PropertyDefinition;\n\n/**\n * A meta-bean implementation designed for use by the code generator.\n * \n * @param <T>  the type of the bean\n */\npublic final class MinimalMetaBean<T extends Bean> implements TypedMetaBean<T> {\n\n    /** The bean type. */\n    private final Class<T> beanType;\n    /** The constructor to use. */\n    private final Supplier<BeanBuilder<T>> builderSupplier;\n    /** The meta-property instances of the bean. */\n    private final Map<String, MetaProperty<?>> metaPropertyMap;\n    /** The aliases. */\n    private final Map<String, String> aliasMap;\n\n    /**\n     * Obtains an instance of the meta-bean for immutable beans.\n     * <p>\n     * The properties will be determined using reflection to find the\n     * {@link PropertyDefinition} annotation.\n     * The field names must be specified as reflection does not return fields in source code order.\n     * \n     * @param <B>  the type of the bean\n     * @param beanType  the bean type, not null\n     * @param fieldNames  the field names, not null\n     * @param builderSupplier  the supplier of bean builders, not null\n     * @param getters  the getter functions, not null\n     * @return the meta-bean, not null\n     */\n    @SafeVarargs\n    public static <B extends Bean> MinimalMetaBean<B> of(\n            Class<B> beanType,\n            String[] fieldNames,\n            Supplier<BeanBuilder<B>> builderSupplier,\n            Function<B, Object>... getters) {\n\n        Objects.requireNonNull(getters, \"getters must not be null\");\n        return new MinimalMetaBean<>(beanType, fieldNames, builderSupplier, Arrays.asList(getters), null);\n    }\n\n    /**\n     * Obtains an instance of the meta-bean for mutable beans.\n     * <p>\n     * The properties will be determined using reflection to find the\n     * {@link PropertyDefinition} annotation.\n     * The field names must be specified as reflection does not return fields in source code order.\n     * \n     * @param <B>  the type of the bean\n     * @param beanType  the bean type, not null\n     * @param fieldNames  the field names, not null\n     * @param builderSupplier  the supplier of bean builders, not null\n     * @param getters  the getter functions, not null\n     * @param setters  the setter functions, not null\n     * @return the meta-bean, not null\n     */\n    public static <B extends Bean> MinimalMetaBean<B> of(\n            Class<B> beanType,\n            String[] fieldNames,\n            Supplier<BeanBuilder<B>> builderSupplier,\n            List<Function<B, Object>> getters,\n            List<BiConsumer<B, Object>> setters) {\n\n        Objects.requireNonNull(getters, \"getters must not be null\");\n        Objects.requireNonNull(setters, \"setters must not be null\");\n        return new MinimalMetaBean<>(beanType, fieldNames, builderSupplier, getters, setters);\n    }\n\n    /**\n     * Constructor.\n     * \n     * @param beanType  the bean type, not null\n     * @param builderSupplier  the supplier of bean builders, not null\n     * @param fieldNames  the field names, not null\n     * @param getters  the getter functions, not null\n     * @param setters  the setter functions, may be null\n     */\n    private MinimalMetaBean(\n            Class<T> beanType,\n            String[] fieldNames,\n            Supplier<BeanBuilder<T>> builderSupplier,\n            List<Function<T, Object>> getters,\n            List<BiConsumer<T, Object>> setters) {\n\n        Objects.requireNonNull(beanType, \"beanType must not be null\");\n        Objects.requireNonNull(builderSupplier, \"builderSupplier must not be null\");\n        Objects.requireNonNull(fieldNames, \"fieldNames must not be null\");\n        Objects.requireNonNull(getters, \"getters must not be null\");\n        if (fieldNames.length != getters.size()) {\n            throw new IllegalArgumentException(\"Number of getter functions must match number of fields\");\n        }\n        if (setters != null && fieldNames.length != setters.size()) {\n            throw new IllegalArgumentException(\"Number of setter functions must match number of fields\");\n        }\n        this.beanType = beanType;\n        this.builderSupplier = builderSupplier;\n        // extract fields and match to getters/setters\n        var map = new LinkedHashMap<String, MetaProperty<?>>();\n        for (var i = 0; i < fieldNames.length; i++) {\n            var fieldName = fieldNames[i];\n            Field field;\n            try {\n                field = beanType.getDeclaredField(fieldName);\n            } catch (NoSuchFieldException ex) {\n                throw new IllegalArgumentException(ex);\n            }\n            if (Modifier.isStatic(field.getModifiers())) {\n                throw new IllegalArgumentException(\"Field must not be static\");\n            }\n            if (field.getAnnotation(PropertyDefinition.class) == null) {\n                throw new IllegalArgumentException(\"Field must have PropertyDefinition annotation\");\n            }\n            map.put(fieldName, new MinimalMetaProperty<>(\n                    this, fieldName, field, getters.get(i), setters != null ? setters.get(i) : null));\n        }\n        // derived\n        var methods = beanType.getDeclaredMethods();\n        for (var method : methods) {\n            if (!Modifier.isStatic(method.getModifiers()) &&\n                    Modifier.isPublic(method.getModifiers()) &&\n                    method.getAnnotation(DerivedProperty.class) != null &&\n                    method.getName().startsWith(\"get\") &&\n                    method.getName().length() > 3 &&\n                    Character.isUpperCase(method.getName().charAt(3)) &&\n                    method.getParameterTypes().length == 0) {\n                var methodName = method.getName();\n                var propertyName = Character.toLowerCase(methodName.charAt(3)) + methodName.substring(4);\n                var mp = new MinimalMetaProperty<>(this, method, propertyName);\n                map.put(propertyName, mp);\n            }\n        }\n        this.metaPropertyMap = Collections.unmodifiableMap(map);\n        this.aliasMap = new HashMap<>();\n    }\n\n    private MinimalMetaBean(\n            Class<T> beanType,\n            Supplier<BeanBuilder<T>> builderSupplier,\n            Map<String, MetaProperty<?>> metaPropertyMap,\n            Map<String, String> aliasMap) {\n\n        this.beanType = beanType;\n        this.builderSupplier = builderSupplier;\n        this.metaPropertyMap = metaPropertyMap;\n        this.aliasMap = aliasMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Adds an alias to the meta-bean.\n     * <p>\n     * When using {@link #metaProperty(String)}, the alias will return the\n     * meta-property of the real name.\n     * \n     * @param alias  the alias\n     * @param realName  the real name\n     * @return the new meta-bean instance\n     * @throws IllegalArgumentException if the realName is invalid\n     */\n    public MinimalMetaBean<T> withAlias(String alias, String realName) {\n        if (!metaPropertyMap.containsKey(realName)) {\n            throw new IllegalArgumentException(\"Invalid property name: \" + realName);\n        }\n        var aliasMap = new HashMap<>(this.aliasMap);\n        aliasMap.put(alias, realName);\n        return new MinimalMetaBean<>(beanType, builderSupplier, metaPropertyMap, aliasMap);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean isBuildable() {\n        return true;\n    }\n\n    @Override\n    public BeanBuilder<T> builder() {\n        return builderSupplier.get();\n    }\n\n    @Override\n    public Class<T> beanType() {\n        return beanType;\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public <R> MetaProperty<R> metaProperty(String propertyName) {\n        var mp = metaPropertyMap().get(aliasMap.getOrDefault(propertyName, propertyName));\n        if (mp == null) {\n            throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n        }\n        return (MetaProperty<R>) mp;\n    }\n\n    @Override\n    public Map<String, MetaProperty<?>> metaPropertyMap() {\n        return metaPropertyMap;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        return obj instanceof MinimalMetaBean<?> other &&\n                this.beanType.equals(other.beanType);\n    }\n\n    @Override\n    public int hashCode() {\n        return beanType.hashCode() + 3;\n    }\n\n    /**\n     * Returns a string that summarises the meta-bean.\n     * \n     * @return a summary string, not null\n     */\n    @Override\n    public String toString() {\n        return \"MetaBean:\" + beanName();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/direct/MinimalMetaProperty.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl.direct;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Modifier;\nimport java.lang.reflect.Type;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.function.BiConsumer;\nimport java.util.function.Function;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.PropertyStyle;\nimport org.joda.beans.ResolvedType;\nimport org.joda.beans.impl.BasicMetaProperty;\n\n/**\n * An immutable meta-property based on a functional interface.\n * \n * @param <P>  the type of the property content\n */\nfinal class MinimalMetaProperty<P> extends BasicMetaProperty<P> {\n\n    /** The meta-bean. */\n    private final MetaBean metaBean;\n    /** The type of the property. */\n    private final Class<P> propertyType;\n    /** The type of the property. */\n    private final Type propertyGenericType;\n    /** The function to create the resolved type of the property. */\n    private final Function<Class<?>, ResolvedType> propertyResolvedTypeFn;\n    /** The annotations. */\n    private final List<Annotation> annotations;\n    /** The read method. */\n    private final Function<Bean, Object> getter;\n    /** The write method. */\n    private final BiConsumer<Bean, Object> setter;\n    /** The property style. */\n    private final PropertyStyle style;\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates an instance from a {@code Field}.\n     * \n     * @param metaBean  the meta bean, not null\n     * @param propertyName  the property name, not empty\n     * @param field  the field, not null\n     * @param getter  the property getter, not null\n     * @param setter  the property setter, null if read only\n     */\n    @SuppressWarnings(\"unchecked\")\n    MinimalMetaProperty(\n            MetaBean metaBean,\n            String propertyName,\n            Field field,\n            Function<? extends Bean, Object> getter,\n            BiConsumer<? extends Bean, Object> setter) {\n        \n        super(propertyName);\n        this.metaBean = metaBean;\n        this.propertyType = (Class<P>) field.getType();\n        this.propertyGenericType = field.getGenericType();\n        this.annotations = Arrays.asList(field.getAnnotations());\n        this.getter = (Function<Bean, Object>) getter;\n        this.setter = (BiConsumer<Bean, Object>) setter;\n        if (ImmutableBean.class.isAssignableFrom(metaBean.beanType())) {\n            this.style = PropertyStyle.IMMUTABLE;\n        } else {\n            this.style = setter != null ? PropertyStyle.READ_WRITE : PropertyStyle.READ_ONLY;\n        }\n        this.propertyResolvedTypeFn = createResolvedTypeFunction();\n    }\n\n    /**\n     * Creates an instance from a derived {@code Method}.\n     * \n     * @param metaBean  the meta bean, not null\n     * @param method  the method, not null\n     * @param propertyName  the property name, not empty\n     */\n    @SuppressWarnings(\"unchecked\")\n    MinimalMetaProperty(\n            MetaBean metaBean,\n            Method method,\n            String propertyName) {\n        \n        super(propertyName);\n        this.metaBean = metaBean;\n        this.propertyType = (Class<P>) method.getReturnType();\n        this.propertyGenericType = method.getGenericReturnType();\n        this.annotations = Arrays.asList(method.getAnnotations());\n        this.getter = b -> {\n            try {\n                return method.invoke(b);\n            } catch (RuntimeException ex) {\n                throw ex;\n            } catch (Exception ex) {\n                throw new RuntimeException(ex);\n            }\n        };\n        this.setter = null;\n        this.style = PropertyStyle.DERIVED;\n        this.propertyResolvedTypeFn = createResolvedTypeFunction();\n    }\n\n    private Function<Class<?>, ResolvedType> createResolvedTypeFunction() {\n        var beanType = metaBean.beanType();\n        var resolvedType = ResolvedType.from(propertyGenericType, beanType);\n        return !resolvedType.isParameterized() || Modifier.isFinal(beanType.getModifiers()) ?\n                contextClass -> resolvedType :\n                contextClass -> contextClass == beanType ? resolvedType : ResolvedType.from(propertyGenericType, contextClass);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MetaBean metaBean() {\n        return metaBean;\n    }\n\n    @Override\n    public Class<?> declaringType() {\n        return metaBean.beanType();\n    }\n\n    @Override\n    public Class<P> propertyType() {\n        return propertyType;\n    }\n\n    @Override\n    public Type propertyGenericType() {\n        return propertyGenericType;\n    }\n\n    @Override\n    public ResolvedType propertyResolvedType(Class<?> contextClass) {\n        return propertyResolvedTypeFn.apply(contextClass);\n    }\n\n    @Override\n    public PropertyStyle style() {\n        return style;\n    }\n\n    @Override\n    public List<Annotation> annotations() {\n        return annotations;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public P get(Bean bean) {\n        try {\n            return (P) getter.apply(bean);\n        } catch (RuntimeException | Error ex) {\n            throw ex;\n        } catch (Throwable ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    @Override\n    public void set(Bean bean, Object value) {\n        if (setter == null) {\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + name());\n        }\n        try {\n            setter.accept(bean, value);\n        } catch (RuntimeException | Error ex) {\n            throw ex;\n        } catch (Throwable ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/direct/package-info.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n\n/**\n * Implementation of Joda-Beans designed for extension by the code generator.\n * <p>\n * Use of the code generator is optional with Joda-Beans, but it is the most common approach.\n * These class are used by the generator, but could potentially be used without it.\n */\npackage org.joda.beans.impl.direct;\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/flexi/FlexiBean.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.impl.flexi;\r\n\r\nimport java.io.ObjectStreamException;\r\nimport java.io.Serial;\r\nimport java.io.Serializable;\r\nimport java.util.Collections;\r\nimport java.util.LinkedHashMap;\r\nimport java.util.Map;\r\nimport java.util.NoSuchElementException;\r\nimport java.util.Set;\r\nimport java.util.regex.Pattern;\r\n\r\nimport org.joda.beans.DynamicBean;\r\nimport org.joda.beans.DynamicMetaBean;\r\nimport org.joda.beans.Property;\r\nimport org.joda.beans.impl.BasicProperty;\r\n\r\n/**\r\n * Implementation of a fully dynamic {@code Bean}.\r\n * <p>\r\n * Properties are dynamic, and can be added and removed at will from the map.\r\n * The internal storage is created lazily to allow a flexi-bean to be used as\r\n * a lightweight extension to another bean.\r\n * <p>\r\n * Each flexi-bean has a different set of properties.\r\n * As such, there is one instance of meta-bean for each flexi-bean.\r\n * <p>\r\n * The keys of a flexi-bean must be simple identifiers as per '[a-zA-Z_][a-zA-Z0-9_]*'.\r\n */\r\npublic final class FlexiBean implements DynamicBean, Serializable {\r\n    // Alternate way to implement this would be to create a list/map of real property\r\n    // objects which could then be properly typed\r\n\r\n    /** Serialization version. */\r\n    @Serial\r\n    private static final long serialVersionUID = 1L;\r\n    /** Valid regex for keys. */\r\n    private static final Pattern VALID_KEY = Pattern.compile(\"[a-zA-Z_][a-zA-Z0-9_]*\");\r\n\r\n    /** The meta-bean. */\r\n    private final transient FlexiMetaBean metaBean = new FlexiMetaBean(this);  // CSIGNORE\r\n    /** The underlying data. */\r\n    volatile Map<String, Object> data = Collections.emptyMap();// CSIGNORE\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Creates a standalone meta-bean.\r\n     * <p>\r\n     * This creates a new instance each time in line with dynamic bean principles.\r\n     * \r\n     * @return the meta-bean, not null\r\n     */\r\n    public static DynamicMetaBean meta() {\r\n        return new FlexiBean().metaBean();\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Constructor.\r\n     */\r\n    public FlexiBean() {\r\n    }\r\n\r\n    /**\r\n     * Constructor that copies all the data entries from the specified bean.\r\n     * \r\n     * @param copyFrom  the bean to copy from, not null\r\n     */\r\n    public FlexiBean(FlexiBean copyFrom) {\r\n        putAll(copyFrom.data);\r\n    }\r\n\r\n    // resolve to set up transient field\r\n    private Object readResolve() throws ObjectStreamException {\r\n        return new FlexiBean(this);\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Gets the internal data map.\r\n     * \r\n     * @return the data, not null\r\n     */\r\n    private Map<String, Object> dataWritable() {\r\n        if (data == Collections.EMPTY_MAP) {\r\n            data = new LinkedHashMap<>();\r\n        }\r\n        return data;\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Gets the number of properties.\r\n     * \r\n     * @return the number of properties\r\n     */\r\n    public int size() {\r\n        return data.size();\r\n    }\r\n\r\n    /**\r\n     * Checks if the bean contains a specific property.\r\n     * \r\n     * @param propertyName  the property name, null returns false\r\n     * @return true if the bean contains the property\r\n     */\r\n    public boolean contains(String propertyName) {\r\n        return propertyExists(propertyName);\r\n    }\r\n\r\n    /**\r\n     * Gets the value of the property.\r\n     * <p>\r\n     * This returns null if the property does not exist.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     * @return the value of the property, may be null\r\n     */\r\n    public Object get(String propertyName) {\r\n        return data.get(propertyName);\r\n    }\r\n\r\n    /**\r\n     * Gets the value of the property cast to a specific type.\r\n     * <p>\r\n     * This returns null if the property does not exist.\r\n     * \r\n     * @param <T>  the value type\r\n     * @param propertyName  the property name, not empty\r\n     * @param type  the type to cast to, not null\r\n     * @return the value of the property, may be null\r\n     * @throws ClassCastException if the type is incorrect\r\n     */\r\n    public <T> T get(String propertyName, Class<T> type) {\r\n        return type.cast(get(propertyName));\r\n    }\r\n\r\n    /**\r\n     * Gets the value of the property as a {@code String}.\r\n     * This will use {@link Object#toString()}.\r\n     * <p>\r\n     * This returns null if the property does not exist.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     * @return the value of the property, may be null\r\n     */\r\n    public String getString(String propertyName) {\r\n        var obj = get(propertyName);\r\n        return obj != null ? obj.toString() : null;\r\n    }\r\n\r\n    /**\r\n     * Gets the value of the property as a {@code boolean}.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     * @return the value of the property\r\n     * @throws ClassCastException if the value is not compatible\r\n     * @throws NullPointerException if the property does not exist or is null\r\n     */\r\n    public boolean getBoolean(String propertyName) {\r\n        return (Boolean) get(propertyName);\r\n    }\r\n\r\n    /**\r\n     * Gets the value of the property as a {@code int}.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     * @return the value of the property\r\n     * @throws ClassCastException if the value is not compatible\r\n     * @throws NullPointerException if the property does not exist or is null\r\n     */\r\n    public int getInt(String propertyName) {\r\n        return ((Number) get(propertyName)).intValue();\r\n    }\r\n\r\n    /**\r\n     * Gets the value of the property as a {@code int} using a default value.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     * @param defaultValue  the default value for null or invalid property\r\n     * @return the value of the property\r\n     * @throws ClassCastException if the value is not compatible\r\n     */\r\n    public int getInt(String propertyName, int defaultValue) {\r\n        var obj = get(propertyName);\r\n        return obj != null ? ((Number) obj).intValue() : defaultValue;\r\n    }\r\n\r\n    /**\r\n     * Gets the value of the property as a {@code long}.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     * @return the value of the property\r\n     * @throws ClassCastException if the value is not compatible\r\n     * @throws NullPointerException if the property does not exist or is null\r\n     */\r\n    public long getLong(String propertyName) {\r\n        return ((Number) get(propertyName)).longValue();\r\n    }\r\n\r\n    /**\r\n     * Gets the value of the property as a {@code long} using a default value.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     * @param defaultValue  the default value for null or invalid property\r\n     * @return the value of the property\r\n     * @throws ClassCastException if the value is not compatible\r\n     */\r\n    public long getLong(String propertyName, long defaultValue) {\r\n        var obj = get(propertyName);\r\n        return obj != null ? ((Number) obj).longValue() : defaultValue;\r\n    }\r\n\r\n    /**\r\n     * Gets the value of the property as a {@code double}.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     * @return the value of the property\r\n     * @throws ClassCastException if the value is not compatible\r\n     * @throws NullPointerException if the property does not exist or is null\r\n     */\r\n    public double getDouble(String propertyName) {\r\n        return ((Number) get(propertyName)).doubleValue();\r\n    }\r\n\r\n    /**\r\n     * Gets the value of the property as a {@code double} using a default value.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     * @param defaultValue  the default value for null or invalid property\r\n     * @return the value of the property\r\n     * @throws ClassCastException if the value is not compatible\r\n     */\r\n    public double getDouble(String propertyName, double defaultValue) {\r\n        var obj = get(propertyName);\r\n        return obj != null ? ((Number) obj).doubleValue() : defaultValue;\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Sets a property in this bean to the specified value.\r\n     * <p>\r\n     * This creates a property if one does not exist.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     * @param newValue  the new value, may be null\r\n     * @return {@code this} for chaining, not null\r\n     */\r\n    public FlexiBean append(String propertyName, Object newValue) {\r\n        put(propertyName, newValue);\r\n        return this;\r\n    }\r\n\r\n    /**\r\n     * Sets a property in this bean to the specified value.\r\n     * <p>\r\n     * This creates a property if one does not exist.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     * @param newValue  the new value, may be null\r\n     */\r\n    public void set(String propertyName, Object newValue) {\r\n        put(propertyName, newValue);\r\n    }\r\n\r\n    /**\r\n     * Sets a property in this bean to the specified value.\r\n     * <p>\r\n     * This creates a property if one does not exist.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     * @param newValue  the new value, may be null\r\n     * @return the old value of the property, may be null\r\n     */\r\n    public Object put(String propertyName, Object newValue) {\r\n        if (!VALID_KEY.matcher(propertyName).matches()) {\r\n            throw new IllegalArgumentException(\"Invalid key for FlexiBean: \" + propertyName);\r\n        }\r\n        return dataWritable().put(propertyName, newValue);\r\n    }\r\n\r\n    /**\r\n     * Puts the properties in the specified map into this bean.\r\n     * <p>\r\n     * This creates properties if they do not exist.\r\n     * \r\n     * @param map  the map of properties to add, not null\r\n     */\r\n    public void putAll(Map<String, ? extends Object> map) {\r\n        if (!map.isEmpty()) {\r\n            for (var key : map.keySet()) {\r\n                if (!VALID_KEY.matcher(key).matches()) {\r\n                    throw new IllegalArgumentException(\"Invalid key for FlexiBean: \" + key);\r\n                }\r\n            }\r\n            if (data == Collections.EMPTY_MAP) {\r\n                data = new LinkedHashMap<>(map);\r\n            } else {\r\n                data.putAll(map);\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Puts the properties in the specified bean into this bean.\r\n     * <p>\r\n     * This creates properties if they do not exist.\r\n     * \r\n     * @param other  the map of properties to add, not null\r\n     */\r\n    public void putAll(FlexiBean other) {\r\n        if (other.size() > 0) {\r\n            if (data == Collections.EMPTY_MAP) {\r\n                data = new LinkedHashMap<>(other.data);\r\n            } else {\r\n                data.putAll(other.data);\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Removes a property.\r\n     * <p>\r\n     * No error occurs if the property does not exist.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     */\r\n    public void remove(String propertyName) {\r\n        propertyRemove(propertyName);\r\n    }\r\n\r\n    /**\r\n     * Removes all properties.\r\n     */\r\n    public void clear() {\r\n        if (data != Collections.EMPTY_MAP) {\r\n            data.clear();\r\n        }\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Checks if the property exists.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     * @return true if the property exists\r\n     */\r\n    public boolean propertyExists(String propertyName) {\r\n        return data.containsKey(propertyName);\r\n    }\r\n\r\n    /**\r\n     * Gets the value of the property.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     * @return the value of the property, may be null\r\n     */\r\n    public Object propertyGet(String propertyName) {\r\n        if (!propertyExists(propertyName)) {\r\n            throw new NoSuchElementException(\"Unknown property: \" + propertyName);\r\n        }\r\n        return data.get(propertyName);\r\n    }\r\n\r\n    /**\r\n     * Sets the value of the property.\r\n     * \r\n     * @param propertyName  the property name, not empty\r\n     * @param newValue  the new value of the property, may be null\r\n     */\r\n    public void propertySet(String propertyName, Object newValue) {\r\n        put(propertyName, newValue);\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Override\r\n    public DynamicMetaBean metaBean() {\r\n        return metaBean;\r\n    }\r\n\r\n    @Override\r\n    public Property<Object> property(String name) {\r\n        return BasicProperty.of(this, FlexiMetaProperty.of(metaBean, name));\r\n    }\r\n\r\n    @Override\r\n    public Set<String> propertyNames() {\r\n        return data.keySet();\r\n    }\r\n\r\n    @Override\r\n    public void propertyDefine(String propertyName, Class<?> propertyType) {\r\n        if (!propertyExists(propertyName)) {\r\n            put(propertyName, null);\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public void propertyRemove(String propertyName) {\r\n        if (data != Collections.EMPTY_MAP) {\r\n            data.remove(propertyName);\r\n        }\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Returns a map representing the contents of the bean.\r\n     * \r\n     * @return a map representing the contents of the bean, not null\r\n     */\r\n    public Map<String, Object> toMap() {\r\n        if (size() == 0) {\r\n            return Collections.emptyMap();\r\n        }\r\n        // retain order, Map.of() does not respect order\r\n        return Collections.unmodifiableMap(new LinkedHashMap<>(data));\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Clones this bean, returning an independent copy.\r\n     * \r\n     * @return the clone, not null\r\n     */\r\n    @Override\r\n    public FlexiBean clone() {\r\n        return new FlexiBean(this);\r\n    }\r\n\r\n    /**\r\n     * Compares this bean to another based on the property names and content.\r\n     * \r\n     * @param obj  the object to compare to, null returns false\r\n     * @return true if equal\r\n     */\r\n    @Override\r\n    public boolean equals(Object obj) {\r\n        return obj == this ||\r\n                (obj instanceof FlexiBean other &&\r\n                        this.data.equals(other.data));\r\n    }\r\n\r\n    /**\r\n     * Returns a suitable hash code.\r\n     * \r\n     * @return a hash code\r\n     */\r\n    @Override\r\n    public int hashCode() {\r\n        return data.hashCode();\r\n    }\r\n\r\n    /**\r\n     * Returns a string that summarises the bean.\r\n     * <p>\r\n     * The string contains the class name and properties.\r\n     * \r\n     * @return a summary string, not null\r\n     */\r\n    @Override\r\n    public String toString() {\r\n        return getClass().getSimpleName() + data.toString();\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/flexi/FlexiBeanBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl.flexi;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaProperty;\n\n/**\n * Implementation of a meta-bean for {@code FlexiBean}.\n */\nclass FlexiBeanBuilder implements BeanBuilder<FlexiBean> {\n\n    /**\n     * The bean itself.\n     */\n    private final FlexiBean bean;\n\n    /**\n     * Creates the meta-bean.\n     * \n     * @param bean  the underlying bean, not null\n     */\n    FlexiBeanBuilder(FlexiBean bean) {\n        this.bean = bean;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public Object get(String propertyName) {\n        // lenient getter\n        return bean.get(propertyName);\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public <P> P get(MetaProperty<P> metaProperty) {\n        // this approach allows meta-property from one bean to be used with another\n        return (P) bean.get(metaProperty.name());\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public FlexiBeanBuilder set(String propertyName, Object value) {\n        bean.put(propertyName, value);\n        return this;\n    }\n\n    @Override\n    public FlexiBeanBuilder set(MetaProperty<?> metaProperty, Object value) {\n        // this approach allows meta-property from one bean to be used with another\n        bean.put(metaProperty.name(), value);\n        return this;\n    }\n\n    @Override\n    public FlexiBean build() {\n        return bean;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public String toString() {\n        return \"FlexiBeanBuilder\";\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/flexi/FlexiMetaBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl.flexi;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Collections;\nimport java.util.Iterator;\nimport java.util.LinkedHashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.DynamicMetaBean;\nimport org.joda.beans.MetaProperty;\n\n/**\n * Implementation of a meta-bean for {@code FlexiBean}.\n */\nclass FlexiMetaBean implements DynamicMetaBean {\n\n    /**\n     * The bean itself.\n     */\n    private final FlexiBean bean;\n\n    /**\n     * Creates the meta-bean.\n     * \n     * @param bean  the underlying bean, not null\n     */\n    FlexiMetaBean(FlexiBean bean) {\n        this.bean = bean;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean isBuildable() {\n        return true;\n    }\n\n    @Override\n    public BeanBuilder<FlexiBean> builder() {\n        return new FlexiBeanBuilder(bean);\n    }\n\n    @Override\n    public Class<FlexiBean> beanType() {\n        return FlexiBean.class;\n    }\n\n    @Override\n    public int metaPropertyCount() {\n        return bean.size();\n    }\n\n    @Override\n    public boolean metaPropertyExists(String name) {\n        return bean.propertyExists(name);\n    }\n\n    @Override\n    public MetaProperty<Object> metaProperty(String name) {\n        // do not check if exists\n        return FlexiMetaProperty.of(this, name);\n    }\n\n    @Override\n    public Iterable<MetaProperty<?>> metaPropertyIterable() {\n        if (bean.data.isEmpty()) {\n            return Collections.emptySet();\n        }\n        return () -> {\n            var it = bean.data.keySet().iterator();\n            return new Iterator<>() {\n                @Override\n                public boolean hasNext() {\n                    return it.hasNext();\n                }\n                @Override\n                public MetaProperty<?> next() {\n                    return FlexiMetaProperty.of(FlexiMetaBean.this, it.next());\n                }\n                @Override\n                public void remove() {\n                    throw new UnsupportedOperationException(\"Unmodifiable\");\n                }\n\n            };\n        };\n    }\n\n    @Override\n    public Map<String, MetaProperty<?>> metaPropertyMap() {\n        if (bean.data.isEmpty()) {\n            return Collections.emptyMap();\n        }\n        var keySet = bean.data.keySet();\n        var map = LinkedHashMap.<String, MetaProperty<?>>newLinkedHashMap(keySet.size());\n        for (var name : keySet) {\n            map.put(name, FlexiMetaProperty.of(this, name));\n        }\n        return Collections.unmodifiableMap(map);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public void metaPropertyDefine(String propertyName, Class<?> propertyType) {\n        bean.propertyDefine(propertyName, propertyType);\n    }\n\n    @Override\n    public void metaPropertyRemove(String propertyName) {\n        bean.propertyRemove(propertyName);\n    }\n\n    @Override\n    public List<Annotation> annotations() {\n        return Collections.emptyList();\n    }\n\n    /**\n     * Returns a string that summarises the meta-bean.\n     * \n     * @return a summary string, not null\n     */\n    @Override\n    public String toString() {\n        return \"MetaBean:\" + beanType().getSimpleName();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/flexi/FlexiMetaProperty.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.impl.flexi;\r\n\r\nimport java.lang.annotation.Annotation;\r\nimport java.util.Collections;\r\nimport java.util.List;\r\n\r\nimport org.joda.beans.Bean;\r\nimport org.joda.beans.MetaBean;\r\nimport org.joda.beans.PropertyStyle;\r\nimport org.joda.beans.impl.BasicMetaProperty;\r\n\r\n/**\r\n * A meta-property using a {@code FlexiBean} for storage.\r\n */\r\nfinal class FlexiMetaProperty extends BasicMetaProperty<Object> {\r\n\r\n    /** The meta-bean. */\r\n    private final MetaBean metaBean;\r\n\r\n    /**\r\n     * Factory to create a meta-property.\r\n     * \r\n     * @param metaBean  the meta-bean, not null\r\n     * @param propertyName  the property name, not empty\r\n     */\r\n    static FlexiMetaProperty of(MetaBean metaBean, String propertyName) {\r\n        return new FlexiMetaProperty(metaBean, propertyName);\r\n    }\r\n\r\n    /**\r\n     * Constructor.\r\n     * \r\n     * @param metaBean  the meta-bean, not null\r\n     * @param propertyName  the property name, not empty\r\n     */\r\n    private FlexiMetaProperty(MetaBean metaBean, String propertyName) {\r\n        super(propertyName);\r\n        this.metaBean = metaBean;\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Override\r\n    public MetaBean metaBean() {\r\n        return metaBean;\r\n    }\r\n\r\n    @Override\r\n    public Class<?> declaringType() {\r\n        return FlexiBean.class;\r\n    }\r\n\r\n    @Override\r\n    public Class<Object> propertyType() {\r\n        return Object.class;\r\n    }\r\n\r\n    @Override\r\n    public Class<Object> propertyGenericType() {\r\n        return Object.class;\r\n    }\r\n\r\n    @Override\r\n    public PropertyStyle style() {\r\n        return PropertyStyle.READ_WRITE;\r\n    }\r\n\r\n    @Override\r\n    public List<Annotation> annotations() {\r\n        return Collections.emptyList();\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Override\r\n    public Object get(Bean bean) {\r\n        return ((FlexiBean) bean).propertyGet(name());\r\n    }\r\n\r\n    @Override\r\n    public void set(Bean bean, Object value) {\r\n        ((FlexiBean) bean).propertySet(name(), value);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/flexi/package-info.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n\n/**\n * Implementation of Joda-Beans as a flexible map of data.\n * <p>\n * A {@code FlexiBean} is typically used as a dynamic bean where properties\n * can be added and removed at any time. This also makes it useful as an extension\n * to other beans, allowing a standard set of properties to be supplemented.\n */\npackage org.joda.beans.impl.flexi;\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/light/LightBeanBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl.light;\n\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaProperty;\n\n/**\n * Implementation of {@code BeanBuilder} that builds light beans.\n * \n * @param <B>  the bean type\n */\nclass LightBeanBuilder<B extends Bean>\n        implements BeanBuilder<B> {\n\n    /** The meta-bean. */\n    private final LightMetaBean<B> metaBean;\n    /** The data. */\n    private final Object[] data;\n\n    //-----------------------------------------------------------------------\n    /**\n     * Constructs the builder wrapping the target bean.\n     * \n     * @param metaBean  the target meta-bean, not null\n     * @param data  the newly created data array\n     */\n    LightBeanBuilder(LightMetaBean<B> metaBean, Object[] data) {\n        this.metaBean = metaBean;\n        this.data = data;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public Object get(String propertyName) {\n        return get(metaBean.metaProperty(propertyName));\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public <P> P get(MetaProperty<P> metaProperty) {\n        return (P) data[index(metaProperty)];\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public BeanBuilder<B> set(String propertyName, Object value) {\n        return set(metaBean.metaProperty(propertyName), value);\n    }\n\n    @Override\n    public BeanBuilder<B> set(MetaProperty<?> metaProperty, Object value) {\n        data[index(metaProperty)] = value;\n        return this;\n    }\n\n    private int index(MetaProperty<?> metaProperty) {\n        if (metaProperty instanceof LightMetaProperty<?> mp) {\n            var index = mp.getConstructorIndex();\n            if (index < 0) {\n                throw new NoSuchElementException(\"Derived property cannot be set: \" + metaProperty.name());\n            }\n            return index;\n        }\n        return index(metaBean.metaProperty(metaProperty.name()));\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public B build() {\n        return metaBean.build(data);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a string that summarises the builder.\n     * \n     * @return a summary string, not null\n     */\n    @Override\n    public String toString() {\n        return \"BeanBuilder for \" + metaBean.beanName();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/light/LightMetaBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl.light;\n\nimport static java.util.stream.Collectors.joining;\n\nimport java.lang.invoke.MethodHandle;\nimport java.lang.invoke.MethodHandles;\nimport java.lang.invoke.MethodType;\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Modifier;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.LinkedHashMap;\nimport java.util.List;\nimport java.util.Locale;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\nimport java.util.Objects;\nimport java.util.function.Function;\nimport java.util.stream.Stream;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.DerivedProperty;\nimport org.joda.beans.gen.PropertyDefinition;\n\n/**\n * A meta-bean implementation that operates using method handles.\n * <p>\n * The properties are found using the {@link PropertyDefinition} annotation.\n * There must be a constructor matching the property definitions (arguments of same order and types).\n * <p>\n * This uses method handles to avoid problems with reflection {@code setAccessible()} in Java SE 9.\n * \n * @param <T>  the type of the bean\n */\npublic final class LightMetaBean<T extends Bean> implements TypedMetaBean<T> {\n\n    /**\n     * The empty object array.\n     */\n    private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];\n\n    /** The bean type. */\n    private final Class<T> beanType;\n    /** The meta-property instances of the bean. */\n    private final Map<String, MetaProperty<?>> metaPropertyMap;\n    /** The aliases. */\n    private final Map<String, String> aliasMap;\n    /** The constructor to use. */\n    private final Function<Object[], T> constructorFn;\n    /** The construction data array. */\n    private final Object[] constructionData;\n\n    //-----------------------------------------------------------------------\n    /**\n     * Obtains an instance of the meta-bean using standard default values.\n     * <p>\n     * The properties will be determined using reflection to find the fields.\n     * Each field must have a {@link PropertyDefinition} annotation.\n     * The order of the properties is undefined as Java fields are not necessarily\n     * returned in source code order.\n     * <p>\n     * The default values for primitives are determined automatically.\n     * If the bean has non-primitive values like lists and maps that need defaulting\n     * then {@link #of(Class, java.lang.invoke.MethodHandles.Lookup, String[], Object...)}\n     * must be used.\n     * \n     * @param <B>  the type of the bean\n     * @param beanType  the bean type, not null\n     * @param lookup  the method handle lookup, not null\n     * @return the meta-bean, not null\n     */\n    public static <B extends Bean> LightMetaBean<B> of(Class<B> beanType, MethodHandles.Lookup lookup) {\n        // the field name order is undefined\n        // but since they are not being matched against default values that is OK\n        return new LightMetaBean<>(beanType, lookup, fieldNames(beanType), EMPTY_OBJECT_ARRAY);\n    }\n\n    // determine the field names by reflection\n    private static String[] fieldNames(Class<?> beanType) {\n        var fieldNames = new ArrayList<String>();\n        for (var field : beanType.getDeclaredFields()) {\n            if (!Modifier.isStatic(field.getModifiers()) && field.getAnnotation(PropertyDefinition.class) != null) {\n                fieldNames.add(field.getName());\n            }\n        }\n        return fieldNames.toArray(new String[0]);\n    }\n\n    /**\n     * Obtains an instance of the meta-bean specifying default values.\n     * <p>\n     * The properties will be determined using reflection to find the\n     * {@link PropertyDefinition} annotation.\n     * <p>\n     * The field names must be specified as reflection does not return fields in source code order.\n     * The default values must be provided if they cannot be determined automatically.\n     * Default values for primitives are determined automatically, but empty lists and maps are not.\n     * \n     * @param <B>  the type of the bean\n     * @param beanType  the bean type, not null\n     * @param lookup  the method handle lookup, not null\n     * @param fieldNames  the field names, one for each property, not null\n     * @param defaultValues  the default values, one for each property, not null\n     * @return the meta-bean, not null\n     */\n    public static <B extends Bean> LightMetaBean<B> of(\n            Class<B> beanType,\n            MethodHandles.Lookup lookup,\n            String[] fieldNames,\n            Object... defaultValues) {\n\n        return new LightMetaBean<>(beanType, lookup, fieldNames, defaultValues);\n    }\n\n    /**\n     * Constructor.\n     */\n    private LightMetaBean(\n            Class<T> beanType,\n            MethodHandles.Lookup lookup,\n            String[] fieldNames,\n            Object[] defaultValues) {\n\n        Objects.requireNonNull(beanType, \"beanType must not be null\");\n        Objects.requireNonNull(lookup, \"lookup must not be null\");\n        Objects.requireNonNull(fieldNames, \"fieldNames must not be null\");\n        Objects.requireNonNull(defaultValues, \"defaultValues must not be null\");\n        if (defaultValues.length > 0 && defaultValues.length != fieldNames.length) {\n            throw new IllegalArgumentException(\"Number of default values must match number of fields\");\n        }\n        this.beanType = beanType;\n        // handle ordered or random\n        var map = new LinkedHashMap<String, MetaProperty<?>>();\n        var propertyTypes = new ArrayList<Class<?>>();\n        for (var fieldName : fieldNames) {\n            Field field;\n            try {\n                field = beanType.getDeclaredField(fieldName);\n            } catch (NoSuchFieldException ex) {\n                throw new IllegalArgumentException(ex);\n            }\n            if (Modifier.isStatic(field.getModifiers())) {\n                throw new IllegalArgumentException(\"Field must not be static\");\n            }\n            if (field.getAnnotation(PropertyDefinition.class) == null) {\n                throw new IllegalArgumentException(\"Field must have PropertyDefinition annotation\");\n            }\n            var pdef = field.getAnnotation(PropertyDefinition.class);\n            var name = field.getName();\n            if (pdef.get().isEmpty() || pdef.get().equals(\"field\") || pdef.get().startsWith(\"optional\")) {\n                map.put(name, LightMetaProperty.of(this, field, lookup, name, propertyTypes.size()));\n            } else {\n                var getterName = \"get\" + name.substring(0, 1).toUpperCase(Locale.ENGLISH) + name.substring(1);\n                Method getMethod = null;\n                if (field.getType() == boolean.class) {\n                    getMethod = findGetMethod(\n                            beanType, \"is\" + name.substring(0, 1).toUpperCase(Locale.ENGLISH) + name.substring(1));\n                }\n                if (getMethod == null) {\n                    getMethod = findGetMethod(beanType, getterName);\n                    if (getMethod == null) {\n                        throw new IllegalArgumentException(\n                                \"Unable to find property getter: \" + beanType.getSimpleName() + \".\" + getterName + \"()\");\n                    }\n                }\n                Method setMethod = null;\n                if (!ImmutableBean.class.isAssignableFrom(beanType)) {\n                    var setterName = \"set\" + name.substring(0, 1).toUpperCase(Locale.ENGLISH) + name.substring(1);\n                    setMethod = findSetMethod(beanType, setterName, field.getType());\n                    if (setMethod == null) {\n                        throw new IllegalArgumentException(\n                                \"Unable to find property setter: \" + beanType.getSimpleName() + \".\" + setterName + \"()\");\n                    }\n                }\n                map.put(name, LightMetaProperty.of(this, field, getMethod, setMethod, lookup, name, propertyTypes.size()));\n            }\n            propertyTypes.add(field.getType());\n        }\n        var constructor = findConstructor(beanType, propertyTypes);\n        var constructionData = defaultValues;\n        if (defaultValues.length == 0) {\n            constructionData = buildConstructionData(constructor);\n        }\n        // derived\n        var methods = beanType.getDeclaredMethods();\n        for (var method : methods) {\n            if (!Modifier.isStatic(method.getModifiers()) &&\n                    method.getAnnotation(DerivedProperty.class) != null &&\n                    method.getName().startsWith(\"get\") &&\n                    method.getName().length() > 3 &&\n                    Character.isUpperCase(method.getName().charAt(3)) &&\n                    method.getParameterTypes().length == 0) {\n                var methodName = method.getName();\n                var propertyName = Character.toLowerCase(methodName.charAt(3)) + methodName.substring(4);\n                var mp = LightMetaProperty.of(this, method, lookup, propertyName, -1);\n                map.put(propertyName, mp);\n            }\n        }\n        this.metaPropertyMap = Collections.unmodifiableMap(map);\n        this.aliasMap = new HashMap<>();\n        this.constructionData = constructionData;\n        var handle = findConstructorHandle(beanType, lookup, constructor);\n        this.constructorFn = args -> build(handle, args);\n    }\n\n    /**\n     * Constructor used internally.\n     */\n    private LightMetaBean(\n            Class<T> beanType,\n            Map<String, MetaProperty<?>> metaPropertyMap,\n            Map<String, String> aliasMap,\n            Function<Object[], T> constructorFn,\n            Object[] constructionData) {\n        \n        this.beanType = beanType;\n        this.metaPropertyMap = metaPropertyMap;\n        this.aliasMap = aliasMap;\n        this.constructorFn = constructorFn;\n        this.constructionData = constructionData;\n    }\n\n    // finds a method on class or public method on super-type\n    private static Method findGetMethod(Class<? extends Bean> beanType, String getterName) {\n        try {\n            return beanType.getDeclaredMethod(getterName);\n        } catch (NoSuchMethodException ex) {\n            try {\n                return beanType.getMethod(getterName);\n            } catch (NoSuchMethodException ex2) {\n                return null;\n            }\n        }\n    }\n\n    // finds a method on class or public method on super-type\n    private static Method findSetMethod(Class<? extends Bean> beanType, String setterName, Class<?> fieldType) {\n        try {\n            return beanType.getDeclaredMethod(setterName, fieldType);\n        } catch (NoSuchMethodException ex) {\n            var methods = beanType.getMethods();\n            var potential = new ArrayList<Method>();\n            for (var method : methods) {\n                if (method.getName().equals(setterName) && method.getParameterTypes().length == 1) {\n                    potential.add(method);\n                }\n            }\n            if (potential.size() == 1) {\n                return potential.get(0);\n            }\n            for (Method method : potential) {\n                if (method.getParameterTypes()[0].equals(fieldType)) {\n                    return method;\n                }\n            }\n            return null;\n        }\n    }\n\n    // finds constructor which matches types exactly\n    private static <T extends Bean> MethodHandle findConstructorHandle(\n            Class<T> beanType,\n            MethodHandles.Lookup lookup,\n            Constructor<?> constructor) {\n\n        try {\n            // spreader allows an Object[] to invoke the positional arguments\n            var constructorType = MethodType.methodType(Void.TYPE, constructor.getParameterTypes());\n            var baseHandle = lookup.findConstructor(beanType, constructorType)\n                    .asSpreader(Object[].class, constructor.getParameterTypes().length);\n            // change the return type so caller can use invokeExact()\n            return baseHandle.asType(baseHandle.type().changeReturnType(Bean.class));\n        } catch (NoSuchMethodException ex) {\n            throw new IllegalArgumentException(\"Unable to find constructor: \" + beanType.getSimpleName());\n        } catch (IllegalAccessException ex) {\n            throw new IllegalArgumentException(\"Unable to access constructor: \" + beanType.getSimpleName());\n        }\n    }\n\n    // finds constructor which matches types exactly\n    private static <T extends Bean> Constructor<T> findConstructor(Class<T> beanType, List<Class<?>> propertyTypes) {\n        var types = propertyTypes.toArray(new Class<?>[0]);\n        try {\n            return beanType.getDeclaredConstructor(types);\n        } catch (NoSuchMethodException ex) {\n            return findConstructorFallback(beanType, types, ex);\n        }\n    }\n\n    // try a more lenient search\n    // this handles cases where field is a concrete class and constructor is an interface\n    private static <T extends Bean> Constructor<T> findConstructorFallback(Class<T> beanType, Class<?>[] types, NoSuchMethodException ex) {\n        @SuppressWarnings(\"unchecked\")\n        var cons = (Constructor<T>[]) beanType.getDeclaredConstructors();\n        Constructor<T> match = null;\n        outer:\n        for (var con : cons) {\n            var conTypes = con.getParameterTypes();\n            if (conTypes.length == types.length) {\n                for (var j = 0; j < types.length; j++) {\n                    if (!conTypes[j].isAssignableFrom(types[j])) {\n                        continue outer;\n                    }\n                }\n                if (match != null) {\n                    throw new UnsupportedOperationException(\"Unable to find constructor: More than one matches\");\n                }\n                match = con;\n            }\n        }\n        if (match == null) {\n            var signature = Stream.of(types).map(Class::getName).collect(joining(\", \"));\n            var msg = \"Unable to find constructor: \" + beanType.getSimpleName() + '(' + signature + ')';\n            throw new UnsupportedOperationException(msg, ex);\n        }\n        return match;\n    }\n\n    // array used to collect data when building\n    // needs to have default values for primitives\n    // note that this does not handle empty collections/maps\n    private static Object[] buildConstructionData(Constructor<?> constructor) {\n        var parameterTypes = constructor.getParameterTypes();\n        var args = new Object[parameterTypes.length];\n        for (var i = 0; i < parameterTypes.length; i++) {\n            if (parameterTypes[i] == boolean.class) {\n                args[i] = false;\n            } else if (parameterTypes[i] == int.class) {\n                args[i] = 0;\n            } else if (parameterTypes[i] == long.class) {\n                args[i] = (long) 0;\n            } else if (parameterTypes[i] == short.class) {\n                args[i] = (short) 0;\n            } else if (parameterTypes[i] == byte.class) {\n                args[i] = (byte) 0;\n            } else if (parameterTypes[i] == float.class) {\n                args[i] = (float) 0;\n            } else if (parameterTypes[i] == double.class) {\n                args[i] = (double) 0;\n            } else if (parameterTypes[i] == char.class) {\n                args[i] = (char) 0;\n            }\n        }\n        return args;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private T build(MethodHandle handle, Object[] args) {\n        try {\n            return (T) handle.invokeExact(args);\n            \n        } catch (Error ex) {\n            throw ex;\n        } catch (Throwable ex) {\n            throw new IllegalArgumentException(\n                    \"Bean cannot be created: \" + beanName() + \" from \" + Arrays.toString(args), ex);\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    T build(Object[] args) {\n        return constructorFn.apply(args);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Adds an alias to the meta-bean.\n     * <p>\n     * When using {@link #metaProperty(String)}, the alias will return the\n     * meta-property of the real name.\n     * \n     * @param alias  the alias\n     * @param realName  the real name\n     * @return the new meta-bean instance\n     * @throws IllegalArgumentException if the realName is invalid\n     */\n    public LightMetaBean<T> withAlias(String alias, String realName) {\n        if (!metaPropertyMap.containsKey(realName)) {\n            throw new IllegalArgumentException(\"Invalid property name: \" + realName);\n        }\n        var aliasMap = new HashMap<>(this.aliasMap);\n        aliasMap.put(alias, realName);\n        return new LightMetaBean<>(beanType, metaPropertyMap, aliasMap, constructorFn, constructionData);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean isBuildable() {\n        return true;\n    }\n\n    @Override\n    public BeanBuilder<T> builder() {\n        return new LightBeanBuilder<>(this, constructionData.clone());\n    }\n\n    @Override\n    public Class<T> beanType() {\n        return beanType;\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public <R> MetaProperty<R> metaProperty(String propertyName) {\n        var mp = metaPropertyMap().get(aliasMap.getOrDefault(propertyName, propertyName));\n        if (mp == null) {\n            throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n        }\n        return (MetaProperty<R>) mp;\n    }\n\n    @Override\n    public Map<String, MetaProperty<?>> metaPropertyMap() {\n        return metaPropertyMap;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        return obj instanceof LightMetaBean<?> other &&\n                this.beanType.equals(other.beanType);\n    }\n\n    @Override\n    public int hashCode() {\n        return beanType.hashCode() + 3;\n    }\n\n    /**\n     * Returns a string that summarises the meta-bean.\n     * \n     * @return a summary string, not null\n     */\n    @Override\n    public String toString() {\n        return \"MetaBean:\" + beanName();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/light/LightMetaProperty.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl.light;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.invoke.MethodHandle;\nimport java.lang.invoke.MethodHandles;\nimport java.lang.invoke.MethodType;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Modifier;\nimport java.lang.reflect.Type;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.function.Function;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.PropertyStyle;\nimport org.joda.beans.ResolvedType;\nimport org.joda.beans.impl.BasicMetaProperty;\n\n/**\n * An immutable meta-property based on a getter interface.\n * \n * @param <P>  the type of the property content\n */\nfinal class LightMetaProperty<P> extends BasicMetaProperty<P> {\n\n    /** The meta-bean. */\n    private final MetaBean metaBean;\n    /** The type of the property. */\n    private final Class<P> propertyType;\n    /** The type of the property. */\n    private final Type propertyGenericType;\n    /** The function to create the resolved type of the property. */\n    private final Function<Class<?>, ResolvedType> propertyResolvedTypeFn;\n    /** The annotations. */\n    private final List<Annotation> annotations;\n    /** The read method. */\n    private final MethodHandle getter;\n    /** The optional write method. */\n    private final MethodHandle setter;\n    /** The index of the property in the constructor. */\n    private final int constructorIndex;\n    /** The property style. */\n    private final PropertyStyle style;\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates an instance from a {@code Field}.\n     * \n     * @param <P>  the property type\n     * @param metaBean  the meta bean, not null\n     * @param field  the field, not null\n     * @param constructorIndex  the index of the property in the constructor\n     * @return the property, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    static <P> LightMetaProperty<P> of(\n            MetaBean metaBean,\n            Field field,\n            MethodHandles.Lookup lookup,\n            String propertyName,\n            int constructorIndex) {\n        \n        MethodHandle getter;\n        try {\n            getter = lookup.findGetter(field.getDeclaringClass(), field.getName(), field.getType());\n        } catch (IllegalArgumentException | NoSuchFieldException | IllegalAccessException ex) {\n            throw new UnsupportedOperationException(\"Property cannot be read: \" + propertyName, ex);\n        }\n        MethodHandle setter = null;\n        if (!Modifier.isFinal(field.getModifiers())) {\n            try {\n                setter = lookup.findSetter(field.getDeclaringClass(), field.getName(), field.getType());\n            } catch (IllegalArgumentException | NoSuchFieldException | IllegalAccessException ex) {\n                throw new UnsupportedOperationException(\"Property cannot be read: \" + propertyName, ex);\n            }\n        }\n        return new LightMetaProperty<>(\n                metaBean, \n                propertyName, \n                (Class<P>) field.getType(), \n                field.getGenericType(), \n                Arrays.asList(field.getAnnotations()), \n                getter,\n                setter,\n                constructorIndex,\n                calculateStyle(metaBean, setter));\n    }\n\n    /**\n     * Creates an instance from a get/set {@code Method} pair.\n     * \n     * @param <P>  the property type\n     * @param metaBean  the meta bean, not null\n     * @param getMethod  the method, not null\n     * @param setMethod  the method, not null\n     * @param constructorIndex  the index of the property in the constructor\n     * @return the property, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    static <P> LightMetaProperty<P> of(\n            MetaBean metaBean,\n            Field field,\n            Method getMethod,\n            Method setMethod,\n            MethodHandles.Lookup lookup,\n            String propertyName,\n            int constructorIndex) {\n        \n        MethodHandle getter;\n        try {\n            var methodType = MethodType.methodType(getMethod.getReturnType(), getMethod.getParameterTypes());\n            getter = lookup.findVirtual(field.getDeclaringClass(), getMethod.getName(), methodType);\n        } catch (IllegalArgumentException | NoSuchMethodException | IllegalAccessException ex) {\n            throw new UnsupportedOperationException(\"Property cannot be read: \" + propertyName, ex);\n        }\n        MethodHandle setter = null;\n        if (setMethod != null) {\n            try {\n                var methodType = MethodType.methodType(void.class, setMethod.getParameterTypes());\n                setter = lookup.findVirtual(field.getDeclaringClass(), setMethod.getName(), methodType);\n            } catch (IllegalArgumentException | NoSuchMethodException | IllegalAccessException ex) {\n                throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName, ex);\n            }\n        }\n        return new LightMetaProperty<>(\n                metaBean, \n                propertyName, \n                (Class<P>) field.getType(), \n                field.getGenericType(), \n                Arrays.asList(field.getAnnotations()), \n                getter,\n                setter,\n                constructorIndex,\n                calculateStyle(metaBean, setter));\n    }\n\n    private static PropertyStyle calculateStyle(MetaBean metaBean, MethodHandle setter) {\n        if (ImmutableBean.class.isAssignableFrom(metaBean.beanType())) {\n            return PropertyStyle.IMMUTABLE;\n        }\n        return setter != null ? PropertyStyle.READ_WRITE : PropertyStyle.READ_ONLY;\n    }\n\n    /**\n     * Creates an instance from a derived {@code Method}.\n     * \n     * @param <P>  the property type\n     * @param metaBean  the meta bean, not null\n     * @param getMethod  the get method, not null\n     * @param constructorIndex  the index of the property\n     * @return the property, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    static <P> LightMetaProperty<P> of(\n            MetaBean metaBean,\n            final Method getMethod,\n            MethodHandles.Lookup lookup,\n            final String propertyName,\n            int constructorIndex) {\n        \n        MethodHandle getter;\n        try {\n            getter = lookup.unreflect(getMethod);\n        } catch (IllegalArgumentException | IllegalAccessException ex) {\n            throw new UnsupportedOperationException(\"Property cannot be read: \" + propertyName, ex);\n        }\n        return new LightMetaProperty<>(\n                metaBean, \n                propertyName, \n                (Class<P>) getMethod.getReturnType(), \n                getMethod.getGenericReturnType(), \n                Arrays.asList(getMethod.getAnnotations()), \n                getter,\n                null,\n                constructorIndex,\n                PropertyStyle.DERIVED);\n    }\n\n    /**\n     * Creates an instance.\n     * \n     * @param metaBean  the meta bean, not null\n     * @param propertyName  the property name, not empty\n     * @param propertyType  the property type\n     * @param propertyGenericType  the property generic type\n     * @param annotations  the annotations\n     * @param getter  the property getter\n     * @param setter  the property setter\n     * @param constructorIndex  the index of the property in the constructor\n     */\n    LightMetaProperty(\n            MetaBean metaBean, \n            String propertyName,\n            Class<P> propertyType,\n            Type propertyGenericType,\n            List<Annotation> annotations,\n            MethodHandle getter,\n            MethodHandle setter,\n            int constructorIndex,\n            PropertyStyle style) {\n        \n        super(propertyName);\n        this.metaBean = metaBean;\n        this.propertyType = propertyType;\n        this.propertyGenericType = propertyGenericType;\n        this.annotations = annotations;\n        this.getter = getter.asType(MethodType.methodType(Object.class, Bean.class));\n        this.setter = setter != null ? setter.asType(MethodType.methodType(void.class, Bean.class, Object.class)) : null;\n        this.constructorIndex = constructorIndex;\n        this.style = style;\n        var beanType = metaBean.beanType();\n        var resolvedType = ResolvedType.from(propertyGenericType, beanType);\n        this.propertyResolvedTypeFn = !resolvedType.isParameterized() || Modifier.isFinal(beanType.getModifiers()) ?\n                contextClass -> resolvedType :\n                contextClass -> contextClass == beanType ? resolvedType : ResolvedType.from(propertyGenericType, contextClass);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MetaBean metaBean() {\n        return metaBean;\n    }\n\n    @Override\n    public Class<?> declaringType() {\n        return metaBean.beanType();\n    }\n\n    @Override\n    public Class<P> propertyType() {\n        return propertyType;\n    }\n\n    @Override\n    public Type propertyGenericType() {\n        return propertyGenericType;\n    }\n\n    @Override\n    public ResolvedType propertyResolvedType(Class<?> contextClass) {\n        return propertyResolvedTypeFn.apply(contextClass);\n    }\n\n    @Override\n    public PropertyStyle style() {\n        return style;\n    }\n\n    @Override\n    public List<Annotation> annotations() {\n        return annotations;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public P get(Bean bean) {\n        try {\n            return (P) getter.invokeExact(bean);\n        } catch (RuntimeException | Error ex) {\n            throw ex;\n        } catch (Throwable ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    @Override\n    public void set(Bean bean, Object value) {\n        if (setter == null) {\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + name());\n        }\n        try {\n            setter.invokeExact(bean, value);\n        } catch (RuntimeException | Error ex) {\n            throw ex;\n        } catch (Throwable ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    int getConstructorIndex() {\n        return constructorIndex;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/light/PropertyGetter.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl.light;\n\nimport org.joda.beans.Bean;\n\n/**\n * Functional interface providing the ability to get a property from a bean.\n */\ninterface PropertyGetter {\n\n    /**\n     * Queries the property.\n     * \n     * @param bean  the bean to query\n     * @return the property value\n     */\n    Object get(Bean bean);\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/light/PropertySetter.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl.light;\n\nimport org.joda.beans.Bean;\n\n/**\n * Functional interface providing the ability to set a property in a bean.\n */\ninterface PropertySetter {\n\n    /**\n     * Sets the property.\n     * \n     * @param bean  the bean to change\n     * @param value  the value to set\n     */\n    void set(Bean bean, Object value);\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/light/package-info.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n\n/**\n * Implementation of light immutable Joda-Beans.\n */\npackage org.joda.beans.impl.light;\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/map/MapBean.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.impl.map;\r\n\r\nimport java.io.Serial;\r\nimport java.util.HashMap;\r\nimport java.util.Map;\r\nimport java.util.Set;\r\n\r\nimport org.joda.beans.DynamicBean;\r\nimport org.joda.beans.DynamicMetaBean;\r\nimport org.joda.beans.Property;\r\nimport org.joda.beans.impl.BasicProperty;\r\nimport org.joda.beans.impl.flexi.FlexiBean;\r\n\r\n/**\r\n * Implementation of a fully dynamic {@code Bean} based on an exposed {@code Map}.\r\n * <p>\r\n * Properties are dynamic, and can be added and removed at will from the map.\r\n * <p>\r\n * This class extends {@link HashMap}, allowing it to be used wherever a map is.\r\n * See {@link FlexiBean} for a map-like bean implementation that is more controlled.\r\n */\r\npublic class MapBean extends HashMap<String, Object> implements DynamicBean {\r\n\r\n    /** Serialization version. */\r\n    @Serial\r\n    private static final long serialVersionUID = 1L;\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Creates a standalone meta-bean.\r\n     * <p>\r\n     * This creates a new instance each time in line with dynamic bean principles.\r\n     * \r\n     * @return the meta-bean, not null\r\n     */\r\n    public static DynamicMetaBean meta() {\r\n        return new MapBean().metaBean();\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Creates an instance.\r\n     */\r\n    public MapBean() {\r\n    }\r\n\r\n    /**\r\n     * Creates an instance.\r\n     * \r\n     * @param map  the map to copy, not null\r\n     */\r\n    private MapBean(Map<String, Object> map) {\r\n        super(map);\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Override\r\n    public DynamicMetaBean metaBean() {\r\n        return new MapMetaBean(this);\r\n    }\r\n\r\n    @Override\r\n    public Property<Object> property(String name) {\r\n        return BasicProperty.of(this, MapBeanMetaProperty.of(metaBean(), name));\r\n    }\r\n\r\n    @Override\r\n    public Set<String> propertyNames() {\r\n        return keySet();\r\n    }\r\n\r\n    @Override\r\n    public void propertyDefine(String propertyName, Class<?> propertyType) {\r\n        if (!containsKey(propertyName)) {\r\n            put(propertyName, null);\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public void propertyRemove(String propertyName) {\r\n        remove(propertyName);\r\n    }\r\n\r\n    @Override\r\n    public MapBean clone() {\r\n        return new MapBean(this);\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Returns a string that summarises the bean.\r\n     * <p>\r\n     * The string contains the class name and properties.\r\n     * \r\n     * @return a summary string, not null\r\n     */\r\n    @Override\r\n    public String toString() {\r\n        return getClass().getSimpleName() + super.toString();\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/map/MapBeanBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl.map;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaProperty;\n\n/**\n * Implementation of a meta-bean for {@code MapBean}.\n */\nclass MapBeanBuilder implements BeanBuilder<MapBean> {\n\n    /**\n     * The bean itself.\n     */\n    private final MapBean bean;\n\n    /**\n     * Creates the meta-bean.\n     * \n     * @param bean  the underlying bean, not null\n     */\n    MapBeanBuilder(MapBean bean) {\n        this.bean = bean;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public Object get(String propertyName) {\n        // lenient getter\n        return bean.get(propertyName);\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public <P> P get(MetaProperty<P> metaProperty) {\n        // this approach allows meta-property from one bean to be used with another\n        return (P) bean.get(metaProperty.name());\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MapBeanBuilder set(String propertyName, Object value) {\n        bean.put(propertyName, value);\n        return this;\n    }\n\n    @Override\n    public MapBeanBuilder set(MetaProperty<?> metaProperty, Object value) {\n        // this approach allows meta-property from one bean to be used with another\n        bean.put(metaProperty.name(), value);\n        return this;\n    }\n\n    @Override\n    public MapBean build() {\n        return bean;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public String toString() {\n        return \"MapBeanBuilder\";\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/map/MapBeanMetaProperty.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.impl.map;\r\n\r\nimport java.lang.annotation.Annotation;\r\nimport java.util.Collections;\r\nimport java.util.List;\r\n\r\nimport org.joda.beans.Bean;\r\nimport org.joda.beans.MetaBean;\r\nimport org.joda.beans.PropertyStyle;\r\nimport org.joda.beans.impl.BasicMetaProperty;\r\n\r\n/**\r\n * A meta-property using a {@code MapBean} for storage.\r\n */\r\nfinal class MapBeanMetaProperty extends BasicMetaProperty<Object> {\r\n\r\n    /** The meta-bean. */\r\n    private final MetaBean metaBean;\r\n\r\n    /**\r\n     * Factory to create a meta-property.\r\n     * \r\n     * @param metaBean  the meta-bean, not null\r\n     * @param propertyName  the property name, not empty\r\n     */\r\n    static MapBeanMetaProperty of(MetaBean metaBean, String propertyName) {\r\n        return new MapBeanMetaProperty(metaBean, propertyName);\r\n    }\r\n\r\n    /**\r\n     * Constructor.\r\n     * \r\n     * @param metaBean  the meta-bean, not null\r\n     * @param propertyName  the property name, not empty\r\n     */\r\n    private MapBeanMetaProperty(MetaBean metaBean, String propertyName) {\r\n        super(propertyName);\r\n        this.metaBean = metaBean;\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Override\r\n    public MetaBean metaBean() {\r\n        return metaBean;\r\n    }\r\n\r\n    @Override\r\n    public Class<?> declaringType() {\r\n        return MapBean.class;\r\n    }\r\n\r\n    @Override\r\n    public Class<Object> propertyType() {\r\n        return Object.class;\r\n    }\r\n\r\n    @Override\r\n    public Class<Object> propertyGenericType() {\r\n        return Object.class;\r\n    }\r\n\r\n    @Override\r\n    public PropertyStyle style() {\r\n        return PropertyStyle.READ_WRITE;\r\n    }\r\n\r\n    @Override\r\n    public List<Annotation> annotations() {\r\n        return Collections.emptyList();\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Override\r\n    public Object get(Bean bean) {\r\n        return ((MapBean) bean).get(name());\r\n    }\r\n\r\n    @Override\r\n    public void set(Bean bean, Object value) {\r\n        ((MapBean) bean).put(name(), value);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/map/MapMetaBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.impl.map;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Collections;\nimport java.util.Iterator;\nimport java.util.LinkedHashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.DynamicMetaBean;\nimport org.joda.beans.MetaProperty;\n\n/**\n * Implementation of a meta-bean for {@code MapBean}.\n */\nclass MapMetaBean implements DynamicMetaBean {\n\n    /**\n     * The bean itself.\n     */\n    private final MapBean bean;\n\n    /**\n     * Creates the meta-bean.\n     * \n     * @param bean  the underlying bean, not null\n     */\n    MapMetaBean(MapBean bean) {\n        this.bean = bean;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean isBuildable() {\n        return true;\n    }\n\n    @Override\n    public BeanBuilder<MapBean> builder() {\n        return new MapBeanBuilder(bean);\n    }\n\n    @Override\n    public Class<MapBean> beanType() {\n        return MapBean.class;\n    }\n\n    @Override\n    public int metaPropertyCount() {\n        return bean.size();\n    }\n\n    @Override\n    public boolean metaPropertyExists(String name) {\n        return bean.containsKey(name);\n    }\n\n    @Override\n    public MetaProperty<Object> metaProperty(String name) {\n        // do not check if exists\n        return MapBeanMetaProperty.of(this, name);\n    }\n\n    @Override\n    public Iterable<MetaProperty<?>> metaPropertyIterable() {\n        return () -> {\n            var it = bean.keySet().iterator();\n            return new Iterator<>() {\n                @Override\n                public boolean hasNext() {\n                    return it.hasNext();\n                }\n                @Override\n                public MetaProperty<?> next() {\n                    return MapBeanMetaProperty.of(MapMetaBean.this, it.next());\n                }\n                @Override\n                public void remove() {\n                    throw new UnsupportedOperationException(\"Unmodifiable\");\n                }\n\n            };\n        };\n    }\n\n    @Override\n    public Map<String, MetaProperty<?>> metaPropertyMap() {\n        var keySet = bean.keySet();\n        var map = LinkedHashMap.<String, MetaProperty<?>>newLinkedHashMap(keySet.size());\n        for (var name : bean.keySet()) {\n            map.put(name, MapBeanMetaProperty.of(this, name));\n        }\n        return Collections.unmodifiableMap(map);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public void metaPropertyDefine(String propertyName, Class<?> propertyType) {\n        bean.propertyDefine(propertyName, propertyType);\n    }\n\n    @Override\n    public void metaPropertyRemove(String propertyName) {\n        bean.propertyRemove(propertyName);\n    }\n\n    @Override\n    public List<Annotation> annotations() {\n        return Collections.emptyList();\n    }\n\n    /**\n     * Returns a string that summarises the meta-bean.\n     * \n     * @return a summary string, not null\n     */\n    @Override\n    public String toString() {\n        return \"MetaBean:\" + beanType().getSimpleName();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/map/package-info.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n\n/**\n * Implementation of Joda-Beans extending a map.\n * <p>\n * A {@code MapBean} is a dynamic bean that extends a {@code HashMap}.\n * This is similar to a {@code FlexiBean}, but used if you need a map implementatino.\n */\npackage org.joda.beans.impl.map;\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/package-info.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n\n/**\n * Base implementations of Joda-Bean interfaces.\n * <p>\n * The Joda-Bean interfaces introduce a number of concepts and this package introduces\n * basic implementations of them. The implementations are in a simple and standard form.\n * It is recommended to extend these base classes where possible, however there may\n * be a faster implementation available.\n */\npackage org.joda.beans.impl;\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/reflection/ReflectiveMetaBean.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.impl.reflection;\r\n\r\nimport java.lang.reflect.InvocationTargetException;\r\nimport java.util.Collections;\r\nimport java.util.LinkedHashMap;\r\nimport java.util.Map;\r\nimport java.util.Objects;\r\n\r\nimport org.joda.beans.Bean;\r\nimport org.joda.beans.BeanBuilder;\r\nimport org.joda.beans.MetaProperty;\r\nimport org.joda.beans.TypedMetaBean;\r\nimport org.joda.beans.impl.BasicBeanBuilder;\r\n\r\n/**\r\n * A meta-bean implementation that uses reflection.\r\n * <p>\r\n * This is implementation of a meta-bean can be used directly by applications without code generation.\r\n * It requires that the bean implements {@code Bean} and has a no-arguments constructor.\r\n * Therefore, it is only suitable for mutable beans.\r\n * <p>\r\n * Typically, the meta-bean will be created as a public static final constant.\r\n * Only one method from {@link Bean} needs to be implemented, which simply returns the meta-bean.\r\n * \r\n * @param <T>  the type of the bean\r\n */\r\npublic final class ReflectiveMetaBean<T extends Bean> implements TypedMetaBean<T> {\r\n\r\n    /** The bean type. */\r\n    private final Class<T> beanType;\r\n    /** The meta-property instances of the bean. */\r\n    private final Map<String, MetaProperty<?>> metaPropertyMap;\r\n\r\n    /**\r\n     * Create a meta-bean and meta properties.\r\n     * <p>\r\n     * The meta-properties will be created from the property names by searching for a getter and setter.\r\n     * \r\n     * @param <B>  the type of the bean\r\n     * @param beanClass  the bean class, not null\r\n     * @param propertyNames  the property names, not null\r\n     * @return the meta-bean, not null\r\n     */\r\n    public static <B extends Bean> ReflectiveMetaBean<B> of(Class<B> beanClass, String... propertyNames) {\r\n        return new ReflectiveMetaBean<>(beanClass, propertyNames);\r\n    }\r\n\r\n    /**\r\n     * Constructor.\r\n     * \r\n     * @param beanType  the bean type, not null\r\n     * @param propertyNames  the property names, not null\r\n     */\r\n    private ReflectiveMetaBean(Class<T> beanType, String[] propertyNames) {\r\n        Objects.requireNonNull(beanType, \"beanType must not be null\");\r\n        Objects.requireNonNull(propertyNames, \"propertyNames must not be null\");\r\n        this.beanType = beanType;\r\n        var map = new LinkedHashMap<String, MetaProperty<?>>();\r\n        for (var name : propertyNames) {\r\n            map.put(name, new ReflectiveMetaProperty<>(this, beanType, name));\r\n        }\r\n        this.metaPropertyMap = Collections.unmodifiableMap(map);\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Override\r\n    public boolean isBuildable() {\r\n        try {\r\n            beanType.getDeclaredConstructor().newInstance();\r\n            return true;\r\n        } catch (Exception ex) {\r\n            return false;\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public BeanBuilder<T> builder() {\r\n        try {\r\n            var bean = beanType.getDeclaredConstructor().newInstance();\r\n            return new BasicBeanBuilder<>(bean);\r\n        } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException ex) {\r\n            throw new UnsupportedOperationException(\"Bean cannot be created: \" + beanName(), ex);\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public Class<T> beanType() {\r\n        return beanType;\r\n    }\r\n\r\n    @Override\r\n    public Map<String, MetaProperty<?>> metaPropertyMap() {\r\n        return metaPropertyMap;\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Override\r\n    public boolean equals(Object obj) {\r\n        return obj instanceof ReflectiveMetaBean<?> other &&\r\n                this.beanType.equals(other.beanType);\r\n    }\r\n\r\n    @Override\r\n    public int hashCode() {\r\n        return beanType.hashCode() + 3;\r\n    }\r\n\r\n    /**\r\n     * Returns a string that summarises the meta-bean.\r\n     * \r\n     * @return a summary string, not null\r\n     */\r\n    @Override\r\n    public String toString() {\r\n        return \"MetaBean:\" + beanName();\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/reflection/ReflectiveMetaProperty.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.impl.reflection;\r\n\r\nimport java.lang.annotation.Annotation;\r\nimport java.lang.reflect.InvocationTargetException;\r\nimport java.lang.reflect.Method;\r\nimport java.lang.reflect.Type;\r\nimport java.util.ArrayList;\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\nimport java.util.Locale;\r\n\r\nimport org.joda.beans.Bean;\r\nimport org.joda.beans.ImmutableBean;\r\nimport org.joda.beans.MetaBean;\r\nimport org.joda.beans.PropertyStyle;\r\nimport org.joda.beans.impl.BasicMetaProperty;\r\n\r\n/**\r\n * A meta-property implemented using a {@code PropertyDescriptor}.\r\n * <p>\r\n * The property descriptor class is part of the JDK JavaBean standard.\r\n * It provides access to get and set a property on a bean.\r\n * <p>\r\n * Instances of this class should be declared as a static constant on the bean,\r\n * one for each property, followed by a {@code ReflectiveMetaBean} declaration.\r\n * \r\n * @param <P>  the type of the property content\r\n */\r\nfinal class ReflectiveMetaProperty<P> extends BasicMetaProperty<P> {\r\n\r\n    /** The meta-bean. */\r\n    private volatile MetaBean metaBean;\r\n    /** The declaring type. */\r\n    private final Class<?> declaringType;\r\n    /** The type of the property. */\r\n    private final Class<P> propertyType;\r\n    /** The getter. */\r\n    private final Method getMethod;\r\n    /** The setter. */\r\n    private final Method setMethod;\r\n\r\n    /**\r\n     * Constructor using {@code PropertyDescriptor} to find the get and set methods.\r\n     * \r\n     * @param metaBean  the meta-bean\r\n     * @param beanType  the bean type, not null\r\n     * @param propertyName  the property name, not empty\r\n     */\r\n    @SuppressWarnings({\"unchecked\", \"null\"})\r\n    ReflectiveMetaProperty(MetaBean metaBean, Class<? extends Bean> beanType, String propertyName) {\r\n        super(propertyName);\r\n        var getterName = \"get\" + propertyName.substring(0, 1).toUpperCase(Locale.ENGLISH) + propertyName.substring(1);\r\n        var isserName = \"is\" + propertyName.substring(0, 1).toUpperCase(Locale.ENGLISH) + propertyName.substring(1);\r\n        var getMethod = findGetMethod(beanType, getterName);\r\n        var isMethod = findGetMethod(beanType, isserName);\r\n        if (getMethod == null && isMethod == null) {\r\n            throw new IllegalArgumentException(\r\n                \"Unable to find property getter: \" + beanType.getSimpleName() + \".\" + getterName + \"()\");\r\n        }\r\n        getMethod = isMethod != null ? isMethod : getMethod;\r\n        Method setMethod = null;\r\n        if (!ImmutableBean.class.isAssignableFrom(beanType)) {\r\n            var setterName = \"set\" + propertyName.substring(0, 1).toUpperCase(Locale.ENGLISH) + propertyName.substring(1);\r\n            setMethod = findSetMethod(beanType, setterName, getMethod.getReturnType());\r\n            if (setMethod == null) {\r\n                throw new IllegalArgumentException(\r\n                    \"Unable to find property setter: \" + beanType.getSimpleName() + \".\" + setterName + \"()\");\r\n            }\r\n        }\r\n        this.metaBean = metaBean;\r\n        this.declaringType = (getMethod != null ? getMethod.getDeclaringClass() : setMethod.getDeclaringClass());\r\n        this.propertyType = (Class<P>) getMethod.getReturnType();\r\n        this.getMethod = getMethod;\r\n        this.setMethod = setMethod;\r\n    }\r\n\r\n    // finds a method on class or public method on super-type\r\n    private static Method findGetMethod(Class<? extends Bean> beanType, String getterName) {\r\n        try {\r\n            return beanType.getDeclaredMethod(getterName);\r\n        } catch (NoSuchMethodException ex) {\r\n            try {\r\n                return beanType.getMethod(getterName);\r\n            } catch (NoSuchMethodException ex2) {\r\n                return null;\r\n            }\r\n        }\r\n    }\r\n\r\n    // finds a method on class or public method on super-type\r\n    private static Method findSetMethod(Class<? extends Bean> beanType, String setterName, Class<?> fieldType) {\r\n        try {\r\n            return beanType.getDeclaredMethod(setterName, fieldType);\r\n        } catch (NoSuchMethodException ex) {\r\n            var methods = beanType.getMethods();\r\n            var potential = new ArrayList<Method>();\r\n            for (var method : methods) {\r\n                if (method.getName().equals(setterName) && method.getParameterTypes().length == 1) {\r\n                    potential.add(method);\r\n                }\r\n            }\r\n            if (potential.size() == 1) {\r\n                return potential.get(0);\r\n            }\r\n            for (var method : potential) {\r\n                if (method.getParameterTypes()[0].equals(fieldType)) {\r\n                    return method;\r\n                }\r\n            }\r\n            return null;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Sets the meta-bean, necessary due to ordering restrictions during loading.\r\n     * @param metaBean  the meta-bean, not null\r\n     */\r\n    void setMetaBean(MetaBean metaBean) {\r\n        this.metaBean = metaBean;\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Override\r\n    public MetaBean metaBean() {\r\n        return metaBean;\r\n    }\r\n\r\n    @Override\r\n    public Class<?> declaringType() {\r\n        return declaringType;\r\n    }\r\n\r\n    @Override\r\n    public Class<P> propertyType() {\r\n        return propertyType;\r\n    }\r\n\r\n    @Override\r\n    public Type propertyGenericType() {\r\n        if (getMethod != null) {\r\n            return getMethod.getGenericReturnType();\r\n        }\r\n        return setMethod.getGenericParameterTypes()[0];\r\n    }\r\n\r\n    @Override\r\n    public PropertyStyle style() {\r\n        return (getMethod == null ? PropertyStyle.WRITE_ONLY :\r\n                (setMethod == null ? PropertyStyle.READ_ONLY : PropertyStyle.READ_WRITE));\r\n    }\r\n\r\n    @Override\r\n    public List<Annotation> annotations() {\r\n        if (getMethod != null) {\r\n            return Arrays.asList(getMethod.getDeclaredAnnotations());\r\n        }\r\n        return Arrays.asList(setMethod.getDeclaredAnnotations());\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Override\r\n    @SuppressWarnings(\"unchecked\")\r\n    public P get(Bean bean) {\r\n        if (!style().isReadable()) {\r\n            throw new UnsupportedOperationException(\"Property cannot be read: \" + name());\r\n        }\r\n        try {\r\n            return (P) getMethod.invoke(bean, (Object[]) null);\r\n        } catch (IllegalArgumentException | IllegalAccessException ex) {\r\n            throw new UnsupportedOperationException(\"Property cannot be read: \" + name(), ex);\r\n        } catch (InvocationTargetException ex) {\r\n            if (ex.getCause() instanceof RuntimeException) {\r\n                throw (RuntimeException) ex.getCause();\r\n            }\r\n            throw new RuntimeException(ex);\r\n        }\r\n    }\r\n\r\n    @SuppressWarnings(\"null\")\r\n    @Override\r\n    public void set(Bean bean, Object value) {\r\n        if (!style().isWritable()) {\r\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + name());\r\n        }\r\n        try {\r\n            setMethod.invoke(bean, value);\r\n        } catch (IllegalArgumentException ex) {\r\n            if (value == null && setMethod.getParameterTypes()[0].isPrimitive()) {\r\n                throw new NullPointerException(\"Property cannot be written: \" + name() + \": Cannot store null in primitive\");\r\n            }\r\n            if (!propertyType.isInstance(value)) {\r\n                throw new ClassCastException(\"Property cannot be written: \" + name() + \": Invalid type: \" + value.getClass().getName());\r\n            }\r\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + name(), ex);\r\n        } catch (IllegalAccessException ex) {\r\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + name(), ex);\r\n        } catch (InvocationTargetException ex) {\r\n            if (ex.getCause() instanceof RuntimeException) {\r\n                throw (RuntimeException) ex.getCause();\r\n            }\r\n            throw new RuntimeException(ex);\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/impl/reflection/package-info.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n\n/**\n * Implementation of Joda-Beans using reflection.\n * <p>\n * This package implements a Joda-Bean via reflection.\n */\npackage org.joda.beans.impl.reflection;\n"
  },
  {
    "path": "src/main/java/org/joda/beans/package-info.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n\n/**\n * Base interfaces and annotations defining Joda-Beans.\n * <p>\n * Joda-Beans is a library that can be used to provide enhanced Java Beans.\n * These extensions provide the tools for framework writers to access bean and property\n * information in a consistent and fast manner, typically without reflection.\n * <p>\n * A Joda-Bean implements the {@code Bean} interface. In turn, this requires the\n * creation of a {@code MetaBean} implementation, typically an inner class.\n * Both also require the provision of implementations of {@code Property} and\n * {@code MetaProperty} to express the properties of the bean.\n * <p>\n * Other packages provide implementations of the interfaces and a code generator.\n */\npackage org.joda.beans;\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/CollectSerIteratorFactory.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport java.util.ArrayList;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaProperty;\nimport org.joda.collect.grid.Grid;\nimport org.joda.collect.grid.ImmutableCell;\nimport org.joda.collect.grid.ImmutableGrid;\n\n/**\n * Factory used to create wrappers around collection-like objects.\n */\npublic class CollectSerIteratorFactory extends GuavaSerIteratorFactory {\n\n    /**\n     * Creates an iterator wrapper for a meta-property value.\n     * \n     * @param value  the possible collection-like object, not null\n     * @param prop  the meta-property defining the value, not null\n     * @param beanClass  the class of the bean, not the meta-property, for better generics, not null\n     * @return the iterator, null if not a collection-like type\n     */\n    @Override\n    public SerIterator create(Object value, MetaProperty<?> prop, Class<?> beanClass) {\n        var declaredType = prop.propertyType();\n        if (value instanceof Grid<?> grid) {\n            var valueType = defaultToObjectClass(JodaBeanUtils.collectionType(prop, beanClass));\n            var valueTypeTypes = JodaBeanUtils.collectionTypeTypes(prop, beanClass);\n            return grid(grid, declaredType, valueType, valueTypeTypes);\n        }\n        return super.create(value, prop, beanClass);\n    }\n\n    /**\n     * Creates an iterator wrapper for a value retrieved from a parent iterator.\n     * <p>\n     * Allows the parent iterator to define the child iterator using generic type information.\n     * This handles cases such as a {@code List} as the value in a {@code Map}.\n     * \n     * @param value  the possible collection-like object, not null\n     * @param parent  the parent iterator, not null\n     * @return the iterator, null if not a collection-like type\n     */\n    @Override\n    public SerIterator createChild(Object value, SerIterator parent) {\n        var declaredType = parent.valueType();\n        var childGenericTypes = parent.valueTypeTypes();\n        if (value instanceof Grid<?> grid) {\n            if (childGenericTypes.size() == 1) {\n                return grid(grid, declaredType, childGenericTypes.get(0), EMPTY_VALUE_TYPES);\n            }\n            return grid(grid, Object.class, Object.class, EMPTY_VALUE_TYPES);\n        }\n        return super.createChild(value, parent);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates an iterator wrapper for a meta-property value.\n     * \n     * @param metaTypeDescription  the description of the collection type, not null\n     * @param settings  the settings object, not null\n     * @param knownTypes  the known types map, null if not using known type shortening\n     * @return the iterator, null if not a collection-like type\n     */\n    @Override\n    public SerIterable createIterable(String metaTypeDescription, JodaBeanSer settings, Map<String, Class<?>> knownTypes) {\n        if (metaTypeDescription.equals(\"Grid\")) {\n            return grid(Object.class, EMPTY_VALUE_TYPES);\n        }\n        return super.createIterable(metaTypeDescription, settings, knownTypes);\n    }\n\n    /**\n     * Creates an iterator wrapper for a meta-property value.\n     * \n     * @param prop  the meta-property defining the value, not null\n     * @param beanClass  the class of the bean, not the meta-property, for better generics, not null\n     * @return the iterator, null if not a collection-like type\n     */\n    @Override\n    public SerIterable createIterable(MetaProperty<?> prop, Class<?> beanClass) {\n        if (Grid.class.isAssignableFrom(prop.propertyType())) {\n            var valueType = JodaBeanUtils.collectionType(prop, beanClass);\n            var valueTypeTypes = JodaBeanUtils.collectionTypeTypes(prop, beanClass);\n            return grid(valueType, valueTypeTypes);\n        }\n        return super.createIterable(prop, beanClass);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets an iterable wrapper for {@code Grid}.\n     * \n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    public static SerIterable grid(Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        return new SerIterable() {\n            private final List<Grid.Cell<?>> cells = new ArrayList<>();\n            private int[] dimensions;\n\n            @Override\n            public SerIterator iterator() {\n                return grid(build(), Object.class, valueType, valueTypeTypes);\n            }\n\n            @Override\n            public void dimensions(int[] dimensions) {\n                this.dimensions = dimensions;\n            }\n\n            @Override\n            public void add(Object key, Object column, Object value, int count) {\n                if (value != null) {\n                    cells.add(ImmutableCell.of((Integer) key, (Integer) column, value));\n                }\n            }\n\n            @Override\n            @SuppressWarnings({\"unchecked\", \"rawtypes\"})\n            public Grid<?> build() {\n                if (dimensions == null || dimensions.length != 2) {\n                    throw new IllegalArgumentException(\"Expected 2 dimensions, rowCount and columnCount\");\n                }\n                return ImmutableGrid.copyOf(dimensions[0], dimensions[1], (Iterable) cells);\n            }\n\n            @Override\n            public SerCategory category() {\n                return SerCategory.GRID;\n            }\n\n            @Override\n            public Class<?> keyType() {\n                return Integer.class;\n            }\n\n            @Override\n            public Class<?> columnType() {\n                return Integer.class;\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n        };\n    }\n\n    /**\n     * Gets an iterator wrapper for {@code Grid}.\n     * \n     * @param grid  the collection, not null\n     * @param declaredType  the declared type, not null\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterator, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static SerIterator grid(Grid<?> grid, Class<?> declaredType, Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        return new SerIterator() {\n            private final Iterator it = grid.cells().iterator();\n            private Grid.Cell current;\n\n            @Override\n            public String metaTypeName() {\n                return \"Grid\";\n            }\n\n            @Override\n            public boolean metaTypeRequired() {\n                return !Grid.class.isAssignableFrom(declaredType);\n            }\n\n            @Override\n            public SerCategory category() {\n                return SerCategory.GRID;\n            }\n\n            @Override\n            public int dimensionSize(int dimension) {\n                return (dimension == 0 ? grid.rowCount() : grid.columnCount());\n            }\n\n            @Override\n            public int size() {\n                return grid.size();\n            }\n\n            @Override\n            public boolean hasNext() {\n                return it.hasNext();\n            }\n\n            @Override\n            public void next() {\n                current = (Grid.Cell) it.next();\n            }\n\n            @Override\n            public Class<?> keyType() {\n                return Integer.class;\n            }\n\n            @Override\n            public Object key() {\n                return current.getRow();\n            }\n\n            @Override\n            public Class<?> columnType() {\n                return Integer.class;\n            }\n\n            @Override\n            public Object column() {\n                return current.getColumn();\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public Object value() {\n                return current.getValue();\n            }\n\n            @Override\n            public Object value(int row, int column) {\n                return grid.get(row, column);\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n        };\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/DefaultDeserializer.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\n\n/**\n * Default deserializer that expects the input to match the current classpath beans.\n * <p>\n * This uses the standard {@code MetaBean}, {@code MetaProperty} and  {@code BeanBuilder}.\n */\npublic class DefaultDeserializer implements SerDeserializer {\n\n    /**\n     * Singleton.\n     */\n    public static final SerDeserializer INSTANCE = new DefaultDeserializer();\n\n    /**\n     * Creates an instance.\n     */\n    protected DefaultDeserializer() {\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MetaBean findMetaBean(Class<?> beanType) {\n        return MetaBean.of(beanType);\n    }\n\n    @Override\n    public BeanBuilder<?> createBuilder(Class<?> beanType, MetaBean metaBean) {\n        return metaBean.builder();\n    }\n\n    @Override\n    public MetaProperty<?> findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName) {\n        return metaBean.metaProperty(propertyName);\n    }\n\n    @Override\n    public void setValue(BeanBuilder<?> builder, MetaProperty<?> metaProp, Object value) {\n        builder.set(metaProp, value);\n    }\n\n    @Override\n    public Object build(Class<?> beanType, BeanBuilder<?> builder) {\n        return builder.build();\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public String toString() {\n        return getClass().getSimpleName();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/GuavaSerIteratorFactory.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport java.util.ArrayList;\nimport java.util.Iterator;\nimport java.util.LinkedHashMap;\nimport java.util.LinkedHashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.util.Set;\n\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaProperty;\n\nimport com.google.common.collect.ArrayListMultimap;\nimport com.google.common.collect.BiMap;\nimport com.google.common.collect.HashBasedTable;\nimport com.google.common.collect.HashBiMap;\nimport com.google.common.collect.HashMultimap;\nimport com.google.common.collect.HashMultiset;\nimport com.google.common.collect.ImmutableList;\nimport com.google.common.collect.ImmutableMap;\nimport com.google.common.collect.ImmutableSet;\nimport com.google.common.collect.ImmutableSortedMap;\nimport com.google.common.collect.ImmutableSortedSet;\nimport com.google.common.collect.ListMultimap;\nimport com.google.common.collect.Multimap;\nimport com.google.common.collect.Multiset;\nimport com.google.common.collect.Ordering;\nimport com.google.common.collect.SetMultimap;\nimport com.google.common.collect.SortedMultiset;\nimport com.google.common.collect.Table;\nimport com.google.common.collect.Table.Cell;\nimport com.google.common.collect.TreeMultiset;\n\n/**\n * Guava factory used to create wrappers around collection-like objects.\n */\npublic class GuavaSerIteratorFactory extends SerIteratorFactory {\n\n    /**\n     * Creates an iterator wrapper for a meta-property value.\n     * \n     * @param value  the possible collection-like object, not null\n     * @param prop  the meta-property defining the value, not null\n     * @param beanClass  the class of the bean, not the meta-property, for better generics, not null\n     * @return the iterator, null if not a collection-like type\n     */\n    @Override\n    public SerIterator create(Object value, MetaProperty<?> prop, Class<?> beanClass) {\n        var declaredType = prop.propertyType();\n        switch (value) {\n            case BiMap<?, ?> map -> {\n                var keyType = JodaBeanUtils.mapKeyType(prop, beanClass);\n                var valueType = JodaBeanUtils.mapValueType(prop, beanClass);\n                var valueTypeTypes = JodaBeanUtils.mapValueTypeTypes(prop, beanClass);\n                return biMap(map, declaredType, keyType, valueType, valueTypeTypes);\n            }\n            case Multiset<?> multiset -> {\n                var valueType = JodaBeanUtils.collectionType(prop, beanClass);\n                var valueTypeTypes = JodaBeanUtils.collectionTypeTypes(prop, beanClass);\n                return multiset(multiset, declaredType, valueType, valueTypeTypes);\n            }\n            case Multimap<?, ?> multimap -> {\n                var keyType = JodaBeanUtils.mapKeyType(prop, beanClass);\n                var valueType = JodaBeanUtils.mapValueType(prop, beanClass);\n                var valueTypeTypes = JodaBeanUtils.mapValueTypeTypes(prop, beanClass);\n                return multimap(multimap, declaredType, keyType, valueType, valueTypeTypes);\n            }\n            case Table<?, ?, ?> table -> {\n                var rowType = JodaBeanUtils.extractTypeClass(prop, beanClass, 3, 0);\n                var colType = JodaBeanUtils.extractTypeClass(prop, beanClass, 3, 1);\n                var valueType = JodaBeanUtils.extractTypeClass(prop, beanClass, 3, 2);\n                return table(table, declaredType, rowType, colType, valueType, EMPTY_VALUE_TYPES);\n            }\n            case null, default -> {\n                return super.create(value, prop, beanClass);\n            }\n        }\n    }\n\n    /**\n     * Creates an iterator wrapper for a value retrieved from a parent iterator.\n     * <p>\n     * Allows the parent iterator to define the child iterator using generic type information.\n     * This handles cases such as a {@code List} as the value in a {@code Map}.\n     * \n     * @param value  the possible collection-like object, not null\n     * @param parent  the parent iterator, not null\n     * @return the iterator, null if not a collection-like type\n     */\n    @Override\n    public SerIterator createChild(Object value, SerIterator parent) {\n        var declaredType = parent.valueType();\n        var childGenTypes = parent.valueTypeTypes();\n        switch (value) {\n            case BiMap<?, ?> map -> {\n                if (childGenTypes.size() == 2) {\n                    return biMap(map, declaredType, childGenTypes.get(0), childGenTypes.get(1), EMPTY_VALUE_TYPES);\n                }\n                return biMap(map, Object.class, Object.class, Object.class, EMPTY_VALUE_TYPES);\n            }\n            case Multimap<?, ?> multimap -> {\n                if (childGenTypes.size() == 2) {\n                    return multimap(multimap, declaredType, childGenTypes.get(0), childGenTypes.get(1), EMPTY_VALUE_TYPES);\n                }\n                return multimap(multimap, Object.class, Object.class, Object.class, EMPTY_VALUE_TYPES);\n            }\n            case Multiset<?> multiset -> {\n                if (childGenTypes.size() == 1) {\n                    return multiset(multiset, declaredType, childGenTypes.get(0), EMPTY_VALUE_TYPES);\n                }\n                return multiset(multiset, Object.class, Object.class, EMPTY_VALUE_TYPES);\n            }\n            case Table<?, ?, ?> table -> {\n                if (childGenTypes.size() == 3) {\n                    return table(table, declaredType,\n                            childGenTypes.get(0), childGenTypes.get(1),\n                            childGenTypes.get(2), EMPTY_VALUE_TYPES);\n                }\n                return table(table, Object.class, Object.class, Object.class, Object.class, EMPTY_VALUE_TYPES);\n            }\n            case null, default -> {\n                return super.createChild(value, parent);\n            }\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates an iterator wrapper for a meta-property value.\n     * \n     * @param metaTypeDescription  the description of the collection type, not null\n     * @param settings  the settings object, not null\n     * @param knownTypes  the known types map, null if not using known type shortening\n     * @return the iterator, null if not a collection-like type\n     */\n    @Override\n    public SerIterable createIterable(String metaTypeDescription, JodaBeanSer settings, Map<String, Class<?>> knownTypes) {\n        return switch (metaTypeDescription) {\n            case \"BiMap\" -> biMap(Object.class, Object.class, EMPTY_VALUE_TYPES);\n            case \"SetMultimap\" -> setMultimap(Object.class, Object.class, EMPTY_VALUE_TYPES);\n            case \"ListMultimap\", \"Multimap\" -> listMultimap(Object.class, Object.class, EMPTY_VALUE_TYPES);\n            case \"Multiset\" -> multiset(Object.class, EMPTY_VALUE_TYPES);\n            case \"Table\" -> table(Object.class, Object.class, Object.class, EMPTY_VALUE_TYPES);\n            default -> super.createIterable(metaTypeDescription, settings, knownTypes);\n        };\n    }\n\n    /**\n     * Creates an iterator wrapper for a meta-property value.\n     * \n     * @param prop  the meta-property defining the value, not null\n     * @param beanClass  the class of the bean, not the meta-property, for better generics, not null\n     * @return the iterator, null if not a collection-like type\n     */\n    @Override\n    public SerIterable createIterable(MetaProperty<?> prop, Class<?> beanClass) {\n        if (BiMap.class.isAssignableFrom(prop.propertyType())) {\n            var keyType = defaultToObjectClass(JodaBeanUtils.mapKeyType(prop, beanClass));\n            var valueType = defaultToObjectClass(JodaBeanUtils.mapValueType(prop, beanClass));\n            var valueTypeTypes = JodaBeanUtils.mapValueTypeTypes(prop, beanClass);\n            return biMap(keyType, valueType, valueTypeTypes);\n        }\n        if (SortedMultiset.class.isAssignableFrom(prop.propertyType())) {\n            var valueType = defaultToObjectClass(JodaBeanUtils.collectionType(prop, beanClass));\n            var valueTypeTypes = JodaBeanUtils.collectionTypeTypes(prop, beanClass);\n            return sortedMultiset(valueType, valueTypeTypes);\n        }\n        if (Multiset.class.isAssignableFrom(prop.propertyType())) {\n            var valueType = defaultToObjectClass(JodaBeanUtils.collectionType(prop, beanClass));\n            var valueTypeTypes = JodaBeanUtils.collectionTypeTypes(prop, beanClass);\n            return multiset(valueType, valueTypeTypes);\n        }\n        if (SetMultimap.class.isAssignableFrom(prop.propertyType())) {\n            var keyType = defaultToObjectClass(JodaBeanUtils.mapKeyType(prop, beanClass));\n            var valueType = defaultToObjectClass(JodaBeanUtils.mapValueType(prop, beanClass));\n            var valueTypeTypes = JodaBeanUtils.mapValueTypeTypes(prop, beanClass);\n            return setMultimap(keyType, valueType, valueTypeTypes);\n        }\n        if (ListMultimap.class.isAssignableFrom(prop.propertyType()) || Multimap.class.isAssignableFrom(prop.propertyType())) {\n            var keyType = defaultToObjectClass(JodaBeanUtils.mapKeyType(prop, beanClass));\n            var valueType = defaultToObjectClass(JodaBeanUtils.mapValueType(prop, beanClass));\n            var valueTypeTypes = JodaBeanUtils.mapValueTypeTypes(prop, beanClass);\n            return listMultimap(keyType, valueType, valueTypeTypes);\n        }\n        if (Table.class.isAssignableFrom(prop.propertyType())) {\n            var rowType = defaultToObjectClass(JodaBeanUtils.extractTypeClass(prop, beanClass, 3, 0));\n            var colType = defaultToObjectClass(JodaBeanUtils.extractTypeClass(prop, beanClass, 3, 1));\n            var valueType = defaultToObjectClass(JodaBeanUtils.extractTypeClass(prop, beanClass, 3, 2));\n            return table(rowType, colType, valueType, EMPTY_VALUE_TYPES);\n        }\n        if (ImmutableList.class.isAssignableFrom(prop.propertyType())) {\n            var valueType = JodaBeanUtils.collectionType(prop, beanClass);\n            var valueTypeTypes = JodaBeanUtils.collectionTypeTypes(prop, beanClass);\n            return immutableList(valueType, valueTypeTypes);\n        }\n        if (ImmutableSortedSet.class.isAssignableFrom(prop.propertyType())) {\n            var valueType = JodaBeanUtils.collectionType(prop, beanClass);\n            var valueTypeTypes = JodaBeanUtils.collectionTypeTypes(prop, beanClass);\n            return immutableSortedSet(valueType, valueTypeTypes);\n        }\n        if (ImmutableSet.class.isAssignableFrom(prop.propertyType())) {\n            var valueType = JodaBeanUtils.collectionType(prop, beanClass);\n            var valueTypeTypes = JodaBeanUtils.collectionTypeTypes(prop, beanClass);\n            return immutableSet(valueType, valueTypeTypes);\n        }\n        if (ImmutableSortedMap.class.isAssignableFrom(prop.propertyType())) {\n            var keyType = JodaBeanUtils.mapKeyType(prop, beanClass);\n            var valueType = JodaBeanUtils.mapValueType(prop, beanClass);\n            var valueTypeTypes = JodaBeanUtils.mapValueTypeTypes(prop, beanClass);\n            return immutableSortedMap(keyType, valueType, valueTypeTypes);\n        }\n        if (ImmutableMap.class.isAssignableFrom(prop.propertyType())) {\n            var keyType = JodaBeanUtils.mapKeyType(prop, beanClass);\n            var valueType = JodaBeanUtils.mapValueType(prop, beanClass);\n            var valueTypeTypes = JodaBeanUtils.mapValueTypeTypes(prop, beanClass);\n            return immutableMap(keyType, valueType, valueTypeTypes);\n        }\n        return super.createIterable(prop, beanClass);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets an iterable wrapper for {@code BiMap}.\n     * \n     * @param keyType  the value type, not null\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    public static SerIterable biMap(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        BiMap<Object, Object> map = HashBiMap.create();\n        return map(keyType, valueType, valueTypeTypes, map);\n    }\n\n    /**\n     * Gets an iterable wrapper for {@code Multiset}.\n     * \n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    public static SerIterable multiset(Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        Multiset<Object> coll = HashMultiset.create();\n        return multiset(valueType, valueTypeTypes, coll);\n    }\n\n    /**\n     * Gets an iterable wrapper for {@code SortedMultiset}.\n     * \n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    @SuppressWarnings({\"rawtypes\", \"unchecked\"})\n    public static SerIterable sortedMultiset(Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        Ordering natural = Ordering.natural();\n        SortedMultiset<Object> coll = TreeMultiset.create(natural);\n        return multiset(valueType, valueTypeTypes, coll);\n    }\n\n    private static SerIterable multiset(Class<?> valueType, List<Class<?>> valueTypeTypes, Multiset<Object> coll) {\n        return new SerIterable() {\n            @Override\n            public SerIterator iterator() {\n                return multiset(coll, Object.class, valueType, valueTypeTypes);\n            }\n\n            @Override\n            public void add(Object key, Object column, Object value, int count) {\n                if (key != null) {\n                    throw new IllegalArgumentException(\"Unexpected key\");\n                }\n                coll.add(value, count);\n            }\n\n            @Override\n            public Object build() {\n                return coll;\n            }\n\n            @Override\n            public SerCategory category() {\n                return SerCategory.COUNTED;\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n        };\n    }\n\n    /**\n     * Gets an iterator wrapper for {@code Multiset}.\n     * \n     * @param multiset  the collection, not null\n     * @param declaredType  the declared type, not null\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterator, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static SerIterator multiset(\n            Multiset<?> multiset, Class<?> declaredType, Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        return new SerIterator() {\n            private final Iterator it = multiset.entrySet().iterator();\n            private Multiset.Entry current;\n\n            @Override\n            public String metaTypeName() {\n                return \"Multiset\";\n            }\n\n            @Override\n            public boolean metaTypeRequired() {\n                return !Multiset.class.isAssignableFrom(declaredType);\n            }\n\n            @Override\n            public SerCategory category() {\n                return SerCategory.COUNTED;\n            }\n\n            @Override\n            public int size() {\n                return multiset.entrySet().size();\n            }\n\n            @Override\n            public boolean hasNext() {\n                return it.hasNext();\n            }\n\n            @Override\n            public void next() {\n                current = (Multiset.Entry) it.next();\n            }\n\n            @Override\n            public int count() {\n                return current.getCount();\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n\n            @Override\n            public Object value() {\n                return current.getElement();\n            }\n        };\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets an iterable wrapper for {@code ListMultimap}.\n     * \n     * @param keyType  the key type, not null\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    public static SerIterable listMultimap(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        ListMultimap<Object, Object> map = ArrayListMultimap.create();\n        return new SerIterable() {\n            @Override\n            public SerIterator iterator() {\n                return multimap(map, Object.class, keyType, valueType, valueTypeTypes);\n            }\n\n            @Override\n            public void add(Object key, Object column, Object value, int count) {\n                if (key == null) {\n                    throw new IllegalArgumentException(\"Missing key\");\n                }\n                if (count != 1) {\n                    throw new IllegalArgumentException(\"Unexpected count\");\n                }\n                map.put(key, value);\n            }\n\n            @Override\n            public Object build() {\n                return map;\n            }\n\n            @Override\n            public SerCategory category() {\n                return SerCategory.MAP;\n            }\n\n            @Override\n            public Class<?> keyType() {\n                return keyType;\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n        };\n    }\n\n    /**\n     * Gets an iterable wrapper for {@code SetMultimap}.\n     * \n     * @param keyType  the key type, not null\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    public static SerIterable setMultimap(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        SetMultimap<Object, Object> map = HashMultimap.create();\n        return new SerIterable() {\n            @Override\n            public SerIterator iterator() {\n                return multimap(map, Object.class, keyType, valueType, valueTypeTypes);\n            }\n\n            @Override\n            public void add(Object key, Object column, Object value, int count) {\n                if (key == null) {\n                    throw new IllegalArgumentException(\"Missing key\");\n                }\n                if (count != 1) {\n                    throw new IllegalArgumentException(\"Unexpected count\");\n                }\n                map.put(key, value);\n            }\n\n            @Override\n            public Object build() {\n                return map;\n            }\n\n            @Override\n            public SerCategory category() {\n                return SerCategory.MAP;\n            }\n\n            @Override\n            public Class<?> keyType() {\n                return keyType;\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n        };\n    }\n\n    /**\n     * Gets an iterator wrapper for {@code Multimap}.\n     * \n     * @param map  the collection, not null\n     * @param declaredType  the declared type, not null\n     * @param keyType  the key type, not null\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterator, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static SerIterator multimap(\n            Multimap<?, ?> map, Class<?> declaredType, Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        return new SerIterator() {\n            private final Iterator it = map.entries().iterator();\n            private Map.Entry current;\n\n            @Override\n            public String metaTypeName() {\n                if (map instanceof SetMultimap) {\n                    return \"SetMultimap\";\n                }\n                if (map instanceof ListMultimap) {\n                    return \"ListMultimap\";\n                }\n                return \"Multimap\";\n            }\n\n            @Override\n            public boolean metaTypeRequired() {\n                if (map instanceof SetMultimap) {\n                    return !SetMultimap.class.isAssignableFrom(declaredType);\n                }\n                if (map instanceof ListMultimap) {\n                    return !ListMultimap.class.isAssignableFrom(declaredType);\n                }\n                return !Multimap.class.isAssignableFrom(declaredType);\n            }\n\n            @Override\n            public SerCategory category() {\n                return SerCategory.MAP;\n            }\n\n            @Override\n            public int size() {\n                return map.size();\n            }\n\n            @Override\n            public boolean hasNext() {\n                return it.hasNext();\n            }\n\n            @Override\n            public void next() {\n                current = (Map.Entry) it.next();\n            }\n\n            @Override\n            public Class<?> keyType() {\n                return keyType;\n            }\n\n            @Override\n            public Object key() {\n                return current.getKey();\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n\n            @Override\n            public Object value() {\n                return current.getValue();\n            }\n        };\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets an iterable wrapper for {@code Table}.\n     * \n     * @param rowType  the row type, not null\n     * @param colType  the column type, not null\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    public static SerIterable table(Class<?> rowType, Class<?> colType, Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        Table<Object, Object, Object> table = HashBasedTable.create();\n        return new SerIterable() {\n            @Override\n            public SerIterator iterator() {\n                return table(table, Object.class, rowType, colType, valueType, valueTypeTypes);\n            }\n\n            @Override\n            public void add(Object row, Object column, Object value, int count) {\n                if (row == null) {\n                    throw new IllegalArgumentException(\"Missing row\");\n                }\n                if (column == null) {\n                    throw new IllegalArgumentException(\"Missing column\");\n                }\n                if (count != 1) {\n                    throw new IllegalArgumentException(\"Unexpected count\");\n                }\n                table.put(row, column, value);\n            }\n\n            @Override\n            public Object build() {\n                return table;\n            }\n\n            @Override\n            public SerCategory category() {\n                return SerCategory.TABLE;\n            }\n\n            @Override\n            public Class<?> keyType() {\n                return rowType;\n            }\n\n            @Override\n            public Class<?> columnType() {\n                return colType;\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n        };\n    }\n\n    /**\n     * Gets an iterator wrapper for {@code Table}.\n     * \n     * @param table  the collection, not null\n     * @param declaredType  the declared type, not null\n     * @param rowType  the row type, not null\n     * @param colType  the col type, not null\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterator, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static SerIterator table(\n            Table<?, ?, ?> table,\n            Class<?> declaredType,\n            Class<?> rowType,\n            Class<?> colType,\n            Class<?> valueType,\n            List<Class<?>> valueTypeTypes) {\n\n        return new SerIterator() {\n            private final Iterator it = table.cellSet().iterator();\n            private Cell current;\n\n            @Override\n            public String metaTypeName() {\n                return \"Table\";\n            }\n\n            @Override\n            public boolean metaTypeRequired() {\n                return !Table.class.isAssignableFrom(declaredType);\n            }\n\n            @Override\n            public SerCategory category() {\n                return SerCategory.TABLE;\n            }\n\n            @Override\n            public int size() {\n                return table.size();\n            }\n\n            @Override\n            public boolean hasNext() {\n                return it.hasNext();\n            }\n\n            @Override\n            public void next() {\n                current = (Cell) it.next();\n            }\n\n            @Override\n            public Class<?> keyType() {\n                return rowType;\n            }\n\n            @Override\n            public Object key() {\n                return current.getRowKey();\n            }\n\n            @Override\n            public Class<?> columnType() {\n                return colType;\n            }\n\n            @Override\n            public Object column() {\n                return current.getColumnKey();\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n\n            @Override\n            public Object value() {\n                return current.getValue();\n            }\n        };\n    }\n\n    /**\n     * Gets an iterator wrapper for {@code BiMap}.\n     * \n     * @param map  the collection, not null\n     * @param declaredType  the declared type, not null\n     * @param keyType  the value type, not null\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterator, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static SerIterator biMap(\n            BiMap<?, ?> map, Class<?> declaredType, Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        return new SerIterator() {\n            private final Iterator it = map.entrySet().iterator();\n            private Entry current;\n\n            @Override\n            public String metaTypeName() {\n                return \"BiMap\";\n            }\n\n            @Override\n            public boolean metaTypeRequired() {\n                // hack around Guava annoyance by assuming that size 0 and 1 ImmutableBiMap\n                // was actually meant to be an ImmutableMap\n                if ((declaredType == Map.class || declaredType == ImmutableMap.class) && map.size() < 2) {\n                    return false;\n                }\n                return !BiMap.class.isAssignableFrom(declaredType);\n            }\n\n            @Override\n            public SerCategory category() {\n                return SerCategory.MAP;\n            }\n\n            @Override\n            public int size() {\n                return map.size();\n            }\n\n            @Override\n            public boolean hasNext() {\n                return it.hasNext();\n            }\n\n            @Override\n            public void next() {\n                current = (Entry) it.next();\n            }\n\n            @Override\n            public Class<?> keyType() {\n                return keyType;\n            }\n\n            @Override\n            public Object key() {\n                return current.getKey();\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n\n            @Override\n            public Object value() {\n                return current.getValue();\n            }\n        };\n    }\n\n    /**\n     * Gets an iterable wrapper for {@code ImmutableList}.\n     *\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    public static SerIterable immutableList(Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        List<Object> coll = new ArrayList<>();\n        return new SerIterable() {\n            @Override\n            public SerIterator iterator() {\n                return collection(coll, Object.class, valueType, valueTypeTypes);\n            }\n\n            @Override\n            public void add(Object key, Object column, Object value, int count) {\n                if (key != null) {\n                    throw new IllegalArgumentException(\"Unexpected key\");\n                }\n                for (var i = 0; i < count; i++) {\n                    coll.add(value);\n                }\n            }\n\n            @Override\n            public Object build() {\n                return ImmutableList.copyOf(coll);\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n        };\n    }\n\n    /**\n     * Gets an iterable wrapper for {@code ImmutableSortedSet}.\n     *\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    public static SerIterable immutableSortedSet(Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        Set<Object> coll = new LinkedHashSet<>();\n        return new SerIterable() {\n            @Override\n            public SerIterator iterator() {\n                return collection(coll, Object.class, valueType, valueTypeTypes);\n            }\n\n            @Override\n            public void add(Object key, Object column, Object value, int count) {\n                if (key != null) {\n                    throw new IllegalArgumentException(\"Unexpected key\");\n                }\n                for (var i = 0; i < count; i++) {\n                    coll.add(value);\n                }\n            }\n\n            @Override\n            public Object build() {\n                return ImmutableSortedSet.copyOf(coll);\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n        };\n    }\n\n    /**\n     * Gets an iterable wrapper for {@code ImmutableSet}.\n     *\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    public static SerIterable immutableSet(Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        Set<Object> coll = new LinkedHashSet<>();\n        return new SerIterable() {\n            @Override\n            public SerIterator iterator() {\n                return collection(coll, Object.class, valueType, valueTypeTypes);\n            }\n\n            @Override\n            public void add(Object key, Object column, Object value, int count) {\n                if (key != null) {\n                    throw new IllegalArgumentException(\"Unexpected key\");\n                }\n                for (var i = 0; i < count; i++) {\n                    coll.add(value);\n                }\n            }\n\n            @Override\n            public Object build() {\n                return ImmutableSet.copyOf(coll);\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n        };\n    }\n\n    static SerIterable immutableMap(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        Map<Object, Object> map = new LinkedHashMap<>();\n        return new SerIterable() {\n            @Override\n            public SerIterator iterator() {\n                return map(map, Object.class, keyType, valueType, valueTypeTypes);\n            }\n\n            @Override\n            public void add(Object key, Object column, Object value, int count) {\n                if (key == null) {\n                    throw new IllegalArgumentException(\"Missing key\");\n                }\n                if (count != 1) {\n                    throw new IllegalArgumentException(\"Unexpected count\");\n                }\n                map.put(key, value);\n            }\n\n            @Override\n            public Object build() {\n                return ImmutableMap.copyOf(map);\n            }\n\n            @Override\n            public SerCategory category() {\n                return SerCategory.MAP;\n            }\n\n            @Override\n            public Class<?> keyType() {\n                return keyType;\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n        };\n    }\n\n    static SerIterable immutableSortedMap(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        Map<Object, Object> map = new LinkedHashMap<>();\n        return new SerIterable() {\n            @Override\n            public SerIterator iterator() {\n                return map(map, Object.class, keyType, valueType, valueTypeTypes);\n            }\n\n            @Override\n            public void add(Object key, Object column, Object value, int count) {\n                if (key == null) {\n                    throw new IllegalArgumentException(\"Missing key\");\n                }\n                if (count != 1) {\n                    throw new IllegalArgumentException(\"Unexpected count\");\n                }\n                map.put(key, value);\n            }\n\n            @Override\n            public Object build() {\n                return ImmutableSortedMap.copyOf(map);\n            }\n\n            @Override\n            public SerCategory category() {\n                return SerCategory.MAP;\n            }\n\n            @Override\n            public Class<?> keyType() {\n                return keyType;\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n        };\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/JodaBeanMimeType.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\n/**\n * Provides mime types for Joda-Beans.\n */\npublic final class JodaBeanMimeType {\n\n    /**\n     * Mime type for the binary format.\n     */\n    public static final String BINARY = \"application/vnd.org.joda.bean\";\n    /**\n     * Mime type for the XML format.\n     */\n    public static final String XML = \"application/vnd.org.joda.bean+xml\";\n    /**\n     * Mime type for the JSON format.\n     */\n    public static final String JSON = \"application/vnd.org.joda.bean+json\";\n\n    /**\n     * Restricted constructor\n     */\n    private JodaBeanMimeType() {\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/JodaBeanSer.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport java.util.Set;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.ser.bin.JodaBeanBinFormat;\nimport org.joda.beans.ser.bin.JodaBeanBinReader;\nimport org.joda.beans.ser.bin.JodaBeanBinWriter;\nimport org.joda.beans.ser.json.JodaBeanJsonNumberFormat;\nimport org.joda.beans.ser.json.JodaBeanJsonReader;\nimport org.joda.beans.ser.json.JodaBeanJsonWriter;\nimport org.joda.beans.ser.json.JodaBeanSimpleJsonReader;\nimport org.joda.beans.ser.json.JodaBeanSimpleJsonWriter;\nimport org.joda.beans.ser.map.JodaBeanSimpleMapReader;\nimport org.joda.beans.ser.map.JodaBeanSimpleMapWriter;\nimport org.joda.beans.ser.xml.JodaBeanXmlReader;\nimport org.joda.beans.ser.xml.JodaBeanXmlWriter;\nimport org.joda.convert.StringConvert;\n\n/**\n * Provides the ability for a Joda-Bean to be serialized.\n * <p>\n * Serialization of Joda-Beans uses the information in the beans to optimize\n * the size of the data output.\n */\npublic final class JodaBeanSer {\n\n    /**\n     * Obtains the singleton compact instance.\n     */\n    public static final JodaBeanSer COMPACT = new JodaBeanSer(\"\", \"\", StringConvert.create(),\n            SerIteratorFactory.INSTANCE, true, SerDeserializers.INSTANCE, false, Set.of(), JodaBeanJsonNumberFormat.STRING);\n    /**\n     * Obtains the singleton pretty-printing instance.\n     */\n    public static final JodaBeanSer PRETTY = new JodaBeanSer(\" \", \"\\n\", StringConvert.create(),\n            SerIteratorFactory.INSTANCE, true, SerDeserializers.INSTANCE, false, Set.of(), JodaBeanJsonNumberFormat.STRING);\n\n    /**\n     * The indent to use.\n     */\n    private final String indent;\n    /**\n     * The new line to use.\n     */\n    private final String newLine;\n    /**\n     * The string converter to use.\n     */\n    private final StringConvert converter;\n    /**\n     * The iterator factory to use.\n     */\n    private final SerIteratorFactory iteratorFactory;\n    /**\n     * Whether to use short types.\n     */\n    private final boolean shortTypes;\n    /**\n     * The deserializers.\n     */\n    private final SerDeserializers deserializers;\n    /**\n     * Whether to include derived properties.\n     */\n    private final boolean includeDerived;\n    /**\n     * The set of bean classes that are to be treated as values, caching by reference where possible.\n     * Types convertible by Joda-Convert are always treated as value classes.\n     * Note that most serializers do not cache by reference.\n     */\n    private final Set<Class<? extends ImmutableBean>> beanValueClasses;\n    /**\n     * The JSON number format.\n     */\n    private final JodaBeanJsonNumberFormat jsonNumberFormat;\n\n    /**\n     * Creates an instance.\n     * \n     * @param indent  the indent, not null\n     * @param newLine  the new line, not null\n     * @param converter  the converter, not null\n     * @param iteratorFactory  the iterator factory, not null\n     * @param shortTypes  whether to use short types\n     * @param deserializers  the deserializers to use, not null\n     * @param beanValueClasses  the bean value classes, not null\n     * @param jsonNumberFormat  the JSON number format, not null\n     */\n    private JodaBeanSer(String indent, String newLine, StringConvert converter,\n            SerIteratorFactory iteratorFactory,\n            boolean shortTypes,\n            SerDeserializers deserializers,\n            boolean includeDerived,\n            Set<Class<? extends ImmutableBean>> beanValueClasses,\n            JodaBeanJsonNumberFormat jsonNumberFormat) {\n\n        this.indent = indent;\n        this.newLine = newLine;\n        this.converter = converter;\n        this.iteratorFactory = iteratorFactory;\n        this.shortTypes = shortTypes;\n        this.deserializers = deserializers;\n        this.includeDerived = includeDerived;\n        this.beanValueClasses = Set.copyOf(beanValueClasses);\n        this.jsonNumberFormat = jsonNumberFormat;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the pretty print indent.\n     * \n     * @return the indent, not null\n     */\n    public String getIndent() {\n        return indent;\n    }\n\n    /**\n     * Returns a copy of this serializer with the specified pretty print indent.\n     * \n     * @param indent  the indent, not null\n     * @return a copy of this object with the indent changed, not null\n     */\n    public JodaBeanSer withIndent(String indent) {\n        JodaBeanUtils.notNull(indent, \"indent\");\n        return new JodaBeanSer(\n                indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived, beanValueClasses, jsonNumberFormat);\n    }\n\n    /**\n     * Gets the new line string.\n     * \n     * @return the newLine, not null\n     */\n    public String getNewLine() {\n        return newLine;\n    }\n\n    /**\n     * Returns a copy of this serializer with the specified pretty print new line.\n     * \n     * @param newLine  the new line, not null\n     * @return a copy of this object with the new line changed, not null\n     */\n    public JodaBeanSer withNewLine(String newLine) {\n        JodaBeanUtils.notNull(newLine, \"newLine\");\n        return new JodaBeanSer(\n                indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived, beanValueClasses, jsonNumberFormat);\n    }\n\n    /**\n     * Gets the string converter.\n     * <p>\n     * The default converter can be modified.\n     * \n     * @return the converter, not null\n     */\n    public StringConvert getConverter() {\n        return converter;\n    }\n\n    /**\n     * Returns a copy of this serializer with the specified string converter.\n     * <p>\n     * The default converter can be modified.\n     * \n     * @param converter  the converter, not null\n     * @return a copy of this object with the converter changed, not null\n     */\n    public JodaBeanSer withConverter(StringConvert converter) {\n        JodaBeanUtils.notNull(converter, \"converter\");\n        return new JodaBeanSer(\n                indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived, beanValueClasses, jsonNumberFormat);\n    }\n\n    /**\n     * Gets the iterator factory.\n     * \n     * @return the iterator factory, not null\n     */\n    public SerIteratorFactory getIteratorFactory() {\n        return iteratorFactory;\n    }\n\n    /**\n     * Returns a copy of this serializer with the specified iterator factory.\n     * \n     * @param iteratorFactory  the iterator factory, not null\n     * @return a copy of this object with the iterator factory changed, not null\n     */\n    public JodaBeanSer withIteratorFactory(SerIteratorFactory iteratorFactory) {\n        JodaBeanUtils.notNull(iteratorFactory, \"iteratorFactory\");\n        return new JodaBeanSer(\n                indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived, beanValueClasses, jsonNumberFormat);\n    }\n\n    /**\n     * Gets whether to use short types.\n     * \n     * @return the short types flag, not null\n     */\n    public boolean isShortTypes() {\n        return shortTypes;\n    }\n\n    /**\n     * Returns a copy of this serializer with the short types flag set.\n     * \n     * @param shortTypes  whether to use short types, not null\n     * @return a copy of this object with the short types flag changed, not null\n     */\n    public JodaBeanSer withShortTypes(boolean shortTypes) {\n        return new JodaBeanSer(\n                indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived, beanValueClasses, jsonNumberFormat);\n    }\n\n    /**\n     * Gets the deserializers.\n     * <p>\n     * The default deserializers can be modified.\n     * \n     * @return the converter, not null\n     */\n    public SerDeserializers getDeserializers() {\n        return deserializers;\n    }\n\n    /**\n     * Returns a copy of this serializer with the specified deserializers.\n     * <p>\n     * The default deserializers can be modified.\n     * <p>\n     * This can be used to select a more lenient mode of parsing, see {@link SerDeserializers#LENIENT}.\n     * \n     * @param deserializers  the deserializers, not null\n     * @return a copy of this object with the converter changed, not null\n     */\n    public JodaBeanSer withDeserializers(SerDeserializers deserializers) {\n        JodaBeanUtils.notNull(deserializers, \"deserializers\");\n        return new JodaBeanSer(\n                indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived, beanValueClasses, jsonNumberFormat);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the include derived flag.\n     * <p>\n     * The default deserializers can be modified.\n     * \n     * @return the converter, not null\n     */\n    public boolean isIncludeDerived() {\n        return includeDerived;\n    }\n\n    /**\n     * Returns a copy of this serializer with the specified include derived flag.\n     * <p>\n     * The default deserializers can be modified.\n     * <p>\n     * This is used to set the output to include derived properties.\n     * \n     * @param includeDerived  whether to include derived properties on output\n     * @return a copy of this object with the derived flag changed, not null\n     */\n    public JodaBeanSer withIncludeDerived(boolean includeDerived) {\n        return new JodaBeanSer(\n                indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived, beanValueClasses, jsonNumberFormat);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the bean value classes.\n     * \n     * @return the bean value classes, not null\n     * @since 3.0.0\n     */\n    public Set<Class<? extends ImmutableBean>> getBeanValueClasses() {\n        return beanValueClasses;\n    }\n\n    /**\n     * Returns a copy of this serializer with the bean value classes changed.\n     * \n     * @param beanValueClasses  the bean value classes, not null\n     * @return a copy of this object with the bean value classes changed, not null\n     * @since 3.0.0\n     */\n    public JodaBeanSer withBeanValueClasses(Set<Class<? extends ImmutableBean>> beanValueClasses) {\n        JodaBeanUtils.notNull(beanValueClasses, \"beanValueClasses\");\n        return new JodaBeanSer(\n                indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived, beanValueClasses, jsonNumberFormat);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the JSON number format.\n     * \n     * @return the JSON number format, not null\n     * @since 3.0.0\n     */\n    public JodaBeanJsonNumberFormat getJsonNumberFormat() {\n        return jsonNumberFormat;\n    }\n\n    /**\n     * Returns a copy of this serializer with the JSON number format changed.\n     * \n     * @param jsonNumberFormat  the JSON number format, not null\n     * @return a copy of this object with the bean value classes changed, not null\n     * @since 3.0.0\n     */\n    public JodaBeanSer withJsonNumberFormat(JodaBeanJsonNumberFormat jsonNumberFormat) {\n        JodaBeanUtils.notNull(jsonNumberFormat, \"jsonNumberFormat\");\n        return new JodaBeanSer(\n                indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived, beanValueClasses, jsonNumberFormat);\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Checks if the property is serialized.\n     * \n     * @param prop  the property to check\n     * @return true if the property is serialized\n     */\n    public boolean isSerialized(MetaProperty<?> prop) {\n        return prop.style().isSerializable() || (prop.style().isDerived() && includeDerived);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates a reader that determines the file format and parses it.\n     * <p>\n     * This parser can handle XML, JSON, simple JSON, binary and binary referencing formats.\n     * <p>\n     * It is recommended, though not necessary, to create a new instance of the reader for each message.\n     * \n     * @return the smart reader, not null\n     */\n    public JodaBeanSmartReader smartReader() {\n        return new JodaBeanSmartReader(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates a binary writer using the standard format.\n     * <p>\n     * It is recommended, though not necessary, to create a new instance of the writer for each message.\n     * \n     * @return the binary writer, not null\n     */\n    public JodaBeanBinWriter binWriter() {\n        return new JodaBeanBinWriter(this, JodaBeanBinFormat.STANDARD);\n    }\n\n    /**\n     * Creates a binary writer using the specified format.\n     * <p>\n     * It is recommended, though not necessary, to create a new instance of the writer for each message.\n     * \n     * @param format  the format, not null\n     * @return the binary writer, not null\n     * @since 3.0.0\n     */\n    public JodaBeanBinWriter binWriter(JodaBeanBinFormat format) {\n        return new JodaBeanBinWriter(this, format);\n    }\n\n    /**\n     * Creates a binary writer using the referencing format that typically results in a smaller output.\n     * <p>\n     * It is recommended, though not necessary, to create a new instance of the writer for each message.\n     * <p>\n     * The writer only supports serializing ImmutableBean instances and will throw an exception\n     * if any non-immutable beans are encountered.\n     * It assumes that non-bean items present within the root bean are themselves immutable.\n     * Due to this immutability restriction it serializes references to values based on object equality,\n     * rather than based on reference equality. When the output is parsed it may be smaller in memory\n     * as any beans that were originally equal will be returned as pointers to the same instance.\n     * <p>\n     * The reader {@link #binReader()} handles both the standard and referencing formats.\n     * \n     * @return the referencing binary writer, not null\n     * @deprecated Pass the format explicitly \n     */\n    @Deprecated\n    public JodaBeanBinWriter binWriterReferencing() {\n        return new JodaBeanBinWriter(this, JodaBeanBinFormat.REFERENCING);\n    }\n\n    /**\n     * Creates a binary reader that handles all binary formats that can be written.\n     * <p>\n     * It is recommended, though not necessary, to create a new instance of the reader for each message.\n     * \n     * @return the binary reader, not null\n     */\n    public JodaBeanBinReader binReader() {\n        return new JodaBeanBinReader(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates an XML writer.\n     * <p>\n     * A new instance of the writer must be created for each message.\n     * \n     * @return the XML writer, not null\n     */\n    public JodaBeanXmlWriter xmlWriter() {\n        return new JodaBeanXmlWriter(this);\n    }\n\n    /**\n     * Creates an XML reader.\n     * <p>\n     * A new instance of the reader must be created for each message.\n     * \n     * @return the XML reader, not null\n     */\n    public JodaBeanXmlReader xmlReader() {\n        return new JodaBeanXmlReader(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates a JSON writer.\n     * <p>\n     * A new instance of the writer must be created for each message.\n     * \n     * @return the JSON writer, not null\n     */\n    public JodaBeanJsonWriter jsonWriter() {\n        return new JodaBeanJsonWriter(this);\n    }\n\n    /**\n     * Creates a JSON reader.\n     * <p>\n     * A new instance of the reader must be created for each message.\n     * \n     * @return the JSON reader, not null\n     */\n    public JodaBeanJsonReader jsonReader() {\n        return new JodaBeanJsonReader(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates a simple JSON writer.\n     * <p>\n     * A new instance of the writer must be created for each message.\n     * The simple writer omits all metadata.\n     * It is suitable for simple beans as often found in data-transfer protocols.\n     * <p>\n     * Not all beans can be used with the simple JSON writer as no type information is written.\n     * If a bean has subclasses, or the declared type of a property or collection is\n     * {@code Object}, then the JSON will not round trip. Where the type cannot be determined,\n     * the reader will return {@code Boolean}, {@code Integer}, {@code Double}, {@code String},\n     * {@code ArrayList} or string keyed {@code HashMap}.\n     * Maps must have keys that can be written as a string.\n     * \n     * @return the simple JSON writer, not null\n     */\n    public JodaBeanSimpleJsonWriter simpleJsonWriter() {\n        return new JodaBeanSimpleJsonWriter(this);\n    }\n\n    /**\n     * Creates a simple JSON reader.\n     * <p>\n     * A new instance of the reader must be created for each message.\n     * The simple reader is designed to operate with the simple writer.\n     * It will not operate well with the output of {@link #jsonWriter()}.\n     * \n     * @return the simple JSON reader, not null\n     */\n    public JodaBeanSimpleJsonReader simpleJsonReader() {\n        return new JodaBeanSimpleJsonReader(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates a simple in-memory {@code Map} writer.\n     * <p>\n     * A new instance of the writer must be created for each message.\n     * \n     * @return the simple map writer, not null\n     */\n    public JodaBeanSimpleMapWriter simpleMapWriter() {\n        return new JodaBeanSimpleMapWriter(this);\n    }\n\n    /**\n     * Creates a simple in-memory {@code Map} reader.\n     * <p>\n     * A new instance of the reader must be created for each message.\n     * \n     * @return the simple map reader, not null\n     */\n    public JodaBeanSimpleMapReader simpleMapReader() {\n        return new JodaBeanSimpleMapReader(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public String toString() {\n        return getClass().getSimpleName();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/JodaBeanSerFormat.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.UncheckedIOException;\nimport java.nio.charset.StandardCharsets;\n\n/**\n * The Joda-Beans serialization format.\n */\nenum JodaBeanSerFormat {\n\n    /**\n     * The binary format.\n     */\n    BIN ,\n    /**\n     * The JSON format.\n     */\n    JSON,\n    /**\n     * The JSON format.\n     */\n    JSON_UTF8,\n    /**\n     * The XML format.\n     */\n    XML,\n    /**\n     * The XML format.\n     */\n    XML_UTF8,\n    /**\n     * The format is unknown.\n     */\n    UNKNOWN;\n\n    // creates the reader, handling any UTF BOM\n    <T> T read(InputStream stream, Class<T> rootType, JodaBeanSer settings) {\n        // javac generics fails when this code is moved to enum subclasses\n        return switch (this) {\n            case BIN -> settings.binReader().read(stream, rootType);\n            case JSON -> {\n                var reader = new InputStreamReader(stream, StandardCharsets.UTF_8);\n                yield rootType.cast(settings.simpleJsonReader().read(reader, rootType));\n            }\n            case JSON_UTF8 -> {\n                read(stream, 3);\n                var reader = new InputStreamReader(stream, StandardCharsets.UTF_8);\n                yield rootType.cast(settings.simpleJsonReader().read(reader, rootType));\n            }\n            case XML -> {\n                var reader = new InputStreamReader(stream, StandardCharsets.UTF_8);\n                yield rootType.cast(settings.xmlReader().read(reader, rootType));\n            }\n            case XML_UTF8 -> {\n                read(stream, 3);\n                var reader = new InputStreamReader(stream, StandardCharsets.UTF_8);\n                yield rootType.cast(settings.xmlReader().read(reader, rootType));\n            }\n            case UNKNOWN -> throw new IllegalArgumentException(\"File is not a recognised Joda-Beans format\");\n            default -> throw new IllegalArgumentException(\"File is not a recognised Joda-Beans format\");\n        };\n    }\n\n    // read a fixed number of bytes from the input stream\n    private static void read(InputStream buffered, int count) {\n        try {\n            for (var i = 0; i < count; i++) {\n                buffered.read();\n            }\n        } catch (IOException ex) {\n            throw new UncheckedIOException(ex);\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/JodaBeanSmartReader.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport java.io.BufferedInputStream;\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.UncheckedIOException;\nimport java.nio.charset.StandardCharsets;\nimport java.util.Arrays;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\n\n/**\n * Determines the correct file format and parses it appropriately.\n */\npublic class JodaBeanSmartReader {\n\n    /**\n     * The settings.\n     */\n    private final JodaBeanSer settings;\n\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings, not null\n     */\n    JodaBeanSmartReader(JodaBeanSer settings) {\n        this.settings = settings;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Checks if the input is a serialized Joda-Bean.\n     * <p>\n     * XML and JSON files may be prefixed by the UTF-8 Unicode BOM.\n     * <p>\n     * Callers may pass in part of the file, rather than the whole file.\n     * Up to 128 bytes are needed to determine the format (XML requires the most, others far less).\n     * \n     * @param input  the input bytes to check, which need only consist of the first 128 bytes of the file, not null\n     * @return true if it is a known format\n     */\n    public boolean isKnownFormat(byte[] input) {\n        return determineFormat(input) != JodaBeanSerFormat.UNKNOWN;\n    }\n\n    /**\n     * Checks if the input is a serialized Joda-Bean.\n     * <p>\n     * XML and JSON files may be prefixed by the UTF-8 Unicode BOM.\n     * <p>\n     * The input stream will be marked and reset, thus these operations must be supported.\n     * As such, the same stream can then be for parsing.\n     * \n     * @param input  the input stream to check, where only the first few bytes are read, not null\n     * @return true if it is a known format\n     * @throws UncheckedIOException if unable to read the stream\n     * @throws IllegalArgumentException if the input stream does not support mark/reset\n     */\n    public boolean isKnownFormat(InputStream input) {\n        return determineFormat(input) != JodaBeanSerFormat.UNKNOWN;\n    }\n\n    //-----------------------------------------------------------------------\n    // determines the format of a serialized Joda-Bean\n    private JodaBeanSerFormat determineFormat(byte[] input) {\n        if (input.length < 2) {\n            return JodaBeanSerFormat.UNKNOWN;\n        }\n        // parse each known format. including possible UTF BOM prefix\n        if (input.length >= 4 && input[0] == (byte) 0xef && input[1] == (byte) 0xbb && input[2] == (byte) 0xbf) {\n            if (input[3] == '<' && isXml(input, 3)) {\n                return JodaBeanSerFormat.XML_UTF8;\n            } else if (input[3] == '{' && isJson(input, 3)) {\n                return JodaBeanSerFormat.JSON_UTF8;\n            } else {\n                return JodaBeanSerFormat.UNKNOWN;\n            }\n        } else if (input[0] == '<' && isXml(input, 0)) {\n            return JodaBeanSerFormat.XML;\n        } else if (input[0] == '{' && isJson(input, 0)) {\n            return JodaBeanSerFormat.JSON;\n        } else if (input[0] == (byte) 0x94 && input[1] == (byte) 0x02) {\n            return JodaBeanSerFormat.BIN;\n        } else if (input[0] == (byte) 0x92 && input[1] == (byte) 0x01) {\n            return JodaBeanSerFormat.BIN;\n        } else {\n            return JodaBeanSerFormat.UNKNOWN;\n        }\n    }\n\n    private boolean isXml(byte[] bytes, int pos) {\n        var str = new String(bytes, pos, bytes.length - pos, StandardCharsets.UTF_8);\n        return str.contains(\"<bean \") || str.contains(\"<bean>\");\n    }\n\n    private boolean isJson(byte[] bytes, int pos) {\n        for (var i = pos + 1; i < bytes.length; i++) {\n            var b = bytes[i];\n            if (b == '}' || b == '\"') {\n                return true;\n            } else if (!(b == ' ' || b == '\\t' || b == '\\r' || b == '\\n')) {\n                return false;\n            }\n        }\n        return false;\n    }\n\n    // determines the format of a serialized Joda-Bean\n    private JodaBeanSerFormat determineFormat(InputStream input) {\n        if (!input.markSupported()) {\n            throw new IllegalArgumentException(\"Input stream does not support mark/reset\");\n        }\n        var buf = new byte[128];\n        try {\n            input.mark(128);\n            var readCount = read(input, buf, 128);\n            buf = Arrays.copyOf(buf, readCount);\n            input.reset();\n        } catch (IOException ex) {\n            throw new UncheckedIOException(ex);\n        }\n        return determineFormat(buf);\n    }\n\n    // fully reads the stream\n    private static int read(InputStream in, byte[] buf, int len) throws IOException {\n        var pos = 0;\n        while (pos < len) {\n            var result = in.read(buf, pos, len - pos);\n            if (result == -1) {\n                break;\n            }\n            pos += result;\n        }\n        return pos;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Reads and parses to a bean.\n     * <p>\n     * XML and JSON files may be prefixed by the UTF-8 Unicode BOM.\n     * \n     * @param input  the input bytes to parse, not null\n     * @return the bean, not null\n     * @throws IllegalArgumentException if the file format is not recognized\n     * @throws RuntimeException if unable to parse\n     */\n    public Bean read(byte[] input) {\n        return read(input, Bean.class);\n    }\n\n    /**\n     * Reads and parses to a bean.\n     * <p>\n     * XML and JSON files may be prefixed by the UTF-8 Unicode BOM.\n     * \n     * @param <T>  the root type\n     * @param input  the input bytes to parse, not null\n     * @param rootType  the root type, not null\n     * @return the bean, not null\n     * @throws IllegalArgumentException if the file format is not recognized\n     * @throws RuntimeException if unable to parse\n     */\n    public <T> T read(byte[] input, Class<T> rootType) {\n        JodaBeanUtils.notNull(input, \"input\");\n        return read(new ByteArrayInputStream(input), rootType);\n    }\n\n    /**\n     * Reads and parses to a bean.\n     * <p>\n     * XML and JSON files may be prefixed by the UTF-8 Unicode BOM.\n     * \n     * @param input  the input stream, not null\n     * @return the bean, not null\n     * @throws UncheckedIOException if unable to read the stream\n     * @throws IllegalArgumentException if the file format is not recognized\n     * @throws RuntimeException if unable to parse\n     */\n    public Bean read(InputStream input) {\n        return read(input, Bean.class);\n    }\n\n    /**\n     * Reads and parses to a bean.\n     * <p>\n     * XML and JSON files may be prefixed by the UTF-8 Unicode BOM.\n     * \n     * @param <T>  the root type\n     * @param input  the input stream, not null\n     * @param rootType  the root type, not null\n     * @return the bean, not null\n     * @throws UncheckedIOException if unable to read the stream\n     * @throws IllegalArgumentException if the file format is not recognized\n     * @throws RuntimeException if unable to parse\n     */\n    public <T> T read(InputStream input, Class<T> rootType) {\n        JodaBeanUtils.notNull(input, \"input\");\n        JodaBeanUtils.notNull(rootType, \"rootType\");\n        var buffered = buffer(input);\n        var format = determineFormat(buffered);\n        return format.read(buffered, rootType, settings);\n    }\n\n    // buffer the input stream\n    private BufferedInputStream buffer(InputStream input) {\n        if (input.getClass() == BufferedInputStream.class) {\n            return (BufferedInputStream) input;\n        }\n        return new BufferedInputStream(input);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/LenientDeserializer.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\n\n/**\n * Lenient deserializer that ignores unknown properties.\n */\nclass LenientDeserializer extends DefaultDeserializer {\n\n    /**\n     * Singleton.\n     */\n    public static final SerDeserializer INSTANCE = new LenientDeserializer();\n\n    /**\n     * Creates an instance.\n     */\n    protected LenientDeserializer() {\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MetaProperty<?> findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName) {\n        // dynamic beans force code by exception\n        try {\n            return metaBean.metaProperty(propertyName);\n        } catch (NoSuchElementException ex) {\n            return null;\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/LinkedByteArrayOutputStream.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.util.Arrays;\nimport java.util.HexFormat;\nimport java.util.Objects;\n\n/**\n * An optimised byte array output stream.\n * <p>\n * This class holds a number of smaller byte arrays internally.\n * Each array is typically 1024 bytes, but if a large byte array is written\n * the class will hold it as a single large array.\n * <p>\n * Calling {@link #toByteArray()} returns a single combined byte array.\n * Calling {@link #writeTo(OutputStream)} writes the internal arrays without needing to create a combined array.\n * <p>\n * This class is not thread-safe.\n */\npublic class LinkedByteArrayOutputStream extends OutputStream {\n\n    // segment holding one byte array, the current position in the array, and the next segment when it is full\n    private static final class ByteSegment {\n        private final byte[] bytes;\n        private int pos;\n        private ByteSegment next;\n\n        private ByteSegment(byte[] bytes) {\n            this.bytes = bytes;\n        }\n    }\n\n    // the head/root segment\n    private final ByteSegment head = new ByteSegment(new byte[1024]);\n    // the current tail\n    private ByteSegment tail = head;\n    // the total number of bytes written\n    private int total;\n\n    /**\n     * Creates an instance.\n     */\n    public LinkedByteArrayOutputStream() {\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Writes a single byte to the output stream.\n     * \n     * @param val  the value\n     */\n    @Override\n    public void write(int val) {\n        var tailRemaining = tail.bytes.length - tail.pos;\n        if (tailRemaining == 0) {\n            tail.next = new ByteSegment(new byte[1024]);\n            tail = tail.next;\n        }\n        tail.bytes[tail.pos] = (byte) val;\n        tail.pos++;\n        total++;\n    }\n\n    /**\n     * Writes all or part of a byte array to the output stream.\n     * \n     * @param bytes  the byte array to write, not null\n     * @param offset  the offset from the start of the array\n     * @param length  the number of bytes to write\n     * @throws IndexOutOfBoundsException if the offset or length is invalid\n     */\n    @Override\n    public void write(byte[] bytes, int offset, int length) {\n        Objects.checkFromIndexSize(offset, length, bytes.length);\n        var tailRemaining = tail.bytes.length - tail.pos;\n        // first part\n        var firstPartLength = Math.min(tailRemaining, length);\n        System.arraycopy(bytes, offset, tail.bytes, tail.pos, firstPartLength);\n        tail.pos += firstPartLength;\n        // remainder\n        var newLength = length - firstPartLength;\n        if (newLength > 0) {\n            var newOffset = offset + firstPartLength;\n            if (newLength >= 1024) {\n                tail.next = new ByteSegment(Arrays.copyOfRange(bytes, newOffset, length));\n            } else {\n                tail.next = new ByteSegment(new byte[1024]);\n                System.arraycopy(bytes, newOffset, tail.next.bytes, 0, newLength);\n            }\n            tail = tail.next;\n            tail.pos = newLength;\n        }\n        total += length;\n    }\n\n    /**\n     * Writes a byte array to the output stream.\n     * \n     * @param bytes  the byte array to write, not null\n     */\n    @Override\n    public void write(byte[] bytes) {\n        write(bytes, 0, bytes.length);\n    }\n\n    /**\n     * Writes all the bytes to the specified output stream.\n     * \n     * @param out  the output stream to write to\n     * @throws IOException if an IO error occurs\n     */\n    public void writeTo(OutputStream out) throws IOException {\n        for (var segment = head; segment != null; segment = segment.next) {\n            out.write(segment.bytes, 0, segment.pos);\n        }\n    }\n\n    /**\n     * Returns a single byte array containing all the bytes written to the output stream.\n     * <p>\n     * The returned array contains a copy of the internal state of this class.\n     * <p>\n     * It is not expected that callers will call this method multiple times, although it is safe to do so.\n     * \n     * @return the combined byte array\n     */\n    public byte[] toByteArray() {\n        var result = new byte[total];\n        var pos = 0;\n        for (var segment = head; segment != null; segment = segment.next) {\n            System.arraycopy(segment.bytes, 0, result, pos, segment.pos);\n            pos += segment.pos;\n        }\n        return result;\n    }\n\n    /**\n     * Gets the current number of bytes written.\n     * \n     * @return the number of bytes written\n     */\n    public int size() {\n        return total;\n    }\n\n    /**\n     * A no-op, as this class does not need flushing.\n     */\n    @Override\n    public void flush() {\n    }\n\n    /**\n     * A no-op, as this class does not need closing.\n     */\n    @Override\n    public void close() {\n    }\n\n    /**\n     * Returns a hex-formatted string of the bytes that have been written.\n     */\n    @Override\n    public String toString() {\n        var hex = HexFormat.of();\n        var buf = new StringBuilder(total * 2);\n        for (var segment = head; segment != null; segment = segment.next) {\n            hex.formatHex(buf, segment.bytes, 0, segment.pos);\n        }\n        return buf.toString();\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/SerCategory.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\n/**\n * Defines the type of the iterable.\n */\npublic enum SerCategory {\n\n    /**\n     * Simple collection.\n     */\n    COLLECTION,\n    /**\n     * Counted collection.\n     */\n    COUNTED,\n    /**\n     * Map.\n     */\n    MAP,\n    /**\n     * Table.\n     */\n    TABLE,\n    /**\n     * Grid.\n     */\n    GRID;\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/SerDeserializer.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\n\n/**\n * Assists with deserialization allowing migration of data from an old data format to a new one.\n * <p>\n * This allows beans stored under an old version to be read in by a newer version.\n * <p>\n * Methods are called in order as follows:\n * <ol>\n * <li>{@code lookupMetaBean}\n * <li>{@code createBuilder}\n * <li>{@code lookupMetaProperty}, then {@code setValue} - once per property\n * <li>{@code build}\n * </ol>\n * <p>\n * A renamed property can be handled by overriding the {@code lookupMetaProperty}:\n * <pre>\n *  public MetaProperty&lt;?&gt; findMetaProperty(Class&lt;?&gt; beanType, MetaBean metaBean, String propertyName) {\n *    if (\"firstName\".equals(propertyName)) {\n *      return metaBean.metaProperty(\"forename\");\n *    }\n *    return super.findMetaProperty(beanType, metaBean, propertyName);\n *  }\n * </pre>\n * <p>\n * A property type change can be handled by overriding the {@code lookupMetaProperty}\n * and {@code setValue}:\n * <pre>\n *  private MetaProperty&lt;String&gt; NUMBER_OF_CARS_STRING =\n *    StandaloneMetaProperty.of(\"numberOfCars\", SimplePerson.meta(), String.class);\n *  \n *  public MetaProperty&lt;?&gt; findMetaProperty(Class&lt;?&gt; beanType, MetaBean metaBean, String propertyName) {\n *    if (\"numberOfCars\".equals(propertyName)) {\n *      return NUMBER_OF_CARS_STRING;  // replica of the old property\n *    }\n *    return super.findMetaProperty(beanType, metaBean, propertyName);\n *  }\n *\n *  public void setValue(BeanBuilder builder, MetaProperty metaProp, Object value) {\n *    if (metaProp == NUMBER_OF_CARS_STRING &amp;&amp; value != null) {\n *      String oldValue = value.toString();\n *      switch (oldValue) {\n *        case \"One\": value = 1; break;\n *        case \"Two\": value = 2; break;\n *        case \"Lots\": value = 3; break;\n *        default: value = 0; break;\n *      }\n *    }\n *    super.setValue(builder, metaProp, value);\n *  }\n * </pre>\n * <p>\n * A semantic change can be handled by overriding the {@code createBuilder}\n * and {@code build}, buffering the input to process at the end of the bean:\n * <pre>\n *  public BeanBuilder createBuilder(Class beanType, MetaBean metaBean) {\n *    return BufferingBeanBuilder.of(metaBean);\n *  }\n *\n *  public Object build(Class&lt;?&gt; beanType, BeanBuilder&lt;?&gt; builder) {\n *    BufferingBeanBuilder&lt;?&gt; bld = (BufferingBeanBuilder&lt;?&gt;) builder;\n *    if (\"Stephen\".equals(bld.getBuffer().get(SimplePerson.meta().forename())) &amp;&amp;\n *         \"Colebourne\".equals(bld.getBuffer().get(SimplePerson.meta().surname()))) {\n *      bld.set(SimplePerson.meta().forename(), \"Steve\");\n *    }\n *    return bld.build();\n *  }\n * </pre>\n */\npublic interface SerDeserializer {\n\n    /**\n     * Lookup the meta-bean for the specified type.\n     * <p>\n     * If the type is not a bean, then null may be returned.\n     * \n     * @param beanType  the type being processed, not null\n     * @return the meta-bean, null if not a bean type\n     */\n    public abstract MetaBean findMetaBean(Class<?> beanType);\n\n    /**\n     * Creates the stateful builder that captures state as the parse progresses.\n     * <p>\n     * This is normally a {@code BeanBuilder} however any type may be returned.\n     * \n     * @param beanType  the type being processed, not null\n     * @param metaBean  the meta-bean, null if not a bean type\n     * @return the builder, null if not interested in the parse progress\n     */\n    public abstract BeanBuilder<?> createBuilder(Class<?> beanType, MetaBean metaBean);\n\n    /**\n     * Lookup the meta-property for the specified property name.\n     * <p>\n     * Return null if a property has been deleted, which will cause the parser\n     * to discard the property.\n     * <p>\n     * Return a non-null meta-property to parse the property.\n     * If the property was renamed, or had a type change, then the meta-property\n     * should match the property as originally stored.\n     * \n     * @param beanType  the type being processed, not null\n     * @param metaBean  the meta-bean, null if not a bean type\n     * @param propertyName  the property name being parsed, not null\n     * @return the meta-property, null to ignore the property\n     */\n    public abstract MetaProperty<?> findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName);\n\n    /**\n     * Sets the parsed value into the builder.\n     * \n     * @param builder  the builder, null if not interested in the parse progress\n     * @param metaProp  the meta-property, not null\n     * @param value  the parsed value, may be null\n     */\n    public abstract void setValue(BeanBuilder<?> builder, MetaProperty<?> metaProp, Object value);\n\n    /**\n     * Builds the resulting object.\n     * <p>\n     * This method finishes the builder and returns the final object.\n     * The migrator could validate or manipulate data here once all data is parsed,\n     * for example to default a missing field.\n     * \n     * @param beanType  the type being processed, not null\n     * @param builder  the builder, null if not interested in the parse progress\n     * @return the final built object, may be null\n     */\n    public abstract Object build(Class<?> beanType, BeanBuilder<?> builder);\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/SerDeserializerProvider.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\n/**\n * Provides access to deserializers.\n * <p>\n * This plugin point allows instances to {@link SerDeserializer} to be created.\n * Implementations of this interface can introspect the bean type when choosing a deserializer.\n * This allows deserializers to be provided that can handle multiple bean types, for example all beans\n * in a particular package, any bean with a particular supertype or with a particular annotation.\n * <p>\n * In the simple case where an exact match is needed, the class implementing {@link SerDeserializer}\n * can also implement {@link SerDeserializerProvider} with a singleton constant instance.\n */\npublic interface SerDeserializerProvider {\n\n    /**\n     * Finds the deserializer for the specified type.\n     * <p>\n     * If the type is not known, the implementation must return null.\n     * \n     * \n     * @param beanType  the type being processed, not null\n     * @return the deserializer, null if this provider does not support the type\n     */\n    public abstract SerDeserializer findDeserializer(Class<?> beanType);\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/SerDeserializers.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport static java.nio.charset.StandardCharsets.UTF_8;\nimport static java.util.stream.Collectors.toList;\nimport static java.util.stream.Collectors.toMap;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Modifier;\nimport java.net.URL;\nimport java.util.AbstractMap.SimpleEntry;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentMap;\nimport java.util.concurrent.CopyOnWriteArrayList;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.convert.RenameHandler;\n\n/**\n * Manages a map of deserializers that assist with data migration.\n * <p>\n * Deserializers handle situations where the data being read does not match the\n * bean in the classpath. See also {@code RenameHandler}.\n * <p>\n * Normally, it makes sense to customize the shared singleton instance, because\n * the classpath is static and fixed and the transformations are common.\n * <p>\n * Implementations must be thread-safe singletons.\n */\npublic final class SerDeserializers {\n\n    /**\n     * Deserializers loaded from the classpath.\n     */\n    private static final Map<Class<?>, SerDeserializer> CLASSPATH_STRICT = loadFromClasspath();\n    /**\n     * Deserializers loaded from the classpath.\n     */\n    private static final Map<Class<?>, SerDeserializer> CLASSPATH_LENIENT = CLASSPATH_STRICT.entrySet().stream()\n            .map(e -> new SimpleEntry<>(e.getKey(), toLenient(e.getValue())))\n            .collect(toMap(e -> e.getKey(), e -> e.getValue()));\n    /**\n     * Shared global instance which can be mutated.\n     */\n    public static final SerDeserializers INSTANCE = new SerDeserializers(false);\n    /**\n     * Lenient instance which can be mutated.\n     */\n    public static final SerDeserializers LENIENT = new SerDeserializers(true);\n\n    /**\n     * Whether deserialization is lenient.\n     */\n    private final boolean lenient;\n    /**\n     * The default deserializer.\n     */\n    private final SerDeserializer defaultDeserializer;\n    /**\n     * The deserializers.\n     */\n    private final ConcurrentMap<Class<?>, SerDeserializer> deserializers = new ConcurrentHashMap<>();\n    /**\n     * The deserializer providers.\n     */\n    private final CopyOnWriteArrayList<SerDeserializerProvider> providers = new CopyOnWriteArrayList<>();\n\n    /**\n     * Creates an instance.\n     */\n    public SerDeserializers() {\n        this.lenient = false;\n        this.defaultDeserializer = DefaultDeserializer.INSTANCE;\n        this.deserializers.putAll(CLASSPATH_STRICT);\n    }\n\n    /**\n     * Creates an instance using additional providers.\n     * \n     * @param providers  the providers to use\n     */\n    public SerDeserializers(SerDeserializerProvider... providers) {\n        this(false, providers);\n    }\n\n    /**\n     * Creates an instance using additional providers.\n     * \n     * @param lenient  whether to deserialize leniently\n     * @param providers  the providers to use\n     */\n    public SerDeserializers(boolean lenient, SerDeserializerProvider... providers) {\n        this.lenient = lenient;\n        this.defaultDeserializer = lenient ? LenientDeserializer.INSTANCE : DefaultDeserializer.INSTANCE;\n        this.deserializers.putAll(lenient ? CLASSPATH_LENIENT : CLASSPATH_STRICT);\n        this.providers.addAll(Arrays.asList(providers));\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Adds the deserializer to be used for the specified type.\n     * \n     * @param type  the type, not null\n     * @param deserializer  the deserializer, not null\n     * @return this, for chaining, not null\n     */\n    public SerDeserializers register(Class<?> type, SerDeserializer deserializer) {\n        deserializers.put(type, deserializer);\n        return this;\n    }\n\n    /**\n     * Gets the map of deserializers which can be modified.\n     * \n     * @return the map of deserializers, not null\n     */\n    public ConcurrentMap<Class<?>, SerDeserializer> getDeserializers() {\n        return deserializers;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Adds the deserializer provider to be used.\n     * \n     * @param provider  the deserializer provider, not null\n     * @return this, for chaining, not null\n     */\n    public SerDeserializers registerProvider(SerDeserializerProvider provider) {\n        providers.add(provider);\n        return this;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Finds the deserializer for the specified type.\n     * <p>\n     * The {@code DefaultDeserializer} is used if one has not been registered.\n     * \n     * @param type  the type, not null\n     * @return the deserializer, not null\n     */\n    public SerDeserializer findDeserializer(Class<?> type) {\n        var deser = deserializers.get(type);\n        if (deser != null) {\n            return deser;\n        }\n        for (SerDeserializerProvider provider : providers) {\n            deser = provider.findDeserializer(type);\n            if (deser != null) {\n                return deser;\n            }\n        }\n        return defaultDeserializer;\n    }\n\n    /**\n     * Decodes the type\n     * \n     * @param typeStr  the type, not null\n     * @param settings  the settings, not null\n     * @param basePackage  the base package, not null\n     * @param knownTypes  the known types, not null\n     * @param defaultType  the default type, not null\n     * @return the decoded type\n     * @throws ClassNotFoundException if the class is not found\n     */\n    public Class<?> decodeType(\n            String typeStr,\n            JodaBeanSer settings,\n            String basePackage,\n            Map<String, Class<?>> knownTypes,\n            Class<?> defaultType) throws ClassNotFoundException {\n        \n        if (lenient) {\n            return SerTypeMapper.decodeType(\n                    typeStr, settings, basePackage, knownTypes, defaultType == Object.class ? String.class : defaultType);\n        }\n        return SerTypeMapper.decodeType(typeStr, settings, basePackage, knownTypes);\n    }\n\n    //-----------------------------------------------------------------------\n    // loads config files\n    private static Map<Class<?>, SerDeserializer> loadFromClasspath() {\n        // log errors to System.err, as problems in static initializers can be troublesome to diagnose\n        Map<Class<?>, SerDeserializer> result = new HashMap<>();\n        URL url = null;\n        try {\n            // this is the new location of the file, working on Java 8, Java 9 class path and Java 9 module path\n            var loader = Thread.currentThread().getContextClassLoader();\n            if (loader == null) {\n                loader = RenameHandler.class.getClassLoader();\n            }\n            var en = loader.getResources(\"META-INF/org/joda/beans/JodaBeans.ini\");\n            while (en.hasMoreElements()) {\n                url = en.nextElement();\n                var lines = loadRenameFile(url);\n                parseRenameFile(lines, url, result);\n            }\n        } catch (Error | Exception ex) {\n            System.err.println(\"ERROR: Unable to load JodaBeans.ini: \" + url + \": \" + ex.getMessage());\n            ex.printStackTrace();\n            result.clear();\n        }\n        return result;\n    }\n\n    // loads a single rename file\n    private static List<String> loadRenameFile(URL url) throws IOException {\n        try (var reader = new BufferedReader(new InputStreamReader(url.openStream(), UTF_8))) {\n            return reader.lines()\n                    .filter(line -> !line.isEmpty() && !line.startsWith(\"#\"))\n                    .collect(toList());\n        }\n    }\n\n    // parses a single rename file\n    private static void parseRenameFile(List<String> lines, URL url, Map<Class<?>, SerDeserializer> map) {\n        // format allows multiple [deserializers] so file can be merged\n        var deserializers = false;\n        for (String line : lines) {\n            try {\n                if (line.equals(\"[deserializers]\")) {\n                    deserializers = true;\n                } else if (deserializers) {\n                    var equalsPos = line.indexOf('=');\n                    var beanName = equalsPos >= 0 ? line.substring(0, equalsPos).trim() : line;\n                    var deserName = equalsPos >= 0 ? line.substring(equalsPos + 1).trim() : line;\n                    registerFromClasspath(beanName, deserName, map);\n                } else {\n                    throw new IllegalArgumentException(\"JodaBeans.ini must start with [deserializers]\");\n                }\n            } catch (Exception ex) {\n                System.err.println(\"ERROR: Invalid JodaBeans.ini: \" + url + \": \" + ex.getMessage());\n            }\n        }\n    }\n\n    // parses and registers the classes\n    private static void registerFromClasspath(\n            String beanName, String deserName, Map<Class<?>, SerDeserializer> map) throws Exception {\n\n        Class<? extends Bean> beanClass = Class.forName(beanName).asSubclass(Bean.class);\n        Class<?> deserClass = Class.forName(deserName);\n\n        Field field = null;\n        SerDeserializer deser;\n        try {\n            field = deserClass.getDeclaredField(\"DESERIALIZER\");\n            if (!Modifier.isStatic(field.getModifiers())) {\n                throw new IllegalStateException(\"Field \" + field + \" must be static\");\n            }\n            deser = (SerDeserializer) field.get(null);\n        } catch (NoSuchFieldException ex) {\n            Constructor<?> cons = null;\n            try {\n                cons = deserClass.getConstructor();\n                deser = (SerDeserializer) cons.newInstance();\n            } catch (NoSuchMethodException ex2) {\n                throw new IllegalStateException(\n                        \"Class \" + deserClass.getName() + \" must have field DESERIALIZER or a no-arg constructor\");\n            } catch (IllegalAccessException ex2) {\n                cons.setAccessible(true);\n                deser = (SerDeserializer) cons.newInstance();\n            }\n        } catch (IllegalAccessException ex) {\n            field.setAccessible(true);\n            deser = (SerDeserializer) field.get(null);\n        }\n        map.put(beanClass, deser);\n    }\n\n    // makes the deserializer lenient\n    private static SerDeserializer toLenient(SerDeserializer underlying) {\n        return new SerDeserializer() {\n\n            @Override\n            public MetaBean findMetaBean(Class<?> beanType) {\n                return underlying.findMetaBean(beanType);\n            }\n\n            @Override\n            public BeanBuilder<?> createBuilder(Class<?> beanType, MetaBean metaBean) {\n                return underlying.createBuilder(beanType, metaBean);\n            }\n\n            @Override\n            public MetaProperty<?> findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName) {\n                // dynamic beans force code by exception\n                try {\n                    return underlying.findMetaProperty(beanType, metaBean, propertyName);\n                } catch (NoSuchElementException ex) {\n                    return null;\n                }\n            }\n\n            @Override\n            public void setValue(BeanBuilder<?> builder, MetaProperty<?> metaProp, Object value) {\n                underlying.setValue(builder, metaProp, value);\n            }\n\n            @Override\n            public Object build(Class<?> beanType, BeanBuilder<?> builder) {\n                return underlying.build(beanType, builder);\n            }\n        };\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public String toString() {\n        return getClass().getSimpleName();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/SerIterable.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport java.util.List;\n\n/**\n * An abstraction over collections, lists, sets and maps.\n * <p>\n * This is a plugin point that can handle Guava collections.\n */\npublic abstract class SerIterable {\n\n    /**\n     * Obtains an iterator over the data.\n     * \n     * @return the iterator, not null\n     */\n    public abstract SerIterator iterator();\n\n    /**\n     * Sets the dimensions of the wrapped collection.\n     * \n     * @param dimensions  the dimension, 0 for row, 1 for column\n     */\n    public void dimensions(int[] dimensions) {\n        throw new IllegalArgumentException(\"Iterable does not support dimensions\");\n    }\n\n    /**\n     * Adds an item to the builder.\n     * \n     * @param key  the key, such as for a map, null if no key\n     * @param column  the column, such as for a table, null if no column\n     * @param value  the value, such as for a map or list value, may be null\n     * @param count  the count, such as for a multiset, typically one or greater\n     */\n    public abstract void add(Object key, Object column, Object value, int count);\n\n    /**\n     * Builds the final collection.\n     * \n     * @return the build collection, not null\n     */\n    public abstract Object build();\n\n    /**\n     * Gets the category of iterable.\n     * \n     * @return the category, not null\n     */\n    public SerCategory category() {\n        return SerCategory.COLLECTION;\n    }\n\n    /**\n     * Gets the type of the key.\n     * \n     * @return the key type, null if no key\n     */\n    public Class<?> keyType() {\n        return null;\n    }\n\n    /**\n     * Gets the type of the column.\n     * \n     * @return the column type, null if no column\n     */\n    public Class<?> columnType() {\n        return null;\n    }\n\n    /**\n     * Gets the type of the value.\n     * \n     * @return the value type, not null\n     */\n    public abstract Class<?> valueType();\n\n    /**\n     * Gets the generic parameters of the value type.\n     * \n     * @return the generic parameters of the value type, not null\n     */\n    public abstract List<Class<?>> valueTypeTypes();\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/SerIterator.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport java.util.List;\n\n/**\n * An abstraction of collections, lists, sets and maps.\n * <p>\n * This is a plugin point that can handle Guava collections.\n */\npublic abstract class SerIterator {\n\n    /**\n     * Gets the meta type of the underlying.\n     * \n     * @return the type, such as 'List' or 'Map'\n     */\n    public abstract String metaTypeName();\n\n    /**\n     * Checks if the meta type of the underlying is required.\n     * \n     * @return true if generic inspection is insufficient to determine the collection\n     */\n    public abstract boolean metaTypeRequired();\n\n    /**\n     * Gets the size of one dimension of the wrapped collection.\n     * \n     * @param dimension  the dimension, 0 for row, 1 for column\n     * @return the size, -1 if unknown\n     */\n    public int dimensionSize(int dimension) {\n        return -1;\n    }\n\n    /**\n     * Gets the size of the wrapped collection.\n     * \n     * @return the size, -1 if unknown\n     */\n    public abstract int size();\n\n    /**\n     * Gets the category of iterable.\n     * \n     * @return the category, not null\n     */\n    public SerCategory category() {\n        return SerCategory.COLLECTION;\n    }\n\n    /**\n     * Checks if there is a next item.\n     * \n     * @return true if there is another item\n     */\n    public abstract boolean hasNext();\n\n    /**\n     * Advances to the next item.\n     */\n    public abstract void next();\n\n    /**\n     * Gets the number of occurrences of this item.\n     * \n     * @return the count\n     */\n    public int count() {\n        return 1;\n    }\n\n    /**\n     * Gets the type of the key.\n     * \n     * @return the key type, null if no key\n     */\n    public Class<?> keyType() {\n        return null;\n    }\n\n    /**\n     * The key.\n     * \n     * @return the key, may be null\n     */\n    public Object key() {\n        return null;\n    }\n\n    /**\n     * Gets the type of the column.\n     * \n     * @return the column type, null if no column\n     */\n    public Class<?> columnType() {\n        return null;\n    }\n\n    /**\n     * The column.\n     * \n     * @return the key, may be null\n     */\n    public Object column() {\n        return null;\n    }\n\n    /**\n     * Gets the type of the value.\n     * \n     * @return the value type, not null\n     */\n    public abstract Class<?> valueType();\n\n    /**\n     * Gets the generic parameters of the value type.\n     * \n     * @return the generic parameters of the value type, not null\n     */\n    public abstract List<Class<?>> valueTypeTypes();\n\n    /**\n     * The value.\n     * \n     * @return the value, may be null\n     */\n    public abstract Object value();\n\n    /**\n     * The value at a row/column.\n     * \n     * @param row  the row\n     * @param column  the column\n     * @return the value\n     */\n    public Object value(int row, int column) {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/SerIteratorFactory.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport java.lang.reflect.Array;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.util.NavigableMap;\nimport java.util.NavigableSet;\nimport java.util.Set;\nimport java.util.SortedMap;\nimport java.util.SortedSet;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaProperty;\nimport org.joda.collect.grid.ImmutableGrid;\n\nimport com.google.common.collect.ImmutableMultiset;\n\n/**\n * A factory used to create wrappers around collection-like objects.\n */\npublic class SerIteratorFactory {\n\n    /**\n     * Singleton instance.\n     */\n    public static final SerIteratorFactory INSTANCE = getInstance();\n\n    private static SerIteratorFactory getInstance() {\n        try {\n            ImmutableGrid.of();  // check if class is available\n            return new CollectSerIteratorFactory();\n        } catch (Exception | LinkageError ex) {\n            try {\n                ImmutableMultiset.of();  // check if class is available\n                return new GuavaSerIteratorFactory();\n            } catch (Exception | LinkageError ex2) {\n                return new SerIteratorFactory();\n            }\n        }\n    }\n\n    /**\n     * An empty list of classes.\n     */\n    public static final List<Class<?>> EMPTY_VALUE_TYPES = Collections.emptyList();\n    /**\n     * Map of array types.\n     */\n    private static final Map<String, Class<?>> META_TYPE_MAP = new HashMap<>();\n    static {\n        META_TYPE_MAP.put(\"Object[]\", Object.class);\n        META_TYPE_MAP.put(\"String[]\", String.class);\n        META_TYPE_MAP.put(\"boolean[]\", boolean.class);\n        META_TYPE_MAP.put(\"char[]\", char.class);\n        META_TYPE_MAP.put(\"byte[]\", byte.class);\n        META_TYPE_MAP.put(\"short[]\", short.class);\n        META_TYPE_MAP.put(\"int[]\", int.class);\n        META_TYPE_MAP.put(\"long[]\", long.class);\n        META_TYPE_MAP.put(\"float[]\", float.class);\n        META_TYPE_MAP.put(\"double[]\", double.class);\n        META_TYPE_MAP.put(\"Object[][]\", Object[].class);\n        META_TYPE_MAP.put(\"String[][]\", String[].class);\n        META_TYPE_MAP.put(\"boolean[][]\", boolean[].class);\n        META_TYPE_MAP.put(\"char[][]\", char[].class);\n        META_TYPE_MAP.put(\"byte[][]\", byte[].class);\n        META_TYPE_MAP.put(\"short[][]\", short[].class);\n        META_TYPE_MAP.put(\"int[][]\", int[].class);\n        META_TYPE_MAP.put(\"long[][]\", long[].class);\n        META_TYPE_MAP.put(\"float[][]\", float[].class);\n        META_TYPE_MAP.put(\"double[][]\", double[].class);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates an iterator wrapper for a meta-property value.\n     * \n     * @param value  the possible collection-like object, not null\n     * @param prop  the meta-property defining the value, not null\n     * @param beanClass  the class of the bean, not the meta-property, for better generics, not null\n     * @param allowPrimitiveArrays  whether to allow primitive arrays\n     * @return the iterator, null if not a collection-like type\n     */\n    public SerIterator create(Object value, MetaProperty<?> prop, Class<?> beanClass, boolean allowPrimitiveArrays) {\n        if (allowPrimitiveArrays &&\n                value.getClass().isArray() &&\n                value.getClass().getComponentType().isPrimitive() &&\n                value.getClass().getComponentType() != byte.class) {\n            return arrayPrimitive(value, prop.propertyType(), value.getClass().getComponentType());\n        }\n        return create(value, prop, beanClass);\n    }\n\n    /**\n     * Creates an iterator wrapper for a meta-property value.\n     * \n     * @param value  the possible collection-like object, not null\n     * @param prop  the meta-property defining the value, not null\n     * @param beanClass  the class of the bean, not the meta-property, for better generics, not null\n     * @return the iterator, null if not a collection-like type\n     */\n    public SerIterator create(Object value, MetaProperty<?> prop, Class<?> beanClass) {\n        var declaredType = prop.propertyType();\n        if (value instanceof Collection<?> collection) {\n            var valueType = defaultToObjectClass(JodaBeanUtils.collectionType(prop, beanClass));\n            var valueTypeTypes = JodaBeanUtils.collectionTypeTypes(prop, beanClass);\n            return collection(collection, declaredType, valueType, valueTypeTypes);\n        }\n        if (value instanceof Map<?, ?> map) {\n            var keyType = defaultToObjectClass(JodaBeanUtils.mapKeyType(prop, beanClass));\n            var valueType = defaultToObjectClass(JodaBeanUtils.mapValueType(prop, beanClass));\n            var valueTypeTypes = JodaBeanUtils.mapValueTypeTypes(prop, beanClass);\n            return map(map, declaredType, keyType, valueType, valueTypeTypes);\n        }\n        if (value.getClass().isArray() && !value.getClass().getComponentType().isPrimitive()) {\n            var array = (Object[]) value;\n            return array(array, declaredType, array.getClass().getComponentType());\n        }\n        return null;\n    }\n\n    /**\n     * Creates an iterator wrapper for a value retrieved from a parent iterator.\n     * <p>\n     * Allows the parent iterator to define the child iterator using generic type information.\n     * This handles cases such as a {@code List} as the value in a {@code Map}.\n     * \n     * @param value  the possible collection-like object, not null\n     * @param parent  the parent iterator, not null\n     * @return the iterator, null if not a collection-like type\n     */\n    public SerIterator createChild(Object value, SerIterator parent) {\n        var declaredType = parent.valueType();\n        var childGenericTypes = parent.valueTypeTypes();\n        if (value instanceof Collection<?> collection) {\n            if (childGenericTypes.size() == 1) {\n                return collection(collection, declaredType, childGenericTypes.getFirst(), EMPTY_VALUE_TYPES);\n            }\n            return collection(collection, Object.class, Object.class, EMPTY_VALUE_TYPES);\n        }\n        if (value instanceof Map<?, ?> map) {\n            if (childGenericTypes.size() == 2) {\n                return map(map, declaredType, childGenericTypes.getFirst(), childGenericTypes.get(1), EMPTY_VALUE_TYPES);\n            }\n            return map(map, Object.class, Object.class, Object.class, EMPTY_VALUE_TYPES);\n        }\n        if (value.getClass().isArray() && !value.getClass().getComponentType().isPrimitive()) {\n            var array = (Object[]) value;\n            return array(array, Object.class, value.getClass().getComponentType());\n        }\n        return null;\n    }\n\n    /**\n     * Defaults input class to Object class.\n     * \n     * @param type  the type, may be null\n     * @return the type, not null\n     */\n    protected Class<?> defaultToObjectClass(Class<?> type) {\n        return (type != null ? type : Object.class);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates an iterator wrapper for a meta-type description.\n     * \n     * @param metaTypeDescription  the description of the collection type, not null\n     * @param settings  the settings object, not null\n     * @param knownTypes  the known types map, null if not using known type shortening\n     * @return the iterable, null if not a collection-like type\n     */\n    public SerIterable createIterable(String metaTypeDescription, JodaBeanSer settings, Map<String, Class<?>> knownTypes) {\n        if (metaTypeDescription.equals(\"Set\")) {\n            return set(Object.class, EMPTY_VALUE_TYPES);\n        }\n        if (metaTypeDescription.equals(\"List\") || metaTypeDescription.equals(\"Collection\")) {\n            return list(Object.class, EMPTY_VALUE_TYPES);\n        }\n        if (metaTypeDescription.equals(\"Map\")) {\n            return map(Object.class, Object.class, EMPTY_VALUE_TYPES);\n        }\n        if (metaTypeDescription.endsWith(\"[][][]\")) {\n            throw new IllegalArgumentException(\"Three-dimensional arrays cannot be parsed\");\n        }\n        if (metaTypeDescription.endsWith(\"[][]\")) {\n            var type = META_TYPE_MAP.get(metaTypeDescription);\n            if (type != null) {\n                return array(type);\n            }\n            var clsStr = metaTypeDescription.substring(0, metaTypeDescription.length() - 4);\n            try {\n                var cls = SerTypeMapper.decodeType(clsStr, settings, null, knownTypes);\n                var compound = \"[L\" + cls.getName() + \";\";\n                return array(Class.forName(compound));  // needs to be Class.forName\n            } catch (ClassNotFoundException ex) {\n                throw new RuntimeException(ex);\n            }\n        }\n        if (metaTypeDescription.endsWith(\"[]\")) {\n            var type = META_TYPE_MAP.get(metaTypeDescription);\n            if (type == null) {\n                var clsStr = metaTypeDescription.substring(0, metaTypeDescription.length() - 2);\n                try {\n                    type = SerTypeMapper.decodeType(clsStr, settings, null, knownTypes);\n                } catch (ClassNotFoundException ex) {\n                    throw new RuntimeException(ex);\n                }\n            }\n            return array(type);\n        }\n        return null;\n    }\n\n    /**\n     * Creates an iterator wrapper for a child where there are second level generic parameters.\n     * \n     * @param iterable  the parent iterable, not null\n     * @return the iterable, null if not a collection-like type\n     */\n    public SerIterable createIterable(SerIterable iterable) {\n        var valueTypeTypes = iterable.valueTypeTypes();\n        if (!valueTypeTypes.isEmpty()) {\n            var valueType = iterable.valueType();\n            if (NavigableSet.class.isAssignableFrom(valueType)) {\n                return navigableSet(valueTypeTypes.get(0), EMPTY_VALUE_TYPES);\n            }\n            if (SortedSet.class.isAssignableFrom(valueType)) {\n                return sortedSet(valueTypeTypes.get(0), EMPTY_VALUE_TYPES);\n            }\n            if (Set.class.isAssignableFrom(valueType)) {\n                return set(valueTypeTypes.get(0), EMPTY_VALUE_TYPES);\n            }\n            if (Collection.class.isAssignableFrom(valueType)) {  // includes List\n                return list(valueTypeTypes.get(0), EMPTY_VALUE_TYPES);\n            }\n            if (NavigableMap.class.isAssignableFrom(valueType)) {\n                if (valueTypeTypes.size() == 2) {\n                    return navigableMap(valueTypeTypes.get(0), valueTypeTypes.get(1), EMPTY_VALUE_TYPES);\n                }\n                return navigableMap(Object.class, Object.class, EMPTY_VALUE_TYPES);\n            }\n            if (SortedMap.class.isAssignableFrom(valueType)) {\n                if (valueTypeTypes.size() == 2) {\n                    return sortedMap(valueTypeTypes.get(0), valueTypeTypes.get(1), EMPTY_VALUE_TYPES);\n                }\n                return sortedMap(Object.class, Object.class, EMPTY_VALUE_TYPES);\n            }\n            if (Map.class.isAssignableFrom(valueType)) {\n                if (valueTypeTypes.size() == 2) {\n                    return map(valueTypeTypes.get(0), valueTypeTypes.get(1), EMPTY_VALUE_TYPES);\n                }\n                return map(Object.class, Object.class, EMPTY_VALUE_TYPES);\n            }\n            if (valueType.isArray()) {\n                return array(valueType.getComponentType());\n            }\n        }\n        return null;\n    }\n\n    /**\n     * Creates an iterator wrapper for a meta-property value.\n     * \n     * @param prop  the meta-property defining the value, not null\n     * @param beanClass  the class of the bean, not the meta-property, for better generics, not null\n     * @param allowPrimitiveArrays  whether to allow primitive arrays\n     * @return the iterable, null if not a collection-like type\n     */\n    public SerIterable createIterable(MetaProperty<?> prop, Class<?> beanClass, boolean allowPrimitiveArrays) {\n        if (allowPrimitiveArrays &&\n                prop.propertyType().isArray() &&\n                prop.propertyType().getComponentType().isPrimitive() &&\n                prop.propertyType().getComponentType() != byte.class) {\n            return arrayPrimitive(prop.propertyType().getComponentType());\n        }\n        return createIterable(prop, beanClass);\n    }\n\n    /**\n     * Creates an iterator wrapper for a meta-property value.\n     * \n     * @param prop  the meta-property defining the value, not null\n     * @param beanClass  the class of the bean, not the meta-property, for better generics, not null\n     * @return the iterable, null if not a collection-like type\n     */\n    public SerIterable createIterable(MetaProperty<?> prop, Class<?> beanClass) {\n        var propType = prop.propertyType();\n        if (NavigableSet.class.isAssignableFrom(propType)) {\n            var valueType = JodaBeanUtils.collectionType(prop, beanClass);\n            var valueTypeTypes = JodaBeanUtils.collectionTypeTypes(prop, beanClass);\n            return navigableSet(valueType, valueTypeTypes);\n        }\n        if (SortedSet.class.isAssignableFrom(prop.propertyType())) {\n            var valueType = JodaBeanUtils.collectionType(prop, beanClass);\n            var valueTypeTypes = JodaBeanUtils.collectionTypeTypes(prop, beanClass);\n            return sortedSet(valueType, valueTypeTypes);\n        }\n        if (Set.class.isAssignableFrom(prop.propertyType())) {\n            var valueType = JodaBeanUtils.collectionType(prop, beanClass);\n            var valueTypeTypes = JodaBeanUtils.collectionTypeTypes(prop, beanClass);\n            return set(valueType, valueTypeTypes);\n        }\n        if (Collection.class.isAssignableFrom(prop.propertyType())) {  // includes List\n            var valueType = JodaBeanUtils.collectionType(prop, beanClass);\n            var valueTypeTypes = JodaBeanUtils.collectionTypeTypes(prop, beanClass);\n            return list(valueType, valueTypeTypes);\n        }\n        if (NavigableMap.class.isAssignableFrom(prop.propertyType())) {\n            var keyType = JodaBeanUtils.mapKeyType(prop, beanClass);\n            var valueType = JodaBeanUtils.mapValueType(prop, beanClass);\n            var valueTypeTypes = JodaBeanUtils.mapValueTypeTypes(prop, beanClass);\n            return navigableMap(keyType, valueType, valueTypeTypes);\n        }\n        if (SortedMap.class.isAssignableFrom(prop.propertyType())) {\n            var keyType = JodaBeanUtils.mapKeyType(prop, beanClass);\n            var valueType = JodaBeanUtils.mapValueType(prop, beanClass);\n            var valueTypeTypes = JodaBeanUtils.mapValueTypeTypes(prop, beanClass);\n            return sortedMap(keyType, valueType, valueTypeTypes);\n        }\n        if (Map.class.isAssignableFrom(prop.propertyType())) {\n            var keyType = JodaBeanUtils.mapKeyType(prop, beanClass);\n            var valueType = JodaBeanUtils.mapValueType(prop, beanClass);\n            var valueTypeTypes = JodaBeanUtils.mapValueTypeTypes(prop, beanClass);\n            return map(keyType, valueType, valueTypeTypes);\n        }\n        if (prop.propertyType().isArray() && !prop.propertyType().getComponentType().isPrimitive()) {\n            return array(prop.propertyType().getComponentType());\n        }\n        return null;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets an iterable wrapper for {@code List}.\n     * \n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    public static SerIterable list(Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        List<Object> coll = new ArrayList<>();\n        return new SerIterable() {\n            @Override\n            public SerIterator iterator() {\n                return collection(coll, Object.class, valueType, valueTypeTypes);\n            }\n\n            @Override\n            public void add(Object key, Object column, Object value, int count) {\n                if (key != null) {\n                    throw new IllegalArgumentException(\"Unexpected key\");\n                }\n                for (var i = 0; i < count; i++) {\n                    coll.add(value);\n                }\n            }\n\n            @Override\n            public Object build() {\n                return coll;\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n        };\n    }\n\n    /**\n     * Gets an iterable wrapper for {@code Set}.\n     * \n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    public static SerIterable set(Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        Set<Object> coll = new HashSet<>();\n        return set(valueType, valueTypeTypes, coll);\n    }\n\n    /**\n     * Gets an iterable wrapper for {@code SortedSet}.\n     * \n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    public static SerIterable sortedSet(Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        SortedSet<Object> coll = new TreeSet<>();\n        return set(valueType, valueTypeTypes, coll);\n    }\n\n    /**\n     * Gets an iterable wrapper for {@code NavigableSet}.\n     * \n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    public static SerIterable navigableSet(Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        NavigableSet<Object> coll = new TreeSet<>();\n        return set(valueType, valueTypeTypes, coll);\n    }\n\n    private static SerIterable set(Class<?> valueType, List<Class<?>> valueTypeTypes, Set<Object> coll) {\n        return new SerIterable() {\n            @Override\n            public SerIterator iterator() {\n                return collection(coll, Object.class, valueType, valueTypeTypes);\n            }\n\n            @Override\n            public void add(Object key, Object column, Object value, int count) {\n                if (key != null) {\n                    throw new IllegalArgumentException(\"Unexpected key\");\n                }\n                for (var i = 0; i < count; i++) {\n                    coll.add(value);\n                }\n            }\n\n            @Override\n            public Object build() {\n                return coll;\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n        };\n    }\n\n    /**\n     * Gets an iterator wrapper for {@code Collection}.\n     * \n     * @param coll  the collection, not null\n     * @param declaredType  the declared type, not null\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterator, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static SerIterator collection(\n            Collection<?> coll, Class<?> declaredType, Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        return new SerIterator() {\n            private final Iterator it = coll.iterator();\n            private Object current;\n\n            @Override\n            public String metaTypeName() {\n                if (coll instanceof Set) {\n                    return \"Set\";\n                }\n                if (coll instanceof List) {\n                    return \"List\";\n                }\n                return \"Collection\";\n            }\n\n            @Override\n            public boolean metaTypeRequired() {\n                if (coll instanceof Set) {\n                    return !Set.class.isAssignableFrom(declaredType);\n                }\n                if (coll instanceof List) {\n                    return !List.class.isAssignableFrom(declaredType);\n                }\n                return !Collection.class.isAssignableFrom(declaredType);\n            }\n\n            @Override\n            public int size() {\n                return coll.size();\n            }\n\n            @Override\n            public boolean hasNext() {\n                return it.hasNext();\n            }\n\n            @Override\n            public void next() {\n                current = it.next();\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n\n            @Override\n            public Object value() {\n                return current;\n            }\n        };\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets an iterable wrapper for {@code Map}.\n     * \n     * @param keyType  the value type, not null\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    public static SerIterable map(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        Map<Object, Object> map = new HashMap<>();\n        return map(keyType, valueType, valueTypeTypes, map);\n    }\n\n    /**\n     * Gets an iterable wrapper for {@code SortedMap}.\n     * \n     * @param keyType  the value type, not null\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    public static SerIterable sortedMap(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        SortedMap<Object, Object> map = new TreeMap<>();\n        return map(keyType, valueType, valueTypeTypes, map);\n    }\n\n    /**\n     * Gets an iterable wrapper for {@code NavigableMap}.\n     * \n     * @param keyType  the value type, not null\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterable, not null\n     */\n    public static SerIterable navigableMap(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        NavigableMap<Object, Object> map = new TreeMap<>();\n        return map(keyType, valueType, valueTypeTypes, map);\n    }\n\n    static SerIterable map(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes, Map<Object, Object> map) {\n        return new SerIterable() {\n            @Override\n            public SerIterator iterator() {\n                return map(map, Object.class, keyType, valueType, valueTypeTypes);\n            }\n\n            @Override\n            public void add(Object key, Object column, Object value, int count) {\n                if (count != 1) {\n                    throw new IllegalArgumentException(\"Unexpected count\");\n                }\n                map.put(key, value);\n            }\n\n            @Override\n            public Object build() {\n                return map;\n            }\n\n            @Override\n            public SerCategory category() {\n                return SerCategory.MAP;\n            }\n\n            @Override\n            public Class<?> keyType() {\n                return keyType;\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n        };\n    }\n\n    /**\n     * Gets an iterator wrapper for {@code Map}.\n     * \n     * @param map  the collection, not null\n     * @param declaredType  the declared type, not null\n     * @param keyType  the value type, not null\n     * @param valueType  the value type, not null\n     * @param valueTypeTypes  the generic parameters of the value type\n     * @return the iterator, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static SerIterator map(\n            Map<?, ?> map, Class<?> declaredType, Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes) {\n        return new SerIterator() {\n            private final Iterator it = map.entrySet().iterator();\n            private Entry current;\n\n            @Override\n            public String metaTypeName() {\n                return \"Map\";\n            }\n\n            @Override\n            public boolean metaTypeRequired() {\n                return !Map.class.isAssignableFrom(declaredType);\n            }\n\n            @Override\n            public SerCategory category() {\n                return SerCategory.MAP;\n            }\n\n            @Override\n            public int size() {\n                return map.size();\n            }\n\n            @Override\n            public boolean hasNext() {\n                return it.hasNext();\n            }\n\n            @Override\n            public void next() {\n                current = (Entry) it.next();\n            }\n\n            @Override\n            public Class<?> keyType() {\n                return keyType;\n            }\n\n            @Override\n            public Object key() {\n                return current.getKey();\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return valueTypeTypes;\n            }\n\n            @Override\n            public Object value() {\n                return current.getValue();\n            }\n        };\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets an iterable wrapper for an object array.\n     * \n     * @param valueType  the value type, not null\n     * @return the iterable, not null\n     */\n    public static SerIterable array(Class<?> valueType) {\n        if (valueType.isPrimitive()) {\n            return arrayPrimitive(valueType);\n        }\n        List<Object> list = new ArrayList<>();\n        return new SerIterable() {\n            @Override\n            public SerIterator iterator() {\n                return array(build(), Object.class, valueType);\n            }\n\n            @Override\n            public void add(Object key, Object column, Object value, int count) {\n                if (key != null) {\n                    throw new IllegalArgumentException(\"Unexpected key\");\n                }\n                if (count != 1) {\n                    throw new IllegalArgumentException(\"Unexpected count\");\n                }\n                for (var i = 0; i < count; i++) {\n                    list.add(value);\n                }\n            }\n\n            @Override\n            public Object[] build() {\n                var array = (Object[]) Array.newInstance(valueType, list.size());\n                return list.toArray(array);\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return EMPTY_VALUE_TYPES;\n            }\n        };\n    }\n\n    /**\n     * Gets an iterable wrapper for a primitive array.\n     * \n     * @param valueType  the value type, not null\n     * @return the iterable, not null\n     */\n    static SerIterable arrayPrimitive(Class<?> valueType) {\n        List<Object> list = new ArrayList<>();\n        return new SerIterable() {\n            @Override\n            public SerIterator iterator() {\n                return arrayPrimitive(build(), Object.class, valueType);\n            }\n\n            @Override\n            public void add(Object key, Object column, Object value, int count) {\n                if (key != null) {\n                    throw new IllegalArgumentException(\"Unexpected key\");\n                }\n                if (count != 1) {\n                    throw new IllegalArgumentException(\"Unexpected count\");\n                }\n                for (var i = 0; i < count; i++) {\n                    list.add(value);\n                }\n            }\n\n            @Override\n            public Object build() {\n                var array = Array.newInstance(valueType, list.size());\n                for (var i = 0; i < list.size(); i++) {\n                    Array.set(array, i, list.get(i));\n                }\n                return array;\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return EMPTY_VALUE_TYPES;\n            }\n        };\n    }\n\n    /**\n     * Gets an iterator wrapper for an object array.\n     * \n     * @param array  the array, not null\n     * @param declaredType  the declared type, not null\n     * @param valueType  the value type, not null\n     * @return the iterator, not null\n     */\n    public static SerIterator array(Object[] array, Class<?> declaredType, Class<?> valueType) {\n        return new SerIterator() {\n            private int index = -1;\n\n            @Override\n            public String metaTypeName() {\n                return metaTypeNameBase(valueType);\n            }\n\n            private String metaTypeNameBase(Class<?> arrayType) {\n                if (arrayType.isArray()) {\n                    return metaTypeNameBase(arrayType.getComponentType()) + \"[]\";\n                }\n                if (arrayType == Object.class) {\n                    return \"Object[]\";\n                }\n                if (arrayType == String.class) {\n                    return \"String[]\";\n                }\n                return arrayType.getName() + \"[]\";\n            }\n\n            @Override\n            public boolean metaTypeRequired() {\n                if (valueType == Object.class) {\n                    return !Object[].class.isAssignableFrom(declaredType);\n                }\n                if (valueType == String.class) {\n                    return !String[].class.isAssignableFrom(declaredType);\n                }\n                return true;\n            }\n\n            @Override\n            public int size() {\n                return array.length;\n            }\n\n            @Override\n            public boolean hasNext() {\n                return (index + 1) < array.length;\n            }\n\n            @Override\n            public void next() {\n                index++;\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return Collections.emptyList();\n            }\n\n            @Override\n            public Object value() {\n                return array[index];\n            }\n        };\n    }\n\n    /**\n     * Gets an iterator wrapper for a primitive array.\n     * \n     * @param array  the array, not null\n     * @param declaredType  the declared type, not null\n     * @param valueType  the value type, not null\n     * @return the iterator, not null\n     */\n    static SerIterator arrayPrimitive(Object array, Class<?> declaredType, Class<?> valueType) {\n        var arrayLength = Array.getLength(array);\n        return new SerIterator() {\n            private int index = -1;\n\n            @Override\n            public String metaTypeName() {\n                return metaTypeNameBase(valueType);\n            }\n\n            private String metaTypeNameBase(Class<?> arrayType) {\n                if (arrayType.isArray()) {\n                    return metaTypeNameBase(arrayType.getComponentType()) + \"[]\";\n                }\n                if (arrayType == Object.class) {\n                    return \"Object[]\";\n                }\n                if (arrayType == String.class) {\n                    return \"String[]\";\n                }\n                return arrayType.getName() + \"[]\";\n            }\n\n            @Override\n            public boolean metaTypeRequired() {\n                if (valueType == Object.class) {\n                    return !Object[].class.isAssignableFrom(declaredType);\n                }\n                if (valueType == String.class) {\n                    return !String[].class.isAssignableFrom(declaredType);\n                }\n                return true;\n            }\n\n            @Override\n            public int size() {\n                return arrayLength;\n            }\n\n            @Override\n            public boolean hasNext() {\n                return (index + 1) < arrayLength;\n            }\n\n            @Override\n            public void next() {\n                index++;\n            }\n\n            @Override\n            public Class<?> valueType() {\n                return valueType;\n            }\n\n            @Override\n            public List<Class<?>> valueTypeTypes() {\n                return Collections.emptyList();\n            }\n\n            @Override\n            public Object value() {\n                return Array.get(array, index);\n            }\n        };\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/SerOptional.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport java.util.Optional;\nimport java.util.OptionalDouble;\nimport java.util.OptionalInt;\nimport java.util.OptionalLong;\nimport java.util.function.BiFunction;\nimport java.util.function.Function;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaProperty;\n\n/**\n * Assists with serialization and deserialization of optional properties.\n */\npublic class SerOptional {\n\n    /** Guava Optional type. */\n    private static final Class<?> GUAVA_OPTIONAL_CLASS;\n    /** Extractor for Guava Optional. */\n    private static final Function<Object, Object> GUAVA_EXTRACT;\n    /** Wrapper for Guava Optional. */\n    private static final BiFunction<Class<?>, Object, Object> GUAVA_WRAPPER;\n    static {\n        Class<?> optionalType;\n        Function<Object, Object> extract;\n        BiFunction<Class<?>, Object, Object> wrapper;\n        try {\n            optionalType = GuavaSerOptional.OPTIONAL_TYPE;\n            extract = GuavaSerOptional::extractValue;\n            wrapper = GuavaSerOptional::wrapValue;\n        } catch (RuntimeException | LinkageError ex) {\n            optionalType = Optional.class;\n            extract = Function.identity();\n            wrapper = (cls, value) -> value;\n        }\n        GUAVA_OPTIONAL_CLASS = optionalType;\n        GUAVA_EXTRACT = extract;\n        GUAVA_WRAPPER = wrapper;\n    }\n\n    /**\n     * Extracts the value of the property from a bean, unwrapping any optional.\n     * \n     * @param metaProp  the property to query, not null\n     * @param bean  the bean to query, not null\n     * @return the value of the property, with any optional wrapper removed\n     */\n    public static Object extractValue(MetaProperty<?> metaProp, Bean bean) {\n        var value = metaProp.get(bean);\n        return switch (value) {\n            case null -> null;\n            case Optional<?> opt -> opt.orElse(null);\n            case OptionalLong opt -> opt.isPresent() ? opt.getAsLong() : null;\n            case OptionalInt opt -> opt.isPresent() ? opt.getAsInt() : null;\n            case OptionalDouble opt -> opt.isPresent() ? opt.getAsDouble() : null;\n            default -> GUAVA_EXTRACT.apply(value);\n        };\n    }\n\n    /**\n     * Extracts the type the optional is wrapping.\n     * \n     * @param metaProp  the property to query, not null\n     * @param beanType  the type of the bean, not null\n     * @return the type of the property with any optional wrapper removed\n     */\n    public static Class<?> extractType(MetaProperty<?> metaProp, Class<?> beanType) {\n        var propType = metaProp.propertyType();\n        if (propType == Optional.class ||\n                propType == OptionalLong.class ||\n                propType == OptionalInt.class ||\n                propType == OptionalDouble.class ||\n                propType == GUAVA_OPTIONAL_CLASS) {\n            return extractType(metaProp, beanType, propType);\n        }\n        return propType;\n    }\n\n    // broken out for hotspot\n    private static Class<?> extractType(MetaProperty<?> metaProp, Class<?> beanType, Class<?> type) {\n        try {\n            var genericType = JodaBeanUtils.extractTypeClass(metaProp, beanType, 1, 0);\n            return (genericType != null ? genericType : type);\n        } catch (Exception ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    /**\n     * Wraps the value of a property if it is an optional.\n     * \n     * @param metaProp  the property to query, not null\n     * @param beanType  the type of the bean, not null\n     * @param value  the value to wrap, may be null\n     * @return the value of the property, with any optional wrapper added\n     */\n    public static Object wrapValue(MetaProperty<?> metaProp, Class<?> beanType, Object value) {\n        var propType = metaProp.propertyType();\n        if (propType == Optional.class) {\n            return Optional.ofNullable(value);\n        } else if (propType == OptionalLong.class) {\n            return value == null ? OptionalLong.empty() : OptionalLong.of((Long) value);\n        } else if (propType == OptionalInt.class) {\n            return value == null ? OptionalInt.empty() : OptionalInt.of((Integer) value);\n        } else if (propType == OptionalDouble.class) {\n            return value == null ? OptionalDouble.empty() : OptionalDouble.of((Double) value);\n        } else {\n            return GUAVA_WRAPPER.apply(propType, value);\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    // a separate class so that it can fail to load if Guava is missing\n    private static final class GuavaSerOptional {\n        public static final Class<?> OPTIONAL_TYPE = com.google.common.base.Optional.class;\n\n        private static Object extractValue(Object value) {\n            return value instanceof com.google.common.base.Optional<?> opt ? opt.orNull() : value;\n        }\n\n        public static Object wrapValue(Class<?> propType, Object value) {\n            if (propType == OPTIONAL_TYPE) {\n                return com.google.common.base.Optional.fromNullable(value);\n            }\n            return value;\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/SerTypeMapper.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport java.io.File;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.net.URI;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Locale;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.util.UUID;\n\nimport org.joda.convert.RenameHandler;\n\n/**\n * Type mapper for Joda-Bean serialization, used by serialization implementations.\n */\npublic final class SerTypeMapper {\n\n    /**\n     * Known simple classes.\n     */\n    private static final Map<Class<?>, String> BASIC_TYPES;\n    /**\n     * Known simple classes.\n     */\n    private static final Map<String, Class<?>> BASIC_TYPES_REVERSED;\n    static {\n        Map<Class<?>, String> map = new HashMap<>();\n\n        map.put(String.class, \"String\");\n        map.put(Long.class, \"Long\");\n        map.put(Integer.class, \"Integer\");\n        map.put(Short.class, \"Short\");\n        map.put(Byte.class, \"Byte\");\n        map.put(Character.class, \"Character\");\n        map.put(Boolean.class, \"Boolean\");\n        map.put(Double.class, \"Double\");\n        map.put(Float.class, \"Float\");\n        map.put(BigInteger.class, \"BigInteger\");\n        map.put(BigDecimal.class, \"BigDecimal\");\n        map.put(Locale.class, \"Locale\");\n        map.put(Class.class, \"Class\");\n        map.put(UUID.class, \"UUID\");\n        map.put(URI.class, \"URI\");\n        map.put(File.class, \"File\");\n        // selection of types are the most common types suitable for reduction\n        // and suitable for simple interpretation on non-Java systems\n\n        Map<String, Class<?>> reversed = new HashMap<>();\n        for (Entry<Class<?>, String> entry : map.entrySet()) {\n            reversed.put(entry.getValue(), entry.getKey());\n        }\n        BASIC_TYPES = Collections.unmodifiableMap(map);\n        BASIC_TYPES_REVERSED = Collections.unmodifiableMap(reversed);\n    }\n\n    /**\n     * Creates an instance.\n     */\n    private SerTypeMapper() {\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Encodes a basic class.\n     * <p>\n     * This handles known simple types, like String, Integer or File, and prefixing.\n     * It also allows a map of message specific shorter forms.\n     * \n     * @param cls  the class to encode, not null\n     * @param settings  the settings object, not null\n     * @param basePackage  the base package to use with trailing dot, null if none\n     * @param knownTypes  the known types map, null if not using known type shortening\n     * @return the class object, null if not a basic type\n     */\n    public static String encodeType(Class<?> cls, JodaBeanSer settings, String basePackage, Map<Class<?>, String> knownTypes) {\n        // basic type\n        var result = BASIC_TYPES.get(cls);\n        if (result != null) {\n            return result;\n        }\n        // handle enum subclasses\n        Class<?> supr1 = cls.getSuperclass();\n        if (supr1 != null) {\n            Class<?> supr2 = supr1.getSuperclass();\n            if (supr2 == Enum.class) {\n                cls = supr1;\n            }\n        }\n        // calculate\n        if (settings.isShortTypes()) {\n            if (knownTypes != null) {\n                result = knownTypes.get(cls);\n                if (result != null) {\n                    return result;\n                }\n            }\n            result = cls.getName();\n            if (basePackage != null &&\n                    result.startsWith(basePackage) &&\n                    Character.isUpperCase(result.charAt(basePackage.length())) &&\n                    !BASIC_TYPES_REVERSED.containsKey(result.substring(basePackage.length()))) {\n                // use short format\n                result = result.substring(basePackage.length());\n                if (knownTypes != null) {\n                    knownTypes.put(cls, result);\n                }\n            } else {\n                // use long format, short next time if possible\n                if (knownTypes != null) {\n                    var simpleName = cls.getSimpleName();\n                    if (Character.isUpperCase(simpleName.charAt(0)) &&\n                            !BASIC_TYPES_REVERSED.containsKey(simpleName) &&\n                            !knownTypes.containsValue(simpleName)) {\n                        knownTypes.put(cls, simpleName);\n                    } else {\n                        knownTypes.put(cls, result);\n                    }\n                }\n            }\n        } else {\n            result = cls.getName();\n        }\n        return result;\n    }\n\n    /**\n     * Decodes a class, throwing an exception if not found.\n     * <p>\n     * This uses the context class loader.\n     * This handles known simple types, like String, Integer or File, and prefixing.\n     * It also allows a map of message specific shorter forms.\n     * \n     * @param className  the class name, not null\n     * @param settings  the settings object, not null\n     * @param basePackage  the base package to use with trailing dot, null if none\n     * @param knownTypes  the known types map, null if not using known type shortening\n     * @return the class object, not null\n     * @throws ClassNotFoundException if not found\n     */\n    public static Class<?> decodeType(\n            String className,\n            JodaBeanSer settings,\n            String basePackage,\n            Map<String, Class<?>> knownTypes) throws ClassNotFoundException {\n\n        return decodeType0(className, settings, basePackage, knownTypes, null);\n    }\n\n    /**\n     * Decodes a class, returning a default if not found.\n     * <p>\n     * This uses the context class loader.\n     * This handles known simple types, like String, Integer or File, and prefixing.\n     * It also allows a map of message specific shorter forms.\n     * \n     * @param className  the class name, not null\n     * @param settings  the settings object, not null\n     * @param basePackage  the base package to use with trailing dot, null if none\n     * @param knownTypes  the known types map, null if not using known type shortening\n     * @param defaultType  the type to use as a default if the type cannot be found\n     * @return the class object, not null\n     * @throws ClassNotFoundException if an error occurs\n     */\n    public static Class<?> decodeType(\n            String className,\n            JodaBeanSer settings,\n            String basePackage,\n            Map<String, Class<?>> knownTypes,\n            Class<?> defaultType) throws ClassNotFoundException {\n\n        return decodeType0(className, settings, basePackage, knownTypes, defaultType);\n    }\n\n    // internal type decode\n    private static Class<?> decodeType0(\n            String className,\n            JodaBeanSer settings,\n            String basePackage,\n            Map<String, Class<?>> knownTypes,\n            Class<?> defaultType) throws ClassNotFoundException {\n\n        // basic type\n        Class<?> result = BASIC_TYPES_REVERSED.get(className);\n        if (result != null) {\n            return result;\n        }\n        // check cache\n        if (knownTypes != null) {\n            result = knownTypes.get(className);\n            if (result != null) {\n                return result;\n            }\n        }\n        // calculate\n        var fullName = className;\n        var expanded = false;\n        if (basePackage != null && !className.isEmpty() && Character.isUpperCase(className.charAt(0))) {\n            fullName = basePackage + className;\n            expanded = true;\n        }\n        try {\n            result = RenameHandler.INSTANCE.lookupType(fullName);\n            if (knownTypes != null) {\n                // cache full name\n                knownTypes.put(fullName, result);\n                if (expanded) {\n                    // cache short name\n                    knownTypes.put(className, result);\n                } else {\n                    // derive and cache short name\n                    var simpleName = result.getSimpleName();\n                    // handle renames\n                    if (!fullName.equals(result.getName()) &&\n                            RenameHandler.INSTANCE.getTypeRenames().containsKey(fullName) &&\n                            result.getEnclosingClass() == null) {\n                        simpleName = fullName.substring(fullName.lastIndexOf(\".\") + 1);\n                    }\n                    if (Character.isUpperCase(simpleName.charAt(0)) &&\n                            !BASIC_TYPES_REVERSED.containsKey(simpleName) &&\n                            !knownTypes.containsKey(simpleName)) {\n                        knownTypes.put(simpleName, result);\n                    }\n                }\n            }\n            return result;\n        } catch (ClassNotFoundException ex) {\n            // handle pathological case of package name starting with upper case\n            if (!fullName.equals(className)) {\n                try {\n                    result = RenameHandler.INSTANCE.lookupType(className);\n                    if (knownTypes != null) {\n                        knownTypes.put(className, result);\n                    }\n                    return result;\n                } catch (ClassNotFoundException ignored) {\n                }\n            }\n            if (defaultType == null) {\n                throw ex;\n            }\n            return defaultType;\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public String toString() {\n        return getClass().getSimpleName();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/AbstractBinReader.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.io.DataInputStream;\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerIterable;\nimport org.joda.beans.ser.SerIteratorFactory;\nimport org.joda.beans.ser.SerOptional;\nimport org.joda.beans.ser.SerTypeMapper;\n\n/**\n * Provides the ability for a Joda-Bean to read from both the standard and referencing binary formats.\n * <p>\n * This class contains mutable state and cannot be used from multiple threads.\n * A new instance must be created for each message.\n */\nabstract class AbstractBinReader extends MsgPack {\n\n    /**\n     * Settings.\n     */\n    final JodaBeanSer settings;  // CSIGNORE\n    /**\n     * The reader.\n     */\n    final DataInputStream input;  // CSIGNORE\n    /**\n     * The base package including the trailing dot.\n     */\n    private String basePackage;\n    /**\n     * The known types.\n     */\n    private final Map<String, Class<?>> knownTypes = new HashMap<>();\n\n    //-----------------------------------------------------------------------\n    // creates an instance\n    AbstractBinReader(JodaBeanSer settings, DataInputStream input) {\n        this.settings = settings;\n        this.input = input;\n    }\n\n    //-----------------------------------------------------------------------\n    // reads the input stream where the array and version bytes have been read already\n    <T> T read(Class<T> rootType) {\n        try {\n            try {\n                return parseRemaining(rootType);\n            } finally {\n                input.close();\n            }\n        } catch (RuntimeException ex) {\n            throw ex;\n        } catch (Exception ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    <T> T parseRemaining(Class<T> declaredType) throws Exception {\n        // the array and version has already been read\n        var parsed = parseObject(declaredType, null, null, null, true);\n        return declaredType.cast(parsed);\n    }\n\n    Object parseBean(int propertyCount, Class<?> beanType) {\n        var propName = \"\";\n        try {\n            var deser = settings.getDeserializers().findDeserializer(beanType);\n            var metaBean = deser.findMetaBean(beanType);\n            var builder = deser.createBuilder(beanType, metaBean);\n            for (var i = 0; i < propertyCount; i++) {\n                // property name\n                propName = acceptPropertyName();\n                var metaProp = deser.findMetaProperty(beanType, metaBean, propName);\n                if (metaProp == null || metaProp.style().isDerived()) {\n                    MsgPackInput.skipObject(input);\n                } else {\n                    var value = parseObject(SerOptional.extractType(metaProp, beanType), metaProp, beanType, null, false);\n                    deser.setValue(builder, metaProp, SerOptional.wrapValue(metaProp, beanType, value));\n                }\n            }\n            propName = \"\";\n            return deser.build(beanType, builder);\n        } catch (Exception ex) {\n            throw new RuntimeException(\"Error parsing bean: \" + beanType.getName() + \"::\" + propName + \", \" + ex.getMessage(), ex);\n        }\n    }\n\n    String acceptPropertyName() throws IOException {\n        var typeByte = input.readByte();\n        return acceptString(typeByte);\n    }\n\n    //-------------------------------------------------------------------------\n    // parses an object, determining how to parse based on the input data\n    Object parseObject(Class<?> declaredType, MetaProperty<?> metaProp, Class<?> beanType, SerIterable parentIterable, boolean rootType) throws Exception {\n        var typeByte = input.readByte();\n\n        // parse metadata\n        if (isMap(typeByte)) {\n            input.mark(8);\n            var mapSize = acceptMap(typeByte);\n            if (mapSize > 0) {\n                int typeByteTemp = input.readByte();\n                if (typeByteTemp == EXT_8) {\n                    var size = input.readUnsignedByte();\n                    typeByteTemp = input.readByte();\n                    if (typeByteTemp == JODA_TYPE_BEAN) {\n                        var typeStr = acceptStringBytes(size);\n                        var effectiveType = SerTypeMapper.decodeType(typeStr, settings, basePackage, knownTypes);\n                        return parseObjectAsBean(declaredType, rootType, effectiveType, mapSize);\n                    } else if (typeByteTemp == JODA_TYPE_DATA) {\n                        if (mapSize != 1) {\n                            throw new IllegalArgumentException(\"Invalid binary data: Expected map size 1, but was: \" + mapSize);\n                        }\n                        var typeStr = acceptStringBytes(size);\n                        var effectiveType = settings.getDeserializers().decodeType(\n                                typeStr, settings, basePackage, knownTypes, declaredType);\n                        if (!declaredType.isAssignableFrom(effectiveType)) {\n                            throw new IllegalArgumentException(\"Specified type is incompatible with declared type: \" + declaredType.getName() + \" and \" + effectiveType.getName());\n                        }\n                        return parseObjectFromInput(input.readByte(), effectiveType, metaProp, beanType, parentIterable);\n                    } else if (typeByteTemp == JODA_TYPE_META) {\n                        return parseObjectAsCollectionWithMeta(mapSize, size);\n                    }\n                }\n            }\n            input.reset();\n        }\n        // parse based on type\n        return parseObjectFromInput(typeByte, declaredType, metaProp, beanType, parentIterable);\n    }\n\n    // a bean with an explicit type\n    private Object parseObjectAsBean(Class<?> declaredType, boolean rootType, Class<?> effectiveType, int mapSize) throws Exception {\n        if (rootType) {\n            if (!Bean.class.isAssignableFrom(effectiveType)) {\n                throw new IllegalArgumentException(\"Root type is not a Joda-Bean: \" + effectiveType.getName());\n            }\n            basePackage = effectiveType.getPackage().getName() + \".\";\n        }\n        if (!declaredType.isAssignableFrom(effectiveType)) {\n            throw new IllegalArgumentException(\"Specified type is incompatible with declared type: \" + declaredType.getName() + \" and \" + effectiveType.getName());\n        }\n        if (input.readByte() != NIL) {\n            throw new IllegalArgumentException(\"Invalid binary data: Expected null after bean type\");\n        }\n        return parseBean(mapSize - 1, effectiveType);\n    }\n\n    // a collection with a meta annotation\n    private Object parseObjectAsCollectionWithMeta(int mapSize, int strSize) throws Exception {\n        if (mapSize != 1) {\n            throw new IllegalArgumentException(\"Invalid binary data: Expected map size 1, but was: \" + mapSize);\n        }\n        var metaType = acceptStringBytes(strSize);\n        var typeByte = input.readByte();\n        if (isMap(typeByte) || isArray(typeByte)) {\n            var childIterable = settings.getIteratorFactory().createIterable(metaType, settings, knownTypes);\n            if (childIterable == null) {\n                throw new IllegalArgumentException(\"Invalid binary data: Invalid metaType: \" + metaType);\n            }\n            return parseIterable(typeByte, childIterable);\n        } else {\n            throw new IllegalArgumentException(\"Invalid binary data: MetaType was not followed by a collection: \" + metaType);\n        }\n    }\n\n    private Object parseObjectFromInput(\n            int typeByte,\n            Class<?> effectiveType,\n            MetaProperty<?> metaProp,\n            Class<?> beanType,\n            SerIterable parentIterable) throws Exception {\n\n        if (typeByte == NIL) {\n            return null;\n        } else if (Bean.class.isAssignableFrom(effectiveType)) {\n            if (isMap(typeByte)) {\n                var mapSize = acceptMap(typeByte);\n                return parseBean(mapSize, effectiveType);\n            } else {\n                return parseSimple(typeByte, effectiveType);\n            }\n        } else if (isMap(typeByte) || isArray(typeByte)) {\n            SerIterable childIterable = null;\n            if (metaProp != null) {\n                childIterable = settings.getIteratorFactory().createIterable(metaProp, beanType);\n            } else if (parentIterable != null) {\n                childIterable = settings.getIteratorFactory().createIterable(parentIterable);\n            }\n            if (childIterable == null) {\n                // handle array types sent without a metatype\n                if (effectiveType.isArray()) {\n                    childIterable = SerIteratorFactory.array(effectiveType.getComponentType());\n                } else {\n                    throw new IllegalArgumentException(\"Invalid binary data: Unable to create collection type\");\n                }\n            }\n            return parseIterable(typeByte, childIterable);\n        } else {\n            return parseSimple(typeByte, effectiveType);\n        }\n    }\n\n    Object parseIterable(int typeByte, SerIterable iterable) throws Exception {\n        return switch (iterable.category()) {\n            case COLLECTION -> parseIterableArray(typeByte, iterable);\n            case COUNTED -> parseIterableCounted(typeByte, iterable);\n            case MAP -> parseIterableMap(typeByte, iterable);\n            case TABLE -> parseIterableTable(typeByte, iterable);\n            case GRID -> parseIterableGrid(typeByte, iterable);\n        };\n    }\n\n    Object parseIterableMap(int typeByte, SerIterable iterable) throws Exception {\n        var size = acceptMap(typeByte);\n        for (var i = 0; i < size; i++) {\n            var key = parseObject(iterable.keyType(), null, null, null, false);\n            var value = parseObject(iterable.valueType(), null, null, iterable, false);\n            iterable.add(key, null, value, 1);\n        }\n        return iterable.build();\n    }\n\n    Object parseIterableTable(int typeByte, SerIterable iterable) throws Exception {\n        var size = acceptArray(typeByte);\n        for (var i = 0; i < size; i++) {\n            if (acceptArray(input.readByte()) != 3) {\n                throw new IllegalArgumentException(\"Table must have cell array size 3\");\n            }\n            var key = parseObject(iterable.keyType(), null, null, null, false);\n            var column = parseObject(iterable.columnType(), null, null, null, false);\n            var value = parseObject(iterable.valueType(), null, null, iterable, false);\n            iterable.add(key, column, value, 1);\n        }\n        return iterable.build();\n    }\n\n    Object parseIterableGrid(int typeByte, SerIterable iterable) throws Exception {\n        var size = acceptArray(typeByte);\n        var rows = acceptInteger(input.readByte());\n        var columns = acceptInteger(input.readByte());\n        iterable.dimensions(new int[] {rows, columns});\n        if ((rows * columns) != (size - 2)) {\n            // sparse\n            for (var i = 0; i < (size - 2); i++) {\n                if (acceptArray(input.readByte()) != 3) {\n                    throw new IllegalArgumentException(\"Grid must have cell array size 3\");\n                }\n                var row = acceptInteger(input.readByte());\n                var column = acceptInteger(input.readByte());\n                var value = parseObject(iterable.valueType(), null, null, iterable, false);\n                iterable.add(row, column, value, 1);\n            }\n        } else {\n            // dense\n            for (var row = 0; row < rows; row++) {\n                for (var column = 0; column < columns; column++) {\n                    var value = parseObject(iterable.valueType(), null, null, iterable, false);\n                    iterable.add(row, column, value, 1);\n                }\n            }\n        }\n        return iterable.build();\n    }\n\n    Object parseIterableCounted(int typeByte, SerIterable iterable) throws Exception {\n        var size = acceptMap(typeByte);\n        for (var i = 0; i < size; i++) {\n            var value = parseObject(iterable.valueType(), null, null, iterable, false);\n            var count = acceptInteger(input.readByte());\n            iterable.add(null, null, value, count);\n        }\n        return iterable.build();\n    }\n\n    Object parseIterableArray(int typeByte, SerIterable iterable) throws Exception {\n        var size = acceptArray(typeByte);\n        for (var i = 0; i < size; i++) {\n            iterable.add(null, null, parseObject(iterable.valueType(), null, null, iterable, false), 1);\n        }\n        return iterable.build();\n    }\n\n    //-------------------------------------------------------------------------\n    Object parseSimple(int typeByte, Class<?> type) throws Exception {\n        if (isString(typeByte)) {\n            var text = acceptString(typeByte);\n            if (type == String.class || type.isAssignableFrom(String.class)) {\n                return text;\n            }\n            return settings.getConverter().convertFromString(type, text);\n        }\n        if (isIntegral(typeByte)) {\n            // ordered from common to less-common\n            var value = acceptLong(typeByte);\n            if (type == Long.class || type == long.class) {\n                return Long.valueOf(value);\n\n            } else if (type == Integer.class || type == int.class) {\n                if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) {\n                    throw new IllegalArgumentException(\"Invalid binary data: Expected int, but was \" + value);\n                }\n                return Integer.valueOf((int) value);\n\n            } else if (type == Double.class || type == double.class) {\n                // handle case where property type has changed from integral to double\n                return Double.valueOf(value);\n\n            } else if (type == Short.class || type == short.class) {\n                if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) {\n                    throw new IllegalArgumentException(\"Invalid binary data: Expected byte, but was \" + value);\n                }\n                return Short.valueOf((short) value);\n\n            } else if (type == Byte.class || type == byte.class) {\n                if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) {\n                    throw new IllegalArgumentException(\"Invalid binary data: Expected byte, but was \" + value);\n                }\n                return Byte.valueOf((byte) value);\n\n            } else if (type == Float.class || type == float.class) {\n                // handle case where property type has changed from integral to float\n                return Float.valueOf(value);\n\n            } else {\n                if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) {\n                    return Long.valueOf(value);\n                }\n                return Integer.valueOf((int) value);\n            }\n        }\n        return switch (typeByte) {\n            case TRUE -> Boolean.TRUE;\n            case FALSE -> Boolean.FALSE;\n            case FLOAT_32 -> Float.valueOf(input.readFloat());\n            case FLOAT_64 -> Double.valueOf(input.readDouble());\n            case BIN_8, BIN_16, BIN_32 -> acceptBinary(typeByte);\n            default -> throw invalidBinaryData(type.getName(), typeByte);\n        };\n    }\n\n    //-----------------------------------------------------------------------\n    int acceptMap(int typeByte) throws IOException {\n        if (typeByte >= MIN_FIX_MAP && typeByte <= MAX_FIX_MAP) {\n            return (typeByte - MIN_FIX_MAP);\n        } else if (typeByte == MAP_16) {\n            return input.readUnsignedShort();\n        } else if (typeByte == MAP_32) {\n            return readPositiveInt(\"Invalid binary data: Map too large\");\n        } else {\n            throw invalidBinaryData(\"map\", typeByte);\n        }\n    }\n\n    int acceptArray(int typeByte) throws IOException {\n        if (typeByte >= MIN_FIX_ARRAY && typeByte <= MAX_FIX_ARRAY) {\n            return typeByte - MIN_FIX_ARRAY;\n        } else if (typeByte == ARRAY_16) {\n            return input.readUnsignedShort();\n        } else if (typeByte == ARRAY_32) {\n            return readPositiveInt(\"Invalid binary data: Array too large\");\n        } else {\n            throw invalidBinaryData(\"array\", typeByte);\n        }\n    }\n\n    String acceptString(int typeByte) throws IOException {\n        int size;\n        if (typeByte >= MIN_FIX_STR && typeByte <= MAX_FIX_STR) {\n            size = typeByte - MIN_FIX_STR;\n        } else if (typeByte == STR_8) {\n            size = input.readUnsignedByte();\n        } else if (typeByte == STR_16) {\n            size = input.readUnsignedShort();\n        } else if (typeByte == STR_32) {\n            size = readPositiveInt(\"Invalid binary data: String too large\");\n        } else {\n            throw invalidBinaryData(\"string\", typeByte);\n        }\n        return acceptStringBytes(size);\n    }\n\n    String acceptStringBytes(int size) throws IOException {\n        var bytes = new byte[size];\n        input.readFully(bytes);\n        // inline common ASCII case for much better performance\n        var chars = new char[size];\n        for (var i = 0; i < size; i++) {\n            var b = bytes[i];\n            if (b >= 0) {\n                chars[i] = (char) b;\n            } else {\n                return new String(bytes, UTF_8);\n            }\n        }\n        return new String(chars);\n    }\n\n    byte[] acceptBinary(int typeByte) throws IOException {\n        int size = switch (typeByte) {\n            case BIN_8 -> input.readUnsignedByte();\n            case BIN_16 -> input.readUnsignedShort();\n            case BIN_32 -> readPositiveInt(\"Invalid binary data: Binary too large\");\n            default -> throw invalidBinaryData(\"binary\", typeByte);\n        };\n        var bytes = new byte[size];\n        input.readFully(bytes);\n        return bytes;\n    }\n\n    int acceptInteger(int typeByte) throws IOException {\n        if (typeByte >= MIN_FIX_INT && typeByte <= MAX_FIX_INT) {\n            return typeByte;\n        }\n        return switch (typeByte) {\n            case UINT_8 -> input.readUnsignedByte();\n            case UINT_16 -> input.readUnsignedShort();\n            case UINT_32 -> readPositiveInt(\"Invalid binary data: Expected int, but was large unsigned int\");\n            case UINT_64 -> readUnsignedLongAsInt();\n            case SINT_8 -> input.readByte();\n            case SINT_16 -> input.readShort();\n            case SINT_32 -> input.readInt();\n            case SINT_64 -> readLongAsInt();\n            default -> throw invalidBinaryData(\"int\", typeByte);\n        };\n    }\n\n    long acceptLong(int typeByte) throws IOException {\n        if (typeByte >= MIN_FIX_INT && typeByte <= MAX_FIX_INT) {\n            return typeByte;\n        }\n        return switch (typeByte) {\n            case UINT_8 -> input.readUnsignedByte();\n            case UINT_16 -> input.readUnsignedShort();\n            case UINT_32 -> Integer.toUnsignedLong(input.readInt());\n            case UINT_64 -> readUnsignedLong();\n            case SINT_8 -> input.readByte();\n            case SINT_16 -> input.readShort();\n            case SINT_32 -> input.readInt();\n            case SINT_64 -> input.readLong();\n            default -> throw invalidBinaryData(\"long\", typeByte);\n        };\n    }\n\n    private int readPositiveInt(String msg) throws IOException {\n        var val = input.readInt();\n        if (val < 0) {\n            throw new IllegalArgumentException(msg);\n        }\n        return val;\n    }\n\n    private long readUnsignedLong() throws IOException {\n        var val = input.readLong();\n        if (val < 0) {\n            throw new IllegalArgumentException(\"Invalid binary data: Expected long, but was large unsigned int\");\n        }\n        return val;\n    }\n\n    private int readUnsignedLongAsInt() throws IOException {\n        var val = input.readLong();\n        if (val < 0 || val > Integer.MAX_VALUE) {\n            throw new IllegalArgumentException(\"Invalid binary data: Expected int, but was large unsigned int\");\n        }\n        return (int) val;\n    }\n\n    private int readLongAsInt() throws IOException {\n        var val = input.readLong();\n        if (val < Integer.MIN_VALUE || val > Integer.MAX_VALUE) {\n            throw new IllegalArgumentException(\"Invalid binary data: Expected int, but was large signed int\");\n        }\n        return (int) val;\n    }\n\n    private IllegalArgumentException invalidBinaryData(String expected, int actualByte) {\n        return new IllegalArgumentException(\n                \"Invalid binary data: Expected \" + expected + \", but was: 0x\" + toHex(actualByte));\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/AbstractBinWriter.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerIterator;\nimport org.joda.beans.ser.SerOptional;\nimport org.joda.beans.ser.SerTypeMapper;\n\n/**\n * Provides the ability for a Joda-Bean to be written to both the standard and referencing binary formats.\n * <p>\n * This class contains mutable state and cannot be used from multiple threads.\n * A new instance must be created for each message.\n */\nabstract class AbstractBinWriter {\n\n    /**\n     * The settings to use.\n     */\n    final JodaBeanSer settings;  // CSIGNORE\n    /**\n     * The output stream.\n     */\n    final MsgPackOutput output;  // CSIGNORE\n    /**\n     * The base package including the trailing dot.\n     */\n    private String basePackage;\n    /**\n     * The known types.\n     */\n    private final Map<Class<?>, String> knownTypes = new HashMap<>();\n\n    // creates an instance\n    AbstractBinWriter(JodaBeanSer settings, OutputStream output) {\n        this.settings = settings;\n        this.output = new MsgPackOutput(output);\n    }\n\n    //-----------------------------------------------------------------------\n    void writeRootBean(Bean bean, boolean rootTypeFlag) throws IOException {\n        writeBean(bean, bean.getClass(), rootTypeFlag ? RootType.ROOT_WITH_TYPE : RootType.ROOT_WITHOUT_TYPE);\n    }\n\n    void writeBean(Bean bean, Class<?> declaredType, RootType rootTypeFlag) throws IOException {\n        var count = bean.metaBean().metaPropertyCount();\n        var props = new MetaProperty<?>[count];\n        var values = new Object[count];\n        var size = 0;\n        for (var prop : bean.metaBean().metaPropertyIterable()) {\n            if (settings.isSerialized(prop)) {\n                var value = SerOptional.extractValue(prop, bean);\n                if (value != null) {\n                    props[size] = prop;\n                    values[size++] = value;\n                }\n            }\n        }\n        if (rootTypeFlag == RootType.ROOT_WITH_TYPE || (rootTypeFlag == RootType.NOT_ROOT && bean.getClass() != declaredType)) {\n            var type = SerTypeMapper.encodeType(bean.getClass(), settings, basePackage, knownTypes);\n            if (rootTypeFlag == RootType.ROOT_WITH_TYPE) {\n                basePackage = bean.getClass().getPackage().getName() + \".\";\n            }\n            output.writeMapHeader(size + 1);\n            output.writeExtensionString(MsgPack.JODA_TYPE_BEAN, type);\n            output.writeNil();\n        } else {\n            output.writeMapHeader(size);\n        }\n        for (var i = 0; i < size; i++) {\n            MetaProperty<?> prop = props[i];\n            var value = values[i];\n            output.writeString(prop.name());\n            var propType = SerOptional.extractType(prop, bean.getClass());\n            if (value instanceof Bean beanValue) {\n                if (settings.getConverter().isConvertible(value.getClass())) {\n                    writeSimple(propType, value);\n                } else {\n                    writeBean(beanValue, propType, RootType.NOT_ROOT);\n                }\n            } else {\n                var itemIterator = settings.getIteratorFactory().create(value, prop, bean.getClass());\n                if (itemIterator != null) {\n                    writeElements(itemIterator);\n                } else {\n                    writeSimple(propType, value);\n                }\n            }\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    void writeMetaPropertyReference(String metaTypeName) throws IOException {\n        output.writeExtensionString(MsgPack.JODA_TYPE_META, metaTypeName);\n    }\n\n    void writeElements(SerIterator itemIterator) throws IOException {\n        if (itemIterator.metaTypeRequired()) {\n            output.writeMapHeader(1);\n            writeMetaPropertyReference(itemIterator.metaTypeName());\n        }\n        switch (itemIterator.category()) {\n            case COLLECTION -> writeArray(itemIterator);\n            case COUNTED -> writeCounted(itemIterator);\n            case MAP -> writeMap(itemIterator);\n            case TABLE -> writeTable(itemIterator);\n            case GRID -> writeGrid(itemIterator);\n        }\n    }\n\n    void writeArray(SerIterator itemIterator) throws IOException {\n        output.writeArrayHeader(itemIterator.size());\n        while (itemIterator.hasNext()) {\n            itemIterator.next();\n            writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator);\n        }\n    }\n\n    void writeMap(SerIterator itemIterator) throws IOException {\n        output.writeMapHeader(itemIterator.size());\n        while (itemIterator.hasNext()) {\n            itemIterator.next();\n            writeObject(itemIterator.keyType(), itemIterator.key(), null);\n            writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator);\n        }\n    }\n\n    void writeTable(SerIterator itemIterator) throws IOException {\n        output.writeArrayHeader(itemIterator.size());\n        while (itemIterator.hasNext()) {\n            itemIterator.next();\n            output.writeArrayHeader(3);\n            writeObject(itemIterator.keyType(), itemIterator.key(), null);\n            writeObject(itemIterator.columnType(), itemIterator.column(), null);\n            writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator);\n        }\n    }\n\n    void writeGrid(SerIterator itemIterator) throws IOException {\n        var rows = itemIterator.dimensionSize(0);\n        var columns = itemIterator.dimensionSize(1);\n        var totalSize = rows * columns;\n        if (itemIterator.size() < (totalSize / 4)) {\n            // sparse\n            output.writeArrayHeader(itemIterator.size() + 2);\n            output.writeInt(rows);\n            output.writeInt(columns);\n            while (itemIterator.hasNext()) {\n                itemIterator.next();\n                output.writeArrayHeader(3);\n                output.writeInt((Integer) itemIterator.key());\n                output.writeInt((Integer) itemIterator.column());\n                writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator);\n            }\n        } else {\n            // dense\n            output.writeArrayHeader(totalSize + 2);\n            output.writeInt(rows);\n            output.writeInt(columns);\n            for (var row = 0; row < rows; row++) {\n                for (var column = 0; column < columns; column++) {\n                    writeObject(itemIterator.valueType(), itemIterator.value(row, column), itemIterator);\n                }\n            }\n        }\n    }\n\n    void writeCounted(SerIterator itemIterator) throws IOException {\n        output.writeMapHeader(itemIterator.size());\n        while (itemIterator.hasNext()) {\n            itemIterator.next();\n            writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator);\n            output.writeInt(itemIterator.count());\n        }\n    }\n\n    void writeObject(Class<?> declaredType, Object obj, SerIterator parentIterator) throws IOException {\n        if (obj == null) {\n            output.writeNil();\n        } else if (settings.getConverter().isConvertible(obj.getClass())) {\n            writeSimple(declaredType, obj);\n        } else if (obj instanceof Bean bean) {\n            writeBean(bean, declaredType, RootType.NOT_ROOT);\n        } else if (parentIterator != null) {\n            var childIterator = settings.getIteratorFactory().createChild(obj, parentIterator);\n            if (childIterator != null) {\n                writeElements(childIterator);\n            } else {\n                writeSimple(declaredType, obj);\n            }\n        } else {\n            writeSimple(declaredType, obj);\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    void writeSimple(Class<?> declaredType, Object value) throws IOException {\n        // simple types have no need to write a type object\n        switch (value) {\n            case Integer val -> {\n                output.writeInt(val);\n                return;\n            }\n            case Double val -> {\n                output.writeDouble(val);\n                return;\n            }\n            case Float val -> {\n                output.writeFloat(val);\n                return;\n            }\n            case Boolean val -> {\n                output.writeBoolean(val);\n                return;\n            }\n            default -> {\n            }\n        }\n\n        // handle no declared type and subclasses\n        Class<?> effectiveType = getAndSerializeEffectiveTypeIfRequired(value, declaredType);\n\n        // long/short/byte only processed now to ensure that a distinction can be made between Integer and Long\n        // (the method call above writes additional type information into the output stream)\n        switch (value) {\n            case Long val -> {\n                output.writeLong(val);\n                return;\n            }\n            case Short val -> {\n                output.writeInt(val);\n                return;\n            }\n            case Byte val -> {\n                output.writeInt(val);\n                return;\n            }\n            case byte[] val -> {\n                output.writeBytes(val);\n                return;\n            }\n            default -> {\n            }\n        }\n\n        // write as a string\n        try {\n            writeObjectAsString(value, effectiveType);\n        } catch (RuntimeException ex) {\n            throw new IllegalArgumentException(\"Unable to convert type \" + effectiveType.getName() + \" declared as \" + declaredType.getName(), ex);\n        }\n    }\n\n    // called when serializing an object in {@link #writeSimple(Class, Object)}, to get the effective type of the\n    // object and if necessary to serialize the class information\n    // needs to handle no declared type and subclass instances\n    Class<?> getAndSerializeEffectiveTypeIfRequired(Object value, Class<?> declaredType) throws IOException {\n        var realType = value.getClass();\n        if (declaredType == Object.class) {\n            if (realType != String.class) {\n                var effectiveType = settings.getConverter().findTypedConverter(realType).getEffectiveType();\n                output.writeMapHeader(1);\n                var type = SerTypeMapper.encodeType(effectiveType, settings, basePackage, knownTypes);\n                output.writeExtensionString(MsgPack.JODA_TYPE_DATA, type);\n                return effectiveType;\n            } else {\n                return realType;\n            }\n        }\n        if (!settings.getConverter().isConvertible(declaredType)) {\n            var effectiveType = settings.getConverter().findTypedConverter(realType).getEffectiveType();\n            output.writeMapHeader(1);\n            var type = SerTypeMapper.encodeType(effectiveType, settings, basePackage, knownTypes);\n            output.writeExtensionString(MsgPack.JODA_TYPE_DATA, type);\n            return effectiveType;\n        }\n        return declaredType;\n    }\n\n    // writes a value as a string\n    // called after discerning that the value is not a simple type\n    void writeObjectAsString(Object value, Class<?> effectiveType) throws IOException {\n        var converted = settings.getConverter().convertToString(effectiveType, value);\n        if (converted == null) {\n            throw new IllegalArgumentException(\"Unable to write because converter returned a null string: \" + value);\n        }\n        output.writeString(converted);\n    }\n\n    //-----------------------------------------------------------------------\n    enum RootType {\n        ROOT_WITH_TYPE,\n        ROOT_WITHOUT_TYPE,\n        NOT_ROOT,\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/BeanPack.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.nio.charset.Charset;\nimport java.nio.charset.StandardCharsets;\n\n/**\n * Constants used in MsgPack binary serialization.\n * <p>\n * This uses the v2.0 specification of MsgPack as of 2014-01-29.\n */\nabstract class BeanPack {\n\n    /**\n     * UTF-8 encoding.\n     */\n    static final Charset UTF_8 = StandardCharsets.UTF_8;\n    /**\n     * The smallest length of string that is cached.\n     */\n    static final int MIN_LENGTH_STR_VALUE = 3;\n\n    // fixed-size numbers\n    /**\n     * Maximum fixed int (7 bits).\n     */\n    static final int MAX_FIX_INT = 0x7F;\n    /**\n     * Minimum fixed int (4 bits).\n     */\n    static final int MIN_FIX_INT = 0xFFFFFFF0;\n\n    // maps\n    /**\n     * Min fixed map - up to length 12.\n     */\n    static final int MIN_FIX_MAP = 0xFFFFFF80;\n    /**\n     * Max fixed map.\n     */\n    static final int MAX_FIX_MAP = 0xFFFFFF8C;\n    /**\n     * Map - followed by the size as an unsigned byte.\n     */\n    static final int MAP_8 = 0xFFFFFF8D;\n    /**\n     * Map - followed by the size as an unsigned short.\n     */\n    static final int MAP_16 = 0xFFFFFF8E;\n    /**\n     * Map - followed by the size as an unsigned long.\n     */\n    static final int MAP_32 = 0xFFFFFF8F;\n\n    // arrays\n    /**\n     * Min fixed array - up to length 12.\n     */\n    static final int MIN_FIX_ARRAY = 0xFFFFFF90;  // must be same as MsgPack\n    /**\n     * Max fixed array.\n     */\n    static final int MAX_FIX_ARRAY = 0xFFFFFF9C;\n    /**\n     * Array - followed by the size as an unsigned byte.\n     */\n    static final int ARRAY_8 = 0xFFFFFF9D;\n    /**\n     * Array - followed by the size as an unsigned short.\n     */\n    static final int ARRAY_16 = 0xFFFFFF9E;\n    /**\n     * Array - followed by the size as an unsigned long.\n     */\n    static final int ARRAY_32 = 0xFFFFFF9F;\n\n    // strings\n    /**\n     * Min fixed string - up to length 40.\n     */\n    static final int MIN_FIX_STR = 0xFFFFFFA0;\n    /**\n     * Max fixed string.\n     */\n    static final int MAX_FIX_STR = 0xFFFFFFC8;\n    /**\n     * String - followed by the size as an unsigned byte.\n     */\n    static final int STR_8 = 0xFFFFFFC9;\n    /**\n     * String - followed by the size as an unsigned short.\n     */\n    static final int STR_16 = 0xFFFFFFCA;\n    /**\n     * String - followed by the size as an unsigned int.\n     */\n    static final int STR_32 = 0xFFFFFFCB;\n\n    // primitives\n    /**\n     * Null.\n     */\n    static final int NULL = 0xFFFFFFCC;\n    /**\n     * False.\n     */\n    static final int FALSE = 0xFFFFFFCD;\n    /**\n     * True.\n     */\n    static final int TRUE = 0xFFFFFFCE;\n    /**\n     * Unused.\n     */\n    static final int UNUSED = 0xFFFFFFCF;\n\n    // numbers\n    /**\n     * Float - followed by 4 bytes.\n     */\n    static final int FLOAT_32 = 0xFFFFFFD0;\n    /**\n     * Double in 1-byte int format - followed by 1 byte signed int\n     */\n    static final int DOUBLE_INT_8 = 0xFFFFFFD1;\n    /**\n     * Double - followed by 8 bytes.\n     */\n    static final int DOUBLE_64 = 0xFFFFFFD2;\n    /**\n     * Char (unsigned) - followed by 2 bytes.\n     */\n    static final int CHAR_16 = 0xFFFFFFD3;\n    /**\n     * Byte (signed) - followed by 1 byte.\n     */\n    static final int BYTE_8 = 0xFFFFFFD4;\n    /**\n     * Short (signed) - followed by 2 bytes.\n     */\n    static final int SHORT_16 = 0xFFFFFFD5;\n    /**\n     * Int (signed) - followed by 2 bytes.\n     */\n    static final int INT_16 = 0xFFFFFFD6;\n    /**\n     * Int (signed) - followed by 4 bytes.\n     */\n    static final int INT_32 = 0xFFFFFFD7;\n    /**\n     * Long (signed) - followed by 1 byte.\n     */\n    static final int LONG_8 = 0xFFFFFFD8;\n    /**\n     * Long (signed) - followed by 2 bytes.\n     */\n    static final int LONG_16 = 0xFFFFFFD9;\n    /**\n     * Long (signed) - followed by 4 bytes.\n     */\n    static final int LONG_32 = 0xFFFFFFDA;\n    /**\n     * Long (signed) - followed by 8 bytes.\n     */\n    static final int LONG_64 = 0xFFFFFFDB;\n\n    // date/time\n    /**\n     * LocalDate (2 bytes) - packed format from year 2000 to 2169 inclusive,\n     * 11 bits for year-month from 2000, 5 bits for 1-based day-of-month.\n     */\n    static final int DATE_PACKED = 0xFFFFFFDC;\n    /**\n     * LocalDate (5 bytes) - 27 bits for year-month, 5 bits for 1-based day-of-month.\n     */\n    static final int DATE = 0xFFFFFFDD;\n    /**\n     * LocalTime (6 bytes) - 6 byte nano-of-day.\n     */\n    static final int TIME = 0xFFFFFFDE;\n    /**\n     * Instant (12 bytes) - 8 for the seconds and 4 for the nanoseconds.\n     */\n    static final int INSTANT = 0xFFFFFFDF;\n    /**\n     * Duration (12 bytes) - 8 for the seconds and 4 for the nanoseconds.\n     */\n    static final int DURATION = 0xFFFFFFE0;\n\n    // byte[]/double[]\n    /**\n     * byte[] - followed by the size as an unsigned short.\n     */\n    static final int BIN_8 = 0xFFFFFFE1;\n    /**\n     * byte[] - followed by the size as an unsigned short.\n     */\n    static final int BIN_16 = 0xFFFFFFE2;\n    /**\n     * byte[] - followed by the size as an unsigned int.\n     */\n    static final int BIN_32 = 0xFFFFFFE3;\n    /**\n     * double[] - followed by the size as an unsigned byte.\n     */\n    static final int DOUBLE_ARRAY_8 = 0xFFFFFFE4;\n    /**\n     * double[] - followed by the size as an unsigned short.\n     */\n    static final int DOUBLE_ARRAY_16 = 0xFFFFFFE5;\n    /**\n     * double[] - followed by the size as an unsigned int.\n     */\n    static final int DOUBLE_ARRAY_32 = 0xFFFFFFE6;\n\n    // types and references\n    /**\n     * Type definition - followed by a 1 byte length, UTF-8 string and the actual value.\n     */\n    static final int TYPE_DEFN_8 = 0xFFFFFFE7;\n    /**\n     * Type definition - followed by a 2 byte length, UTF-8 string and the actual value.\n     */\n    static final int TYPE_DEFN_16 = 0xFFFFFFE8;\n    /**\n     * Reference to a type name - followed by a 1 byte int and the actual value.\n     */\n    static final int TYPE_REF_8 = 0xFFFFFFE9;\n    /**\n     * Reference to a type name - followed by a 2 byte int and the actual value.\n     */\n    static final int TYPE_REF_16 = 0xFFFFFFEA;\n    /**\n     * Bean with full definition - followed by a 1 byte int count of properties, then each property name,\n     * then each property value, nulls replacing non-serialized entries.\n     * Beans with 256 or more properties are not recorded as bean definitions.\n     */\n    static final int BEAN_DEFN = 0xFFFFFFEB;\n    /**\n     * Value with full definition - followed by the value.\n     */\n    static final int VALUE_DEFN = 0xFFFFFFEC;\n    /**\n     * Reference to a previous value - followed by a 1 byte int and the actual value.\n     */\n    static final int VALUE_REF_8 = 0xFFFFFFED;\n    /**\n     * Reference to a previous value - followed by a 2 byte int and the actual value.\n     */\n    static final int VALUE_REF_16 = 0xFFFFFFEE;\n    /**\n     * Reference to a previous value - followed by a 3 byte int and the actual value.\n     */\n    static final int VALUE_REF_24 = 0xFFFFFFEF;\n\n    //-------------------------------------------------------------------------\n    /**\n     * Set type code, followed by an array of values.\n     */\n    static final int TYPE_CODE_LIST = -1;\n    /**\n     * Set type code, followed by an array of values.\n     */\n    static final int TYPE_CODE_SET = -2;\n    /**\n     * Set type code, followed by an array of values.\n     */\n    static final int TYPE_CODE_MAP = -3;\n    /**\n     * Optional type code, followed by a value, where a null value means empty.\n     */\n    static final int TYPE_CODE_OPTIONAL = -4;\n    /**\n     * Multiset type code, followed by a map of values.\n     */\n    static final int TYPE_CODE_MULTISET = -5;\n    /**\n     * Multimap type code, followed by a map of values.\n     */\n    static final int TYPE_CODE_LIST_MULTIMAP = -6;\n    /**\n     * SetMultimap type code, followed by a map of values.\n     */\n    static final int TYPE_CODE_SET_MULTIMAP = -7;\n    /**\n     * Bimap type code, followed by a map of values.\n     */\n    static final int TYPE_CODE_BIMAP = -8;\n    /**\n     * Table type code.\n     */\n    static final int TYPE_CODE_TABLE = -9;\n    /**\n     * Optional (Guava) type code, followed by a value, where a null value means empty.\n     */\n    static final int TYPE_CODE_GUAVA_OPTIONAL = -10;\n    /**\n     * Grid type code.\n     */\n    static final int TYPE_CODE_GRID = -11;\n    /**\n     * Object[] type code, followed by an array of values.\n     */\n    static final int TYPE_CODE_OBJECT_ARRAY = -12;\n    /**\n     * String[] type code, followed by an array of values.\n     */\n    static final int TYPE_CODE_STRING_ARRAY = -13;\n\n    //-----------------------------------------------------------------------\n    /**\n     * Converts a byte to a hex string for debugging.\n     * \n     * @param b  the byte\n     * @return the two character hex equivalent, not null\n     */\n    static String toHex(int b) {\n        return String.format(\"%02X\", (byte) b);\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/BeanPackInput.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.DataInputStream;\nimport java.io.IOException;\nimport java.time.Duration;\nimport java.time.Instant;\nimport java.time.LocalDate;\nimport java.time.LocalTime;\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * Receives and processes BeanPack data.\n * <p>\n * This interprets based on the data in the input, and does not interpret data into beans.\n */\nabstract class BeanPackInput extends BeanPack {\n\n    /**\n     * The stream to read.\n     */\n    private final DataInputStream input;\n    /**\n     * The type definitions.\n     */\n    private final List<String> typeDefinitions = new ArrayList<>();\n    /**\n     * The value definitions.\n     */\n    private final List<Object> valueDefinitions = new ArrayList<>();\n\n    /**\n     * Creates an instance.\n     * \n     * @param bytes  the bytes to read, not null\n     */\n    BeanPackInput(byte[] bytes) {\n        this(new DataInputStream(new ByteArrayInputStream(bytes)));\n    }\n\n    /**\n     * Creates an instance.\n     * \n     * @param stream  the stream to read from, not null\n     */\n    BeanPackInput(DataInputStream stream) {\n        this.input = stream;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Reads all the data in the stream, closing the stream.\n     */\n    void readAll() {\n        try {\n            try {\n                acceptObject();\n            } finally {\n                input.close();\n            }\n        } catch (IOException ex) {\n            throw new IllegalStateException(ex);\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    private Object acceptObject() throws IOException {\n        var next = input.readByte();\n        return readObject(next);\n    }\n\n    //-----------------------------------------------------------------------\n    Object readObject(byte typeByte) throws IOException {\n        handleObjectStart();\n        if (typeByte >= MIN_FIX_INT) {  // no need to check for b <= MAX_FIX_INT\n            handleInt(typeByte);\n            return typeByte;\n\n        } else if (typeByte >= MIN_FIX_STR && typeByte <= MAX_FIX_STR) {\n            return parseString(typeByte - MIN_FIX_STR);\n\n        } else if (typeByte >= MIN_FIX_ARRAY && typeByte <= MAX_FIX_ARRAY) {\n            return parseArray(typeByte - MIN_FIX_ARRAY);\n\n        } else if (typeByte >= MIN_FIX_MAP && typeByte <= MAX_FIX_MAP) {\n            return parseMap(typeByte - MIN_FIX_MAP);\n\n        } else {\n            return switch (typeByte) {\n                case MAP_8 -> parseMap(input.readUnsignedByte());\n                case MAP_16 -> parseMap(input.readUnsignedShort());\n                case MAP_32 -> parseMap(input.readInt());\n                case ARRAY_8 -> parseArray(input.readUnsignedByte());\n                case ARRAY_16 -> parseArray(input.readUnsignedShort());\n                case ARRAY_32 -> parseArray(input.readInt());\n                case STR_8 -> parseString(input.readUnsignedByte());\n                case STR_16 -> parseString(input.readUnsignedShort());\n                case STR_32 -> parseString(input.readInt());\n                case NULL -> parseNull();\n                case FALSE -> parseBoolean(false);\n                case TRUE -> parseBoolean(true);\n                case UNUSED -> parseUnknown(typeByte);\n                case FLOAT_32 -> parseFloat(input.readFloat());\n                case DOUBLE_INT_8 -> parseDouble(input.readByte());\n                case DOUBLE_64 -> parseDouble(input.readDouble());\n                case CHAR_16 -> parseChar(input.readChar());\n                case BYTE_8 -> parseByte(input.readByte());\n                case SHORT_16 -> parseShort(input.readShort());\n                case INT_16 -> parseInt(input.readShort());\n                case INT_32 -> parseInt(input.readInt());\n                case LONG_8 -> parseLong(input.readByte());\n                case LONG_16 -> parseLong(input.readShort());\n                case LONG_32 -> parseLong(input.readInt());\n                case LONG_64 -> parseLong(input.readLong());\n                case DATE_PACKED -> parseDatePacked();\n                case DATE -> parseDate();\n                case TIME -> parseTime();\n                case INSTANT -> parseInstant();\n                case DURATION -> parseDuration();\n                case BIN_8 -> parseByteArray(input.readUnsignedByte());\n                case BIN_16 -> parseByteArray(input.readUnsignedShort());\n                case BIN_32 -> parseByteArray(input.readInt());\n                case DOUBLE_ARRAY_8 -> parseDoubleArray(input.readUnsignedByte());\n                case DOUBLE_ARRAY_16 -> parseDoubleArray(input.readUnsignedShort());\n                case DOUBLE_ARRAY_32 -> parseDoubleArray(input.readInt());\n                case TYPE_DEFN_8 -> parseTypeName(input.readUnsignedByte());\n                case TYPE_DEFN_16 -> parseTypeName(input.readUnsignedShort());\n                case TYPE_REF_8 -> parseTypeReference(input.readByte());\n                case TYPE_REF_16 -> parseTypeReference(input.readUnsignedShort());\n                case BEAN_DEFN -> parseBean(input.readUnsignedByte());\n                case VALUE_DEFN -> parseValueDefinition();\n                case VALUE_REF_8 -> parseValueReference(input.readUnsignedByte());\n                case VALUE_REF_16 -> parseValueReference(input.readUnsignedShort());\n                case VALUE_REF_24 -> parseValueReference((input.readUnsignedByte() << 16) + input.readUnsignedShort());\n                default -> parseUnknown(typeByte);\n            };\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    private Object parseMap(int size) throws IOException {\n        handleMapHeader(size);\n        for (var i = 0; i < size; i++) {\n            readMapKey();\n            readMapValue();\n        }\n        handleMapFooter();\n        return \"<bean>\";  // maps are not cached as values, so this map must actually be a bean\n    }\n\n    Object readMapKey() throws IOException {\n        return acceptObject();\n    }\n\n    Object readMapValue() throws IOException {\n        return acceptObject();\n    }\n\n    private Object parseArray(int size) throws IOException {\n        handleArrayHeader(size);\n        for (var i = 0; i < size; i++) {\n            readArrayItem();\n        }\n        handleArrayFooter();\n        return \"<bean>\";  // maps are not cached as values, so this map must actually be a bean\n    }\n\n    Object readArrayItem() throws IOException {\n        return acceptObject();\n    }\n\n    private Object parseBean(int size) throws IOException {\n        handleBeanHeader(size);\n        for (var i = 0; i < size * 2; i++) {\n            readBeanItem();\n        }\n        handleBeanFooter();\n        return \"<bean>\";\n    }\n\n    Object readBeanItem() throws IOException {\n        return acceptObject();\n    }\n\n    private Object readAnnotatedValue() throws IOException {\n        return acceptObject();\n    }\n\n    //-------------------------------------------------------------------------\n    private Object parseNull() throws IOException {\n        handleNull();\n        return null;\n    }\n\n    private Object parseBoolean(boolean value) throws IOException {\n        handleBoolean(value);\n        return value;\n    }\n\n    private Object parseUnknown(byte value) throws IOException {\n        handleUnknown(value);\n        return null;\n    }\n\n    private Object parseFloat(float value) throws IOException {\n        handleFloat(value);\n        return null;\n    }\n\n    private Object parseDouble(double value) throws IOException {\n        handleDouble(value);\n        return null;\n    }\n\n    private Object parseChar(char value) throws IOException {\n        handleChar(value);\n        return null;\n    }\n\n    private Object parseByte(byte value) throws IOException {\n        handleByte(value);\n        return value;\n    }\n\n    private Object parseShort(short value) throws IOException {\n        handleShort(value);\n        return value;\n    }\n\n    private Object parseInt(int value) throws IOException {\n        handleInt(value);\n        return value;\n    }\n\n    private Object parseLong(long value) throws IOException {\n        handleLong(value);\n        return value;\n    }\n\n    private String parseString(int size) throws IOException {\n        if (size < 0) {\n            throw new IllegalStateException(\"String too large\");\n        }\n        var bytes = new byte[size];\n        input.readFully(bytes);\n        var str = new String(bytes, UTF_8);\n        handleString(str);\n        if (str.length() >= MIN_LENGTH_STR_VALUE) {\n            valueDefinitions.add(str);\n        }\n        return str;\n    }\n\n    private LocalDate parseDatePacked() throws IOException {\n        var packed = input.readUnsignedShort();\n        var dom = packed & 31;\n        var ym = packed >> 5;\n        var date = LocalDate.of((ym / 12) + 2000, (ym % 12) + 1, dom);\n        handleDate(date);\n        return date;\n    }\n\n    private LocalDate parseDate() throws IOException {\n        var upper = input.readInt();\n        var lower = input.readUnsignedByte();\n        var year = upper >> 1;\n        var month = ((upper & 1) << 3) + (lower >>> 5);\n        var dom = lower & 31;\n        var date = LocalDate.of(year, month, dom);\n        handleDate(date);\n        return date;\n    }\n\n    private LocalTime parseTime() throws IOException {\n        var upper = input.readUnsignedShort();\n        var lower = Integer.toUnsignedLong(input.readInt());\n        var nod = ((long) upper << 32) + lower;\n        var time = LocalTime.ofNanoOfDay(nod);\n        handleTime(time);\n        return time;\n    }\n\n    private Instant parseInstant() throws IOException {\n        var second = input.readLong();\n        var nanos = input.readInt();\n        var instant = Instant.ofEpochSecond(second, nanos);\n        handleInstant(instant);\n        return instant;\n    }\n\n    private Duration parseDuration() throws IOException {\n        var seconds = input.readLong();\n        var nanos = input.readInt();\n        var duration = Duration.ofSeconds(seconds, nanos);\n        handleDuration(duration);\n        return duration;\n    }\n\n    //-----------------------------------------------------------------------\n    private byte[] parseByteArray(int size) throws IOException {\n        var bytes = new byte[size];\n        input.readFully(bytes);\n        handleBinary(bytes);\n        return bytes;\n    }\n\n    private double[] parseDoubleArray(int size) throws IOException {\n        var values = new double[size];\n        for (int i = 0; i < size; i++) {\n            values[i] = input.readDouble();\n        }\n        handleDoubleArray(values);\n        return values;\n    }\n\n    //-------------------------------------------------------------------------\n    private Object parseTypeName(int size) throws IOException {\n        var bytes = new byte[size];\n        input.readFully(bytes);\n        var typeName = new String(bytes, UTF_8);\n        handleTypeName(typeName);\n        typeDefinitions.add(typeName);\n        return readAnnotatedValue();\n    }\n\n    private Object parseTypeReference(int ref) throws IOException {\n        var typeName = switch (ref) {\n            case TYPE_CODE_LIST -> \"List\";\n            case TYPE_CODE_SET -> \"Set\";\n            case TYPE_CODE_MAP -> \"Map\";\n            case TYPE_CODE_OPTIONAL -> \"Optional\";\n            case TYPE_CODE_MULTISET -> \"Multiset\";\n            case TYPE_CODE_LIST_MULTIMAP -> \"ListMultimap\";\n            case TYPE_CODE_SET_MULTIMAP -> \"SetMultimap\";\n            case TYPE_CODE_BIMAP -> \"BiMap\";\n            case TYPE_CODE_TABLE -> \"Table\";\n            case TYPE_CODE_GUAVA_OPTIONAL -> \"List\";\n            case TYPE_CODE_GRID -> \"Grid\";\n            case TYPE_CODE_OBJECT_ARRAY -> \"Object[]\";\n            case TYPE_CODE_STRING_ARRAY -> \"String[]\";\n            default -> ref >= 0 ? typeDefinitions.get(ref) : \"Unknown\";\n        };\n        handleTypeReference(ref, typeName);\n        return readAnnotatedValue();\n    }\n\n    private Object parseValueDefinition() throws IOException {\n        handleValueDefinition();\n        var value = readAnnotatedValue();\n        valueDefinitions.add(value);\n        return value;\n    }\n\n    private Object parseValueReference(int ref) {\n        var value = valueDefinitions.get(ref);\n        handleValueReference(ref, value);\n        return value;\n    }\n\n    //-------------------------------------------------------------------------\n    void handleObjectStart() {\n    }\n\n    void handleMapHeader(int size) {\n    }\n\n    void handleMapFooter() {\n    }\n\n    void handleArrayHeader(int size) {\n    }\n\n    void handleArrayFooter() {\n    }\n\n    void handleString(String str) {\n    }\n\n    void handleNull() {\n    }\n\n    void handleBoolean(boolean bool) {\n    }\n\n    void handleFloat(float value) {\n    }\n\n    void handleDouble(double value) {\n    }\n\n    void handleChar(char value) {\n    }\n\n    void handleByte(byte value) {\n    }\n\n    void handleShort(short value) {\n    }\n\n    void handleInt(int value) {\n    }\n\n    void handleLong(long value) {\n    }\n\n    void handleDate(LocalDate date) {\n    }\n\n    void handleTime(LocalTime time) {\n    }\n\n    void handleInstant(Instant instant) {\n    }\n\n    void handleDuration(Duration duration) {\n    }\n\n    void handleBinary(byte[] bytes) {\n    }\n\n    void handleDoubleArray(double[] values) {\n    }\n\n    void handleTypeName(String typeName) throws IOException {\n    }\n\n    void handleTypeReference(int ref, String typeName) throws IOException {\n    }\n\n    void handleBeanHeader(int propertyCount) throws IOException {\n    }\n\n    void handleBeanFooter() throws IOException {\n    }\n\n    void handleValueDefinition() throws IOException {\n    }\n\n    void handleValueReference(int ref, Object value) {\n    }\n\n    void handleUnknown(byte b) {\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/BeanPackOutput.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.io.DataOutputStream;\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.time.Duration;\nimport java.time.Instant;\nimport java.time.LocalDate;\nimport java.time.LocalTime;\n\nimport org.joda.beans.ResolvedType;\n\n/**\n * Outputter for BeanPack data, which is derived from ideas in MsgPack.\n */\nfinal class BeanPackOutput extends BeanPack {\n\n    /**\n     * Mask to check if value is a small positive integer, from 0 to 127 inclusive.\n     */\n    private static final int MASK_SMALL_INT_POSITIVE = 0xFFFFFF80;\n\n    /**\n     * The stream to write to.\n     */\n    private final DataOutputStream output;\n\n    /**\n     * Creates an instance.\n     * \n     * @param stream  the stream to write to, not null\n     */\n    BeanPackOutput(OutputStream stream) {\n        this.output = new DataOutputStream(stream);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Writes a null.\n     * \n     * @throws IOException if an error occurs\n     */\n    void writeNull() throws IOException {\n        output.writeByte(NULL);\n    }\n\n    /**\n     * Writes a boolean.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeBoolean(boolean value) throws IOException {\n        if (value) {\n            output.writeByte(TRUE);\n        } else {\n            output.writeByte(FALSE);\n        }\n    }\n\n    /**\n     * Writes a float.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeFloat(float value) throws IOException {\n        output.writeByte(FLOAT_32);\n        output.writeFloat(value);\n    }\n\n    /**\n     * Writes a double.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeDouble(double value) throws IOException {\n        var intValue = (int) value;\n        if (value == intValue && intValue <= Byte.MAX_VALUE && intValue >= Byte.MIN_VALUE && Double.compare(value, -0d) != 0) {\n            output.writeByte(DOUBLE_INT_8);\n            output.writeByte(intValue);\n        } else {\n            output.writeByte(DOUBLE_64);\n            output.writeDouble(value);\n        }\n    }\n\n    /**\n     * Writes a char.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeChar(char value) throws IOException {\n        output.writeByte(CHAR_16);\n        output.writeChar(value);\n    }\n\n    /**\n     * Writes a byte.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeByte(byte value) throws IOException {\n        output.writeByte(BYTE_8);\n        output.writeByte(value);\n    }\n\n    /**\n     * Writes a short.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeShort(short value) throws IOException {\n        output.writeByte(SHORT_16);\n        output.writeShort(value);\n    }\n\n    /**\n     * Writes an int.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeInt(int value) throws IOException {\n        if ((value & MASK_SMALL_INT_POSITIVE) == 0) {\n            output.writeByte(value);\n        } else if (value >= 0) {\n            if (value <= Short.MAX_VALUE) {\n                output.writeByte(INT_16);\n                output.writeShort((short) value);\n            } else {\n                output.writeByte(INT_32);\n                output.writeInt(value);\n            }\n        } else {\n            if (value >= MIN_FIX_INT) {\n                output.writeByte(value);\n            } else if (value >= Short.MIN_VALUE) {\n                output.writeByte(INT_16);\n                output.writeShort((short) value);\n            } else {\n                output.writeByte(INT_32);\n                output.writeInt(value);\n            }\n        }\n    }\n\n    /**\n     * Writes a long.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeLong(long value) throws IOException {\n        if (value >= 0) {\n            if (value <= Byte.MAX_VALUE) {\n                output.writeByte(LONG_8);\n                output.writeByte((byte) value);\n            } else if (value <= Short.MAX_VALUE) {\n                output.writeByte(LONG_16);\n                output.writeShort((short) value);\n            } else if (value <= Integer.MAX_VALUE) {\n                output.writeByte(LONG_32);\n                output.writeInt((int) value);\n            } else {\n                output.writeByte(LONG_64);\n                output.writeLong(value);\n            }\n        } else {\n            if (value >= Byte.MIN_VALUE) {\n                output.writeByte(LONG_8);\n                output.writeByte((byte) value);\n            } else if (value >= Short.MIN_VALUE) {\n                output.writeByte(LONG_16);\n                output.writeShort((short) value);\n            } else if (value >= Integer.MIN_VALUE) {\n                output.writeByte(LONG_32);\n                output.writeInt((int) value);\n            } else {\n                output.writeByte(LONG_64);\n                output.writeLong(value);\n            }\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Writes a date.\n     * \n     * @param date  the date\n     * @throws IOException if an error occurs\n     */\n    void writeDate(LocalDate date) throws IOException {\n        var year = date.getYear();\n        var month = date.getMonthValue();\n        var dom = date.getDayOfMonth();\n        if (year >= 2000 && year <= 2169) {\n            var ym2000 = (year - 2000) * 12 + (month - 1);\n            output.write(DATE_PACKED);\n            var packed = (ym2000 << 5) + dom;\n            output.writeShort(packed);\n        } else {\n            output.write(DATE);\n            var packed = (((long) year) << 9) + (month << 5) + dom;\n            output.writeInt((int) (packed >> 8));\n            output.writeByte((byte) (packed & 0xFF));\n        }\n    }\n\n    /**\n     * Writes a time.\n     * \n     * @param time  the time\n     * @throws IOException if an error occurs\n     */\n    void writeTime(LocalTime time) throws IOException {\n        var nod = time.toNanoOfDay();\n        var upper = (int) (nod >>> 32);\n        var lower = (int) (nod & 0xFFFFFFFFL);\n        output.write(TIME);\n        output.writeShort(upper);\n        output.writeInt(lower);\n    }\n\n    /**\n     * Writes an instant.\n     * \n     * @param instant  the instant\n     * @throws IOException if an error occurs\n     */\n    void writeInstant(Instant instant) throws IOException {\n        output.write(INSTANT);\n        output.writeLong(instant.getEpochSecond());\n        output.writeInt(instant.getNano());\n    }\n\n    /**\n     * Writes a duration.\n     * \n     * @param duration  the instant\n     * @throws IOException if an error occurs\n     */\n    void writeDuration(Duration duration) throws IOException {\n        output.write(DURATION);\n        output.writeLong(duration.getSeconds());\n        output.writeInt(duration.getNano());\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Writes a byte[].\n     * \n     * @param bytes  the bytes, not null\n     * @throws IOException if an error occurs\n     */\n    void writeBytes(byte[] bytes) throws IOException {\n        // positive numbers only\n        var size = bytes.length;\n        if (size <= 0xFF) {\n            output.writeByte(BIN_8);\n            output.writeByte(size);\n        } else if (size <= 0xFFFF) {\n            output.writeByte(BIN_16);\n            output.writeShort(size);\n        } else {\n            output.writeByte(BIN_32);\n            output.writeInt(size);\n        }\n        output.write(bytes);\n    }\n\n    /**\n     * Writes a double[].\n     * \n     * @param values  the values, not null\n     * @throws IOException if an error occurs\n     */\n    void writeDoubles(double[] values) throws IOException {\n        // positive numbers only\n        var size = values.length;\n        if (size <= 0xFF) {\n            output.writeByte(DOUBLE_ARRAY_8);\n            output.writeByte(size);\n        } else if (size <= 0xFFFF) {\n            output.writeByte(DOUBLE_ARRAY_16);\n            output.writeShort(size);\n        } else {\n            output.writeByte(DOUBLE_ARRAY_32);\n            output.writeInt(size);\n        }\n        for (double value : values) {\n            output.writeDouble(value);\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Writes a map header.\n     * \n     * @param size  the size\n     * @throws IOException if an error occurs\n     */\n    void writeMapHeader(int size) throws IOException {\n        // positive numbers only\n        if (size <= 12) {\n            output.writeByte(MIN_FIX_MAP + size);\n        } else if (size <= 0xFF) {\n            output.writeByte(MAP_8);\n            output.writeByte(size);\n        } else if (size <= 0xFFFF) {\n            output.writeByte(MAP_16);\n            output.writeShort(size);\n        } else {\n            output.writeByte(MAP_32);\n            output.writeInt(size);\n        }\n    }\n\n    /**\n     * Writes an array header.\n     * \n     * @param size  the size\n     * @throws IOException if an error occurs\n     */\n    void writeArrayHeader(int size) throws IOException {\n        // positive numbers only\n        if (size <= 12) {\n            output.writeByte(MIN_FIX_ARRAY + size);\n        } else if (size <= 0xFF) {\n            output.writeByte(ARRAY_8);\n            output.writeByte(size);\n        } else if (size <= 0xFFFF) {\n            output.writeByte(ARRAY_16);\n            output.writeShort(size);\n        } else {\n            output.writeByte(ARRAY_32);\n            output.writeInt(size);\n        }\n    }\n\n    /**\n     * Writes a String.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeString(String value) throws IOException {\n        // Java 21 performance testing showed manually converting to UTF-8 to be slower\n        var bytes = value.getBytes(UTF_8);\n        var size = bytes.length;\n        if (size <= (MAX_FIX_STR - MIN_FIX_STR)) {\n            output.writeByte(MIN_FIX_STR + size);\n        } else {\n            writeStringHeaderLarge(size);\n        }\n        output.write(bytes);\n    }\n\n    // separate out larger strings, which may benefit hotspot\n    private void writeStringHeaderLarge(int size) throws IOException {\n        // positive numbers only\n        if (size <= 0xFF) {\n            output.writeByte(STR_8);\n            output.writeByte(size);\n        } else if (size <= 0xFFFF) {\n            output.writeByte(STR_16);\n            output.writeShort(size);\n        } else {\n            output.writeByte(STR_32);\n            output.writeInt(size);\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Writes a type name.\n     * <p>\n     * The type name is a class name, not a {@link ResolvedType}.\n     * \n     * @param className  the class name\n     * @throws IOException if an error occurs\n     */\n    void writeTypeName(String className) throws IOException {\n        // written directly, as this is not part of the value definition setup\n        var bytes = className.getBytes(UTF_8);\n        if (bytes.length <= 0xFF) {\n            output.write(TYPE_DEFN_8);\n            output.writeByte(bytes.length);\n        } else {  // assume type name length will be < 0xFFFF\n            output.write(TYPE_DEFN_16);\n            output.writeShort(bytes.length);\n        }\n        output.write(bytes);\n    }\n\n    /**\n     * Writes a type reference.\n     * \n     * @param ref  the reference\n     * @throws IOException if an error occurs\n     */\n    void writeTypeReference(int ref) throws IOException {\n        // allow negative numbers >= -128\n        if (ref <= 0x7F) {\n            output.write(TYPE_REF_8);\n            output.writeByte(ref);\n        } else {\n            output.write(TYPE_REF_16);\n            output.writeShort(ref);\n        }\n    }\n\n    /**\n     * Writes a bean definition header.\n     * \n     * @param propertyCount  the count of properties, must be 0 to 255\n     * @throws IOException if an error occurs\n     */\n    void writeBeanDefinitionHeader(int propertyCount) throws IOException {\n        // 0 to 255\n        output.write(BEAN_DEFN);\n        output.writeByte(propertyCount);\n    }\n\n    /**\n     * Writes a value definition header.\n     * \n     * @throws IOException if an error occurs\n     */\n    void writeValueDefinitionHeader() throws IOException {\n        output.write(VALUE_DEFN);\n    }\n\n    /**\n     * Writes a value reference.\n     * \n     * @param ref  the reference\n     * @throws IOException if an error occurs\n     */\n    void writeValueReference(int ref) throws IOException {\n        // positive numbers only\n        if (ref <= 0xFF) {\n            output.write(VALUE_REF_8);\n            output.writeByte(ref);\n        } else if (ref <= 0xFFFF) {\n            output.write(VALUE_REF_16);\n            output.writeShort(ref);\n        } else {\n            output.write(VALUE_REF_24);\n            output.writeByte(ref >>> 16);\n            output.writeShort(ref & 0xFFFF);\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/BeanPackVisualizer.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.io.IOException;\nimport java.time.Duration;\nimport java.time.Instant;\nimport java.time.LocalDate;\nimport java.time.LocalTime;\n\n/**\n * Allows BeanPack data to be visualized.\n */\nfinal class BeanPackVisualizer extends BeanPackInput {\n\n    /**\n     * The current indent.\n     */\n    private String indent = \"\";\n    /**\n     * The buffer.\n     */\n    private final StringBuilder buf = new StringBuilder(1024);\n\n    /**\n     * Creates an instance.\n     * \n     * @param bytes  the bytes to read, not null\n     */\n    BeanPackVisualizer(byte[] bytes) {\n        super(bytes);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Visualizes the data in the stream.\n     */\n    String visualizeData() {\n        try {\n            readAll();\n            return buf.toString();\n        } catch (Exception ex) {\n            return buf.append(\"!!ERROR!!\").append(System.lineSeparator()).append(ex.toString()).toString();\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    Object readMapKey() throws IOException {\n        indent = indent + \"= \";\n        var value = super.readMapKey();\n        indent = indent.substring(0, indent.length() - 2);\n        return value;\n    }\n\n    @Override\n    Object readMapValue() throws IOException {\n        indent = indent + \"  \";\n        var value = super.readMapValue();\n        indent = indent.substring(0, indent.length() - 2);\n        return value;\n    }\n\n    @Override\n    Object readArrayItem() throws IOException {\n        indent = indent + \"- \";\n        var value = super.readArrayItem();\n        indent = indent.substring(0, indent.length() - 2);\n        return value;\n    }\n\n    @Override\n    Object readBeanItem() throws IOException {\n        indent = indent + \"- \";\n        var value = super.readBeanItem();\n        indent = indent.substring(0, indent.length() - 2);\n        return value;\n    }\n\n    @Override\n    void handleObjectStart() {\n        buf.append(indent);\n        indent = indent.replace(\"-\", \" \").replace(\"=\", \" \");\n    }\n\n    //-------------------------------------------------------------------------\n    @Override\n    void handleNull() {\n        buf.append(\"null\").append(System.lineSeparator());\n    }\n\n    @Override\n    void handleBoolean(boolean bool) {\n        buf.append(bool).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleFloat(float value) {\n        buf.append(\"flt \").append(value).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleDouble(double value) {\n        buf.append(\"dbl \").append(value).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleChar(char value) {\n        buf.append(\"chr \").append(value).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleByte(byte value) {\n        buf.append(\"byt \").append(value).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleShort(short value) {\n        buf.append(\"sht \").append(value).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleInt(int value) {\n        buf.append(\"int \").append(value).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleLong(long value) {\n        buf.append(\"lng \").append(value).append(System.lineSeparator());\n    }\n\n    //-------------------------------------------------------------------------\n    @Override\n    void handleDate(LocalDate date) {\n        buf.append(date).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleTime(LocalTime time) {\n        buf.append(time).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleInstant(Instant instant) {\n        buf.append(instant).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleDuration(Duration duration) {\n        buf.append(duration).append(System.lineSeparator());\n    }\n\n    //-------------------------------------------------------------------------\n    @Override\n    void handleMapHeader(int size) {\n        buf.append(\"map (\").append(size).append(\")\").append(System.lineSeparator());\n    }\n\n    @Override\n    void handleArrayHeader(int size) {\n        buf.append(\"arr (\").append(size).append(\")\").append(System.lineSeparator());\n    }\n\n    @Override\n    void handleString(String str) {\n        buf.append(\"str '\").append(str).append('\\'').append(System.lineSeparator());\n    }\n\n    @Override\n    void handleBinary(byte[] bytes) {\n        buf.append(\"bin '\");\n        for (byte b : bytes) {\n            buf.append(toHex(b));\n        }\n        buf.append(\"'\").append(System.lineSeparator());\n    }\n\n    @Override\n    void handleDoubleArray(double[] values) {\n        buf.append(\"dbl [\");\n        for (int i = 0; i < values.length; i++) {\n            if (i > 0) {\n                buf.append(System.lineSeparator()).append(\"     \");\n            }\n            for (int j = 0; j < 8 && i < values.length; j++, i++) {\n                if (j > 0) {\n                    buf.append(',');\n                }\n                buf.append(values[i]);\n            }\n        }\n        buf.append(\"]\").append(System.lineSeparator());\n    }\n\n    //-------------------------------------------------------------------------\n    @Override\n    void handleTypeName(String typeName) throws IOException {\n        buf.append(\"@type \").append(typeName).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleTypeReference(int ref, String typeName) throws IOException {\n        var str = ref < 0 ? typeName : ref + \" \" + typeName;\n        buf.append(\"@typeref \").append(str).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleBeanHeader(int propertyCount) throws IOException {\n        buf.append(\"bean (\").append(propertyCount).append(\")\").append(System.lineSeparator());\n    }\n\n    @Override\n    void handleValueDefinition() throws IOException {\n        buf.append(\"@value \").append(System.lineSeparator());\n    }\n\n    @Override\n    void handleValueReference(int ref, Object value) {\n        buf.append(\"ref \").append(ref).append(\" '\").append(value).append('\\'').append(System.lineSeparator());\n    }\n\n    //-------------------------------------------------------------------------\n    @Override\n    void handleUnknown(byte b) {\n        buf.append(\"Unknown - \").append(String.format(\"%02X \", b)).append(System.lineSeparator());\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/BeanReferences.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport static java.util.Collections.reverseOrder;\nimport static java.util.Comparator.comparingInt;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.LinkedHashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerIterator;\nimport org.joda.beans.ser.SerOptional;\n\n/**\n * Stores information on the references in a bean.\n */\nfinal class BeanReferences {\n\n    private static final Set<Class<?>> NON_REFERENCED = Set.of(\n            Long.class,\n            Integer.class,\n            Short.class,\n            Byte.class,\n            Double.class,\n            Float.class,\n            Boolean.class,\n            Character.class,\n            byte[].class);\n\n    /**\n     * The settings.\n     */\n    private final JodaBeanSer settings;\n    /**\n     * The classes that are being serialized.\n     */\n    private final Map<Class<?>, ClassInfo> classes = new HashMap<>();\n    /**\n     * The amount of time each class needs to have its type serialized, linked for stability.\n     */\n    private final Map<Class<?>, Integer> classSerializationCount = new LinkedHashMap<>();\n    /**\n     * The sorted class infos.\n     */\n    private final List<ClassInfo> classInfoList = new ArrayList<>();\n    /**\n     * The serialized objects that are repeated and require references.\n     */\n    private final Map<Object, Ref> refs = new HashMap<>();\n\n    // finds \n    static BeanReferences find(ImmutableBean root, JodaBeanSer settings) {\n        var references = new BeanReferences(settings);\n        references.findReferences(root);\n        return references;\n    }\n\n    // creates an instance\n    private BeanReferences(JodaBeanSer settings) {\n        this.settings = settings;\n    }\n\n    //-----------------------------------------------------------------------\n    // finds classes and references within the bean\n    private void findReferences(ImmutableBean root) {\n        // handle root bean\n        classes.put(root.getClass(), classInfoFromMetaBean(root.metaBean()));\n        classSerializationCount.put(root.getClass(), 1);\n\n        // recursively check object graph\n        var objects = new LinkedHashMap<Object, Integer>();\n        findReferencesBean(root, root.getClass(), objects, null);\n\n        // build up the list of references, but only for those instances that are repeated\n        var refEntries = objects.entrySet().stream()\n                .filter(entry -> entry.getValue() > 1)\n                .sorted(reverseOrder(comparingInt(Map.Entry::getValue)))\n                .toList();\n        for (var entry : refEntries) {\n            var value = entry.getKey();\n            var realType = value.getClass();\n\n            // simple types do not need references\n            if (!NON_REFERENCED.contains(realType)) {\n                refs.put(value, new Ref(false, refs.size()));\n            }\n        }\n        \n        // reorder classes so the most repeated serialized names have the lowest number (hence the shortest extension)\n        this.classInfoList.addAll(classSerializationCount.entrySet().stream()\n                .sorted(reverseOrder(comparingInt(Map.Entry::getValue)))\n                .map(entry -> classes.get(entry.getKey()))\n                .toList());\n\n        // adjust the position in the ClassInfo instance\n        for (var position = 0; position < classInfoList.size(); position++) {\n            var classInfo = classInfoList.get(position);\n            classInfo.position = position;\n        }\n    }\n\n    // recursively find the references\n    private void findReferencesBean(\n            Object base,\n            Class<?> declaredClass,\n            Map<Object, Integer> objects,\n            SerIterator parentIterator) {\n\n        if (base == null) {\n            return;\n        }\n\n        // has this object been seen before, if so no need to check it again\n        if (objects.compute(base, BeanReferences::incrementOrOne) > 1) {\n            // shouldn't try and reuse references to collections\n            if (!(base instanceof Bean) && parentIterator != null) {\n                var childIterator = settings.getIteratorFactory().createChild(base, parentIterator);\n                if (childIterator != null) {\n                    findReferencesIterable(childIterator, objects);\n                }\n            }\n            return;\n        }\n        if (base instanceof Bean bean) {\n            addClassInfo(base, declaredClass);\n            if (settings.getConverter().isConvertible(bean.getClass())) {\n                return;\n            }\n\n            for (var prop : bean.metaBean().metaPropertyIterable()) {\n                if (settings.isSerialized(prop)) {\n                    var value = prop.get(bean);\n                    var type = SerOptional.extractType(prop, base.getClass());\n\n                    if (value != null) {\n                        var itemIterator = settings.getIteratorFactory().create(value, prop, bean.getClass());\n                        if (itemIterator != null) {\n                            if (itemIterator.metaTypeRequired()) {\n                                objects.compute(itemIterator.metaTypeName(), BeanReferences::incrementOrOne);\n                            }\n                            findReferencesIterable(itemIterator, objects);\n                        } else {\n                            findReferencesBean(value, type, objects, null);\n                        }\n                    }\n                }\n            }\n        } else if (parentIterator != null) {\n            var childIterator = settings.getIteratorFactory().createChild(base, parentIterator);\n            if (childIterator != null) {\n                // shouldn't try and reuse references to collections\n                findReferencesIterable(childIterator, objects);\n            } else {\n                addClassInfo(base, declaredClass);\n            }\n        } else {\n            addClassInfo(base, declaredClass);\n        }\n    }\n\n    // recursively find the references in an iterable\n    private void findReferencesIterable(SerIterator itemIterator, Map<Object, Integer> objects) {\n        switch (itemIterator.category()) {\n            case COLLECTION -> {\n                while (itemIterator.hasNext()) {\n                    itemIterator.next();\n                    findReferencesBean(itemIterator.value(), itemIterator.valueType(), objects, itemIterator);\n                }\n            }\n            case COUNTED -> {\n                while (itemIterator.hasNext()) {\n                    itemIterator.next();\n                    findReferencesBean(itemIterator.value(), itemIterator.valueType(), objects, itemIterator);\n                }\n            }\n            case MAP -> {\n                while (itemIterator.hasNext()) {\n                    itemIterator.next();\n                    findReferencesBean(itemIterator.key(), itemIterator.keyType(), objects, null);\n                    findReferencesBean(itemIterator.value(), itemIterator.valueType(), objects, itemIterator);\n                }\n            }\n            case TABLE -> {\n                while (itemIterator.hasNext()) {\n                    itemIterator.next();\n                    findReferencesBean(itemIterator.key(), itemIterator.keyType(), objects, null);\n                    findReferencesBean(itemIterator.column(), itemIterator.columnType(), objects, null);\n                    findReferencesBean(itemIterator.value(), itemIterator.valueType(), objects, itemIterator);\n                }\n            }\n            case GRID -> {\n                while (itemIterator.hasNext()) {\n                    itemIterator.next();\n                    findReferencesBean(itemIterator.value(), itemIterator.valueType(), objects, itemIterator);\n                }\n            }\n        }\n    }\n\n    // add to list of known classes\n    private void addClassInfo(Object value, Class<?> declaredClass) {\n        if (value instanceof Bean bean) {\n            if (!(value instanceof ImmutableBean)) {\n                throw new IllegalArgumentException(\n                        \"Can only serialize immutable beans in referencing binary format: \" + value.getClass().getName());\n            }\n            var isConvertible = settings.getConverter().isConvertible(value.getClass());\n            if (declaredClass.equals(value.getClass()) &&\n                    (classes.containsKey(value.getClass()) || isConvertible)) {\n                return;\n            }\n\n            // don't need meta-property info if it's a convertible type\n            if (isConvertible) {\n                addClassInfoForEffectiveType(value);\n            } else {\n                var classInfo = classInfoFromMetaBean(bean.metaBean());\n                addClassInfoAndIncrementCount(value.getClass(), classInfo);\n            }\n            \n        } else if (declaredClass == Object.class && !value.getClass().equals(String.class)) {\n            addClassInfoForEffectiveType(value);\n            \n        } else if (!settings.getConverter().isConvertible(declaredClass)) {\n            addClassInfoForEffectiveType(value);\n        }\n    }\n\n    private void addClassInfoForEffectiveType(Object value) {\n        var effectiveType = settings.getConverter().findTypedConverter(value.getClass()).getEffectiveType();\n        var classInfo = new ClassInfo(effectiveType, List.of());\n        addClassInfoAndIncrementCount(effectiveType, classInfo);\n    }\n\n    // adds the class, incrementing the number of times it is used\n    private void addClassInfoAndIncrementCount(Class<?> type, ClassInfo classInfo) {\n        classes.putIfAbsent(type, classInfo);\n        classSerializationCount.compute(type, BeanReferences::incrementOrOne);\n    }\n\n    // converts a meta-bean to a ClassInfo\n    private ClassInfo classInfoFromMetaBean(MetaBean metaBean) {\n        var metaProperties = new ArrayList<MetaProperty<?>>();\n        for (var metaProp : metaBean.metaPropertyIterable()) {\n            if (settings.isSerialized(metaProp)) {\n                metaProperties.add(metaProp);\n            }\n        }\n        // Positions get recreated when all classes have been recorded\n        return new ClassInfo(metaBean.beanType(), metaProperties);\n    }\n\n    // Used in Map#compute so we can initialise all the values to one and then increment\n    private static int incrementOrOne(@SuppressWarnings(\"unused\") Object k, Integer i) {\n        return i == null ? 1 : Math.addExact(i, 1);\n    }\n\n    //-----------------------------------------------------------------------\n    // gets the map of references\n    Map<Object, Ref> getReferences() {\n        return refs;\n    }\n    \n    List<ClassInfo> getClassInfoList() {\n        return classInfoList;\n    }\n\n    // lookup the class info by type\n    ClassInfo getClassInfo(Class<?> effectiveType) {\n        var classInfo = classes.get(effectiveType);\n        if (classInfo == null) {\n            throw new IllegalStateException(\n                    \"Tried to serialise class that wasn't present in bean on first pass: \" + effectiveType.getName());\n        }\n        return classInfo;\n    }\n\n    // CSOFF\n    //-----------------------------------------------------------------------\n    // The info needed to serialize instances of a class with a reference to the initially serialized class definition\n    static final class ClassInfo {\n\n        // The class itself - not necessary for serialization but here for easier inspection\n        final Class<?> type;\n\n        // The meta-properties (empty if not a bean) in the order in which they need to be serialized\n        final List<MetaProperty<?>> metaProperties;\n\n        // The position in the initial class definition list, lower means serialized more often\n        int position;\n\n        private ClassInfo(Class<?> type, List<MetaProperty<?>> metaProperties) {\n            this.type = type;\n            this.metaProperties = metaProperties;\n            this.position = -1;\n        }\n\n        @Override\n        public String toString() {\n            return \"ClassInfo{\" +\n                    \"position=\" + position +\n                    \", type=\" + type +\n                    \", metaProperties=\" + metaProperties +\n                    '}';\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    // The reference itself (position) plus whether it has previously been serialized\n    static final class Ref {\n        boolean hasBeenSerialized;\n        final int position;\n\n        private Ref(boolean hasBeenSerialized, int position) {\n            this.hasBeenSerialized = hasBeenSerialized;\n            this.position = position;\n        }\n\n        void sent() {\n            hasBeenSerialized = true;\n        }\n\n        @Override\n        public String toString() {\n            return \"Ref{\" +\n                    \"hasBeenSerialized=\" + hasBeenSerialized +\n                    \", position=\" + position +\n                    '}';\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/JodaBeanBinFormat.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport org.joda.beans.ser.JodaBeanSer;\n\n/**\n * Provides control over the binary format.\n * \n * @since 3.0.0\n */\npublic enum JodaBeanBinFormat {\n\n    /**\n     * The Standard format, version 1.\n     * <p>\n     * The binary format is based on MessagePack v2.0.\n     * Each bean is output as a map using the property name.\n     * <p>\n     * Most simple types, defined by Joda-Convert, are output as MessagePack strings.\n     * However, MessagePack nil, boolean, float, integral and bin types are also used\n     * for null, byte[] and the Java numeric primitive types (excluding char).\n     * <p>\n     * Beans are output using MessagePack maps where the key is the property name.\n     * Collections are output using MessagePack maps or arrays.\n     * Multisets are output as a map of value to count.\n     * <p>\n     * If a collection contains a collection then addition meta-type information is\n     * written to aid with deserialization.\n     * At this level, the data read back may not be identical to that written.\n     * <p>\n     * Where necessary, the Java type is sent using an 'ext' entity.\n     * Three 'ext' types are used, one each for beans, meta-type and simple.\n     * The class name is passed as the 'ext' data.\n     * The 'ext' value is sent as an additional key-value pair for beans, with the\n     * 'ext' as the key and 'nil' as the value. Where the additional type information\n     * is not about a bean, a tuple is written using a size 1 map where the key is the\n     * 'ext' data and the value is the data being annotated.\n     * <p>\n     * Type names are shortened by the package of the root type if possible.\n     * Certain basic types are also handled, such as String, Integer, File and URI.\n     */\n    STANDARD(1),\n    /**\n     * The Referencing format, version 2.\n     * <p>\n     * The referencing format is based on the standard format.\n     * As a more complex format, it is intended to be consumed only by Joda-Beans\n     * (whereas the standard format could be consumed by any consumer using MsgPack).\n     * Thus this format is not fully documented and may change over time.\n     * <p>\n     * The referencing format only supports serialization of instances of {@code ImmutableBean}\n     * and other basic types. If any mutable beans are encountered during traversal an exception will be thrown.\n     * <p>\n     * An initial pass of the bean is used to build up a map of unique immutable beans\n     * and unique immutable instances of other classes (based on an equality check).\n     * Then the class and property names for each bean class is serialized up front as a map of class name to list of\n     * property names, along with class information for any class where type information would be required when parsing\n     * and is not available on the metabean for the enclosing bean object.\n     * <p>\n     * Each unique immutable bean is output as a list of each property value using the fixed\n     * property order previously serialized. Subsequent instances of unique objects (defined by an\n     * equality check) are replaced by references to the first serialized instance.\n     * <p>\n     * The Java type names are sent using an 'ext' entity.\n     * Five 'ext' types are used, one each for beans, meta-type and simple, reference keys and reference lookups.\n     * The class name is passed as the 'ext' data.\n     * The 'ext' value is sent as the first item in an array of property values for beans, an integer referring to the\n     * location in the initial class mapping.\n     * Where the additional type information is not about a bean, a tuple is written using a size 1 map where the key is\n     * the 'ext' data and the value is the data being annotated.\n     * <p>\n     * For references, when an object will be referred back to it is written as a map of size one with 'ext' as the key\n     * and the object that should be referred to as the value.\n     * When that same object is referred back to it is written as 'ext' with the data from the initial 'ext'.\n     */\n    REFERENCING(2),\n    /**\n     * Packed format, version 3.\n     * <p>\n     * This format uses a structure called BeanPack that is similar to MessagePack, but distinctly different.\n     * The exact format is not specified and may change over time.\n     * Types, bean definitions and Joda-Convert values are captured the first time they are found and then used by reference.\n     * In addition, {@link JodaBeanSer#getBeanValueClasses()} is taken into account, with instances of the specified\n     * value classes being deduplicated in the binary form. (Types and values are deduplicated automatically, beans\n     * are only deduplicated as per {@code JodaBeanSer.getBeanValueClasses()}).\n     */\n    PACKED(3);\n\n    /**\n     * The format version.\n     */\n    private final int version;\n\n    private JodaBeanBinFormat(int version) {\n        this.version = version;\n    }\n\n    /**\n     * Returns the version number used to identify the format in the file.\n     * \n     * @return the version\n     */\n    public int version() {\n        return version;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/JodaBeanBinReader.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.DataInputStream;\nimport java.io.InputStream;\nimport java.util.Objects;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ser.JodaBeanSer;\n\n/**\n * Provides the ability for a Joda-Bean to read from binary formats.\n * <p>\n * This class is immutable and may be used from multiple threads.\n * <p>\n * The binary formats are defined by {@link JodaBeanBinWriter}.\n */\npublic class JodaBeanBinReader extends MsgPack {\n\n    /**\n     * Settings.\n     */\n    private final JodaBeanSer settings;\n\n    //-----------------------------------------------------------------------\n    /**\n     * Visualizes the binary data.\n     * \n     * @param input  the input bytes, not null\n     * @return the visualization\n     */\n    public static String visualize(byte[] input) {\n        if (input.length >= 2 && input[1] == 3) {\n            return new BeanPackVisualizer(input).visualizeData();\n        }\n        return new MsgPackVisualizer(input).visualizeData();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings, not null\n     */\n    public JodaBeanBinReader(JodaBeanSer settings) {\n        this.settings = Objects.requireNonNull(settings, \"settings must not be null\");\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Reads and parses to a bean.\n     * \n     * @param input  the input bytes, not null\n     * @return the bean, not null\n     */\n    public Bean read(byte[] input) {\n        return read(input, Bean.class);\n    }\n\n    /**\n     * Reads and parses to a bean.\n     * \n     * @param <T>  the root type\n     * @param input  the input bytes, not null\n     * @param rootType  the root type, not null\n     * @return the bean, not null\n     */\n    public <T> T read(byte[] input, Class<T> rootType) {\n        Objects.requireNonNull(input, \"input must not be null\");\n        return read(new ByteArrayInputStream(input), rootType);\n    }\n\n    /**\n     * Reads and parses to a bean.\n     * \n     * @param input  the input reader, not null\n     * @return the bean, not null\n     */\n    public Bean read(InputStream input) {\n        return read(input, Bean.class);\n    }\n\n    /**\n     * Reads and parses to a bean.\n     * <p>\n     * Unusually for a method of this type, it closes the input stream.\n     * \n     * @param <T>  the root type\n     * @param input  the input stream, not null\n     * @param rootType  the root type, not null\n     * @return the bean, not null\n     */\n    public <T> T read(InputStream input, Class<T> rootType) {\n        Objects.requireNonNull(input, \"input must not be null\");\n        Objects.requireNonNull(rootType, \"rootType must not be null\");\n        try {\n            try (input) {\n                var dataInput = input instanceof DataInputStream din ?\n                        din :\n                        new DataInputStream(input);\n                return parseVersion(dataInput, rootType);\n            }\n        } catch (RuntimeException ex) {\n            throw ex;\n        } catch (Exception ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    // parses the version\n    private <T> T parseVersion(DataInputStream input, Class<T> declaredType) throws Exception {\n        // root array\n        int arrayByte = input.readByte();\n        int versionByte = input.readByte();\n        switch (versionByte) {\n            case 1:\n                if (arrayByte != MIN_FIX_ARRAY + 2) {\n                    throw new IllegalArgumentException(\n                            \"Invalid binary data: Expected array with 2 elements, but was: 0x\" + toHex(arrayByte));\n                }\n                return new JodaBeanStandardBinReader(settings, input).read(declaredType);\n            case 2:\n                if (arrayByte != MIN_FIX_ARRAY + 4) {\n                    throw new IllegalArgumentException(\n                            \"Invalid binary data: Expected array with 4 elements, but was: 0x\" + toHex(arrayByte));\n                }\n                return new JodaBeanReferencingBinReader(settings, input).read(declaredType);\n            case 3:\n                if (arrayByte != MIN_FIX_ARRAY + 3) {\n                    throw new IllegalArgumentException(\n                            \"Invalid binary data: Expected array with 3 elements, but was: 0x\" + toHex(arrayByte));\n                }\n                return new JodaBeanPackedBinReader(settings, input).read(declaredType);\n            default:\n                throw new IllegalArgumentException(\n                        \"Invalid binary data: Expected version 1, 2 or 3, but was: 0x\" + toHex(versionByte));\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/JodaBeanBinWriter.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport static org.joda.beans.ser.bin.JodaBeanBinFormat.REFERENCING;\nimport static org.joda.beans.ser.bin.JodaBeanBinFormat.STANDARD;\n\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.util.Objects;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.LinkedByteArrayOutputStream;\n\n/**\n * Provides the ability for a Joda-Bean to be written to a binary format.\n * <p>\n * This class is immutable and may be used from multiple threads.\n * <p>\n * See {@link JodaBeanBinFormat} for details on each file format.\n */\npublic class JodaBeanBinWriter {\n\n    /**\n     * Settings.\n     */\n    private final JodaBeanSer settings;\n    /**\n     * The format.\n     */\n    private final JodaBeanBinFormat format;\n\n    //-----------------------------------------------------------------------\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings to use, not null\n     */\n    public JodaBeanBinWriter(JodaBeanSer settings) {\n        this(settings, STANDARD);\n    }\n\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings to use, not null\n     * @param referencing  whether to use referencing\n     * @deprecated Use the format instead of the boolean flag\n     */\n    @Deprecated\n    public JodaBeanBinWriter(JodaBeanSer settings, boolean referencing) {\n        this.settings = Objects.requireNonNull(settings, \"settings must not be null\");\n        this.format = referencing ? REFERENCING : STANDARD;\n    }\n\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings to use, not null\n     * @param format  the format, not null\n     * @since 3.0.0\n     */\n    public JodaBeanBinWriter(JodaBeanSer settings, JodaBeanBinFormat format) {\n        this.settings = Objects.requireNonNull(settings, \"settings must not be null\");\n        this.format = Objects.requireNonNull(format, \"format must not be null\");\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Writes the bean to an array of bytes.\n     * <p>\n     * The type of the bean will be set in the message.\n     * \n     * @param bean  the bean to output, not null\n     * @return the binary data, not null\n     */\n    public byte[] write(Bean bean) {\n        return write(bean, true);\n    }\n\n    /**\n     * Writes the bean to an array of bytes.\n     * \n     * @param bean  the bean to output, not null\n     * @param rootType  true to output the root type\n     * @return the binary data, not null\n     */\n    public byte[] write(Bean bean, boolean rootType) {\n        var baos = new LinkedByteArrayOutputStream();\n        try {\n            write(bean, rootType, baos);\n        } catch (IOException ex) {\n            throw new IllegalStateException(ex);\n        }\n        return baos.toByteArray();\n    }\n\n    /**\n     * Writes the bean to the {@code OutputStream}.\n     * <p>\n     * The type of the bean will be set in the message.\n     * \n     * @param bean  the bean to output, not null\n     * @param output  the output stream, not null\n     * @throws IOException if an error occurs\n     */\n    public void write(Bean bean, OutputStream output) throws IOException {\n        write(bean, true, output);\n    }\n\n    /**\n     * Writes the bean to the {@code OutputStream}.\n     * \n     * @param bean  the bean to output, not null\n     * @param includeRootType  true to output the root type\n     * @param output  the output stream, not null\n     * @throws IOException if an error occurs\n     */\n    public void write(Bean bean, boolean includeRootType, OutputStream output) throws IOException {\n        Objects.requireNonNull(bean, \"bean must not be null\");\n        Objects.requireNonNull(output, \"output must not be null\");\n        switch (format) {\n            case STANDARD -> new JodaBeanStandardBinWriter(settings, output).write(bean, includeRootType);\n            case REFERENCING -> new JodaBeanReferencingBinWriter(settings, output).write(bean);\n            case PACKED -> new JodaBeanPackedBinWriter(settings, output).write(bean, includeRootType);\n            default -> throw new IllegalArgumentException(\"Invalid bin format, must be Standard, Referencing or Packed\");\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/JodaBeanPackedBinReader.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.io.DataInputStream;\nimport java.io.IOException;\nimport java.lang.reflect.Array;\nimport java.time.Duration;\nimport java.time.Instant;\nimport java.time.LocalDate;\nimport java.time.LocalTime;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.IdentityHashMap;\nimport java.util.LinkedHashMap;\nimport java.util.LinkedHashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.Set;\nimport java.util.SortedMap;\nimport java.util.SortedSet;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.ResolvedType;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerTypeMapper;\nimport org.joda.collect.grid.DenseGrid;\nimport org.joda.collect.grid.Grid;\nimport org.joda.collect.grid.ImmutableGrid;\nimport org.joda.collect.grid.SparseGrid;\n\nimport com.google.common.collect.ArrayListMultimap;\nimport com.google.common.collect.BiMap;\nimport com.google.common.collect.HashBasedTable;\nimport com.google.common.collect.HashBiMap;\nimport com.google.common.collect.HashMultimap;\nimport com.google.common.collect.HashMultiset;\nimport com.google.common.collect.ImmutableCollection;\nimport com.google.common.collect.ImmutableList;\nimport com.google.common.collect.ImmutableMap;\nimport com.google.common.collect.ImmutableMultiset;\nimport com.google.common.collect.ImmutableSet;\nimport com.google.common.collect.ListMultimap;\nimport com.google.common.collect.Multimap;\nimport com.google.common.collect.Multiset;\nimport com.google.common.collect.SetMultimap;\nimport com.google.common.collect.SortedMultiset;\nimport com.google.common.collect.Table;\nimport com.google.common.collect.TreeMultiset;\n\n/**\n * Reads the Joda-Bean BeanPack binary format with strings deduplicated by reference.\n * <p>\n * This class contains mutable state and cannot be used from multiple threads.\n * A new instance must be created for each message.\n */\nfinal class JodaBeanPackedBinReader extends BeanPack {\n\n    /**\n     * The resolved type for {@code Map<Object, Object>}.\n     */\n    private static final ResolvedType MAP_TYPE = ResolvedType.ofFlat(Map.class, Object.class, Object.class);\n    /**\n     * The resolved type for {@code List<Object>}.\n     */\n    private static final ResolvedType LIST_TYPE = ResolvedType.ofFlat(List.class, Object.class);\n\n    // why is there an ugly ClassValue setup here?\n    // because this is O(1) whereas switch with pattern match which is O(n)\n    private static final ClassValue<BinHandler> LOOKUP = new ClassValue<>() {\n\n        @Override\n        protected BinHandler computeValue(Class<?> type) {\n            return BaseBinHandlers.INSTANCE.createHandler(type);\n        }\n    };\n    /**\n     * Map of array types.\n     */\n    private static final Map<String, Class<?>> ARRAY_TYPE_NAME_MAP = new HashMap<>();\n    static {\n        ARRAY_TYPE_NAME_MAP.put(\"Object[]\", Object[].class);\n        ARRAY_TYPE_NAME_MAP.put(\"String[]\", String[].class);\n        ARRAY_TYPE_NAME_MAP.put(\"boolean[]\", boolean[].class);\n        ARRAY_TYPE_NAME_MAP.put(\"char[]\", char[].class);\n        ARRAY_TYPE_NAME_MAP.put(\"byte[]\", byte[].class);\n        ARRAY_TYPE_NAME_MAP.put(\"short[]\", short[].class);\n        ARRAY_TYPE_NAME_MAP.put(\"int[]\", int[].class);\n        ARRAY_TYPE_NAME_MAP.put(\"long[]\", long[].class);\n        ARRAY_TYPE_NAME_MAP.put(\"float[]\", float[].class);\n        ARRAY_TYPE_NAME_MAP.put(\"double[]\", double[].class);\n    }\n\n    /**\n     * Settings.\n     */\n    final JodaBeanSer settings;  // CSIGNORE\n    /**\n     * The reader.\n     */\n    final DataInputStream input;  // CSIGNORE\n    /**\n     * The base package including the trailing dot.\n     */\n    private String basePackage;\n    /**\n     * The known types.\n     */\n    private final Map<String, Class<?>> knownTypes = new HashMap<>();\n    /**\n     * The type definitions.\n     */\n    private final List<ResolvedType> typeDefinitions = new ArrayList<>();\n    /**\n     * The bean definitions.\n     */\n    private final Map<Class<?>, List<MetaProperty<?>>> beanDefinitions = new IdentityHashMap<>();\n    /**\n     * The value definitions.\n     */\n    private final List<Object> valueDefinitions = new ArrayList<>();\n\n    //-----------------------------------------------------------------------\n    // creates an instance\n    JodaBeanPackedBinReader(JodaBeanSer settings, DataInputStream input) {\n        this.settings = settings;\n        this.input = input;\n    }\n\n    //-----------------------------------------------------------------------\n    // reads the input stream where the array and version bytes have been read already\n    <T> T read(Class<T> rootType) {\n        try {\n            try {\n                return parseRemaining(rootType);\n            } finally {\n                input.close();\n            }\n        } catch (RuntimeException ex) {\n            throw ex;\n        } catch (Exception ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    <T> T parseRemaining(Class<T> declaredType) throws Exception {\n        // the array and version has already been read\n        basePackage = acceptStringOrNull();\n        var parsed = parseObject(ResolvedType.from(declaredType));\n        return declaredType.cast(parsed);\n    }\n\n    //-------------------------------------------------------------------------\n    // parses an object, determining how to parse based on the input data\n    Object parseObject(ResolvedType declaredType) throws IOException {\n        var typeByte = input.readByte();\n\n        // parse the type code\n        return switch (typeByte) {\n            case MIN_FIX_MAP -> parseMap(0, declaredType);\n            case MIN_FIX_MAP + 1 -> parseMap(1, declaredType);\n            case MIN_FIX_MAP + 2 -> parseMap(2, declaredType);\n            case MIN_FIX_MAP + 3 -> parseMap(3, declaredType);\n            case MIN_FIX_MAP + 4 -> parseMap(4, declaredType);\n            case MIN_FIX_MAP + 5 -> parseMap(5, declaredType);\n            case MIN_FIX_MAP + 6 -> parseMap(6, declaredType);\n            case MIN_FIX_MAP + 7 -> parseMap(7, declaredType);\n            case MIN_FIX_MAP + 8 -> parseMap(8, declaredType);\n            case MIN_FIX_MAP + 9 -> parseMap(9, declaredType);\n            case MIN_FIX_MAP + 10 -> parseMap(10, declaredType);\n            case MIN_FIX_MAP + 11 -> parseMap(11, declaredType);\n            case MIN_FIX_MAP + 12 -> parseMap(12, declaredType);\n            case MAP_8 -> parseMap(input.readUnsignedByte(), declaredType);\n            case MAP_16 -> parseMap(input.readUnsignedShort(), declaredType);\n            case MAP_32 -> parseMap(input.readInt(), declaredType);\n            case MIN_FIX_ARRAY -> parseArray(0, declaredType);\n            case MIN_FIX_ARRAY + 1 -> parseArray(1, declaredType);\n            case MIN_FIX_ARRAY + 2 -> parseArray(2, declaredType);\n            case MIN_FIX_ARRAY + 3 -> parseArray(3, declaredType);\n            case MIN_FIX_ARRAY + 4 -> parseArray(4, declaredType);\n            case MIN_FIX_ARRAY + 5 -> parseArray(5, declaredType);\n            case MIN_FIX_ARRAY + 6 -> parseArray(6, declaredType);\n            case MIN_FIX_ARRAY + 7 -> parseArray(7, declaredType);\n            case MIN_FIX_ARRAY + 8 -> parseArray(8, declaredType);\n            case MIN_FIX_ARRAY + 9 -> parseArray(9, declaredType);\n            case MIN_FIX_ARRAY + 10 -> parseArray(10, declaredType);\n            case MIN_FIX_ARRAY + 11 -> parseArray(11, declaredType);\n            case MIN_FIX_ARRAY + 12 -> parseArray(12, declaredType);\n            case ARRAY_8 -> parseArray(input.readUnsignedByte(), declaredType);\n            case ARRAY_16 -> parseArray(input.readUnsignedShort(), declaredType);\n            case ARRAY_32 -> parseArray(input.readInt(), declaredType);\n            case STR_8 -> parseString(input.readUnsignedByte(), declaredType);\n            case STR_16 -> parseString(input.readUnsignedShort(), declaredType);\n            case STR_32 -> parseString(input.readInt(), declaredType);\n            case NULL -> null;\n            case FALSE -> false;\n            case TRUE -> true;\n            case UNUSED -> parseUnknown();\n            case FLOAT_32 -> input.readFloat();\n            case DOUBLE_INT_8 -> (double) input.readByte();\n            case DOUBLE_64 -> input.readDouble();\n            case CHAR_16 -> input.readChar();\n            case BYTE_8 -> parseByte(input.readByte(), declaredType);\n            case SHORT_16 -> parseShort(input.readShort(), declaredType);\n            case INT_16 -> parseInt(input.readShort(), declaredType);\n            case INT_32 -> parseInt(input.readInt(), declaredType);\n            case LONG_8 -> parseLong(input.readByte(), declaredType);\n            case LONG_16 -> parseLong(input.readShort(), declaredType);\n            case LONG_32 -> parseLong(input.readInt(), declaredType);\n            case LONG_64 -> parseLong(input.readLong(), declaredType);\n            case DATE_PACKED -> parseDatePacked();\n            case DATE -> parseDate();\n            case TIME -> parseTime();\n            case INSTANT -> parseInstant();\n            case DURATION -> parseDuration();\n            case BIN_8 -> parseByteArray(input.readUnsignedByte());\n            case BIN_16 -> parseByteArray(input.readUnsignedShort());\n            case BIN_32 -> parseByteArray(input.readInt());\n            case DOUBLE_ARRAY_8 -> parseDoubleArray(input.readUnsignedByte());\n            case DOUBLE_ARRAY_16 -> parseDoubleArray(input.readUnsignedShort());\n            case DOUBLE_ARRAY_32 -> parseDoubleArray(input.readInt());\n            case TYPE_DEFN_8 -> parseTypeDefinition(input.readUnsignedByte());\n            case TYPE_DEFN_16 -> parseTypeDefinition(input.readUnsignedShort());\n            case TYPE_REF_8 -> parseTypeRef(input.readByte(), declaredType);\n            case TYPE_REF_16 -> parseTypeRef(input.readUnsignedShort(), declaredType);\n            case BEAN_DEFN -> parseBeanDefinition(input.readUnsignedByte(), declaredType);\n            case VALUE_DEFN -> parseValueDefinition(declaredType);\n            case VALUE_REF_8 -> parseValueRef(input.readUnsignedByte(), declaredType);\n            case VALUE_REF_16 -> parseValueRef(input.readUnsignedShort(), declaredType);\n            case VALUE_REF_24 -> parseValueRef((input.readUnsignedByte() << 16) + input.readUnsignedShort(), declaredType);\n            default -> typeByte < MIN_FIX_INT ?\n                    parseString(typeByte - MIN_FIX_STR, declaredType) :\n                    parseInt(typeByte, declaredType);\n        };\n    }\n\n    //-------------------------------------------------------------------------\n    // parse a BeanPack map\n    private Object parseMap(int size, ResolvedType declaredType) throws IOException {\n        var rawType = declaredType.getRawType();\n        if (Bean.class.isAssignableFrom(rawType)) {\n            return parseMapAsBean(size, rawType, false);\n        } else {\n            return parseViaHandler(size, rawType == Object.class ? MAP_TYPE : declaredType);\n        }\n    }\n\n    // parse a BeanPack array\n    private Object parseArray(int size, ResolvedType declaredType) throws IOException {\n        var rawType = declaredType.getRawType();\n        if (Bean.class.isAssignableFrom(rawType)) {\n            return parseArrayAsBean(size, rawType);\n        } else {\n            return parseViaHandler(size, rawType == Object.class ? LIST_TYPE : declaredType);\n        }\n    }\n\n    // parse a BeanPack map as a Map/Array\n    private Object parseViaHandler(int size, ResolvedType declaredType) throws IOException {\n        var handler = LOOKUP.get(declaredType.getRawType());\n        return handler.handle(this, declaredType, size);\n    }\n\n    //-------------------------------------------------------------------------\n    // parse a BeanPack string\n    private Object parseString(int strLen, ResolvedType declaredType) throws IOException {\n        var str = acceptStringBytes(strLen);\n        return interpretString(str, declaredType);\n    }\n\n    private Object interpretString(String str, ResolvedType declaredType) {\n        if (declaredType.getRawType().isAssignableFrom(String.class)) {\n            return str;\n        } else {\n            // Joda-Convert\n            return settings.getConverter().convertFromString(declaredType.getRawType(), str);\n        }\n    }\n\n    private Object parseUnknown() {\n        throw new IllegalArgumentException(\"Invalid binary data: Unknown type byte\");\n    }\n\n    //-------------------------------------------------------------------------\n    // parse the type name, validate it, store it in the type cache and parse the actual value\n    private Object parseTypeDefinition(int size) throws IOException {\n        // manually parse, as separate from the value definition\n        var bytes = new byte[size];\n        input.readFully(bytes);\n        var typeName = new String(bytes, UTF_8);\n        // interpret the type, which is always a Class (not a ResolvedType)\n        Class<?> decodedType = decodeTypeName(typeName);\n        var effectiveType = ResolvedType.of(decodedType);\n        typeDefinitions.add(effectiveType);\n        return parseObject(effectiveType);\n    }\n\n    private Class<?> decodeTypeName(String typeName) {\n        try {\n            if (typeName.endsWith(\"[]\")) {\n                return decodeArrayTypeName(typeName);\n            } else {\n                return settings.getDeserializers().decodeType(typeName, settings, basePackage, knownTypes, Object.class);\n            }\n        } catch (ClassNotFoundException ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    // finds the array type from a string like int[] or Foo[][]\n    private Class<?> decodeArrayTypeName(String typeName) throws ClassNotFoundException {\n        var type = ARRAY_TYPE_NAME_MAP.get(typeName);\n        if (type != null) {\n            return type;\n        }\n        var clsStr = typeName.substring(0, typeName.length() - 2);\n        if (clsStr.endsWith(\"[]\")) {\n            return decodeArrayTypeName(clsStr).arrayType();\n        }\n        return SerTypeMapper.decodeType(clsStr, settings, null, knownTypes).arrayType();\n    }\n\n    // parse the int reference, negative for type codes and positive for user types\n    private Object parseTypeRef(int ref, ResolvedType declaredType) throws IOException {\n        if (ref < 0) {\n            var rawEffectiveType = BaseBinHandlers.INSTANCE.classForTypeCode(ref);\n            var effectiveType = ResolvedType.of(rawEffectiveType);\n            return parseObject(effectiveType);\n        } else {\n            var effectiveType = typeDefinitions.get(ref);\n            return parseObject(effectiveType);\n        }\n    }\n\n    // parse the actual bean, passing down a flag so that the meta-properties are stored in the bean cache\n    private Object parseBeanDefinition(int propertyCount, ResolvedType declaredType) throws IOException {\n        // when written, the bean definition is always preceded by a type definition/ref\n        var beanType = declaredType.getRawType();\n        if (!Bean.class.isAssignableFrom(beanType)) {\n            throw new IllegalArgumentException(\"Invalid binary data: Expected bean, but found \" + declaredType);\n        }\n        // parse the meta-property names first\n        var deser = settings.getDeserializers().findDeserializer(beanType);\n        var metaBean = deser.findMetaBean(beanType);\n        var metaProperties = new ArrayList<MetaProperty<?>>(propertyCount);\n        for (var i = 0; i < propertyCount; i++) {\n            var propName = acceptString();\n            var metaProp = deser.findMetaProperty(beanType, metaBean, propName);\n            if (metaProp == null || !settings.isSerialized(metaProp)) {\n                metaProperties.add(null);  // message contains a property that is no longer in the bean\n            } else {\n                metaProperties.add(metaProp);\n            }\n        }\n        beanDefinitions.put(beanType, metaProperties);\n        // now the meta-property names are stored, we can parse the bean values\n        var propName = \"\";\n        try {\n            var builder = deser.createBuilder(beanType, metaBean);\n            for (var i = 0; i < propertyCount; i++) {\n                var metaProp = metaProperties.get(i);\n                if (metaProp == null) {\n                    propName = \"<skipped>\";\n                    skipObject();\n                } else {\n                    propName = metaProp.name();\n                    var value = parseObject(metaProp.propertyResolvedType(beanType));\n                    deser.setValue(builder, metaProp, value);\n                }\n            }\n            propName = \"<init>\";\n            return deser.build(beanType, builder);\n        } catch (IOException ex) {\n            throw ex;\n        } catch (Exception ex) {\n            throw invalidBean(beanType, propName, ex);\n        }\n    }\n\n    // parse the actual value, store it in the value cache, and return the value\n    private Object parseValueDefinition(ResolvedType declaredType) throws IOException {\n        var obj = parseObject(declaredType);\n        valueDefinitions.add(obj);\n        return obj;\n    }\n\n    // obtain the value reference, query the value cache, and return the value\n    private Object parseValueRef(int ref, ResolvedType declaredType) throws IOException {\n        var value = valueDefinitions.get(ref);\n        if (value instanceof String str) {\n            return interpretString(str, declaredType);\n        } else if (value != null) {\n            return value;\n        } else {\n            throw new IllegalArgumentException(\"Invalid binary data: Referenced value not found: ref \" + ref);\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    // parse a BeanPack map that has been identified as a bean\n    private Object parseMapAsBean(int mapSize, Class<?> beanType, boolean isDefinition) throws IOException {\n        var propName = \"\";\n        try {\n            var deser = settings.getDeserializers().findDeserializer(beanType);\n            var metaBean = deser.findMetaBean(beanType);\n            var builder = deser.createBuilder(beanType, metaBean);\n            var metaProperties = new ArrayList<MetaProperty<?>>(mapSize);\n            for (var i = 0; i < mapSize; i++) {\n                propName = acceptString();\n                var metaProp = deser.findMetaProperty(beanType, metaBean, propName);\n                if (metaProp == null || metaProp.style().isDerived()) {\n                    skipObject();\n                    metaProperties.add(null);\n                } else {\n                    var value = parseObject(metaProp.propertyResolvedType(beanType));\n                    deser.setValue(builder, metaProp, value);\n                    metaProperties.add(metaProp);\n                }\n            }\n            if (isDefinition) {\n                beanDefinitions.put(beanType, metaProperties);\n            }\n            propName = \"<init>\";\n            return deser.build(beanType, builder);\n        } catch (IOException ex) {\n            throw ex;\n        } catch (Exception ex) {\n            throw invalidBean(beanType, propName, ex);\n        }\n    }\n\n    // parse a BeanPack array that has been identified as a bean (by reference)\n    private Object parseArrayAsBean(int arraySize, Class<?> beanType) throws IOException {\n        var propName = \"\";\n        try {\n            var deser = settings.getDeserializers().findDeserializer(beanType);\n            var metaBean = deser.findMetaBean(beanType);\n            var builder = deser.createBuilder(beanType, metaBean);\n            var metaProperties = beanDefinitions.get(beanType);\n            if (metaProperties == null) {\n                throw invalidBeanRef(beanType);\n            }\n            if (metaProperties.size() != arraySize) {\n                throw invalidBeanRefSize(beanType);\n            }\n            for (var i = 0; i < arraySize; i++) {\n                var metaProp = metaProperties.get(i);\n                if (metaProp == null) {\n                    propName = \"<skipped>\";\n                    skipObject();\n                } else {\n                    propName = metaProp.name();\n                    var value = parseObject(metaProp.propertyResolvedType(beanType));\n                    deser.setValue(builder, metaProp, value);\n                }\n            }\n            propName = \"<init>\";\n            return deser.build(beanType, builder);\n        } catch (IOException ex) {\n            throw ex;\n        } catch (Exception ex) {\n            throw invalidBean(beanType, propName, ex);\n        }\n    }\n\n    private IllegalArgumentException invalidBeanRef(Class<?> beanType) {\n        return new IllegalArgumentException(\n                \"Invalid binary data: Referenced bean not found: \" + beanType.getName());\n    }\n\n    private IllegalArgumentException invalidBeanRefSize(Class<?> beanType) {\n        return new IllegalArgumentException(\n                \"Invalid binary data: Referenced bean had different number of properties: \" + beanType.getName());\n    }\n\n    private RuntimeException invalidBean(Class<?> beanType, String propName, Exception ex) {\n        return new RuntimeException(\"Error parsing bean: \" + beanType.getName() + \"::\" + propName + \", \" + ex.getMessage(), ex);\n    }\n\n    //-------------------------------------------------------------------------\n    // parse a byte, allowing conversion to other number types\n    private Object parseByte(byte value, ResolvedType declaredType) {\n        var desiredType = declaredType.getRawType();\n        if (desiredType == byte.class || desiredType == Byte.class) {\n            return value;\n        } else {\n            return parseLongWithConversion(value, value, desiredType);\n        }\n    }\n\n    // parse a short, allowing conversion to other number types\n    private Object parseShort(short value, ResolvedType declaredType) {\n        var desiredType = declaredType.getRawType();\n        if (desiredType == short.class || desiredType == Short.class) {\n            return value;\n        } else {\n            return parseLongWithConversion(value, value, desiredType);\n        }\n    }\n\n    // parse an int, allowing conversion to other number types\n    private Object parseInt(int value, ResolvedType declaredType) {\n        var desiredType = declaredType.getRawType();\n        if (desiredType == int.class || desiredType == Integer.class) {\n            return value;\n        } else {\n            return parseLongWithConversion(value, value, desiredType);\n        }\n    }\n\n    // parse a long, allowing conversion to other number types\n    private Object parseLong(long value, ResolvedType declaredType) {\n        var desiredType = declaredType.getRawType();\n        if (desiredType == long.class || desiredType == Long.class) {\n            return value;\n        } else {\n            return parseLongWithConversion(value, value, desiredType);\n        }\n    }\n\n    // convert the value that we have been given to the desired type\n    private Object parseLongWithConversion(long value, Number defaultValue, Class<?> desiredType) {\n        if (desiredType == Object.class || desiredType == Number.class) {\n            return defaultValue;\n        } else if (desiredType == Long.class || desiredType == long.class) {\n            return value;\n        } else if (desiredType == Integer.class || desiredType == int.class) {\n            if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) {\n                throw new IllegalArgumentException(\"Invalid binary data: Expected int, but was \" + value);\n            }\n            return Integer.valueOf((int) value);\n        } else if (desiredType == Double.class || desiredType == double.class) {\n            return Double.valueOf(value);\n        } else if (desiredType == Float.class || desiredType == float.class) {\n            return Float.valueOf(value);\n        } else if (desiredType == Short.class || desiredType == short.class) {\n            if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) {\n                throw new IllegalArgumentException(\"Invalid binary data: Expected short, but was \" + value);\n            }\n            return Short.valueOf((short) value);\n        } else if (desiredType == Byte.class || desiredType == byte.class) {\n            if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) {\n                throw new IllegalArgumentException(\"Invalid binary data: Expected byte, but was \" + value);\n            }\n            return Byte.valueOf((byte) value);\n        }\n        return defaultValue;  // will probably throw an exception in the calling code\n    }\n\n    //-------------------------------------------------------------------------\n    private LocalDate parseDatePacked() throws IOException {\n        var packed = input.readUnsignedShort();\n        var dom = packed & 31;\n        var ym = packed >> 5;\n        return LocalDate.of((ym / 12) + 2000, (ym % 12) + 1, dom);\n    }\n\n    private LocalDate parseDate() throws IOException {\n        var upper = input.readInt();\n        var lower = input.readUnsignedByte();\n        var year = upper >> 1;\n        var month = ((upper & 1) << 3) + (lower >>> 5);\n        var dom = lower & 31;\n        return LocalDate.of(year, month, dom);\n    }\n\n    private LocalTime parseTime() throws IOException {\n        var upper = input.readShort();\n        var lower = Integer.toUnsignedLong(input.readInt());\n        var nod = ((long) upper << 32) + lower;\n        return LocalTime.ofNanoOfDay(nod);\n    }\n\n    private Instant parseInstant() throws IOException {\n        var second = input.readLong();\n        var nanos = input.readInt();\n        return Instant.ofEpochSecond(second, nanos);\n    }\n\n    private Duration parseDuration() throws IOException {\n        var seconds = input.readLong();\n        var nanos = input.readInt();\n        return Duration.ofSeconds(seconds, nanos);\n    }\n\n    //-----------------------------------------------------------------------\n    private byte[] parseByteArray(int size) throws IOException {\n        var bytes = new byte[size];\n        input.readFully(bytes);\n        return bytes;\n    }\n\n    private double[] parseDoubleArray(int size) throws IOException {\n        var values = new double[size];\n        for (int i = 0; i < size; i++) {\n            values[i] = input.readDouble();\n        }\n        return values;\n    }\n\n    //-------------------------------------------------------------------------\n    private void skipObject() throws IOException {\n        // The only things we care about here are type definitions, bean definition and value definitions.\n        // Type definitions contain the class name, allowing normal parsing to resume.\n        // Bean definitions are always written preceded by a class name, which is sufficient to read the definition.\n        // Value definitions are always written preceded by a class name, which is sufficient to read the definition.\n        //\n        // Each bean acts as a point of separation, where the resolved type is deliberately dropped.\n        // As such, a meta-property holding a generic bean will only use the raw form of the bean for typing.\n        //\n        // A collection is held either in a property, in which case the type is obtained via the property\n        // or it is held in Object/Serializable, in which case no type information is available.\n        // No collection-like class has a generified superclass that is not handled, thus there are no gaps in the type knowledge.\n        parseObject(ResolvedType.OBJECT);\n    }\n\n    private String acceptString() throws IOException {\n        return acceptString(input.readByte());\n    }\n\n    private String acceptStringOrNull() throws IOException {\n        var typeByte = input.readByte();\n        return typeByte == NULL ? null : acceptString(typeByte);\n    }\n\n    private String acceptString(int typeByte) throws IOException {\n        int size;\n        if (typeByte == VALUE_REF_8) {\n            return parseValueRef(input.readUnsignedByte(), ResolvedType.STRING).toString();\n        } else if (typeByte == VALUE_REF_16) {\n            return parseValueRef(input.readUnsignedShort(), ResolvedType.STRING).toString();\n        } else if (typeByte == VALUE_REF_24) {\n            return parseValueRef(input.readUnsignedByte() << 16 + input.readUnsignedShort(), ResolvedType.STRING).toString();\n        } else if (typeByte >= MIN_FIX_STR && typeByte <= MAX_FIX_STR) {\n            size = typeByte - MIN_FIX_STR;\n        } else if (typeByte == STR_8) {\n            size = input.readUnsignedByte();\n        } else if (typeByte == STR_16) {\n            size = input.readUnsignedShort();\n        } else if (typeByte == STR_32) {\n            size = input.readInt();\n        } else {\n            throw invalidBinaryData(\"string\", typeByte);\n        }\n        return acceptStringBytes(size);\n    }\n\n    private String acceptStringBytes(int size) throws IOException {\n        var bytes = new byte[size];\n        input.readFully(bytes);\n        // inline common ASCII case for much better performance\n        var chars = new char[size];\n        for (var i = 0; i < size; i++) {\n            var b = bytes[i];\n            if (b >= 0) {\n                chars[i] = (char) b;\n            } else {\n                return new String(bytes, UTF_8);\n            }\n        }\n        var str = new String(chars);\n        if (str.length() >= JodaBeanPackedBinWriter.MIN_LENGTH_STR_VALUE) {\n            valueDefinitions.add(str);\n        }\n        return str;\n    }\n\n    private int acceptInt() throws IOException {\n        var typeByte = input.readByte();\n        if (typeByte >= MIN_FIX_INT && typeByte <= MAX_FIX_INT) {\n            return typeByte;\n        }\n        return switch (typeByte) {\n            case INT_16 -> input.readShort();\n            case INT_32 -> input.readInt();\n            default -> throw invalidBinaryData(\"int\", typeByte);\n        };\n    }\n\n    private int acceptMap() throws IOException {\n        var typeByte = input.readByte();\n        if (typeByte >= MIN_FIX_MAP && typeByte <= MAX_FIX_MAP) {\n            return typeByte - MIN_FIX_MAP;\n        }\n        return switch (typeByte) {\n            case MAP_8 -> input.readByte();\n            case MAP_16 -> input.readShort();\n            case MAP_32 -> input.readInt();\n            default -> throw invalidBinaryData(\"map\", typeByte);\n        };\n    }\n\n    private int acceptArray() throws IOException {\n        var typeByte = input.readByte();\n        if (typeByte >= MIN_FIX_ARRAY && typeByte <= MAX_FIX_ARRAY) {\n            return typeByte - MIN_FIX_ARRAY;\n        }\n        return switch (typeByte) {\n            case ARRAY_8 -> input.readByte();\n            case ARRAY_16 -> input.readShort();\n            case ARRAY_32 -> input.readInt();\n            default -> throw invalidBinaryData(\"array\", typeByte);\n        };\n    }\n\n    private IllegalArgumentException invalidBinaryData(String expected, int actualByte) {\n        return new IllegalArgumentException(\n                \"Invalid binary data: Expected \" + expected + \", but was: 0x\" + toHex(actualByte));\n    }\n\n    //-------------------------------------------------------------------------\n    private static interface BinHandler {\n        public abstract Object handle(\n                JodaBeanPackedBinReader reader,\n                ResolvedType declaredType,\n                int size) throws IOException;\n    }\n\n    //-------------------------------------------------------------------------\n    private static sealed class BaseBinHandlers {\n\n        // an instance loaded dependent on the classpath\n        private static final BaseBinHandlers INSTANCE = getInstance();\n\n        private static final BaseBinHandlers getInstance() {\n            try {\n                ImmutableGrid.of();  // check if class is available\n                return new CollectBinHandlers();\n            } catch (Exception | LinkageError ex) {\n                try {\n                    ImmutableMultiset.of();  // check if class is available\n                    return new GuavaBinHandlers();\n                } catch (Exception | LinkageError ex2) {\n                    return new BaseBinHandlers();\n                }\n            }\n        }\n\n        BinHandler createHandler(Class<?> type) {\n            if (SortedSet.class.isAssignableFrom(type)) {\n                return (reader, declType, size) -> parseCollection(reader, declType, size, new TreeSet<>());\n            }\n            if (Set.class.isAssignableFrom(type)) {\n                return (reader, declType, size) -> parseCollection(reader, declType, size, LinkedHashSet.newLinkedHashSet(size));\n            }\n            if (Iterable.class.isAssignableFrom(type)) {\n                return (reader, declType, size) -> parseCollection(reader, declType, size, new ArrayList<>(size));\n            }\n            if (SortedMap.class.isAssignableFrom(type)) {\n                return (reader, declType, size) -> parseMap(reader, declType, size, new TreeMap<>());\n            }\n            if (Map.class.isAssignableFrom(type)) {\n                return (reader, declType, size) -> parseMap(reader, declType, size, LinkedHashMap.newLinkedHashMap(size));\n            }\n            if (Optional.class.isAssignableFrom(type)) {\n                return BaseBinHandlers::parseOptional;\n            }\n            if (type.isArray()) {\n                return BaseBinHandlers::parseArray;\n            }\n            throw new IllegalArgumentException(\"Invalid binary data: Unknown collection: \" + type.getName());\n        }\n\n        Class<?> classForTypeCode(int typeCode) {\n            return switch (typeCode) {\n                case TYPE_CODE_LIST -> List.class;\n                case TYPE_CODE_SET -> Set.class;\n                case TYPE_CODE_MAP -> Map.class;\n                case TYPE_CODE_OPTIONAL -> Optional.class;\n                case TYPE_CODE_OBJECT_ARRAY -> Object[].class;\n                case TYPE_CODE_STRING_ARRAY -> String[].class;\n                default -> throw new IllegalArgumentException(\"Invalid binary data: Unknown type code: \" + typeCode);\n            };\n        }\n\n        // collection - parsed from a BeanPack array\n        private static Collection<?> parseCollection(\n                JodaBeanPackedBinReader reader,\n                ResolvedType declaredType,\n                int size,\n                Collection<Object> collection) throws IOException {\n\n            var itemType = declaredType.getArgumentOrDefault(0);\n            for (var i = 0; i < size; i++) {\n                collection.add(reader.parseObject(itemType));\n            }\n            return collection;\n        }\n\n        // map - parsed from a BeanPack map\n        static Map<?, ?> parseMap(\n                JodaBeanPackedBinReader reader,\n                ResolvedType declaredType,\n                int size,\n                Map<Object, Object> map) throws IOException {\n\n            var keyType = declaredType.getArgumentOrDefault(0);\n            var valueType = declaredType.getArgumentOrDefault(1);\n            for (var i = 0; i < size; i++) {\n                var key = reader.parseObject(keyType);\n                var value = reader.parseObject(valueType);\n                map.put(key, value);\n            }\n            return map;\n        }\n\n        // optional - parsed from a BeanPack array, size 0 or 1\n        private static Optional<?> parseOptional(\n                JodaBeanPackedBinReader reader,\n                ResolvedType declaredType,\n                int size) throws IOException {\n\n            return switch (size) {\n                case 0 -> Optional.empty();\n                case 1 -> {\n                    var itemType = declaredType.getArgumentOrDefault(0);\n                    var value = reader.parseObject(itemType);\n                    yield Optional.ofNullable(value);\n                }\n                default -> throw new IllegalArgumentException(\n                        \"Invalid binary data: Optional must be an array of size zero or one, but was \" + size);\n            };\n        }\n\n        // array - parsed from a BeanPack array\n        private static Object parseArray(\n                JodaBeanPackedBinReader reader,\n                ResolvedType declaredType,\n                int size) throws IOException {\n\n            var componentType = declaredType.toComponentType();\n            var array = Array.newInstance(componentType.getRawType(), size);\n            for (var i = 0; i < size; i++) {\n                Array.set(array, i, reader.parseObject(componentType));\n            }\n            return array;\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    private static sealed class GuavaBinHandlers extends BaseBinHandlers {\n\n        @Override\n        BinHandler createHandler(Class<?> type) {\n            if (SortedMultiset.class.isAssignableFrom(type)) {\n                return (reader, declType, size) -> parseMultiset(reader, declType, size, TreeMultiset.create());\n            }\n            if (Multiset.class.isAssignableFrom(type)) {\n                return (reader, declType, size) -> parseMultiset(reader, declType, size, HashMultiset.create());\n            }\n            if (SetMultimap.class.isAssignableFrom(type)) {\n                return (reader, declType, size) -> parseMultimap(reader, declType, size, HashMultimap.create());\n            }\n            if (Multimap.class.isAssignableFrom(type)) {\n                return (reader, declType, size) -> parseMultimap(reader, declType, size, ArrayListMultimap.create());\n            }\n            if (Table.class.isAssignableFrom(type)) {\n                return GuavaBinHandlers::parseTable;\n            }\n            if (BiMap.class.isAssignableFrom(type)) {\n                return (reader, declType, size) -> parseMap(reader, declType, size, HashBiMap.create());\n            }\n            if (com.google.common.base.Optional.class.isAssignableFrom(type)) {\n                return GuavaBinHandlers::parseOptional;\n            }\n            // these are optimizations, so don't match subtypes like ImmutableSortedSet or ImmutableSortedMap\n            if (ImmutableSet.class == type) {\n                return (reader, declType, size) -> parseImmutableCollection(\n                        reader, declType, size, ImmutableSet.builderWithExpectedSize(size));\n            }\n            if (ImmutableList.class == type) {\n                return (reader, declType, size) -> parseImmutableCollection(\n                        reader, declType, size, ImmutableList.builderWithExpectedSize(size));\n            }\n            if (ImmutableMap.class == type) {\n                return (reader, declType, size) -> parseImmutableMap(reader, declType, size);\n            }\n            return super.createHandler(type);\n        }\n\n        @Override\n        Class<?> classForTypeCode(int typeCode) {\n            return switch (typeCode) {\n                case TYPE_CODE_MULTISET -> Multiset.class;\n                case TYPE_CODE_LIST_MULTIMAP -> ListMultimap.class;\n                case TYPE_CODE_SET_MULTIMAP -> SetMultimap.class;\n                case TYPE_CODE_TABLE -> Table.class;\n                case TYPE_CODE_BIMAP -> BiMap.class;\n                case TYPE_CODE_GUAVA_OPTIONAL -> com.google.common.base.Optional.class;\n                default -> super.classForTypeCode(typeCode);\n            };\n        }\n\n        // multiset - parsed from a BeanPack map of value to count\n        @SuppressWarnings({\"rawtypes\", \"unchecked\"})\n        private static Multiset<?> parseMultiset(\n                JodaBeanPackedBinReader reader,\n                ResolvedType declaredType,\n                int size,\n                Multiset mset) throws IOException {\n\n            var itemType = declaredType.getArgumentOrDefault(0);\n            for (var i = 0; i < size; i++) {\n                var item = reader.parseObject(itemType);\n                var count = reader.acceptInt();\n                mset.add(item, count);\n            }\n            return mset;\n        }\n\n        // multimap - parsed from a BeanPack map of key to array of values\n        private static Multimap<?, ?> parseMultimap(\n                JodaBeanPackedBinReader reader,\n                ResolvedType declaredType,\n                int size,\n                Multimap<Object, Object> mmap) throws IOException {\n\n            var keyType = declaredType.getArgumentOrDefault(0);\n            var valueType = declaredType.getArgumentOrDefault(1);\n            for (var i = 0; i < size; i++) {\n                var key = reader.parseObject(keyType);\n                var valueSize = reader.acceptArray();\n                for (var j = 0; j < valueSize; j++) {\n                    var value = reader.parseObject(valueType);\n                    mmap.put(key, value);\n                }\n            }\n            return mmap;\n        }\n\n        // table - parsed from a BeanPack map of row to map of column to value\n        private static Table<?, ?, ?> parseTable(\n                JodaBeanPackedBinReader reader,\n                ResolvedType declaredType,\n                int size) throws IOException {\n\n            var rowType = declaredType.getArgumentOrDefault(0);\n            var columnType = declaredType.getArgumentOrDefault(1);\n            var valueType = declaredType.getArgumentOrDefault(2);\n            var table = HashBasedTable.create();\n            for (var i = 0; i < size; i++) {\n                var row = reader.parseObject(rowType);\n                var colSize = reader.acceptMap();\n                for (var j = 0; j < colSize; j++) {\n                    var column = reader.parseObject(columnType);\n                    var value = reader.parseObject(valueType);\n                    table.put(row, column, value);\n                }\n            }\n            return table;\n        }\n\n        // optional - parsed from a BeanPack array, size 0 or 1\n        private static com.google.common.base.Optional<?> parseOptional(\n                JodaBeanPackedBinReader reader,\n                ResolvedType declaredType,\n                int size) throws IOException {\n\n            return switch (size) {\n                case 0 -> com.google.common.base.Optional.absent();\n                case 1 -> {\n                    var itemType = declaredType.getArgumentOrDefault(0);\n                    var value = reader.parseObject(itemType);\n                    yield com.google.common.base.Optional.fromNullable(value);\n                }\n                default -> throw new IllegalArgumentException(\n                        \"Invalid binary data: Optional must be an array of size zero or one, but was \" + size);\n            };\n        }\n\n        // immutable collection - optimizes using builder and expected size\n        private static ImmutableCollection<?> parseImmutableCollection(\n                JodaBeanPackedBinReader reader,\n                ResolvedType declaredType,\n                int size,\n                ImmutableCollection.Builder<Object> builder) throws IOException {\n\n            var itemType = declaredType.getArgumentOrDefault(0);\n            for (var i = 0; i < size; i++) {\n                var item = reader.parseObject(itemType);\n                builder.add(item);\n            }\n            return builder.build();\n        }\n\n        // immutable map - optimizes using builder and expected size\n        private static ImmutableMap<?, ?> parseImmutableMap(\n                JodaBeanPackedBinReader reader,\n                ResolvedType declaredType,\n                int size) throws IOException {\n\n            var builder = ImmutableMap.builderWithExpectedSize(size);\n            var keyType = declaredType.getArgumentOrDefault(0);\n            var valueType = declaredType.getArgumentOrDefault(1);\n            for (var i = 0; i < size; i++) {\n                var key = reader.parseObject(keyType);\n                var value = reader.parseObject(valueType);\n                builder.put(key, value);\n            }\n            return builder.build();\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    private static final class CollectBinHandlers extends GuavaBinHandlers {\n\n        @Override\n        BinHandler createHandler(Class<?> type) {\n            if (Grid.class.isAssignableFrom(type)) {\n                return CollectBinHandlers::parseGrid;\n            }\n            return super.createHandler(type);\n        }\n\n        @Override\n        Class<?> classForTypeCode(int typeCode) {\n            return switch (typeCode) {\n                case TYPE_CODE_GRID -> Grid.class;\n                default -> super.classForTypeCode(typeCode);\n            };\n        }\n\n        // grid\n        private static Grid<?> parseGrid(\n                JodaBeanPackedBinReader reader,\n                ResolvedType declaredType,\n                int size) throws IOException {\n\n            var valueType = declaredType.getArgumentOrDefault(0);\n            if (size != 3) {\n                throw new IllegalArgumentException(\n                        \"Invalid binary data: Grid must be an array of size three, but was \" + size);\n            }\n            var rowCount = reader.acceptInt();\n            var colCount = reader.acceptInt();\n            var arraySize = reader.acceptArray();\n            if (rowCount < 0) {\n                // dense\n                rowCount = -rowCount;\n                var grid = DenseGrid.create(rowCount, colCount);\n                for (var row = 0; row < rowCount; row++) {\n                    for (var col = 0; col < colCount; col++) {\n                        var value = reader.parseObject(valueType);\n                        if (value != null) {\n                            grid.put(row, col, value);\n                        }\n                    }\n                }\n                return grid;\n            } else {\n                // sparse\n                var grid = SparseGrid.create(rowCount, colCount);\n                for (var i = 0; i < arraySize / 3; i++) {\n                    var row = reader.acceptInt();\n                    var col = reader.acceptInt();\n                    var value = reader.parseObject(valueType);\n                    if (value != null) {\n                        grid.put(row, col, value);\n                    }\n                }\n                return grid;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/JodaBeanPackedBinWriter.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.lang.reflect.Array;\nimport java.time.Duration;\nimport java.time.Instant;\nimport java.time.LocalDate;\nimport java.time.LocalTime;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.IdentityHashMap;\nimport java.util.LinkedHashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.Set;\nimport java.util.Spliterator;\nimport java.util.stream.StreamSupport;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.DynamicBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.ResolvedType;\nimport org.joda.beans.impl.flexi.FlexiBean;\nimport org.joda.beans.impl.map.MapBean;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerTypeMapper;\nimport org.joda.collect.grid.Grid;\nimport org.joda.collect.grid.ImmutableGrid;\n\nimport com.google.common.collect.BiMap;\nimport com.google.common.collect.ImmutableMap;\nimport com.google.common.collect.ImmutableMultiset;\nimport com.google.common.collect.Multimap;\nimport com.google.common.collect.Multiset;\nimport com.google.common.collect.SetMultimap;\nimport com.google.common.collect.Table;\n\n/**\n * Writes the Joda-Bean BeanPack binary format with strings deduplicated by reference.\n * <p>\n * This class contains mutable state and cannot be used from multiple threads.\n * A new instance must be created for each message.\n */\nfinal class JodaBeanPackedBinWriter {\n\n    static final int MIN_LENGTH_STR_VALUE = 3;\n\n    // why is there an ugly ClassValue setup here?\n    // because this is O(1) whereas switch with pattern match which is O(n)\n    private static final ClassValue<BinHandler<Object>> LOOKUP = new ClassValue<>() {\n\n        @SuppressWarnings(\"rawtypes\")  // sneaky use of raw type to allow typed value in each method below\n        @Override\n        protected BinHandler computeValue(Class<?> type) {\n            if (Bean.class.isAssignableFrom(type)) {\n                return (BinHandler<Bean>) JodaBeanPackedBinWriter::writeBeanMaybeSimple;\n            }\n            // these primitive types are always written and interpretted without a type\n            if (type == String.class) {\n                return (writer, declaredType, propName, value) -> writer.writeString((String) value);\n            }\n            if (type == Integer.class || type == int.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeInt((Integer) value);\n            }\n            if (type == Long.class || type == long.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeLong((Long) value);\n            }\n            if (type == Byte.class || type == byte.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeByte((Byte) value);\n            }\n            if (type == Short.class || type == short.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeShort((Short) value);\n            }\n            if (type == Character.class || type == char.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeChar((Character) value);\n            }\n            if (type == Double.class || type == double.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeDouble((Double) value);\n            }\n            if (type == Float.class || type == float.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeFloat((Float) value);\n            }\n            if (type == Boolean.class || type == boolean.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeBoolean((Boolean) value);\n            }\n            if (type == LocalDate.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeDate((LocalDate) value);\n            }\n            if (type == LocalTime.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeTime((LocalTime) value);\n            }\n            if (type == Instant.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeInstant((Instant) value);\n            }\n            if (type == Duration.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeDuration((Duration) value);\n            }\n            return BaseBinHandlers.INSTANCE.createHandler(type);\n        }\n    };\n\n    /**\n     * The settings to use.\n     */\n    private final JodaBeanSer settings;\n    /**\n     * The outputter.\n     */\n    private final BeanPackOutput output;\n\n    /**\n     * The base package including the trailing dot.\n     */\n    private String basePackage;\n    /**\n     * The known types.\n     */\n    private final Map<Class<?>, String> knownTypes = new IdentityHashMap<>();\n    /**\n     * The type definitions that have been output.\n     */\n    private int typeDefinitionIndex;\n    /**\n     * The type definitions that have been output.\n     */\n    private final Map<Class<?>, Integer> typeDefinitions = new IdentityHashMap<>();\n    /**\n     * The bean definitions.\n     */\n    private final Map<Class<?>, List<MetaProperty<?>>> beanDefinitions = new IdentityHashMap<>();\n    /**\n     * The type definitions that have been output.\n     */\n    private int valueDefinitionIndex;\n    /**\n     * The value definitions that have been output.\n     */\n    private final Map<Object, Integer> valueDefinitions = new HashMap<>();\n\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings to use, not null\n     * @param out  the output stream, not null\n     */\n    JodaBeanPackedBinWriter(JodaBeanSer settings, OutputStream out) {\n        this.settings = settings;\n        this.output = new BeanPackOutput(out);\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Writes the bean to the {@code OutputStream}.\n     * \n     * @param bean  the bean to output, not null\n     * @param includeRootType  whether to include the root type\n     * @throws IOException if an error occurs\n     */\n    void write(Bean bean, boolean includeRootType) throws IOException {\n        var beanClass = bean.getClass();\n        // these first two bytes in BeanPack are compatible with MsgPack!\n        output.writeArrayHeader(3);\n        output.writeInt(3);  // version 3\n        if (includeRootType && beanClass != FlexiBean.class && beanClass != MapBean.class && settings.isShortTypes()) {\n            basePackage = beanClass.getPackage().getName() + '.';\n            SerTypeMapper.encodeType(beanClass, settings, basePackage, knownTypes);\n            writeString(basePackage);\n        } else {\n            basePackage = null;\n            output.writeNull();\n        }\n\n        // root always outputs the bean, not Joda-Convert form\n        writeBean(ResolvedType.of(beanClass), bean, includeRootType);\n        if (typeDefinitionIndex > 0xFFFF) {\n            throw new IllegalArgumentException(\"Invalid bindary data: Too many type references\");\n        }\n        if (valueDefinitionIndex > 0xFFFFFF) {\n            throw new IllegalArgumentException(\"Invalid bindary data: Too many value references\");\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    // writes an object, by determining the runtime type\n    private void writeObject(ResolvedType declaredType, String propertyName, Object value) throws IOException {\n        if (value == null) {\n            output.writeNull();\n        } else {\n            var handler = LOOKUP.get(value.getClass());\n            handler.handle(this, declaredType, propertyName, value);\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    // writes a bean, favouring output as a Joda-Convert type\n    private void writeBeanMaybeSimple(ResolvedType declaredType, String propertyName, Bean bean) throws IOException {\n        // check for Joda-Convert cannot be in ClassValue as it relies on the settings\n        // cannot call valueDefinitions.get(value) here, as hashCode() of a random bean may be very expensive\n        if (settings.getConverter().isConvertible(bean.getClass())) {\n            writeSimple(propertyName, bean);\n        } else if (settings.getBeanValueClasses().contains(bean.getClass())) {\n            writeCachedBean(bean);\n        } else {\n            writeBean(declaredType, bean, true);\n        }\n    }\n\n    // writes a bean, where the bean is a value that can be cached\n    private void writeCachedBean(Bean bean) throws IOException {\n        // note that the declared type is not used to refine the output, creating separation of types in the binary form\n        var ref = valueDefinitions.get(bean);\n        if (ref == null) {\n            // always write the type, as it could be read while skipping where the type is not known\n            output.writeValueDefinitionHeader();\n            writeTypeNameOrReference(bean.getClass());\n\n            var beanClass = bean.getClass();\n            var metaProperties = beanDefinitions.get(beanClass);\n            if (metaProperties == null) {\n                writeBeanWithDefinition(bean);\n            } else {\n                writeBeanValues(bean, metaProperties);\n            }\n            valueDefinitions.put(bean, valueDefinitionIndex++);\n        } else {\n            output.writeValueReference(ref);\n        }\n    }\n\n    // writes a bean, with meta type information if necessary\n    private void writeBean(ResolvedType declaredType, Bean bean, boolean includeRootType) throws IOException {\n        var beanClass = bean.getClass();\n        var metaProperties = beanDefinitions.get(beanClass);\n        if (metaProperties == null) {\n            if (bean instanceof DynamicBean || !includeRootType) {\n                if (beanClass != declaredType.getRawType()) {\n                    writeTypeNameOrReference(beanClass);\n                }\n                writeDynamicBean(bean);\n            } else {\n                // always write the type, as it could be read while skipping where the type is not known\n                writeTypeNameOrReference(beanClass);\n                writeBeanWithDefinition(bean);\n            }\n        } else {\n            if (beanClass != declaredType.getRawType()) {\n                writeTypeNameOrReference(beanClass);\n            }\n            writeBeanValues(bean, metaProperties);\n        }\n    }\n\n    // writes the dynamic bean as a map of property name to property value, without any type information\n    private void writeDynamicBean(Bean bean) throws IOException {\n        // note that the declared type is not used to refine the output, creating separation of types in the binary form\n        var beanClass = bean.getClass();\n        var metaBean = bean.metaBean();\n        var beanMap = new LinkedHashMap<MetaProperty<?>, Object>(metaBean.metaPropertyCount());\n        for (var metaProperty : metaBean.metaPropertyIterable()) {\n            if (settings.isSerialized(metaProperty)) {\n                var value = metaProperty.get(bean);\n                if (value != null) {\n                    beanMap.put(metaProperty, value);\n                }\n            }\n        }\n        output.writeMapHeader(beanMap.size());\n        for (var entry : beanMap.entrySet()) {\n            var metaProperty = entry.getKey();\n            var value = entry.getValue();\n            var resolvedType = metaProperty.propertyResolvedType(beanClass);\n            var childPropertyName = metaProperty.name();\n            if (value != null) {\n                writeString(childPropertyName);\n                writeObject(resolvedType, childPropertyName, value);\n            }\n        }\n    }\n\n    // writes the bean definition structure\n    private void writeBeanWithDefinition(Bean bean) throws IOException {\n        // note that the declared type is not used to refine the output, creating separation of types in the binary form\n        var metaProperties = findSerializedMetaProperties(bean);\n        if (metaProperties.size() > 255) {\n            writeDynamicBean(bean);\n        } else {\n            var beanClass = bean.getClass();\n            beanDefinitions.put(beanClass, metaProperties);\n            output.writeBeanDefinitionHeader(metaProperties.size());\n            for (var metaProperty : metaProperties) {\n                writeString(metaProperty.name());\n            }\n            for (var metaProperty : metaProperties) {\n                var resolvedType = metaProperty.propertyResolvedType(beanClass);\n                var childPropertyName = metaProperty.name();\n                var value = metaProperty.get(bean);\n                writeObject(resolvedType, childPropertyName, value);\n            }\n        }\n    }\n\n    // find the list of meta properties that will be serialized\n    private ArrayList<MetaProperty<?>> findSerializedMetaProperties(Bean bean) {\n        var metaBean = bean.metaBean();\n        var metaProperties = new ArrayList<MetaProperty<?>>(metaBean.metaPropertyCount());\n        for (var metaProperty : metaBean.metaPropertyIterable()) {\n            if (settings.isSerialized(metaProperty)) {\n                metaProperties.add(metaProperty);\n            }\n        }\n        return metaProperties;\n    }\n\n    // writes the bean values without property names, effectively referring back to the original definition\n    private void writeBeanValues(Bean bean, List<MetaProperty<?>> metaProperties) throws IOException {\n        // note that the declared type is not used to refine the output, creating separation of types in the binary form\n        var beanClass = bean.getClass();\n        output.writeArrayHeader(metaProperties.size());\n        for (var metaProperty : metaProperties) {\n            if (settings.isSerialized(metaProperty)) {\n                var resolvedType = metaProperty.propertyResolvedType(beanClass);\n                var childPropertyName = metaProperty.name();\n                var value = metaProperty.get(bean);\n                writeObject(resolvedType, childPropertyName, value);\n            }\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    // writes a string\n    private void writeString(String str) throws IOException {\n        if (str.length() >= MIN_LENGTH_STR_VALUE) {\n            var ref = valueDefinitions.get(str);\n            if (ref == null) {\n                valueDefinitions.put(str, valueDefinitionIndex++);\n                output.writeString(str);\n            } else {\n                output.writeValueReference(ref);\n            }\n        } else {\n            output.writeString(str);\n        }\n    }\n\n    // writes a simple type, with meta type information if necessary\n    // this method is never called for primitive types like int/long/LocalDate\n    private void writeSimple(String propertyName, Object value) throws IOException {\n        // note that the declared type is not used to refine the output, creating separation of types in the binary form\n        // write the reference, or call Joda-Convert if first time value is seen\n        var ref = valueDefinitions.get(value);\n        if (ref == null) {\n            // always write the type (by passing OBJECT), as it could be read while skipping where the type is not known\n            output.writeValueDefinitionHeader();\n            writeJodaConvert(ResolvedType.OBJECT, propertyName, value);\n            valueDefinitions.put(value, valueDefinitionIndex++);\n        } else {\n            output.writeValueReference(ref);\n        }\n    }\n\n    // writes the object as a String using Joda-Convert\n    private void writeJodaConvert(ResolvedType declaredType, String propertyName, Object value) throws IOException {\n        try {\n            // handle situations where there is no declared type, or there is a subclass of the declared type\n            var effectiveType = value.getClass();\n            var converter = settings.getConverter().findTypedConverterNoGenerics(effectiveType);\n            if (effectiveType != declaredType.toBoxed().getRawType()) {\n                effectiveType = converter.getEffectiveType();\n                writeTypeNameOrReference(effectiveType);\n            }\n            var converted = converter.convertToString(value);\n            if (converted == null) {\n                output.writeNull();\n                return;\n            }\n            writeString(converted);\n        } catch (RuntimeException ex) {\n            throw invalidConversionMsg(propertyName, value, ex);\n        }\n    }\n\n    private IllegalArgumentException invalidConversionMsg(String propertyName, Object value, RuntimeException ex) {\n        var msg = \"Unable to write property '\" + propertyName + \"', type \" +\n                value.getClass().getName() + \" could not be converted to a String\";\n        return new IllegalArgumentException(msg, ex);\n    }\n\n    // writes the type header\n    private final void writeTypeNameOrReference(Class<?> type) throws IOException {\n        var ref = typeDefinitions.get(type);\n        if (ref == null) {\n            var encodedClassName = SerTypeMapper.encodeType(type, settings, basePackage, knownTypes);\n            typeDefinitions.put(type, typeDefinitionIndex++);\n            output.writeTypeName(encodedClassName);\n        } else {\n            output.writeTypeReference(ref);\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    private static interface BinHandler<T> {\n        public abstract void handle(\n                JodaBeanPackedBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                T obj) throws IOException;\n    }\n\n    //-------------------------------------------------------------------------\n    // handles base JDK collections\n    private static sealed class BaseBinHandlers {\n\n        // an instance loaded dependent on the classpath\n        private static final BaseBinHandlers INSTANCE = getInstance();\n\n        private static final BaseBinHandlers getInstance() {\n            try {\n                ImmutableGrid.of();  // check if class is available\n                return new CollectBinHandlers();\n            } catch (Exception | LinkageError ex) {\n                try {\n                    ImmutableMultiset.of();  // check if class is available\n                    return new GuavaBinHandlers();\n                } catch (Exception | LinkageError ex2) {\n                    return new BaseBinHandlers();\n                }\n            }\n        }\n\n        // creates the handler, called from ClassValue.computeValue()\n        BinHandler<?> createHandler(Class<?> type) {\n            if (Optional.class.isAssignableFrom(type)) {\n                return (BinHandler<Optional<?>>) BaseBinHandlers::writeOptional;\n            }\n            if (type == byte[].class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeBytes((byte[]) value);\n            }\n            if (type == double[].class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeDoubles((double[]) value);\n            }\n            if (type.isArray()) {\n                var componentType = type.getComponentType();\n                if (componentType.isPrimitive()) {\n                    return (BinHandler<Object>) BaseBinHandlers::writePrimitiveArray;\n                } else {\n                    return (BinHandler<Object[]>) BaseBinHandlers::writeArray;\n                }\n            }\n            if (Map.class.isAssignableFrom(type)) {\n                return (BinHandler<Map<?, ?>>) BaseBinHandlers::writeMap;\n            }\n            if (Collection.class.isAssignableFrom(type)) {\n                return (BinHandler<Collection<?>>) BaseBinHandlers::writeCollection;\n            }\n            if (Iterable.class.isAssignableFrom(type)) {\n                return (BinHandler<Iterable<?>>) BaseBinHandlers::writeIterable;\n            }\n            return (writer, declaredType, propertyName, value) -> writer.writeSimple(propertyName, value);\n        }\n\n        // writes an optional, with meta type information if necessary\n        private static void writeOptional(\n                JodaBeanPackedBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Optional<?> opt) throws IOException {\n\n            // write actual type\n            if (!Optional.class.isAssignableFrom(declaredType.getRawType())) {\n                writer.output.writeTypeReference(BeanPack.TYPE_CODE_OPTIONAL);\n            }\n            // write content, using an array of size 0 or 1\n            var valueType = declaredType.getArgumentOrDefault(0);\n            if (opt.isEmpty()) {\n                writer.output.writeArrayHeader(0);\n            } else {\n                writer.output.writeArrayHeader(1);\n                writer.writeObject(valueType, \"\", opt.get());\n            }\n        }\n\n        // writes an array, with meta type information if necessary\n        private static void writeArray(\n                JodaBeanPackedBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Object[] array) throws IOException {\n\n            // write actual type\n            var actualComponentType = array.getClass().getComponentType();\n            if (!declaredType.isArray() || declaredType.getRawType().getComponentType() != actualComponentType) {\n                if (actualComponentType == String.class) {\n                    writer.output.writeTypeReference(BeanPack.TYPE_CODE_STRING_ARRAY);\n                } else if (actualComponentType == Object.class) {\n                    writer.output.writeTypeReference(BeanPack.TYPE_CODE_OBJECT_ARRAY);\n                } else {\n                    writeArrayTypeDescription(writer, array.getClass());\n                }\n            }\n            // write content\n            var componentType = declaredType.toComponentType();\n            writer.output.writeArrayHeader(array.length);\n            for (var item : array) {\n                writer.writeObject(componentType, \"\", item);\n            }\n        }\n\n        // writes a primitive array, with meta type information if necessary\n        private static void writePrimitiveArray(\n                JodaBeanPackedBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Object array) throws IOException {\n\n            // write actual type\n            var arrayType = array.getClass();\n            if (!declaredType.isArray()) {\n                writeArrayTypeDescription(writer, arrayType);\n            }\n            // write content\n            var arrayComponentType = arrayType.getComponentType();\n            var componentType = ResolvedType.of(arrayComponentType);\n            var handler = JodaBeanPackedBinWriter.LOOKUP.get(arrayComponentType);\n            var arrayLength = Array.getLength(array);\n            writer.output.writeArrayHeader(arrayLength);\n            for (int i = 0; i < arrayLength; i++) {\n                handler.handle(writer, componentType, propertyName, Array.get(array, i));\n            }\n        }\n\n        // writes the meta type header\n        private static final void writeArrayTypeDescription(JodaBeanPackedBinWriter writer, Class<?> arrayType) throws IOException {\n            var ref = writer.typeDefinitions.get(arrayType);\n            if (ref == null) {\n                var encodedClassName = metaTypeArrayName(arrayType.getComponentType());\n                writer.typeDefinitions.put(arrayType, writer.typeDefinitionIndex++);\n                writer.output.writeTypeName(encodedClassName);\n            } else {\n                writer.output.writeTypeReference(ref);\n            }\n        }\n\n        // determines the meta type name to use\n        private static String metaTypeArrayName(Class<?> valueType) {\n            if (valueType.isArray()) {\n                return metaTypeArrayName(valueType.getComponentType()) + \"[]\";\n            }\n            if (valueType == Object.class) {\n                return \"Object[]\";\n            }\n            if (valueType == String.class) {\n                return \"String[]\";\n            }\n            return valueType.getName() + \"[]\";\n        }\n\n        // writes an iterable, with meta type information if necessary\n        private static void writeIterable(\n                JodaBeanPackedBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Iterable<?> iterable) throws IOException {\n\n            // convert to a list, which is necessary as there is no size() on Iterable\n            // this ensures that the generics of the iterable are retained\n            var list = StreamSupport.stream(iterable::spliterator, Spliterator.ORDERED, false).toList();\n            var adjustedType = ResolvedType.of(List.class, declaredType.getArguments());\n            writeCollection(writer, adjustedType, propertyName, list);\n        }\n\n        // writes a collection, with meta type information if necessary\n        private static void writeCollection(\n                JodaBeanPackedBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Collection<?> coll) throws IOException {\n\n            // write actual type\n            if (coll instanceof Set && !Set.class.isAssignableFrom(declaredType.getRawType())) {\n                writer.output.writeTypeReference(BeanPack.TYPE_CODE_SET);\n            } else if (!Collection.class.isAssignableFrom(declaredType.getRawType())) {\n                writer.output.writeTypeReference(BeanPack.TYPE_CODE_LIST);\n            }\n            // write content\n            var itemType = declaredType.getArgumentOrDefault(0);\n            writer.output.writeArrayHeader(coll.size());\n            for (var item : coll) {\n                writer.writeObject(itemType, \"\", item);\n            }\n        }\n\n        // writes a map, with meta type information if necessary\n        private static void writeMap(\n                JodaBeanPackedBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Map<?, ?> map) throws IOException {\n\n            // write actual type\n            if (!Map.class.isAssignableFrom(declaredType.getRawType())) {\n                writer.output.writeTypeReference(BeanPack.TYPE_CODE_MAP);\n            }\n            // write content\n            writeMapEntries(writer, declaredType, propertyName, map.entrySet());\n        }\n\n        // writes a map given map entries, code shared with Multimap\n        static <K, V> void writeMapEntries(\n                JodaBeanPackedBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Collection<Map.Entry<K, V>> mapEntries) throws IOException {\n\n            var keyType = declaredType.getArgumentOrDefault(0);\n            var valueType = declaredType.getArgumentOrDefault(1);\n            writer.output.writeMapHeader(mapEntries.size());\n            for (var entry : mapEntries) {\n                writer.writeObject(keyType, \"\", entry.getKey());\n                writer.writeObject(valueType, \"\", entry.getValue());\n            }\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    private static sealed class GuavaBinHandlers extends BaseBinHandlers {\n\n        @Override\n        BinHandler<?> createHandler(Class<?> type) {\n            if (com.google.common.base.Optional.class.isAssignableFrom(type)) {\n                return (BinHandler<com.google.common.base.Optional<?>>) GuavaBinHandlers::writeOptional;\n            }\n            if (Multimap.class.isAssignableFrom(type)) {\n                return (BinHandler<Multimap<?, ?>>) GuavaBinHandlers::writeMultimap;\n            }\n            if (Multiset.class.isAssignableFrom(type)) {\n                return (BinHandler<Multiset<?>>) GuavaBinHandlers::writeMultiset;\n            }\n            if (Table.class.isAssignableFrom(type)) {\n                return (BinHandler<Table<?, ?, ?>>) GuavaBinHandlers::writeTable;\n            }\n            if (BiMap.class.isAssignableFrom(type)) {\n                return (BinHandler<BiMap<?, ?>>) GuavaBinHandlers::writeBiMap;\n            }\n            return super.createHandler(type);\n        }\n\n        // writes an optional, with meta type information if necessary\n        private static void writeOptional(\n                JodaBeanPackedBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                com.google.common.base.Optional<?> opt) throws IOException {\n\n            // write actual type\n            if (!com.google.common.base.Optional.class.isAssignableFrom(declaredType.getRawType())) {\n                writer.output.writeTypeReference(BeanPack.TYPE_CODE_OPTIONAL);\n            }\n            // write content, using an array of size 0 or 1\n            var valueType = declaredType.getArgumentOrDefault(0);\n            if (opt.isPresent()) {\n                writer.output.writeArrayHeader(1);\n                writer.writeObject(valueType, \"\", opt.get());\n            } else {\n                writer.output.writeArrayHeader(0);\n            }\n        }\n\n        // writes a multimap, with meta type information if necessary\n        private static void writeMultimap(\n                JodaBeanPackedBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Multimap<?, ?> mmap) throws IOException {\n\n            // write actual type\n            if (mmap instanceof SetMultimap && !SetMultimap.class.isAssignableFrom(declaredType.getRawType())) {\n                writer.output.writeTypeReference(BeanPack.TYPE_CODE_SET_MULTIMAP);\n            } else if (!Multimap.class.isAssignableFrom(declaredType.getRawType())) {\n                writer.output.writeTypeReference(BeanPack.TYPE_CODE_LIST_MULTIMAP);\n            }\n            // write content, using a map of key to array of values\n            var keyType = declaredType.getArgumentOrDefault(0);\n            var valueType = declaredType.getArgumentOrDefault(1);\n            var map = mmap.asMap();\n            writer.output.writeMapHeader(map.size());\n            for (var entry : map.entrySet()) {\n                writer.writeObject(keyType, \"\", entry.getKey());\n                var values = entry.getValue();\n                writer.output.writeArrayHeader(values.size());\n                for (var value : values) {\n                    writer.writeObject(valueType, \"\", value);\n                }\n            }\n        }\n\n        // writes a multiset, with meta type information if necessary\n        private static void writeMultiset(\n                JodaBeanPackedBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Multiset<?> mset) throws IOException {\n\n            // write actual type\n            if (!Multiset.class.isAssignableFrom(declaredType.getRawType())) {\n                writer.output.writeTypeReference(BeanPack.TYPE_CODE_MULTISET);\n            }\n            // write content, using a map of value to count\n            var valueType = declaredType.getArgumentOrDefault(0);\n            var entrySet = mset.entrySet();\n            writer.output.writeMapHeader(entrySet.size());\n            for (var entry : entrySet) {\n                writer.writeObject(valueType, \"\", entry.getElement());\n                writer.output.writeInt(entry.getCount());\n            }\n        }\n\n        // writes a table, with meta type information if necessary\n        private static void writeTable(\n                JodaBeanPackedBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Table<?, ?, ?> table) throws IOException {\n\n            // write actual type\n            if (!Table.class.isAssignableFrom(declaredType.getRawType())) {\n                writer.output.writeTypeReference(BeanPack.TYPE_CODE_TABLE);\n            }\n            // write content, using a map of row to map of column to value\n            var rowType = declaredType.getArgumentOrDefault(0);\n            var columnType = declaredType.getArgumentOrDefault(1);\n            var valueType = declaredType.getArgumentOrDefault(2);\n            var rowMap = table.rowMap();\n            writer.output.writeMapHeader(rowMap.size());\n            for (var rowEntry : rowMap.entrySet()) {\n                writer.writeObject(rowType, \"\", rowEntry.getKey());\n                writer.output.writeMapHeader(rowEntry.getValue().size());\n                for (var colEntry : rowEntry.getValue().entrySet()) {\n                    writer.writeObject(columnType, \"\", colEntry.getKey());\n                    writer.writeObject(valueType, \"\", colEntry.getValue());\n                }\n            }\n        }\n\n        // writes a BiMap, with meta type information if necessary\n        private static void writeBiMap(\n                JodaBeanPackedBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                BiMap<?, ?> biMap) throws IOException {\n\n            // write actual type\n            if (!BiMap.class.isAssignableFrom(declaredType.getRawType())) {\n                // hack around Guava annoyance by assuming that size 0 and 1 ImmutableBiMap\n                // was actually meant to be an ImmutableMap\n                if ((declaredType.getRawType() != Map.class && declaredType.getRawType() != ImmutableMap.class) || biMap.size() >= 2) {\n                    writer.output.writeTypeReference(BeanPack.TYPE_CODE_BIMAP);\n                } else if (!Map.class.isAssignableFrom(declaredType.getRawType())) {\n                    writer.output.writeTypeReference(BeanPack.TYPE_CODE_MAP);\n                }\n            }\n            // write content\n            writeMapEntries(writer, declaredType, propertyName, biMap.entrySet());\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    private static final class CollectBinHandlers extends GuavaBinHandlers {\n\n        @Override\n        BinHandler<?> createHandler(Class<?> type) {\n            if (Grid.class.isAssignableFrom(type)) {\n                return (BinHandler<Grid<?>>) CollectBinHandlers::writeGrid;\n            }\n            return super.createHandler(type);\n        }\n\n        // writes a grid, with meta type information if necessary\n        private static void writeGrid(\n                JodaBeanPackedBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Grid<?> grid) throws IOException {\n\n            // write actual type\n            if (!Grid.class.isAssignableFrom(declaredType.getRawType())) {\n                writer.output.writeTypeReference(BeanPack.TYPE_CODE_GRID);\n            }\n            // write content using sparse or dense approach\n            var valueType = declaredType.getArgumentOrDefault(0);\n            var rowCount = grid.rowCount();\n            var colCount = grid.columnCount();\n            var totalSize = rowCount * colCount;\n            var gridSize = grid.size();\n            var sparse = gridSize <= (totalSize / 3d);\n            writer.output.writeArrayHeader(3);\n            writer.output.writeInt(sparse ? rowCount : -rowCount);\n            writer.output.writeInt(colCount);\n            if (sparse) {\n                // sparse\n                writer.output.writeArrayHeader(gridSize * 3);\n                for (var cell : grid.cells()) {\n                    writer.output.writeInt(cell.getRow());\n                    writer.output.writeInt(cell.getColumn());\n                    writer.writeObject(valueType, \"\", cell.getValue());\n                }\n            } else {\n                // dense\n                writer.output.writeArrayHeader(totalSize);\n                for (var row = 0; row < rowCount; row++) {\n                    for (var column = 0; column < colCount; column++) {\n                        writer.writeObject(valueType, \"\", grid.get(row, column));\n                    }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/JodaBeanReferencingBinReader.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.io.DataInputStream;\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerIterable;\nimport org.joda.beans.ser.SerOptional;\nimport org.joda.beans.ser.SerTypeMapper;\n\n/**\n * Provides the ability for a Joda-Bean to read from the referencing binary format.\n */\nclass JodaBeanReferencingBinReader extends AbstractBinReader {\n\n    /**\n     * The base package including the trailing dot.\n     */\n    private String overrideBasePackage;\n    /**\n     * The classes that have been serialized.\n     */\n    private ClassInfo[] classes;\n    /**\n     * The classes for lookup of classInfo when the class is known and unnecessary to serialise.\n     */\n    private Map<Class<?>, ClassInfo> classMap;\n    /**\n     * The serialized objects that are repeated and referenced.\n     */\n    private Object[] refs;\n\n    //-----------------------------------------------------------------------\n    // creates an instance\n    JodaBeanReferencingBinReader(JodaBeanSer settings, DataInputStream input) {\n        super(settings, input);\n    }\n\n    //-----------------------------------------------------------------------\n    // reads the input stream\n    @Override\n    <T> T read(Class<T> rootType) {\n        try {\n            try {\n                return parseRemaining(rootType);\n            } finally {\n                input.close();\n            }\n        } catch (RuntimeException ex) {\n            throw ex;\n        } catch (Exception ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    // parses the root bean\n    @Override\n    <T> T parseRemaining(Class<T> declaredType) throws Exception {\n        // the array and version has already been read\n        overrideBasePackage = declaredType.getPackage().getName() + \".\";\n        // ref count + class map\n        parseClassDescriptions();\n\n        // parse\n        var parsed = parseObject(declaredType, null, null, null, true);\n        return declaredType.cast(parsed);\n    }\n\n    //-----------------------------------------------------------------------\n    // parses the references\n    private void parseClassDescriptions() throws Exception {\n        var refCount = acceptInteger(input.readByte());\n        if (refCount < 0) {\n            throw new IllegalArgumentException(\"Invalid binary data: Expected count of references, but was: \" + refCount);\n        }\n        refs = new Object[refCount];\n\n        var classMapSize = acceptMap(input.readByte());\n        classes = new ClassInfo[classMapSize]; // Guaranteed non-negative by acceptMap()\n        classMap = new HashMap<>(classMapSize);\n\n        for (var position = 0; position < classMapSize; position++) {\n            var classInfo = parseClassInfo();\n            classes[position] = classInfo;\n            classMap.put(classInfo.type, classInfo);\n        }\n    }\n\n    // parses the class information\n    private ClassInfo parseClassInfo() throws Exception {\n        var className = acceptString(input.readByte());\n        var type = SerTypeMapper.decodeType(className, settings, overrideBasePackage, null);\n        var propertyCount = acceptArray(input.readByte());\n        if (propertyCount < 0) {\n            throw new IllegalArgumentException(\"Invalid binary data: Expected array with 0 to many elements, but was: \" + propertyCount);\n        }\n\n        var metaProperties = new MetaProperty<?>[propertyCount];\n        if (ImmutableBean.class.isAssignableFrom(type)) {\n            var deser = settings.getDeserializers().findDeserializer(type);\n            var metaBean = deser.findMetaBean(type);\n            for (var i = 0; i < propertyCount; i++) {\n                var propertyName = acceptString(input.readByte());\n                metaProperties[i] = deser.findMetaProperty(type, metaBean, propertyName);\n            }\n        } else if (propertyCount != 0) {\n            throw new IllegalArgumentException(\"Invalid binary data: Found non immutable bean class that has meta properties defined: \" + type.getName() + \", \" + propertyCount + \" properties\");\n        }\n        return new ClassInfo(type, metaProperties);\n    }\n\n    // parses the bean using the class information\n    private Object parseBean(int propertyCount, ClassInfo classInfo) {\n        var propName = \"\";\n        if (classInfo.metaProperties.length != propertyCount) {\n            throw new IllegalArgumentException(\"Invalid binary data: Expected \" + classInfo.metaProperties.length + \" properties but was: \" + propertyCount);\n        }\n        try {\n            var deser = settings.getDeserializers().findDeserializer(classInfo.type);\n            var metaBean = deser.findMetaBean(classInfo.type);\n            var builder = deser.createBuilder(classInfo.type, metaBean);\n            for (var metaProp : classInfo.metaProperties) {\n                if (metaProp == null) {\n                    MsgPackInput.skipObject(input);\n                } else {\n                    propName = metaProp.name();\n                    var value = parseObject(SerOptional.extractType(metaProp, classInfo.type), metaProp, classInfo.type, null, false);\n                    var wrappedValue = SerOptional.wrapValue(metaProp, classInfo.type, value);\n                    if (wrappedValue != null) {\n                        // null is the same as a value not being set\n                        // in the case of defaults we want those to take precedence\n                        deser.setValue(builder, metaProp, wrappedValue);\n                    }\n                }\n                propName = \"\";\n            }\n            return deser.build(classInfo.type, builder);\n        } catch (Exception ex) {\n            throw new RuntimeException(\"Error parsing bean: \" + classInfo.type.getName() + \"::\" + propName + \", \" + ex.getMessage(), ex);\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    Object parseObject(\n            Class<?> declaredType,\n            MetaProperty<?> metaProp,\n            Class<?> beanType,\n            SerIterable parentIterable,\n            boolean rootType) throws Exception {\n\n        // establish type\n        Class<?> effectiveType = declaredType;\n        ClassInfo classInfo = null;\n        String metaType = null;\n        Integer ref = null;\n        int typeByte = input.readByte();\n\n        // Unwrap nested references and metadata\n        while (isMap(typeByte)) {\n\n            input.mark(18);\n            var mapSize = acceptMap(typeByte);\n            if (mapSize > 0) {\n                int typeByteTemp = input.readByte();\n\n                if (isIntExtension(typeByteTemp)) {\n\n                    var nestedTypeByteTemp = typeByteTemp;\n                    typeByteTemp = input.readByte();\n                    var reference = acceptIntExtension(nestedTypeByteTemp);\n\n                    if (typeByteTemp == JODA_TYPE_DATA) {\n                        if (mapSize != 1) {\n                            throw new IllegalArgumentException(\"Invalid binary data: Expected map size 1, but was: \" + mapSize);\n                        }\n                        classInfo = classes[reference];\n                        if (!declaredType.isAssignableFrom(classInfo.type)) {\n                            throw new IllegalArgumentException(\"Specified type is incompatible with declared type: \" + declaredType.getName() + \" and \" + classInfo.type.getName());\n                        }\n                        typeByte = input.readByte();\n                    } else if (typeByteTemp == JODA_TYPE_META) {\n                        if (mapSize != 1) {\n                            throw new IllegalArgumentException(\"Invalid binary data: Expected map size 1, but was: \" + mapSize);\n                        }\n                        var value = refs[reference];\n                        if (!(value instanceof String)) {\n                            throw new IllegalArgumentException(\"Invalid binary data: Expected reference to meta type name, but was: \" + reference + \", \" + value);\n                        }\n                        metaType = (String) value;\n                        typeByte = input.readByte();\n                    } else if (typeByteTemp == JODA_TYPE_REF_KEY) {\n                        if (mapSize != 1) {\n                            throw new IllegalArgumentException(\"Invalid binary data: Expected map size 1, but was: \" + mapSize);\n                        }\n                        // Regular object that is re-referenced\n                        // ref is the key, so the rest of the object needs to be placed in refs[ref]\n                        ref = reference;\n                        if (ref < 0 || ref > refs.length) {\n                            throw new IllegalArgumentException(\"Invalid binary data: Expected reference to position less than \" + refs.length + \", but was: \" + ref);\n                        }\n                        typeByte = input.readByte();\n                    } else {\n                        input.reset();\n                        break;\n                    }\n                } else if (typeByteTemp == EXT_8) {\n                    var size = input.readUnsignedByte();\n                    typeByteTemp = input.readByte();\n                    if (typeByteTemp != JODA_TYPE_META) {\n                        throw new IllegalArgumentException(\"Invalid binary data: Expected meta information, but was: 0x\" + toHex(typeByteTemp));\n                    }\n                    if (mapSize != 1) {\n                        throw new IllegalArgumentException(\"Invalid binary data: Expected map size 1, but was: \" + mapSize);\n                    }\n                    metaType = acceptStringBytes(size);\n                    typeByte = input.readByte();\n                } else if (isMap(typeByteTemp)) {\n                    mapSize = acceptMap(typeByteTemp);\n                    typeByteTemp = input.readByte();\n                    // Check for nested JODA_TYPE_META with a reference as the key\n                    if (isIntExtension(typeByteTemp)) {\n                        var nestedTypeByteTemp = typeByteTemp;\n                        typeByteTemp = input.readByte();\n                        var reference = acceptIntExtension(nestedTypeByteTemp);\n                        if (typeByteTemp == JODA_TYPE_REF_KEY) {\n                            if (mapSize != 1) {\n                                throw new IllegalArgumentException(\"Invalid binary data: Expected map size 1, but was: \" + mapSize);\n                            }\n                            typeByteTemp = input.readByte();\n\n                            // Check for nested JODA_TYPE_META\n                            if (typeByteTemp == EXT_8) {\n                                var size = input.readUnsignedByte();\n                                typeByteTemp = input.readByte();\n                                // Meta is the only type serialized using EXT_8\n                                if (typeByteTemp != JODA_TYPE_META) {\n                                    throw new IllegalArgumentException(\"Invalid binary data: Expected previous metatype, but was: 0x\" + toHex(typeByteTemp));\n                                }\n                                metaType = acceptStringBytes(size);\n                                refs[reference] = metaType;\n                                typeByte = input.readByte();\n                            } else {\n                                input.reset();\n                                break;\n                            }\n                        } else {\n                            input.reset();\n                            break;\n                        }\n                    } else {\n                        input.reset();\n                        break;\n                    }\n                } else {\n                    input.reset();\n                    break;\n                }\n            } else {\n                input.reset();\n                break;\n            }\n        }\n\n        if (isArray(typeByte)) {\n            input.mark(11);\n            var arraySize = acceptArray(typeByte);\n            if (arraySize > 0) {\n                int typeByteTemp = input.readByte();\n                if (isIntExtension(typeByteTemp)) {\n                    var nestedTypeByteTemp = typeByteTemp;\n                    typeByteTemp = input.readByte();\n                    var reference = acceptIntExtension(nestedTypeByteTemp);\n\n                    if (typeByteTemp == JODA_TYPE_BEAN) {\n                        classInfo = classes[reference];\n                        var bean = parseBean(declaredType, rootType, classInfo, arraySize);\n                        if (ref != null) {\n                            refs[ref] = bean;\n                        }\n                        return bean;\n                    } else {\n                        input.reset();\n                    }\n                } else {\n                    input.reset();\n                }\n            } else {\n                input.reset();\n            }\n        }\n\n        if (isIntExtension(typeByte)) {\n            input.mark(5);\n            int typeByteTemp = input.readByte();\n            var reference = acceptIntExtension(typeByte);\n            // JODA_TYPE_REF is the only thing serialized in isolation, others are serialized as map keys or the start of an array\n            if (typeByteTemp != JODA_TYPE_REF) {\n                throw new IllegalArgumentException(\"Invalid binary data: Expected reference to previous object, but was: 0x\" + toHex(typeByteTemp));\n            }\n            var value = refs[reference];\n            if (value == null) {\n                throw new IllegalArgumentException(\"Invalid binary data: Expected reference to previous object, but was null: \" + reference);\n            }\n            return value;\n        }\n\n        if (classInfo != null) {\n            effectiveType = classInfo.type;\n        }\n        var value = parseObject(metaProp, beanType, parentIterable, effectiveType, metaType, typeByte);\n\n        if (ref != null) {\n            refs[ref] = value; // This object was keyed and is repeated\n        }\n\n        return value;\n    }\n\n    private Object parseObject(\n            MetaProperty<?> metaProp,\n            Class<?> beanType,\n            SerIterable parentIterable,\n            Class<?> effectiveType,\n            String metaType,\n            int typeByte) throws Exception {\n\n        // parse based on type\n        if (typeByte == NIL) {\n            return null;\n        }\n        if (Bean.class.isAssignableFrom(effectiveType)) {\n            if (isArray(typeByte)) {\n                var arraySize = acceptArray(typeByte);\n                var classInfo = classMap.computeIfAbsent(effectiveType, this::lookupClassInfo);\n                return parseBean(arraySize, classInfo);\n            } else {\n                return parseSimple(typeByte, effectiveType);\n            }\n        } else {\n            if (isMap(typeByte) || isArray(typeByte)) {\n                SerIterable childIterable = null;\n                if (metaType != null) {\n                    childIterable = settings.getIteratorFactory().createIterable(metaType, settings, null);\n                } else if (metaProp != null) {\n                    childIterable = settings.getIteratorFactory().createIterable(metaProp, beanType);\n                } else if (parentIterable != null) {\n                    childIterable = settings.getIteratorFactory().createIterable(parentIterable);\n                }\n                if (childIterable == null) {\n                    throw new IllegalArgumentException(\"Invalid binary data: Invalid metaType: \" + metaType);\n                }\n                return parseIterable(typeByte, childIterable);\n            } else {\n                return parseSimple(typeByte, effectiveType);\n            }\n        }\n    }\n\n    // looks up information of classes that are not known upfront, e.g. are used by custom de-serializers\n    private ClassInfo lookupClassInfo(Class<?> type) {\n        var deser = settings.getDeserializers().findDeserializer(type);\n        var metaBean = deser.findMetaBean(type);\n        if (metaBean == null) {\n            throw new RuntimeException(\"Could not find type: \" + type.getName());\n        }\n        var propertyCount = metaBean.metaPropertyCount();\n        var metaProperties = new MetaProperty[propertyCount];\n        var i = 0;\n        for (var metaProperty : metaBean.metaPropertyIterable()) {\n            metaProperties[i++] = metaProperty;\n        }\n        return new ClassInfo(type, metaProperties);\n    }\n\n    private Object parseBean(Class<?> declaredType, boolean rootType, ClassInfo classInfo, int arraySize) {\n        if (rootType) {\n            if (!Bean.class.isAssignableFrom(classInfo.type)) {\n                throw new IllegalArgumentException(\"Root type is not a Joda-Bean: \" + classInfo.type.getName());\n            }\n            overrideBasePackage = classInfo.type.getPackage().getName() + \".\";\n        }\n        if (!declaredType.isAssignableFrom(classInfo.type)) {\n            throw new IllegalArgumentException(\"Specified type is incompatible with declared type: \" + declaredType.getName() + \" and \" + classInfo.type.getName());\n        }\n        return parseBean(arraySize - 1, classInfo);\n    }\n\n    //-----------------------------------------------------------------------\n    private boolean isIntExtension(int typeByte) {\n        return typeByte == MsgPack.FIX_EXT_1 || typeByte == MsgPack.FIX_EXT_2 || typeByte == MsgPack.FIX_EXT_4;\n    }\n\n    private int acceptIntExtension(int typeByte) throws IOException {\n        return switch (typeByte) {\n            case MsgPack.FIX_EXT_1 -> input.readUnsignedByte();\n            case MsgPack.FIX_EXT_2 -> input.readUnsignedShort();\n            case MsgPack.FIX_EXT_4 -> input.readInt();\n            default -> throw new IllegalArgumentException(\n                    \"Invalid binary data: Expected int extension type, but was: 0x\" + toHex(typeByte));\n        };\n    }\n\n    //-----------------------------------------------------------------------\n    // The info needed to deserialize instances of a class with a reference to the initially serialized class definition\n    private static final class ClassInfo {\n\n        // The class itself\n        private final Class<?> type;\n\n        // The metaproperties (empty if not a bean) in the order in which they need to be serialized\n        private final MetaProperty<?>[] metaProperties;\n\n        private ClassInfo(Class<?> type, MetaProperty<?>[] metaProperties) {\n            this.type = type;\n            this.metaProperties = metaProperties;\n        }\n\n        @Override\n        public String toString() {\n            return \"ClassInfo{\" +\n                    \"type=\" + type +\n                    \", metaProperties=\" + Arrays.toString(metaProperties) +\n                    '}';\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/JodaBeanReferencingBinWriter.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.io.IOException;\nimport java.io.OutputStream;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerOptional;\nimport org.joda.beans.ser.SerTypeMapper;\n\n/**\n * Provides the ability for a Joda-Bean to written to the referencing binary format.\n */\nclass JodaBeanReferencingBinWriter extends AbstractBinWriter {\n\n    private BeanReferences references;\n\n    // creates an instance\n    JodaBeanReferencingBinWriter(JodaBeanSer settings, OutputStream output) {\n        super(settings, output);\n    }\n\n    //-----------------------------------------------------------------------\n    // writes the bean\n    void write(Bean bean) throws IOException {\n        if (!(bean instanceof ImmutableBean immutable)) {\n            throw new IllegalArgumentException(\n                    \"Referencing binary format can only write ImmutableBean instances: \" + bean.getClass().getName());\n        }\n        // sets up the map of beans - classes & classSerializationCount\n        references = BeanReferences.find(immutable, settings);\n\n        // write array of 4 items - Version, Ref Count, Class Info, Root Bean\n        output.writeArrayHeader(4);\n        output.writeInt(2);\n        writeClassDescriptions(references);\n        writeRootBean(bean, true);\n    }\n\n    // determines what beans occur more than once and setup references\n    private void writeClassDescriptions(BeanReferences references) throws IOException {\n        // write out ref count first, which is the number of instances that are referenced\n        output.writeInt(references.getReferences().size());\n\n        // write map of class name to a list of metatype names (which is empty if not a bean)\n        var classInfos = references.getClassInfoList();\n        output.writeMapHeader(classInfos.size());\n        for (var classInfo : classInfos) {\n            // known types parameter is null as we never serialize the class names again\n            var className = SerTypeMapper.encodeType(classInfo.type, settings, null, null);\n            output.writeString(className);\n\n            output.writeArrayHeader(classInfo.metaProperties.size());\n            for (MetaProperty<?> property : classInfo.metaProperties) {\n                output.writeString(property.name());\n            }\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    void writeBean(Bean bean, Class<?> declaredType, RootType rootTypeFlag) throws IOException {\n        var ref = references.getReferences().get(bean);\n        if (ref != null) {\n            if (ref.hasBeenSerialized) {\n                output.writePositiveExtensionInt(MsgPack.JODA_TYPE_REF, ref.position);\n                return;\n            }\n            output.writeMapHeader(1);\n            output.writePositiveExtensionInt(MsgPack.JODA_TYPE_REF_KEY, ref.position);\n        }\n\n        var classInfo = references.getClassInfo(bean.getClass());\n        var props = classInfo.metaProperties;\n        var count = props.size();\n        var values = new Object[count];\n        var size = 0;\n        for (var prop : props) {\n            var value = SerOptional.extractValue(prop, bean);\n            values[size++] = value;\n        }\n\n        if (rootTypeFlag == RootType.ROOT_WITH_TYPE || (rootTypeFlag == RootType.NOT_ROOT && bean.getClass() != declaredType)) {\n            output.writeArrayHeader(size + 1);\n            output.writePositiveExtensionInt(MsgPack.JODA_TYPE_BEAN, classInfo.position);\n        } else {\n            output.writeArrayHeader(size);\n        }\n\n        for (var i = 0; i < size; i++) {\n            var prop = props.get(i);\n            var value = values[i];\n            var propType = SerOptional.extractType(prop, bean.getClass());\n\n            if (value == null) {\n                output.writeNil();\n                continue;\n            }\n\n            if (value instanceof Bean beanValue) {\n                if (settings.getConverter().isConvertible(value.getClass())) {\n                    writeSimple(propType, value);\n                } else {\n                    writeBean(beanValue, propType, RootType.NOT_ROOT);\n                }\n            } else {\n                var itemIterator = settings.getIteratorFactory().create(value, prop, bean.getClass());\n                if (itemIterator != null) {\n                    writeElements(itemIterator);\n                } else {\n                    writeSimple(propType, value);\n                }\n            }\n        }\n        if (ref != null) {\n            ref.sent();\n        }\n    }\n\n    @Override\n    void writeMetaPropertyReference(String metaTypeName) throws IOException {\n        var ref = references.getReferences().get(metaTypeName);\n        if (ref != null) {\n            if (ref.hasBeenSerialized) {\n                output.writePositiveExtensionInt(MsgPack.JODA_TYPE_META, ref.position);\n            } else {\n                output.writeMapHeader(1);\n                output.writePositiveExtensionInt(MsgPack.JODA_TYPE_REF_KEY, ref.position);\n                output.writeExtensionString(MsgPack.JODA_TYPE_META, metaTypeName);\n                ref.sent();\n            }\n        } else {\n            output.writeExtensionString(MsgPack.JODA_TYPE_META, metaTypeName);\n        }\n    }\n\n    @Override\n    Class<?> getAndSerializeEffectiveTypeIfRequired(Object value, Class<?> declaredType) throws IOException {\n        var ref = references.getReferences().get(value);\n        if (ref != null && ref.hasBeenSerialized) {\n            // Don't need to change types if using a reference\n            return declaredType;\n        }\n        var realType = value.getClass();\n        var effectiveType = declaredType;\n        if (declaredType == Object.class) {\n            if (realType != String.class) {\n                effectiveType = settings.getConverter().findTypedConverter(realType).getEffectiveType();\n                var classInfo = references.getClassInfo(effectiveType);\n                output.writeMapHeader(1);\n                output.writePositiveExtensionInt(MsgPack.JODA_TYPE_DATA, classInfo.position);\n            } else {\n                effectiveType = realType;\n            }\n        } else if (!settings.getConverter().isConvertible(declaredType)) {\n            effectiveType = settings.getConverter().findTypedConverter(realType).getEffectiveType();\n            var classInfo = references.getClassInfo(effectiveType);\n            output.writeMapHeader(1);\n            output.writePositiveExtensionInt(MsgPack.JODA_TYPE_DATA, classInfo.position);\n        }\n        return effectiveType;\n    }\n\n    @Override\n    void writeObjectAsString(Object value, Class<?> effectiveType) throws IOException {\n        var ref = references.getReferences().get(value);\n        if (ref != null && ref.hasBeenSerialized) {\n            output.writePositiveExtensionInt(MsgPack.JODA_TYPE_REF, ref.position);\n        } else {\n            var converted = settings.getConverter().convertToString(effectiveType, value);\n            if (converted == null) {\n                throw new IllegalArgumentException(\"Unable to write because converter returned a null string: \" + value);\n            }\n            if (ref != null) {\n                output.writeMapHeader(1);\n                output.writePositiveExtensionInt(MsgPack.JODA_TYPE_REF_KEY, ref.position);\n                output.writeString(converted);\n                ref.sent();\n            } else {\n                output.writeString(converted);\n            }\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/JodaBeanStandardBinReader.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.io.DataInputStream;\n\nimport org.joda.beans.ser.JodaBeanSer;\n\n/**\n * Provides the ability for a Joda-Bean to read from the standard binary format.\n */\nclass JodaBeanStandardBinReader extends AbstractBinReader {\n\n    // creates an instance\n    JodaBeanStandardBinReader(JodaBeanSer settings, DataInputStream input) {\n        super(settings, input);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/JodaBeanStandardBinWriter.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.lang.reflect.Array;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.Set;\nimport java.util.Spliterator;\nimport java.util.stream.StreamSupport;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ResolvedType;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerTypeMapper;\nimport org.joda.collect.grid.Grid;\nimport org.joda.collect.grid.ImmutableGrid;\n\nimport com.google.common.collect.BiMap;\nimport com.google.common.collect.ImmutableMap;\nimport com.google.common.collect.ImmutableMultiset;\nimport com.google.common.collect.ListMultimap;\nimport com.google.common.collect.Multimap;\nimport com.google.common.collect.Multiset;\nimport com.google.common.collect.SetMultimap;\nimport com.google.common.collect.Table;\n\n/**\n * Writes a Joda-Bean in standard binary format.\n * <p>\n * This class contains mutable state and cannot be used from multiple threads.\n * A new instance must be created for each message.\n */\nfinal class JodaBeanStandardBinWriter {\n\n    // why is there an ugly ClassValue setup here?\n    // because this is O(1) whereas switch with pattern match which is O(n)\n    private static final ClassValue<BinHandler<Object>> LOOKUP = new ClassValue<>() {\n\n        @SuppressWarnings(\"rawtypes\")  // sneaky use of raw type to allow typed value in each method below\n        @Override\n        protected BinHandler computeValue(Class<?> type) {\n            if (Bean.class.isAssignableFrom(type)) {\n                return (BinHandler<Bean>) JodaBeanStandardBinWriter::writeBeanMaybeSimple;\n            }\n            // these primitive types are always written and interpretted without a type\n            if (type == String.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeString((String) value);\n            }\n            if (type == Integer.class || type == int.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeInt((Integer) value);\n            }\n            if (type == Double.class || type == double.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeDouble((Double) value);\n            }\n            if (type == Float.class || type == float.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeFloat((Float) value);\n            }\n            if (type == Boolean.class || type == boolean.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeBoolean((Boolean) value);\n            }\n            return BaseBinHandlers.INSTANCE.createHandler(type);\n        }\n    };\n\n    /**\n     * The settings to use.\n     */\n    private final JodaBeanSer settings;\n    /**\n     * The outputter.\n     */\n    private final MsgPackOutput output;\n    /**\n     * The base package including the trailing dot.\n     */\n    private String basePackage;\n    /**\n     * The known types.\n     */\n    private final Map<Class<?>, String> knownTypes = new HashMap<>();\n\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings to use, not null\n     * @param out  the output stream, not null\n     */\n    JodaBeanStandardBinWriter(JodaBeanSer settings, OutputStream out) {\n        this.settings = settings;\n        this.output = new MsgPackOutput(out);\n    }\n\n    //-------------------------------------------------------------------------\n    /**\n     * Writes the bean to the {@code OutputStream}.\n     * \n     * @param bean  the bean to output, not null\n     * @param includeRootType  whether to include the root type\n     * @throws IOException if an error occurs\n     */\n    void write(Bean bean, boolean includeRootType) throws IOException {\n        var rootType = includeRootType ? ResolvedType.OBJECT : ResolvedType.of(bean.getClass());\n        output.writeArrayHeader(2);\n        output.writeInt(1);  // version 1\n        // root always outputs the bean, not Joda-Convert form\n        writeBean(rootType, \"\", bean, includeRootType);\n    }\n\n    //-----------------------------------------------------------------------\n    // writes an object, by determining the runtime type\n    private void writeObject(ResolvedType declaredType, String propertyName, Object value) throws IOException {\n        if (value == null) {\n            output.writeNil();\n        } else {\n            var handler = LOOKUP.get(value.getClass());\n            handler.handle(this, declaredType, propertyName, value);\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    // writes a bean, favouring output as a Joda-Convert type\n    private void writeBeanMaybeSimple(ResolvedType declaredType, String propertyName, Bean bean) throws IOException {\n        // check for Joda-Convert cannot be in ClassValue as it relies on the settings\n        if (settings.getConverter().isConvertible(bean.getClass())) {\n            writeSimple(declaredType, propertyName, bean);\n        } else {\n            writeBean(declaredType, propertyName, bean, false);\n        }\n    }\n\n    // writes a bean, with meta type information if necessary\n    private void writeBean(ResolvedType declaredType, String propertyName, Bean bean, boolean isRootAndInclRootType) throws IOException {\n        // have to determine the number of properties being output before starting to write\n        var count = bean.metaBean().metaPropertyCount();\n        var propHandlers = new PropertyHandler[count];\n        var size = 0;\n        for (var metaProperty : bean.metaBean().metaPropertyIterable()) {\n            if (settings.isSerialized(metaProperty)) {\n                var value = metaProperty.get(bean);\n                if (value != null) {\n                    var resolvedType = metaProperty.propertyResolvedType(bean.getClass());\n                    var handler = LOOKUP.get(value.getClass());\n                    // package up each write in a lambda, avoiding a second lookup\n                    var propHandler = handler.handleProperty(this, resolvedType, metaProperty.name(), value);\n                    if (propHandler != null) {\n                        propHandlers[size++] = propHandler;\n                    }\n                }\n            }\n        }\n        // write out the header, potentially including the type\n        if (bean.getClass() != declaredType.getRawType()) {\n            var typeStr = SerTypeMapper.encodeType(bean.getClass(), settings, basePackage, knownTypes);\n            if (isRootAndInclRootType) {\n                basePackage = bean.getClass().getPackage().getName() + \".\";\n            }\n            output.writeMapHeader(size + 1);\n            output.writeExtensionString(MsgPack.JODA_TYPE_BEAN, typeStr);\n            output.writeNil();\n        } else {\n            output.writeMapHeader(size);\n        }\n        // write each property\n        for (int i = 0; i < size; i++) {\n            propHandlers[i].handle();\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    // writes a simple type, with meta type information if necessary\n    private void writeSimple(ResolvedType declaredType, String propertyName, Object value) throws IOException {\n        // when int/double/float/boolean are parsed they are treated as being of that exact type\n        // long/short/byte require type metadata\n        // also handle no declared type and subclasses\n        var effectiveType = getAndSerializeEffectiveTypeIfRequired(value, declaredType.getRawType());\n        // currently favouring == checks over pattern match switch\n        var type = value.getClass();\n        if (type == Long.class) {\n            output.writeLong((Long) value);\n        } else if (type == Short.class) {\n            output.writeInt((Short) value);\n        } else if (type == Byte.class) {\n            output.writeInt((Byte) value);\n        } else if (type == byte[].class) {\n            output.writeBytes((byte[]) value);\n        } else {\n            writeJodaConvert(effectiveType, propertyName, value);\n        }\n    }\n\n    // called when serializing an object in {@link #writeSimple(Class, Object)}, to get the effective type of the\n    // object and if necessary to serialize the class information\n    // needs to handle no declared type and subclass instances\n    private Class<?> getAndSerializeEffectiveTypeIfRequired(Object value, Class<?> declaredType) throws IOException {\n        var realType = value.getClass();\n        if (declaredType == Object.class) {\n            if (realType != String.class) {\n                var effectiveType = settings.getConverter().findTypedConverter(realType).getEffectiveType();\n                output.writeMapHeader(1);\n                var type = SerTypeMapper.encodeType(effectiveType, settings, basePackage, knownTypes);\n                output.writeExtensionString(MsgPack.JODA_TYPE_DATA, type);\n                return effectiveType;\n            } else {\n                return realType;\n            }\n        }\n        if (!settings.getConverter().isConvertible(declaredType)) {\n            var effectiveType = settings.getConverter().findTypedConverter(realType).getEffectiveType();\n            output.writeMapHeader(1);\n            var type = SerTypeMapper.encodeType(effectiveType, settings, basePackage, knownTypes);\n            output.writeExtensionString(MsgPack.JODA_TYPE_DATA, type);\n            return effectiveType;\n        }\n        return declaredType;\n    }\n\n    // writes the object as a String using Joda-Convert\n    private void writeJodaConvert(Class<?> effectiveType, String propertyName, Object value) throws IOException {\n        try {\n            var converted = settings.getConverter().convertToString(effectiveType, value);\n            if (converted == null) {\n                throw invalidNullString(propertyName, value);\n            }\n            output.writeString(converted);\n        } catch (RuntimeException ex) {\n            throw invalidConversionMsg(propertyName, value, ex);\n        }\n    }\n\n    private static IllegalArgumentException invalidNullString(String propertyName, Object value) throws IOException {\n        return new IllegalArgumentException(\n                \"Unable to write property '\" + propertyName + \"' because converter returned a null string: \" + value);\n    }\n\n    private IllegalArgumentException invalidConversionMsg(String propertyName, Object value, RuntimeException ex) {\n        var msg = \"Unable to write property '\" + propertyName + \"', type \" +\n                value.getClass().getName() + \" could not be converted to a String\";\n        return new IllegalArgumentException(msg, ex);\n    }\n\n    // writes the meta type header\n    private static final void writeMetaType(JodaBeanStandardBinWriter writer, String metaTypeName) throws IOException {\n        writer.output.writeMapHeader(1);\n        writer.output.writeExtensionString(MsgPack.JODA_TYPE_META, metaTypeName);\n    }\n\n    // gets the weakened type, which exists for backwards compatibility\n    // once the parser can handle ResolvedType this method can, in theory, be removed\n    private static ResolvedType toWeakenedType(ResolvedType base) {\n        for (var arg : base.getArguments()) {\n            var rawType = arg.getRawType();\n            if (LOOKUP.get(rawType).isCollection(rawType)) {\n                return base.toRaw();\n            }\n        }\n        return base;\n    }\n\n    //-------------------------------------------------------------------------\n    private static interface BinHandler<T> {\n        public abstract void handle(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                T obj) throws IOException;\n\n        public default PropertyHandler handleProperty(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                T obj) {\n\n            return () -> {\n                writer.output.writeString(propertyName);\n                handle(writer, declaredType, propertyName, obj);\n            };\n        }\n\n        public default boolean isCollection(Class<?> type) {\n            return false;\n        }\n    }\n\n    private static interface CollectionBinHandler<T> extends BinHandler<T> {\n        @Override\n        public default boolean isCollection(Class<?> type) {\n            return true;\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    // like Runnable, but with IOException\n    private static interface PropertyHandler {\n        public abstract void handle() throws IOException;\n    }\n\n    //-------------------------------------------------------------------------\n    // handles base JDK collections\n    private static sealed class BaseBinHandlers {\n\n        // an instance loaded dependent on the classpath\n        private static final BaseBinHandlers INSTANCE = getInstance();\n\n        private static final BaseBinHandlers getInstance() {\n            try {\n                ImmutableGrid.of();  // check if class is available\n                return new CollectBinHandlers();\n            } catch (Exception | LinkageError ex) {\n                try {\n                    ImmutableMultiset.of();  // check if class is available\n                    return new GuavaBinHandlers();\n                } catch (Exception | LinkageError ex2) {\n                    return new BaseBinHandlers();\n                }\n            }\n        }\n\n        // creates the handler, called from ClassValue.computeValue()\n        BinHandler<?> createHandler(Class<?> type) {\n            if (type == Optional.class) {\n                return OptionalBinHandler.INSTANCE;\n            }\n            if (type.isArray()) {\n                var componentType = type.getComponentType();\n                if (componentType.isPrimitive()) {\n                    if (componentType == byte.class) {\n                        return JodaBeanStandardBinWriter::writeSimple;\n                    } else {\n                        return (CollectionBinHandler<Object>) BaseBinHandlers::writePrimitiveArray;\n                    }\n                } else {\n                    return (CollectionBinHandler<Object[]>) BaseBinHandlers::writeArray;\n                }\n            }\n            if (Map.class.isAssignableFrom(type)) {\n                return (CollectionBinHandler<Map<?, ?>>) BaseBinHandlers::writeMap;\n            }\n            if (Collection.class.isAssignableFrom(type)) {\n                return (CollectionBinHandler<Collection<?>>) BaseBinHandlers::writeCollection;\n            }\n            if (Iterable.class.isAssignableFrom(type)) {\n                return (CollectionBinHandler<Iterable<?>>) BaseBinHandlers::writeIterable;\n            }\n            return JodaBeanStandardBinWriter::writeSimple;\n        }\n\n        // writes an array, with meta type information if necessary\n        private static void writeArray(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Object[] array) throws IOException {\n\n            // write actual type\n            var valueType = array.getClass().getComponentType();\n            if (valueType == Object.class && !Object[].class.isAssignableFrom(declaredType.getRawType())) {\n                writeMetaType(writer, metaTypeArrayName(valueType));\n            } else if (valueType == String.class && !String[].class.isAssignableFrom(declaredType.getRawType())) {\n                writeMetaType(writer, metaTypeArrayName(valueType));\n            }\n            // write content\n            var componentType = toWeakenedType(declaredType.toComponentType());\n            writer.output.writeArrayHeader(array.length);\n            for (var item : array) {\n                writer.writeObject(componentType, \"\", item);\n            }\n        }\n\n        // writes a primitive array, with meta type information if necessary\n        private static void writePrimitiveArray(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Object array) throws IOException {\n\n            // write actual type\n            var valueType = array.getClass().getComponentType();\n            if (!declaredType.isArray()) {\n                writeMetaType(writer, metaTypeArrayName(valueType));\n            }\n            // write content\n            var componentType = declaredType.toComponentType();\n            var handler = JodaBeanStandardBinWriter.LOOKUP.get(componentType.getRawType());\n            var arrayLength = Array.getLength(array);\n            writer.output.writeArrayHeader(arrayLength);\n            for (int i = 0; i < arrayLength; i++) {\n                handler.handle(writer, componentType, propertyName, Array.get(array, i));\n            }\n        }\n\n        // determines the meta type name to use\n        private static String metaTypeArrayName(Class<?> valueType) {\n            if (valueType.isArray()) {\n                return metaTypeArrayName(valueType.getComponentType()) + \"[]\";\n            }\n            if (valueType == Object.class) {\n                return \"Object[]\";\n            }\n            if (valueType == String.class) {\n                return \"String[]\";\n            }\n            return valueType.getName() + \"[]\";\n        }\n\n        // writes an iterable, with meta type information if necessary\n        private static void writeIterable(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Iterable<?> iterable) throws IOException {\n\n            // convert to a list, which is necessary as there is no size() on Iterable\n            // this ensures that the generics of the iterable are retained\n            var list = StreamSupport.stream(iterable::spliterator, Spliterator.ORDERED, false).toList();\n            var adjustedType = ResolvedType.of(List.class, declaredType.getArguments());\n            writeCollection(writer, adjustedType, propertyName, list);\n        }\n\n        // writes a collection, with meta type information if necessary\n        private static void writeCollection(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Collection<?> coll) throws IOException {\n\n            // write actual type\n            if (coll instanceof Set && !Set.class.isAssignableFrom(declaredType.getRawType())) {\n                writeMetaType(writer, \"Set\");\n            } else if (coll instanceof List && !List.class.isAssignableFrom(declaredType.getRawType())) {\n                writeMetaType(writer, \"List\");\n            } else if (!Collection.class.isAssignableFrom(declaredType.getRawType())) {\n                writeMetaType(writer, \"Collection\");\n            }\n            // write content\n            var itemType = toWeakenedType(declaredType.getArgumentOrDefault(0));\n            writer.output.writeArrayHeader(coll.size());\n            for (var item : coll) {\n                writer.writeObject(itemType, \"\", item);\n            }\n        }\n\n        // writes a map, with meta type information if necessary\n        private static void writeMap(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Map<?, ?> map) throws IOException {\n\n            // write actual type\n            if (!Map.class.isAssignableFrom(declaredType.getRawType())) {\n                writeMetaType(writer, \"Map\");\n            }\n            // write content\n            writeMapEntries(writer, declaredType, propertyName, map.entrySet());\n        }\n\n        // writes a map given map entries, code shared with Multimap\n        static <K, V> void writeMapEntries(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Collection<Map.Entry<K, V>> mapEntries) throws IOException {\n\n            var keyType = toWeakenedType(declaredType.getArgumentOrDefault(0));\n            var valueType = toWeakenedType(declaredType.getArgumentOrDefault(1));\n            writer.output.writeMapHeader(mapEntries.size());\n            for (var entry : mapEntries) {\n                writer.writeObject(keyType, \"\", entry.getKey());\n                writer.writeObject(valueType, \"\", entry.getValue());\n            }\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    private static sealed class GuavaBinHandlers extends BaseBinHandlers {\n\n        @Override\n        BinHandler<?> createHandler(Class<?> type) {\n            if (Multimap.class.isAssignableFrom(type)) {\n                return (CollectionBinHandler<Multimap<?, ?>>) GuavaBinHandlers::writeMultimap;\n            }\n            if (Multiset.class.isAssignableFrom(type)) {\n                return (CollectionBinHandler<Multiset<?>>) GuavaBinHandlers::writeMultiset;\n            }\n            if (Table.class.isAssignableFrom(type)) {\n                return (CollectionBinHandler<Table<?, ?, ?>>) GuavaBinHandlers::writeTable;\n            }\n            if (BiMap.class.isAssignableFrom(type)) {\n                return (CollectionBinHandler<BiMap<?, ?>>) GuavaBinHandlers::writeBiMap;\n            }\n            if (com.google.common.base.Optional.class.isAssignableFrom(type)) {\n                return GuavaOptionalBinHandler.INSTANCE;\n            }\n            return super.createHandler(type);\n        }\n\n        // writes a multimap, with meta type information if necessary\n        private static void writeMultimap(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Multimap<?, ?> mmap) throws IOException {\n\n            // write actual type\n            if (mmap instanceof SetMultimap && !SetMultimap.class.isAssignableFrom(declaredType.getRawType())) {\n                writeMetaType(writer, \"SetMultimap\");\n            } else if (mmap instanceof ListMultimap && !ListMultimap.class.isAssignableFrom(declaredType.getRawType())) {\n                writeMetaType(writer, \"ListMultimap\");\n            } else if (!Multimap.class.isAssignableFrom(declaredType.getRawType())) {\n                writeMetaType(writer, \"Multimap\");\n            }\n            // write content, using a map with repeated keys\n            writeMapEntries(writer, declaredType, propertyName, mmap.entries());\n        }\n\n        // writes a multiset, with meta type information if necessary\n        private static void writeMultiset(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Multiset<?> mset) throws IOException {\n\n            // write actual type\n            if (!Multiset.class.isAssignableFrom(declaredType.getRawType())) {\n                writeMetaType(writer, \"Multiset\");\n            }\n            // write content, using a map of value to count\n            var valueType = toWeakenedType(declaredType.getArgumentOrDefault(0));\n            var entrySet = mset.entrySet();\n            writer.output.writeMapHeader(entrySet.size());\n            for (var entry : entrySet) {\n                writer.writeObject(valueType, \"\", entry.getElement());\n                writer.output.writeInt(entry.getCount());\n            }\n        }\n\n        // writes a table, with meta type information if necessary\n        private static void writeTable(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Table<?, ?, ?> table) throws IOException {\n\n            // write actual type\n            if (!Table.class.isAssignableFrom(declaredType.getRawType())) {\n                writeMetaType(writer, \"Table\");\n            }\n            // write content, using an array of cells\n            var rowType = toWeakenedType(declaredType.getArgumentOrDefault(0));\n            var columnType = toWeakenedType(declaredType.getArgumentOrDefault(1));\n            var valueType = toWeakenedType(declaredType.getArgumentOrDefault(2));\n            writer.output.writeArrayHeader(table.size());\n            for (var cell : table.cellSet()) {\n                writer.output.writeArrayHeader(3);\n                writer.writeObject(rowType, \"\", cell.getRowKey());\n                writer.writeObject(columnType, \"\", cell.getColumnKey());\n                writer.writeObject(valueType, \"\", cell.getValue());\n            }\n        }\n\n        // writes a BiMap, with meta type information if necessary\n        private static void writeBiMap(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                BiMap<?, ?> biMap) throws IOException {\n\n            // write actual type\n            if (!BiMap.class.isAssignableFrom(declaredType.getRawType())) {\n                // hack around Guava annoyance by assuming that size 0 and 1 ImmutableBiMap\n                // was actually meant to be an ImmutableMap\n                if ((declaredType.getRawType() != Map.class && declaredType.getRawType() != ImmutableMap.class) || biMap.size() >= 2) {\n                    writeMetaType(writer, \"BiMap\");\n                } else if (!Map.class.isAssignableFrom(declaredType.getRawType())) {\n                    writeMetaType(writer, \"Map\");\n                }\n            }\n            // write content\n            writeMapEntries(writer, declaredType, propertyName, biMap.entrySet());\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    private static final class CollectBinHandlers extends GuavaBinHandlers {\n\n        @Override\n        BinHandler<?> createHandler(Class<?> type) {\n            if (Grid.class.isAssignableFrom(type)) {\n                return (CollectionBinHandler<Grid<?>>) CollectBinHandlers::writeGrid;\n            }\n            return super.createHandler(type);\n        }\n\n        // writes a grid, with meta type information if necessary\n        private static void writeGrid(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Grid<?> grid) throws IOException {\n\n            // write actual type\n            if (!Grid.class.isAssignableFrom(declaredType.getRawType())) {\n                writeMetaType(writer, \"Grid\");\n            }\n            // write content using sparse or dense approach\n            var valueType = toWeakenedType(declaredType.getArgumentOrDefault(0));\n            var rows = grid.rowCount();\n            var columns = grid.columnCount();\n            var totalSize = rows * columns;\n            var gridSize = grid.size();\n            if (gridSize < (totalSize / 4)) {\n                // sparse\n                writer.output.writeArrayHeader(gridSize + 2);\n                writer.output.writeInt(rows);\n                writer.output.writeInt(columns);\n                for (var cell : grid.cells()) {\n                    writer.output.writeArrayHeader(3);\n                    writer.output.writeInt(cell.getRow());\n                    writer.output.writeInt(cell.getColumn());\n                    writer.writeObject(valueType, \"\", cell.getValue());\n                }\n            } else {\n                // dense\n                writer.output.writeArrayHeader(totalSize + 2);\n                writer.output.writeInt(rows);\n                writer.output.writeInt(columns);\n                for (var row = 0; row < rows; row++) {\n                    for (var column = 0; column < columns; column++) {\n                        writer.writeObject(valueType, \"\", grid.get(row, column));\n                    }\n                }\n            }\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    static final class OptionalBinHandler implements BinHandler<Optional<?>> {\n        private static final OptionalBinHandler INSTANCE = new OptionalBinHandler();\n\n        // when Optional is not a property, it is processed as a kind of collection\n        @Override\n        public void handle(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Optional<?> opt) throws IOException {\n\n            if (!Optional.class.isAssignableFrom(declaredType.getRawType())) {\n                writeMetaType(writer, \"Optional\");\n            }\n            var valueType = declaredType.getArgumentOrDefault(0).toRaw();\n            writer.writeObject(valueType, \"\", opt.orElse(null));\n        }\n\n        // when Optional is a property, it is ignored if empty\n        @Override\n        public PropertyHandler handleProperty(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Optional<?> opt) {\n\n            return opt\n                    .map(value -> (PropertyHandler) () -> {\n                        var valueType = declaredType.getArgumentOrDefault(0).toRaw();\n                        writer.output.writeString(propertyName);\n                        writer.writeObject(valueType, propertyName, value);\n                    })\n                    .orElse(null);\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    static final class GuavaOptionalBinHandler implements BinHandler<com.google.common.base.Optional<?>> {\n        private static final GuavaOptionalBinHandler INSTANCE = new GuavaOptionalBinHandler();\n\n        // when Optional is not a property, it is processed as a kind of collection\n        @Override\n        public void handle(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                com.google.common.base.Optional<?> opt) throws IOException {\n\n            if (!com.google.common.base.Optional.class.isAssignableFrom(declaredType.getRawType())) {\n                writeMetaType(writer, \"GuavaOptional\");\n            }\n            // write content\n            var valueType = declaredType.getArgumentOrDefault(0).toRaw();\n            writer.writeObject(valueType, \"\", opt.orNull());\n        }\n\n        // when Optional is a property, it is ignored if empty\n        @Override\n        public PropertyHandler handleProperty(\n                JodaBeanStandardBinWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                com.google.common.base.Optional<?> opt) {\n\n            return opt\n                    .transform(value -> (PropertyHandler) () -> {\n                        var valueType = declaredType.getArgumentOrDefault(0).toRaw();\n                        writer.output.writeString(propertyName);\n                        writer.writeObject(valueType, propertyName, value);\n                    })\n                    .orNull();\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/MsgPack.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.nio.charset.Charset;\nimport java.nio.charset.StandardCharsets;\n\n/**\n * Constants used in MsgPack binary serialization.\n * <p>\n * This uses the v2.0 specification of MsgPack as of 2014-01-29.\n */\nabstract class MsgPack {\n\n    /**\n     * UTF-8 encoding.\n     */\n    static final Charset UTF_8 = StandardCharsets.UTF_8;\n    /**\n     * Maximum fixed int.\n     */\n    static final int MAX_FIX_INT = 0x7F;\n    /**\n     * Minimum fixed int.\n     */\n    static final int MIN_FIX_INT = 0xFFFFFFE0;\n    /**\n     * Min fixed map - up to length 15.\n     */\n    static final int MIN_FIX_MAP = 0xFFFFFF80;\n    /**\n     * Max fixed map.\n     */\n    static final int MAX_FIX_MAP = 0xFFFFFF8F;\n    /**\n     * Min fixed array - up to length 15.\n     */\n    static final int MIN_FIX_ARRAY = 0xFFFFFF90;\n    /**\n     * Max fixed array.\n     */\n    static final int MAX_FIX_ARRAY = 0xFFFFFF9F;\n    /**\n     * Min fixed string - up to length 31.\n     */\n    static final int MIN_FIX_STR = 0xFFFFFFA0;\n    /**\n     * Max fixed string.\n     */\n    static final int MAX_FIX_STR = 0xFFFFFFBF;\n    /**\n     * Nil.\n     */\n    static final int NIL = 0xFFFFFFC0;\n    /**\n     * False.\n     */\n    static final int FALSE = 0xFFFFFFC2;\n    /**\n     * True.\n     */\n    static final int TRUE = 0xFFFFFFC3;\n    /**\n     * Binary - up to length 255.\n     */\n    static final int BIN_8 = 0xFFFFFFC4;\n    /**\n     * Binary - up to length (2^16)-1.\n     */\n    static final int BIN_16 = 0xFFFFFFC5;\n    /**\n     * Binary - up to length (2^32)-1.\n     */\n    static final int BIN_32 = 0xFFFFFFC6;\n    /**\n     * Extension - up to length 255.\n     */\n    static final int EXT_8 = 0xFFFFFFC7;\n    /**\n     * Extension - up to length (2^16)-1.\n     */\n    static final int EXT_16 = 0xFFFFFFC8;\n    /**\n     * Extension - up to length (2^32)-1.\n     */\n    static final int EXT_32 = 0xFFFFFFC9;\n    /**\n     * Float - 4 bytes.\n     */\n    static final int FLOAT_32 = 0xFFFFFFCA;\n    /**\n     * Double - 8 bytes.\n     */\n    static final int FLOAT_64 = 0xFFFFFFCB;\n    /**\n     * Int (unsigned) - up to 1 byte.\n     */\n    static final int UINT_8 = 0xFFFFFFCC;\n    /**\n     * Int (unsigned) - up to 2 bytes.\n     */\n    static final int UINT_16 = 0xFFFFFFCD;\n    /**\n     * Int (unsigned) - up to 4 bytes.\n     */\n    static final int UINT_32 = 0xFFFFFFCE;\n    /**\n     * Int (unsigned) - up to 8 bytes.\n     */\n    static final int UINT_64 = 0xFFFFFFCF;\n    /**\n     * Int (signed) - up to 1 byte.\n     */\n    static final int SINT_8 = 0xFFFFFFD0;\n    /**\n     * Int (signed) - up to 2 bytes.\n     */\n    static final int SINT_16 = 0xFFFFFFD1;\n    /**\n     * Int (signed) - up to 4 bytes.\n     */\n    static final int SINT_32 = 0xFFFFFFD2;\n    /**\n     * Int (signed) - up to 8 bytes.\n     */\n    static final int SINT_64 = 0xFFFFFFD3;\n    /**\n     * Fixed extension - 1 byte.\n     */\n    static final int FIX_EXT_1 = 0xFFFFFFD4;\n    /**\n     * Fixed extension - 2 bytes.\n     */\n    static final int FIX_EXT_2 = 0xFFFFFFD5;\n    /**\n     * Fixed extension - 4 bytes.\n     */\n    static final int FIX_EXT_4 = 0xFFFFFFD6;\n    /**\n     * Fixed extension - 8 bytes.\n     */\n    static final int FIX_EXT_8 = 0xFFFFFFD7;\n    /**\n     * Fixed extension - 16 bytes.\n     */\n    static final int FIX_EXT_16 = 0xFFFFFFD8;\n    /**\n     * String - up to length 255.\n     */\n    static final int STR_8 = 0xFFFFFFD9;\n    /**\n     * String - up to length (2^16)-1.\n     */\n    static final int STR_16 = 0xFFFFFFDA;\n    /**\n     * String - up to length (2^32)-1.\n     */\n    static final int STR_32 = 0xFFFFFFDB;\n    /**\n     * Array - up to length (2^16)-1.\n     */\n    static final int ARRAY_16 = 0xFFFFFFDC;\n    /**\n     * Array - up to length (2^32)-1.\n     */\n    static final int ARRAY_32 = 0xFFFFFFDD;\n    /**\n     * Map - up to length (2^16)-1.\n     */\n    static final int MAP_16 = 0xFFFFFFDE;\n    /**\n     * Map - up to length (2^32)-1.\n     */\n    static final int MAP_32 = 0xFFFFFFDF;\n\n    /**\n     * Extension type code for a Joda-Bean bean-type.\n     */\n    static final int JODA_TYPE_BEAN = 32;\n    /**\n     * Extension type code for a Joda-Bean simple-type.\n     */\n    static final int JODA_TYPE_DATA = 33;\n    /**\n     * Extension type code for a Joda-Bean meta-type.\n     */\n    static final int JODA_TYPE_META = 34;\n    /**\n     * Extension type code for a Joda-Bean serialized reference.\n     */\n    static final int JODA_TYPE_REF_KEY = 35;\n    /**\n     * Extension type code for a reference to a previously serialized Joda-Bean.\n     */\n    static final int JODA_TYPE_REF = 36;\n\n    //-----------------------------------------------------------------------\n    /**\n     * Converts a byte to a hex string for debugging.\n     * \n     * @param b  the byte\n     * @return the two character hex equivalent, not null\n     */\n    static String toHex(int b) {\n        return String.format(\"%02X\", (byte) b);\n    }\n\n    static boolean isMap(int typeByte) {\n        return (typeByte >= MIN_FIX_MAP && typeByte <= MAX_FIX_MAP) || typeByte == MAP_16 || typeByte == MAP_32;\n    }\n\n    static boolean isArray(int typeByte) {\n        return (typeByte >= MIN_FIX_ARRAY && typeByte <= MAX_FIX_ARRAY) || typeByte == ARRAY_16 || typeByte == ARRAY_32;\n    }\n\n    static boolean isString(int typeByte) {\n        return (typeByte >= MIN_FIX_STR && typeByte <= MAX_FIX_STR) || typeByte == STR_8 || typeByte == STR_16 || typeByte == STR_32;\n    }\n\n    static boolean isIntegral(int typeByte) {\n        return (typeByte >= MIN_FIX_INT && typeByte <= MAX_FIX_INT) ||\n                typeByte == UINT_8 || typeByte == UINT_16 || typeByte == UINT_32 || typeByte == UINT_64 ||\n                typeByte == SINT_8 || typeByte == SINT_16 || typeByte == SINT_32 || typeByte == SINT_64;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/MsgPackInput.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.DataInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Receives and processes MsgPack data.\n */\nabstract class MsgPackInput extends MsgPack {\n\n    /**\n     * The stream to read.\n     */\n    private final DataInputStream input;\n\n    /**\n     * Creates an instance.\n     * \n     * @param bytes  the bytes to read, not null\n     */\n    MsgPackInput(byte[] bytes) {\n        this(new ByteArrayInputStream(bytes));\n    }\n\n    /**\n     * Creates an instance.\n     * \n     * @param stream  the stream to read from, not null\n     */\n    MsgPackInput(InputStream stream) {\n        this(new DataInputStream(stream));\n    }\n\n    /**\n     * Creates an instance.\n     * \n     * @param stream  the stream to read from, not null\n     */\n    MsgPackInput(DataInputStream stream) {\n        this.input = stream;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Reads all the data in the stream, closing the stream.\n     */\n    void readAll() {\n        try {\n            try {\n                var b = input.read();\n                while (b >= 0) {\n                    readObject(b);\n                    b = input.read();\n                }\n            } finally {\n                input.close();\n            }\n        } catch (IOException ex) {\n            throw new IllegalStateException(ex);\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    void readObject(int unsigned) throws IOException {\n        handleObjectStart();\n        var b = (byte) unsigned;\n        if (b >= MIN_FIX_INT) {  // no need to check for b <= MAX_FIX_INT\n            handleInt(b);\n            \n        } else if (b >= MIN_FIX_STR && b <= MAX_FIX_STR) {\n            string(b - MIN_FIX_STR);\n            \n        } else if (b >= MIN_FIX_ARRAY && b <= MAX_FIX_ARRAY) {\n            array(b - MIN_FIX_ARRAY);\n            \n        } else if (b >= MIN_FIX_MAP && b <= MAX_FIX_MAP) {\n            map(b - MIN_FIX_MAP);\n            \n        } else {\n            switch (b) {\n                case NIL -> handleNil();\n                case FALSE -> handleBoolean(false);\n                case TRUE -> handleBoolean(true);\n                case BIN_8 -> binary(input.readUnsignedByte());\n                case BIN_16 -> binary(input.readUnsignedShort());\n                case BIN_32 -> binary(input.readInt());\n                case EXT_8 -> extension(input.readUnsignedByte(), false);\n                case EXT_16 -> extension(input.readUnsignedShort(), false);\n                case EXT_32 -> extension(input.readInt(), false);\n                case FLOAT_32 -> handleFloat(input.readFloat());\n                case FLOAT_64 -> handleDouble(input.readDouble());\n                case UINT_8 -> handleInt(input.readUnsignedByte());\n                case UINT_16 -> handleInt(input.readUnsignedShort());\n                case UINT_32 -> {\n                    var val = input.readInt();\n                    if (val >= 0) {\n                        handleInt(val);\n                    } else {\n                        handleUnsignedLong(Integer.toUnsignedLong(val));\n                    }\n                }\n                case UINT_64 -> handleUnsignedLong(input.readLong());\n                case SINT_8 -> handleInt((int) input.readByte());\n                case SINT_16 -> handleInt((int) input.readShort());\n                case SINT_32 -> handleInt(input.readInt());\n                case SINT_64 -> handleSignedLong(input.readLong());\n                case FIX_EXT_1 -> extension(1, true);\n                case FIX_EXT_2 -> extension(2, true);\n                case FIX_EXT_4 -> extension(4, true);\n                case FIX_EXT_8 -> extension(8, true);\n                case FIX_EXT_16 -> extension(16, true);\n                case STR_8 -> string(input.readUnsignedByte());\n                case STR_16 -> string(input.readUnsignedShort());\n                case STR_32 -> string(input.readInt());\n                case ARRAY_16 -> array(input.readUnsignedShort());\n                case ARRAY_32 -> array(input.readInt());\n                case MAP_16 -> map(input.readUnsignedShort());\n                case MAP_32 -> map(input.readInt());\n                default -> handleUnknown(b);\n            }\n        }\n    }\n\n    private void string(int size) throws IOException {\n        if (size < 0) {\n            throw new IllegalStateException(\"String too large\");\n        }\n        var bytes = new byte[size];\n        input.readFully(bytes);\n        var str = new String(bytes, UTF_8);\n        handleString(str);\n    }\n\n    private void array(int size) throws IOException {\n        handleArrayHeader(size);\n        for (var i = 0; i < size; i++) {\n            readArrayItem();\n        }\n    }\n\n    void readArrayItem() throws IOException {\n        var next = input.readUnsignedByte();\n        readObject(next);\n    }\n\n    private void map(int size) throws IOException {\n        handleMapHeader(size);\n        for (var i = 0; i < size; i++) {\n            readMapKey();\n            readMapValue();\n        }\n    }\n\n    void readMapKey() throws IOException {\n        var next = input.readUnsignedByte();\n        readObject(next);\n    }\n\n    void readMapValue() throws IOException {\n        var next = input.readUnsignedByte();\n        readObject(next);\n    }\n\n    private void binary(int size) throws IOException {\n        if (size < 0) {\n            throw new IllegalStateException(\"Binary too large\");\n        }\n        var bytes = new byte[size];\n        input.readFully(bytes);\n        handleBinary(bytes);\n    }\n\n    private void extension(int size, boolean numeric) throws IOException {\n        int type = input.readByte();\n        if (size < 0) {\n            throw new IllegalStateException(\"Extension too large\");\n        }\n        var bytes = new byte[size];\n        input.readFully(bytes);\n        handleExtension(type, numeric, bytes);\n    }\n\n    void handleObjectStart() {\n    }\n\n    void handleBoolean(boolean bool) {\n    }\n\n    void handleNil() {\n    }\n\n    void handleInt(int value) {\n    }\n\n    void handleUnsignedLong(long value) {\n    }\n\n    void handleSignedLong(long value) {\n    }\n\n    void handleFloat(float value) {\n    }\n\n    void handleDouble(double value) {\n    }\n\n    void handleUnknown(byte b) {\n    }\n\n    void handleString(String str) {\n    }\n\n    void handleArrayHeader(int size) {\n    }\n\n    void handleMapHeader(int size) {\n    }\n\n    void handleBinary(byte[] bytes) {\n    }\n\n    void handleExtension(int type, boolean numeric, byte[] bytes) {\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Skips over the next object in an input stream.\n     * \n     * @param input  the input stream, not null\n     * @throws IOException if an error occurs\n     */\n    public static void skipObject(DataInputStream input) throws IOException {\n        new Skipper(input).skip(input.readByte());\n    }\n\n    private static class Skipper extends MsgPackInput {\n        Skipper(DataInputStream input) {\n            super(input);\n        }\n        void skip(int typeByte) throws IOException {\n            readObject(typeByte);\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/MsgPackOutput.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.io.DataOutputStream;\nimport java.io.IOException;\nimport java.io.OutputStream;\n\n/**\n * Outputter for MsgPack data.\n */\nfinal class MsgPackOutput extends MsgPack {\n\n    /**\n     * The stream to write to.\n     */\n    private final DataOutputStream output;\n\n    /**\n     * Creates an instance.\n     * \n     * @param stream  the stream to write to, not null\n     */\n    MsgPackOutput(OutputStream stream) {\n        this.output = new DataOutputStream(stream);\n    }\n\n    /**\n     * Creates an instance.\n     * \n     * @param stream  the stream to write to, not null\n     */\n    MsgPackOutput(DataOutputStream stream) {\n        this.output = stream;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Writes a MessagePack nil.\n     * \n     * @throws IOException if an error occurs\n     */\n    void writeNil() throws IOException {\n        output.writeByte(NIL);\n    }\n\n    /**\n     * Writes a MessagePack boolean.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeBoolean(boolean value) throws IOException {\n        if (value) {\n            output.writeByte(TRUE);\n        } else {\n            output.writeByte(FALSE);\n        }\n    }\n\n    /**\n     * Writes a MessagePack int.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeInt(int value) throws IOException {\n        if (value < MIN_FIX_INT) {\n            // large negative\n            if (value >= Byte.MIN_VALUE) {\n                output.writeByte(SINT_8);\n                output.writeByte((byte) value);\n            } else if (value >= Short.MIN_VALUE) {\n                output.writeByte(SINT_16);\n                output.writeShort((short) value);\n            } else {\n                output.writeByte(SINT_32);\n                output.writeInt(value);\n            }\n        } else if (value < MAX_FIX_INT) {\n            // in range -64 to 127\n            output.writeByte(value);\n        } else {\n            // large positive\n            if (value < 0xFF) {\n                output.writeByte(UINT_8);\n                output.writeByte((byte) value);\n            } else if (value < 0xFFFF) {\n                output.writeByte(UINT_16);\n                output.writeShort((short) value);\n            } else {\n                output.writeByte(UINT_32);\n                output.writeInt(value);\n            }\n        }\n    }\n\n    /**\n     * Writes a MessagePack long.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeLong(long value) throws IOException {\n        if (value < MIN_FIX_INT) {\n            // large negative\n            if (value >= Byte.MIN_VALUE) {\n                output.writeByte(SINT_8);\n                output.writeByte((byte) value);\n            } else if (value >= Short.MIN_VALUE) {\n                output.writeByte(SINT_16);\n                output.writeShort((short) value);\n            } else if (value >= Integer.MIN_VALUE) {\n                output.writeByte(SINT_32);\n                output.writeInt((int) value);\n            } else {\n                output.writeByte(SINT_64);\n                output.writeLong(value);\n            }\n        } else if (value < MAX_FIX_INT) {\n            // in range -64 to 127\n            output.writeByte((byte) value);\n        } else {\n            // large positive\n            if (value < 0xFF) {\n                output.writeByte(UINT_8);\n                output.writeByte((byte) value);\n            } else if (value < 0xFFFF) {\n                output.writeByte(UINT_16);\n                output.writeShort((short) value);\n            } else if (value < 0xFFFFFFFFL) {\n                output.writeByte(UINT_32);\n                output.writeInt((int) value);\n            } else {\n                output.writeByte(UINT_64);\n                output.writeLong(value);\n            }\n        }\n    }\n\n    /**\n     * Writes a MessagePack float.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeFloat(float value) throws IOException {\n        output.writeByte(FLOAT_32);\n        output.writeFloat(value);\n    }\n\n    /**\n     * Writes a MessagePack double.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeDouble(double value) throws IOException {\n        output.writeByte(FLOAT_64);\n        output.writeDouble(value);\n    }\n\n    /**\n     * Writes a MessagePack byte block.\n     * \n     * @param bytes  the bytes, not null\n     * @throws IOException if an error occurs\n     */\n    void writeBytes(byte[] bytes) throws IOException {\n        var size = bytes.length;\n        if (size < 256) {\n            output.writeByte(BIN_8);\n            output.writeByte(size);\n        } else if (size < 65536) {\n            output.writeByte(BIN_16);\n            output.writeShort(size);\n        } else {\n            output.writeByte(BIN_32);\n            output.writeInt(size);\n        }\n        output.write(bytes);\n    }\n\n    /**\n     * Writes a MessagePack string.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeString(String value) throws IOException {\n        // Java 21 performance testing showed manually converting to UTF-8 to be slower\n        var bytes = value.getBytes(UTF_8);\n        var size = bytes.length;\n        if (size < 32) {\n            output.writeByte(MIN_FIX_STR + size);\n        } else if (size < 256) {\n            output.writeByte(STR_8);\n            output.writeByte(size);\n        } else {\n            writeStringHeaderLarge(size);\n        }\n        output.write(bytes);\n    }\n\n    // separate out larger strings, which may benefit hotspot\n    private void writeStringHeaderLarge(int size) throws IOException {\n        if (size < 65536) {\n            output.writeByte(STR_16);\n            output.writeShort(size);\n        } else {\n            output.writeByte(STR_32);\n            output.writeInt(size);\n        }\n    }\n\n    /**\n     * Writes a MessagePack array header.\n     * \n     * @param size  the size\n     * @throws IOException if an error occurs\n     */\n    void writeArrayHeader(int size) throws IOException {\n        if (size < 16) {\n            output.writeByte(MIN_FIX_ARRAY + size);\n        } else if (size < 65536) {\n            output.writeByte(ARRAY_16);\n            output.writeShort(size);\n        } else {\n            output.writeByte(ARRAY_32);\n            output.writeInt(size);\n        }\n    }\n\n    /**\n     * Writes a MessagePack map header.\n     * \n     * @param size  the size\n     * @throws IOException if an error occurs\n     */\n    void writeMapHeader(int size) throws IOException {\n        if (size < 16) {\n            output.writeByte(MIN_FIX_MAP + size);\n        } else if (size < 65536) {\n            output.writeByte(MAP_16);\n            output.writeShort(size);\n        } else {\n            output.writeByte(MAP_32);\n            output.writeInt(size);\n        }\n    }\n\n    /**\n     * Writes an extension value using FIX_EXT_1.\n     * \n     * @param extensionType  the type\n     * @param value  the value to write as the data\n     * @throws IOException if an error occurs\n     */\n    void writeExtensionByte(int extensionType, int value) throws IOException {\n        output.write(FIX_EXT_1);\n        output.write(extensionType);\n        output.write(value);\n    }\n\n    /**\n     * Writes an extension string using EXT_8.\n     * \n     * @param extensionType  the type\n     * @param str  the string to write as the data\n     * @throws IOException if an error occurs\n     */\n    void writeExtensionString(int extensionType, String str) throws IOException {\n        var bytes = str.getBytes(UTF_8);\n        if (bytes.length > 256) {\n            throw new IllegalArgumentException(\"String too long\");\n        }\n        output.write(EXT_8);\n        output.write(bytes.length);\n        output.write(extensionType);\n        output.write(bytes);\n    }\n\n    /**\n     * Writes an extension reference of a positive integer using FIX_EXT data types.\n     * \n     * @param extensionType  the type\n     * @param reference  the positive integer reference to write as the data\n     * @throws IOException if an error occurs\n     */\n    void writePositiveExtensionInt(int extensionType, int reference) throws IOException {\n        if (reference < 0) {\n            throw new IllegalArgumentException(\"Can only serialize positive references: \" + reference);\n        }\n        if (reference < 0xFF) {\n            output.write(FIX_EXT_1);\n            output.write(extensionType);\n            output.writeByte((byte) reference);\n        } else if (reference < 0xFFFF) {\n            output.writeByte(FIX_EXT_2);\n            output.write(extensionType);\n            output.writeShort((short) reference);\n        } else {\n            output.writeByte(FIX_EXT_4);\n            output.write(extensionType);\n            output.writeInt(reference);\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/MsgPackVisualizer.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.io.DataInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Allows MsgPack data to be visualized.\n */\nfinal class MsgPackVisualizer extends MsgPackInput {\n\n    /**\n     * The current indent.\n     */\n    private String indent = \"\";\n    /**\n     * The buffer.\n     */\n    private final StringBuilder buf = new StringBuilder(1024);\n\n    /**\n     * Creates an instance.\n     * \n     * @param bytes  the bytes to read, not null\n     */\n    MsgPackVisualizer(byte[] bytes) {\n        super(bytes);\n    }\n\n    /**\n     * Creates an instance.\n     * \n     * @param stream  the stream to read from, not null\n     */\n    MsgPackVisualizer(InputStream stream) {\n        super(stream);\n    }\n\n    /**\n     * Creates an instance.\n     * \n     * @param stream  the stream to read from, not null\n     */\n    MsgPackVisualizer(DataInputStream stream) {\n        super(stream);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Visualizes the data in the stream.\n     */\n    String visualizeData() {\n        readAll();\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    void readArrayItem() throws IOException {\n        indent = indent + \"- \";\n        super.readArrayItem();\n        indent = indent.substring(0, indent.length() - 2);\n    }\n\n    @Override\n    void readMapKey() throws IOException {\n        indent = indent + \"= \";\n        super.readMapKey();\n        indent = indent.substring(0, indent.length() - 2);\n    }\n\n    @Override\n    void readMapValue() throws IOException {\n        indent = indent + \"  \";\n        super.readMapValue();\n        indent = indent.substring(0, indent.length() - 2);\n    }\n\n    @Override\n    void handleObjectStart() {\n        buf.append(indent);\n        indent = indent.replace(\"-\", \" \").replace(\"=\", \" \");\n    }\n\n    @Override\n    void handleBoolean(boolean bool) {\n        buf.append(bool).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleNil() {\n        buf.append(\"nil\").append(System.lineSeparator());\n    }\n\n    @Override\n    void handleInt(int value) {\n        buf.append(\"int \").append(value).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleUnsignedLong(long value) {\n        buf.append(\"int \").append(value).append(\" unsigned\").append(System.lineSeparator());\n    }\n\n    @Override\n    void handleSignedLong(long value) {\n        buf.append(\"int \").append(value).append(\" signed\").append(System.lineSeparator());\n    }\n\n    @Override\n    void handleFloat(float value) {\n        buf.append(\"flt \").append(value).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleDouble(double value) {\n        buf.append(\"dbl \").append(value).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleUnknown(byte b) {\n        buf.append(\"Unknown - \").append(String.format(\"%02X \", b)).append(System.lineSeparator());\n    }\n\n    @Override\n    void handleString(String str) {\n        buf.append(\"str '\").append(str).append('\\'').append(System.lineSeparator());\n    }\n\n    @Override\n    void handleArrayHeader(int size) {\n        buf.append(\"arr (\").append(size).append(\")\").append(System.lineSeparator());\n    }\n\n    @Override\n    void handleMapHeader(int size) {\n        buf.append(\"map (\").append(size).append(\")\").append(System.lineSeparator());\n    }\n\n    @Override\n    void handleBinary(byte[] bytes) {\n        buf.append(\"bin '\");\n        for (byte b : bytes) {\n            buf.append(toHex(b));\n        }\n        buf.append(\"'\").append(System.lineSeparator());\n    }\n\n    @Override\n    void handleExtension(int type, boolean numeric, byte[] bytes) {\n        String str;\n        if (numeric) {\n            var value = 0;\n            for (byte b : bytes) {\n                value = (value << 8) | (0xFF & b);\n            }\n            if (bytes.length == 1) {\n                value = Byte.toUnsignedInt((byte) value);\n            } else if (bytes.length == 2) {\n                value = Short.toUnsignedInt((short) value);\n            }\n            str = Integer.toString(value);\n        } else {\n            str = new String(bytes, UTF_8);            \n        }\n        buf.append(\"ext type=\")\n            .append(type)\n            .append(\" '\")\n            .append(str)\n            .append(\"'\");\n        switch (type) {\n            case JODA_TYPE_BEAN -> buf.append(\" (bean)\");\n            case JODA_TYPE_DATA -> buf.append(\" (data)\");\n            case JODA_TYPE_META -> buf.append(\" (meta)\");\n            case JODA_TYPE_REF_KEY -> buf.append(\" (refkey)\");\n            case JODA_TYPE_REF -> buf.append(\" (ref)\");\n            default -> {\n            }\n        }\n        buf.append(System.lineSeparator());\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/bin/package-info.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n\n/**\n * Serialization of Joda-Beans using a binary format.\n */\npackage org.joda.beans.ser.bin;\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/json/AbstractJsonReader.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.json;\n\nimport static org.joda.beans.ser.json.JodaBeanJsonWriter.BEAN;\nimport static org.joda.beans.ser.json.JodaBeanJsonWriter.META;\nimport static org.joda.beans.ser.json.JodaBeanJsonWriter.TYPE;\nimport static org.joda.beans.ser.json.JodaBeanJsonWriter.VALUE;\n\nimport java.io.IOException;\nimport java.io.UncheckedIOException;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.ResolvedType;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerCategory;\nimport org.joda.beans.ser.SerIterable;\nimport org.joda.beans.ser.SerIteratorFactory;\nimport org.joda.beans.ser.SerOptional;\nimport org.joda.beans.ser.SerTypeMapper;\n\n/**\n * Provides the ability for a Joda-Bean to read from JSON.\n * <p>\n * The JSON format is defined by {@link JodaBeanJsonWriter}.\n * <p>\n * This class contains mutable state and cannot be used from multiple threads.\n * A new instance must be created for each message.\n */\nabstract class AbstractJsonReader {\n\n    /**\n     * Settings.\n     */\n    private final JodaBeanSer settings;\n    /**\n     * The reader.\n     */\n    private JsonInput input;\n    /**\n     * The base package including the trailing dot.\n     */\n    private String basePackage;\n    /**\n     * The known types.\n     */\n    private final Map<String, Class<?>> knownTypes = new HashMap<>();\n\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings, not null\n     */\n    AbstractJsonReader(final JodaBeanSer settings) {\n        JodaBeanUtils.notNull(settings, \"settings\");\n        this.settings = settings;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Parses the root bean.\n     * \n     * @param input  the JSON input\n     * @param declaredType  the declared type, not null\n     * @return the bean, not null\n     * @throws UncheckedIOException if unable to read the stream\n     * @throws IllegalArgumentException if unable to parse the JSON\n     */\n    <T> T parseRoot(JsonInput input, Class<T> declaredType) {\n        try {\n            this.input = input;\n            var parsed = parseObject(input.acceptEvent(JsonEvent.OBJECT), declaredType, null, null, null, true);\n            return declaredType.cast(parsed);\n        } catch (ClassNotFoundException | ClassCastException ex) {\n            throw new IllegalArgumentException(ex);\n        } catch (IOException ex) {\n            throw new UncheckedIOException(ex);\n        }\n    }\n\n    // parse a bean, event after object start passed in\n    private Object parseBean(JsonEvent event, Class<?> beanType) throws IOException {\n        var propName = \"\";\n        try {\n            var deser = settings.getDeserializers().findDeserializer(beanType);\n            var metaBean = deser.findMetaBean(beanType);\n            var builder = deser.createBuilder(beanType, metaBean);\n            while (event != JsonEvent.OBJECT_END) {\n                // property name\n                propName = input.acceptObjectKey(event);\n                var metaProp = deser.findMetaProperty(beanType, metaBean, propName);\n                // ignore unknown properties\n                if (metaProp == null || metaProp.style().isDerived()) {\n                    input.skipData();\n                } else {\n                    var value = parseObject(input.readEvent(),\n                            SerOptional.extractType(metaProp, beanType), metaProp, beanType, null, false);\n                    deser.setValue(builder, metaProp, SerOptional.wrapValue(metaProp, beanType, value));\n                }\n                propName = \"\";\n                event = input.acceptObjectSeparator();\n            }\n            return deser.build(beanType, builder);\n        } catch (IOException ex) {\n            throw ex;\n        } catch (Exception ex) {\n            throw new IllegalArgumentException(\n                    \"Error parsing bean: \" + beanType.getName() + \"::\" + propName + \": \" + ex.getMessage(), ex);\n        }\n    }\n\n    // parse object, event passed in\n    private Object parseObject(\n            JsonEvent event,\n            Class<?> inputDeclaredType,\n            MetaProperty<?> metaProp,\n            Class<?> beanType,\n            SerIterable parentIterable,\n            boolean rootType) throws IOException, ClassNotFoundException {\n\n        // avoid nulls\n        var declaredType = (inputDeclaredType == null ? Object.class : inputDeclaredType);\n        // establish type\n        if (event == JsonEvent.OBJECT) {\n            event = input.readEvent();\n            if (event == JsonEvent.STRING) {\n                var key = input.parseObjectKey();\n                if (key.equals(BEAN)) {\n                    return parseTypedBean(declaredType, rootType);\n                } else if (key.equals(TYPE)) {\n                    return parseTypedSimple(declaredType);\n                } else if (key.equals(META)) {\n                    return parseTypedMeta();\n                } else {\n                    input.pushBack('\"');\n                    input.pushBackObjectKey(key);\n                    event = JsonEvent.OBJECT;\n                }\n            } else if (event == JsonEvent.OBJECT_END) {\n                input.pushBack('}');\n                event = JsonEvent.OBJECT;\n            } else {\n                throw new IllegalArgumentException(\"Invalid JSON data: Expected JSON object end but found \" + event);\n            }\n        }\n        // parse based on type\n        if (Bean.class.isAssignableFrom(declaredType)) {\n            if (event == JsonEvent.OBJECT) {\n                return parseBean(input.readEvent(), declaredType);\n            } else {\n                return parseSimple(event, declaredType);\n            }\n        } else {\n            if (event == JsonEvent.OBJECT || event == JsonEvent.ARRAY) {\n                SerIterable childIterable = null;\n                if (metaProp != null) {\n                    childIterable = settings.getIteratorFactory().createIterable(metaProp, beanType, true);\n                } else if (parentIterable != null) {\n                    childIterable = settings.getIteratorFactory().createIterable(parentIterable);\n                }\n                if (childIterable == null) {\n                    if (event == JsonEvent.ARRAY) {\n                        childIterable = parseUnknownArray(declaredType);\n                    } else {\n                        childIterable = parseUnknownObject(declaredType);\n                    }\n                }\n                return parseIterable(event, childIterable);\n            } else {\n                return parseSimple(event, declaredType);\n            }\n        }\n    }\n\n    // leniently assume it is am array/List (previously only the simple JSON parser made this assumption)\n    SerIterable parseUnknownArray(Class<?> declaredType) {\n        if (declaredType.isArray()) {\n            return SerIteratorFactory.array(declaredType.getComponentType());\n        } else {\n            return SerIteratorFactory.list(Object.class, Collections.emptyList());\n        }\n    }\n\n    // leniently assume it is a Map (previously only the simple JSON parser made this assumption)\n    SerIterable parseUnknownObject(Class<?> declaredType) {\n        return SerIteratorFactory.map(String.class, Object.class, Collections.emptyList());\n    }\n\n    private Object parseTypedBean(Class<?> declaredType, boolean rootType) throws IOException, ClassNotFoundException {\n        var typeStr = input.acceptString();\n        Class<?> effectiveType = SerTypeMapper.decodeType(typeStr, settings, basePackage, knownTypes);\n        if (rootType) {\n            if (!Bean.class.isAssignableFrom(effectiveType)) {\n                throw new IllegalArgumentException(\"Root type is not a Joda-Bean: \" + effectiveType.getName());\n            }\n            basePackage = effectiveType.getPackage().getName() + \".\";\n        }\n        if (!declaredType.isAssignableFrom(effectiveType)) {\n            throw new IllegalArgumentException(\"Specified type is incompatible with declared type: \" +\n                declaredType.getName() + \" and \" + effectiveType.getName());\n        }\n        var event = input.readEvent();\n        if (event == JsonEvent.COMMA) {\n            event = input.readEvent();\n        }\n        return parseBean(event, effectiveType);\n    }\n\n    private Object parseTypedSimple(Class<?> declaredType) throws IOException, ClassNotFoundException {\n        var typeStr = input.acceptString();\n        var effectiveType = settings.getDeserializers().decodeType(typeStr, settings, basePackage, knownTypes, declaredType);\n        if (!declaredType.isAssignableFrom(effectiveType)) {\n            if (!declaredType.isPrimitive() || ResolvedType.of(declaredType).toBoxed().getRawType() != effectiveType) {\n                throw new IllegalArgumentException(\"Specified type is incompatible with declared type: \" +\n                        declaredType.getName() + \" and \" + effectiveType.getName());\n            }\n        }\n        input.acceptEvent(JsonEvent.COMMA);\n        var valueKey = input.acceptObjectKey(input.readEvent());\n        if (!valueKey.equals(VALUE)) {\n            throw new IllegalArgumentException(\"Invalid JSON data: Expected 'value' key but found \" + valueKey);\n        }\n        var result = parseSimple(input.readEvent(), effectiveType);\n        input.acceptEvent(JsonEvent.OBJECT_END);\n        return result;\n    }\n\n    private Object parseTypedMeta() throws IOException, ClassNotFoundException {\n        var metaType = input.acceptString();\n        var childIterable = settings.getIteratorFactory().createIterable(metaType, settings, knownTypes);\n        input.acceptEvent(JsonEvent.COMMA);\n        var valueKey = input.acceptObjectKey(input.readEvent());\n        if (!valueKey.equals(VALUE)) {\n            throw new IllegalArgumentException(\"Invalid JSON data: Expected 'value' key but found \" + valueKey);\n        }\n        var result = parseIterable(input.readEvent(), childIterable);\n        input.acceptEvent(JsonEvent.OBJECT_END);\n        return result;\n    }\n\n    private Object parseIterable(JsonEvent event, SerIterable iterable) throws IOException, ClassNotFoundException {\n        if (iterable.category() == SerCategory.MAP) {\n            return parseIterableMap(event, iterable);\n        } else if (iterable.category() == SerCategory.COUNTED) {\n            return parseIterableCounted(event, iterable);\n        } else if (iterable.category() == SerCategory.TABLE) {\n            return parseIterableTable(event, iterable);\n        } else if (iterable.category() == SerCategory.GRID) {\n            return parseIterableGrid(event, iterable);\n        } else {\n            return parseIterableArray(event, iterable);\n        }\n    }\n\n    private Object parseIterableMap(JsonEvent event, SerIterable iterable) throws IOException, ClassNotFoundException {\n        if (event == JsonEvent.OBJECT) {\n            event = input.readEvent();\n            while (event != JsonEvent.OBJECT_END) {\n                var keyStr = input.acceptObjectKey(event);\n                var key = parseText(keyStr, iterable.keyType());\n                var value = parseObject(input.readEvent(), iterable.valueType(), null, null, iterable, false);\n                iterable.add(key, null, value, 1);\n                event = input.acceptObjectSeparator();\n            }\n        } else if (event == JsonEvent.ARRAY) {\n            event = input.readEvent();\n            while (event != JsonEvent.ARRAY_END) {\n                input.ensureEvent(event, JsonEvent.ARRAY);\n                var key = parseObject(input.readEvent(), iterable.keyType(), null, null, null, false);\n                input.acceptEvent(JsonEvent.COMMA);\n                var value = parseObject(input.readEvent(), iterable.valueType(), null, null, iterable, false);\n                input.acceptEvent(JsonEvent.ARRAY_END);\n                iterable.add(key, null, value, 1);\n                event = input.acceptArraySeparator();\n            }\n            return iterable.build();\n        } else {\n            throw new IllegalArgumentException(\"Invalid JSON data: Expected array or object but found \" + event);\n        }\n        return iterable.build();\n    }\n\n    private Object parseIterableTable(JsonEvent event, SerIterable iterable) throws IOException, ClassNotFoundException {\n        input.ensureEvent(event, JsonEvent.ARRAY);\n        event = input.readEvent();\n        while (event != JsonEvent.ARRAY_END) {\n            input.ensureEvent(event, JsonEvent.ARRAY);\n            var key = parseObject(input.readEvent(), iterable.keyType(), null, null, null, false);\n            input.acceptEvent(JsonEvent.COMMA);\n            var column = parseObject(input.readEvent(), iterable.columnType(), null, null, null, false);\n            input.acceptEvent(JsonEvent.COMMA);\n            var value = parseObject(input.readEvent(), iterable.valueType(), null, null, iterable, false);\n            iterable.add(key, column, value, 1);\n            input.acceptEvent(JsonEvent.ARRAY_END);\n            event = input.acceptArraySeparator();\n        }\n        return iterable.build();\n    }\n\n    private Object parseIterableGrid(JsonEvent event, SerIterable iterable) throws IOException, ClassNotFoundException {\n        input.ensureEvent(event, JsonEvent.ARRAY);\n        input.acceptEvent(JsonEvent.NUMBER_INTEGRAL);\n        var rows = (int) input.parseNumberIntegral();\n        input.acceptEvent(JsonEvent.COMMA);\n        input.acceptEvent(JsonEvent.NUMBER_INTEGRAL);\n        var columns = (int) input.parseNumberIntegral();\n        iterable.dimensions(new int[] {rows, columns});\n        event = input.acceptArraySeparator();\n        while (event != JsonEvent.ARRAY_END) {\n            input.ensureEvent(event, JsonEvent.ARRAY);\n            input.acceptEvent(JsonEvent.NUMBER_INTEGRAL);\n            var row = (int) input.parseNumberIntegral();\n            input.acceptEvent(JsonEvent.COMMA);\n            input.acceptEvent(JsonEvent.NUMBER_INTEGRAL);\n            var column = (int) input.parseNumberIntegral();\n            input.acceptEvent(JsonEvent.COMMA);\n            var value = parseObject(input.readEvent(), iterable.valueType(), null, null, iterable, false);\n            input.acceptEvent(JsonEvent.ARRAY_END);\n            iterable.add(row, column, value, 1);\n            event = input.acceptArraySeparator();\n        }\n        return iterable.build();\n    }\n\n    private Object parseIterableCounted(JsonEvent event, SerIterable iterable) throws IOException, ClassNotFoundException {\n        input.ensureEvent(event, JsonEvent.ARRAY);\n        event = input.readEvent();\n        while (event != JsonEvent.ARRAY_END) {\n            input.ensureEvent(event, JsonEvent.ARRAY);\n            var value = parseObject(input.readEvent(), iterable.valueType(), null, null, iterable, false);\n            input.acceptEvent(JsonEvent.COMMA);\n            input.acceptEvent(JsonEvent.NUMBER_INTEGRAL);\n            iterable.add(null, null, value, (int) input.parseNumberIntegral());\n            input.acceptEvent(JsonEvent.ARRAY_END);\n            event = input.acceptArraySeparator();\n        }\n        return iterable.build();\n    }\n\n    private Object parseIterableArray(JsonEvent event, SerIterable iterable) throws IOException, ClassNotFoundException {\n        input.ensureEvent(event, JsonEvent.ARRAY);\n        event = input.readEvent();\n        while (event != JsonEvent.ARRAY_END) {\n            var value = parseObject(event, iterable.valueType(), null, null, iterable, false);\n            iterable.add(null, null, value, 1);\n            event = input.acceptArraySeparator();\n        }\n        return iterable.build();\n    }\n\n    private Object parseSimple(JsonEvent event, Class<?> type) throws IOException {\n        switch (event) {\n            case STRING: {\n                var text = input.parseString();\n                return parseText(text, type);\n            }\n            case NUMBER_INTEGRAL: {\n                var value = input.parseNumberIntegral();\n                if (type == Long.class || type == long.class) {\n                    return Long.valueOf(value);\n                    \n                } else if (type == Short.class || type == short.class) {\n                    if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) {\n                        throw new IllegalArgumentException(\"Invalid JSON data: Expected short, but was \" + value);\n                    }\n                    return Short.valueOf((short) value);\n                    \n                } else if (type == Byte.class || type == byte.class) {\n                    if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) {\n                        throw new IllegalArgumentException(\"Invalid JSON data: Expected byte, but was \" + value);\n                    }\n                    return Byte.valueOf((byte) value);\n                    \n                } else if (type == Double.class || type == double.class) {\n                    double dblVal = value;\n                    if (value != (long) dblVal) {\n                        throw new IllegalArgumentException(\"Invalid JSON data: Value exceeds capacity of double: \" + value);\n                    }\n                    return Double.valueOf(dblVal);\n                    \n                } else if (type == Float.class || type == float.class) {\n                    float fltVal = value;\n                    if (value != (long) fltVal) {\n                        throw new IllegalArgumentException(\"Invalid JSON data: Value exceeds capacity of float: \" + value);\n                    }\n                    return Float.valueOf(fltVal);\n                    \n                } else if (type == Integer.class || type == int.class) {\n                    if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) {\n                        throw new IllegalArgumentException(\"Invalid JSON data: Expected int, but was \" + value);\n                    }\n                    return Integer.valueOf((int) value);\n                } else {\n                    if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) {\n                        return Long.valueOf(value);\n                    }\n                    return Integer.valueOf((int) value);\n                }\n            }\n            case NUMBER_FLOATING: {\n                var value = input.parseNumberFloating();\n                if (type == Float.class || type == float.class) {\n                    return Float.valueOf((float) value);\n                } else {\n                    return Double.valueOf(value);\n                }\n            }\n            case NULL: {\n                if (type == double.class || type == Double.class) {\n                    return Double.NaN;  // leniently accept null for NaN\n                } else if (type == float.class || type == Float.class) {\n                    return Float.NaN;  // leniently accept null for NaN\n                } else {\n                    return null;\n                }\n            }\n            case TRUE:\n                return Boolean.TRUE;\n            case FALSE:\n                return Boolean.FALSE;\n            default:\n                throw new IllegalArgumentException(\"Invalid JSON data: Expected simple type but found \" + event);\n        }\n    }\n\n    private Object parseText(String text, Class<?> type) {\n        if (type == Object.class || type.isAssignableFrom(String.class)) {\n            return text;\n        }\n        return settings.getConverter().convertFromString(type, text);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/json/JodaBeanJsonNumberFormat.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.json;\n\n/**\n * Provides control over the format of unusual JSON numeric values.\n * \n * @since 3.0.0\n */\npublic enum JodaBeanJsonNumberFormat {\n\n    /**\n     * Format using {@code NAN_AS_NULL} when using simple JSON, and {@code STRINGS} when using normal JSON.\n     */\n    COMPATIBLE_V2,\n    /**\n     * Format NaN as {@code null} and Infinity as a string.\n     * <p>\n     * The value will be sent as literal {@code null}, the string {@code \"Infinity\"} or the string {@code \"-Infinity\"}.\n     */\n    NAN_AS_NULL,\n    /**\n     * Format NaN and Infinity as a string.\n     * <p>\n     * The value will be sent as the string {@code \"NaN\"}, {@code \"Infinity\"} or {@code \"-Infinity\"}.\n     */\n    STRING,\n    /**\n     * Format NaN and Infinity as a literal, as per 'The JSON5 Data Interchange Format'.\n     * <p>\n     * The value will be sent as the literal {@code NaN}, {@code Infinity} or {@code -Infinity}.\n     */\n    LITERAL;\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/json/JodaBeanJsonReader.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.json;\n\nimport java.io.Reader;\nimport java.io.StringReader;\nimport java.io.UncheckedIOException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.ser.JodaBeanSer;\n\n/**\n * Provides the ability for a Joda-Bean to read from JSON.\n * <p>\n * The JSON format is defined by {@link JodaBeanJsonWriter}.\n * <p>\n * This class contains mutable state and cannot be used from multiple threads.\n * A new instance must be created for each message.\n */\npublic class JodaBeanJsonReader extends AbstractJsonReader {\n\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings, not null\n     */\n    public JodaBeanJsonReader(JodaBeanSer settings) {\n        super(settings);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Reads and parses to a bean.\n     * \n     * @param input  the input string, not null\n     * @return the bean, not null\n     * @throws UncheckedIOException if unable to read the stream\n     * @throws IllegalArgumentException if unable to parse the JSON\n     */\n    public Bean read(String input) {\n        return read(input, Bean.class);\n    }\n\n    /**\n     * Reads and parses to a bean.\n     * \n     * @param <T>  the root type\n     * @param input  the input string, not null\n     * @param rootType  the root type, not null\n     * @return the bean, not null\n     * @throws UncheckedIOException if unable to read the stream\n     * @throws IllegalArgumentException if unable to parse the JSON\n     */\n    public <T> T read(String input, Class<T> rootType) {\n        JodaBeanUtils.notNull(input, \"input\");\n        return read(new StringReader(input), rootType);\n    }\n\n    /**\n     * Reads and parses to a bean.\n     * \n     * @param input  the input reader, not null\n     * @return the bean, not null\n     * @throws UncheckedIOException if unable to read the stream\n     * @throws IllegalArgumentException if unable to parse the JSON\n     */\n    public Bean read(Reader input) {\n        return read(input, Bean.class);\n    }\n\n    /**\n     * Reads and parses to a bean.\n     * \n     * @param <T>  the root type\n     * @param input  the input reader, not null\n     * @param rootType  the root type, not null\n     * @return the bean, not null\n     * @throws UncheckedIOException if unable to read the stream\n     * @throws IllegalArgumentException if unable to parse the JSON\n     */\n    public <T> T read(Reader input, Class<T> rootType) {\n        JodaBeanUtils.notNull(input, \"input\");\n        JodaBeanUtils.notNull(rootType, \"rootType\");\n        var jsonInput = new JsonInput(input);\n        return parseRoot(jsonInput, rootType);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/json/JodaBeanJsonWriter.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.json;\n\nimport java.io.IOException;\nimport java.lang.reflect.Array;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.Set;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.ResolvedType;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerTypeMapper;\nimport org.joda.collect.grid.Grid;\nimport org.joda.collect.grid.ImmutableGrid;\nimport org.joda.convert.ToStringConverter;\n\nimport com.google.common.collect.BiMap;\nimport com.google.common.collect.ImmutableMap;\nimport com.google.common.collect.ImmutableMultiset;\nimport com.google.common.collect.ListMultimap;\nimport com.google.common.collect.Multimap;\nimport com.google.common.collect.Multiset;\nimport com.google.common.collect.SetMultimap;\nimport com.google.common.collect.Table;\n\n/**\n * Provides the ability for a Joda-Bean to be written to JSON.\n * <p>\n * This class contains mutable state and cannot be used from multiple threads.\n * A new instance must be created for each message.\n * <p>\n * The JSON format is kept relatively natural, however some meta-data is added.\n * This has the unfortunate effect of adding an additional object structure to\n * hold the type in a few places.\n * <p>\n * Beans are output using JSON objects where the key is the property name.\n * The type of the bean will be sent using the '&#64;type' property name if necessary.\n * <p>\n * Most simple types, defined by Joda-Convert, are output as JSON strings.\n * If the simple type requires additional type information, the value is replaced by\n * a JSON object containing the keys '&#64;type' and 'value'.\n * <p>\n * Null values are generally omitted, but where included are sent as 'null'.\n * Boolean values are sent as 'true' and 'false'.\n * Integer and Double values are sent as JSON numbers.\n * Other numeric types are also sent as numbers but may have additional type information.\n * <p>\n * Collections are output using JSON objects or arrays.\n * Multisets are output as a map of value to count.\n * <p>\n * If a collection contains a collection then addition meta-type information is\n * written to aid with deserialization.\n * At this level, the data read back may not be identical to that written.\n * If the collection type requires additional type information, the value is replaced by\n * a JSON object containing the keys '&#64;meta' and 'value'.\n * <p>\n * Type names are shortened by the package of the root type if possible.\n * Certain basic types are also handled, such as String, Integer, File and URI.\n */\npublic class JodaBeanJsonWriter {\n\n    /**\n     * JSON bean type attribute.\n     */\n    static final String BEAN = \"@bean\";\n    /**\n     * JSON simple type attribute.\n     */\n    static final String TYPE = \"@type\";\n    /**\n     * JSON meta-type attribute.\n     */\n    static final String META = \"@meta\";\n    /**\n     * JSON value attribute.\n     */\n    static final String VALUE = \"value\";\n\n    // why is there an ugly ClassValue setup here?\n    // because this is O(1) whereas switch with pattern match which is O(n)\n    private static final ClassValue<JsonHandler<Object>> LOOKUP = new ClassValue<>() {\n\n        @SuppressWarnings(\"rawtypes\")  // sneaky use of raw type to allow typed value in each method below\n        @Override\n        protected JsonHandler computeValue(Class<?> type) {\n            if (Bean.class.isAssignableFrom(type)) {\n                return (JsonHandler<Bean>) JodaBeanJsonWriter::writeBeanMaybeSimple;\n            }\n            if (type == String.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeString((String) value);\n            }\n            if (type == Long.class || type == long.class) {\n                return (writer, declaredType, propName, value) -> writer.writeLong(declaredType, (Long) value);\n            }\n            if (type == Integer.class || type == int.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeInt((Integer) value);\n            }\n            if (type == Short.class || type == short.class) {\n                return (writer, declaredType, propName, value) -> writer.writeShort(declaredType, (Short) value);\n            }\n            if (type == Byte.class || type == byte.class) {\n                return (writer, declaredType, propName, value) -> writer.writeByte(declaredType, (Byte) value);\n            }\n            if (type == Double.class || type == double.class) {\n                return (writer, declaredType, propName, value) -> writer.writeDouble(declaredType, (Double) value);\n            }\n            if (type == Float.class || type == float.class) {\n                return (writer, declaredType, propName, value) -> writer.writeFloat(declaredType, (Float) value);\n            }\n            if (type == Boolean.class || type == boolean.class) {\n                return (writer, declaredType, propName, value) -> writer.output.writeBoolean((Boolean) value);\n            }\n            return BaseJsonHandlers.INSTANCE.computeValue(type);\n        }\n    };\n\n    /**\n     * The settings to use.\n     */\n    final JodaBeanSer settings;  // CSIGNORE\n    /**\n     * The outputter.\n     */\n    JsonOutput output;  // CSIGNORE\n    /**\n     * The base package including the trailing dot.\n     */\n    private String basePackage;\n    /**\n     * The known types.\n     */\n    private final Map<Class<?>, String> knownTypes = new HashMap<>();\n\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings to use, not null\n     */\n    public JodaBeanJsonWriter(JodaBeanSer settings) {\n        // COMPATIBLE_V2 value is eliminated here and in the subclass\n        JodaBeanUtils.notNull(settings, \"settings\");\n        if (settings.getJsonNumberFormat() == JodaBeanJsonNumberFormat.COMPATIBLE_V2) {\n            this.settings = settings.withJsonNumberFormat(JodaBeanJsonNumberFormat.STRING);\n        } else {\n            this.settings = settings;\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Writes the bean to a string.\n     * <p>\n     * The type of the bean will be set in the message.\n     * \n     * @param bean  the bean to output, not null\n     * @return the JSON, not null\n     */\n    public String write(Bean bean) {\n        return write(bean, true);\n    }\n\n    /**\n     * Writes the bean to a string specifying whether to include the type at the root.\n     * \n     * @param bean  the bean to output, not null\n     * @param includeRootType  true to output the root type\n     * @return the JSON, not null\n     */\n    public String write(Bean bean, boolean includeRootType) {\n        var buf = new StringBuilder(1024);\n        try {\n            write(bean, includeRootType, buf);\n        } catch (IOException ex) {\n            throw new IllegalStateException(ex);\n        }\n        return buf.toString();\n    }\n\n    /**\n     * Writes the bean to the {@code Appendable}.\n     * <p>\n     * The type of the bean will be set in the message.\n     * \n     * @param bean  the bean to output, not null\n     * @param output  the output appendable, not null\n     * @throws IOException if an error occurs\n     */\n    public void write(Bean bean, Appendable output) throws IOException {\n        write(bean, true, output);\n    }\n\n    /**\n     * Writes the bean to the {@code Appendable} specifying whether to include the type at the root.\n     * \n     * @param bean  the bean to output, not null\n     * @param includeRootType  true to output the root type\n     * @param output  the output appendable, not null\n     * @throws IOException if an error occurs\n     */\n    public void write(Bean bean, boolean includeRootType, Appendable output) throws IOException {\n        JodaBeanUtils.notNull(bean, \"bean\");\n        JodaBeanUtils.notNull(output, \"output\");\n        this.output = new JsonOutput(output, settings.getJsonNumberFormat(), settings.getIndent(), settings.getNewLine());\n        var rootType = includeRootType ? ResolvedType.OBJECT : ResolvedType.of(bean.getClass());\n        // root always outputs the bean, not Joda-Convert form\n        writeBean(rootType, bean, includeRootType);\n        output.append(settings.getNewLine());\n    }\n\n    //-----------------------------------------------------------------------\n    // walk an object, by determining the runtime type\n    void writeObject(ResolvedType declaredType, String propertyName, Object value) throws IOException {\n        if (value == null) {\n            output.writeNull();\n        } else {\n            var handler = LOOKUP.get(value.getClass());\n            handler.handle(this, declaredType, propertyName, value);\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    // writes a bean, favouring output as a Joda-Convert type\n    private void writeBeanMaybeSimple(ResolvedType declaredType, String propertyName, Bean bean) throws IOException {\n        // check for Joda-Convert cannot be in ClassValue as it relies on the settings\n        if (settings.getConverter().isConvertible(bean.getClass())) {\n            writeSimple(declaredType, propertyName, bean);\n        } else {\n            writeBean(declaredType, bean, false);\n        }\n    }\n\n    // writes a bean, with meta type information if necessary\n    private void writeBean(ResolvedType declaredType, Bean bean, boolean isRoot) throws IOException {\n        output.writeObjectStart();\n        writeBeanType(declaredType, bean, isRoot);\n        writeBeanProperties(declaredType, bean);\n        output.writeObjectEnd();\n    }\n\n    // optionally writes the type of the bean\n    void writeBeanType(ResolvedType declaredType, Bean bean, boolean includeRootType) throws IOException {\n        if (bean.getClass() != declaredType.getRawType()) {\n            var typeStr = SerTypeMapper.encodeType(bean.getClass(), settings, basePackage, knownTypes);\n            if (includeRootType) {\n                basePackage = bean.getClass().getPackage().getName() + \".\";\n            }\n            output.writeObjectKeyValue(BEAN, typeStr);\n        }\n    }\n\n    // optionally writes the type of the bean\n    private void writeBeanProperties(ResolvedType declaredType, Bean bean) throws IOException {\n        for (var metaProperty : bean.metaBean().metaPropertyIterable()) {\n            if (settings.isSerialized(metaProperty)) {\n                var value = metaProperty.get(bean);\n                if (value != null) {\n                    var resolvedType = metaProperty.propertyResolvedType(bean.getClass());\n                    var handler = LOOKUP.get(value.getClass());\n                    handler.handleProperty(this, resolvedType, metaProperty.name(), value);\n                }\n            }\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    void writeLong(ResolvedType declaredType, Long val) throws IOException {\n        if (declaredType.getRawType() == long.class) {\n            output.writeLong(val);\n        } else {\n            output.writeObjectStart();\n            output.writeObjectKeyValue(TYPE, \"Long\");\n            output.writeObjectKey(VALUE);\n            output.writeLong(val);\n            output.writeObjectEnd();\n        }\n    }\n\n    void writeShort(ResolvedType declaredType, Short val) throws IOException {\n        if (declaredType.getRawType() == short.class) {\n            output.writeInt(val);\n        } else {\n            output.writeObjectStart();\n            output.writeObjectKeyValue(TYPE, \"Short\");\n            output.writeObjectKey(VALUE);\n            output.writeInt(val);\n            output.writeObjectEnd();\n        }\n    }\n\n    void writeByte(ResolvedType declaredType, Byte val) throws IOException {\n        if (declaredType.getRawType() == byte.class) {\n            output.writeInt(val);\n        } else {\n            output.writeObjectStart();\n            output.writeObjectKeyValue(TYPE, \"Byte\");\n            output.writeObjectKey(VALUE);\n            output.writeInt(val);\n            output.writeObjectEnd();\n        }\n    }\n\n    void writeDouble(ResolvedType declaredType, Double val) throws IOException {\n        if (declaredType.getRawType() == double.class || (!Double.isNaN(val) && !Double.isInfinite(val))) {\n            output.writeDouble(val);\n        } else {\n            output.writeObjectStart();\n            output.writeObjectKeyValue(TYPE, \"Double\");\n            output.writeObjectKey(VALUE);\n            output.writeDouble(val);\n            output.writeObjectEnd();\n        }\n    }\n\n    void writeFloat(ResolvedType declaredType, Float val) throws IOException {\n        if (declaredType.getRawType() == float.class) {\n            output.writeFloat(val);\n        } else {\n            output.writeObjectStart();\n            output.writeObjectKeyValue(TYPE, \"Float\");\n            output.writeObjectKey(VALUE);\n            output.writeFloat(val);\n            output.writeObjectEnd();\n        }\n    }\n\n    // writes a simple type\n    void writeSimple(ResolvedType declaredType, String propertyName, Object value) throws IOException {\n        // handle no declared type and subclasses\n        Class<?> realType = value.getClass();\n        Class<?> effectiveType = declaredType.getRawType();\n        var requiresClose = false;\n        if (effectiveType == Object.class) {\n            if (realType != String.class) {\n                effectiveType = settings.getConverter().findTypedConverter(realType).getEffectiveType();\n                var typeStr = SerTypeMapper.encodeType(effectiveType, settings, basePackage, knownTypes);\n                output.writeObjectStart();\n                output.writeObjectKeyValue(TYPE, typeStr);\n                output.writeObjectKey(VALUE);\n                requiresClose = true;\n            } else {\n                effectiveType = realType;\n            }\n        } else if (!settings.getConverter().isConvertible(effectiveType)) {\n            effectiveType = settings.getConverter().findTypedConverter(realType).getEffectiveType();\n            var typeStr = SerTypeMapper.encodeType(effectiveType, settings, basePackage, knownTypes);\n            output.writeObjectStart();\n            output.writeObjectKeyValue(TYPE, typeStr);\n            output.writeObjectKey(VALUE);\n            requiresClose = true;\n        }\n\n        writeJodaConvert(declaredType, propertyName, value);\n\n        // close open map\n        if (requiresClose) {\n            output.writeObjectEnd();\n        }\n    }\n\n    // writes using Joda-Convert\n    void writeJodaConvert(ResolvedType declaredType, String propertyName, Object value) throws IOException {\n        var realType = value.getClass();\n        try {\n            var converted = settings.getConverter().convertToString(value);\n            if (converted == null) {\n                throw invalidNullString(propertyName, value);\n            }\n            output.writeString(converted);\n        } catch (RuntimeException ex) {\n            throw new IllegalArgumentException(\n                    \"Unable to write property '\" + propertyName + \"', type \" + realType.getName() + \" could not be converted to a String\",\n                    ex);\n        }\n    }\n\n    private static IllegalArgumentException invalidNullString(String propertyName, Object value) {\n        return new IllegalArgumentException(\n                \"Unable to write property '\" + propertyName + \"' because converter returned a null string: \" + value);\n    }\n\n    // writes a map given map entries, code shared with Multimap\n    <K, V> void writeMapEntries(\n            ResolvedType declaredType,\n            String propertyName,\n            Collection<Map.Entry<K, V>> mapEntries) throws IOException {\n\n        // if key type is known and convertible use short key format, else use full bean format\n        var keyType = toWeakenedType(declaredType.getArgumentOrDefault(0));\n        var keyConverterOpt = settings.getConverter().converterFor(keyType.getRawType());\n        if (keyConverterOpt.isPresent()) {\n            writeMapEntriesSimple(declaredType, propertyName, mapEntries, keyType, keyConverterOpt.get().withoutGenerics());\n        } else {\n            writeMapComplex(declaredType, propertyName, mapEntries, keyType);\n        }\n    }\n\n    private <K, V> void writeMapEntriesSimple(\n            ResolvedType declaredType,\n            String propertyName,\n            Collection<Map.Entry<K, V>> mapEntries,\n            ResolvedType keyType,\n            ToStringConverter<Object> keyConverter) throws IOException {\n\n        var valueType = toWeakenedType(declaredType.getArgumentOrDefault(1));\n        output.writeObjectStart();\n        for (var entry : mapEntries) {\n            var key = entry.getKey();\n            if (key == null) {\n                throw invalidNullMapKey(propertyName);\n            }\n            var str = keyConverter.convertToString(key);\n            if (str == null) {\n                throw invalidConvertedNullMapKey(propertyName);\n            }\n            output.writeObjectKey(str);\n            writeObject(valueType, \"\", entry.getValue());\n        }\n        output.writeObjectEnd();\n    }\n\n    private <K, V> void writeMapComplex(\n            ResolvedType declaredType,\n            String propertyName,\n            Collection<Map.Entry<K, V>> mapEntries,\n            ResolvedType keyType) throws IOException {\n\n        var valueType = toWeakenedType(declaredType.getArgumentOrDefault(1));\n        output.writeArrayStart();\n        for (var entry : mapEntries) {\n            var key = entry.getKey();\n            if (key == null) {\n                throw invalidNullMapKey(propertyName);\n            }\n            output.writeArrayItemStart();\n            output.writeArrayStart();\n            output.writeArrayItemStart();\n            writeObject(keyType, \"\", key);\n            output.writeArrayItemStart();\n            writeObject(valueType, \"\", entry.getValue());\n            output.writeArrayEnd();\n        }\n        output.writeArrayEnd();\n    }\n\n    static IllegalArgumentException invalidNullMapKey(String propertyName) {\n        return new IllegalArgumentException(\n                \"Unable to write property '\" + propertyName + \"', map key must not be null\");\n    }\n\n    static IllegalArgumentException invalidConvertedNullMapKey(String propertyName) {\n        return new IllegalArgumentException(\n                \"Unable to write property '\" + propertyName + \"', converted map key must not be null\");\n    }\n\n    //-------------------------------------------------------------------------\n    // gets the weakened type, which exists for backwards compatibility\n    // once the parser can handle ResolvedType this method can, in theory, be removed\n    static ResolvedType toWeakenedType(ResolvedType base) {\n        for (var arg : base.getArguments()) {\n            var rawType = arg.getRawType();\n            if (LOOKUP.get(rawType).isCollection()) {\n                return base.toRaw();\n            }\n        }\n        return base;\n    }\n\n    //-------------------------------------------------------------------------\n    // handler for meta types, but with IOException\n    static interface MetaTypeHandler {\n        public abstract String handle() throws IOException;\n    }\n\n    // handler for meta type content, but with IOException\n    static interface ContentHandler {\n        public abstract void handle() throws IOException;\n    }\n\n    // writes content with a meta type\n    void writeWithMetaType(ContentHandler contentHandler, MetaTypeHandler metaTypeHandler) throws IOException {\n        var metaTypeName = metaTypeHandler.handle();\n        if (metaTypeName != null) {\n            output.writeObjectStart();\n            output.writeObjectKeyValue(META, metaTypeName);\n            output.writeObjectKey(VALUE);\n            contentHandler.handle();\n            output.writeObjectEnd();\n        } else {\n            contentHandler.handle();\n        }\n    }\n\n    // writes content with a meta type\n    void writeWithMetaType(ContentHandler contentHandler, Class<?> cls, ResolvedType declaredType, String metaTypeName)\n            throws IOException {\n\n        if (!cls.isAssignableFrom(declaredType.getRawType())) {\n            output.writeObjectStart();\n            output.writeObjectKeyValue(META, metaTypeName);\n            output.writeObjectKey(VALUE);\n            contentHandler.handle();\n            output.writeObjectEnd();\n        } else {\n            contentHandler.handle();\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    private static interface JsonHandler<T> {\n        public abstract void handle(\n                JodaBeanJsonWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                T obj) throws IOException;\n\n        public default void handleProperty(\n                JodaBeanJsonWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                T obj) throws IOException {\n\n            writer.output.writeObjectKey(propertyName);\n            handle(writer, declaredType, propertyName, obj);\n        }\n\n        public default boolean isCollection() {\n            return false;\n        }\n    }\n\n    private static interface CollectionJsonHandler<T> extends JsonHandler<T> {\n        @Override\n        public default boolean isCollection() {\n            return true;\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    private static sealed class BaseJsonHandlers {\n\n        private static final BaseJsonHandlers INSTANCE = getInstance();\n\n        private static final BaseJsonHandlers getInstance() {\n            try {\n                ImmutableGrid.of();  // check if class is available\n                return new CollectJsonHandlers();\n            } catch (RuntimeException | LinkageError ex) {\n                try {\n                    ImmutableMultiset.of();  // check if class is available\n                    return new GuavaJsonHandlers();\n                } catch (RuntimeException | LinkageError ex2) {\n                    return new BaseJsonHandlers();\n                }\n            }\n        }\n\n        @SuppressWarnings(\"rawtypes\")  // sneaky use of raw type to allow typed value in each method below\n        JsonHandler computeValue(Class<?> type) {\n            if (type == Optional.class) {\n                return OptionalJsonHandler.INSTANCE;\n            }\n            if (type.isArray()) {\n                var componentType = type.getComponentType();\n                if (componentType.isPrimitive()) {\n                    if (componentType == byte.class) {\n                        return JodaBeanJsonWriter::writeSimple;\n                    } else {\n                        return (CollectionJsonHandler<Object>) BaseJsonHandlers::writePrimitiveArray;\n                    }\n                } else {\n                    return (CollectionJsonHandler<Object[]>) BaseJsonHandlers::writeArray;\n                }\n            }\n            if (Map.class.isAssignableFrom(type)) {\n                return (CollectionJsonHandler<Map<?, ?>>) BaseJsonHandlers::writeMap;\n            }\n            if (Iterable.class.isAssignableFrom(type)) {\n                return (CollectionJsonHandler<Collection<?>>) BaseJsonHandlers::writeCollection;\n            }\n            return JodaBeanJsonWriter::writeSimple;\n        }\n\n        // writes an array, with meta type information if necessary\n        private static void writeArray(\n                JodaBeanJsonWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Object[] array) throws IOException {\n\n            var arrayComponentType = array.getClass().getComponentType();\n            // check actual type\n            MetaTypeHandler metaTypeHandler = () -> {\n                if (declaredType.getRawType() != array.getClass()) {\n                    return metaTypeArrayName(arrayComponentType);\n                }\n                return null;\n            };\n            // write content\n            ContentHandler contentHandler = () -> {\n                var componentType = toWeakenedType(ResolvedType.of(arrayComponentType));\n                writer.output.writeArrayStart();\n                for (var item : array) {\n                    writer.output.writeArrayItemStart();\n                    writer.writeObject(componentType, \"\", item);\n                }\n                writer.output.writeArrayEnd();\n            };\n            writer.writeWithMetaType(contentHandler, metaTypeHandler);\n        }\n\n        // writes a primitive array, with meta type information if necessary\n        private static void writePrimitiveArray(\n                JodaBeanJsonWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Object array) throws IOException {\n\n            var arrayComponentType = array.getClass().getComponentType();\n            // check actual type\n            MetaTypeHandler metaTypeHandler = () -> {\n                if (declaredType.getRawType() != array.getClass()) {\n                    return metaTypeArrayName(arrayComponentType);\n                }\n                return null;\n            };\n            // write content\n            ContentHandler contentHandler = () -> {\n                var componentType = ResolvedType.of(arrayComponentType);\n                var handler = JodaBeanJsonWriter.LOOKUP.get(arrayComponentType);\n                var arrayLength = Array.getLength(array);\n                writer.output.writeArrayStart();\n                for (int i = 0; i < arrayLength; i++) {\n                    writer.output.writeArrayItemStart();\n                    handler.handle(writer, componentType, propertyName, Array.get(array, i));\n                }\n                writer.output.writeArrayEnd();\n            };\n            writer.writeWithMetaType(contentHandler, metaTypeHandler);\n        }\n\n        // determines the meta type name to use\n        private static String metaTypeArrayName(Class<?> valueType) {\n            if (valueType.isArray()) {\n                return metaTypeArrayName(valueType.getComponentType()) + \"[]\";\n            }\n            if (valueType == Object.class) {\n                return \"Object[]\";\n            }\n            if (valueType == String.class) {\n                return \"String[]\";\n            }\n            return valueType.getName() + \"[]\";\n        }\n\n        // writes a collection\n        private static void writeCollection(\n                JodaBeanJsonWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Iterable<?> coll) throws IOException {\n\n            // check actual type\n            MetaTypeHandler metaTypeHandler = () -> {\n                if (coll instanceof Set && !Set.class.isAssignableFrom(declaredType.getRawType())) {\n                    return \"Set\";\n                } else if (coll instanceof List && !List.class.isAssignableFrom(declaredType.getRawType())) {\n                    return \"List\";\n                } else if (!Collection.class.isAssignableFrom(declaredType.getRawType())) {\n                    return \"Collection\";\n                }\n                return null;\n            };\n            // write content, using an array\n            ContentHandler contentHandler = () -> {\n                var itemType = toWeakenedType(declaredType.getArgumentOrDefault(0));\n                writer.output.writeArrayStart();\n                for (var item : coll) {\n                    writer.output.writeArrayItemStart();\n                    writer.writeObject(itemType, \"\", item);\n                }\n                writer.output.writeArrayEnd();\n            };\n            writer.writeWithMetaType(contentHandler, metaTypeHandler);\n        }\n\n        // writes a map, with meta type information if necessary\n        private static void writeMap(\n                JodaBeanJsonWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Map<?, ?> map) throws IOException {\n\n            // write content, using a map\n            ContentHandler contentHandler = () -> writer.writeMapEntries(declaredType, propertyName, map.entrySet());\n            writer.writeWithMetaType(contentHandler, Map.class, declaredType, \"Map\");\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    private static sealed class GuavaJsonHandlers extends BaseJsonHandlers {\n\n        @Override\n        @SuppressWarnings(\"rawtypes\")  // sneaky use of raw type to allow typed value in each method below\n        JsonHandler computeValue(Class<?> type) {\n            if (Multimap.class.isAssignableFrom(type)) {\n                return (CollectionJsonHandler<Multimap<?, ?>>) GuavaJsonHandlers::writeMultimap;\n            }\n            if (Multiset.class.isAssignableFrom(type)) {\n                return (CollectionJsonHandler<Multiset<?>>) GuavaJsonHandlers::writeMultiset;\n            }\n            if (Table.class.isAssignableFrom(type)) {\n                return (CollectionJsonHandler<Table<?, ?, ?>>) GuavaJsonHandlers::writeTable;\n            }\n            if (BiMap.class.isAssignableFrom(type)) {\n                return (CollectionJsonHandler<BiMap<?, ?>>) GuavaJsonHandlers::writeBiMap;\n            }\n            if (com.google.common.base.Optional.class.isAssignableFrom(type)) {\n                return GuavaOptionalJsonHandler.INSTANCE;\n            }\n            return super.computeValue(type);\n        }\n\n        // writes a multimap\n        private static void writeMultimap(\n                JodaBeanJsonWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Multimap<?, ?> mmap) throws IOException {\n\n            // check actual type\n            MetaTypeHandler metaTypeHandler = () -> {\n                if (mmap instanceof SetMultimap && !SetMultimap.class.isAssignableFrom(declaredType.getRawType())) {\n                    return \"SetMultimap\";\n                } else if (mmap instanceof ListMultimap && !ListMultimap.class.isAssignableFrom(declaredType.getRawType())) {\n                    return \"ListMultimap\";\n                } else if (!Multimap.class.isAssignableFrom(declaredType.getRawType())) {\n                    return \"Multimap\";\n                }\n                return null;\n            };\n            // write content, using a map\n            ContentHandler contentHandler = () -> writer.writeMapEntries(declaredType, propertyName, mmap.entries());\n            writer.writeWithMetaType(contentHandler, metaTypeHandler);\n        }\n\n        // writes a multiset\n        private static void writeMultiset(\n                JodaBeanJsonWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Multiset<?> mset) throws IOException {\n\n            // write content, using an array of value to count\n            ContentHandler contentHandler = () -> {\n                var valueType = toWeakenedType(declaredType.getArgumentOrDefault(0));\n                writer.output.writeArrayStart();\n                for (var entry : mset.entrySet()) {\n                    writer.output.writeArrayItemStart();\n                    writer.output.writeArrayStart();\n                    writer.output.writeArrayItemStart();\n                    writer.writeObject(valueType, \"\", entry.getElement());\n                    writer.output.writeArrayItemStart();\n                    writer.output.writeInt(entry.getCount());\n                    writer.output.writeArrayEnd();\n                }\n                writer.output.writeArrayEnd();\n            };\n            writer.writeWithMetaType(contentHandler, Multiset.class, declaredType, \"Multiset\");\n        }\n\n        // writes a table\n        private static void writeTable(\n                JodaBeanJsonWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Table<?, ?, ?> table) throws IOException {\n\n            // write content, using an array of cells\n            ContentHandler contentHandler = () -> {\n                var rowType = toWeakenedType(declaredType.getArgumentOrDefault(0));\n                var columnType = toWeakenedType(declaredType.getArgumentOrDefault(1));\n                var valueType = toWeakenedType(declaredType.getArgumentOrDefault(2));\n                writer.output.writeArrayStart();\n                for (var cell : table.cellSet()) {\n                    writer.output.writeArrayItemStart();\n                    writer.output.writeArrayStart();\n                    writer.output.writeArrayItemStart();\n                    writer.writeObject(rowType, \"\", cell.getRowKey());\n                    writer.output.writeArrayItemStart();\n                    writer.writeObject(columnType, \"\", cell.getColumnKey());\n                    writer.output.writeArrayItemStart();\n                    writer.writeObject(valueType, \"\", cell.getValue());\n                    writer.output.writeArrayEnd();\n                }\n                writer.output.writeArrayEnd();\n            };\n            writer.writeWithMetaType(contentHandler, Table.class, declaredType, \"Table\");\n        }\n\n        // writes a BiMap, with meta type information if necessary\n        private static void writeBiMap(\n                JodaBeanJsonWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                BiMap<?, ?> biMap) throws IOException {\n\n            MetaTypeHandler metaTypeHandler = () -> {\n                if (!BiMap.class.isAssignableFrom(declaredType.getRawType())) {\n                    // hack around Guava annoyance by assuming that size 0 and 1 ImmutableBiMap\n                    // was actually meant to be an ImmutableMap\n                    if ((declaredType.getRawType() != Map.class && declaredType.getRawType() != ImmutableMap.class) || biMap.size() >= 2) {\n                        return \"BiMap\";\n                    } else if (!Map.class.isAssignableFrom(declaredType.getRawType())) {\n                        return \"Map\";\n                    }\n                }\n                return null;\n            };\n            ContentHandler contentHandler = () -> writer.writeMapEntries(declaredType, propertyName, biMap.entrySet());\n            writer.writeWithMetaType(contentHandler, metaTypeHandler);\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    private static final class CollectJsonHandlers extends GuavaJsonHandlers {\n\n        @Override\n        @SuppressWarnings(\"rawtypes\")  // sneaky use of raw type to allow typed value in each method below\n        JsonHandler computeValue(Class<?> type) {\n            if (Grid.class.isAssignableFrom(type)) {\n                return (CollectionJsonHandler<Grid<?>>) CollectJsonHandlers::writeGrid;\n            }\n            return super.computeValue(type);\n        }\n\n        private static void writeGrid(\n                JodaBeanJsonWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Grid<?> grid) throws IOException {\n\n            // write grid using sparse approach\n            ContentHandler contentHandler = () -> {\n                var valueType = toWeakenedType(declaredType.getArgumentOrDefault(0));\n                writer.output.writeArrayStart();\n                writer.output.writeArrayItemStart();\n                writer.output.writeInt(grid.rowCount());\n                writer.output.writeArrayItemStart();\n                writer.output.writeInt(grid.columnCount());\n                for (var cell : grid.cells()) {\n                    writer.output.writeArrayItemStart();\n                    writer.output.writeArrayStart();\n                    writer.output.writeArrayItemStart();\n                    writer.output.writeInt(cell.getRow());\n                    writer.output.writeArrayItemStart();\n                    writer.output.writeInt(cell.getColumn());\n                    writer.output.writeArrayItemStart();\n                    writer.writeObject(valueType, \"\", cell.getValue());\n                    writer.output.writeArrayEnd();\n                }\n                writer.output.writeArrayEnd();\n            };\n            writer.writeWithMetaType(contentHandler, Grid.class, declaredType, \"Grid\");\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    static final class OptionalJsonHandler implements JsonHandler<Optional<?>> {\n        private static final OptionalJsonHandler INSTANCE = new OptionalJsonHandler();\n\n        // when Optional is not a property, it is processed as a kind of collection\n        @Override\n        public void handle(\n                JodaBeanJsonWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Optional<?> opt) throws IOException {\n\n            var valueType = declaredType.getArgumentOrDefault(0).toRaw();\n            writer.writeObject(valueType, \"\", opt.orElse(null));\n        }\n\n        // when Optional is a property, it is ignored if empty\n        @Override\n        public void handleProperty(\n                JodaBeanJsonWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                Optional<?> opt) throws IOException {\n\n            var value = opt.orElse(null);\n            if (value != null) {\n                var valueType = declaredType.getArgumentOrDefault(0).toRaw();\n                writer.output.writeObjectKey(propertyName);\n                writer.writeObject(valueType, propertyName, value);\n            }\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    static final class GuavaOptionalJsonHandler implements JsonHandler<com.google.common.base.Optional<?>> {\n        private static final GuavaOptionalJsonHandler INSTANCE = new GuavaOptionalJsonHandler();\n\n        // when Optional is not a property, it is processed as a kind of collection\n        @Override\n        public void handle(\n                JodaBeanJsonWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                com.google.common.base.Optional<?> opt) throws IOException {\n\n            var valueType = declaredType.getArgumentOrDefault(0).toRaw();\n            writer.writeObject(valueType, \"\", opt.orNull());\n        }\n\n        // when Optional is a property, it is ignored if empty\n        @Override\n        public void handleProperty(\n                JodaBeanJsonWriter writer,\n                ResolvedType declaredType,\n                String propertyName,\n                com.google.common.base.Optional<?> opt) throws IOException {\n\n            var value = opt.orNull();\n            if (value != null) {\n                var valueType = declaredType.getArgumentOrDefault(0).toRaw();\n                writer.output.writeObjectKey(propertyName);\n                writer.writeObject(valueType, propertyName, value);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/json/JodaBeanSimpleJsonReader.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.json;\n\nimport java.io.Reader;\nimport java.io.StringReader;\nimport java.io.UncheckedIOException;\n\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.ser.JodaBeanSer;\n\n/**\n * Provides the ability for a Joda-Bean to read from JSON.\n * <p>\n * The JSON format is defined by {@link JodaBeanJsonWriter}.\n * <p>\n * This class contains mutable state and cannot be used from multiple threads.\n * A new instance must be created for each message.\n */\npublic class JodaBeanSimpleJsonReader extends AbstractJsonReader {\n\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings, not null\n     */\n    public JodaBeanSimpleJsonReader(JodaBeanSer settings) {\n        super(settings);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Reads and parses to a bean.\n     * \n     * @param <T>  the root type\n     * @param input  the input string, not null\n     * @param rootType  the root type, not null\n     * @return the bean, not null\n     * @throws UncheckedIOException if unable to read the stream\n     * @throws IllegalArgumentException if unable to parse the JSON\n     */\n    public <T> T read(String input, Class<T> rootType) {\n        JodaBeanUtils.notNull(input, \"input\");\n        return read(new StringReader(input), rootType);\n    }\n\n    /**\n     * Reads and parses to a bean.\n     * \n     * @param <T>  the root type\n     * @param input  the input reader, not null\n     * @param rootType  the root type, not null\n     * @return the bean, not null\n     * @throws UncheckedIOException if unable to read the stream\n     * @throws IllegalArgumentException if unable to parse the JSON\n     */\n    public <T> T read(Reader input, Class<T> rootType) {\n        JodaBeanUtils.notNull(input, \"input\");\n        JodaBeanUtils.notNull(rootType, \"rootType\");\n        var jsonInput = new JsonInput(input);\n        return parseRoot(jsonInput, rootType);\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/json/JodaBeanSimpleJsonWriter.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.json;\n\nimport java.io.IOException;\nimport java.util.Collection;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.ResolvedType;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.convert.ToStringConverter;\n\n/**\n * Provides the ability for a Joda-Bean to be written to a simple JSON format.\n * <p>\n * This class contains mutable state and cannot be used from multiple threads.\n * A new instance must be created for each message.\n * <p>\n * The JSON format used here is natural, with no meta-data.\n * As such, it may not be possible to write some objects or read the JSON data back in.\n * <p>\n * Beans are output using JSON objects where the key is the property name.\n * Most simple types, defined by Joda-Convert, are output as JSON strings.\n * Null values are generally omitted, but where included are sent as 'null'.\n * Boolean values are sent as 'true' and 'false'.\n * Numeric values are sent as JSON numbers.\n * Maps must have a key that can be converted to a string by Joda-Convert.\n * The property type needs to be known when writing/reading - properties, or\n * list/map entries, that are defined as {@code Object} are unlikely to work well.\n * <p>\n * Collections are output using JSON arrays. Maps as JSON objects.\n */\npublic class JodaBeanSimpleJsonWriter extends JodaBeanJsonWriter {\n\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings to use, not null\n     */\n    public JodaBeanSimpleJsonWriter(JodaBeanSer settings) {\n        super(adjustSettings(settings));\n    }\n\n    private static JodaBeanSer adjustSettings(JodaBeanSer settings) {\n        JodaBeanUtils.notNull(settings, \"settings\");\n        if (settings.getJsonNumberFormat() == JodaBeanJsonNumberFormat.COMPATIBLE_V2) {\n            return settings.withJsonNumberFormat(JodaBeanJsonNumberFormat.NAN_AS_NULL);\n        } else {\n            return settings;\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Writes the bean to a string.\n     * \n     * @param bean  the bean to output, not null\n     * @return the JSON, not null\n     */\n    @Override\n    public String write(Bean bean) {\n        return super.write(bean);\n    }\n\n    /**\n     * Writes the bean to the {@code Appendable}.\n     * <p>\n     * The type of the bean will be set in the message.\n     * \n     * @param bean  the bean to output, not null\n     * @param output  the output appendable, not null\n     * @throws IOException if an error occurs\n     */\n    @Override\n    public void write(Bean bean, Appendable output) throws IOException {\n        super.write(bean, false, output);\n    }\n\n    //-------------------------------------------------------------------------\n    @Override\n    void writeBeanType(ResolvedType declaredType, Bean bean, boolean includeRootType) throws IOException {\n        // do not write type\n    }\n\n    //-------------------------------------------------------------------------\n    @Override\n    void writeLong(ResolvedType declaredType, Long val) throws IOException {\n        // do not write type\n        output.writeLong(val);\n    }\n\n    @Override\n    void writeShort(ResolvedType declaredType, Short val) throws IOException {\n        // do not write type\n        output.writeInt(val);\n    }\n\n    @Override\n    void writeByte(ResolvedType declaredType, Byte val) throws IOException {\n        // do not write type\n        output.writeInt(val);\n    }\n\n    @Override\n    void writeDouble(ResolvedType declaredType, Double val) throws IOException {\n        // do not write type\n        output.writeDouble(val);\n    }\n\n    @Override\n    void writeFloat(ResolvedType declaredType, Float val) throws IOException {\n        // do not write type\n        output.writeFloat(val);\n    }\n\n    //-------------------------------------------------------------------------\n    @Override\n    void writeSimple(ResolvedType declaredType, String propertyName, Object value) throws IOException {\n        // do not write type\n        super.writeJodaConvert(declaredType, propertyName, value);\n    }\n\n    // writes a map given map entries, used by Map/Multimap/BiMap\n    @Override\n    <K, V> void writeMapEntries(\n            ResolvedType declaredType,\n            String propertyName,\n            Collection<Map.Entry<K, V>> mapEntries) throws IOException {\n\n        // simple JSON requires the key to be a Joda-Convert type\n        var keyType = toWeakenedType(declaredType.getArgumentOrDefault(0));\n        var valueType = toWeakenedType(declaredType.getArgumentOrDefault(1));\n        // converter based on the declared type if possible, else based on the runtime type\n        var keyConverterOpt = settings.getConverter().converterFor(keyType.getRawType());\n        ToStringConverter<Object> keyConverter = keyConverterOpt.isPresent() ?\n                keyConverterOpt.get().withoutGenerics() :\n                key -> settings.getConverter().convertToString(key);\n        output.writeObjectStart();\n        for (var entry : mapEntries) {\n            var key = entry.getKey();\n            if (key == null) {\n                throw invalidNullMapKey(propertyName);\n            }\n            var str = keyConverter.convertToString(key);\n            if (str == null) {\n                throw invalidConvertedNullMapKey(propertyName);\n            }\n            output.writeObjectKey(str);\n            writeObject(valueType, \"\", entry.getValue());\n        }\n        output.writeObjectEnd();\n    }\n\n    //-------------------------------------------------------------------------\n    // writes content with a meta type\n    @Override\n    void writeWithMetaType(ContentHandler contentHandler, MetaTypeHandler metaTypeHandler) throws IOException {\n        // do not write type\n        contentHandler.handle();\n    }\n\n    @Override\n    void writeWithMetaType(ContentHandler contentHandler, Class<?> cls, ResolvedType declaredType, String metaTypeName)\n            throws IOException {\n\n        // do not write type\n        contentHandler.handle();\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/json/JsonEvent.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.json;\n\n/**\n * JSON event types.\n */\nenum JsonEvent {\n\n    OBJECT,\n    OBJECT_END,\n    ARRAY,\n    ARRAY_END,\n    STRING,\n    NUMBER_INTEGRAL,\n    NUMBER_FLOATING,\n    NULL,\n    TRUE,\n    FALSE,\n    COMMA,\n    COLON,\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/json/JsonInput.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.json;\n\nimport java.io.IOException;\nimport java.io.Reader;\n\n/**\n * Reader of JSON data.\n */\nfinal class JsonInput {\n    // this code parses the literals NaN, Infinity, -Infinity, +Infinity\n    // any number may be prefixed by +\n\n    /** encoding JSON */\n    private static final String[] REPLACE = new String[128];\n    static {\n        for (var i = 0; i < 32; i++) {\n            REPLACE[i] = String.format(\"\\\\u%04x\", i);\n        }\n        REPLACE['\\b'] = \"\\\\b\";\n        REPLACE['\\t'] = \"\\\\t\";\n        REPLACE['\\n'] = \"\\\\n\";\n        REPLACE['\\f'] = \"\\\\f\";\n        REPLACE['\\r'] = \"\\\\r\";\n        REPLACE['\"'] = \"\\\\\\\"\";\n        REPLACE['\\\\'] = \"\\\\\\\\\";\n        REPLACE[127] = \"\\\\u007f\";\n    }\n\n    /**\n     * The reader.\n     */\n    private final Reader input;\n    /**\n     * The reused string buffer.\n     */\n    private final StringBuilder buf = new StringBuilder(32);\n    /**\n     * The last parsed integral number.\n     */\n    private long integral;\n    /**\n     * The last parsed floating number.\n     */\n    private double floating;\n    /**\n     * The previously read character.\n     */\n    private Character cachedNext;\n    /**\n     * The previously read object key.\n     */\n    private String cachedObjectKey;\n\n    /**\n     * Creates an instance that parses JSON.\n     * \n     * @param input  the input to read from, not null\n     */\n    JsonInput(Reader input) {\n        this.input = input;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Writes a JSON null.\n     * \n     * @throws IOException if an error occurs\n     */\n    JsonEvent readEvent() throws IOException {\n        var next = readNext();\n        // whitespace\n        while (next == ' ' || next == '\\t' || next == '\\n' || next == '\\r') {\n            next = readNext();\n        }\n        // identify token\n        return switch (next) {\n            case '{' -> JsonEvent.OBJECT;\n            case '}' -> JsonEvent.OBJECT_END;\n            case '[' -> JsonEvent.ARRAY;\n            case ']' -> JsonEvent.ARRAY_END;\n            case '\"' -> JsonEvent.STRING;\n            case '-', '+', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' -> acceptNumber(next);\n            case 'n' -> acceptNull();\n            case 't' -> acceptTrue();\n            case 'f' -> acceptFalse();\n            case 'N' -> acceptNaN();\n            case 'I' -> acceptInfinity();\n            case ',' -> JsonEvent.COMMA;\n            case ':' -> JsonEvent.COLON;\n            default -> throw new IllegalArgumentException(\"Invalid JSON data: Expected JSON character but found '\" + next + \"'\");\n        };\n    }\n\n    // store peeked value for later use\n    void pushBack(char ch) {\n        cachedNext = ch;\n    }\n\n    // store peeked value for later use\n    void pushBackObjectKey(String objectKey) {\n        cachedObjectKey = objectKey;\n    }\n\n    JsonEvent ensureEvent(JsonEvent event, JsonEvent expected) {\n        if (event != expected) {\n            throw new IllegalArgumentException(\"Invalid JSON data: Expected \" + expected + \" but found \" + event);\n        }\n        return event;\n    }\n\n    JsonEvent acceptEvent(JsonEvent expected) throws IOException {\n        return ensureEvent(readEvent(), expected);\n    }\n\n    //-----------------------------------------------------------------------\n    // expect object key and parse it\n    String acceptObjectKey(JsonEvent event) throws IOException {\n        ensureEvent(event, JsonEvent.STRING);\n        return parseObjectKey();\n    }\n\n    // opening quite already consumed\n    String parseObjectKey() throws IOException {\n        if (cachedObjectKey != null) {\n            var key = cachedObjectKey;\n            cachedObjectKey = null;\n            return key;\n        }\n        var str = parseString();\n        acceptEvent(JsonEvent.COLON);\n        return str;\n    }\n\n    //-----------------------------------------------------------------------\n    // expect string and parse it\n    String acceptString() throws IOException {\n        acceptEvent(JsonEvent.STRING);\n        return parseString();\n    }\n\n    // opening quite already consumed\n    String parseString() throws IOException {\n        buf.setLength(0);\n        var next = readNext();\n        while (next != '\"') {\n            if (next == '\\\\') {\n                parseEscape();\n            } else {\n                buf.append(next);\n            }\n            next = readNext();\n        }\n        return buf.toString();\n    }\n\n    private void parseEscape() throws IOException {\n        var next = readNext();\n        switch (next) {\n            case '\"':\n                buf.append('\"');\n                return;\n            case '/':\n                buf.append('/');\n                return;\n            case '\\\\':\n                buf.append('\\\\');\n                return;\n            case 'b':\n                buf.append('\\b');\n                return;\n            case 'f':\n                buf.append('\\f');\n                return;\n            case 'n':\n                buf.append('\\n');\n                return;\n            case 'r':\n                buf.append('\\r');\n                return;\n            case 't':\n                buf.append('\\t');\n                return;\n            case 'u':\n                var total = 0;\n                for (var i = 0; i < 4; i++) {\n                    total = total * 16 + acceptHex();\n                }\n                buf.append((char) total);\n                return;\n            default:\n                throw new IllegalArgumentException(\"Invalid JSON data: Expected valid escape sequence but found '\\\\\" + next + \"'\");\n        }\n    }\n\n    private int acceptHex() throws IOException {\n        var next = readNext();\n        if (next >= '0' && next <= '9') {\n            return next - 48;\n        }\n        if (next >= 'a' && next <= 'f') {\n            return next - 97 + 10;\n        }\n        if (next >= 'A' && next <= 'F') {\n            return next - 65 + 10;\n        }\n        throw new IllegalArgumentException(\"Invalid JSON data: Expected hex but found '\" + next + \"'\");\n    }\n\n    //-----------------------------------------------------------------------\n    // number already parsed\n    long parseNumberIntegral() {\n        return integral;\n    }\n\n    // number already parsed\n    double parseNumberFloating() {\n        return floating;\n    }\n\n    private JsonEvent acceptNumber(char first) throws IOException {\n        buf.setLength(0);\n        buf.append(first);\n        var last = first;\n        var next = readNext();\n        while ((next >= '0' && next <= '9') || next == '.' || next == '-' || next == '+' || next == 'e' || next == 'E' || next == 'I') {\n            buf.append(next);\n            last = next;\n            next = readNext();\n        }\n        pushBack(next);\n        var str = buf.toString();\n        if (str.equals(\"-I\")) {\n            acceptInfinity();\n            floating = Double.NEGATIVE_INFINITY;\n            return JsonEvent.NUMBER_FLOATING;\n        } else if (str.equals(\"+I\")) {\n            return acceptInfinity();\n        } else if (last < '0' || last > '9') {\n            throw new IllegalArgumentException(\"Invalid JSON data: Expected number but found invalid last char '\" + last + \"'\");\n        }\n        if (str.equals(\"0\")) {\n            integral = 0;\n            return JsonEvent.NUMBER_INTEGRAL;\n        } else if (str.startsWith(\"0\") && str.charAt(1) != '.') {\n            throw new IllegalArgumentException(\"Invalid JSON data: Expected number but found zero at start\");\n        } else if (str.contains(\".\") || str.contains(\"e\") || str.contains(\"E\")) {\n            floating = Double.parseDouble(str);\n            return JsonEvent.NUMBER_FLOATING;\n        } else {\n            integral = Long.parseLong(str);\n            return JsonEvent.NUMBER_INTEGRAL;\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    private JsonEvent acceptNull() throws IOException {\n        acceptChar('u');\n        acceptChar('l');\n        acceptChar('l');\n        return JsonEvent.NULL;\n    }\n\n    private JsonEvent acceptTrue() throws IOException {\n        acceptChar('r');\n        acceptChar('u');\n        acceptChar('e');\n        return JsonEvent.TRUE;\n    }\n\n    private JsonEvent acceptFalse() throws IOException {\n        acceptChar('a');\n        acceptChar('l');\n        acceptChar('s');\n        acceptChar('e');\n        return JsonEvent.FALSE;\n    }\n\n    private JsonEvent acceptNaN() throws IOException {\n        acceptChar('a');\n        acceptChar('N');\n        floating = Double.NaN;\n        return JsonEvent.NUMBER_FLOATING;\n    }\n\n    private JsonEvent acceptInfinity() throws IOException {\n        acceptChar('n');\n        acceptChar('f');\n        acceptChar('i');\n        acceptChar('n');\n        acceptChar('i');\n        acceptChar('t');\n        acceptChar('y');\n        floating = Double.POSITIVE_INFINITY;\n        return JsonEvent.NUMBER_FLOATING;\n    }\n\n    private void acceptChar(char ch) throws IOException {\n        var next = readNext();\n        if (next != ch) {\n            throw new IllegalArgumentException(\"Invalid JSON data: Expected '\" + ch + \"' but found '\" + next + \"'\");\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    private char readNext() throws IOException {\n        if (cachedNext != null) {\n            var next = cachedNext.charValue();\n            cachedNext = null;\n            return next;\n        }\n        var next = input.read();\n        if (next == -1) {\n            throw new IllegalArgumentException(\"Invalid JSON data: End of file\");\n        }\n        return (char) next;\n    }\n\n    void skipData() throws IOException {\n        skipData(readEvent());\n    }\n\n    private void skipData(JsonEvent event) throws IOException {\n        switch (event) {\n            case OBJECT: {\n                var ev = readEvent();\n                while (ev != JsonEvent.OBJECT_END) {\n                    acceptObjectKey(ev);\n                    skipData();\n                    ev = acceptObjectSeparator();\n                }\n                break;\n            }\n            case ARRAY: {\n                var ev = readEvent();\n                while (ev != JsonEvent.ARRAY_END) {\n                    skipData(ev);\n                    ev = acceptArraySeparator();\n                }\n                break;\n            }\n            case STRING: {\n                parseString();\n                break;\n            }\n            case NULL:\n            case TRUE:\n            case FALSE:\n            case NUMBER_FLOATING:\n            case NUMBER_INTEGRAL:\n                break;\n            default:\n                throw new IllegalArgumentException(\"Invalid JSON data: Expected data item but found \" + event);\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    // accepts a comma or object end\n    JsonEvent acceptObjectSeparator() throws IOException {\n        var event = readEvent();\n        if (event == JsonEvent.COMMA) {\n            return readEvent();  // leniently allow comma before objectEnd\n        } else {\n            return ensureEvent(event, JsonEvent.OBJECT_END);\n        }\n    }\n\n    // accepts a comma or array end\n    JsonEvent acceptArraySeparator() throws IOException {\n        var event = readEvent();\n        if (event == JsonEvent.COMMA) {\n            return readEvent();  // leniently allow comma before arrayEnd\n        } else {\n            return ensureEvent(event, JsonEvent.ARRAY_END);\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/json/JsonOutput.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.json;\n\nimport java.io.IOException;\nimport java.util.BitSet;\n\n/**\n * Outputter for JSON data.\n */\nfinal class JsonOutput {\n\n    /** encoding JSON */\n    private static final String[] REPLACE = new String[128];\n    static {\n        // performance is better without adding the characters from 32 to 126\n        // (because they would have to be added as String, not char, which slows down the append method)\n        for (var i = 0; i < 32; i++) {\n            REPLACE[i] = String.format(\"\\\\u%04x\", i);\n        }\n        REPLACE['\\b'] = \"\\\\b\";\n        REPLACE['\\t'] = \"\\\\t\";\n        REPLACE['\\n'] = \"\\\\n\";\n        REPLACE['\\f'] = \"\\\\f\";\n        REPLACE['\\r'] = \"\\\\r\";\n        REPLACE['\"'] = \"\\\\\\\"\";\n        REPLACE['\\\\'] = \"\\\\\\\\\";\n        REPLACE[127] = \"\\\\u007f\";\n    }\n\n    /**\n     * The appender to write to.\n     */\n    private final Appendable output;\n    /**\n     * The number format.\n     */\n    private final JodaBeanJsonNumberFormat numberFormat;\n    /**\n     * The indent amount.\n     */\n    private final String indent;\n    /**\n     * The new line.\n     */\n    private final String newLine;\n    /**\n     * The current indent.\n     */\n    private String currentIndent = \"\";\n    /**\n     * The comma depth.\n     */\n    private int commaDepth;\n    /**\n     * The comma state.\n     */\n    private final BitSet commaState = new BitSet(64);\n\n    /**\n     * Creates an instance that outputs in compact format.\n     * \n     * @param output  the output to write to, not null\n     */\n    JsonOutput(Appendable output) {\n        this(output, JodaBeanJsonNumberFormat.STRING, \"\", \"\");\n    }\n\n    /**\n     * Creates an instance where the output format can be controlled.\n     * \n     * @param output  the output to write to, not null\n     * @param numberFormat  the number format, not null\n     * @param indent  the pretty format indent\n     * @param newLine  the pretty format new line\n     */\n    JsonOutput(Appendable output, JodaBeanJsonNumberFormat numberFormat, String indent, String newLine) {\n        this.output = output;\n        this.numberFormat = numberFormat;\n        this.indent = indent;\n        this.newLine = newLine;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Writes a JSON null.\n     * \n     * @throws IOException if an error occurs\n     */\n    void writeNull() throws IOException {\n        output.append(\"null\");\n    }\n\n    /**\n     * Writes a JSON boolean.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeBoolean(boolean value) throws IOException {\n        if (value) {\n            output.append(\"true\");\n        } else {\n            output.append(\"false\");\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Writes a JSON int.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeInt(int value) throws IOException {\n        output.append(Integer.toString(value));\n    }\n\n    /**\n     * Writes a JSON long.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeLong(long value) throws IOException {\n        output.append(Long.toString(value));\n    }\n\n    /**\n     * Writes a JSON float.\n     * <p>\n     * This outputs the values of NaN, and Infinity as strings.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeFloat(float value) throws IOException {\n        if (Float.isNaN(value)) {\n            switch (numberFormat) {\n                case LITERAL -> output.append(\"NaN\");\n                case NAN_AS_NULL -> writeNull();\n                default -> output.append(\"\\\"NaN\\\"\");\n            }\n        } else if (Float.isInfinite(value)) {\n            var str = value > 0 ? \"Infinity\" : \"-Infinity\";\n            switch (numberFormat) {\n                case LITERAL -> output.append(str);\n                default -> output.append('\"').append(str).append('\"');\n            }\n        } else {\n            output.append(Float.toString(value));\n        }\n    }\n\n    /**\n     * Writes a JSON double.\n     * <p>\n     * This outputs the values of NaN, and Infinity as strings.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeDouble(double value) throws IOException {\n        if (Double.isNaN(value)) {\n            switch (numberFormat) {\n                case LITERAL -> output.append(\"NaN\");\n                case NAN_AS_NULL -> writeNull();\n                default -> output.append(\"\\\"NaN\\\"\");\n            }\n        } else if (Double.isInfinite(value)) {\n            var str = value > 0 ? \"Infinity\" : \"-Infinity\";\n            switch (numberFormat) {\n                case LITERAL -> output.append(str);\n                default -> output.append('\"').append(str).append('\"');\n            }\n        } else {\n            output.append(Double.toString(value));\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Writes a JSON string.\n     * \n     * @param value  the value\n     * @throws IOException if an error occurs\n     */\n    void writeString(String value) throws IOException {\n        output.append('\"');\n        for (var i = 0; i < value.length(); i++) {\n            var ch = value.charAt(i);\n            if (ch < 128) {\n                var replace = REPLACE[ch];\n                if (replace != null) {\n                    output.append(replace);\n                } else {\n                    output.append(ch);\n                }\n            } else if (ch == '\\u2028') {\n                output.append(\"\\\\u2028\");  // match other JSON writers\n            } else if (ch == '\\u2029') {\n                output.append(\"\\\\u2029\");  // match other JSON writers\n            } else {\n                output.append(ch);\n            }\n        }\n        output.append('\"');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Writes a JSON array start.\n     * \n     * @throws IOException if an error occurs\n     */\n    void writeArrayStart() throws IOException {\n        output.append('[');\n        commaDepth++;\n        commaState.clear(commaDepth);\n    }\n\n    /**\n     * Writes a JSON array item start.\n     * \n     * @throws IOException if an error occurs\n     */\n    void writeArrayItemStart() throws IOException {\n        if (commaState.get(commaDepth)) {\n            output.append(',');\n            if (!newLine.isEmpty()) {\n                output.append(' ');\n            }\n        } else {\n            commaState.set(commaDepth);\n        }\n    }\n\n    /**\n     * Writes a JSON array end.\n     * \n     * @throws IOException if an error occurs\n     */\n    void writeArrayEnd() throws IOException {\n        output.append(']');\n        commaDepth--;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Writes a JSON object start.\n     * \n     * @throws IOException if an error occurs\n     */\n    void writeObjectStart() throws IOException {\n        output.append('{');\n        currentIndent = currentIndent + indent;\n        commaDepth++;\n        commaState.set(commaDepth, false);\n    }\n\n    /**\n     * Writes a JSON object key.\n     * <p>\n     * This handles the comma, string encoded key and separator colon.\n     * \n     * @param key  the item key\n     * @throws IOException if an error occurs\n     */\n    void writeObjectKey(String key) throws IOException {\n        if (commaState.get(commaDepth)) {\n            output.append(',');\n        } else {\n            commaState.set(commaDepth, true);\n        }\n        output.append(newLine);\n        output.append(currentIndent);\n        writeString(key);\n        output.append(':');\n        if (!newLine.isEmpty()) {\n            output.append(' ');\n        }\n    }\n\n    /**\n     * Writes a JSON object key and value.\n     * \n     * @param key  the item key\n     * @param value  the item value\n     * @throws IOException if an error occurs\n     */\n    void writeObjectKeyValue(String key, String value) throws IOException {\n        writeObjectKey(key);\n        writeString(value);\n    }\n\n    /**\n     * Writes a JSON object end.\n     * \n     * @throws IOException if an error occurs\n     */\n    void writeObjectEnd() throws IOException {\n        currentIndent = currentIndent.substring(0, currentIndent.length() - indent.length());\n        if (commaState.get(commaDepth)) {\n            output.append(newLine);\n            output.append(currentIndent);\n        }\n        output.append('}');\n        commaDepth--;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/json/package-info.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n\n/**\n * Serialization of Joda-Beans using JSON.\n */\npackage org.joda.beans.ser.json;\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/map/JodaBeanSimpleMapReader.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.map;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerIterable;\nimport org.joda.beans.ser.SerIteratorFactory;\nimport org.joda.beans.ser.SerOptional;\n\n/**\n * Provides the ability for a Joda-Bean to read from a JSON-like in memory {@code Map}.\n * <p>\n * The format is defined by {@link JodaBeanSimpleMapWriter}.\n * <p>\n * This class contains mutable state and cannot be used from multiple threads.\n * A new instance must be created for each message.\n */\npublic class JodaBeanSimpleMapReader {\n\n    /**\n     * Settings.\n     */\n    private final JodaBeanSer settings;\n\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings, not null\n     */\n    public JodaBeanSimpleMapReader(JodaBeanSer settings) {\n        JodaBeanUtils.notNull(settings, \"settings\");\n        this.settings = settings;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Reads and parses to a bean.\n     * \n     * @param <T>  the root type\n     * @param input  the map input, not null\n     * @param rootType  the root type, not null\n     * @return the bean, not null\n     */\n    public <T> T read(Map<String, Object> input, Class<T> rootType) {\n        JodaBeanUtils.notNull(input, \"input\");\n        JodaBeanUtils.notNull(rootType, \"rootType\");\n        try {\n            return parseRoot(input, rootType);\n        } catch (RuntimeException ex) {\n            throw ex;\n        } catch (Exception ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Parses the root bean.\n     * \n     * @param input  the map input, not null\n     * @param declaredType  the declared type, not null\n     * @return the bean, not null\n     * @throws Exception if an error occurs\n     */\n    private <T> T parseRoot(Map<String, Object> input, Class<T> declaredType) {\n        var parsed = parseBean(input, declaredType);\n        return declaredType.cast(parsed);\n    }\n\n    // parse a bean, event after object start passed in\n    private Object parseBean(Map<String, Object> input, Class<?> beanType) {\n        var propName = \"\";\n        try {\n            var deser = settings.getDeserializers().findDeserializer(beanType);\n            var metaBean = deser.findMetaBean(beanType);\n            var builder = deser.createBuilder(beanType, metaBean);\n            for (var entry : input.entrySet()) {\n                // property name\n                propName = entry.getKey();\n                var metaProp = deser.findMetaProperty(beanType, metaBean, propName);\n                // ignore unknown properties\n                if (metaProp != null && !metaProp.style().isDerived()) {\n                    var declaredType = SerOptional.extractType(metaProp, beanType);\n                    var value = parseProperty(entry.getValue(), declaredType, metaProp, beanType);\n                    deser.setValue(builder, metaProp, SerOptional.wrapValue(metaProp, beanType, value));\n                }\n            }\n            propName = \"\";\n            return deser.build(beanType, builder);\n        } catch (Exception ex) {\n            throw new IllegalArgumentException(\n                    \"Error parsing bean: \" + beanType.getName() + \"::\" + propName + \", \" + ex.getMessage(), ex);\n        }\n    }\n\n    // parse an object defined by a meta-property, event passed in\n    private Object parseProperty(\n            Object input,\n            Class<?> declaredType,\n            MetaProperty<?> metaProp,\n            Class<?> beanType) {\n\n        // parse based on type\n        if (Bean.class.isAssignableFrom(declaredType)) {\n            return parseObjectAsBean(input, declaredType);\n        } else if (input instanceof List || input instanceof Map) {\n            var childIterable = settings.getIteratorFactory().createIterable(metaProp, beanType, true);\n            return childIterable != null ?\n                    parseIterable(input, childIterable) :\n                    parseObjectAsCollection(input, declaredType);\n        } else {\n            return parseSimple(input, declaredType);\n        }\n    }\n\n    // parse an object within a collection\n    private Object parseObject(\n            Object input,\n            Class<?> declaredType,\n            SerIterable parentIterableOrNull) {\n\n        if (Bean.class.isAssignableFrom(declaredType)) {\n            return parseObjectAsBean(input, declaredType);\n        } else if (input instanceof List || input instanceof Map) {\n            var childIterable = parentIterableOrNull != null ?\n                    settings.getIteratorFactory().createIterable(parentIterableOrNull) :\n                    null;\n            return childIterable != null ?\n                    parseIterable(input, childIterable) :\n                    parseObjectAsCollection(input, declaredType);\n        } else {\n            return parseSimple(input, declaredType);\n        }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private Object parseObjectAsBean(Object input, Class<?> declaredType) {\n        if (input instanceof Map) {\n            return parseBean((Map<String, Object>) input, declaredType);\n        } else {\n            return parseSimple(input, declaredType);\n        }\n    }\n\n    private Object parseObjectAsCollection(Object input, Class<?> declaredType) {\n        if (input instanceof List<?> inputList) {\n            if (declaredType.isArray()) {\n                return parseIterableArray(inputList, SerIteratorFactory.array(declaredType.getComponentType()));\n            } else {\n                return parseIterableArray(inputList, SerIteratorFactory.list(Object.class, List.of()));\n            }\n        } else {\n            return parseIterableMap(input, SerIteratorFactory.map(String.class, Object.class, List.of()));\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    private Object parseIterable(Object input, SerIterable iterable) {\n        return switch (iterable.category()) {\n            case COLLECTION -> parseIterableArray((List<?>) input, iterable);\n            case COUNTED -> parseIterableCounted((List<?>) input, iterable);\n            case MAP -> parseIterableMap(input, iterable);\n            case TABLE -> parseIterableTable((List<?>) input, iterable);\n            case GRID -> parseIterableGrid((List<?>) input, iterable);\n        };\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private Object parseIterableMap(Object input, SerIterable iterable) {\n        if (input instanceof Map) {\n            for (var entry : ((Map<String, Object>) input).entrySet()) {\n                var keyStr = entry.getKey();\n                var key = convertText(keyStr, iterable.keyType());\n                var value = parseObject(entry.getValue(), iterable.valueType(), iterable);\n                iterable.add(key, null, value, 1);\n            }\n            return iterable.build();\n        } else if (input instanceof List<?> inputList) {\n            for (var inputVal : inputList) {\n                var inputData = (List<?>) inputVal;\n                if (inputData.size() != 3) {\n                    throw new IllegalArgumentException(\"Expected table iterable to have entries of size 3\");\n                }\n                var key = parseObject(inputData.get(0), iterable.keyType(), null);\n                var value = parseObject(inputData.get(2), iterable.valueType(), iterable);\n                iterable.add(key, null, value, 1);\n            }\n            return iterable.build();\n        } else {\n            throw new IllegalArgumentException(\"Invalid data: Expected List or Map but found \" + input);\n        }\n    }\n\n    private Object parseIterableTable(List<?> input, SerIterable iterable) {\n        for (var inputVal : input) {\n            List<?> inputData = (List<?>) inputVal;\n            if (inputData.size() != 3) {\n                throw new IllegalArgumentException(\"Expected table iterable to have entries of size 3\");\n            }\n            var key = parseObject(inputData.get(0), iterable.keyType(), null);\n            var col = parseObject(inputData.get(1), iterable.columnType(), null);\n            var value = parseObject(inputData.get(2), iterable.valueType(), iterable);\n            iterable.add(key, col, value, 1);\n        }\n        return iterable.build();\n    }\n\n    private Object parseIterableGrid(List<?> input, SerIterable iterable) {\n        if (input.size() < 2) {\n            throw new IllegalArgumentException(\"Expected grid iterable to be at least size 2\");\n        }\n        var rows = (Integer) input.get(0);\n        var columns = (Integer) input.get(1);\n        iterable.dimensions(new int[] {rows, columns});\n        for (var inputVal : input.subList(2, input.size())) {\n            var inputData = (List<?>) inputVal;\n            if (inputData.size() != 3) {\n                throw new IllegalArgumentException(\"Expected grid iterable to have entries of size 3\");\n            }\n            var row = (Integer) inputData.get(0);\n            var col = (Integer) inputData.get(1);\n            var value = parseObject(inputData.get(2), iterable.valueType(), iterable);\n            iterable.add(row, col, value, 1);\n        }\n        return iterable.build();\n    }\n\n    private Object parseIterableCounted(List<?> input, SerIterable iterable) {\n        for (var inputVal : input) {\n            var inputData = (List<?>) inputVal;\n            if (inputData.size() != 2) {\n                throw new IllegalArgumentException(\"Expected counted iterable to have entries of size 2\");\n            }\n            var value = parseObject(inputData.get(0), iterable.valueType(), iterable);\n            var count = (Integer) inputData.get(1);\n            iterable.add(null, null, value, count);\n        }\n        return iterable.build();\n    }\n\n    private Object parseIterableArray(List<?> input, SerIterable iterable) {\n        for (var inputVal : input) {\n            var value = parseObject(inputVal, iterable.valueType(), iterable);\n            iterable.add(null, null, value, 1);\n        }\n        return iterable.build();\n    }\n\n    //-------------------------------------------------------------------------\n    private Object parseSimple(Object input, Class<?> type) {\n        return switch (input) {\n            case null -> convertNull(type);\n            case String s -> convertText(s, type);\n            case Boolean b -> input;\n            case Long l -> convertLong(l, type);\n            case Integer i -> convertInteger(i, type);\n            case Short s -> input;\n            case Byte b -> input;\n            case Double d -> convertDouble(d, type);\n            case Float f -> convertFloat(f, type);\n            default -> throw new IllegalArgumentException(\"Invalid data: Expected simple type but found \" + input);\n        };\n    }\n\n    private Object convertNull(Class<?> type) {\n        if (type == double.class || type == Double.class) {\n            return Double.NaN;  // leniently accept null for NaN\n        } else if (type == float.class || type == Float.class) {\n            return Float.NaN;  // leniently accept null for NaN\n        } else {\n            return null;\n        }\n    }\n\n    private Object convertText(String input, Class<?> type) {\n        if (type == Object.class || type.isAssignableFrom(String.class)) {\n            return input;\n        }\n        return settings.getConverter().convertFromString(type, input);\n    }\n\n    private Object convertLong(Long inputLong, Class<?> type) {\n        if (type == Long.class || type == long.class) {\n            return inputLong;\n        } else {\n            return convertInteger(inputLong.longValue(), type);\n        }\n    }\n\n    private Object convertInteger(Integer inputInteger, Class<?> type) {\n        if (type == Integer.class || type == int.class) {\n            return inputInteger;\n        } else {\n            return convertInteger(inputInteger.longValue(), type);\n        }\n    }\n\n    private Object convertDouble(Double inputDouble, Class<?> type) {\n        if (type == Double.class || type == double.class) {\n            return inputDouble;\n        } else if (type == Float.class || type == float.class) {\n            return inputDouble.floatValue();\n        } else {\n            return convertInteger(inputDouble.longValue(), type);\n        }\n    }\n\n    private Object convertFloat(Float inputFloat, Class<?> type) {\n        if (type == Float.class || type == float.class) {\n            return inputFloat;\n        } else if (type == Double.class || type == double.class) {\n            return inputFloat.doubleValue();\n        } else {\n            return convertInteger(inputFloat.longValue(), type);\n        }\n    }\n\n    // converts the value we received to the type we desire\n    private Object convertInteger(long value, Class<?> type) {\n        if (type == Long.class || type == long.class) {\n            return Long.valueOf(value);\n            \n        } else if (type == Short.class || type == short.class) {\n            if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) {\n                throw new IllegalArgumentException(\"Invalid data: Value exceeds capacity of short: \" + value);\n            }\n            return Short.valueOf((short) value);\n            \n        } else if (type == Byte.class || type == byte.class) {\n            if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) {\n                throw new IllegalArgumentException(\"Invalid data: Value exceeds capacity of byte: \" + value);\n            }\n            return Byte.valueOf((byte) value);\n            \n        } else if (type == Double.class || type == double.class) {\n            double dblVal = value;\n            if (value != (long) dblVal) {\n                throw new IllegalArgumentException(\"Invalid data: Value exceeds capacity of double: \" + value);\n            }\n            return Double.valueOf(dblVal);\n            \n        } else if (type == Float.class || type == float.class) {\n            float fltVal = value;\n            if (value != (long) fltVal) {\n                throw new IllegalArgumentException(\"Invalid data: Value exceeds capacity of float: \" + value);\n            }\n            return Float.valueOf(fltVal);\n\n        } else if (type == Integer.class || type == int.class) {\n            if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) {\n                throw new IllegalArgumentException(\"Invalid data: Expected int, but was \" + value);\n            }\n            return Integer.valueOf((int) value);\n        } else {\n            if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) {\n                return Long.valueOf(value);\n            }\n            return Integer.valueOf((int) value);\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/map/JodaBeanSimpleMapWriter.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.map;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.LinkedHashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerCategory;\nimport org.joda.beans.ser.SerIterator;\nimport org.joda.beans.ser.SerOptional;\n\n/**\n * Provides the ability for a Joda-Bean to be written to a JSON-like in memory {@code Map}.\n * <p>\n * This class contains mutable state and cannot be used from multiple threads.\n * A new instance must be created for each message.\n * <p>\n * The format used here is natural, with no meta-data.\n * As such, it may not be possible to write some objects or read the JSON data back in.\n * <p>\n * Beans are output as maps where the key is the property name.\n * Most simple types, defined by Joda-Convert, are output as JSON strings.\n * Null values are generally omitted, booleans and numbers are left as is.\n * Maps must have a key that can be converted to a string by Joda-Convert.\n * The property type needs to be known when writing/reading - properties, or\n * list/map entries, that are defined as {@code Object} are unlikely to work well.\n * <p>\n * Collections are output using lists, Maps as maps, with other collection types\n * having a complex list-based format.\n */\npublic class JodaBeanSimpleMapWriter {\n\n    /**\n     * The settings to use.\n     */\n    private final JodaBeanSer settings;\n\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings to use, not null\n     */\n    public JodaBeanSimpleMapWriter(JodaBeanSer settings) {\n        JodaBeanUtils.notNull(settings, \"settings\");\n        this.settings = settings;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Writes the bean to a string.\n     * \n     * @param bean  the bean to output, not null\n     * @return the JSON, not null\n     */\n    public Map<String, Object> write(Bean bean) {\n        JodaBeanUtils.notNull(bean, \"bean\");\n        return writeBean(bean, bean.getClass());\n    }\n\n    //-----------------------------------------------------------------------\n    // write a bean as a JSON object\n    private Map<String, Object> writeBean(Bean bean, Class<?> declaredType) {\n        Map<String, Object> result = new LinkedHashMap<>();\n        // property information\n        for (MetaProperty<?> prop : bean.metaBean().metaPropertyIterable()) {\n            if (prop.style().isSerializable() || (prop.style().isDerived() && settings.isIncludeDerived())) {\n                var value = SerOptional.extractValue(prop, bean);\n                if (value != null) {\n                    Object outputValue;\n                    Class<?> propType = SerOptional.extractType(prop, bean.getClass());\n                    if (value instanceof Bean beanValue) {\n                        if (settings.getConverter().isConvertible(value.getClass())) {\n                            outputValue = writeSimple(propType, value);\n                        } else {\n                            outputValue = writeBean(beanValue, propType);\n                        }\n                    } else {\n                        var itemIterator = settings.getIteratorFactory().create(value, prop, bean.getClass(), true);\n                        if (itemIterator != null) {\n                            outputValue = writeElements(itemIterator);\n                        } else {\n                            outputValue = writeSimple(propType, value);\n                        }\n                    }\n                    result.put(prop.name(), outputValue);\n                }\n            }\n        }\n        return result;\n    }\n\n    //-----------------------------------------------------------------------\n    // write a collection\n    private Object writeElements(SerIterator itemIterator) {\n        if (itemIterator.category() == SerCategory.MAP) {\n            return writeMap(itemIterator);\n        } else if (itemIterator.category() == SerCategory.COUNTED) {\n            return writeCounted(itemIterator);\n        } else if (itemIterator.category() == SerCategory.TABLE) {\n            return writeTable(itemIterator);\n        } else if (itemIterator.category() == SerCategory.GRID) {\n            return writeGrid(itemIterator);\n        } else {\n            return writeArray(itemIterator);\n        }\n    }\n\n    // write list/set/array\n    private Object writeArray(SerIterator itemIterator) {\n        List<Object> result = new ArrayList<>();\n        while (itemIterator.hasNext()) {\n            itemIterator.next();\n            result.add(writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator));\n        }\n        return result;\n    }\n\n    // write map\n    private Object writeMap(SerIterator itemIterator) {\n        if (itemIterator.size() == 0) {\n            return new LinkedHashMap<>();\n        }\n        // if key type is known and convertible use short key format, else use full bean format\n        if (settings.getConverter().isConvertible(itemIterator.keyType())) {\n            return writeMapSimple(itemIterator);\n        } else {\n            return writeMapComplex(itemIterator);\n        }\n    }\n\n    // write map with simple keys\n    private Object writeMapSimple(SerIterator itemIterator) {\n        Map<String, Object> result = new LinkedHashMap<>();\n        var keyConverter = settings.getConverter().findConverterNoGenerics(itemIterator.keyType());\n        while (itemIterator.hasNext()) {\n            itemIterator.next();\n            var key = itemIterator.key();\n            if (key == null) {\n                throw new IllegalArgumentException(\"Unable to write map key as it cannot be null\");\n            }\n            var str = keyConverter.convertToString(itemIterator.key());\n            if (str == null) {\n                throw new IllegalArgumentException(\"Unable to write map key as it cannot be a null string\");\n            }\n            result.put(str, writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator));\n        }\n        return result;\n    }\n\n    // write map with complex keys\n    private Object writeMapComplex(SerIterator itemIterator) {\n        Map<String, Object> result = new LinkedHashMap<>();\n        while (itemIterator.hasNext()) {\n            itemIterator.next();\n            var key = itemIterator.key();\n            if (key == null) {\n                throw new IllegalArgumentException(\"Unable to write map key as it cannot be null\");\n            }\n            var str = settings.getConverter().convertToString(itemIterator.key());\n            if (str == null) {\n                throw new IllegalArgumentException(\"Unable to write map key as it cannot be a null string\");\n            }\n            result.put(str, writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator));\n        }\n        return result;\n    }\n\n    // write table\n    private Object writeTable(SerIterator itemIterator) {\n        List<Object> result = new ArrayList<>();\n        while (itemIterator.hasNext()) {\n            itemIterator.next();\n            var outputKey = writeObject(itemIterator.keyType(), itemIterator.key(), null);\n            var outputCol = writeObject(itemIterator.columnType(), itemIterator.column(), null);\n            var outputValue = writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator);\n            result.add(Arrays.asList(outputKey, outputCol, outputValue));\n        }\n        return result;\n    }\n\n    // write grid using sparse approach\n    private Object writeGrid(SerIterator itemIterator) {\n        List<Object> result = new ArrayList<>();\n        result.add(itemIterator.dimensionSize(0));\n        result.add(itemIterator.dimensionSize(1));\n        while (itemIterator.hasNext()) {\n            itemIterator.next();\n            var outputKey = (Integer) itemIterator.key();\n            var outputCol = (Integer) itemIterator.column();\n            var outputValue = writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator);\n            result.add(Arrays.asList(outputKey, outputCol, outputValue));\n        }\n        return result;\n    }\n\n    // write counted set\n    private Object writeCounted(final SerIterator itemIterator) {\n        List<Object> result = new ArrayList<>();\n        while (itemIterator.hasNext()) {\n            itemIterator.next();\n            var outputValue = writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator);\n            var outputCount = itemIterator.count();\n            result.add(Arrays.asList(outputValue, outputCount));\n        }\n        return result;\n    }\n\n    // write collection object\n    private Object writeObject(Class<?> declaredType, Object obj, SerIterator parentIterator) {\n        if (obj == null) {\n            return null;\n        } else if (settings.getConverter().isConvertible(obj.getClass())) {\n            return writeSimple(declaredType, obj);\n        } else if (obj instanceof Bean bean) {\n            return writeBean(bean, declaredType);\n        } else if (parentIterator != null) {\n            var childIterator = settings.getIteratorFactory().createChild(obj, parentIterator);\n            if (childIterator != null) {\n                return writeElements(childIterator);\n            } else {\n                return writeSimple(declaredType, obj);\n            }\n        } else {\n            return writeSimple(declaredType, obj);\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    // write simple type\n    private Object writeSimple(Class<?> declaredType, Object value) {\n        Class<?> realType = value.getClass();\n        if (realType == Integer.class || realType == Long.class || realType == Short.class ||\n                realType == Byte.class || realType == Float.class || realType == Double.class ||\n                realType == Boolean.class) {\n            return value;\n        } else {\n            // write as a string\n            try {\n                var converted = settings.getConverter().convertToString(realType, value);\n                if (converted == null) {\n                    throw new IllegalArgumentException(\"Unable to write because converter returned a null string: \" + value);\n                }\n                return converted;\n            } catch (RuntimeException ex) {\n                throw new IllegalArgumentException(\n                        \"Unable to convert type \" + declaredType.getName() + \" for real type: \" + realType.getName(), ex);\n            }\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/map/package-info.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n\n/**\n * Serialization of Joda-Beans to/from an in-memory Map.\n */\npackage org.joda.beans.ser.map;\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/package-info.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n\n/**\n * Serialization of Joda-Beans.\n * <p>\n * The main class of this package is {@link org.joda.beans.ser.JodaBeanSer JodaBeanSer}.\n * Configure, or use a constant, to obtain access to serialization.\n * From there, use one of the specific methods for JSON, XML or binary.\n */\npackage org.joda.beans.ser;\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/xml/JodaBeanXml.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.xml;\n\nimport javax.xml.namespace.QName;\n\n/**\n * Constants used in XML.\n */\nfinal class JodaBeanXml {\n\n    /**\n     * XML bean tag.\n     */\n    public static final String BEAN = \"bean\";\n    /**\n     * XML bean QName.\n     */\n    public static final QName BEAN_QNAME = new QName(null, BEAN);\n    /**\n     * XML item tag.\n     */\n    public static final String ITEM = \"item\";\n    /**\n     * XML item QName.\n     */\n    public static final QName ITEM_QNAME = new QName(null, ITEM);\n    /**\n     * XML entry tag.\n     */\n    public static final String ENTRY = \"entry\";\n    /**\n     * XML entry QName.\n     */\n    public static final QName ENTRY_QNAME = new QName(null, ENTRY);\n    /**\n     * XML type attribute.\n     */\n    public static final String TYPE = \"type\";\n    /**\n     * XML type QName.\n     */\n    public static final QName TYPE_QNAME = new QName(null, TYPE);\n    /**\n     * XML key attribute.\n     */\n    public static final String KEY = \"key\";\n    /**\n     * XML key QName.\n     */\n    public static final QName KEY_QNAME = new QName(null, KEY);\n    /**\n     * XML rows attribute.\n     */\n    public static final String ROWS = \"rows\";\n    /**\n     * XML rows QName.\n     */\n    public static final QName ROWS_QNAME = new QName(null, ROWS);\n    /**\n     * XML cols attribute.\n     */\n    public static final String COLS = \"cols\";\n    /**\n     * XML cols QName.\n     */\n    public static final QName COLS_QNAME = new QName(null, COLS);\n    /**\n     * XML row attribute.\n     */\n    public static final String ROW = \"row\";\n    /**\n     * XML row QName.\n     */\n    public static final QName ROW_QNAME = new QName(null, ROW);\n    /**\n     * XML col attribute.\n     */\n    public static final String COL = \"col\";\n    /**\n     * XML col QName.\n     */\n    public static final QName COL_QNAME = new QName(null, COL);\n    /**\n     * XML count attribute.\n     */\n    public static final String COUNT = \"count\";\n    /**\n     * XML count QName.\n     */\n    public static final QName COUNT_QNAME = new QName(null, COUNT);\n    /**\n     * XML meta-type attribute.\n     */\n    public static final String METATYPE = \"metatype\";\n    /**\n     * XML meta-type QName.\n     */\n    public static final QName METATYPE_QNAME = new QName(null, METATYPE);\n    /**\n     * XML null attribute.\n     */\n    public static final String NULL = \"null\";\n    /**\n     * XML null QName.\n     */\n    public static final QName NULL_QNAME = new QName(null, NULL);\n\n    /**\n     * Restricted constructor.\n     */\n    private JodaBeanXml() {\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/xml/JodaBeanXmlReader.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.xml;\n\nimport static org.joda.beans.ser.xml.JodaBeanXml.BEAN_QNAME;\nimport static org.joda.beans.ser.xml.JodaBeanXml.COLS_QNAME;\nimport static org.joda.beans.ser.xml.JodaBeanXml.COL_QNAME;\nimport static org.joda.beans.ser.xml.JodaBeanXml.COUNT_QNAME;\nimport static org.joda.beans.ser.xml.JodaBeanXml.ENTRY_QNAME;\nimport static org.joda.beans.ser.xml.JodaBeanXml.ITEM_QNAME;\nimport static org.joda.beans.ser.xml.JodaBeanXml.KEY_QNAME;\nimport static org.joda.beans.ser.xml.JodaBeanXml.METATYPE_QNAME;\nimport static org.joda.beans.ser.xml.JodaBeanXml.NULL_QNAME;\nimport static org.joda.beans.ser.xml.JodaBeanXml.ROWS_QNAME;\nimport static org.joda.beans.ser.xml.JodaBeanXml.ROW_QNAME;\nimport static org.joda.beans.ser.xml.JodaBeanXml.TYPE;\nimport static org.joda.beans.ser.xml.JodaBeanXml.TYPE_QNAME;\n\nimport java.io.InputStream;\nimport java.io.Reader;\nimport java.io.StringReader;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport javax.xml.stream.XMLEventReader;\nimport javax.xml.stream.XMLInputFactory;\nimport javax.xml.stream.events.StartElement;\nimport javax.xml.stream.events.XMLEvent;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerCategory;\nimport org.joda.beans.ser.SerIterable;\nimport org.joda.beans.ser.SerOptional;\nimport org.joda.beans.ser.SerTypeMapper;\n\n/**\n * Provides the ability for a Joda-Bean to read from XML.\n * <p>\n * The XML format is defined by {@link JodaBeanXmlWriter}.\n * <p>\n * This class contains mutable state and cannot be used from multiple threads.\n * A new instance must be created for each message.\n */\npublic class JodaBeanXmlReader {\n\n    // if you get a message like\n    // \"Message: JAXP00010001: The parser has encountered more than \"64000\" entity \n    // expansions in this document; this is the limit imposed by the JDK.\"\n    // then you need to update your JDK to 8u20 or later, see JDK-8028111\n    private static final XMLInputFactory XML_FACTORY;\n    static {\n        var factory = XMLInputFactory.newInstance();\n        factory.setProperty(XMLInputFactory.IS_COALESCING, true);\n        factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, true);\n        factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);\n        factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);\n        XML_FACTORY = factory;\n    }\n\n    /**\n     * Settings.\n     */\n    private final JodaBeanSer settings;\n    /**\n     * The reader.\n     */\n    private XMLEventReader reader;\n    /**\n     * The base package including the trailing dot.\n     */\n    private String basePackage;\n    /**\n     * The known types.\n     */\n    private final Map<String, Class<?>> knownTypes = new HashMap<>();\n\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings, not null\n     */\n    public JodaBeanXmlReader(final JodaBeanSer settings) {\n        this.settings = settings;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Reads and parses to a bean.\n     * \n     * @param input  the input string, not null\n     * @return the bean, not null\n     */\n    public Bean read(final String input) {\n        return read(input, Bean.class);\n    }\n\n    /**\n     * Reads and parses to a bean.\n     * \n     * @param <T>  the root type\n     * @param input  the input string, not null\n     * @param rootType  the root type, not null\n     * @return the bean, not null\n     */\n    public <T> T read(final String input, Class<T> rootType) {\n        return read(new StringReader(input), rootType);\n    }\n\n    /**\n     * Reads and parses to a bean.\n     * \n     * @param input  the input reader, not null\n     * @return the bean, not null\n     */\n    public Bean read(final InputStream input) {\n        return read(input, Bean.class);\n    }\n\n    /**\n     * Reads and parses to a bean.\n     * \n     * @param <T>  the root type\n     * @param input  the input stream, not null\n     * @param rootType  the root type, not null\n     * @return the bean, not null\n     */\n    public <T> T read(final InputStream input, Class<T> rootType) {\n        try {\n            try {\n                reader = XML_FACTORY.createXMLEventReader(input);\n                return read(rootType);\n            } finally {\n                if (reader != null) {\n                    reader.close();\n                }\n            }\n        } catch (RuntimeException ex) {\n            throw ex;\n        } catch (Exception ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    /**\n     * Reads and parses to a bean.\n     * \n     * @param input  the input reader, not null\n     * @return the bean, not null\n     */\n    public Bean read(final Reader input) {\n        return read(input, Bean.class);\n    }\n\n    /**\n     * Reads and parses to a bean.\n     * \n     * @param <T>  the root type\n     * @param input  the input reader, not null\n     * @param rootType  the root type, not null\n     * @return the bean, not null\n     */\n    public <T> T read(final Reader input, Class<T> rootType) {\n        try {\n            try {\n                reader = XML_FACTORY.createXMLEventReader(input);\n                return read(rootType);\n            } finally {\n                if (reader != null) {\n                    reader.close();\n                }\n            }\n        } catch (RuntimeException ex) {\n            throw ex;\n        } catch (Exception ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Parses the root bean.\n     * \n     * @param rootType  the root type, not null\n     * @return the bean, not null\n     * @throws Exception if an error occurs\n     */\n    private <T> T read(final Class<T> rootType) throws Exception {\n        var start = advanceToStartElement();\n        if (!start.getName().equals(BEAN_QNAME)) {\n            throw new IllegalArgumentException(\"Expected root element 'bean' but found '\" + start.getName() + \"'\");\n        }\n        var attr = start.getAttributeByName(TYPE_QNAME);\n        if (attr == null && rootType == Bean.class) {\n            throw new IllegalArgumentException(\"Root element attribute must specify '\" + TYPE + \"'\");\n        }\n        Class<?> effectiveType = rootType;\n        if (attr != null) {\n            var typeStr = attr.getValue();\n            effectiveType = SerTypeMapper.decodeType(typeStr, settings, null, knownTypes);\n            if (!rootType.isAssignableFrom(effectiveType)) {\n                throw new IllegalArgumentException(\"Specified root type is incompatible with XML root type: \" + rootType.getName() + \" and \" + effectiveType.getName());\n            }\n        }\n        if (!Bean.class.isAssignableFrom(effectiveType)) {\n            throw new IllegalArgumentException(\"Root type is not a Joda-Bean: \" + effectiveType.getName());\n        }\n        basePackage = effectiveType.getPackage().getName() + \".\";\n        var parsed = parseBean(effectiveType);\n        return rootType.cast(parsed);\n    }\n\n    /**\n     * Parses a logical bean in the input XML.\n     * <p>\n     * Return type allows for a non-bean to be returned.\n     * \n     * @param beanType  the bean type, not null\n     * @return the bean, not null\n     */\n    @SuppressWarnings(\"null\")\n    private Object parseBean(final Class<?> beanType) {\n        var propName = \"\";\n        try {\n            XMLEvent event = null;\n            // handle case where whole bean is Joda-Convert string\n            if (settings.getConverter().isConvertible(beanType)) {\n                var buf = new StringBuilder();\n                while (reader.hasNext()) {\n                    event = nextEvent(\">btxt \");\n                    if (event.isCharacters()) {\n                        buf.append(event.asCharacters().getData());\n                    } else if (event.isEndElement()) {\n                        return settings.getConverter().convertFromString(beanType, buf.toString());\n                    } else if (event.isStartElement()) {\n                        break;  // not serialized via Joda-Convert\n                    } else if (event.isEndDocument()) {\n                        throw new IllegalArgumentException(\"Unexpected end of document\");\n                    }\n                }\n            } else {\n                event = nextEvent(\">bean \");\n            }\n            // handle structured bean\n            var deser = settings.getDeserializers().findDeserializer(beanType);\n            var metaBean = deser.findMetaBean(beanType);\n            BeanBuilder<?> builder = deser.createBuilder(beanType, metaBean);\n            // handle beans with structure\n            while (!event.isEndElement()) {\n                if (event.isStartElement()) {\n                    var start = event.asStartElement();\n                    propName = start.getName().getLocalPart();\n                    MetaProperty<?> metaProp = deser.findMetaProperty(beanType, metaBean, propName);\n                    if (metaProp == null || metaProp.style().isDerived()) {\n                        var depth = 0;\n                        event = nextEvent(\" skip \");\n                        while (!event.isEndElement() || depth > 0) {\n                            if (event.isStartElement()) {\n                                depth++;\n                            } else if (event.isEndElement()) {\n                                depth--;\n                            }\n                            event = nextEvent(\" skip \");\n                        }\n                        // skip elements\n                    } else {\n                        Class<?> childType = parseTypeAttribute(start, SerOptional.extractType(metaProp, beanType));\n                        Object value;\n                        if (Bean.class.isAssignableFrom(childType)) {\n                            value = parseBean(childType);\n                        } else {\n                            var iterable = settings.getIteratorFactory().createIterable(metaProp, beanType);\n                            if (iterable != null) {\n                                value = parseIterable(start, iterable);\n                            } else {\n                                // metatype\n                                var metaTypeAttr = start.getAttributeByName(METATYPE_QNAME);\n                                if (metaTypeAttr != null) {\n                                    iterable = settings.getIteratorFactory().createIterable(metaTypeAttr.getValue(), settings, knownTypes);\n                                    if (iterable == null) {\n                                        throw new IllegalArgumentException(\"Invalid metaType\");\n                                    }\n                                    value = parseIterable(start, iterable);\n                                } else {\n                                    var text = advanceAndParseText();\n                                    value = settings.getConverter().convertFromString(childType, text);\n                                }\n                            }\n                        }\n                        deser.setValue(builder, metaProp, SerOptional.wrapValue(metaProp, beanType, value));\n                    }\n                    propName = \"\";\n                }\n                event = nextEvent(\".bean \");\n            }\n            return deser.build(beanType, builder);\n        } catch (Exception ex) {\n            throw new RuntimeException(\"Error parsing bean: \" + beanType.getName() + \"::\" + propName + \", \" + ex.getMessage(), ex);\n        }\n    }\n\n    /**\n     * Parses to a collection wrapper.\n     * \n     * @param iterable  the iterable builder, not null\n     * @return the iterable, not null\n     */\n    private Object parseIterable(final StartElement iterableEvent, final SerIterable iterable) throws Exception {\n        var rowsAttr = iterableEvent.getAttributeByName(ROWS_QNAME);\n        var columnsAttr = iterableEvent.getAttributeByName(COLS_QNAME);\n        if (rowsAttr != null && columnsAttr != null) {\n            iterable.dimensions(new int[] {Integer.parseInt(rowsAttr.getValue()), Integer.parseInt(columnsAttr.getValue())});\n        }\n        var event = nextEvent(\">iter \");\n        while (!event.isEndElement()) {\n            if (event.isStartElement()) {\n                var start = event.asStartElement();\n                var expectedType = iterable.category() == SerCategory.MAP ? ENTRY_QNAME : ITEM_QNAME;\n                if (!start.getName().equals(expectedType)) {\n                    throw new IllegalArgumentException(\"Expected '\" + expectedType.getLocalPart() + \"' but found '\" + start.getName() + \"'\");\n                }\n                var count = 1;\n                Object key = null;\n                Object column = null;\n                Object value = null;\n                if (iterable.category() == SerCategory.COUNTED) {\n                    var countAttr = start.getAttributeByName(COUNT_QNAME);\n                    if (countAttr != null) {\n                        count = Integer.parseInt(countAttr.getValue());\n                    }\n                    value = parseValue(iterable, start);\n                    \n                } else if (iterable.category() == SerCategory.TABLE || iterable.category() == SerCategory.GRID) {\n                    var rowAttr = start.getAttributeByName(ROW_QNAME);\n                    var colAttr = start.getAttributeByName(COL_QNAME);\n                    if (rowAttr == null || colAttr == null) {\n                        throw new IllegalArgumentException(\"Unable to read table as row/col attribute missing\");\n                    }\n                    var rowStr = rowAttr.getValue();\n                    if (iterable.keyType() != null) {\n                        key = settings.getConverter().convertFromString(iterable.keyType(), rowStr);\n                    } else {\n                        key = rowStr;\n                    }\n                    var colStr = colAttr.getValue();\n                    if (iterable.columnType() != null) {\n                        column = settings.getConverter().convertFromString(iterable.columnType(), colStr);\n                    } else {\n                        column = colStr;\n                    }\n                    value = parseValue(iterable, start);\n                    \n                } else if (iterable.category() == SerCategory.MAP) {\n                    var keyAttr = start.getAttributeByName(KEY_QNAME);\n                    if (keyAttr != null) {\n                        // item is value with a key attribute\n                        var keyStr = keyAttr.getValue();\n                        if (iterable.keyType() != null) {\n                            key = settings.getConverter().convertFromString(iterable.keyType(), keyStr);\n                        } else {\n                            key = keyStr;\n                        }\n                        value = parseValue(iterable, start);\n                        \n                    } else {\n                        // two items nested in this entry\n                        event = nextEvent(\">>map \");\n                        var loop = 0;\n                        while (!event.isEndElement()) {\n                            if (event.isStartElement()) {\n                                start = event.asStartElement();\n                                if (!start.getName().equals(ITEM_QNAME)) {\n                                    throw new IllegalArgumentException(\"Expected 'item' but found '\" + start.getName() + \"'\");\n                                }\n                                if (key == null) {\n                                    key = parseKey(iterable, start);\n                                } else {\n                                    value = parseValue(iterable, start);\n                                }\n                                loop++;\n                            }\n                            event = nextEvent(\"..map \");\n                        }\n                        if (loop != 2) {\n                            throw new IllegalArgumentException(\"Expected 2 'item's but found \" + loop);\n                        }\n                    }                    \n                    \n                } else {  // COLLECTION\n                    value = parseValue(iterable, start);\n                }\n                iterable.add(key, column, value, count);\n            }\n            event = nextEvent(\".iter \");\n        }\n        return iterable.build();\n    }\n\n    private Object parseKey(final SerIterable iterable, StartElement start) throws Exception {\n        // type\n        Class<?> childType = parseTypeAttribute(start, iterable.keyType());\n        if (Bean.class.isAssignableFrom(childType) || settings.getConverter().isConvertible(childType)) {\n            return parseBean(childType);\n        } else if (childType.isAssignableFrom(String.class)) {\n            return parseBean(String.class);\n        } else {\n            throw new IllegalArgumentException(\"Unable to read map as parsed key type is neither a bean nor a simple type: \" + childType.getName());\n        }\n    }\n\n    private Object parseValue(final SerIterable iterable, StartElement start) throws Exception {\n        // null\n        Object value;\n        var nullAttr = start.getAttributeByName(NULL_QNAME);\n        if (nullAttr != null) {\n            if (!nullAttr.getValue().equals(\"true\")) {\n                throw new IllegalArgumentException(\"Unexpected value for null attribute\");\n            }\n            advanceAndParseText();  // move to end tag and ignore any text\n            value = null;\n        } else {\n            // type\n            Class<?> childType = parseTypeAttribute(start, iterable.valueType());\n            if (Bean.class.isAssignableFrom(childType)) {\n                value = parseBean(childType);\n            } else {\n                // try deep generic parameters\n                var childIterable = settings.getIteratorFactory().createIterable(iterable);\n                if (childIterable != null) {\n                    value = parseIterable(start, childIterable);\n                } else {\n                    // metatype\n                    var metaTypeAttr = start.getAttributeByName(METATYPE_QNAME);\n                    if (metaTypeAttr != null) {\n                        childIterable = settings.getIteratorFactory().createIterable(metaTypeAttr.getValue(), settings, knownTypes);\n                        if (childIterable == null) {\n                            throw new IllegalArgumentException(\"Invalid metaType\");\n                        }\n                        value = parseIterable(start, childIterable);\n                    } else {\n                        var text = advanceAndParseText();\n                        value = settings.getConverter().convertFromString(childType, text);\n                    }\n                }\n            }\n        }\n        return value;\n    }\n\n    //-----------------------------------------------------------------------\n    private Class<?> parseTypeAttribute(StartElement start, Class<?> defaultType) throws ClassNotFoundException {\n        var typeAttr = start.getAttributeByName(TYPE_QNAME);\n        if (typeAttr == null) {\n            return (defaultType == Object.class ? String.class : defaultType);\n        }\n        var typeStr = typeAttr.getValue();\n        return settings.getDeserializers().decodeType(typeStr, settings, basePackage, knownTypes, defaultType);\n    }\n\n    // reader can be anywhere, but normally at StartDocument\n    private StartElement advanceToStartElement() throws Exception {\n        while (reader.hasNext()) {\n            var event = nextEvent(\"advnc \");\n            if (event.isStartElement()) {\n                return event.asStartElement();\n            }\n        }\n        throw new IllegalArgumentException(\"Unexpected end of document\");\n    }\n\n    // reader must be at StartElement\n    private String advanceAndParseText() throws Exception {\n        var buf = new StringBuilder();\n        while (reader.hasNext()) {\n            var event = nextEvent(\"text  \");\n            if (event.isCharacters()) {\n                buf.append(event.asCharacters().getData());\n            } else if (event.isEndElement()) {\n                return buf.toString();\n            } else if (event.isStartElement()) {\n                throw new IllegalArgumentException(\"Unexpected start tag\");\n            }\n        }\n        throw new IllegalArgumentException(\"Unexpected end of document\");\n    }\n\n    // provide for debugging\n    private XMLEvent nextEvent(String location) throws Exception {\n        var event = reader.nextEvent();\n//        System.out.println(location + event.toString().replace('\\n', ' ') + \" \" + event.getClass().getSimpleName());\n        return event;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/xml/JodaBeanXmlWriter.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.xml;\n\nimport static org.joda.beans.ser.xml.JodaBeanXml.BEAN;\nimport static org.joda.beans.ser.xml.JodaBeanXml.COL;\nimport static org.joda.beans.ser.xml.JodaBeanXml.COLS;\nimport static org.joda.beans.ser.xml.JodaBeanXml.COUNT;\nimport static org.joda.beans.ser.xml.JodaBeanXml.ENTRY;\nimport static org.joda.beans.ser.xml.JodaBeanXml.ITEM;\nimport static org.joda.beans.ser.xml.JodaBeanXml.KEY;\nimport static org.joda.beans.ser.xml.JodaBeanXml.METATYPE;\nimport static org.joda.beans.ser.xml.JodaBeanXml.NULL;\nimport static org.joda.beans.ser.xml.JodaBeanXml.ROW;\nimport static org.joda.beans.ser.xml.JodaBeanXml.ROWS;\nimport static org.joda.beans.ser.xml.JodaBeanXml.TYPE;\n\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Objects;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerCategory;\nimport org.joda.beans.ser.SerIterator;\nimport org.joda.beans.ser.SerOptional;\nimport org.joda.beans.ser.SerTypeMapper;\nimport org.joda.convert.StringConverter;\n\n/**\n * Provides the ability for a Joda-Bean to be written to XML.\n * <p>\n * This class contains mutable state and cannot be used from multiple threads.\n * A new instance must be created for each message.\n * <p>\n * The XML consists of a root level 'bean' element with a 'type' attribute.\n * At each subsequent level, a bean is output using the property name.\n * Where necessary, the 'type' attribute is used to clarify a type.\n * <p>\n * Simple types, defined by Joda-Convert, are output as strings.\n * Beans are output recursively within the parent property element.\n * Collections are output using 'item' elements within the property element.\n * The 'item' elements will use 'key' for map keys, 'count' for multiset counts\n * and 'null=true' for null entries. Note that map keys must be simple types.\n * <p>\n * If a collection contains a collection then more information is written.\n * A 'metatype' attribute is added to define the high level type, such as List.\n * At this level, the data read back may not be identical to that written.\n * <p>\n * Type names are shortened by the package of the root type if possible.\n * Certain basic types are also handled, such as String, Integer, File and URI.\n */\npublic class JodaBeanXmlWriter {\n\n    /**\n     * The settings to use.\n     */\n    private final JodaBeanSer settings;\n    /**\n     * The string builder, may be null.\n     */\n    private final StringBuilder builder;\n    /**\n     * The location to output to.\n     */\n    private Appendable output;\n    /**\n     * The root bean.\n     */\n    private Bean rootBean;\n    /**\n     * The base package including the trailing dot.\n     */\n    private String basePackage;\n    /**\n     * The known types.\n     */\n    private final Map<Class<?>, String> knownTypes = new HashMap<>();\n\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings to use, not null\n     */\n    public JodaBeanXmlWriter(JodaBeanSer settings) {\n        this.settings = settings;\n        this.builder = null;\n    }\n\n    /**\n     * Creates an instance.\n     * \n     * @param settings  the settings to use, not null\n     * @param builder  the builder to output to, not null\n     */\n    public JodaBeanXmlWriter(JodaBeanSer settings, StringBuilder builder) {\n        this.settings = settings;\n        this.builder = builder;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Writes the bean to a string.\n     * <p>\n     * The type of the bean will be set in the message.\n     * \n     * @param bean  the bean to output, not null\n     * @return the XML, not null\n     */\n    public String write(Bean bean) {\n        return write(bean, true);\n    }\n\n    /**\n     * Writes the bean to a string.\n     * \n     * @param bean  the bean to output, not null\n     * @param rootType  true to output the root type\n     * @return the XML, not null\n     */\n    public String write(Bean bean, boolean rootType) {\n        var builder = this.builder != null ? this.builder : new StringBuilder(1024);\n        try {\n            write(bean, rootType, builder);\n        } catch (IOException ex) {\n            throw new IllegalStateException(ex);\n        }\n        return builder.toString();\n    }\n\n    /**\n     * Writes the bean to the {@code Appendable}.\n     * <p>\n     * The type of the bean will be set in the message.\n     *\n     * @param bean  the bean to output, not null\n     * @param output  the output appendable, not null\n     * @throws IOException if an error occurs\n     */\n    public void write(Bean bean, Appendable output) throws IOException {\n        write(bean, true, output);\n    }\n\n    /**\n     * Writes the bean to the {@code Appendable}.\n     *\n     * @param bean  the bean to output, not null\n     * @param rootType  true to output the root type\n     * @param output  the output appendable, not null\n     * @throws IOException if an error occurs\n     */\n    public void write(Bean bean, boolean rootType, Appendable output) throws IOException {\n        this.output = output;\n        this.rootBean = Objects.requireNonNull(bean, \"bean must not be null\");\n        this.basePackage = (rootType ? bean.getClass().getPackage().getName() + \".\" : null);\n        \n        var type = rootBean.getClass().getName();\n        writeHeader();\n        output.append('<').append(BEAN);\n        if (rootType) {\n            appendAttribute(output, TYPE, type);\n        }\n        output.append('>').append(settings.getNewLine());\n        writeBean(rootBean, settings.getIndent());\n        output.append('<').append('/').append(BEAN).append('>').append(settings.getNewLine());\n    }\n\n    private void writeHeader() throws IOException {\n        output.append(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\").append(settings.getNewLine());\n    }\n\n    //-----------------------------------------------------------------------\n    private boolean willWriteBean(Bean bean) {\n        for (MetaProperty<?> prop : bean.metaBean().metaPropertyIterable()) {\n            if (prop.style().isSerializable() || (prop.style().isDerived() && settings.isIncludeDerived())) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private void writeBean(Bean bean, String currentIndent) throws IOException {\n        for (MetaProperty<?> prop : bean.metaBean().metaPropertyIterable()) {\n            if (prop.style().isSerializable() || (prop.style().isDerived() && settings.isIncludeDerived())) {\n                var value = SerOptional.extractValue(prop, bean);\n                if (value != null) {\n                    var propName = prop.name();\n                    Class<?> propType = SerOptional.extractType(prop, bean.getClass());\n                    if (value instanceof Bean beanValue) {\n                        if (settings.getConverter().isConvertible(value.getClass())) {\n                            writeSimple(currentIndent, propName, new StringBuilder(), propType, value);\n                        } else {\n                            writeBean(currentIndent, propName, new StringBuilder(), propType, beanValue);\n                        }\n                    } else {\n                        var itemIterator = settings.getIteratorFactory().create(value, prop, bean.getClass());\n                        if (itemIterator != null) {\n                            writeElements(currentIndent, propName, new StringBuilder(), itemIterator);\n                        } else {\n                            writeSimple(currentIndent, propName, new StringBuilder(), propType, value);\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    private void writeBean(String currentIndent, String tagName, StringBuilder attrs, Class<?> propType, Bean value) throws IOException {\n        if (value == null) {\n            throw new IllegalArgumentException(\"Bean cannot be null\");\n        }\n        output.append(currentIndent).append('<').append(tagName).append(attrs);\n        if (value.getClass() != propType) {\n            var typeStr = SerTypeMapper.encodeType(value.getClass(), settings, basePackage, knownTypes);\n            appendAttribute(output, TYPE, typeStr);\n        }\n        if (willWriteBean(value)) {\n            output.append('>').append(settings.getNewLine());\n            writeBean(value, currentIndent + settings.getIndent());\n            output.append(currentIndent).append('<').append('/').append(tagName).append('>').append(settings.getNewLine());\n        } else {\n            output.append('/').append('>').append(settings.getNewLine());\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    private void writeElements(String currentIndent, String tagName, StringBuilder attrs, SerIterator itemIterator) throws IOException {\n        if (itemIterator.metaTypeRequired()) {\n            appendAttribute(attrs, METATYPE, itemIterator.metaTypeName());\n        }\n        if (itemIterator.category() == SerCategory.GRID) {\n            appendAttribute(attrs, ROWS, Integer.toString(itemIterator.dimensionSize(0)));\n            appendAttribute(attrs, COLS, Integer.toString(itemIterator.dimensionSize(1)));\n        }\n        if (itemIterator.size() == 0) {\n            output.append(currentIndent).append('<').append(tagName).append(attrs).append('/').append('>').append(settings.getNewLine());\n        } else {\n            output.append(currentIndent).append('<').append(tagName).append(attrs).append('>').append(settings.getNewLine());\n            writeElements(currentIndent + settings.getIndent(), itemIterator);\n            output.append(currentIndent).append('<').append('/').append(tagName).append('>').append(settings.getNewLine());\n        }\n    }\n\n    private void writeElements(String currentIndent, SerIterator itemIterator) throws IOException {\n        // find converter once for performance, and before checking if key is bean\n        StringConverter<Object> keyConverter = null;\n        StringConverter<Object> rowConverter = null;\n        StringConverter<Object> columnConverter = null;\n        var keyBean = false;\n        if (itemIterator.category() == SerCategory.TABLE || itemIterator.category() == SerCategory.GRID) {\n            try {\n                rowConverter = settings.getConverter().findConverterNoGenerics(itemIterator.keyType());\n            } catch (RuntimeException ex) {\n                throw new IllegalArgumentException(\"Unable to write table/grid as declared key type is not a simple type: \" + itemIterator.keyType().getName(), ex);\n            }\n            try {\n                columnConverter = settings.getConverter().findConverterNoGenerics(itemIterator.columnType());\n            } catch (RuntimeException ex) {\n                throw new IllegalArgumentException(\"Unable to write table/grid as declared column type is not a simple type: \" + itemIterator.columnType().getName(), ex);\n            }\n        } else if (itemIterator.category() == SerCategory.MAP) {\n            // if key type is known and convertible use short key format, else use full bean format\n            if (settings.getConverter().isConvertible(itemIterator.keyType())) {\n                keyConverter = settings.getConverter().findConverterNoGenerics(itemIterator.keyType());\n            } else {\n                keyBean = true;\n            }\n        }\n        // output each item\n        while (itemIterator.hasNext()) {\n            itemIterator.next();\n            var attr = new StringBuilder(32);\n            if (keyConverter != null) {\n                var keyStr = convertToString(keyConverter, itemIterator.key(), \"map key\");\n                appendAttribute(attr, KEY, keyStr);\n            }\n            if (rowConverter != null) {\n                var rowStr = convertToString(rowConverter, itemIterator.key(), \"table row\");\n                appendAttribute(attr, ROW, rowStr);\n                var colStr = convertToString(columnConverter, itemIterator.column(), \"table column\");\n                appendAttribute(attr, COL, colStr);\n            }\n            if (itemIterator.count() != 1) {\n                appendAttribute(attr, COUNT, Integer.toString(itemIterator.count()));\n            }\n            if (keyBean) {\n                var key = itemIterator.key();\n                output.append(currentIndent).append('<').append(ENTRY).append(attr).append('>').append(settings.getNewLine());\n                writeKeyElement(currentIndent + settings.getIndent(), key, itemIterator);\n                writeValueElement(currentIndent + settings.getIndent(), ITEM, new StringBuilder(), itemIterator);\n                output.append(currentIndent).append('<').append('/').append(ENTRY).append('>').append(settings.getNewLine());\n            } else {\n                var tagName = itemIterator.category() == SerCategory.MAP ? ENTRY : ITEM;\n                writeValueElement(currentIndent, tagName, attr, itemIterator);\n            }\n        }\n    }\n\n    private String convertToString(StringConverter<Object> converter, Object obj, String description) {\n        if (obj == null) {\n            throw new IllegalArgumentException(\"Unable to write \" + description + \" as it cannot be null\");\n        }\n        var str = encodeAttribute(converter.convertToString(obj));\n        if (str == null) {\n            throw new IllegalArgumentException(\"Unable to write \" + description + \" as it cannot be a null string: \" + obj);\n        }\n        return str;\n    }\n\n    private void writeKeyElement(String currentIndent, Object key, SerIterator itemIterator) throws IOException {\n        if (key == null) {\n            throw new IllegalArgumentException(\"Unable to write map key as it cannot be null\");\n        }\n        // if key type is known and convertible use short key format\n        if (settings.getConverter().isConvertible(itemIterator.keyType())) {\n            writeSimple(currentIndent, ITEM, new StringBuilder(), Object.class, key);\n        } else if (key instanceof Bean bean) {\n            writeBean(currentIndent, ITEM, new StringBuilder(), itemIterator.keyType(), bean);\n        } else {\n            // this case covers where the key type is not known, such as an Object meta-property\n            try {\n                writeSimple(currentIndent, ITEM, new StringBuilder(), Object.class, key);\n            } catch (RuntimeException ex) {\n                throw new IllegalArgumentException(\"Unable to write map as declared key type is neither a bean nor a simple type: \" + itemIterator.keyType().getName(), ex);\n            }\n        }\n    }\n\n    private void writeValueElement(String currentIndent, String tagName, StringBuilder attrs, SerIterator itemIterator) throws IOException {\n        var value = itemIterator.value();\n        Class<?> valueType = itemIterator.valueType();\n        if (value == null) {\n            appendAttribute(attrs, NULL, \"true\");\n            output.append(currentIndent).append('<').append(tagName).append(attrs).append(\"/>\").append(settings.getNewLine());\n        } else if (value instanceof Bean bean) {\n            if (settings.getConverter().isConvertible(value.getClass())) {\n                writeSimple(currentIndent, tagName, attrs, valueType, value);\n            } else {\n                writeBean(currentIndent, tagName, attrs, valueType, bean);\n            }\n        } else {\n            var childIterator = settings.getIteratorFactory().createChild(value, itemIterator);\n            if (childIterator != null) {\n                writeElements(currentIndent, tagName, attrs, childIterator);\n            } else {\n                writeSimple(currentIndent, tagName, attrs, valueType, value);\n            }\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    private void writeSimple(String currentIndent, String tagName, StringBuilder attrs, Class<?> declaredType, Object value) throws IOException {\n        Class<?> effectiveType;\n        if (declaredType == Object.class) {\n            Class<?> realType = value.getClass();\n            if (realType != String.class) {\n                effectiveType = settings.getConverter().findTypedConverter(realType).getEffectiveType();\n                var typeStr = SerTypeMapper.encodeType(effectiveType, settings, basePackage, knownTypes);\n                appendAttribute(attrs, TYPE, typeStr);\n            } else {\n                effectiveType = realType;\n            }\n        } else if (!settings.getConverter().isConvertible(declaredType)) {\n            effectiveType = settings.getConverter().findTypedConverter(value.getClass()).getEffectiveType();\n            var typeStr = SerTypeMapper.encodeType(effectiveType, settings, basePackage, knownTypes);\n            appendAttribute(attrs, TYPE, typeStr);\n        } else {\n            effectiveType = declaredType;\n        }\n        try {\n            var converted = settings.getConverter().convertToString(effectiveType, value);\n            if (converted == null) {\n                throw new IllegalArgumentException(\"Unable to write because converter returned a null string: \" + value);\n            }\n            output.append(currentIndent).append('<').append(tagName).append(attrs).append('>');\n            appendEncoded(converted);\n            output.append('<').append('/').append(tagName).append('>').append(settings.getNewLine());\n        } catch (RuntimeException ex) {\n            throw new IllegalArgumentException(\"Unable to convert type \" + effectiveType.getName() + \" declared as \" + declaredType.getName(), ex);\n        }\n    }\n\n    private void appendEncoded(String text) throws IOException {\n        for (var i = 0; i < text.length(); i++) {\n            var ch = text.charAt(i);\n            switch (ch) {\n                case '&':\n                    output.append(\"&amp;\");\n                    break;\n                case '<':\n                    output.append(\"&lt;\");\n                    break;\n                case '>':\n                    output.append(\"&gt;\");\n                    break;\n                case '\\t':\n                case '\\n':\n                case '\\r':\n                    output.append(ch);\n                    break;\n                default:\n                    if (ch < 32) {\n                        throw new IllegalArgumentException(\"Invalid character for XML: \" + ((int) ch));\n                    }\n                    output.append(ch);\n                    break;\n            }\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    private void appendAttribute(Appendable buf, String attrName, String encodedValue) throws IOException {\n        buf.append(' ').append(attrName).append('=').append('\\\"').append(encodedValue).append('\\\"');\n    }\n\n    private String encodeAttribute(String text) {\n        if (text == null) {\n            return null;\n        }\n        return appendEncodedAttribute(new StringBuilder(text.length() + 16), text).toString();\n    }\n\n    private StringBuilder appendEncodedAttribute(StringBuilder builder, String text) {\n        for (var i = 0; i < text.length(); i++) {\n            var ch = text.charAt(i);\n            switch (ch) {\n                case '&':\n                    builder.append(\"&amp;\");\n                    break;\n                case '<':\n                    builder.append(\"&lt;\");\n                    break;\n                case '>':\n                    builder.append(\"&gt;\");\n                    break;\n                case '\"':\n                    builder.append(\"&quot;\");\n                    break;\n                case '\\'':\n                    builder.append(\"&apos;\");\n                    break;\n                case '\\t':\n                    builder.append(\"&#09;\");\n                    break;\n                case '\\n':\n                    builder.append(\"&#0A;\");\n                    break;\n                case '\\r':\n                    builder.append(\"&#0D;\");\n                    break;\n                default:\n                    if (ch < 32) {\n                        throw new IllegalArgumentException(\"Invalid character for XML: \" + ((int) ch));\n                    }\n                    builder.append(ch);\n                    break;\n            }\n        }\n        return builder;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/ser/xml/package-info.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n\n/**\n * Serialization of Joda-Beans using XML.\n */\npackage org.joda.beans.ser.xml;\n"
  },
  {
    "path": "src/main/java/org/joda/beans/test/BeanAssert.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.test;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\nimport java.util.Map;\r\n\r\nimport org.joda.beans.Bean;\r\nimport org.joda.beans.JodaBeanUtils;\r\nimport org.joda.beans.MetaProperty;\r\n\r\n/**\r\n * Assertion class to compare beans.\r\n * <p>\r\n * This class fulfils a similar role to other assertion libraries in testing code.\r\n * It should generally be statically imported.\r\n */\r\npublic final class BeanAssert {\r\n\r\n    /**\r\n     * Restricted constructor.\r\n     */\r\n    private BeanAssert() {\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Asserts that two beans are equal, providing a better error message.\r\n     * \r\n     * @param expected  the expected value, not null\r\n     * @param actual  the actual value, not null\r\n     */\r\n    public static void assertBeanEquals(Bean expected, Bean actual) {\r\n        assertBeanEquals(null, expected, actual, 0d);\r\n    }\r\n\r\n    /**\r\n     * Asserts that two beans are equal, providing a better error message.\r\n     * <p>\r\n     * Note that specifying a tolerance can mean that two beans compare as not\r\n     * equal using {@link Object#equals(Object)} but equal using this method,\r\n     * because the standard equals method has no tolerance.\r\n     * \r\n     * @param expected  the expected value, not null\r\n     * @param actual  the actual value, not null\r\n     * @param tolerance  the tolerance to use for {@code double} and {@code float}\r\n     */\r\n    public static void assertBeanEquals(Bean expected, Bean actual, double tolerance) {\r\n        assertBeanEquals(null, expected, actual, tolerance);\r\n    }\r\n\r\n    /**\r\n     * Asserts that two beans are equal, providing a better error message.\r\n     * \r\n     * @param baseMsg  the message to use in any error, null uses default message\r\n     * @param expected  the expected value, not null\r\n     * @param actual  the actual value, not null\r\n     */\r\n    public static void assertBeanEquals(String baseMsg, Bean expected, Bean actual) {\r\n        assertBeanEquals(baseMsg, expected, actual, 0d);\r\n    }\r\n\r\n    /**\r\n     * Asserts that two beans are equal, providing a better error message.\r\n     * <p>\r\n     * Note that specifying a tolerance can mean that two beans compare as not\r\n     * equal using {@link Object#equals(Object)} but equal using this method,\r\n     * because the standard equals method has no tolerance.\r\n     * \r\n     * @param baseMsg  the message to use in any error, null uses default message\r\n     * @param expected  the expected value, not null\r\n     * @param actual  the actual value, not null\r\n     * @param tolerance  the tolerance to use for {@code double} and {@code float}\r\n     */\r\n    public static void assertBeanEquals(String baseMsg, Bean expected, Bean actual, double tolerance) {\r\n        if (expected == null) {\r\n            throw new AssertionError(baseMsg + \": Expected bean must not be null\");\r\n        }\r\n        if (actual == null) {\r\n            throw new AssertionError(baseMsg + \": Actual bean must not be null\");\r\n        }\r\n        if (!expected.equals(actual)) {\r\n            var comparisonMsg = buildMessage(baseMsg, 10, expected, actual, tolerance);\r\n            if (comparisonMsg.isEmpty()) {\r\n                return; // no errors, just double/float within tolerance\r\n            }\r\n            throw new BeanComparisonError(comparisonMsg, expected, actual);\r\n        }\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Asserts that two beans are equal, providing a better error message.\r\n     * \r\n     * @param expected  the expected value, not null\r\n     * @param actual  the actual value, not null\r\n     */\r\n    public static void assertBeanEqualsFullDetail(Bean expected, Bean actual) {\r\n        assertBeanEqualsFullDetail(null, expected, actual, 0d);\r\n    }\r\n\r\n    /**\r\n     * Asserts that two beans are equal, providing a better error message.\r\n     * <p>\r\n     * Note that specifying a tolerance can mean that two beans compare as not\r\n     * equal using {@link Object#equals(Object)} but equal using this method,\r\n     * because the standard equals method has no tolerance.\r\n     * \r\n     * @param expected  the expected value, not null\r\n     * @param actual  the actual value, not null\r\n     * @param tolerance  the tolerance to use for {@code double} and {@code float}\r\n     */\r\n    public static void assertBeanEqualsFullDetail(Bean expected, Bean actual, double tolerance) {\r\n        assertBeanEqualsFullDetail(null, expected, actual, tolerance);\r\n    }\r\n\r\n    /**\r\n     * Asserts that two beans are equal, providing a better error message, with\r\n     * an unlimited number of errors reported.\r\n     * \r\n     * @param baseMsg  the message to use in any error, null uses default message\r\n     * @param expected  the expected value, not null\r\n     * @param actual  the actual value, not null\r\n     */\r\n    public static void assertBeanEqualsFullDetail(String baseMsg, Bean expected, Bean actual) {\r\n        assertBeanEqualsFullDetail(baseMsg, expected, actual, 0d);\r\n    }\r\n\r\n    /**\r\n     * Asserts that two beans are equal, providing a better error message, with\r\n     * an unlimited number of errors reported.\r\n     * <p>\r\n     * Note that specifying a tolerance can mean that two beans compare as not\r\n     * equal using {@link Object#equals(Object)} but equal using this method,\r\n     * because the standard equals method has no tolerance.\r\n     * \r\n     * @param baseMsg  the message to use in any error, null uses default message\r\n     * @param expected  the expected value, not null\r\n     * @param actual  the actual value, not null\r\n     * @param tolerance  the tolerance to use for {@code double} and {@code float}\r\n     */\r\n    public static void assertBeanEqualsFullDetail(String baseMsg, Bean expected, Bean actual, double tolerance) {\r\n        if (expected == null) {\r\n            throw new AssertionError(baseMsg + \": Expected bean must not be null\");\r\n        }\r\n        if (actual == null) {\r\n            throw new AssertionError(baseMsg + \": Actual bean must not be null\");\r\n        }\r\n        if (!expected.equals(actual)) {\r\n            var comparisonMsg = buildMessage(baseMsg, Integer.MAX_VALUE, expected, actual, tolerance);\r\n            if (comparisonMsg.isEmpty()) {\r\n                return; // no errors, just double/float within tolerance\r\n            }\r\n            throw new BeanComparisonError(comparisonMsg, expected, actual);\r\n        }\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    /**\r\n     * Compares the two beans.\r\n     * \r\n     * @param baseMsg  the message, may be null\r\n     * @param maxErrors  the maximum number of errors to report\r\n     * @param expected  the expected value, not null\r\n     * @param actual  the actual value, not null\r\n     * @param tolerance  the tolerance to use for {@code double} and {@code float}\r\n     * @return the message, not null\r\n     */\r\n    private static String buildMessage(String baseMsg, int maxErrors, Bean expected, Bean actual, double tolerance) {\r\n        List<String> diffs = new ArrayList<>();\r\n        buildMessage(diffs, \"\", expected, actual, tolerance);\r\n        if (diffs.isEmpty()) {\r\n            return \"\";\r\n        }\r\n        var buf = new StringBuilder();\r\n        buf.append(baseMsg != null ? baseMsg + \": \" : \"\");\r\n        buf.append(\"Bean did not equal expected. Differences:\");\r\n        var size = diffs.size();\r\n        if (size > maxErrors) {\r\n            diffs = diffs.subList(0, maxErrors);\r\n        }\r\n        for (String diff : diffs) {\r\n            buf.append('\\n').append(diff);\r\n        }\r\n        if (size > maxErrors) {\r\n            buf.append(\"\\n...and \").append(size - 10).append(\" more differences\");\r\n        }\r\n        return buf.toString();\r\n    }\r\n\r\n    private static void buildMessage(List<String> diffs, String prefix, Object expected, Object actual, double tolerance) {\r\n        if (expected == null) {\r\n            if (actual == null) {\r\n                return;\r\n            } else {\r\n                diffs.add(prefix + \": Expected null, but was \" + buildSummary(actual, true));\r\n                return;\r\n            }\r\n        }\r\n        if (actual == null) {\r\n            diffs.add(prefix + \": Was null, but expected \" + buildSummary(expected, true));\r\n            return;\r\n        }\r\n        if (expected.equals(actual)) {\r\n            return;\r\n        }\r\n        if (expected instanceof List<?> expectedList && actual instanceof List<?> actualList) {\r\n            if (expectedList.size() != actualList.size()) {\r\n                diffs.add(prefix + \": List size differs, expected \" + expectedList.size() + \" but was \" + actualList.size());\r\n                return;\r\n            }\r\n            for (var i = 0; i < expectedList.size(); i++) {\r\n                buildMessage(diffs, prefix + '[' + i + \"]\", expectedList.get(i), actualList.get(i), tolerance);\r\n            }\r\n            return;\r\n        }\r\n        if (expected instanceof Map<?, ?> expectedMap && actual instanceof Map<?, ?> actualMap) {\r\n            if (expectedMap.size() != actualMap.size()) {\r\n                diffs.add(prefix + \": Map size differs, expected \" + expectedMap.size() + \" but was \" + actualMap.size());\r\n                return;\r\n            }\r\n            if (!expectedMap.keySet().equals(actualMap.keySet())) {\r\n                diffs.add(prefix + \": Map keySet differs, expected \" + buildSummary(expectedMap.keySet(), false) + \" but was \" + buildSummary(actualMap.keySet(), false));\r\n                return;\r\n            }\r\n            for (var key : expectedMap.keySet()) {\r\n                buildMessage(diffs, prefix + '[' + key + \"]\", expectedMap.get(key), actualMap.get(key), tolerance);\r\n            }\r\n            return;\r\n        }\r\n        if (expected.getClass() != actual.getClass()) {\r\n            diffs.add(prefix + \": Class differs, expected \" + buildSummary(expected, true) + \" but was \" + buildSummary(actual, true));\r\n            return;\r\n        }\r\n        if (expected instanceof Bean) {\r\n            for (MetaProperty<?> prop : ((Bean) expected).metaBean().metaPropertyIterable()) {\r\n                buildMessage(diffs, prefix + '.' + prop.name(), prop.get((Bean) expected), prop.get((Bean) actual), tolerance);\r\n            }\r\n            return;\r\n        }\r\n        if (expected instanceof Double e && tolerance != 0d) {\r\n            var a = (Double) actual;\r\n            if (!JodaBeanUtils.equalWithTolerance(e, a, tolerance)) {\r\n                diffs.add(prefix + \": Double values differ by more than allowed tolerance, expected \" +\r\n                    buildSummary(expected, true) + \" but was \" + buildSummary(actual, false));\r\n            }\r\n            return;\r\n        }\r\n        if (expected instanceof double[] e && tolerance != 0d) {\r\n            var a = (double[]) actual;\r\n            if (e.length != a.length) {\r\n                diffs.add(prefix + \": Double arrays differ in length, expected \" +\r\n                                buildSummary(expected, true) + \" but was \" + buildSummary(actual, false));\r\n            } else {\r\n                for (var i = 0; i < a.length; i++) {\r\n                    if (!JodaBeanUtils.equalWithTolerance(e[i], a[i], tolerance)) {\r\n                        diffs.add(prefix + \": Double arrays differ by more than allowed tolerance, expected \" +\r\n                            buildSummary(expected, true) + \" but was \" + buildSummary(actual, false));\r\n                        break;\r\n                    }\r\n                }\r\n            }\r\n            return;\r\n        }\r\n        if (expected instanceof Float e && tolerance != 0d) {\r\n            var a = (Float) actual;\r\n            if (!JodaBeanUtils.equalWithTolerance(e, a, tolerance)) {\r\n                diffs.add(prefix + \": Float values differ by more than allowed tolerance, expected \" +\r\n                    buildSummary(expected, true) + \" but was \" + buildSummary(actual, false));\r\n            }\r\n            return;\r\n        }\r\n        if (expected instanceof float[] e && tolerance != 0d) {\r\n            var a = (float[]) actual;\r\n            if (e.length != a.length) {\r\n                diffs.add(prefix + \": Float arrays differ in length, expected \" +\r\n                                buildSummary(expected, true) + \" but was \" + buildSummary(actual, false));\r\n            } else {\r\n                for (var i = 0; i < a.length; i++) {\r\n                    if (!JodaBeanUtils.equalWithTolerance(e[i], a[i], tolerance)) {\r\n                        diffs.add(prefix + \": Float arrays differ by more than allowed tolerance, expected \" +\r\n                            buildSummary(expected, true) + \" but was \" + buildSummary(actual, false));\r\n                        break;\r\n                    }\r\n                }\r\n            }\r\n            return;\r\n        }\r\n        if (!JodaBeanUtils.equal(expected, actual)) {\r\n            diffs.add(prefix + \": Content differs, expected \" + buildSummary(expected, true) + \" but was \" + buildSummary(actual, false));\r\n        }\r\n        // equal\r\n    }\r\n\r\n    /**\r\n     * Builds a summary of an object.\r\n     * \r\n     * @param obj  the object to summarise, not null\r\n     */\r\n    private static String buildSummary(Object obj, boolean includeType) {\r\n        var type = obj.getClass().getSimpleName();\r\n        var toStr = JodaBeanUtils.toString(obj);\r\n        if (toStr.length() > 60) {\r\n            toStr = toStr.substring(0, 57) + \"...\";\r\n        }\r\n        return (includeType ? type + \" \" : \"\") + \"<\" + toStr + \">\";\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/test/BeanComparisonError.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.test;\r\n\r\nimport java.io.Serial;\r\n\r\nimport org.joda.beans.Bean;\r\n\r\n/**\r\n * Error class used when two beans fail to compare.\r\n */\r\nclass BeanComparisonError extends AssertionError {\r\n\r\n    /** Serialization version. */\r\n    @Serial\r\n    private static final long serialVersionUID = 1L;\r\n\r\n    /**\r\n     * The expected bean.\r\n     */\r\n    private final Bean expected;\r\n    /**\r\n     * The actual bean.\r\n     */\r\n    private final Bean actual;\r\n\r\n    /**\r\n     * Creates a new error.\r\n     * \r\n     * @param message  the message, may be null\r\n     * @param expected  the expected value, not null\r\n     * @param actual  the actual value, not null\r\n     */\r\n    BeanComparisonError(String message, Bean expected, Bean actual) {\r\n        super(message);\r\n        this.expected = expected;\r\n        this.actual = actual;\r\n    }\r\n\r\n    //-------------------------------------------------------------------------\r\n    /**\r\n     * Gets the expected field.\r\n     * @return the expected\r\n     */\r\n    public Bean getExpected() {\r\n        return expected;\r\n    }\r\n\r\n    /**\r\n     * Gets the actual field.\r\n     * @return the actual\r\n     */\r\n    public Bean getActual() {\r\n        return actual;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/org/joda/beans/test/JodaBeanTests.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.test;\n\nimport java.lang.reflect.Modifier;\nimport java.net.URI;\nimport java.time.DayOfWeek;\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.Year;\nimport java.time.YearMonth;\nimport java.time.ZoneId;\nimport java.time.ZoneOffset;\nimport java.time.ZonedDateTime;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\nimport java.util.Objects;\nimport java.util.Set;\nimport java.util.SortedSet;\nimport java.util.TreeSet;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.impl.StandaloneMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\n\n/**\n * A utility class to assist with testing beans.\n * <p>\n * Test coverage statistics can be heavily skewed by getters, setters and generated code.\n * This class provides a solution, allowing bean test coverage to be artificially increased.\n * Always remember that the goal of artificially increasing coverage is so that you can\n * see what you really need to test, not to avoid writing tests altogether.\n */\npublic final class JodaBeanTests {\n\n    /**\n     * This constant can be used to pass to increase test coverage.\n     * This is used by some {@link MetaBean} methods in generated classes.\n     */\n    public static final String TEST_COVERAGE_PROPERTY = \"!ConstantUsedForTestCoveragePurposes!\";\n\n    /**\n     * This constant can be used to pass to increase test coverage.\n     * This is used by some {@link BeanBuilder} set methods in generated classes.\n     */\n    public static final String TEST_COVERAGE_STRING = \"!ConstantUsedForTestCoveragePurposes!\";\n\n    //-------------------------------------------------------------------------\n    /**\n     * Test a mutable bean for the primary purpose of increasing test coverage.\n     * \n     * @param bean  the bean to test\n     */\n    public static void coverMutableBean(Bean bean) {\n        assertNotNull(bean, \"coverImmutableBean() called with null bean\");\n        assertFalse(bean instanceof ImmutableBean);\n        assertNotSame(JodaBeanUtils.clone(bean), bean);\n        coverBean(bean);\n    }\n\n    /**\n     * Test an immutable bean for the primary purpose of increasing test coverage.\n     * \n     * @param bean  the bean to test\n     */\n    public static void coverImmutableBean(ImmutableBean bean) {\n        assertNotNull(bean, \"coverImmutableBean() called with null bean\");\n        assertSame(JodaBeanUtils.clone(bean), bean);\n        coverBean(bean);\n    }\n\n    /**\n     * Test a bean equals method for the primary purpose of increasing test coverage.\n     * <p>\n     * The two beans passed in should contain a different value for each property.\n     * The method creates a cross-product to ensure test coverage of equals.\n     * \n     * @param bean1  the first bean to test\n     * @param bean2  the second bean to test\n     */\n    @SuppressWarnings(\"unlikely-arg-type\")\n    public static void coverBeanEquals(Bean bean1, Bean bean2) {\n        assertNotNull(bean1, \"coverBeanEquals() called with null bean\");\n        assertNotNull(bean2, \"coverBeanEquals() called with null bean\");\n        assertFalse(bean1.equals(null));\n        assertFalse(bean1.equals(\"NonBean\"));\n        assertTrue(bean1.equals(bean1));\n        assertTrue(bean2.equals(bean2));\n        ignoreThrows(() -> assertEquals(bean1, JodaBeanUtils.cloneAlways(bean1)));\n        ignoreThrows(() -> assertEquals(bean2, JodaBeanUtils.cloneAlways(bean2)));\n        assertTrue(bean1.hashCode() == bean1.hashCode());\n        assertTrue(bean2.hashCode() == bean2.hashCode());\n        if (bean1.equals(bean2) || bean1.getClass() != bean2.getClass()) {\n            return;\n        }\n        var metaBean = bean1.metaBean();\n        var buildableProps = metaBean.metaPropertyMap().values().stream()\n                .filter(mp -> mp.style().isBuildable())\n                .toList();\n        var builtBeansSet = new HashSet<Bean>();\n        builtBeansSet.add(bean1);\n        builtBeansSet.add(bean2);\n        for (var i = 0; i < buildableProps.size(); i++) {\n            for (var j = 0; j < 2; j++) {\n                try {\n                    var bld = metaBean.builder();\n                    for (var k = 0; k < buildableProps.size(); k++) {\n                        MetaProperty<?> mp = buildableProps.get(k);\n                        if (j == 0) {\n                            bld.set(mp, mp.get(k < i ? bean1 : bean2));\n                        } else {\n                            bld.set(mp, mp.get(i <= k ? bean1 : bean2));\n                        }\n                    }\n                    builtBeansSet.add(bld.build());\n                } catch (RuntimeException ex) {\n                    // ignore\n                }\n            }\n        }\n        var builtBeansList = new ArrayList<>(builtBeansSet);\n        for (var i = 0; i < builtBeansList.size() - 1; i++) {\n            for (var j = i + 1; j < builtBeansList.size(); j++) {\n                builtBeansList.get(i).equals(builtBeansList.get(j));\n            }\n        }\n    }\n\n    // provide test coverage to all beans\n    private static void coverBean(Bean bean) {\n        coverProperties(bean);\n        coverNonProperties(bean);\n        coverEquals(bean);\n    }\n\n    // cover parts of a bean that are property-based\n    private static void coverProperties(Bean bean) {\n        var metaBean = bean.metaBean();\n        var metaPropMap = metaBean.metaPropertyMap();\n        assertNotNull(metaPropMap);\n        assertEquals(metaBean.metaPropertyCount(), metaPropMap.size());\n        for (var mp : metaBean.metaPropertyIterable()) {\n            assertTrue(metaBean.metaPropertyExists(mp.name()));\n            assertEquals(metaBean.metaProperty(mp.name()), mp);\n            // Ensure we don't use interned value\n            assertEquals(metaBean.metaProperty(new String(mp.name())), mp);\n            assertEquals(metaPropMap.containsValue(mp), true);\n            assertEquals(metaPropMap.containsKey(mp.name()), true);\n            if (mp.style().isReadable()) {\n                ignoreThrows(() -> mp.get(bean));\n            } else {\n                assertThrows(() -> mp.get(bean), UnsupportedOperationException.class);\n            }\n            if (mp.style().isWritable()) {\n                ignoreThrows(() -> mp.set(bean, \"\"));\n            } else {\n                assertThrows(() -> mp.set(bean, \"\"), UnsupportedOperationException.class);\n            }\n            if (mp.style().isBuildable()) {\n                ignoreThrows(() -> metaBean.builder().get(mp));\n                ignoreThrows(() -> metaBean.builder().get(mp.name()));\n                for (Object setValue : sampleValues(mp)) {\n                    ignoreThrows(() -> metaBean.builder().set(mp, setValue));\n                }\n                for (Object setValue : sampleValues(mp)) {\n                    ignoreThrows(() -> metaBean.builder().set(mp.name(), setValue));\n                }\n            }\n            ignoreThrows(() -> {\n                var m = metaBean.getClass().getDeclaredMethod(mp.name());\n                m.setAccessible(true);\n                m.invoke(metaBean);\n            });\n            ignoreThrows(() -> {\n                var m = metaBean.getClass().getDeclaredMethod(\n                        \"propertySet\", Bean.class, String.class, Object.class, Boolean.TYPE);\n                m.setAccessible(true);\n                m.invoke(metaBean, bean, mp.name(), \"\", true);\n            });\n        }\n        ignoreThrows(() -> {\n            var m = metaBean.getClass().getDeclaredMethod(\n                    \"propertyGet\", Bean.class, String.class, Boolean.TYPE);\n            m.setAccessible(true);\n            m.invoke(metaBean, bean, \"Not a real property name\", true);\n        });\n        MetaProperty<String> fakeMetaProp = StandaloneMetaProperty.of(\"fake\", metaBean, String.class);\n        ignoreThrows(() -> metaBean.builder().set(fakeMetaProp, JodaBeanTests.TEST_COVERAGE_STRING));\n        ignoreThrows(() -> metaBean.builder().set(JodaBeanTests.TEST_COVERAGE_PROPERTY, JodaBeanTests.TEST_COVERAGE_STRING));\n        ignoreThrows(() -> bean.property(JodaBeanTests.TEST_COVERAGE_PROPERTY));\n    }\n\n    // cover parts of a bean that are not property-based\n    private static void coverNonProperties(Bean bean) {\n        var metaBean = bean.metaBean();\n        assertFalse(metaBean.metaPropertyExists(\"\"));\n        assertThrows(() -> metaBean.builder().get(\"foo_bar\"), NoSuchElementException.class);\n        assertThrows(() -> metaBean.builder().set(\"foo_bar\", \"\"), NoSuchElementException.class);\n        assertThrows(() -> metaBean.metaProperty(\"foo_bar\"), NoSuchElementException.class);\n\n        if (metaBean instanceof DirectMetaBean) {\n            var dummy = DirectMetaProperty.ofReadWrite(metaBean, \"foo_bar\", metaBean.beanType(), String.class);\n            assertThrows(() -> dummy.get(bean), NoSuchElementException.class);\n            assertThrows(() -> dummy.set(bean, \"\"), NoSuchElementException.class);\n            assertThrows(() -> dummy.setString(bean, \"\"), NoSuchElementException.class);\n            assertThrows(() -> metaBean.builder().get(dummy), NoSuchElementException.class);\n            assertThrows(() -> metaBean.builder().set(dummy, \"\"), NoSuchElementException.class);\n        }\n\n        var propertyNameSet = bean.propertyNames();\n        assertNotNull(propertyNameSet);\n        for (String propertyName : propertyNameSet) {\n            assertNotNull(bean.property(propertyName));\n        }\n        assertThrows(() -> bean.property(\"\"), NoSuchElementException.class);\n\n        var beanClass = bean.getClass();\n        ignoreThrows(() -> {\n            var m = beanClass.getDeclaredMethod(\"meta\");\n            m.setAccessible(true);\n            m.invoke(null);\n        });\n        ignoreThrows(() -> {\n            var m = beanClass.getDeclaredMethod(\"meta\" + beanClass.getSimpleName(), Class.class);\n            m.setAccessible(true);\n            m.invoke(null, String.class);\n        });\n        ignoreThrows(() -> {\n            var m = beanClass.getDeclaredMethod(\"meta\" + beanClass.getSimpleName(), Class.class, Class.class);\n            m.setAccessible(true);\n            m.invoke(null, String.class, String.class);\n        });\n        ignoreThrows(() -> {\n            var m = beanClass.getDeclaredMethod(\"meta\" + beanClass.getSimpleName(), Class.class, Class.class, Class.class);\n            m.setAccessible(true);\n            m.invoke(null, String.class, String.class, String.class);\n        });\n\n        ignoreThrows(() -> {\n            var m = bean.getClass().getDeclaredMethod(\"builder\");\n            m.setAccessible(true);\n            m.invoke(null);\n        });\n        ignoreThrows(() -> {\n            var m = bean.getClass().getDeclaredMethod(\"toBuilder\");\n            m.setAccessible(true);\n            m.invoke(bean);\n        });\n\n        assertNotNull(bean.toString());\n        assertNotNull(metaBean.toString());\n        assertNotNull(metaBean.builder().toString());\n    }\n\n    // different combinations of values to cover equals()\n    @SuppressWarnings(\"unlikely-arg-type\")\n    private static void coverEquals(Bean bean) {\n        // create beans with different data and compare each to the input bean\n        // this will normally trigger each of the possible branches in equals\n        var buildableProps = bean.metaBean().metaPropertyMap().values().stream()\n                .filter(mp -> mp.style().isBuildable())\n                .toList();\n        for (var i = 0; i < buildableProps.size(); i++) {\n            try {\n                var bld = bean.metaBean().builder();\n                for (var j = 0; j < buildableProps.size(); j++) {\n                    var mp = buildableProps.get(j);\n                    if (j < i) {\n                        bld.set(mp, mp.get(bean));\n                    } else {\n                        var samples = sampleValues(mp);\n                        bld.set(mp, samples.get(0));\n                    }\n                }\n                var built = bld.build();\n                coverBeanEquals(bean, built);\n                assertEquals(built, built);\n                assertEquals(built.hashCode(), built.hashCode());\n            } catch (RuntimeException ex) {\n                // ignore\n            }\n        }\n        // cover the remaining equals edge cases\n        assertFalse(bean.equals(null));\n        assertFalse(bean.equals(\"NonBean\"));\n        assertTrue(bean.equals(bean));\n        ignoreThrows(() -> assertEquals(bean, JodaBeanUtils.cloneAlways(bean)));\n        assertTrue(bean.hashCode() == bean.hashCode());\n    }\n\n    // sample values for setters\n    private static List<?> sampleValues(MetaProperty<?> mp) {\n        var type = mp.propertyType();\n        // enum constants\n        if (Enum.class.isAssignableFrom(type)) {\n            return Arrays.asList(type.getEnumConstants());\n        }\n        // lookup pre-canned samples\n        var sample = SAMPLES.get(type);\n        if (sample != null) {\n            return sample;\n        }\n        // find any potential declared constants, using some plural rules\n        var typeName = type.getName();\n        var samples = new ArrayList<>();\n        samples.addAll(buildSampleConstants(type, type));\n        ignoreThrows(() -> {\n            // cat -> cats\n            samples.addAll(buildSampleConstants(Class.forName(typeName + \"s\"), type));\n        });\n        ignoreThrows(() -> {\n            // dish -> dishes\n            samples.addAll(buildSampleConstants(Class.forName(typeName + \"es\"), type));\n        });\n        ignoreThrows(() -> {\n            // lady -> ladies\n            samples.addAll(buildSampleConstants(Class.forName(typeName.substring(0, typeName.length() - 1) + \"ies\"), type));\n        });\n        ignoreThrows(() -> {\n            // index -> indices\n            samples.addAll(buildSampleConstants(Class.forName(typeName.substring(0, typeName.length() - 2) + \"ices\"), type));\n        });\n        // none\n        return samples;\n    }\n\n    // adds sample constants to the \n    private static List<Object> buildSampleConstants(Class<?> queryType, Class<?> targetType) {\n        var samples = new ArrayList<>();\n        for (var field : queryType.getFields()) {\n            if (field.getType() == targetType &&\n                    Modifier.isPublic(field.getModifiers()) &&\n                    Modifier.isStatic(field.getModifiers()) &&\n                    Modifier.isFinal(field.getModifiers()) &&\n                    !field.isSynthetic()) {\n                ignoreThrows(() -> samples.add(field.get(null)));\n            }\n        }\n        return samples;\n    }\n\n    private static final Map<Class<?>, List<?>> SAMPLES;\n    static {\n        var map = new HashMap<Class<?>, List<?>>();\n        map.put(String.class, List.of(\"Hello\", \"Goodbye\", \" \", \"\"));\n        map.put(Byte.class, List.of((byte) 0, (byte) 1));\n        map.put(Byte.TYPE, List.of((byte) 0, (byte) 1));\n        map.put(Short.class, List.of((short) 0, (short) 1));\n        map.put(Short.TYPE, List.of((short) 0, (short) 1));\n        map.put(Integer.class, List.of(0, 1));\n        map.put(Integer.TYPE, List.of(0, 1));\n        map.put(Long.class, List.of((long) 0, (long) 1));\n        map.put(Long.TYPE, List.of((long) 0, (long) 1));\n        map.put(Float.class, List.of((float) 0, (float) 1));\n        map.put(Float.TYPE, List.of((float) 0, (float) 1));\n        map.put(Double.class, List.of((double) 0, (double) 1));\n        map.put(Double.TYPE, List.of((double) 0, (double) 1));\n        map.put(Character.class, List.of(' ', 'A', 'z'));\n        map.put(Character.TYPE, List.of(' ', 'A', 'z'));\n        map.put(Boolean.class, List.of(Boolean.TRUE, Boolean.FALSE));\n        map.put(Boolean.TYPE, List.of(Boolean.TRUE, Boolean.FALSE));\n        map.put(LocalDate.class, List.of(LocalDate.now(ZoneOffset.UTC), LocalDate.of(2012, 6, 30)));\n        map.put(LocalTime.class, List.of(LocalTime.now(ZoneOffset.UTC), LocalTime.of(11, 30)));\n        map.put(LocalDateTime.class, List.of(LocalDateTime.now(ZoneOffset.UTC), LocalDateTime.of(2012, 6, 30, 11, 30)));\n        map.put(OffsetTime.class, List.of(OffsetTime.now(ZoneOffset.UTC), OffsetTime.of(11, 30, 0, 0, ZoneOffset.ofHours(1))));\n        map.put(OffsetDateTime.class, List.of(\n                OffsetDateTime.now(ZoneOffset.UTC),\n                OffsetDateTime.of(2012, 6, 30, 11, 30, 0, 0, ZoneOffset.ofHours(1))));\n        map.put(ZonedDateTime.class, List.of(\n                ZonedDateTime.now(ZoneOffset.UTC),\n                ZonedDateTime.of(2012, 6, 30, 11, 30, 0, 0, ZoneId.systemDefault())));\n        map.put(Instant.class, List.of(Instant.now(), Instant.EPOCH));\n        map.put(Year.class, List.of(Year.now(ZoneOffset.UTC), Year.of(2012)));\n        map.put(YearMonth.class, List.of(YearMonth.now(ZoneOffset.UTC), YearMonth.of(2012, 6)));\n        map.put(MonthDay.class, List.of(MonthDay.now(ZoneOffset.UTC), MonthDay.of(12, 25)));\n        map.put(Month.class, List.of(Month.JULY, Month.DECEMBER));\n        map.put(DayOfWeek.class, List.of(DayOfWeek.FRIDAY, DayOfWeek.SATURDAY));\n        map.put(URI.class, List.of(URI.create(\"http://www.opengamma.com\"), URI.create(\"http://www.joda.org\")));\n        map.put(Class.class, List.of(Throwable.class, RuntimeException.class, String.class));\n        map.put(Object.class, List.of(\"\", 6));\n        map.put(Collection.class, List.of(new ArrayList<>()));\n        map.put(List.class, List.of(new ArrayList<>()));\n        map.put(Set.class, List.of(new HashSet<>()));\n        map.put(SortedSet.class, List.of(new TreeSet<>()));\n        try {\n            var cls = Class.forName(\"com.google.common.collect.ImmutableList\");\n            var method = cls.getDeclaredMethod(\"of\");\n            map.put(cls, List.of(method.invoke(null)));\n        } catch (Exception ex) {\n            // ignore\n        }\n        try {\n            var cls = Class.forName(\"com.google.common.collect.ImmutableSet\");\n            var method = cls.getDeclaredMethod(\"of\");\n            map.put(cls, List.of(method.invoke(null)));\n        } catch (Exception ex) {\n            // ignore\n        }\n        try {\n            var cls = Class.forName(\"com.google.common.collect.ImmutableSortedSet\");\n            var method = cls.getDeclaredMethod(\"naturalOrder\");\n            map.put(cls, List.of(method.invoke(null)));\n        } catch (Exception ex) {\n            // ignore\n        }\n        try {\n            var cls = Class.forName(\"com.google.common.collect.ImmutableMap\");\n            var method = cls.getDeclaredMethod(\"of\");\n            map.put(cls, List.of(method.invoke(null)));\n        } catch (Exception ex) {\n            // ignore\n        }\n        SAMPLES = map;\n    }\n\n    //-----------------------------------------------------------------------\n    private static void assertNotNull(Object obj) {\n        if (obj == null) {\n            throw new AssertionError(\"Expected (a != null), but found (a == null)\");\n        }\n    }\n\n    private static void assertNotNull(Object obj, String message) {\n        if (obj == null) {\n            throw new AssertionError(message);\n        }\n    }\n\n    private static void assertSame(Object a, Object b) {\n        if (a != b) {\n            throw new AssertionError(\"Expected (a == b), but found (a != b)\");\n        }\n    }\n\n    private static void assertNotSame(Object a, Object b) {\n        if (a == b) {\n            throw new AssertionError(\"Expected (a != b), but found (a == b)\");\n        }\n    }\n\n    private static void assertEquals(Object actual, Object expected) {\n        if (!Objects.equals(actual, expected)) {\n            throw new AssertionError(\"Expected \" + expected + \", but found \" + actual);\n        }\n    }\n\n    private static void assertEquals(int actual, int expected) {\n        if (actual != expected) {\n            throw new AssertionError(\"Expected \" + expected + \", but found \" + actual);\n        }\n    }\n\n    private static void assertTrue(boolean actual) {\n        if (!actual) {\n            throw new AssertionError(\"Expected value to be true, but was false\");\n        }\n    }\n\n    private static void assertFalse(boolean actual) {\n        if (actual) {\n            throw new AssertionError(\"Expected value to be false, but was true\");\n        }\n    }\n\n    //-----------------------------------------------------------------------\n    private static void assertThrows(AssertRunnable runner, Class<? extends Throwable> expected) {\n        assertNotNull(runner, \"assertThrows() called with null AssertRunnable\");\n        assertNotNull(expected, \"assertThrows() called with null expected Class\");\n\n        try {\n            runner.run();\n            throw new AssertionError(\"Expected \" + expected.getSimpleName() + \" but code succeeded normally\");\n        } catch (AssertionError ex) {\n            throw ex;\n        } catch (Throwable ex) {\n            if (!expected.isInstance(ex)) {\n                throw new AssertionError(\n                        \"Expected \" + expected.getSimpleName() + \" but received \" + ex.getClass().getSimpleName(), ex);\n            }\n        }\n    }\n\n    private static void ignoreThrows(AssertRunnable runner) {\n        assertNotNull(runner, \"ignoreThrows() called with null AssertRunnable\");\n        try {\n            runner.run();\n        } catch (Throwable ex) {\n            // ignore\n        }\n    }\n\n    @FunctionalInterface\n    interface AssertRunnable {\n\n        /**\n         * Used to wrap code that is expected to throw an exception.\n         * \n         * @throws Throwable the expected result\n         */\n        void run() throws Throwable;\n\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/joda/beans/test/package-info.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n\n/**\n * Utility to assist with testing and comparing Joda-Beans.\n * <p>\n * This provides the ability to compare two beans in a much more effective way.\n */\npackage org.joda.beans.test;\n"
  },
  {
    "path": "src/main/resources/org/joda/beans/gen/guava.ini",
    "content": "# copies requiring Guava library or Joda-Collect\n\n# ImmutableCollection is abstract, thus uses ImmutableList/ArrayList\n# TreeMultiset use only works with natural ordering\n\n# how to copy $value to make it immutable\n[immutable.builder.to.immutable]\nCollection = ImmutableList.copyOf($value)\nList = ImmutableList.copyOf($value)\nSet = ImmutableSet.copyOf($value)\nSortedSet = ImmutableSortedSet.copyOfSorted($value)\nMap = ImmutableMap.copyOf($value)\nSortedMap = ImmutableSortedMap.copyOfSorted($value)\nEnumSet = EnumSet.copyOf($value)\nNavigableSet = Sets.unmodifiableNavigableSet(Sets.newTreeSet($value))\nNavigableMap = Maps.unmodifiableNavigableMap(Maps.newTreeMap($value))\nBiMap = ImmutableBiMap.copyOf($value)\nMultimap = ImmutableMultimap.copyOf($value)\nListMultimap = ImmutableListMultimap.copyOf($value)\nSetMultimap = ImmutableSetMultimap.copyOf($value)\nMultiset = ImmutableMultiset.copyOf($value)\nSortedMultiset = ImmutableSortedMultiset.copyOfSorted($value)\nTable = ImmutableTable.copyOf($value)\nGrid = ImmutableGrid.copyOf($value)\nImmutableCollection = ImmutableList.copyOf($value)\nImmutableList = ImmutableList.copyOf($value)\nImmutableSet = ImmutableSet.copyOf($value)\nImmutableSortedSet = ImmutableSortedSet.copyOfSorted($value)\nImmutableMap = ImmutableMap.copyOf($value)\nImmutableSortedMap = ImmutableSortedMap.copyOfSorted($value)\nImmutableBiMap = ImmutableBiMap.copyOf($value)\nImmutableMultimap = ImmutableMultimap.copyOf($value)\nImmutableListMultimap = ImmutableListMultimap.copyOf($value)\nImmutableSetMultimap = ImmutableSetMultimap.copyOf($value)\nImmutableMultiset = ImmutableMultiset.copyOf($value)\nImmutableSortedMultiset = ImmutableSortedMultiset.copyOfSorted($value)\nImmutableTable = ImmutableTable.copyOf($value)\nImmutableGrid = ImmutableGrid.copyOf($value)\nImmutableBean = $value\n\n# how to copy $value to make it mutable\n[immutable.builder.to.mutable]\nCollection = ImmutableList.copyOf($value)\nList = ImmutableList.copyOf($value)\nSet = ImmutableSet.copyOf($value)\nSortedSet = ImmutableSortedSet.copyOfSorted($value)\nMap = ImmutableMap.copyOf($value)\nSortedMap = ImmutableSortedMap.copyOfSorted($value)\nEnumSet = new HashSet<>($value)\nNavigableSet = new TreeSet<>($value))\nNavigableMap = new TreeMap<>($value)\nBiMap = ImmutableBiMap.copyOf($value)\nMultimap = ImmutableMultimap.copyOf($value)\nListMultimap = ImmutableListMultimap.copyOf($value)\nSetMultimap = ImmutableSetMultimap.copyOf($value)\nMultiset = ImmutableMultiset.copyOf($value)\nSortedMultiset = ImmutableSortedMultiset.copyOfSorted($value)\nTable = ImmutableTable.copyOf($value)\nGrid = ImmutableGrid.copyOf($value)\nImmutableCollection = $value\nImmutableList = $value\nImmutableSet = $value\nImmutableSortedSet = $value\nImmutableMap = $value\nImmutableSortedMap = $value\nImmutableBiMap = $value\nImmutableMultimap = $value\nImmutableListMultimap = $value\nImmutableSetMultimap = $value\nImmutableMultiset = $value\nImmutableSortedMultiset = $value\nImmutableTable = $value\nImmutableGrid = $value\nImmutableBean = $value\n\n# the type to use for in the builder\n[immutable.builder.type]\nEnumSet = Set<>\nImmutableCollection = Collection<>\nImmutableList = List<>\nImmutableSet = Set<>\nImmutableSortedSet = SortedSet<>\nImmutableMap = Map<>\nImmutableSortedMap = SortedMap<>\nImmutableBiMap = BiMap<>\nImmutableMultimap = Multimap<>\nImmutableListMultimap = ListMultimap<>\nImmutableSetMultimap = SetMultimap<>\nImmutableMultiset = Multiset<>\nImmutableSortedMultiset = SortedMultiset<>\nImmutableTable = Table<>\nImmutableGrid = Grid<>\n\n# the initializer to use for collections in the builder\n[immutable.builder.init]\nCollection = ImmutableList.of()\nList = ImmutableList.of()\nSet = ImmutableSet.of()\nSortedSet = ImmutableSortedSet.of()\nMap = ImmutableMap.of()\nSortedMap = ImmutableSortedMap.of()\nEnumSet = ImmutableSet.of()\nNavigableSet = new TreeSet<>()\nNavigableMap = new TreeMap<>()\nBiMap = ImmutableBiMap.of()\nMultimap = ImmutableMultimap.of()\nListMultimap = ImmutableListMultimap.of()\nSetMultimap = ImmutableSetMultimap.of()\nMultiset = ImmutableMultiset.of()\nSortedMultiset = ImmutableSortedMultiset.of()\nTable = ImmutableTable.of()\nGrid = ImmutableGrid.of()\nImmutableCollection = ImmutableList.of()\nImmutableList = ImmutableList.of()\nImmutableSet = ImmutableSet.of()\nImmutableSortedSet = ImmutableSortedSet.of()\nImmutableMap = ImmutableMap.of()\nImmutableSortedMap = ImmutableSortedMap.of()\nImmutableBiMap = ImmutableBiMap.of()\nImmutableMultimap = ImmutableMultimap.of()\nImmutableListMultimap = ImmutableListMultimap.of()\nImmutableSetMultimap = ImmutableSetMultimap.of()\nImmutableMultiset = ImmutableMultiset.of()\nImmutableSortedMultiset = ImmutableSortedMultiset.of()\nImmutableTable = ImmutableTable.of()\nImmutableGrid = ImmutableGrid.of()\n\n# the code used to copy varargs\n[immutable.builder.varargs]\nCollection = ImmutableList.copyOf($value)\nList = ImmutableList.copyOf($value)\nSet = ImmutableSet.copyOf($value)\nSortedSet = ImmutableSortedSet.copyOf($value)\nEnumSet = EnumSet.copyOf(Arrays.asList($value))\nImmutableCollection = ImmutableList.copyOf($value)\nImmutableList = ImmutableList.copyOf($value)\nImmutableSet = ImmutableSet.copyOf($value)\nImmutableSortedSet = ImmutableSortedSet.copyOf($value)\n\n# provide the ability to handle clone-on-get for immutable classes\n[immutable.get.clone]\nDate = cloneCast\nObject[] = clone\nString[] = clone\nbyte[] = clone\nchar[] = clone\nshort[] = clone\nint[] = clone\nlong[] = clone\nfloat[] = clone\ndouble[] = clone\nboolean[] = clone\nObject[][] = cloneArray\nString[][] = cloneArray\nbyte[][] = cloneArray\nchar[][] = cloneArray\nshort[][] = cloneArray\nint[][] = cloneArray\nlong[][] = cloneArray\nfloat[][] = cloneArray\ndouble[][] = cloneArray\nboolean[][] = cloneArray\n\n# types that invalid in immutable beans\n[immutable.invalid.type]\nStringBuilder =\nStringBuffer =\nConcurrentMap =\nConcurrentNavigableMap =\nArrayList =\nLinkedList =\nHashSet =\nTreeSet =\nHashMap =\nTreeMap =\nConcurrentHashMap =\nConcurrentSkipListMap =\nEnumBiMap =\nEnumHashBiMap =\nHashBiMap =\nEnumMultiset =\nHashMultiset =\nLinkedHashMultiset =\nTreeMultiset =\nArrayListMultimap =\nLinkedListMultimap =\nHashMultimap =\nLinkedHashMultimap =\nTreeMultimap =\n# no immutable version of SortedSetMultimap\n# can be simulated via ImmutableSetMultimap.Builder, but complex\nSortedSetMultimap =\nArrayTable =\nHashBasedTable =\nTreeBasedTable =\nSparseGrid =\nDenseGrid =\nBean =\nFlexiBean =\nStrBuilder =\n"
  },
  {
    "path": "src/main/resources/org/joda/beans/gen/jdk.ini",
    "content": "#copies using JDK 6 classes only\n\n# how to copy $value to make it immutable\n[immutable.builder.to.immutable]\nCollection = Collections.unmodifiableCollection(new ArrayList<>($value))\nList = Collections.unmodifiableList(new ArrayList<>($value))\nSet = Collections.unmodifiableSet(new HashSet<>($value))\nMap = Collections.unmodifiableMap(new HashMap<>($value))\nSortedMap = Collections.unmodifiableSortedMap(new TreeMap<>($value))\nEnumSet = EnumSet.copyOf($value)\nImmutableBean = $value\n\n# how to copy $value to make it mutable\n[immutable.builder.to.mutable]\nCollection = new ArrayList<>($value)\nList = new ArrayList<>($value)\nSet = new HashSet<>($value)\nMap = new HashMap<>($value)\nSortedMap = new TreeMap<>($value)\nEnumSet = new HashSet<>($value)\nImmutableBean = $value\n\n# the type to use for in the builder\n[immutable.builder.type]\nEnumSet = Set<>\n\n# the initializer to use for collections in the builder\n[immutable.builder.init]\nCollection = Collections.emptyList()\nList = Collections.emptyList()\nSet = Collections.emptySet()\nMap = Collections.emptyMap()\nSortedMap = new TreeMap<>()\nEnumSet = Collections.emptySet()\n\n# the code used to copy varargs\n[immutable.builder.varargs]\nCollection = Arrays.asList($value)\nList = Arrays.asList($value)\nSet = new LinkedHashSet<>(Arrays.asList($value))\nSortedSet = new TreeSet<>(Arrays.asList($value))\nEnumSet = EnumSet.copyOf(Arrays.asList($value))\n\n# provide the ability to handle clone-on-get for immutable classes\n[immutable.get.clone]\nDate = cloneCast\nObject[] = clone\nString[] = clone\nbyte[] = clone\nchar[] = clone\nshort[] = clone\nint[] = clone\nlong[] = clone\nfloat[] = clone\ndouble[] = clone\nboolean[] = clone\nObject[][] = cloneArray\nString[][] = cloneArray\nbyte[][] = cloneArray\nchar[][] = cloneArray\nshort[][] = cloneArray\nint[][] = cloneArray\nlong[][] = cloneArray\nfloat[][] = cloneArray\ndouble[][] = cloneArray\nboolean[][] = cloneArray\n\n# types that invalid in immutable beans\n[immutable.invalid.type]\nStringBuilder =\nStringBuffer =\nConcurrentMap =\nConcurrentNavigableMap =\nArrayList =\nLinkedList =\nHashSet =\nSortedSet =\nNavigableSet =\nNavigableMap =\nTreeSet =\nHashMap =\nTreeMap =\nConcurrentHashMap =\nConcurrentSkipListMap =\nMultimap =\nListMultimap =\nSetMultimap =\nMultiset =\nSortedMultiset =\nImmutableCollection =\nImmutableList =\nImmutableSet =\nImmutableSortedSet =\nImmutableMap =\nImmutableSortedMap =\nImmutableBiMap =\nImmutableMultimap =\nImmutableListMultimap =\nImmutableSetMultimap =\nImmutableMultiset =\nImmutableSortedMultiset =\nBean =\nFlexiBean =\nStrBuilder =\n"
  },
  {
    "path": "src/site/markdown/enterprise.md",
    "content": "## Joda-Beans for Enterprise\n\n### Available as part of the Tidelift Subscription\n\n**Tidelift** is working with the maintainers of **Joda-Beans** and thousands of other open source projects to deliver\ncommercial support and maintenance for the open source dependencies you use to build your applications. \nSave time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use.\n\n<button class=\"btn-learnmore\" type=\"button\">[LEARN MORE][1]</button>\n<button class=\"btn-requestdemo\" type=\"button\">[REQUEST A DEMO][2]</button>\n\n### Enterprise-ready open source software - managed for you\n\nThe Tidelift Subscription is a managed open source subscription for application dependencies covering millions\nof open source projects across JavaScript, Python, Java, PHP, Ruby, .NET, and more.\n\nYour subscription includes:\n\n* **Security updates**<br />\nTidelift’s security response team coordinates patches for new breaking security vulnerabilities and alerts\nimmediately through a private channel, so your software supply chain is always secure.\n\n* **Licensing verification and indemnification**<br />\nTidelift verifies license information to enable easy policy enforcement and adds intellectual property\nindemnification to cover creators and users in case something goes wrong. You always have a 100% up-to-date\nbill of materials for your dependencies to share with your legal team, customers, or partners.\n\n* **Maintenance and code improvement**<br />\nTidelift ensures the software you rely on keeps working as long as you need it to work.\nYour managed dependencies are actively maintained and we recruit additional maintainers where required.\n\n* **Package selection and version guidance**<br />\nWe help you choose the best open source packages from the start—and then guide you through updates to stay on\nthe best releases as new issues arise.\n\n* **Roadmap input**<br />\nTake a seat at the table with the creators behind the software you use. Tidelift’s participating maintainers\nearn more income as their software is used by more subscribers, so they’re interested in knowing what you need.\n\n* **Tooling and cloud integration**<br />\nTidelift works with GitHub, GitLab, BitBucket, and more.\nWe support every cloud platform (and other deployment targets, too).\n\nThe end result? All of the capabilities you expect from commercial-grade software, for the full breadth\nof open source you use. That means less time grappling with esoteric open source trivia, and more\ntime building your own applications—and your business.\n\n<button class=\"btn-learnmore\" type=\"button\">[LEARN MORE][1]</button>\n<button class=\"btn-requestdemo\" type=\"button\">[REQUEST A DEMO][2]</button>\n\n[1]: https://tidelift.com/subscription/pkg/maven-org-joda-joda-beans?utm_source=maven-org-joda-joda-beans&utm_medium=referral&utm_campaign=enterprise\n[2]: https://tidelift.com/subscription/request-a-demo?utm_source=maven-org-joda-joda-beans&utm_medium=referral&utm_campaign=enterprise\n"
  },
  {
    "path": "src/site/markdown/index.md",
    "content": "## <i></i> About\n\n**Joda-Beans** provides a small framework that adds properties to Java, greatly enhancing JavaBeans.\n\nThe key concept is to allow each property on a bean to be accessed as an object in its own right.\nThis provides the hook for other technologies to build on, such as serialization, mapping,\nexpression languages and validation.\n\nJoda-Beans is licensed under the business-friendly [Apache 2.0 licence](licensecover.html).\n\n\n## <i></i> Features\n\nA selection of key features:\n\n* Code generate mutable and immutable beans\n* No more manually written getters, setters, equals, hashCode, toString or immutable builders\n* High quality generated code, perfect for use in an API or for creating Javadoc\n* Full-featured property abstraction, treating a bean as a map of properties\n* Fast, no use of reflection\n* Built in JSON, XML and binary serialization\n\n\n## <i></i> Documentation\n\nVarious documentation is available:\n\n* The helpful [user guide](userguide.html)\n* The extended [code generation guide](userguide-codegen.html)\n* The [Javadoc](apidocs/index.html)\n* The [change notes](changes-report.html) for each release\n* The [GitHub](https://github.com/JodaOrg/joda-beans) source repository\n* The [related projects](related.html) including Maven, Gradle and IntelliJ integration\n\n\n---\n\n## <i></i> Why Joda Beans?\n\nJoda-Beans has been created to plug a gap in the Java language - properties.\nThe concept of properties is familiar to those coding in almost every other modern language.\nJava stands alone in its pursuit of the JavaBeans, a specification built on naming conventions and reflection.\n\nJavaBeans are typically created by manual coding or one-off IDE generation, such as by Eclipse.\nThe same approach is taken to the creation of equals and hashCode methods.\nHowever, none of these approaches provides for a simple and fast mechanism to query a bean for the properties it exposes.\n\nJoda-Beans provides a solution. As a developer, you just write the fields much as you would today.\nThen you add annotations to the bean and properties.\nFinally, you run a code generator, which creates the get/set methods plus framework methods that allow the properties\nto be effectively queried.\nA key point is that the code generator may be run again and again on the Java file, and is non-destructive.\n\n```\n  @BeanDefinition\n  public final class Foo implements Bean {\n    /** The forename. */\n    @PropertyDefinition\n    private String forename;\n\n    /** The surname. */\n    @PropertyDefinition(validate = \"notNull\")\n    private String surname;\n\n    /** The address of the person. */\n    @PropertyDefinition\n    private Address address;\n    \n    // Joda-Beans will code generate all getters, setters, equals, hashCode, toString and property accessors\n  }\n```\n\nSee these sample classes used for testing -\n[a simple user account class](https://github.com/JodaOrg/joda-beans/blob/v2.0/src/test/java/org/joda/beans/gen/UserAccount.java#L32),\n[example usage](https://github.com/JodaOrg/joda-beans/blob/v2.0/src/test/java/org/joda/beans/Examples.java#L22),\n[example of validation](https://github.com/JodaOrg/joda-beans/blob/v2.0/src/test/java/org/joda/beans/gen/ValidateBean.java#L33).\n\nAs well as mutable beans following the Java Bean specification. Joda-Beans supports the creation of immutable beans.\nOne of the biggest issues with using immutable objects in Java is their creation.\nJoda-Beans simplifies this by code generating builder classes for each immutable bean:\n\n```\n  // using code generated immutable bean builders, example showing an interest rate swap leg\n  FixedRateSwapLeg payLeg = FixedRateSwapLeg.builder()\n    .accrualPeriods(PeriodicScheduleDefn.builder()\n      .startDate(LocalDate.of(2014, 9, 12))\n      .endDate(LocalDate.of(2021, 9, 12))\n      .frequency(Frequency.P6M)\n      .businessDayAdjustment(BusinessDayConventions.MODIFIED_FOLLOWING)\n      .startDateBusinessDayAdjustment(BusinessDayAdjustment.NONE)\n      .build())\n    .calculation(FixedRateCalculation.builder()\n      .notional(CurrencyAmount.of(Currency.USD, 100_000_000))\n      .dayCount(DayCounts.THIRTY_U_360)\n      .rate(0.015)\n      .build())\n    .build();\n```\n\nOnce beans and properties are defined, it is possible to use them in powerful ways.\nA fast and efficient serialization mechanism is provided to read and write JSON, XML and binary\nusing [Joda-Convert](/joda-convert/) for object to string conversion.\nFurther integration is included for MongoDB and Freemarker.\n\n---\n\n## <i></i> Releases\n\nThe 3.x branch (v3.0.0-SNAPSHOT) is compatible with Java SE 21 or later.\n\nThe 2.x branch (v2.11.1) is compatible with Java SE 8 or later.\n\nv3.x releases are mostly compatible with v2.x releases,\nsee the [releases notes](changes-report.html) for details.\nDeprecated methods have been removed.\n\nJoda-Beans depends on [Joda-Convert](/joda-convert/).\nThere are a number of [optional dependencies](dependencies.html) which help with integration.\n\nAvailable in [Maven Central](https://search.maven.org/search?q=g:org.joda%20AND%20a:joda-beans&core=gav).\n[GitHub release bundles](https://github.com/JodaOrg/joda-beans/releases).\n\n```xml\n<dependency>\n  <groupId>org.joda</groupId>\n  <artifactId>joda-beans</artifactId>\n  <version>2.11.1</version>\n</dependency>\n```\n\nFor Java SE 6 compatibility, use [release 1.14](https://github.com/JodaOrg/joda-beans/releases/tag/v1.14).\nThere are only [minor incompatibilities](migration.html) with the 1.x codebase.\nNote that the v2.x branch is based on Java 8 but contains a `module-info.class` file for Java 9\n(using the multi-release jar format).\n\nSee the [related projects](related.html) page for Maven, Gradle and IntelliJ integration.\n\nJava module name: `org.joda.beans`.\n\n---\n\n### For Enterprise\n\n[Available as part of the Tidelift Subscription](https://tidelift.com/subscription/pkg/maven-org-joda-joda-beans?utm_source=maven-org-joda-joda-beans&utm_medium=referral&utm_campaign=enterprise).\n\nJoda and the maintainers of thousands of other packages are working with Tidelift to deliver one\nenterprise subscription that covers all of the open source you use.\n\nIf you want the flexibility of open source and the confidence of commercial-grade software, this is for you.\n[Learn more](https://tidelift.com/subscription/pkg/maven-org-joda-joda-beans?utm_source=maven-org-joda-joda-beans&utm_medium=referral&utm_campaign=enterprise).\n\n\n### Support\n\nPlease use [Stack Overflow](https://stackoverflow.com/search?q=joda-beans) for general usage questions.\nGitHub [issues](https://github.com/JodaOrg/joda-beans/issues) and [pull requests](https://github.com/JodaOrg/joda-beans/pulls)\nshould be used when you want to help advance the project.\n\nAny donations to support the project are accepted via [OpenCollective](https://opencollective.com/joda).\n\nTo report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).\nTidelift will coordinate the fix and disclosure.\n"
  },
  {
    "path": "src/site/markdown/licensecover.md",
    "content": "## License information\n\nJoda-Beans source code is released under the business-friendly [Apache 2.0 license](licenses.html).\nThis is the same license as all [Apache Software Foundation](https://www.apache.org) projects.\n\nAs is normal with the Apache 2.0 license, a NOTICE file exists for Joda-Beans:\n\n```\nJoda Beans\nCopyright 2001-present Stephen Colebourne\n\nThis product includes software developed by\nJoda.org (https://www.joda.org/).\n```\n"
  },
  {
    "path": "src/site/markdown/migration.md",
    "content": "## Migration to v2.0\n\nJoda-Beans v2.0 has some incompatible changes.\n\n### BeanQuery\n\nThe `BeanQuery` interface has been removed.\nIt was rarely used and can be better achieved via lambdas and functional interfaces in Java SE 8.\nThe `ChainedBeanQuery` class is removed, with some behaviour replaced by `JodaBeanUtils.chain()`.\n\n\n### PropertyMap\n\nThe `PropertyMap` interface has been removed.\nIt was rarely used and can be better achieved via `JodaBeanUtils.flatten()` or `BasicPropertyMap.of()`.\n\n\n## BeanBuilder generics\n\nThe method `BeanBuilder.get(MetaProperty)` has changed its generics.\nIt you use it or have written a `BeanBuilder` you may be affected.\n\n\n## BeanBuilder setString() and setAll()\n\nApplications should use Joda-Convert directly for the setString() methods and loop for setAll().\n\n\n### Registering meta-beans\n\nThe `JodaBeanUtils.registerMetaBean()` and `JodaBeanUtils.metaBean()` methods have been deprecated.\nUse `MetaBean.register()` and `MetaBean.of()` instead.\n\n\n## Config file\n\nThe config file \"jdk6.ini\" has been renamed to \"jdk.ini\".\nThe old name is recognised on the command line.\n\n\n## Light and Minimal beans\n\nThe code generation strategies have been altered to be simpler.\nThey are now ready for Java SE 9.\n\n\n## Reflective beans\n\nThe factory method has been changed. The meta-bean now takes all the property names.\nThis avoids the need to use reflection to find the meta-properties, ready for Java SE 9.\n"
  },
  {
    "path": "src/site/markdown/related.md",
    "content": "## Related projects\n\nHere are links to a number of projects related to **Joda-Beans**.\nThese projects are independent - no guarantees of quality are given!\n\n* [Maven plugin](https://github.com/JodaOrg/joda-beans-maven-plugin) by Stephen Colebourne\n* [Gradle plugin](https://github.com/andreas-schilling/joda-beans-gradle-plugin) by Andreas Schilling\n* [Eclipse integration](https://github.com/JodaOrg/joda-beans-maven-plugin) via Maven plugin and M2E\n* [IntelliJ code folding](https://github.com/cjkent/jodabeansfolding) by Chris Kent\n* [UI generator](https://github.com/JodaOrg/joda-beans-ui) by Stephen Colebourne\n* [Integration projects](https://github.com/JodaOrg/joda-beans-integrate) for Freemarker, Kryo and Mongo\n\nIf your open source library provides a value added feature on top of Joda-Beans,\nthen let us know! Just send a pull request to edit this page.\n"
  },
  {
    "path": "src/site/markdown/userguide-codegen.md",
    "content": "## User guide - Code generation\n\nThis part of the user guide provides information on code generation of beans.\nSee the [main user guide](userguide.html) for a higher level introduction.\n\n\n## Code generator\n\nIt is possible to write a Joda-Bean by hand - they are just normal Java interfaces defining an API for beans.\nThere are some base classes that assist as well as some standard map-based implementations, notably\n[FlexiBean](apidocs/org.joda.beans/org/joda/beans/impl/flexi/FlexiBean.html).\nIt is more common to use the code generator, however the generator is optional.\n\nA code generated Joda-Bean minimises the amount of code that the developer has to write.\nThe developer simply creates an outline class and adds the properties (fields).\nThe code generator then produces all the getters and setters, plus additional helper methods.\n\nHere is an example `UserAccount` class showing the parts that a developer has to write:\n\n```java\n@BeanDefinition\npublic final class UserAccount implements Bean {\n\n    /** The user identifier. */\n    @PropertyDefinition(validate = \"notEmpty\")\n    private String userId;\n\n    /** The email address. */\n    @PropertyDefinition(validate = \"notEmpty\")\n    private String emailAddress;\n\n    /** The number of logins. */\n    @PropertyDefinition\n    private int numberLogins;\n\n    /** The last login instant. */\n    @PropertyDefinition(validate = \"notNull\")\n    private Date lastLogin;\n}\n```\n\nThe code generator will create getters, setters, equals, hashCode, toString, metaBean and properties.\nTo see the generated code for this class,\n[click here](https://github.com/JodaOrg/joda-beans/blob/v1.4/src/test/java/org/joda/beans/gen/UserAccount.java#L34).\n\nNote that the equals, hashCode and toString methods are only generated if they do not exist already.\nAs such, it is easy to write your own versions of these methods if necessary.\nThe restriction is that you must write your own version of these methods *before* the autogenerated block.\nAny equals, hashCode or toString method after the autogenerated block will be ignored (because they might be part of a nested class).\n\n\n## Using the code generator\n\nThe code generator must be invoked before compilation as it generates Java source code.\nIt cannot operate at runtime, as the getters and setters that are generated must be available for developers\nwriting the main part of the application.\n\nThe code generator operates by creating a portion of the source file marked by \"AUTOGENERATED START\" and \"AUTOGENERATED END\" tags\n(when first run, if the tags are not present, it will create the block at the end of the file).\nThe generator only ever changes code within the marked block, apart from imports which it inserts if it determines they are necessary.\nLimiting the generation to a fixed part of the file means that developers can customise the rest of the Java file in any\nway that is desired, such as adding constructors and methods.\n\nThe generator has the following requirements:\n\n* The class must be annotated with [BeanDefinition](apidocs/org.joda.beans/org/joda/beans/gen/BeanDefinition.html)\n* The class must directly implement the [Bean](apidocs/org.joda.beans/org/joda/beans/Bean.html) or\n[ImmutableBean](apidocs/org.joda.beans/org/joda/beans/ImmutableBean.html) interface.\n* The class must be a normal top-level class, nested/inner classes and multiple classes per file are not supported\n* Each property field must be annotated with [PropertyDefinition](apidocs/org.joda.beans/org/joda/beans/gen/PropertyDefinition.html)\n* Each property field must be be private\n* The Javadoc of each property field should normally start with the word \"The\".\n\nThe command line takes the following arguments:\n\n```\n  Usage java org.joda.beans.gen.BeanCodeGen [file]\n  Options\n    -R                process all files recursively, default false\n    -indent=tab       use a tab for indenting, default 4 spaces\n    -indent=[n]       use n spaces for indenting, default 4\n    -prefix=[p]       field prefix of p should be removed, no default\n    -eol=[e]          end of line: 'lf'/'crlf'/'cr', default System.lineSeparator\n    -generated        add @Generated annotation to generated code\n    -config=[f]       config file: 'jdk'/'guava', default guava\n    -style=[s]        default bean style: 'light'/'minimal'/'full', default smart\n    -verbose=[v]      output logging with verbosity from 0 to 3, default 1\n    -nowrite          output messages rather than writing, default is to write\n```\n\nThe prefix is useful for teams that have a coding standard where fields must be prefixed, such as by an underscore or a letter.\nSpecifying it to the generator allows that prefix to be stripped before generating the property name.\n\nThe eol argument allows for configuring the line separator used to write generated files.\n\nThe code generator works by reading the source file and parsing it to memory.\nThe parser is deliberately simplistic and will reject complex files or unusual code formatting styles.\nThe generator processes the annotated properties and replaces the auto-generated section of the file in memory.\nIt then compares the newly generated file with the original and only if they are different is the new file written to the file system.\nThe generator will make use of property comments and will respect and propagate deprecated annotations.\nIt is reasonably intelligent - final fields will become read-only properties, most collections and maps are sensibly handled\nand booleans generate \"is\" methods rather than \"get\" methods. Simple generics are also handled.\n\nThe generator must be invoked every time that the source file is changed.\nFailure to do so (such as by using an IDE refactoring) could leave the auto-generated block in an invalid state.\nNormally the generator will be invoked from the IDE or a build tool, see the\n[Maven plugin](https://github.com/JodaOrg/joda-beans-maven-plugin).\n\nThe code generator only parses and outputs based on a single source Java file.\nIt does not require the file to compile and never knows that \"String\" actually means \"java.lang.String\".\nIn other words, the type system in the generator is totally dumb and based solely on the short simple class name.\n\n\n## Customisation\n\nThe generator has a limited set of customisations to the core part of the generation.\n\nOne key set of control is provided by [@PropertyDefinition](apidocs/org.joda.beans/org/joda/beans/gen/PropertyDefinition.html).\n\nThe style of getter can be controlled using the annotation parameter \"get\".\nIn most cases, the default \"smart\" setting is sufficient:\n\n* \"\" - do not generate any form of getter\n* \"smart\" - process intelligently, using \"is\" for `boolean` and \"get\" for other types\n* \"private\" - process as per \"smart\" but set scope as private\n* \"package\" - process as per 'smart' but set scope as package/default\n* \"protected\" - process as per \"smart\" but set scope as protected\n* \"is\" - generates `isXxx()`\n* \"get\" - generates `getXxx()`\n* \"clone\" - generates `getXxx()` with a clone of the field (assumed to be of the correct type)\n* \"cloneCast\" - generates `getXxx()` with a clone of the field with a cast to the property type\n* \"cloneArray\" - generates getXxx() with a deep clone of the array suitable for multi-dimensional arrays\n* \"optional\" - generate `getXxx()` returning a Java 8 `Optional` wrapper around the field, where the field\n itself is nullable instead of optional. `OptionalDouble`, `OptionalInt` and `OptionalLong` are also handled\n* \"optionalGuava\" - generate `getXxx()` returning a Guava `Optional` wrapper around the field,\n where the field itself is nullable instead of optional\n* \"field\" - generates direct access to the field, enabling a weird manual getter\n* \"manual\" - a method named `getXxx()` must be manually provided\n\nFor example, using the optional wrappers:\n\n```java\n @BeanDefinition\n public final class Foo implements Bean {\n   @PropertyDefinition(get = \"optional\")\n   private String name;  // regular field that can hold null\n\n   // generated getter as follows:\n   public Optional<String> getName() {\n     return Optional.ofNullable(name);\n   }\n }\n```\n\nThe style of setter can be controlled using the annotation parameter \"set\".\nIn most cases, the default \"smart\" setting is sufficient:\n\n* \"' - do not generate any form of setter\n* \"smart\" - process intelligently - uses \"set\" unless final, when it will use \"setClearAddAll\"\n for common list types or \"setClearPutAll\" for common map types and `FlexiBean`\n* \"private\" - process as per \"smart\" but set scope as private\n* \"package\" - process as per 'smart' but set scope as package/default\n* \"protected\" - process as per \"smart\" but set scope as protected\n* \"set\" - generates `setXxx()`\n* \"setClearAddAll\" - generates `setXxx()` using `field.clear()` and `field.addAll(newData)`\n* \"setClearPutAll\" - generates `setXxx()` using `field.clear()` and `field.putAll(newData)`\n* \"cloneArray\" - generates setXxx() with a deep clone of the array suitable for multi-dimensional arrays\n* \"bound\" - generates a bound property with {@code PropertyChangeSupport}\n* \"field\" - generates direct access to the field, enabling a weird manual setter\n* \"manual\" - a method named `setXxx()` must be manually provided at package scope or greater\n* a pattern, see [Javadoc](apidocs/org.joda.beans/org/joda/beans/gen/PropertyDefinition.html#set--)\n\nFor example, to have a private setter:\n\n```java\n @BeanDefinition\n public final class Foo implements Bean {\n   @PropertyDefinition(set = \"private\")\n   private String name;\n\n   // generated setter as follows:\n   private String setName() {\n     this.name = name;\n   }\n }\n```\n\nNote that support for bound properties is very basic. It only handles simple mutable properties.\nFor more complex cases, it is necessary to write the setter manually.\nThe PropertyChangeSupport field is generated, but not the methods to add listeners.\n\nValidation can be specified using the annotation parameter \"validate\":\n\n* \"\" - do not generate any form of validation\n* \"notNull\" - checks that the value is non-null using `JodaBeanUtils.notNull()` which throws IllegalArgumentException\n* \"notEmpty' - checks that a string/collection/map is non-null and non-empty using `JodaBeanUtils.notEmpty()`\n which throws IllegalArgumentException\n* \"{staticMethodName}\" - a custom validation method located on this class\n* \"{className}.{staticMethodName}\" - a custom validation method located on any class\n\n```java\n @BeanDefinition\n public final class Foo implements Bean {\n   @PropertyDefinition(validate = \"notNull\")\n   private String surname;  // generated code will ensure field is non-null\n }\n```\n\nThe exposed type of the property can be specified using the annotation parameter \"type\".\nFor example, if the field is declared as an `ArrayList` but the public type of the getter/setter\nshould be `List` then that can be achieved.\nSimply add the annotation parameter `type = \"List<>\"` (the generics are inserted during generation).\n\n```java\n @BeanDefinition\n public final class Foo implements Bean {\n   @PropertyDefinition(type = \"List<>\")\n   private ArrayList<String> names;\n\n   // generated getter as follows:\n   public List<String> getNames() { ... }\n }\n```\n\nThe exposed type of the property in the builder used for immutable beans can be specified using the annotation parameter \"builderType\".\nFor example, if the field is declared as an `ImmutableList<Address>` but the public type of the builder methods\nshould be `List<? extends Address>` then that can be achieved.\nSimply add the annotation parameter `builderType = \"List<? extends Address>\"`.\n\n```java\n @BeanDefinition\n public final class Foo implements Bean {\n   @PropertyDefinition(builderType = \"List<? extends Address>\")\n   private ImmutableList<Address> addresses;\n\n   // generated getter as follows:\n   public ImmutableList<Address> getAddresses() { ... }\n\n   // generated builder method as follows:\n   public Builder addresses(List<? extends Address> addresses) { ... }\n }\n```\n\nA properties getter and/or setter can be declared to override a superclass.\nSimply add the annotation parameter `overrideGet = true` or `overrideSet = true`\nand the requisite `@Override` annotation will be placed on the getter/setter.\n\n```java\n @BeanDefinition\n public final class Foo implements Bean {\n   @PropertyDefinition(overrideGet = true)\n   private String name;\n\n   // generated getter as follows:\n   @Override\n   public String getName() { ... }\n }\n```\n\nA property can be given an alias, or alternate name.\nSimply add the annotation parameter `alias = \"otherName\"`.\nThis is most useful when a property is renamed, to handle change during [deserialization](userguide-serialization.html).\n\n\nThe style of equals/hashCode/toString can be controlled using the annotation parameters \"equalsHashCodeStyle\" and\n\"toStringStyle\". In most cases, the default \"smart\" setting is sufficient:\n\n* \"omit\" - omit this property from equals/hashCode/toString\n* \"smart\" - process intelligently, equivalent to \"field\" for immutable and \"getter\" for mutable\n* \"getter\" - use the getter for equals/hashCode/toString\n* \"field\" - use the field for equals/hashCode/toString\n\n\n## Derived properties\n\nIt is possible to declare a property without a matching field.\nFor example, an \"age\" property could be derived from a \"dateOfBirth\" field.\n\nTo do this, annotate the getter of the derived property with [DerivedProperty](apidocs/org.joda.beans/org/joda/beans/gen/DerivedProperty.html).\nApart from the absence of a field, a derived property is very similar to a normal read-only property.\n\n\n## Immutable beans\n\nCode generated beans may be immutable.\n\nAll fields in an immutable bean must be final.\nIt is recommended that immutable beans are final,\ndo not extend any other bean class and directly implement [ImmutableBean](apidocs/org.joda.beans/org/joda/beans/ImmutableBean.html).\n\n```java\n @BeanDefinition\n public final class Foo implements ImmutableBean {\n   // code generated immutable bean with public builder\n }\n```\n\nCertain configuration settings will not work as expected if an immutable bean is not declared as final.\n\n\n### Immutable bean customisation\n\nCode generated immutable beans can be customized as follows.\n\nAn immutable bean can be configured to provide additional cross-property validation.\nIn most cases the per-property validation attribute is sufficient.\nWhen cross-property validation is needed, this technique can be used.\n\nSimply declare a private void method taking no arguments annotated with\n[@ImmutableValidator](apidocs/org.joda.beans/org/joda/beans/gen/ImmutableValidator.html).\nThe method will be called during the validation phase of the constructor.\n\n```java\n @ImmutableValidator\n private void validate() {\n   // validate the instance variables of the bean\n }\n```\n\nAn immutable bean can be configured to apply default property values.\nIn most cases this is not necessary, but if the bean has lots of non-null properties it may be\ndesirable to have some default values.\n\nSimply declare a private static void method taking one 'Builder' argument annotated with\n[@ImmutableDefaults](apidocs/org.joda.beans/org/joda/beans/gen/ImmutableDefaults.html).\nThe method will be called before the empty builder is made available for population.\n\n```java\n @ImmutableDefaults\n private static void applyDefaults(Builder builder) {\n   // set default property values directly into the builder\n }\n```\n\nAn immutable bean can be intercepted when the bean is being built.\nIn most cases this is not necessary, but if the bean has a property that needs to be defaulted\nfrom another property this can be useful.\nIn general, use of `@ImmutableValidator` and/or `@ImmutableDefaults` should be preferred.\n\nSimply declare a private static void method taking one 'Builder' argument annotated with\n[@ImmutablePreBuild](apidocs/org.joda.beans/org/joda/beans/gen/ImmutablePreBuild.html).\nThe method will be called when `build()` is invoked on the builder.\n\n```java\n @ImmutablePreBuild\n private static void preBuild(Builder builder) {\n   // query the builder and make any necessary changes\n }\n```\n\nThe constructor of an immutable bean can be replaced.\nIn most cases this is not necessary, but there may be occasional use cases.\nIn general, use of `@ImmutableValidator` and/or `@ImmutableDefaults` should be preferred.\n\nA constructor with parameters matching each property must be written and annotated with\n[@ImmutableConstructor](apidocs/org.joda.beans/org/joda/beans/gen/ImmutableConstructor.html).\nIt may be easier to generate the bean without the annotation and move the generated constructor out\ninto user code, adding the annotation only at that point.\n\n```java\n @ImmutableConstructor\n private MyBean(String surname, String forename) {\n   // a constructor entirely under application control\n }\n```\n\nAn immutable bean can be configured to cache the hash code.\nIn most cases this is not necessary, but if the bean is used as a hash key, then it may be helpful.\n\nSimply set the boolean 'cacheHashCode' flag of '@BeanDefinition' to true.\n\n```java\n @BeanDefinition(cacheHashCode = true)\n public final class Foo implements ImmutableBean {\n   // code generated immutable bean with cached hash code\n }\n```\n\nImmutable beans do not have set methods.\nInstead, a public builder class will be generated with methods to setup an instance.\nThis supports code based manipulation, using the `toBuilder()` method.\nThe scope of the builder, public private or package-scoped, may be controlled in the bean definition.\nThe default is public for immutable beans and no-builder for mutable beans:\n\n```java\n @BeanDefinition(builderScope = \"private\")\n public final class Bar implements ImmutableBean {\n   // code generated immutable bean with private builder\n }\n```\n\nA static factory may be created for an immutable bean.\nThis may be instead of or in addition to the builder.\nThe scope of the factory is always public, and it always contains all properties.\nAny additional customisation should involve moving the generated factory outside the autogenerated block.\nTo create the factory, specify the method name:\n\n```java\n @BeanDefinition(factoryName = \"of\")\n public final class Bar implements ImmutableBean {\n   // code generated immutable bean with static factory named \"of\"\n }\n```\n\nThe scope of the meta-bean, public private or package-scoped, may also be controlled in the bean definition.\nThe default is public:\n\n```java\n @BeanDefinition(metaScope = \"package\")\n public final class Bar implements ImmutableBean {\n   // code generated immutable bean with package-scoped meta-bean\n }\n```\n\nThe scope of the generated constructor for immutable beans can be controlled.\nThe default is to be as private as possible for the needs of the builder, typically private:\n\n```java\n @BeanDefinition(constructorScope = \"package\")\n public final class Bar implements ImmutableBean {\n   // code generated immutable bean with package-scoped constructor\n }\n```\n\nAn option also exists to generate the ConstructorProperties annotation:\n\n```java\n @BeanDefinition(constructorScope = \"public@ConstructorProperties\")\n public final class Bar implements ImmutableBean {\n   // code generated immutable bean with annotated public constructor\n }\n```\n\nA user-defined interface can be added to the meta-bean using the bean definition:\n\n```java\n @BeanDefinition(metaImplements = \"ShapeMeta\")\n public final class Square implements Shape, ImmutableBean {\n   // code generated meta-bean that implements ShapeMeta\n }\n```\n\n\n## Immutable bean hierarchies\n\nIt is possible for an immutable bean to be non-final.\nAny subclass should logically also be immutable, but must set the\n`BeanDefinition` annotation value `hierarchy` to \"immutable\":\n\n```java\n // superclass\n @BeanDefinition\n public abstract class SuperFoo implements ImmutableBean {\n   // code generation will enable an immutable subclass\n }\n \n // subclass\n @BeanDefinition(hierarchy = \"immutable\")\n public final class Foo extends SuperFoo {\n   // code generation will connect to superclass\n   // note that there is NO 'implements ImmutableBean' on the subclass\n }\n```\n\nIt is also possible for a bean to be partially final.\nIn this case, the bean will implement `Bean` rather than `ImmutableBean`.\nTo get the correct behaviour, the `BeanDefinition` annotation value\n`builderScope` must be set to \"public\".\nPartially final beans can extend one another, but must all declare the builder scope.\n\nThe rules as to what works and what does not are complex.\nIt is recommended to keep is simple, and only have normal mutable beans or final immutable beans.\n\n\n## Light beans\n\nIt is possible to generate a very light-weight bean.\nThis approach has no Meta class or Builder (the objects exist behind the scenes).\nThis is the approach with the lowest code generation.\n\n```java\n // superclass\n @BeanDefinition(style = \"light\")\n public final class LightBean implements ImmutableBean {\n   // code generation of a light-weight immutable bean\n }\n```\n\nInternally, the bean uses reflection to implement the meta bean and builder.\nAs such, it may be a little slower.\n\nBoth immutable and mutable light-weight beans can be generated.\n\n\n## Minimal beans\n\nIt is possible to generate a minimal bean.\nThis approach has no Meta class, but does have a Builder for immutable classes.\nThis is the approach with the medium amount of code generation.\n\n```java\n // superclass\n @BeanDefinition(style = \"minimal\")\n public final class MinimalBean implements ImmutableBean {\n   // code generation of a minimal immutable bean\n }\n```\n\nInternally, the bean uses lambdas to implement the meta bean.\n\nBoth immutable and mutable minimal beans can be generated.\n\n\n## Manual builders\n\nIt is possible to write the builder class manually and still have the generated code refer to it.\nA manual builder can be an inner class or top-level class.\n\n```java\n @BeanDefinition(builderName = \"PersonBuilder\", constructorScope = \"package\")\n public final class Person implements ImmutableBean {\n   // code generation of a minimal immutable bean\n }\n // using `extends BasicImmutableBeanBuilder<Person>` might be a better place to start\n public final class PersonBuilder implements BeanBuilder {\n   // manual builder code\n }\n```\n\nA common way to approach manual builders is to generate the builder, copy the builder code,\nadd the `builderName` flag and paste the builder code ready to edit.\n\n\n## Test coverage\n\nCode generated beans are great, but they have a side effect of creating lots of untested generated code.\nThis can make the test coverage percentage produced by tools seem very low.\nOne solution to this is provided by the `JodaBeanTests` class which provides methods to artificially\nprovide test coverage. Of course, this can be used for good or evil! The intention is that it is used\nto highlight those parts of the codebase that really do need tests, not to stop you needing tests at all.\n\n\n## Links\n\nReturn to the [main user guide](userguide.html).\n"
  },
  {
    "path": "src/site/markdown/userguide-serialization.md",
    "content": "## User guide - Serialization\n\nThis part of the user guide provides information on serialization of beans.\nSee the [main user guide](userguide.html) for a higher level introduction.\n\n\n## Serialization\n\nThe `org.joda.beans.ser` package provides support for serializing Joda-Beans via JSON, XML or MsgPack binary.\nThe main class is [JodaBeanSer](apidocs/org.joda.beans/org/joda/beans/ser/JodaBeanSer.html).\nIt contains the relevant settings and methods to access the serialization and deserialization.\n\nThe serializer makes use the meta-data in the bean to minimize the output size.\nIn effect, the Joda-Bean acts as a schema to interpret the data.\n\nTwo standard layouts are provided - COMPACT and PRETTY.\nThe compact layout has no whitespace, whereas the pretty layout uses indentation and new-lines.\nMethods on `JodaBeanSer` allow for further customization.\n\n### XML\n\n```java\n // write to XML\n String xmlStr = JodaBeanSer.COMPACT.xmlWriter().write(bean);\n // read from XML\n MyBean bean = JodaBeanSer.COMPACT.xmlReader().read(xmlStr, MyBean.class);\n```\n\n### JSON\n\n```java\n // write to JSON\n String jsonStr = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n // read from JSON\n MyBean bean = JodaBeanSer.COMPACT.jsonReader().read(jsonStr, MyBean.class);\n```\n\nThere is also a simple JSON reader/writer that does not expose Java types.\n\n### Binary\n\nFor binary there are three different formats available:\n\n* `binReader(STANDARD)` is the default and suitable for most uses.\n* `binReader(REFERENCING)` deduplicates all beans it sees, which can be slow.\n* `binReader(PACKED)` is the effective replacement for REFERENCING where callers choose which beans to deduplicate.\n\nThe classes to deduplicate can be controlled in the PACKED format using `JodaBeanSer.withBeanValueClasses()`.\n\n```java\n // write to Binary\n var bytes = JodaBeanSer.COMPACT.binWriter(JodaBeanBinFormat.PACKED).write(bean);\n // read from Binary\n MyBean bean = JodaBeanSer.COMPACT.binReader().read(bytes, MyBean.class);\n```\n\nNote that COMPACT vs PRETTY makes no difference in binary mode.\n\n\n## Supported types\n\nThe serialization mechanism supports implementations of `Bean`, `Collection`, `Map`, `Optional` and arrays.\nSome formats also support `Iterable`.\nIf Guava is present, implementations of `Multimap`, `Multiset`, `Table`, `BiMap` and Guava's `Optional` are supported.\nIf Joda-Collect is present, implementations of `Grid` are supported.\n\nThe serialization format is generally stable over different versions of the API.\nThe following incompatibilities apply:\n\n* The simple JSON format in v3.x alters two-dimensional primitive arrays to be written using\nthe natural format `[[1, 2], [2, 3]]` instead of the previous format `[\"1,2\", \"2,3\"]`.\n* The standard binary format in v3.x adjusts two-dimensional primitive arrays in a similar way to JSON.\n* The binary formats in v3.x permit null keys in maps.\n\n\n## Handling change\n\nWhen deserializing, the Joda-Bean meta-data is used to parse the input JSON/XML/binary.\nHowever, this causes a problem if the bean is refactored between serialization and deserialization.\nTo handle this, three mechanisms are provided.\n\nFirstly, the `RenameHandler` class from Joda-Convert is used.\nThis allows type renames and enum constant renames to be handled.\nThe class is a singleton and must be configured at application startup.\n\nSecondly, Joda-Beans provides the `SerDeserializer` mechanism.\nA `SerDeserializer` class can be written for each refactored bean.\nIt supports multiple kinds of change, including property rename, property type change and\ncomplex semantic changes. It is registered with `SerDeserializers` and called\ndirectly as part of the parsing process.\n\nFinally, the `PropertyDefinition` annotation has an \"alias\" attribute.\nSetting that allows the old name of a property to be retained when a property is renamed.\n\n\n## Leniency\n\nThe default deserialization mechanism is relatively strict.\nIf the input contains an unknown property then an error will be thrown.\nSimilarly, if a Java type is not handled by `SerTypeMapper` then an exception is thrown.\n\nThere is an alternative mode that is more lenient:\n\n    JodaBeanSer s = JodaBeanSer.COMPACT.withDeserializers(SerDeserializers.LENIENT);\n\nThis mode will ignore unknown properties received for a bean.\nIf a Java type cannot be found, lenient mode will attempt to fallback to an alternative type, such as `String`.\nTogether these help solve problems when integrating multiple projects/services using Joda-Beans.\n\n\n## Smart reader\n\nWhen reading data, it is possible to determine the type of the serialized data dynamically.\nUse `JodaBeanSer.COMPACT.smartReader()` to read an input stream that contains a JSON, XML or binary serialized bean.\n\n\n## Links\n\nReturn to the [main user guide](userguide.html).\n"
  },
  {
    "path": "src/site/markdown/userguide.md",
    "content": "## User guide\n\nJoda-Beans is a small library that adds properties to the Java programming language.\nIt consists of these main parts:\n\n* a set of interfaces and classes that define a property\n* a source [code generator](userguide-codegen.html)\n* [serialization and deserialization](userguide-serialization.html) via JSON, XML and MsgPack binary\n* integration with other technologies\n\nThe main rationale for the project is to raise the abstraction level of Java development.\nMost mainstream languages have some kind of support for properties, unfortunately Java does not.\nThe benefits of the Joda-Beans approach mostly apply when using the code generator:\n\n* easy to write common utilities acting on arbitrary beans without using reflection\n* no need to manually write getters, setters, equals, hashCode, toString\n* simple way to create immutable beans\n* effective and simple round-trip serialization and deserialization\n\n\n## Bean and Property model\n\nThe Joda-Bean API is based around a model of properties in the Java programming language.\n\nAll beans implement the [Bean](apidocs/org.joda.beans/org/joda/beans/Bean.html) interface.\nThis defines a minimal API for all beans, providing the ability to obtain the property names and a named property.\nThe interface also provides access to the *meta-bean*.\n\nThe [MetaBean](apidocs/org.joda.beans/org/joda/beans/MetaBean.html) interface defines the meta-bean.\nThe \"meta\" name indicates that this is a higher level description of the bean itself.\nIn fact, the meta-bean is the equivalent to `java.lang.Class` for beans - there is only one meta-bean object\nfor all instances of the bean.\nThe meta-bean API provides access to the name of the bean, it's type, a builder and the *meta-properties*.\n\nThe [MetaProperty](apidocs/org.joda.beans/org/joda/beans/MetaProperty.html) interface is the main definition of a property.\nIt is at the \"meta\" level, describing the property without holding a references to any specific instance of a bean.\nAs such, it is effectively the equivalent to `java.lang.reflect.Field` for a single property on a bean - there is only\none meta-property object for all instances of the property.\nThe meta-property API provides access to the name of the property, it's type, any declared annotations and\nwhether it is read-write or read-only.\nIt also include methods to get and set the value, which require the bean to be passed in just like `java.lang.reflect.Field`.\n\n```\n  Bean person = new Person();\n  MetaProperty<String> surnameMetaProperty = bean.metaBean().metaProperty(\"surname\");\n  String surname = surnameMetaProperty.get(person);\n```\n\nThe bean itself also provides access to instances of the [Property](apidocs/org.joda.beans/org/joda/beans/Property.html) interface for each property.\nEach property object is a simple combination of the bean and the meta-property.\nThis means that there are simple methods to get and set the value of the property which directly affect the underlying bean.\nThe property also provides methods to get the property name, the underlying bean and the meta-property.\n\n```\n  Bean person = new Person();\n  Property<String> surnameProperty = bean.property(\"surname\");\n  String surname = surnameProperty.get();\n```\n\n\n### Use in an application\n\nApplications can use Joda-Beans properties in many ways, revolving around passing a single property of an object to another method.\nFor example, it would be possible to write a validating method that checked the validity of a single property, but perhaps\nregistered errors on the underlying bean.\n\n\n### Use in a framework\n\nJoda-Beans is designed to work well with frameworks which need dynamic access to the properties of a bean.\nIt is recommended when working with a framework to primarily use the meta-bean and associated meta-properties.\nThis is because they tend to be singletons and more efficient than using the property objects.\nThe meta-property API is also more comprehensive than the property API.\n\nBeans are normal Java objects and can be created from scratch using constructors.\nFrameworks may wish to use the [BeanBuilder](apidocs/org.joda.beans/org/joda/beans/BeanBuilder.html) interface\nwhich provides a standard way to build the bean.\nThe builder is obtained from the meta-bean.\nEach property is then set before calling `build`.\n\nA selection of utilities is available on [JodaBeanUtils](apidocs/org.joda.beans/org/joda/beans/JodaBeanUtils.html).\nThis includes the ability to lookup a meta-bean from a `java.lang.Class`, access to the Joda-Convert string\nconverter and methods to extract the types of lists and maps using reflection on generics.\n\nThe access to the field-level annotations provided by the meta-property is also useful to framework writers.\n\n\n### Joda-Convert integration\n\nA Joda-Beans meta-property provides the ability to set a property from a string.\nThe conversion between the string and the type of the property, such as `int` or `URI`, is handled by\n[Joda-Convert](/joda-convert/). The converter can be customised, and is exposed by `JodaBeanUtils`.\n\nWhen iterating over a bean object graph, being able to determine which objects are \"leaves\", the simple\ntypes that have a direct string representation, is a very useful ability.\n\n\n### Finding the generic type parameters of a property\n\nThe Java bytecode format contains more details about generic types than is often realised.\nThe `JodaBeanUtils` methods `collectionType()`, `mapKeyType()` and\n`mapValueType()` allow the generic parameter type of a property to be extracted.\nThus an application can tell that a property is of type `List<String>`, not just `List`.\n\n\n### Iterating over a bean object graph\n\nThe `JodaBeanUtils` class contains the method `beanIterator()`.\nThis provides a simple mechanism to iterate over all the beans within a bean.\n\nThe iteration is depth-first, and handles collections, and collections within collections.\nNote however that there is no protection against cycles in the object graph, thus the method\nis only fully safe when using immutable beans.\n\n```\n for (Bean bean : JodaBeanUtils.beanIterator(rootBean)) {\n   // perform logic on each bean in the object graph\n }\n```\n\n\n## Code generation\n\nIt is entirely possible to write a Joda-Bean by hand - the design utilises simple Java interfaces.\nMost users choose to code generate beans however.\nFor information on code generation, see the [code generation user guide](userguide-codegen.html).\n\n\n## Serialization\n\nOne of the benefits of a bean and property system is that serialization code becomes much simpler.\nFor information on serialization in XML, JSON and binary, see the [serialization user guide](userguide-serialization.html).\n\n\n## Integration\n\nJoda-Beans has been integrated with Freemarker, MongoDB and Kryo.\nThe integration support classes are included in the jar file but only work when the optional dependency is present.\nNote that it is entirely valid to use Joda-Beans without additional jar file dependencies apart from Joda-Convert.\n\nThe beans are also widely use in the [Strata](https://strata.opengamma.io/) market risk project.\n"
  },
  {
    "path": "src/site/resources/css/site.css",
    "content": "/* Fix broken definition that causes hyperlinks to break */\r\nh1[id]:before,\r\nh2[id]:before,\r\nh3[id]:before,\r\nh4[id]:before,\r\nh5[id]:before,\r\nh6[id]:before,\r\na[name]:before {\r\n height:0px;\r\n margin:0px;\r\n}\r\n/* Blacker text */\r\nbody {\r\n color: #222;\r\n}\r\ncode, pre {\r\n color: #444;\r\n}\r\n.main-body p b {\r\n font-weight: bold;\r\n color: #722;\r\n}\r\n.dropdown-menu>li>a {\r\n color: #666;\r\n}\r\n/* Sidebar had too much padding at the top */\r\n.well {\r\n padding-top: 6px;\r\n padding-bottom: 36px;\r\n}\r\n/* Font Awesome icons by CSS as markdown class is stripped */\r\nh2 i {\r\n display: inline-block;\r\n font: normal normal normal 14px/1 FontAwesome;\r\n font-size: inherit;\r\n text-rendering: auto;\r\n -webkit-font-smoothing: antialiased;\r\n -moz-osx-font-smoothing: grayscale;\r\n}\r\nh2#About i:before {\r\n content: \"\\f015\";\r\n}\r\nh2#Features i:before {\r\n content: \"\\f0d0\";\r\n}\r\nh2#Documentation i:before {\r\n content: \"\\f02d\";\r\n}\r\nh2#Releases i:before {\r\n content: \"\\f02c\";\r\n}\r\nh2#Why_Joda_Beans i:before {\r\n content: \"\\f19c\";\r\n}\r\nh2#Rationale i:before {\r\n content: \"\\f0eb\";\r\n}\r\n\r\n/* Enterprise page */\r\nh2#Joda-Beans_for_Enterprise~div > p:last-child {\r\n text-align: center;\r\n margin-top: 1.1em;\r\n margin-bottom: 1.2em;\r\n}\r\nbutton.btn-learnmore, button.btn-requestdemo {\r\n width: 14em;\r\n font-size: 1.2em;\r\n text-align: center;\r\n padding-top: 0.3em;\r\n padding-bottom: 0.3em;\r\n border-radius: 3px;\r\n border-style: solid;\r\n}\r\nbutton.btn-learnmore {\r\n color: #f6914d;\r\n background-color: white;\r\n border-color: #f6914d;\r\n}\r\nbutton.btn-learnmore a {\r\n color: #f6914d;\r\n}\r\nbutton.btn-requestdemo {\r\n color: white;\r\n background-color: #f6914d;\r\n border-color: #f6914d;\r\n}\r\nbutton.btn-requestdemo a {\r\n color: white;\r\n}\r\n"
  },
  {
    "path": "src/site/resources/download.html",
    "content": "<head>\n<title>OpenGamma</title>\n<meta http-equiv=\"REFRESH\" content=\"0;url=https://github.com/JodaOrg/joda-beans/releases\">\n</head>\n<body></body>\n</html>\n"
  },
  {
    "path": "src/site/site.xml",
    "content": "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n<project name=\"Joda-Beans\">\r\n  <publishDate position=\"bottom\" format=\"yyyy-MM-dd\"/>\r\n  <version position=\"bottom\"/>\r\n  <googleAnalyticsAccountId>UA-1425975-4</googleAnalyticsAccountId>\r\n\r\n  <skin>\r\n    <groupId>org.joda.external</groupId>\r\n    <artifactId>reflow-maven-skin</artifactId>\r\n    <version>1.2</version>\r\n  </skin>\r\n\r\n  <custom>\r\n    <reflowSkin>\r\n      <smoothScroll>false</smoothScroll>\r\n      <highlightJs>true</highlightJs>\r\n      <highlightJsTheme>github</highlightJsTheme>\r\n      <imgLightbox>false</imgLightbox>\r\n      <theme>bootswatch-cosmo</theme>\r\n      <brand>\r\n        <name>Joda-Beans</name>\r\n        <href>index.html</href>\r\n      </brand>\r\n      <topNav>Documentation|Releases|Development|Joda|For Enterprise</topNav>\r\n      <bottomNav>\r\n        <column>Documentation</column>\r\n        <column>Releases</column>\r\n        <column>Development</column>\r\n        <column>Reports</column>\r\n      </bottomNav>\r\n      <bottomDescription><![CDATA[\r\n        Beans and Properties for Java\r\n      ]]></bottomDescription>\r\n      <toc>false</toc>\r\n      <breadcrumbs>false</breadcrumbs>\r\n      <markPageHeader>false</markPageHeader>\r\n      <protocolRelativeURLs>true</protocolRelativeURLs>\r\n      <pages>\r\n        <index>\r\n          <sections>\r\n            <columns>3</columns>\r\n            <columns>1</columns>\r\n            <body />\r\n            <sidebar />\r\n          </sections>\r\n          <shortTitle>Home</shortTitle>\r\n          <highlightJs>false</highlightJs>\r\n        </index>\r\n        <source-repository>\r\n          <highlightJs>false</highlightJs>\r\n        </source-repository>\r\n        <issue-tracking>\r\n          <highlightJs>false</highlightJs>\r\n        </issue-tracking>\r\n        <license>\r\n          <highlightJs>false</highlightJs>\r\n        </license>\r\n      </pages>\r\n    </reflowSkin>\r\n  </custom>\r\n\r\n  <body>\r\n    <head>\r\n      <![CDATA[\r\n        <link href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.min.css\" rel=\"stylesheet\"/>\r\n        <link rel=\"author\" href=\"https://plus.google.com/113137868744510231215\"/>]]>\r\n    </head>\r\n\r\n    <menu name=\"Documentation\">\r\n      <item name=\"Home\" href=\"index.html\"/>\r\n      <item name=\"User guide\" href=\"userguide.html\"/>\r\n      <item name=\"Related projects\" href=\"related.html\"/>\r\n      <item name=\"Javadoc\" href=\"apidocs/index.html\"/>\r\n      <item name=\"License\" href=\"licensecover.html\"/>\r\n    </menu>\r\n\r\n    <menu name=\"Releases\">\r\n      <item name=\"Release notes\" href=\"changes-report.html\"/>\r\n      <item name=\"Dependency info\" href=\"dependency-info.html\"/>\r\n      <item name=\"Download\" href=\"download.html\"/>\r\n    </menu>\r\n\r\n    <menu name=\"Development\">\r\n      <item name=\"GitHub\" href=\"https://github.com/JodaOrg/joda-beans\"/>\r\n      <item name=\"Bugs/Issues\" href=\"https://github.com/JodaOrg/joda-beans/issues\"/>\r\n      <item name=\"Test results\" href=\"surefire.html\"/>\r\n    </menu>\r\n\r\n    <menu name=\"Joda\">\r\n      <item name=\"Home\" href=\"https://www.joda.org\"/>\r\n      <item name=\"Convert\" href=\"https://www.joda.org/joda-convert/\"/>\r\n      <item name=\"Money\" href=\"https://www.joda.org/joda-money/\"/>\r\n      <item name=\"Time\" href=\"https://www.joda.org/joda-time/\"/>\r\n    </menu>\r\n\r\n    <menu name=\"For Enterprise\">\r\n      <item name=\"Tidelift\" href=\"enterprise.html\"/>\r\n    </menu>\r\n\r\n    <menu name=\"Reports\" ref=\"reports\"/>\r\n  </body>\r\n</project>\r\n"
  },
  {
    "path": "src/test/java/org/joda/beans/Examples.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.Documentation;\nimport org.joda.beans.sample.Person;\n\n/**\n * Examples using Person.\n */\npublic class Examples {\n\n    public static void main(String[] args) {\n        // create the bean the hard way - could just do new Person() instead\n        Person p = Person.meta().builder().set(\"surname\", \"Smith\").build();\n        // set surname using normal method\n        p.setSurname(\"Colebourne\");\n        // query using property method\n        System.out.println(p.surname().get());\n        // query using meta-property method\n        System.out.println(Person.meta().surname().get(p));\n        // set/get forename using property method\n        p.forename().set(\"Stephen\");\n        System.out.println(p.forename().get());\n        // set cars\n        p.numberOfCars().set(2);\n        // access all the properties\n        System.out.println(p.propertyNames());\n        System.out.println(JodaBeanUtils.flatten(p));\n        System.out.println(p);\n        // perform validation\n        boolean valid =\n            validateNotEmpty(p.surname()) &&\n            validateNotEmpty(p.forename());\n        System.out.println(valid ? \"Valid\" : \"Not valid\");\n        // extensions\n        p.getExtensions().set(\"suffix\", \"Jr\");\n        System.out.println(p.propertyNames());\n        System.out.println(JodaBeanUtils.flatten(p));\n        System.out.println(p);\n        \n        // create the bean the hard way - could just do new Address() instead\n        Address a = Address.meta().builder().build();\n        // set surname using normal method\n        a.setStreet(\"Barnsnap Close\");\n        // query using property method\n        System.out.println(a.street().get());\n        // set/get forename using property method\n        a.city().set(\"Horsham\");\n        System.out.println(a.city().get());\n        // set cars\n        a.number().set(22);\n        // access all the properties\n        System.out.println(a.propertyNames());\n        System.out.println(JodaBeanUtils.flatten(a));\n        System.out.println(a);\n        // perform validation\n        valid =\n            validateNotEmpty(a.street()) &&\n            validateNotEmpty(a.city());\n        System.out.println(valid ? \"Valid\" : \"Not valid\");\n        \n        // generics\n        Documentation<Address> d = new Documentation<>();\n        d.setType(\"ADDRESS\");\n        d.setContent(a);\n        Property<Address> dProp = d.content();\n        Address a2 = dProp.metaProperty().get(d);\n        System.out.println(a2);\n        Address a3 = Documentation.metaDocumentation(Address.class).content().get(d);\n        System.out.println(a3);\n        Documentation<Address> d2 = Documentation.metaDocumentation(Address.class).builder().build();\n        System.out.println(d2);\n        \n//        try {\n//            Mongo mongo = new Mongo(\"127.0.0.1\");\n//            System.out.println(mongo);\n//            mongo.dropDatabase(\"BeansTest\");\n//            DB db = mongo.getDB(\"BeansTest\");\n//            DBCollection coll = db.createCollection(\"Test\", new BeanMongoDBObject(p));\n//            System.out.println(coll);\n//            System.out.println(\"Docs \" + coll.getCount());\n//            \n//        } catch (Exception ex) {\n//            ex.printStackTrace();\n//        }\n    }\n\n    private static boolean validateNotEmpty(Property<String> property) {\n        String str = property.get();\n        return (str != null && str.length() > 0);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestAddress.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans;\r\n\r\nimport static org.assertj.core.api.Assertions.assertThat;\r\nimport static org.assertj.core.api.Assertions.assertThatExceptionOfType;\r\n\r\nimport java.lang.annotation.Annotation;\r\nimport java.util.List;\r\nimport java.util.Map;\r\nimport java.util.NoSuchElementException;\r\n\r\nimport org.joda.beans.gen.PropertyDefinition;\r\nimport org.joda.beans.sample.Address;\r\nimport org.junit.jupiter.api.Test;\r\n\r\n/**\r\n * Test property using Person.\r\n */\r\nclass TestAddress {\r\n\r\n    private static final int NUM_PROPERTIES = 4;\r\n    private static final String STREET = \"street\";\r\n    private static final String CITY = \"city\";\r\n    private static final String NUMBER = \"number\";\r\n\r\n    @Test\r\n    void test_bean() {\r\n        Bean test = new Address();\r\n        \r\n        assertThat(test).isInstanceOf(Address.class);\r\n        \r\n        assertThat(test.metaBean()).isEqualTo(Address.meta());\r\n        \r\n        assertThat(test.propertyNames()).contains(STREET);\r\n        assertThat(test.propertyNames()).contains(CITY);\r\n        assertThat(test.propertyNames()).contains(NUMBER);\r\n        assertThat(test.propertyNames()).doesNotContain(\"Rubbish\");\r\n        \r\n        assertThat(test.property(STREET).name()).isEqualTo(STREET);\r\n        assertThat(test.property(CITY).name()).isEqualTo(CITY);\r\n        assertThat(test.property(NUMBER).name()).isEqualTo(NUMBER);\r\n    }\r\n\r\n    @Test\r\n    void test_bean_invalidPropertyName() {\r\n        Bean test = Address.meta().builder().build();\r\n        assertThatExceptionOfType(NoSuchElementException.class)\r\n                .isThrownBy(() -> test.property(\"Rubbish\"));\r\n    }\r\n\r\n    @Test\r\n    void test_builder1() {\r\n        BeanBuilder<? extends Address> builder = Address.meta().builder();\r\n        builder.set(\"street\", \"Main Street\");\r\n        assertThat(builder.get(\"street\")).isEqualTo(\"Main Street\");\r\n        builder.set(\"city\", \"London\");\r\n        assertThat(builder.get(\"street\")).isEqualTo(\"Main Street\");\r\n        assertThat(builder.get(\"city\")).isEqualTo(\"London\");\r\n        String street = builder.get(Address.meta().street());\r\n        assertThat(street).isEqualTo(\"Main Street\");\r\n        String city = builder.get(Address.meta().city());\r\n        assertThat(city).isEqualTo(\"London\");\r\n        \r\n        Address test = builder.build();\r\n        Address expected = new Address();\r\n        expected.setStreet(\"Main Street\");\r\n        expected.setCity(\"London\");\r\n        \r\n        assertThat(test).isEqualTo(expected);\r\n    }\r\n\r\n    @Test\r\n    void test_builder2() {\r\n        BeanBuilder<? extends Address> builder = Address.meta().builder();\r\n        builder.set(Address.meta().street(), \"Main Street\");\r\n        builder.set(Address.meta().number(), 12);\r\n        \r\n        Address test = builder.build();\r\n        Address expected = new Address();\r\n        expected.setStreet(\"Main Street\");\r\n        expected.setNumber(12);\r\n        \r\n        assertThat(test).isEqualTo(expected);\r\n    }\r\n\r\n    @Test\r\n    void test_builder_getInvalidPropertyName() {\r\n        BeanBuilder<? extends Address> builder = Address.meta().builder();\r\n        assertThatExceptionOfType(NoSuchElementException.class)\r\n                .isThrownBy(() -> builder.get(\"Rubbish\"));\r\n    }\r\n\r\n    @Test\r\n    void test_builder_setInvalidPropertyName() {\r\n        BeanBuilder<? extends Address> builder = Address.meta().builder();\r\n        assertThatExceptionOfType(NoSuchElementException.class)\r\n                .isThrownBy(() -> builder.set(\"Rubbish\", \"\"));\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_metaBean() {\r\n        MetaBean test = Address.meta();\r\n        \r\n        assertThat(test.beanType()).isEqualTo(Address.class);\r\n        \r\n        assertThat(test.beanName()).isEqualTo(Address.class.getName());\r\n        \r\n        assertThat(test.metaPropertyCount()).isEqualTo(NUM_PROPERTIES);\r\n        \r\n        assertThat(test.metaPropertyExists(STREET)).isTrue();\r\n        assertThat(test.metaPropertyExists(CITY)).isTrue();\r\n        assertThat(test.metaPropertyExists(NUMBER)).isTrue();\r\n        assertThat(test.metaPropertyExists(\"Rubbish\")).isFalse();\r\n        \r\n        assertThat(test.metaProperty(STREET).name()).isEqualTo(STREET);\r\n        assertThat(test.metaProperty(CITY).name()).isEqualTo(CITY);\r\n        assertThat(test.metaProperty(NUMBER).name()).isEqualTo(NUMBER);\r\n        \r\n        Map<String, MetaProperty<?>> map = test.metaPropertyMap();\r\n        assertThat(map).hasSize(NUM_PROPERTIES);\r\n        assertThat(map).containsKey(STREET);\r\n        assertThat(map).containsKey(CITY);\r\n        assertThat(map).containsKey(NUMBER);\r\n        assertThat(map).doesNotContainKey(\"NotHere\");\r\n        assertThat(map.get(STREET)).isEqualTo(Address.meta().street());\r\n    }\r\n\r\n    @Test\r\n    void test_metaBean_invalidPropertyName() {\r\n        MetaBean test = Address.meta();\r\n        assertThatExceptionOfType(NoSuchElementException.class)\r\n                .isThrownBy(() -> test.metaProperty(\"Rubbish\"));\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_namedPropertyMethod() {\r\n        Address address = new Address();\r\n        Property<String> test = address.street();\r\n        \r\n        assertThat((Object) test.bean()).isSameAs(address);\r\n        assertThat(test.metaProperty()).isSameAs(Address.meta().street());\r\n        \r\n        assertThat(test.get()).isNull();\r\n        address.setStreet(\"A\");\r\n        assertThat(test.get()).isEqualTo(\"A\");\r\n        test.set(\"B\");\r\n        assertThat(test.get()).isEqualTo(\"B\");\r\n        assertThat(test.put(\"C\")).isEqualTo(\"B\");\r\n        assertThat(test.get()).isEqualTo(\"C\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_property_String() {\r\n        Address address = new Address();\r\n        Property<String> test = address.property(STREET);\r\n        \r\n        assertThat((Object) test.bean()).isSameAs(address);\r\n        assertThat(test.metaProperty()).isSameAs(Address.meta().street());\r\n        \r\n        assertThat(test.get()).isNull();\r\n        address.setStreet(\"A\");\r\n        assertThat(test.get()).isEqualTo(\"A\");\r\n        test.set(\"B\");\r\n        assertThat(test.get()).isEqualTo(\"B\");\r\n        assertThat(test.put(\"C\")).isEqualTo(\"B\");\r\n        assertThat(test.get()).isEqualTo(\"C\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_namedMetaPropertyMethod() {\r\n        Address address = new Address();\r\n        MetaProperty<String> test = Address.meta().street();\r\n        \r\n        assertThat(test.metaBean().beanType()).isEqualTo(Address.class);\r\n        assertThat(test.propertyType()).isEqualTo(String.class);\r\n        assertThat(test.name()).isEqualTo(STREET);\r\n        assertThat(test.style()).isEqualTo(PropertyStyle.READ_WRITE);\r\n        \r\n        assertThat(test.get(address)).isNull();\r\n        address.setStreet(\"A\");\r\n        assertThat(test.get(address)).isEqualTo(\"A\");\r\n        test.set(address, \"B\");\r\n        assertThat(test.get(address)).isEqualTo(\"B\");\r\n        assertThat(test.put(address, \"C\")).isEqualTo(\"B\");\r\n        assertThat(test.get(address)).isEqualTo(\"C\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_metaProperty_String() {\r\n        Address address = new Address();\r\n        MetaProperty<String> test = Address.meta().metaProperty(STREET);\r\n        \r\n        assertThat(test.metaBean().beanType()).isEqualTo(Address.class);\r\n        assertThat(test.propertyType()).isEqualTo(String.class);\r\n        assertThat(test.name()).isEqualTo(STREET);\r\n        assertThat(test.style()).isEqualTo(PropertyStyle.READ_WRITE);\r\n        \r\n        assertThat(test.get(address)).isNull();\r\n        address.setStreet(\"A\");\r\n        assertThat(test.get(address)).isEqualTo(\"A\");\r\n        test.set(address, \"B\");\r\n        assertThat(test.get(address)).isEqualTo(\"B\");\r\n        assertThat(test.put(address, \"C\")).isEqualTo(\"B\");\r\n        assertThat(test.get(address)).isEqualTo(\"C\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_metaProperty_types() {\r\n        MetaProperty<String> test = Address.meta().street();\r\n        \r\n        assertThat(test.metaBean().beanType()).isEqualTo(Address.class);\r\n        assertThat(test.propertyType()).isEqualTo(String.class);\r\n        assertThat(test.propertyGenericType()).isEqualTo(String.class);\r\n    }\r\n\r\n    @Test\r\n    void test_metaProperty_annotations() {\r\n        MetaProperty<String> prop = Address.meta().street();\r\n        List<Annotation> test = prop.annotations();\r\n        \r\n        assertThat(test.size()).isEqualTo(1);\r\n        assertThat(test.get(0)).isInstanceOf(PropertyDefinition.class);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestArray.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport org.joda.beans.sample.SimpleName;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test arrays using SimpleName.\n */\nclass TestArray {\n\n    @Test\n    void test_bean() {\n        SimpleName person1 = new SimpleName();\n        person1.setForename(\"Etienne\");\n        person1.setMiddleNames(new String[] {\"Yakusa\", \"Mohito\"});\n        person1.setSurname(\"Colebourne\");\n        SimpleName person2 = new SimpleName();\n        person2.setForename(\"Etienne\");\n        person2.setMiddleNames(new String[] {\"Yakusa\", \"Mohito\"});\n        person2.setSurname(\"Colebourne\");\n        \n        assertThat(person1).isEqualTo(person2);\n        assertThat(person1.hashCode()).isEqualTo(person2.hashCode());\n        assertThat(person1).hasToString(\n                \"SimpleName{forename=Etienne, middleNames=[Yakusa, Mohito], surname=Colebourne}\");\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestBasicBean.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans;\r\n\r\nimport static org.assertj.core.api.Assertions.assertThat;\r\n\r\nimport org.joda.beans.impl.BasicBean;\r\nimport org.joda.beans.sample.Address;\r\nimport org.joda.beans.sample.CompanyAddress;\r\nimport org.joda.beans.sample.Person;\r\nimport org.junit.jupiter.api.Test;\r\n\r\n/**\r\n * Test {@link BasicBean}.\r\n */\r\nclass TestBasicBean {\r\n\r\n    @Test\r\n    void test_equals() {\r\n        Person a1 = new Person();\r\n        Person a2 = new Person();\r\n        Person b = new Person();\r\n        \r\n        a1.setForename(\"Stephen\");\r\n        a2.setForename(\"Stephen\");\r\n        b.setForename(\"Etienne\");\r\n        \r\n        assertThat(a1.equals(a1)).isTrue();\r\n        assertThat(a1.equals(a2)).isTrue();\r\n        assertThat(a2.equals(a1)).isTrue();\r\n        assertThat(a2.equals(a2)).isTrue();\r\n        \r\n        assertThat(a1.equals(b)).isFalse();\r\n        assertThat(b.equals(a1)).isFalse();\r\n        \r\n        Object obj = \"Weird type\";\r\n        assertThat(b.equals(obj)).isFalse();\r\n        assertThat(b.equals(null)).isFalse();\r\n    }\r\n\r\n    @Test\r\n    void test_hashCode() {\r\n        Person a1 = new Person();\r\n        Person a2 = new Person();\r\n        \r\n        a1.setForename(\"Stephen\");\r\n        a2.setForename(\"Stephen\");\r\n        \r\n        assertThat(a1.hashCode()).isEqualTo(a2.hashCode());\r\n    }\r\n\r\n    @Test\r\n    void test_toString() {\r\n        Person a = new Person();\r\n        a.setForename(\"Stephen\");\r\n        a.setSurname(\"Colebourne\");\r\n        \r\n        assertThat(a.toString())\r\n                .startsWith(\"Person{\")\r\n                .endsWith(\"}\")\r\n                .contains(\"forename=Stephen\")\r\n                .contains(\"surname=Colebourne\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_property_equals() {\r\n        Address obj1 = new Address();\r\n        CompanyAddress obj2 = new CompanyAddress();\r\n        Property<String> p1 = obj1.city();\r\n        Property<String> p2 = obj2.city();\r\n        \r\n        obj1.setCity(\"London\");\r\n        obj2.setCity(\"London\");\r\n        \r\n        assertThat(p1).isEqualTo(p2);\r\n    }\r\n\r\n    @Test\r\n    void test_property_hashCode() {\r\n        Person obj1 = new Person();\r\n        Person obj2 = new Person();\r\n        Property<String> p1 = obj1.forename();\r\n        Property<String> p2 = obj2.forename();\r\n        \r\n        obj1.setForename(\"Stephen\");\r\n        obj2.setForename(\"Stephen\");\r\n        \r\n        assertThat(p1.hashCode()).isEqualTo(p2.hashCode());\r\n    }\r\n\r\n    @Test\r\n    void test_property_toString() {\r\n        Person obj1 = new Person();\r\n        Property<String> p1 = obj1.forename();\r\n        \r\n        obj1.setForename(\"Stephen\");\r\n        \r\n        assertThat(p1).hasToString(\"Person:forename=Stephen\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_metaProperty_equals() {\r\n        MetaProperty<String> p1 = Address.meta().city();\r\n        MetaProperty<String> p2 = CompanyAddress.meta().city();\r\n        \r\n        assertThat(p1).isEqualTo(p2);\r\n    }\r\n\r\n    @Test\r\n    void test_metaProperty_hashCode() {\r\n        MetaProperty<String> p1 = Person.meta().forename();\r\n        MetaProperty<String> p2 = Person.meta().forename();\r\n        \r\n        assertThat(p1.hashCode()).isEqualTo(p2.hashCode());\r\n    }\r\n\r\n    @Test\r\n    void test_metaProperty_toString() {\r\n        MetaProperty<String> mp1 = Person.meta().forename();\r\n        \r\n        assertThat(mp1).hasToString(\"Person:forename\");\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestBeanCodeGenException.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport java.io.File;\n\nimport org.joda.beans.gen.BeanCodeGenException;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test {@link BeanCodeGenException}, message is parsed by plugins.\n */\nclass TestBeanCodeGenException {\n\n    private static final File FILE = new File(\".\");\n\n    @Test\n    void testMessage() {\n        BeanCodeGenException test = new BeanCodeGenException(\"rubbish\", FILE, 123);\n        assertThat(test.getMessage()).isEqualTo(\"Error in bean: \" + FILE.toString() + \", Line: 123, Message: rubbish\");\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestBeanIterator.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport java.util.Iterator;\n\nimport org.joda.beans.impl.flexi.FlexiBean;\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.ImmEmpty;\nimport org.joda.beans.sample.ImmTreeNode;\nimport org.junit.jupiter.api.Test;\n\nimport com.google.common.collect.ImmutableList;\n\n/**\n * Test {@link BeanIterator}.\n */\nclass TestBeanIterator {\n\n    @Test\n    void test_iteration_noChildren() {\n        ImmEmpty bean = ImmEmpty.builder().build();\n        Iterator<Bean> it = JodaBeanUtils.beanIterator(bean);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(bean);\n        assertThat(it.hasNext()).isFalse();\n    }\n\n    @Test\n    void test_iteration_nullChild() {\n        Address bean = new Address();\n        Iterator<Bean> it = JodaBeanUtils.beanIterator(bean);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(bean);\n        assertThat(it.hasNext()).isFalse();\n    }\n\n    @Test\n    void test_iteration_childWithChildren() {\n        ImmTreeNode node1 = ImmTreeNode.builder().name(\"1\").build();\n        ImmTreeNode node2 = ImmTreeNode.builder().name(\"2\").build();\n        ImmTreeNode root = ImmTreeNode.builder()\n            .name(\"root\")\n            .child1(node1)\n            .child2(node2)\n            .build();\n        \n        Iterator<Bean> it = JodaBeanUtils.beanIterator(root);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(root);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(node1);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(node2);\n        assertThat(it.hasNext()).isFalse();\n    }\n\n    @Test\n    void test_iteration_childWithChildrenOfChildren() {\n        ImmTreeNode node1 = ImmTreeNode.builder().name(\"1\").build();\n        ImmTreeNode node2 = ImmTreeNode.builder().name(\"2\").build();\n        ImmTreeNode node3 = ImmTreeNode.builder()\n            .name(\"3\")\n            .child1(node1)\n            .child2(node2)\n            .build();\n        ImmTreeNode root = ImmTreeNode.builder()\n            .name(\"root\")\n            .child1(node3)\n            .build();\n        \n        Iterator<Bean> it = JodaBeanUtils.beanIterator(root);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(root);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(node3);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(node1);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(node2);\n        assertThat(it.hasNext()).isFalse();\n    }\n\n    @Test\n    void test_iteration_childWithListOfChildren() {\n        ImmTreeNode node1a = ImmTreeNode.builder().name(\"1a\").build();\n        ImmTreeNode node1b = ImmTreeNode.builder().name(\"1b\").build();\n        ImmTreeNode node1 = ImmTreeNode.builder()\n            .name(\"1\")\n            .child1(node1a)\n            .child2(node1b)\n            .build();\n        ImmTreeNode node2a = ImmTreeNode.builder().name(\"2a\").build();\n        ImmTreeNode node2b = ImmTreeNode.builder().name(\"2b\").build();\n        ImmTreeNode node2 = ImmTreeNode.builder()\n            .name(\"2\")\n            .child1(node2a)\n            .child2(node2b)\n            .build();\n        ImmTreeNode node3 = ImmTreeNode.builder().name(\"3\").build();\n        ImmTreeNode root = ImmTreeNode.builder()\n            .name(\"root\")\n            .child1(node3)\n            .childList(ImmutableList.of(node1, node2))\n            .build();\n        \n        Iterator<Bean> it = JodaBeanUtils.beanIterator(root);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(root);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(node3);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(node1);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(node1a);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(node1b);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(node2);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(node2a);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(node2b);\n        assertThat(it.hasNext()).isFalse();\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_iteration_childWithNoChildren_FlexiBean() {\n        FlexiBean bean1 = new FlexiBean();\n        Iterator<Bean> it = JodaBeanUtils.beanIterator(bean1);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(bean1);\n        assertThat(it.hasNext()).isFalse();\n    }\n\n    @Test\n    void test_iteration_childWithOneChild_FlexiBean() {\n        FlexiBean bean1 = new FlexiBean();\n        FlexiBean bean2 = new FlexiBean();\n        bean1.set(\"a\", bean2);\n        Iterator<Bean> it = JodaBeanUtils.beanIterator(bean1);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(bean1);\n        assertThat(it.hasNext()).isTrue();\n        assertThat(it.next()).isSameAs(bean2);\n        assertThat(it.hasNext()).isFalse();\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestClone.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport java.lang.reflect.Method;\nimport java.util.Arrays;\nimport java.util.Date;\n\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.ClonePerson;\nimport org.joda.beans.sample.Company;\nimport org.joda.beans.sample.NoClone;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test property using ClonePerson.\n */\nclass TestClone {\n\n    @Test\n    void test_bean() {\n        ClonePerson base = new ClonePerson();\n        base.setSurname(\"Cable\");\n        base.setMiddleNames(new String[] {\"A\", \"B\", \"C\"});\n        base.setFirstNames(Arrays.asList(\"Vince\", \"Matey\"));\n        base.setDateOfBirth(new Date());\n        Address address = new Address();\n        address.setCity(\"London\");\n        base.setAddresses(Arrays.asList(address));\n        Company company = new Company();\n        company.setCompanyName(\"Government\");\n        base.setCompanies(new Company[] {company});\n        base.setAmounts(new int[] {1, 2});\n        \n        ClonePerson cloned = base.clone();\n        assertThat(cloned).isEqualTo(base);\n        assertThat(cloned.getMiddleNames()).isNotSameAs(base.getMiddleNames());\n        assertThat(cloned.getFirstNames()).isNotSameAs(base.getFirstNames());\n        assertThat(cloned.getDateOfBirth()).isNotSameAs(base.getDateOfBirth());\n        assertThat(cloned.getAddresses()).isNotSameAs(base.getAddresses());\n        assertThat(cloned.getAddresses().get(0)).isNotSameAs(base.getAddresses().get(0));\n        assertThat(cloned.getCompanies()).isNotSameAs(base.getCompanies());\n        assertThat(cloned.getCompanies()[0]).isNotSameAs(base.getCompanies()[0]);\n        assertThat(cloned.getAmounts()).isNotSameAs(base.getAmounts());\n    }\n\n    @Test\n    void test_noclone_on_mutable_bean_option() {\n        // test that clone() was not code-generated\n        Class<?> c = NoClone.class;\n        Method[] noCloneMethods = c.getDeclaredMethods();\n\n        for (Method method : noCloneMethods) {\n            assertThat(\"clone\").isNotEqualTo(method.getName());\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestCompanyAddress.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans;\r\n\r\nimport static org.assertj.core.api.Assertions.assertThat;\r\nimport static org.assertj.core.api.Assertions.assertThatExceptionOfType;\r\n\r\nimport java.lang.annotation.Annotation;\r\nimport java.util.List;\r\nimport java.util.Map;\r\nimport java.util.NoSuchElementException;\r\n\r\nimport org.joda.beans.gen.PropertyDefinition;\r\nimport org.joda.beans.sample.CompanyAddress;\r\nimport org.junit.jupiter.api.Test;\r\n\r\n/**\r\n * Test property using Person.\r\n */\r\nclass TestCompanyAddress {\r\n\r\n    private static final int NUM_PROPERTIES = 5;\r\n    private static final String STREET = \"street\";\r\n    private static final String CITY = \"city\";\r\n    private static final String NUMBER = \"number\";\r\n    private static final String COMPANY_NAME = \"companyName\";\r\n\r\n    @Test\r\n    void test_bean() {\r\n        Bean test = CompanyAddress.meta().builder().build();\r\n        \r\n        assertThat(test instanceof CompanyAddress).isTrue();\r\n        \r\n        assertThat(test.metaBean()).isEqualTo(CompanyAddress.meta());\r\n        \r\n        assertThat(test.propertyNames()).contains(STREET);\r\n        assertThat(test.propertyNames()).contains(CITY);\r\n        assertThat(test.propertyNames()).contains(NUMBER);\r\n        assertThat(test.propertyNames()).contains(COMPANY_NAME);\r\n        assertThat(test.propertyNames()).doesNotContain(\"Rubbish\");\r\n        \r\n        assertThat(test.property(STREET).name()).isEqualTo(STREET);\r\n        assertThat(test.property(CITY).name()).isEqualTo(CITY);\r\n        assertThat(test.property(NUMBER).name()).isEqualTo(NUMBER);\r\n        assertThat(test.property(COMPANY_NAME).name()).isEqualTo(COMPANY_NAME);\r\n    }\r\n\r\n    @Test\r\n    void test_bean_invalidPropertyName() {\r\n        Bean test = CompanyAddress.meta().builder().build();\r\n        assertThatExceptionOfType(NoSuchElementException.class)\r\n                .isThrownBy(() -> test.property(\"Rubbish\"));\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_metaBean() {\r\n        MetaBean test = CompanyAddress.meta();\r\n        \r\n        assertThat(test.beanType()).isEqualTo(CompanyAddress.class);\r\n        \r\n        assertThat(test.beanName()).isEqualTo(CompanyAddress.class.getName());\r\n        \r\n        assertThat(test.metaPropertyCount()).isEqualTo(NUM_PROPERTIES);\r\n        \r\n        assertThat(test.metaPropertyExists(STREET)).isTrue();\r\n        assertThat(test.metaPropertyExists(CITY)).isTrue();\r\n        assertThat(test.metaPropertyExists(NUMBER)).isTrue();\r\n        assertThat(test.metaPropertyExists(\"Rubbish\")).isFalse();\r\n        \r\n        assertThat(test.metaProperty(STREET).name()).isEqualTo(STREET);\r\n        assertThat(test.metaProperty(CITY).name()).isEqualTo(CITY);\r\n        assertThat(test.metaProperty(NUMBER).name()).isEqualTo(NUMBER);\r\n        \r\n        Map<String, MetaProperty<?>> map = test.metaPropertyMap();\r\n        assertThat(map.size()).isEqualTo(NUM_PROPERTIES);\r\n        assertThat(map.containsKey(STREET)).isTrue();\r\n        assertThat(map.containsKey(CITY)).isTrue();\r\n        assertThat(map.containsKey(NUMBER)).isTrue();\r\n    }\r\n\r\n    @Test\r\n    void test_metaBean_invalidPropertyName() {\r\n        MetaBean test = CompanyAddress.meta();\r\n        assertThatExceptionOfType(NoSuchElementException.class)\r\n                .isThrownBy(() -> test.metaProperty(\"Rubbish\"));\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_namedPropertyMethod_street() {\r\n        CompanyAddress address = new CompanyAddress();\r\n        Property<String> test = address.street();\r\n        \r\n        assertThat((Object) test.bean()).isSameAs(address);\r\n        assertThat(test.metaProperty()).isSameAs(CompanyAddress.meta().street());\r\n        \r\n        assertThat(test.get()).isNull();\r\n        address.setStreet(\"A\");\r\n        assertThat(test.get()).isEqualTo(\"A\");\r\n        test.set(\"B\");\r\n        assertThat(test.get()).isEqualTo(\"B\");\r\n        assertThat(test.put(\"C\")).isEqualTo(\"B\");\r\n        assertThat(test.get()).isEqualTo(\"C\");\r\n    }\r\n\r\n    @Test\r\n    void test_namedPropertyMethod_companyName() {\r\n        CompanyAddress address = new CompanyAddress();\r\n        Property<String> test = address.companyName();\r\n        \r\n        assertThat((Object) test.bean()).isSameAs(address);\r\n        assertThat(test.metaProperty()).isSameAs(CompanyAddress.meta().companyName());\r\n        \r\n        assertThat(test.get()).isNull();\r\n        address.setCompanyName(\"A\");\r\n        assertThat(test.get()).isEqualTo(\"A\");\r\n        test.set(\"B\");\r\n        assertThat(test.get()).isEqualTo(\"B\");\r\n        assertThat(test.put(\"C\")).isEqualTo(\"B\");\r\n        assertThat(test.get()).isEqualTo(\"C\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_property_String_street() {\r\n        CompanyAddress address = new CompanyAddress();\r\n        Property<String> test = address.property(STREET);\r\n        \r\n        assertThat((Object) test.bean()).isSameAs(address);\r\n        assertThat(test.metaProperty()).isSameAs(CompanyAddress.meta().street());\r\n        \r\n        assertThat(test.get()).isNull();\r\n        address.setStreet(\"A\");\r\n        assertThat(test.get()).isEqualTo(\"A\");\r\n        test.set(\"B\");\r\n        assertThat(test.get()).isEqualTo(\"B\");\r\n        assertThat(test.put(\"C\")).isEqualTo(\"B\");\r\n        assertThat(test.get()).isEqualTo(\"C\");\r\n    }\r\n\r\n    @Test\r\n    void test_property_String_companyName() {\r\n        CompanyAddress address = new CompanyAddress();\r\n        Property<String> test = address.property(COMPANY_NAME);\r\n        \r\n        assertThat((Object) test.bean()).isSameAs(address);\r\n        assertThat(test.metaProperty()).isSameAs(CompanyAddress.meta().companyName());\r\n        \r\n        assertThat(test.get()).isNull();\r\n        address.setCompanyName(\"A\");\r\n        assertThat(test.get()).isEqualTo(\"A\");\r\n        test.set(\"B\");\r\n        assertThat(test.get()).isEqualTo(\"B\");\r\n        assertThat(test.put(\"C\")).isEqualTo(\"B\");\r\n        assertThat(test.get()).isEqualTo(\"C\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_namedMetaPropertyMethod_street() {\r\n        CompanyAddress address = new CompanyAddress();\r\n        MetaProperty<String> test = CompanyAddress.meta().street();\r\n        \r\n        assertThat(test.metaBean().beanType()).isEqualTo(CompanyAddress.class);\r\n        assertThat(test.propertyType()).isEqualTo(String.class);\r\n        assertThat(test.name()).isEqualTo(STREET);\r\n        assertThat(test.style()).isEqualTo(PropertyStyle.READ_WRITE);\r\n        \r\n        assertThat(test.get(address)).isNull();\r\n        address.setStreet(\"A\");\r\n        assertThat(test.get(address)).isEqualTo(\"A\");\r\n        test.set(address, \"B\");\r\n        assertThat(test.get(address)).isEqualTo(\"B\");\r\n        assertThat(test.put(address, \"C\")).isEqualTo(\"B\");\r\n        assertThat(test.get(address)).isEqualTo(\"C\");\r\n    }\r\n\r\n    @Test\r\n    void test_namedMetaPropertyMethod_companyName() {\r\n        CompanyAddress address = new CompanyAddress();\r\n        MetaProperty<String> test = CompanyAddress.meta().companyName();\r\n        \r\n        assertThat(test.metaBean().beanType()).isEqualTo(CompanyAddress.class);\r\n        assertThat(test.propertyType()).isEqualTo(String.class);\r\n        assertThat(test.name()).isEqualTo(COMPANY_NAME);\r\n        assertThat(test.style()).isEqualTo(PropertyStyle.READ_WRITE);\r\n        \r\n        assertThat(test.get(address)).isNull();\r\n        address.setCompanyName(\"A\");\r\n        assertThat(test.get(address)).isEqualTo(\"A\");\r\n        test.set(address, \"B\");\r\n        assertThat(test.get(address)).isEqualTo(\"B\");\r\n        assertThat(test.put(address, \"C\")).isEqualTo(\"B\");\r\n        assertThat(test.get(address)).isEqualTo(\"C\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_metaProperty_String_street() {\r\n        CompanyAddress address = new CompanyAddress();\r\n        MetaProperty<String> test = CompanyAddress.meta().metaProperty(STREET);\r\n        \r\n        assertThat(test.metaBean().beanType()).isEqualTo(CompanyAddress.class);\r\n        assertThat(test.propertyType()).isEqualTo(String.class);\r\n        assertThat(test.name()).isEqualTo(STREET);\r\n        assertThat(test.style()).isEqualTo(PropertyStyle.READ_WRITE);\r\n        \r\n        assertThat(test.get(address)).isNull();\r\n        address.setStreet(\"A\");\r\n        assertThat(test.get(address)).isEqualTo(\"A\");\r\n        test.set(address, \"B\");\r\n        assertThat(test.get(address)).isEqualTo(\"B\");\r\n        assertThat(test.put(address, \"C\")).isEqualTo(\"B\");\r\n        assertThat(test.get(address)).isEqualTo(\"C\");\r\n    }\r\n\r\n    @Test\r\n    void test_metaProperty_String_companyName() {\r\n        CompanyAddress address = new CompanyAddress();\r\n        MetaProperty<String> test = CompanyAddress.meta().metaProperty(COMPANY_NAME);\r\n        \r\n        assertThat(test.metaBean().beanType()).isEqualTo(CompanyAddress.class);\r\n        assertThat(test.propertyType()).isEqualTo(String.class);\r\n        assertThat(test.name()).isEqualTo(COMPANY_NAME);\r\n        assertThat(test.style()).isEqualTo(PropertyStyle.READ_WRITE);\r\n        \r\n        assertThat(test.get(address)).isNull();\r\n        address.setCompanyName(\"A\");\r\n        assertThat(test.get(address)).isEqualTo(\"A\");\r\n        test.set(address, \"B\");\r\n        assertThat(test.get(address)).isEqualTo(\"B\");\r\n        assertThat(test.put(address, \"C\")).isEqualTo(\"B\");\r\n        assertThat(test.get(address)).isEqualTo(\"C\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_metaProperty_types() {\r\n        MetaProperty<String> test = CompanyAddress.meta().companyName();\r\n        \r\n        assertThat(test.metaBean().beanType()).isEqualTo(CompanyAddress.class);\r\n        assertThat(test.propertyType()).isEqualTo(String.class);\r\n        assertThat(test.propertyGenericType()).isEqualTo(String.class);\r\n    }\r\n\r\n    @Test\r\n    void test_metaProperty_annotations() {\r\n        MetaProperty<String> prop = CompanyAddress.meta().companyName();\r\n        List<Annotation> test = prop.annotations();\r\n        \r\n        assertThat(test).hasSize(1);\r\n        assertThat(test.get(0)).isInstanceOf(PropertyDefinition.class);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestFinalFieldBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatExceptionOfType;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.joda.beans.impl.flexi.FlexiBean;\nimport org.joda.beans.sample.FinalFieldBean;\nimport org.joda.beans.sample.Person;\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test FinalFieldBean.\n */\nclass TestFinalFieldBean {\n\n    /** Bean. */\n    private FinalFieldBean bean;\n\n    @BeforeEach\n    void setUp() {\n        bean = new FinalFieldBean(\"Hello\");\n        bean.setFieldNonFinal(\"Hello\");\n        bean.getListFinal().add(\"Hello\");\n        bean.getFlexiFinal().append(\"Hello\", \"World\");\n        bean.getPersonFinal().setSurname(\"Hello\");\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_finalString() {\n        assertThat(bean.getFieldFinal()).isEqualTo(\"Hello\");\n        assertThat(bean.fieldFinal().get()).isEqualTo(\"Hello\");\n        assertThat(bean.fieldFinal().metaProperty().declaringType()).isEqualTo(FinalFieldBean.class);\n        assertThat(bean.fieldFinal().metaProperty().getString(bean)).isEqualTo(\"Hello\");\n        assertThat(bean.fieldFinal().metaProperty().get(bean)).isEqualTo(\"Hello\");\n        assertThat(bean.fieldFinal().metaProperty().name()).isEqualTo(\"fieldFinal\");\n        assertThat(bean.fieldFinal().metaProperty().style()).isEqualTo(PropertyStyle.READ_ONLY);\n        assertThat(bean.fieldFinal().metaProperty().propertyType()).isEqualTo(String.class);\n\n        assertThatExceptionOfType(UnsupportedOperationException.class)\n                .isThrownBy(() -> bean.fieldFinal().set(\"foo\"));\n        assertThatExceptionOfType(UnsupportedOperationException.class)\n                .isThrownBy(() -> bean.fieldFinal().metaProperty().set(bean, \"foo\"));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_nonFinalString() {\n        assertThat(bean.getFieldNonFinal()).isEqualTo(\"Hello\");\n        assertThat(bean.fieldNonFinal().get()).isEqualTo(\"Hello\");\n        assertThat(bean.fieldNonFinal().metaProperty().declaringType()).isEqualTo(FinalFieldBean.class);\n        assertThat(bean.fieldNonFinal().metaProperty().getString(bean)).isEqualTo(\"Hello\");\n        assertThat(bean.fieldNonFinal().metaProperty().get(bean)).isEqualTo(\"Hello\");\n        assertThat(bean.fieldNonFinal().metaProperty().name()).isEqualTo(\"fieldNonFinal\");\n        assertThat(bean.fieldNonFinal().metaProperty().style()).isEqualTo(PropertyStyle.READ_WRITE);\n        assertThat(bean.fieldNonFinal().metaProperty().propertyType()).isEqualTo(String.class);\n        \n        bean.fieldNonFinal().set(\"foo\");\n        assertThat(bean.getFieldNonFinal()).isEqualTo(\"foo\");\n        \n        bean.fieldNonFinal().metaProperty().set(bean, \"bar\");\n        assertThat(bean.getFieldNonFinal()).isEqualTo(\"bar\");\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_finalList() {\n        List<String> list = new ArrayList<>();\n        list.add(\"Hello\");\n        assertThat(bean.getListFinal()).isEqualTo(list);\n        assertThat(bean.listFinal().get()).isEqualTo(list);\n        assertThat(bean.listFinal().metaProperty().declaringType()).isEqualTo(FinalFieldBean.class);\n        assertThat(bean.listFinal().metaProperty().get(bean)).isEqualTo(list);\n        assertThat(bean.listFinal().metaProperty().name()).isEqualTo(\"listFinal\");\n        assertThat(bean.listFinal().metaProperty().style()).isEqualTo(PropertyStyle.READ_WRITE);\n        assertThat(bean.listFinal().metaProperty().propertyType()).isEqualTo(List.class);\n        \n        list.add(\"foo\");\n        List<String> expected1 = new ArrayList<>(list);\n        bean.listFinal().set(list);\n        assertThat(bean.getListFinal()).isEqualTo(expected1);\n        \n        list.add(\"bar\");\n        List<String> expected2 = new ArrayList<>(list);\n        bean.listFinal().metaProperty().set(bean, list);\n        assertThat(bean.getListFinal()).isEqualTo(expected2);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_finalBean() {\n        FlexiBean flexi = new FlexiBean();\n        flexi.append(\"Hello\", \"World\");\n        assertThat(bean.getFlexiFinal()).isEqualTo(flexi);\n        assertThat(bean.flexiFinal().get()).isEqualTo(flexi);\n        assertThat(bean.flexiFinal().metaProperty().declaringType()).isEqualTo(FinalFieldBean.class);\n        assertThat(bean.flexiFinal().metaProperty().get(bean)).isEqualTo(flexi);\n        assertThat(bean.flexiFinal().metaProperty().name()).isEqualTo(\"flexiFinal\");\n        assertThat(bean.flexiFinal().metaProperty().style()).isEqualTo(PropertyStyle.READ_WRITE);\n        assertThat(bean.flexiFinal().metaProperty().propertyType()).isEqualTo(FlexiBean.class);\n        \n        flexi.append(\"foo\", \"foos\");\n        FlexiBean expected1 = new FlexiBean(flexi);\n        bean.flexiFinal().set(flexi);\n        assertThat(bean.getFlexiFinal()).isEqualTo(expected1);\n        \n        flexi.append(\"bar\", \"bars\");\n        FlexiBean expected2 = new FlexiBean(flexi);\n        bean.flexiFinal().metaProperty().set(bean, flexi);\n        assertThat(bean.getFlexiFinal()).isEqualTo(expected2);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_finalPerson() {\n        Person person = new Person();\n        person.setSurname(\"Hello\");\n        assertThat(bean.getPersonFinal()).isEqualTo(person);\n        assertThat(bean.personFinal().get()).isEqualTo(person);\n        assertThat(bean.personFinal().metaProperty().declaringType()).isEqualTo(FinalFieldBean.class);\n        assertThat(bean.personFinal().metaProperty().get(bean)).isEqualTo(person);\n        assertThat(bean.personFinal().metaProperty().name()).isEqualTo(\"personFinal\");\n        assertThat(bean.personFinal().metaProperty().style()).isEqualTo(PropertyStyle.READ_ONLY);\n        assertThat(bean.personFinal().metaProperty().propertyType()).isEqualTo(Person.class);\n\n        assertThatExceptionOfType(UnsupportedOperationException.class)\n                .isThrownBy(() -> bean.personFinal().set(new Person()));\n        assertThatExceptionOfType(UnsupportedOperationException.class)\n                .isThrownBy(() -> bean.personFinal().metaProperty().set(bean, new Person()));\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestFlexiBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;\nimport static org.assertj.core.api.Assertions.offset;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.ByteArrayOutputStream;\nimport java.io.ObjectInputStream;\nimport java.io.ObjectOutputStream;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.joda.beans.impl.flexi.FlexiBean;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test {@link FlexiBean}.\n */\nclass TestFlexiBean {\n\n    @Test\n    void test_constructor() {\n        FlexiBean test = new FlexiBean();\n        assertThat(test.size()).isEqualTo(0);\n    }\n\n    @Test\n    void test_constructor_copy() {\n        FlexiBean base = new FlexiBean();\n        base.set(\"a\", \"x\");\n        base.set(\"b\", \"y\");\n        FlexiBean test = new FlexiBean(base);\n        assertThat(test).isNotSameAs(base);\n        assertThat(test).isEqualTo(base);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_serialization() throws Exception {\n        FlexiBean test = new FlexiBean();\n        test.put(\"name\", \"Etienne\");\n\n        ByteArrayOutputStream baos = new ByteArrayOutputStream();\n        try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {\n            oos.writeObject(test);\n        }\n\n        try (ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray())) {\n            try (ObjectInputStream ois = new ObjectInputStream(bais)) {\n                Object obj = ois.readObject();\n                assertThat(test).isEqualTo(obj);\n            }\n        }\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_clone() {\n        FlexiBean base = new FlexiBean();\n        base.set(\"a\", \"x\");\n        base.set(\"b\", \"y\");\n        FlexiBean test = base.clone();\n        assertThat(test).isNotSameAs(base);\n        assertThat(test).isEqualTo(base);\n    }\n\n    @Test\n    void test_equalsHashCode() {\n        FlexiBean a1 = new FlexiBean();\n        FlexiBean a2 = new FlexiBean();\n        FlexiBean b = new FlexiBean();\n\n        a1.set(\"first\", \"A\");\n        a2.set(\"first\", \"A\");\n        b.set(\"first\", \"B\");\n\n        assertThat(a1.equals(a1)).isTrue();\n        assertThat(a1.equals(a2)).isTrue();\n        assertThat(a2.equals(a1)).isTrue();\n        assertThat(a2.equals(a2)).isTrue();\n        assertThat(a1.hashCode()).isEqualTo(a2.hashCode());\n\n        assertThat(a1.equals(b)).isFalse();\n        assertThat(b.equals(a1)).isFalse();\n\n        Object obj = \"Weird type\";\n        assertThat(b.equals(obj)).isFalse();\n        assertThat(b.equals(null)).isFalse();\n    }\n\n    @Test\n    void test_toString() {\n        FlexiBean test = new FlexiBean();\n        test.set(\"a\", \"b\");\n        assertThat(test.toString()).isEqualTo(\"FlexiBean{a=b}\");\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_basics() {\n        FlexiBean test = new FlexiBean();\n        assertThat(test.size()).isEqualTo(0);\n        assertThat(test.contains(\"a\")).isFalse();\n        assertThat(test.contains(\"b\")).isFalse();\n        assertThat(test.get(\"a\")).isNull();\n        assertThat(test.get(\"b\")).isNull();\n\n        test.set(\"a\", \"x\");\n        assertThat(test.size()).isEqualTo(1);\n        assertThat(test.contains(\"a\")).isTrue();\n        assertThat(test.contains(\"b\")).isFalse();\n        assertThat(test.get(\"a\")).isEqualTo(\"x\");\n        assertThat(test.get(\"b\")).isNull();\n\n        test.set(\"b\", \"y\");\n        assertThat(test.size()).isEqualTo(2);\n        assertThat(test.contains(\"a\")).isTrue();\n        assertThat(test.contains(\"b\")).isTrue();\n        assertThat(test.get(\"a\")).isEqualTo(\"x\");\n        assertThat(test.get(\"b\")).isEqualTo(\"y\");\n\n        test.set(\"b\", \"z\");\n        assertThat(test.size()).isEqualTo(2);\n        assertThat(test.contains(\"a\")).isTrue();\n        assertThat(test.contains(\"b\")).isTrue();\n        assertThat(test.get(\"a\")).isEqualTo(\"x\");\n        assertThat(test.get(\"b\")).isEqualTo(\"z\");\n\n        test.remove(\"b\");\n        assertThat(test.size()).isEqualTo(1);\n        assertThat(test.contains(\"a\")).isTrue();\n        assertThat(test.contains(\"b\")).isFalse();\n        assertThat(test.get(\"a\")).isEqualTo(\"x\");\n        assertThat(test.get(\"b\")).isNull();\n    }\n\n    @Test\n    void test_type_string() {\n        FlexiBean test = new FlexiBean();\n        assertThat(test.size()).isEqualTo(0);\n        test.set(\"a\", \"x\");\n        assertThat(test.get(\"a\")).isEqualTo(\"x\");\n        assertThat(test.get(\"a\", String.class)).isEqualTo(\"x\");\n        assertThat(test.getString(\"a\")).isEqualTo(\"x\");\n        assertThat(test.getString(\"b\")).isNull();\n    }\n\n    @Test\n    void test_type_long() {\n        FlexiBean test = new FlexiBean();\n        assertThat(test.size()).isEqualTo(0);\n        test.set(\"a\", Long.valueOf(2));\n        assertThat(test.get(\"a\")).isEqualTo(Long.valueOf(2));\n        assertThat(test.get(\"a\", Long.class)).isEqualTo(Long.valueOf(2));\n        assertThat(test.getLong(\"a\")).isEqualTo(2L);\n        assertThat(test.getLong(\"a\", 1L)).isEqualTo(2);\n        assertThat(test.getLong(\"b\", 1L)).isEqualTo(1);\n    }\n\n    @Test\n    void test_type_int() {\n        FlexiBean test = new FlexiBean();\n        assertThat(test.size()).isEqualTo(0);\n        test.set(\"a\", Integer.valueOf(2));\n        assertThat(test.get(\"a\")).isEqualTo(Integer.valueOf(2));\n        assertThat(test.get(\"a\", Integer.class)).isEqualTo(Integer.valueOf(2));\n        assertThat(test.getInt(\"a\")).isEqualTo(2);\n        assertThat(test.getInt(\"a\", 1)).isEqualTo(2);\n        assertThat(test.getInt(\"b\", 1)).isEqualTo(1);\n    }\n\n    @Test\n    void test_type_double() {\n        FlexiBean test = new FlexiBean();\n        assertThat(test.size()).isEqualTo(0);\n        test.set(\"a\", Double.valueOf(1.2d));\n        assertThat(test.get(\"a\")).isEqualTo(Double.valueOf(1.2d));\n        assertThat(test.get(\"a\", Double.class)).isEqualTo(Double.valueOf(1.2d));\n        assertThat(test.getDouble(\"a\")).isEqualTo(1.2d);\n        assertThat(test.getDouble(\"a\", 0.5d)).isEqualTo(1.2d);\n        assertThat(test.getDouble(\"b\", 0.5d)).isEqualTo(0.5d, offset(0.0001d));\n    }\n\n    @Test\n    void test_type_boolean() {\n        FlexiBean test = new FlexiBean();\n        assertThat(test.size()).isEqualTo(0);\n        test.set(\"a\", Boolean.TRUE);\n        assertThat(test.get(\"a\")).isEqualTo(Boolean.TRUE);\n        assertThat(test.get(\"a\", Boolean.class)).isEqualTo(Boolean.TRUE);\n        assertThat(test.getBoolean(\"a\")).isTrue();\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_propertyDefine_propertyRemove() {\n        FlexiBean flexi = new FlexiBean();\n        assertThat(flexi.propertyNames().size()).isEqualTo(0);\n        flexi.propertyDefine(\"name\", String.class);\n        assertThat(flexi.propertyNames().size()).isEqualTo(1);\n        Property<Object> prop = flexi.property(\"name\");\n        assertThat(prop.name()).isEqualTo(\"name\");\n        assertThat(prop.get()).isNull();\n        flexi.propertyRemove(\"name\");\n        assertThat(flexi.propertyNames().size()).isEqualTo(0);\n    }\n\n    @Test\n    void test_metaBean() {\n        FlexiBean flexi = new FlexiBean();\n        DynamicMetaBean meta = flexi.metaBean();\n        assertThat(meta.metaPropertyCount()).isEqualTo(0);\n\n        meta.metaPropertyDefine(\"name\", String.class);\n        assertThat(meta.metaPropertyCount()).isEqualTo(1);\n        MetaProperty<Object> prop = meta.metaProperty(\"name\");\n        assertThat(prop.name()).isEqualTo(\"name\");\n        assertThat(prop.get(flexi)).isNull();\n\n        meta.metaPropertyDefine(\"name\", String.class);\n        assertThat(meta.metaPropertyCount()).isEqualTo(1);\n\n        MetaProperty<Object> prop2 = meta.metaProperty(\"address\");\n        assertThat(prop2).isNotNull();\n        assertThat(meta.metaPropertyCount()).isEqualTo(1); // meta-property object created but data not changed\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_putAll() {\n        FlexiBean test = new FlexiBean();\n        assertThat(test.size()).isEqualTo(0);\n        Map<String, Object> map = new HashMap<>();\n        test.putAll(map);\n        assertThat(test.size()).isEqualTo(0);\n        map.put(\"a\", \"x\");\n        map.put(\"b\", \"y\");\n        test.putAll(map);\n        assertThat(test.size()).isEqualTo(2);\n        assertThat(test.contains(\"a\")).isTrue();\n        assertThat(test.contains(\"b\")).isTrue();\n        map.clear();\n        map.put(\"c\", \"z\");\n        test.putAll(map);\n        assertThat(test.size()).isEqualTo(3);\n        assertThat(test.contains(\"a\")).isTrue();\n        assertThat(test.contains(\"b\")).isTrue();\n        assertThat(test.contains(\"c\")).isTrue();\n    }\n\n    @Test\n    void test_remove() {\n        FlexiBean test = new FlexiBean();\n        assertThat(test.size()).isEqualTo(0);\n        test.remove(\"a\");\n        assertThat(test.size()).isEqualTo(0);\n        test.put(\"a\", \"x\");\n        test.remove(\"a\");\n        assertThat(test.size()).isEqualTo(0);\n    }\n\n    @Test\n    void test_toMap() {\n        FlexiBean base = new FlexiBean();\n        Map<String, Object> test = base.toMap();\n        assertThat(test.size()).isEqualTo(0);\n        base.put(\"a\", \"x\");\n        base.put(\"b\", \"y\");\n        test = base.toMap();\n        assertThat(test.size()).isEqualTo(2);\n        assertThat(test.containsKey(\"a\")).isTrue();\n        assertThat(test.containsKey(\"b\")).isTrue();\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_invalidProperty() {\n        FlexiBean flexi = new FlexiBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> flexi.propertyDefine(\"bad-name\", String.class));\n    }\n\n    @Test\n    void test_append_invalidProperty() {\n        FlexiBean flexi = new FlexiBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> flexi.append(\"bad-name\", \"a\"));\n    }\n\n    @Test\n    void test_set_invalidProperty() {\n        FlexiBean flexi = new FlexiBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> flexi.set(\"bad-name\", \"a\"));\n    }\n\n    @Test\n    void test_put_invalidProperty() {\n        FlexiBean flexi = new FlexiBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> flexi.put(\"bad-name\", \"a\"));\n    }\n\n    @Test\n    void test_putAll_invalidKey() {\n        FlexiBean test = new FlexiBean();\n        Map<String, Object> map = new HashMap<>();\n        map.put(\"1\", \"x\");\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> test.putAll(map));\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestImmutable.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatExceptionOfType;\n\nimport java.util.Calendar;\nimport java.util.GregorianCalendar;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.sample.ImmAddress;\nimport org.joda.beans.sample.ImmAddress.Builder;\nimport org.joda.beans.sample.ImmGuava;\nimport org.joda.beans.sample.ImmPerson;\nimport org.joda.beans.sample.ImmPersonNonFinal;\nimport org.joda.beans.sample.ImmSubPersonNonFinal;\nimport org.joda.beans.sample.ImmSubSubPersonFinal;\nimport org.joda.beans.sample.SimpleAnnotation;\nimport org.junit.jupiter.api.Test;\n\nimport com.google.common.collect.ImmutableList;\nimport com.google.common.collect.ImmutableMultiset;\n\n/**\n * Test property using Person.\n */\nclass TestImmutable {\n\n    @Test\n    void test_bean() {\n        ImmAddress address = ImmAddress.builder()\n                .number(12)\n                .street(\"Park Lane\")\n                .city(\"Smallville\")\n                .owner(ImmPerson.builder().forename(\"John\").surname(\"Doggett\").build())\n                .build();\n        \n        assertThat(address.getCity()).isEqualTo(\"Smallville\");\n        assertThat(address.getStreet()).isEqualTo(\"Park Lane\");\n    }\n\n    @Test\n    void test_builder() {\n        Builder builder = ImmAddress.builder()\n                .set(\"number\", 12)\n                .set(\"street\", \"Park Lane\");\n        assertThat(builder.get(\"number\")).isEqualTo(12);\n        assertThat(builder.get(\"street\")).isEqualTo(\"Park Lane\");\n        assertThat(builder.get(\"city\")).isNull();\n        builder.set(\"city\", \"Smallville\")\n                .set(\"owner\", ImmPerson.builder().forename(\"John\").surname(\"Doggett\").build());\n        assertThat(builder.get(\"number\")).isEqualTo(12);\n        assertThat(builder.get(\"street\")).isEqualTo(\"Park Lane\");\n        assertThat(builder.get(\"city\")).isEqualTo(\"Smallville\");\n        ImmAddress address = builder.build();\n        \n        assertThat(address.getCity()).isEqualTo(\"Smallville\");\n        assertThat(address.getStreet()).isEqualTo(\"Park Lane\");\n    }\n\n    @Test\n    void test_with() {\n        ImmAddress address = ImmAddress.builder()\n                .set(\"number\", 12)\n                .set(\"street\", \"Park Lane\")\n                .set(\"city\", \"Smallville\")\n                .set(\"owner\", ImmPerson.builder().forename(\"John\").surname(\"Doggett\").build())\n                .build();\n        \n        address = address.toBuilder().street(\"Park Road\").build();\n        \n        assertThat(address.getCity()).isEqualTo(\"Smallville\");\n        assertThat(address.getStreet()).isEqualTo(\"Park Road\");\n    }\n\n    @Test\n    void test_annotations() {\n        ImmPerson person = ImmPerson.builder().forename(\"John\").surname(\"Doggett\").build();\n\n        assertThat(person.metaBean().numberOfCars().annotationOpt(SimpleAnnotation.class))\n                .isPresent()\n                .hasValueSatisfying(anno -> {\n                    assertThat(anno.second()).isEqualTo(\"2\");\n                });\n        assertThat(person.metaBean().age()\n                .annotationOpt(SimpleAnnotation.class))\n                .isPresent()\n                .hasValueSatisfying(anno -> {\n                    assertThat(anno.first()).isEqualTo(\"1\");\n                });\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_builder_getInvalidPropertyName() {\n        BeanBuilder<ImmAddress> builder = ImmAddress.meta().builder();\n        assertThatExceptionOfType(NoSuchElementException.class)\n                .isThrownBy(() -> builder.get(\"Rubbish\"));\n    }\n\n    @Test\n    void test_builder_setInvalidPropertyName() {\n        BeanBuilder<ImmAddress> builder = ImmAddress.meta().builder();\n        assertThatExceptionOfType(NoSuchElementException.class)\n                .isThrownBy(() -> builder.set(\"Rubbish\", \"\"));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_builder_subclass() {\n        ImmSubSubPersonFinal.Builder builder = ImmSubSubPersonFinal.meta().builder();\n        builder.set(ImmPersonNonFinal.meta().forename(), \"Bobby\");\n        builder.set(ImmSubPersonNonFinal.meta().middleName(), \"Joe\");\n        builder.set(ImmSubSubPersonFinal.meta().codeCounts(), ImmutableMultiset.of());\n        assertThat(builder.get(\"forename\")).isEqualTo(\"Bobby\");\n        assertThat(builder.get(\"middleName\")).isEqualTo(\"Joe\");\n        assertThat(builder.get(\"codeCounts\")).isEqualTo(ImmutableMultiset.of());\n        assertThat(builder.get(ImmPersonNonFinal.meta().forename())).isEqualTo(\"Bobby\");\n        assertThat(builder.get(ImmSubPersonNonFinal.meta().middleName())).isEqualTo(\"Joe\");\n        assertThat(builder.get(ImmSubSubPersonFinal.meta().codeCounts())).isEqualTo(ImmutableMultiset.of());\n        ImmSubSubPersonFinal result = builder.build();\n        \n        assertThat(result.getForename()).isEqualTo(\"Bobby\");\n        assertThat(result.getMiddleName()).isEqualTo(\"Joe\");\n        assertThat(result.getCodeCounts()).isEmpty();\n    }\n\n    @Test\n    void test_builder_subclass_getInvalidPropertyName() {\n        ImmSubSubPersonFinal.Builder builder = ImmSubSubPersonFinal.meta().builder();\n        assertThatExceptionOfType(NoSuchElementException.class)\n                .isThrownBy(() -> builder.get(\"Rubbish\"));\n    }\n\n    @Test\n    void test_builder_subclass_setInvalidPropertyName() {\n        ImmSubSubPersonFinal.Builder builder = ImmSubSubPersonFinal.meta().builder();\n        assertThatExceptionOfType(NoSuchElementException.class)\n                .isThrownBy(() -> builder.set(\"Rubbish\", \"\"));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_builder_defaultValue() {\n        ImmPerson person = ImmPerson.builder()\n            .forename(\"A\")\n            .surname(\"B\")\n            .build();\n        assertThat(person.getForename()).isEqualTo(\"A\");\n        assertThat(person.getSurname()).isEqualTo(\"B\");\n        assertThat(person.getNumberOfCars()).isEqualTo(1);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_builder_methodTypes() {\n        Calendar cal = Calendar.getInstance();\n        GregorianCalendar gcal = new GregorianCalendar(2015, 5, 30);\n        ImmutableList<Calendar> listCal = ImmutableList.of(cal);\n        ImmutableList<GregorianCalendar> listGcal = ImmutableList.of(gcal);\n        ImmutableList<Number> listNumbers = ImmutableList.<Number>of(2d, 5, 3f);\n        ImmutableList<Integer> listInts = ImmutableList.<Integer>of(1, 2, 3);\n        ImmGuava<Calendar> obj = ImmGuava.<Calendar>builder()\n            .list(cal, gcal)\n            .list(listCal)\n            .listWildExtendsT(listCal)\n            .listWildExtendsT(listGcal)\n            .listWildExtendsNumber(2d, 5, 3f)\n            .listWildExtendsNumber(listNumbers)\n            .listWildExtendsNumber(listInts)\n            .listWildExtendsComparable(2d, 5, 3f)\n            .listWildExtendsComparable(listInts)\n            .build();\n        assertThat(obj.getList()).isEqualTo(listCal);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestJodaBeanUtils.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;\nimport static org.assertj.core.api.Assertions.assertThatNullPointerException;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.function.Function;\n\nimport org.joda.beans.impl.flexi.FlexiBean;\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.ImmAddress;\nimport org.joda.beans.sample.ImmGuava;\nimport org.joda.beans.sample.ImmPerson;\nimport org.joda.beans.sample.Pair;\nimport org.joda.beans.sample.Person;\nimport org.junit.jupiter.api.Test;\n\nimport com.google.common.collect.ImmutableList;\nimport com.google.common.collect.ImmutableMap;\nimport com.google.common.collect.ImmutableMultiset;\n\n/**\n * Test {@link JodaBeanUtils}.\n */\nclass TestJodaBeanUtils {\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_notNull_ok() {\n        JodaBeanUtils.notNull(\"\", \"name\");\n    }\n\n    @Test\n    void test_notNull_notOk() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanUtils.notNull(null, \"name\"));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_notBlank_String_ok() {\n        JodaBeanUtils.notBlank(\"Blah\", \"name\");\n    }\n\n    @Test\n    void test_notBlank_String_notOk_empty() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanUtils.notBlank(\"\", \"name\"));\n    }\n\n    @Test\n    void test_notBlank_String_notOk_allWhitespace() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanUtils.notBlank(\" \", \"name\"));\n    }\n\n    @Test\n    void test_notBlank_String_notOk_null() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanUtils.notBlank((String) null, \"name\"));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_notEmpty_String_ok() {\n        JodaBeanUtils.notEmpty(\"Blah\", \"name\");\n    }\n\n    @Test\n    void test_notEmpty_String_notOk_empty() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanUtils.notBlank(\"\", \"name\"));\n    }\n\n    @Test\n    void test_notEmpty_String_notOk_null() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanUtils.notEmpty((String) null, \"name\"));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_notEmpty_Collection_ok() {\n        JodaBeanUtils.notEmpty(Arrays.asList(\"Blah\"), \"name\");\n    }\n\n    @Test\n    void test_notEmpty_Collection_notOk_empty() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanUtils.notEmpty(new ArrayList<String>(), \"name\"));\n    }\n\n    @Test\n    void test_notEmpty_Collection_notOk_null() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanUtils.notEmpty((Collection<?>) null, \"name\"));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_notEmpty_Map_ok() {\n        Map<String, String> map = new HashMap<>();\n        map.put(\"A\", \"B\");\n        JodaBeanUtils.notEmpty(map, \"name\");\n    }\n\n    @Test\n    void test_notEmpty_Map_notOk_empty() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanUtils.notEmpty(new HashMap<String, String>(), \"name\"));\n    }\n\n    @Test\n    void test_notEmpty_Map_notOk_null() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanUtils.notEmpty((Map<?, ?>) null, \"name\"));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_propertiesEqual_propertiesHashCode() {\n        Pair a = new Pair();\n        a.setFirst(\"A\");\n        \n        FlexiBean b = new FlexiBean();\n        b.set(\"first\", \"A\");\n        assertThat(JodaBeanUtils.propertiesEqual(a, b)).isFalse();\n        assertThat(JodaBeanUtils.propertiesEqual(b, a)).isFalse();\n        \n        b.set(\"second\", null);\n        assertThat(JodaBeanUtils.propertiesEqual(a, b)).isTrue();\n        assertThat(JodaBeanUtils.propertiesEqual(b, a)).isTrue();\n        assertThat(JodaBeanUtils.propertiesHashCode(a)).isEqualTo(JodaBeanUtils.propertiesHashCode(b));\n        \n        b.set(\"second\", \"B\");\n        assertThat(JodaBeanUtils.propertiesEqual(a, b)).isFalse();\n        assertThat(JodaBeanUtils.propertiesEqual(b, a)).isFalse();\n        \n        a.setSecond(\"B\");\n        assertThat(JodaBeanUtils.propertiesEqual(a, b)).isTrue();\n        assertThat(JodaBeanUtils.propertiesEqual(b, a)).isTrue();\n        assertThat(JodaBeanUtils.propertiesHashCode(a)).isEqualTo(JodaBeanUtils.propertiesHashCode(b));\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_equal() {\n        assertThat(JodaBeanUtils.equal(\"A\", \"AA\".substring(0, 1))).isTrue();\n        assertThat(JodaBeanUtils.equal(\"A\", \"B\")).isFalse();\n        assertThat(JodaBeanUtils.equal(\"A\", null)).isFalse();\n        assertThat(JodaBeanUtils.equal(null, \"A\")).isFalse();\n    }\n\n    @Test\n    void test_equal_ObjectArray() {\n        Object[] a1 = new Object[] {1, 2, 3};\n        Object[] a2 = new Object[] {1, 2, 3};\n        Object[] b = new Object[] {1, 2, 4};\n        assertThat(JodaBeanUtils.equal(a1, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, a2)).isTrue();\n        assertThat(JodaBeanUtils.equal(a2, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, b)).isFalse();\n        assertThat(JodaBeanUtils.equal(b, a1)).isFalse();\n    }\n\n    @Test\n    void test_equal_IntegerArray() {\n        Object[] a1 = new Integer[] {1, 2, 3};\n        Object[] a2 = new Integer[] {1, 2, 3};\n        Object[] b = new Integer[] {1, 2, 4};\n        assertThat(JodaBeanUtils.equal(a1, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, a2)).isTrue();\n        assertThat(JodaBeanUtils.equal(a2, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, b)).isFalse();\n        assertThat(JodaBeanUtils.equal(b, a1)).isFalse();\n    }\n\n    @Test\n    void test_equal_IntegerNumberArray() {\n        Object[] a = new Integer[] {1, 2, 3};\n        Object[] b = new Number[] {1, 2, 3};\n        assertThat(JodaBeanUtils.equal(a, b)).isFalse();\n        assertThat(JodaBeanUtils.equal(b, a)).isFalse();\n    }\n\n    @Test\n    void test_equal_IntegerIntArray() {\n        Object[] a = new Integer[] {1, 2, 3};\n        int[] b = new int[] {1, 2, 3};\n        assertThat(JodaBeanUtils.equal(a, b)).isFalse();\n        assertThat(JodaBeanUtils.equal(b, a)).isFalse();\n    }\n\n    @Test\n    void test_equal_IntArray() {\n        int[] a1 = new int[] {1, 2, 3};\n        int[] a2 = new int[] {1, 2, 3};\n        int[] b = new int[] {1, 2, 4};\n        assertThat(JodaBeanUtils.equal(a1, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, a2)).isTrue();\n        assertThat(JodaBeanUtils.equal(a2, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, b)).isFalse();\n        assertThat(JodaBeanUtils.equal(b, a1)).isFalse();\n    }\n\n    @Test\n    void test_equal_MixedArrays() {\n        byte[] b = new byte[] {1, 2, 3};\n        short[] s = new short[] {1, 2, 3};\n        int[] i = new int[] {1, 2, 3};\n        long[] l = new long[] {1, 2, 4};\n        boolean[] bl = new boolean[] {true, false, true};\n        char[] c = new char[] {'1', '2', '3'};\n        float[] f = new float[] {1f, 2f, 3f};\n        double[] d = new double[] {1d, 2d, 3d};\n        assertThat(JodaBeanUtils.equal(b, i)).isFalse();\n        assertThat(JodaBeanUtils.equal(s, i)).isFalse();\n        assertThat(JodaBeanUtils.equal(i, l)).isFalse();\n        assertThat(JodaBeanUtils.equal(l, i)).isFalse();\n        assertThat(JodaBeanUtils.equal(bl, i)).isFalse();\n        assertThat(JodaBeanUtils.equal(c, i)).isFalse();\n        assertThat(JodaBeanUtils.equal(f, i)).isFalse();\n        assertThat(JodaBeanUtils.equal(d, i)).isFalse();\n    }\n\n    @Test\n    void test_equal_LongArray() {\n        long[] a1 = new long[] {1, 2, 3};\n        long[] a2 = new long[] {1, 2, 3};\n        long[] b = new long[] {1, 2, 4};\n        assertThat(JodaBeanUtils.equal(a1, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, a2)).isTrue();\n        assertThat(JodaBeanUtils.equal(a2, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, b)).isFalse();\n        assertThat(JodaBeanUtils.equal(b, a1)).isFalse();\n    }\n\n    @Test\n    void test_equal_DoubleArray() {\n        double[] a1 = new double[] {1, 2, 3};\n        double[] a2 = new double[] {1, 2, 3};\n        double[] b = new double[] {1, 2, 4};\n        assertThat(JodaBeanUtils.equal(a1, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, a2)).isTrue();\n        assertThat(JodaBeanUtils.equal(a2, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, b)).isFalse();\n        assertThat(JodaBeanUtils.equal(b, a1)).isFalse();\n    }\n\n    @Test\n    void test_equal_FloatArray() {\n        float[] a1 = new float[] {1, 2, 3};\n        float[] a2 = new float[] {1, 2, 3};\n        float[] b = new float[] {1, 2, 4};\n        assertThat(JodaBeanUtils.equal(a1, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, a2)).isTrue();\n        assertThat(JodaBeanUtils.equal(a2, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, b)).isFalse();\n        assertThat(JodaBeanUtils.equal(b, a1)).isFalse();\n    }\n\n    @Test\n    void test_equal_ShortArray() {\n        short[] a1 = new short[] {1, 2, 3};\n        short[] a2 = new short[] {1, 2, 3};\n        short[] b = new short[] {1, 2, 4};\n        assertThat(JodaBeanUtils.equal(a1, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, a2)).isTrue();\n        assertThat(JodaBeanUtils.equal(a2, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, b)).isFalse();\n        assertThat(JodaBeanUtils.equal(b, a1)).isFalse();\n    }\n\n    @Test\n    void test_equal_CharArray() {\n        char[] a1 = new char[] {1, 2, 3};\n        char[] a2 = new char[] {1, 2, 3};\n        char[] b = new char[] {1, 2, 4};\n        assertThat(JodaBeanUtils.equal(a1, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, a2)).isTrue();\n        assertThat(JodaBeanUtils.equal(a2, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, b)).isFalse();\n        assertThat(JodaBeanUtils.equal(b, a1)).isFalse();\n    }\n\n    @Test\n    void test_equal_ByteArray() {\n        byte[] a1 = new byte[] {1, 2, 3};\n        byte[] a2 = new byte[] {1, 2, 3};\n        byte[] b = new byte[] {1, 2, 4};\n        assertThat(JodaBeanUtils.equal(a1, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, a2)).isTrue();\n        assertThat(JodaBeanUtils.equal(a2, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, b)).isFalse();\n        assertThat(JodaBeanUtils.equal(b, a1)).isFalse();\n    }\n\n    @Test\n    void test_equal_BooleanArray() {\n        boolean[] a1 = new boolean[] {true, false};\n        boolean[] a2 = new boolean[] {true, false};\n        boolean[] b = new boolean[] {true, true};\n        assertThat(JodaBeanUtils.equal(a1, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, a2)).isTrue();\n        assertThat(JodaBeanUtils.equal(a2, a1)).isTrue();\n        assertThat(JodaBeanUtils.equal(a1, b)).isFalse();\n        assertThat(JodaBeanUtils.equal(b, a1)).isFalse();\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_equal_floats() {\n        assertThat(JodaBeanUtils.equal(1.01f, 1.01f)).isTrue();\n        assertThat(JodaBeanUtils.equal(1.0f, 1.2f)).isFalse();\n    }\n\n    @Test\n    void test_equalWithTolerance_floats_zeroTolerance() {\n        double tolerance = 0d;\n        assertThat(JodaBeanUtils.equalWithTolerance(1.01f, 1.01f, tolerance)).isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(1f, 1.2f, tolerance)).isFalse();\n\n        assertThat(JodaBeanUtils.equalWithTolerance(Float.NaN, Float.NaN, tolerance)).isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(Float.NaN, 1f, tolerance)).isFalse();\n        assertThat(JodaBeanUtils.equalWithTolerance(1f, Float.NaN, tolerance)).isFalse();\n\n        assertThat(JodaBeanUtils.equalWithTolerance(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, tolerance))\n                .isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(Float.POSITIVE_INFINITY, Float.MAX_VALUE, tolerance))\n                .isFalse();\n        assertThat(JodaBeanUtils.equalWithTolerance(Float.MAX_VALUE, Float.POSITIVE_INFINITY, tolerance))\n                .isFalse();\n\n        assertThat(JodaBeanUtils.equalWithTolerance(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY, tolerance))\n                .isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(Float.NEGATIVE_INFINITY, -Float.MAX_VALUE, tolerance))\n                .isFalse();\n        assertThat(JodaBeanUtils.equalWithTolerance(-Float.MAX_VALUE, Float.NEGATIVE_INFINITY, tolerance))\n                .isFalse();\n    }\n\n    @Test\n    void test_equalWithTolerance_floats_someTolerance() {\n        double tolerance = 0.125d;\n        assertThat(JodaBeanUtils.equalWithTolerance(1f, 1.250001f, tolerance)).isFalse();\n        assertThat(JodaBeanUtils.equalWithTolerance(1f, 1.125f, tolerance)).isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(1f, 1.124999f, tolerance)).isTrue();\n\n        assertThat(JodaBeanUtils.equalWithTolerance(1f, 0.875001f, tolerance)).isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(1f, 0.875f, tolerance)).isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(1f, 0.874999f, tolerance)).isFalse();\n\n        assertThat(JodaBeanUtils.equalWithTolerance(Float.NaN, Float.NaN, tolerance)).isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(Float.NaN, 1f, tolerance)).isFalse();\n        assertThat(JodaBeanUtils.equalWithTolerance(1f, Float.NaN, tolerance)).isFalse();\n\n        assertThat(JodaBeanUtils.equalWithTolerance(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, tolerance))\n                .isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(Float.POSITIVE_INFINITY, Float.MAX_VALUE, tolerance))\n                .isFalse();\n        assertThat(JodaBeanUtils.equalWithTolerance(Float.MAX_VALUE, Float.POSITIVE_INFINITY, tolerance))\n                .isFalse();\n\n        assertThat(JodaBeanUtils.equalWithTolerance(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY, 0d))\n                .isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(Float.NEGATIVE_INFINITY, -Float.MAX_VALUE, tolerance))\n                .isFalse();\n        assertThat(JodaBeanUtils.equalWithTolerance(-Float.MAX_VALUE, Float.NEGATIVE_INFINITY, tolerance))\n                .isFalse();\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_equal_doubles() {\n        assertThat(JodaBeanUtils.equal(1.01d, 1.01d)).isTrue();\n        assertThat(JodaBeanUtils.equal(1.0d, 1.2d)).isFalse();\n\n        assertThat(JodaBeanUtils.equal(Double.NaN, Double.NaN)).isTrue();\n        assertThat(JodaBeanUtils.equal(Double.NaN, 1d)).isFalse();\n        assertThat(JodaBeanUtils.equal(1d, Double.NaN)).isFalse();\n\n        assertThat(JodaBeanUtils.equal(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY)).isTrue();\n        assertThat(JodaBeanUtils.equal(Double.POSITIVE_INFINITY, Double.MAX_VALUE)).isFalse();\n        assertThat(JodaBeanUtils.equal(Double.MAX_VALUE, Double.POSITIVE_INFINITY)).isFalse();\n\n        assertThat(JodaBeanUtils.equal(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY)).isTrue();\n        assertThat(JodaBeanUtils.equal(Double.NEGATIVE_INFINITY, -Double.MAX_VALUE)).isFalse();\n        assertThat(JodaBeanUtils.equal(-Double.MAX_VALUE, Double.NEGATIVE_INFINITY)).isFalse();\n    }\n\n    @Test\n    void test_equalWithTolerance_doubles_zeroTolerance() {\n        double tolerance = 0d;\n        assertThat(JodaBeanUtils.equalWithTolerance(1.01d, 1.01d, tolerance)).isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(1d, 1.2d, tolerance)).isFalse();\n\n        assertThat(JodaBeanUtils.equalWithTolerance(Double.NaN, Double.NaN, tolerance)).isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(Double.NaN, 1d, tolerance)).isFalse();\n        assertThat(JodaBeanUtils.equalWithTolerance(1d, Double.NaN, tolerance)).isFalse();\n\n        assertThat(JodaBeanUtils.equalWithTolerance(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, tolerance))\n                .isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(Double.POSITIVE_INFINITY, Double.MAX_VALUE, tolerance))\n                .isFalse();\n        assertThat(JodaBeanUtils.equalWithTolerance(Double.MAX_VALUE, Double.POSITIVE_INFINITY, tolerance))\n                .isFalse();\n\n        assertThat(JodaBeanUtils.equalWithTolerance(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, tolerance))\n                .isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(Double.NEGATIVE_INFINITY, -Double.MAX_VALUE, tolerance))\n                .isFalse();\n        assertThat(JodaBeanUtils.equalWithTolerance(-Double.MAX_VALUE, Double.NEGATIVE_INFINITY, tolerance))\n                .isFalse();\n    }\n\n    @Test\n    void test_equalWithTolerance_doubles_someTolerance() {\n        double tolerance = 0.125d;\n        assertThat(JodaBeanUtils.equalWithTolerance(1d, 1.250001d, tolerance)).isFalse();\n        assertThat(JodaBeanUtils.equalWithTolerance(1d, 1.125d, tolerance)).isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(1d, 1.124999d, tolerance)).isTrue();\n\n        assertThat(JodaBeanUtils.equalWithTolerance(1d, 0.875001d, tolerance)).isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(1d, 0.875d, tolerance)).isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(1d, 0.874999d, tolerance)).isFalse();\n\n        assertThat(JodaBeanUtils.equalWithTolerance(Double.NaN, Double.NaN, tolerance)).isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(Double.NaN, 1d, tolerance)).isFalse();\n        assertThat(JodaBeanUtils.equalWithTolerance(1d, Double.NaN, tolerance)).isFalse();\n\n        assertThat(JodaBeanUtils.equalWithTolerance(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, tolerance))\n                .isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(Double.POSITIVE_INFINITY, Double.MAX_VALUE, tolerance))\n                .isFalse();\n        assertThat(JodaBeanUtils.equalWithTolerance(Double.MAX_VALUE, Double.POSITIVE_INFINITY, tolerance))\n                .isFalse();\n\n        assertThat(JodaBeanUtils.equalWithTolerance(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, 0d))\n                .isTrue();\n        assertThat(JodaBeanUtils.equalWithTolerance(Double.NEGATIVE_INFINITY, -Double.MAX_VALUE, tolerance))\n                .isFalse();\n        assertThat(JodaBeanUtils.equalWithTolerance(-Double.MAX_VALUE, Double.NEGATIVE_INFINITY, tolerance))\n                .isFalse();\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_hashCode_Object() {\n        assertThat(JodaBeanUtils.hashCode(\"A\")).isEqualTo(\"A\".hashCode());\n        assertThat(JodaBeanUtils.hashCode(null)).isEqualTo(0);\n        assertThat(JodaBeanUtils.hashCode(new byte[] { 1 })).isEqualTo(Arrays.hashCode(new byte[] { 1 }));\n        assertThat(JodaBeanUtils.hashCode(new short[] { 1 })).isEqualTo(Arrays.hashCode(new short[] { 1 }));\n        assertThat(JodaBeanUtils.hashCode(new int[] { 1 })).isEqualTo(Arrays.hashCode(new int[] { 1 }));\n        assertThat(JodaBeanUtils.hashCode(new long[] { 1 })).isEqualTo(Arrays.hashCode(new long[] { 1 }));\n        assertThat(JodaBeanUtils.hashCode(new boolean[] { true })).isEqualTo(Arrays.hashCode(new boolean[] { true }));\n        assertThat(JodaBeanUtils.hashCode(new char[] { '1' })).isEqualTo(Arrays.hashCode(new char[] { '1' }));\n        assertThat(JodaBeanUtils.hashCode(new float[] { 1f })).isEqualTo(Arrays.hashCode(new float[] { 1f }));\n        assertThat(JodaBeanUtils.hashCode(new double[] { 1d })).isEqualTo(Arrays.hashCode(new double[] { 1d }));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_copy() {\n        Person p = new Person();\n        p.setForename(\"Stephen\");\n        p.setSurname(\"Colebourne\");\n        p.setExtensions(new FlexiBean());\n        p.getExtensions().set(\"Foo\", \"bar\");\n        ImmPerson copied = JodaBeanUtils.copy(p, ImmPerson.class).build();\n        assertThat(copied).isNotSameAs(p);\n        assertThat(copied.getForename()).isEqualTo(p.getForename());\n        assertThat(copied.getSurname()).isEqualTo(p.getSurname());\n    }\n\n    @Test\n    void test_copyInto() {\n        Person p = new Person();\n        p.setForename(\"Stephen\");\n        p.setExtensions(new FlexiBean());\n        p.getExtensions().set(\"Foo\", \"bar\");\n        ImmPerson copied = JodaBeanUtils.copyInto(p, ImmPerson.meta(), ImmPerson.builder()).build();\n        assertThat(copied).isNotSameAs(p);\n        assertThat(copied.getForename()).isEqualTo(p.getForename());\n        assertThat(copied.getSurname()).isNull();\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_cloneArray_primitive1d() {\n        int[] array = {1, 2, 3};\n        int[] cloned = (int[]) JodaBeanUtils.cloneArray(array);\n        assertThat(cloned)\n                .isNotSameAs(array)\n                .isEqualTo(array);\n        array[0] = 99;\n        assertThat(cloned).isNotEqualTo(array);\n    }\n\n    @Test\n    void test_cloneArray_primitive2d() {\n        int[][] array = {{1, 2, 3}, {4}, {}};\n        int[][] cloned = (int[][]) JodaBeanUtils.cloneArray(array);\n        assertThat(cloned)\n                .isNotSameAs(array)\n                .isEqualTo(array);\n        array[2] = new int[] {99};\n        assertThat(cloned).isNotEqualTo(array);\n    }\n\n    @Test\n    void test_cloneArray_string2d() {\n        String[][] array = {{\"1\", \"2\", \"3\"}, {\"4\"}, {}};\n        String[][] cloned = (String[][]) JodaBeanUtils.cloneArray(array);\n        assertThat(cloned)\n                .isNotSameAs(array)\n                .isEqualTo(array);\n        array[2] = new String[] {\"99\"};\n        assertThat(cloned).isNotEqualTo(array);\n    }\n\n    @Test\n    void test_clone() {\n        Person p = new Person();\n        p.setForename(\"Stephen\");\n        p.setSurname(\"Colebourne\");\n        p.getOtherAddressMap().put(\"A\", new Address());\n        p.getOtherAddressMap().get(\"A\").setCity(\"London\");\n        Person cloned = JodaBeanUtils.clone(p);\n        assertThat(cloned).isNotSameAs(p);\n        assertThat(cloned).isEqualTo(p);\n        p.getOtherAddressMap().put(\"B\", new Address());\n        assertThat(cloned).isNotEqualTo(p);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_listType_Person_addressList() {\n        MetaProperty<List<Address>> test = Person.meta().addressList();\n        \n        assertThat(JodaBeanUtils.collectionType(test, Person.class)).isEqualTo(Address.class);\n    }\n\n    @Test\n    void test_listType_Person_addressesList() {\n        MetaProperty<List<List<Address>>> test = Person.meta().addressesList();\n        \n        assertThat(JodaBeanUtils.collectionType(test, Person.class)).isEqualTo(List.class);\n    }\n\n    @Test\n    void test_multisetType_Person_otherAddressMap() {\n        MetaProperty<ImmutableMultiset<String>> test = ImmPerson.meta().codeCounts();\n        \n        assertThat(JodaBeanUtils.collectionType(test, Person.class)).isEqualTo(String.class);\n    }\n\n    @Test\n    void test_integerType_Person_collectionTypeInvalid() {\n        MetaProperty<Integer> test = ImmPerson.meta().age();\n        \n        assertThat(JodaBeanUtils.collectionType(test, Person.class)).isNull();\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_collectionTypeTypes_valid() {\n        MetaProperty<List<List<Address>>> test = Person.meta().addressesList();\n        \n        List<Class<?>> expected = ImmutableList.<Class<?>>of(Address.class);\n        assertThat(JodaBeanUtils.collectionTypeTypes(test, Person.class)).isEqualTo(expected);\n    }\n\n    @Test\n    void test_collectionTypeTypes_invalidNoGenerics() {\n        MetaProperty<List<Address>> test = Person.meta().addressList();\n        \n        List<Class<?>> expected = Collections.emptyList();\n        assertThat(JodaBeanUtils.collectionTypeTypes(test, Person.class)).isEqualTo(expected);\n    }\n\n    @Test\n    void test_collectionTypeTypes_invalidNotCollection() {\n        MetaProperty<ImmutableMap<String, List<Integer>>> test = ImmAddress.meta().listNumericInMap();\n        \n        List<Class<?>> expected = Collections.emptyList();\n        assertThat(JodaBeanUtils.collectionTypeTypes(test, ImmAddress.class)).isEqualTo(expected);\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_mapType_Person_otherAddressMap() {\n        MetaProperty<Map<String, Address>> test = Person.meta().otherAddressMap();\n        \n        assertThat(JodaBeanUtils.mapKeyType(test, Person.class)).isEqualTo(String.class);\n        assertThat(JodaBeanUtils.mapValueType(test, Person.class)).isEqualTo(Address.class);\n    }\n\n    @Test\n    void test_integerType_Person_mapKeyTypeInvalid() {\n        MetaProperty<Integer> test = ImmPerson.meta().age();\n        \n        assertThat(JodaBeanUtils.mapKeyType(test, Person.class)).isNull();\n        assertThat(JodaBeanUtils.mapValueType(test, Person.class)).isNull();\n    }\n\n    @Test\n    void test_collectionType_Person_mapKeyTypeInvalid() {\n        MetaProperty<List<Address>> test = Person.meta().addressList();\n        \n        assertThat(JodaBeanUtils.mapKeyType(test, Person.class)).isNull();\n        assertThat(JodaBeanUtils.mapValueType(test, Person.class)).isNull();\n    }\n\n    @Test\n    void test_mapType_wildcard() {\n        @SuppressWarnings(\"unchecked\")\n        MetaProperty<Map<? extends Number, String>> test = ImmGuava.meta().mapWildKey();\n\n        assertThat(JodaBeanUtils.mapKeyType(test, ImmGuava.class)).isEqualTo(Number.class);\n        assertThat(JodaBeanUtils.mapValueType(test, ImmGuava.class)).isEqualTo(String.class);\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_mapValueTypeTypes_valid() {\n        MetaProperty<ImmutableMap<String, List<Integer>>> test = ImmAddress.meta().listNumericInMap();\n        \n        List<Class<?>> expected = ImmutableList.<Class<?>>of(Integer.class);\n        assertThat(JodaBeanUtils.mapValueTypeTypes(test, ImmAddress.class)).isEqualTo(expected);\n    }\n\n    @Test\n    void test_mapValueTypeTypes_invalidNoGenerics() {\n        MetaProperty<Map<String, Address>> test = Person.meta().otherAddressMap();\n        \n        List<Class<?>> expected = Collections.emptyList();\n        assertThat(JodaBeanUtils.mapValueTypeTypes(test, Person.class)).isEqualTo(expected);\n    }\n\n    @Test\n    void test_mapValueTypeTypes_invalidNotMap() {\n        MetaProperty<List<Address>> test = Person.meta().addressList();\n        \n        List<Class<?>> expected = Collections.emptyList();\n        assertThat(JodaBeanUtils.mapValueTypeTypes(test, Person.class)).isEqualTo(expected);\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void equalIgnoring() {\n        Bean bean1 = createBean(\"123\", \"321\", \"name1\");\n        Bean bean2 = createBean(\"124\", \"321\", \"name1\");\n        // first not ignored\n        assertThat(JodaBeanUtils.equalIgnoring(bean1, bean2)).isFalse();\n        assertThat(JodaBeanUtils.equalIgnoring(bean1, bean2, bean1.metaBean().metaProperty(\"second\"))).isFalse();\n        assertThat(JodaBeanUtils.equalIgnoring(bean1, bean2, bean1.metaBean().metaProperty(\"second\"), bean1.metaBean().metaProperty(\"name\"))).isFalse();\n        // first is ignored\n        assertThat(JodaBeanUtils.equalIgnoring(bean1, bean2, bean1.metaBean().metaProperty(\"first\"))).isTrue();\n        assertThat(JodaBeanUtils.equalIgnoring(bean1, bean2, bean1.metaBean().metaProperty(\"first\"), bean1.metaBean().metaProperty(\"second\"))).isTrue();\n    }\n\n    @Test\n    void equalIgnoring_same() {\n        Bean bean1 = createBean(\"123\", \"321\", \"name1\");\n        Bean bean2 = createBean(\"124\", \"321\", \"name1\");\n        assertThat(JodaBeanUtils.equalIgnoring(bean1, bean1)).isTrue();\n        assertThat(JodaBeanUtils.equalIgnoring(bean2, bean2)).isTrue();\n    }\n\n    @Test\n    void equalIgnoring_nullFirst() {\n        Bean bean = createBean(\"124\", \"321\", \"name1\");\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanUtils.equalIgnoring(null, bean));\n    }\n\n    @Test\n    void equalIgnoring_nullSecond() {\n        Bean bean = createBean(\"124\", \"321\", \"name1\");\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanUtils.equalIgnoring(bean, null));\n    }\n\n    @Test\n    void equalIgnoring_nullArray() {\n        Bean bean = createBean(\"124\", \"321\", \"name1\");\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanUtils.equalIgnoring(bean, bean, (MetaProperty<?>[]) null));\n    }\n\n    private static Bean createBean(String first, String second, String name) {\n        FlexiBean bean = new FlexiBean();\n        bean.propertySet(\"first\", first);\n        bean.propertySet(\"second\", second);\n        bean.propertySet(\"name\", name);\n        return bean;\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_compare_ascending() {\n        Address address1 = new Address();\n        address1.setOwner(new Person());\n        address1.getOwner().setSurname(\"Joda\");\n        Address address2 = new Address();\n        address2.setOwner(new Person());\n        address2.getOwner().setSurname(\"Beans\");\n        Function<Bean, String> bq = JodaBeanUtils.chain(Address.meta().owner(), Person.meta().surname());\n        \n        Comparator<Bean> asc = JodaBeanUtils.comparator(bq, true);\n        assertThat(asc.compare(address1, address1) == 0).isTrue();\n        assertThat(asc.compare(address1, address2) > 1).isTrue();\n        assertThat(asc.compare(address2, address1) < 1).isTrue();\n    }\n\n    @Test\n    void test_compare_descending() {\n        Address address1 = new Address();\n        address1.setOwner(new Person());\n        address1.getOwner().setSurname(\"Joda\");\n        Address address2 = new Address();\n        address2.setOwner(new Person());\n        address2.getOwner().setSurname(\"Beans\");\n        Function<Bean, String> bq = JodaBeanUtils.chain(Address.meta().owner(), Person.meta().surname());\n        \n        Comparator<Bean> desc = JodaBeanUtils.comparator(bq, false);\n        assertThat(desc.compare(address1, address1) == 0).isTrue();\n        assertThat(desc.compare(address1, address2) < 1).isTrue();\n        assertThat(desc.compare(address2, address1) > 1).isTrue();\n    }\n\n    @Test\n    void test_compare_ascending_null() {\n        assertThatNullPointerException()\n                .isThrownBy(() -> JodaBeanUtils.comparatorAscending(null));\n    }\n\n    @Test\n    void test_compare_descending_null() {\n        assertThatNullPointerException()\n                .isThrownBy(() -> JodaBeanUtils.comparatorDescending(null));\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestLight.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatExceptionOfType;\n\nimport java.util.ArrayList;\nimport java.util.Currency;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.impl.StandaloneMetaProperty;\nimport org.joda.beans.sample.ImmPerson;\nimport org.joda.beans.sample.LightImmutable;\nimport org.joda.beans.sample.LightMutable;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.junit.jupiter.api.Test;\n\nimport com.google.common.base.Optional;\nimport com.google.common.collect.ImmutableList;\n\n/**\n * Test style=light.\n */\nclass TestLight {\n\n    @Test\n    void test_immutable() {\n        ImmPerson person = ImmPerson.builder().forename(\"John\").surname(\"Doggett\").build();\n        LightImmutable bean = LightImmutable.meta().builder()\n                .set(\"number\", 12)\n                .set(\"street\", \"Park Lane\")\n                .set(StandaloneMetaProperty.of(\"city\", LightImmutable.meta(), String.class), \"Smallville\")\n                .set(\"owner\", person)\n                .set(\"list\", new ArrayList<String>())\n                .set(\"currency\", Currency.getInstance(\"USD\"))\n                .set(\"hiddenText\", \"wow\")\n                .set(\"valueChar\", 'a')  // XML does not support char zero\n                .build();\n        \n        assertThat(bean.getNumber()).isEqualTo(12);\n        assertThat(bean.getTown()).isEqualTo(Optional.absent());\n        assertThat(bean.getCity()).isEqualTo(\"Smallville\");\n        assertThat(bean.getStreetName()).isEqualTo(\"Park Lane\");\n        assertThat(bean.getOwner()).isEqualTo(person);\n        assertThat(bean.getList()).isEqualTo(ImmutableList.of());\n        \n        assertThat(bean.metaBean().beanType()).isEqualTo(LightImmutable.class);\n        assertThat(bean.metaBean().metaPropertyCount()).isEqualTo(14);\n        assertThat(bean.metaBean().metaPropertyExists(\"number\")).isTrue();\n        assertThat(bean.metaBean().metaPropertyExists(\"town\")).isTrue();\n        assertThat(bean.metaBean().metaPropertyExists(\"address\")).isTrue();\n        assertThat(bean.metaBean().metaPropertyExists(\"foobar\")).isFalse();\n        \n        assertThat(bean.metaBean().metaPropertyExists(\"place\")).isFalse();\n        assertThat(bean.metaBean().metaProperty(\"place\")).isEqualTo(bean.metaBean().metaProperty(\"city\"));\n        LightImmutable builtWithAlias = LightImmutable.meta().builder()\n                .set(\"place\", \"Place\")\n                .set(\"street\", \"Park Lane\")\n                .set(\"owner\", person)\n                .build();\n        assertThat(builtWithAlias.getCity()).isEqualTo(\"Place\");\n        \n        MetaProperty<Object> mp = bean.metaBean().metaProperty(\"number\");\n        assertThat(mp.propertyType()).isEqualTo(int.class);\n        assertThat(mp.declaringType()).isEqualTo(LightImmutable.class);\n        assertThat(mp.get(bean)).isEqualTo(12);\n        assertThat(mp.style()).isEqualTo(PropertyStyle.IMMUTABLE);\n        \n        MetaProperty<Object> mp2 = bean.metaBean().metaProperty(\"town\");\n        assertThat(mp2.propertyType()).isEqualTo(String.class);\n        assertThat(mp2.propertyGenericType()).isEqualTo(String.class);\n        assertThat(mp2.declaringType()).isEqualTo(LightImmutable.class);\n        assertThat(mp2.get(bean)).isNull();\n        assertThat(mp2.style()).isEqualTo(PropertyStyle.IMMUTABLE);\n        \n        MetaProperty<Object> mp3 = bean.metaBean().metaProperty(\"address\");\n        assertThat(mp3.propertyType()).isEqualTo(String.class);\n        assertThat(mp3.propertyGenericType()).isEqualTo(String.class);\n        assertThat(mp3.declaringType()).isEqualTo(LightImmutable.class);\n        assertThat(mp3.get(bean)).isEqualTo(\"12 Park Lane Smallville\");\n        assertThat(mp3.style()).isEqualTo(PropertyStyle.DERIVED);\n        \n        MetaProperty<Object> mp4 = bean.metaBean().metaProperty(\"hiddenText\");\n        assertThat(mp4.propertyType()).isEqualTo(String.class);\n        assertThat(mp4.propertyGenericType()).isEqualTo(String.class);\n        assertThat(mp4.declaringType()).isEqualTo(LightImmutable.class);\n        assertThat(mp4.get(bean)).isEqualTo(\"wow\");\n        assertThat(mp4.style()).isEqualTo(PropertyStyle.IMMUTABLE);\n        \n        assertThat(JodaBeanSer.PRETTY.xmlWriter().write(bean)).contains(\"<currency>USD<\");\n        assertThat(JodaBeanSer.PRETTY.xmlWriter().write(bean)).doesNotContain(\"<town>\");\n        \n        assertThatExceptionOfType(NoSuchElementException.class)\n                .isThrownBy(() -> LightImmutable.meta().builder().set(mp3, \"Nothing\"));\n    }\n\n    @Test\n    void test_immutable_order() {\n        ImmPerson person = ImmPerson.builder().forename(\"John\").surname(\"Doggett\").build();\n        LightImmutable bean = LightImmutable.meta().builder()\n                .set(\"number\", 12)\n                .set(\"street\", \"Park Lane\")\n                .set(StandaloneMetaProperty.of(\"city\", LightImmutable.meta(), String.class), \"Smallville\")\n                .set(\"owner\", person)\n                .set(\"list\", new ArrayList<String>())\n                .set(\"currency\", Currency.getInstance(\"USD\"))\n                .build();\n\n        ImmutableList<MetaProperty<?>> mps = ImmutableList.copyOf(bean.metaBean().metaPropertyIterable());\n        assertThat(mps.get(0).name()).isEqualTo(\"number\");\n        assertThat(mps.get(1).name()).isEqualTo(\"flag\");\n        assertThat(mps.get(2).name()).isEqualTo(\"street\");\n        assertThat(mps.get(3).name()).isEqualTo(\"town\");\n        assertThat(mps.get(4).name()).isEqualTo(\"city\");\n        assertThat(mps.get(5).name()).isEqualTo(\"owner\");\n        assertThat(mps.get(6).name()).isEqualTo(\"list\");\n        assertThat(mps.get(7).name()).isEqualTo(\"currency\");\n        assertThat(mps.get(8).name()).isEqualTo(\"hiddenText\");\n        assertThat(mps.get(9).name()).isEqualTo(\"valueLong\");\n        assertThat(mps.get(10).name()).isEqualTo(\"valueShort\");\n        assertThat(mps.get(11).name()).isEqualTo(\"valueChar\");\n        assertThat(mps.get(12).name()).isEqualTo(\"valueByte\");\n        assertThat(mps.get(13).name()).isEqualTo(\"address\");\n    }\n\n    @Test\n    void test_mutable() {\n        LightMutable bean = LightMutable.meta().builder()\n                .set(\"number\", 12)\n                .set(\"street\", \"Park Lane\")\n                .set(StandaloneMetaProperty.of(\"city\", LightMutable.meta(), String.class), \"Smallville\")\n                .set(\"list\", new ArrayList<String>())\n                .set(\"currency\", Currency.getInstance(\"USD\"))\n                .set(\"hiddenText\", \"wow\")\n                .build();\n        \n        assertThat(bean.getNumber()).isEqualTo(12);\n        assertThat(bean.getTown()).isEqualTo(Optional.absent());\n        assertThat(bean.getCity()).isEqualTo(\"Smallville\");\n        assertThat(bean.getStreetName()).isEqualTo(\"Park Lane\");\n        assertThat(bean.getList()).isEqualTo(ImmutableList.of());\n        assertThat(bean.getCurrency()).isEqualTo(Optional.of(Currency.getInstance(\"USD\")));\n        \n        bean.setCity(\"Nodnol\");\n        assertThat(bean.getCity()).isEqualTo(\"Nodnol\");\n        \n        bean.property(\"city\").set(\"Paris\");\n        assertThat(bean.getCity()).isEqualTo(\"Paris\");\n        \n        bean.metaBean().metaProperty(\"city\").set(bean, \"London\");\n        assertThat(bean.getCity()).isEqualTo(\"London\");\n        \n        assertThat(bean.metaBean().beanType()).isEqualTo(LightMutable.class);\n        assertThat(bean.metaBean().metaPropertyCount()).isEqualTo(9);\n        assertThat(bean.metaBean().metaPropertyExists(\"number\")).isTrue();\n        assertThat(bean.metaBean().metaPropertyExists(\"town\")).isTrue();\n        assertThat(bean.metaBean().metaPropertyExists(\"address\")).isTrue();\n        assertThat(bean.metaBean().metaPropertyExists(\"foobar\")).isFalse();\n        \n        assertThat(bean.metaBean().metaPropertyExists(\"place\")).isFalse();\n        assertThat(bean.metaBean().metaProperty(\"place\")).isEqualTo(bean.metaBean().metaProperty(\"city\"));\n        LightMutable builtWithAlias = LightMutable.meta().builder()\n                .set(\"place\", \"Place\")\n                .set(\"street\", \"Park Lane\")\n                .build();\n        assertThat(builtWithAlias.getCity()).isEqualTo(\"Place\");\n        \n        MetaProperty<Object> mp = bean.metaBean().metaProperty(\"number\");\n        assertThat(mp.propertyType()).isEqualTo(int.class);\n        assertThat(mp.declaringType()).isEqualTo(LightMutable.class);\n        assertThat(mp.get(bean)).isEqualTo(12);\n        assertThat(mp.style()).isEqualTo(PropertyStyle.READ_WRITE);\n        \n        MetaProperty<Object> mp2 = bean.metaBean().metaProperty(\"currency\");\n        assertThat(mp2.propertyType()).isEqualTo(Currency.class);\n        assertThat(mp2.propertyGenericType()).isEqualTo(Currency.class);\n        assertThat(mp2.declaringType()).isEqualTo(LightMutable.class);\n        assertThat(mp2.get(bean)).isEqualTo(Currency.getInstance(\"USD\"));\n        assertThat(mp2.style()).isEqualTo(PropertyStyle.READ_WRITE);\n        \n        MetaProperty<Object> mp3 = bean.metaBean().metaProperty(\"address\");\n        assertThat(mp3.propertyType()).isEqualTo(String.class);\n        assertThat(mp3.propertyGenericType()).isEqualTo(String.class);\n        assertThat(mp3.declaringType()).isEqualTo(LightMutable.class);\n        assertThat(mp3.get(bean)).isEqualTo(\"12 Park Lane London\");\n        assertThat(mp3.style()).isEqualTo(PropertyStyle.DERIVED);\n        \n        MetaProperty<Object> mp4 = bean.metaBean().metaProperty(\"hiddenText\");\n        assertThat(mp4.propertyType()).isEqualTo(String.class);\n        assertThat(mp4.propertyGenericType()).isEqualTo(String.class);\n        assertThat(mp4.declaringType()).isEqualTo(LightMutable.class);\n        assertThat(mp4.get(bean)).isEqualTo(\"wow\");\n        assertThat(mp4.style()).isEqualTo(PropertyStyle.READ_WRITE);\n        \n        assertThat(JodaBeanSer.PRETTY.xmlWriter().write(bean)).contains(\"<currency>USD<\");\n        assertThat(JodaBeanSer.PRETTY.xmlWriter().write(bean)).doesNotContain(\"<town>\");\n        \n        assertThatExceptionOfType(NoSuchElementException.class)\n                .isThrownBy(() -> LightImmutable.meta().builder().set(mp3, \"Nothing\"));\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestMapBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport org.joda.beans.impl.map.MapBean;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test {@link MapBean}.\n */\nclass TestMapBean {\n\n    @Test\n    void test_clone() {\n        MapBean a = new MapBean();\n        a.put(\"A\", \"AA\");\n        a.put(\"B\", \"BB\");\n        MapBean b = a.clone();\n        \n        assertThat(a.get(\"A\")).isEqualTo(\"AA\");\n        assertThat(a.get(\"B\")).isEqualTo(\"BB\");\n        assertThat(b.get(\"A\")).isEqualTo(\"AA\");\n        assertThat(b.get(\"B\")).isEqualTo(\"BB\");\n        \n        a.clear();\n        \n        assertThat(a.get(\"A\")).isNull();\n        assertThat(a.get(\"B\")).isNull();\n        assertThat(b.get(\"A\")).isEqualTo(\"AA\");\n        assertThat(b.get(\"B\")).isEqualTo(\"BB\");\n    }\n\n    @Test\n    void test_equalsHashCode() {\n        MapBean a1 = new MapBean();\n        MapBean a2 = new MapBean();\n        MapBean b = new MapBean();\n        \n        a1.put(\"first\", \"A\");\n        a2.put(\"first\", \"A\");\n        b.put(\"first\", \"B\");\n        \n        assertThat(a1.equals(a1)).isTrue();\n        assertThat(a1.equals(a2)).isTrue();\n        assertThat(a2.equals(a1)).isTrue();\n        assertThat(a2.equals(a2)).isTrue();\n        assertThat(a1.hashCode()).isEqualTo(a2.hashCode());\n        \n        assertThat(a1.equals(b)).isFalse();\n        assertThat(b.equals(a1)).isFalse();\n        \n        Object obj = \"Weird type\";\n        assertThat(b.equals(obj)).isFalse();\n        assertThat(b.equals(null)).isFalse();\n    }\n\n    @Test\n    void test_propertyDefine_propertyRemove() {\n        MapBean mapBean = new MapBean();\n        assertThat(mapBean.propertyNames().size()).isEqualTo(0);\n        mapBean.propertyDefine(\"name\", String.class);\n        assertThat(mapBean.propertyNames().size()).isEqualTo(1);\n        Property<Object> prop = mapBean.property(\"name\");\n        assertThat(prop.name()).isEqualTo(\"name\");\n        assertThat(prop.get()).isNull();\n        mapBean.propertyRemove(\"name\");\n        assertThat(mapBean.propertyNames().size()).isEqualTo(0);\n    }\n\n    @Test\n    void test_metaBean() {\n        MapBean mapBean = new MapBean();\n        DynamicMetaBean meta = mapBean.metaBean();\n        assertThat(meta.metaPropertyCount()).isEqualTo(0);\n        \n        meta.metaPropertyDefine(\"name\", String.class);\n        assertThat(meta.metaPropertyCount()).isEqualTo(1);\n        MetaProperty<Object> prop = meta.metaProperty(\"name\");\n        assertThat(prop.name()).isEqualTo(\"name\");\n        assertThat(prop.get(mapBean)).isNull();\n        \n        meta.metaPropertyDefine(\"name\", String.class);\n        assertThat(meta.metaPropertyCount()).isEqualTo(1);\n        \n        MetaProperty<Object> prop2 = meta.metaProperty(\"address\");\n        assertThat(prop2).isNotNull();\n        assertThat(meta.metaPropertyCount()).isEqualTo(1); // meta-property object created but data not changed\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestMetaBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;\n\nimport org.joda.beans.impl.flexi.FlexiBean;\nimport org.joda.beans.impl.map.MapBean;\nimport org.joda.beans.sample.ImmPerson;\nimport org.joda.beans.sample.MetaBeanLoad;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test {@link MetaBean}.\n */\nclass TestMetaBean {\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_registerMetaBean() {\n        // register once OK\n        assertThat(ImmPerson.meta()).isNotNull();\n        // register second time not OK\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> MetaBean.register(ImmPerson.meta()));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_metaBean() {\n        MetaBean metaBean = MetaBean.of(MetaBeanLoad.class);\n        assertThat(metaBean).isNotNull();\n        assertThat(metaBean).isEqualTo(MetaBeanLoad.meta());\n    }\n\n    @Test\n    void test_metaBean_FlexiBean() {\n        assertThat(MetaBean.of(FlexiBean.class).builder().build().getClass()).isEqualTo(FlexiBean.class);\n    }\n\n    @Test\n    void test_metaBean_MapBean() {\n        assertThat(MetaBean.of(MapBean.class).builder().build().getClass()).isEqualTo(MapBean.class);\n    }\n\n    @Test\n    void test_metaBean_notFound() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> MetaBean.of(String.class));\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestMetaBeanProvider.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\n/**\n * A mock {@link MetaBeanProvider} for testing.\n */\nclass TestMetaBeanProvider implements MetaBeanProvider {\n\n  @Override\n  public MetaBean findMetaBean(Class<?> cls) {\n    if (cls.equals(AnnotatedBean.class)) {\n      return new AnnotatedMetaBean();\n    } else {\n      return null;\n    }\n  }\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestMetaBeans.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test {@link MetaBeans}.\n */\nclass TestMetaBeans {\n\n  @Test\n  void test_metaBeanProviderAnnotation() {\n    MetaBean metaBean = MetaBeans.lookup(AnnotatedBean.class);\n    assertThat(metaBean).isInstanceOf(AnnotatedMetaBean.class);\n  }\n}\n\n// --------------------------------------------------------------------------------------------------\n\n@MetaProvider(TestMetaBeanProvider.class)\nclass AnnotatedBean implements Bean {\n\n  @Override\n  public MetaBean metaBean() {\n    throw new UnsupportedOperationException(\"This method is not needed for testing\");\n  }\n\n  @Override\n  public <R> Property<R> property(String propertyName) {\n    throw new UnsupportedOperationException(\"This method is not needed for testing\");\n  }\n\n  @Override\n  public Set<String> propertyNames() {\n    throw new UnsupportedOperationException(\"This method is not needed for testing\");\n  }\n}\n\nclass AnnotatedMetaBean implements MetaBean {\n\n  @Override\n  public boolean isBuildable() {\n    throw new UnsupportedOperationException(\"This method is not needed for testing\");\n  }\n\n  @Override\n  public BeanBuilder<? extends Bean> builder() {\n    throw new UnsupportedOperationException(\"This method is not needed for testing\");\n  }\n\n  @Override\n  public Class<? extends Bean> beanType() {\n    return AnnotatedBean.class;\n  }\n\n  @Override\n  public Map<String, MetaProperty<?>> metaPropertyMap() {\n    throw new UnsupportedOperationException(\"This method is not needed for testing\");\n  }\n}\n\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestMetaInvoke.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport org.joda.beans.sample.AbstractResult;\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.AddressResult;\nimport org.joda.beans.sample.CompanyAddress;\nimport org.joda.beans.sample.CompanyAddressMidResult;\nimport org.joda.beans.sample.CompanyAddressResult;\nimport org.joda.beans.sample.Documentation;\nimport org.joda.beans.sample.DocumentationHolder;\nimport org.joda.beans.sample.FinalFieldBean;\nimport org.joda.beans.sample.GenericSubWrapper;\nimport org.joda.beans.sample.GenericWrapperDocumentation;\nimport org.joda.beans.sample.MidAbstractResult;\nimport org.joda.beans.sample.NoGenEquals;\nimport org.joda.beans.sample.NoProperties;\nimport org.joda.beans.sample.Pair;\nimport org.joda.beans.sample.Person;\nimport org.joda.beans.sample.PersonDocumentation;\nimport org.joda.beans.sample.RWOnlyBean;\nimport org.joda.beans.sample.SubPerson;\nimport org.joda.beans.sample.SubWrapper;\nimport org.joda.beans.sample.TweakedPair;\nimport org.joda.beans.sample.ValidateBean;\nimport org.joda.beans.sample.Wrapper;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test property using Person.\n */\nclass TestMetaInvoke {\n\n    @Test\n    void test_method_call_compiles() {\n        @SuppressWarnings(\"unchecked\")\n        AbstractResult.Meta<Address> a = AbstractResult.meta();\n        assertThat(a).isNotNull();\n        \n        AbstractResult.Meta<Address> a2 = AbstractResult.metaAbstractResult(Address.class);\n        assertThat(a2).isNotNull();\n        \n        Address.Meta b = Address.meta();\n        assertThat(b).isNotNull();\n        \n        AddressResult.Meta c = AddressResult.meta();\n        assertThat(c).isNotNull();\n        \n        CompanyAddress.Meta d = CompanyAddress.meta();\n        assertThat(d).isNotNull();\n        \n        CompanyAddressMidResult.Meta e = CompanyAddressMidResult.meta();\n        assertThat(e).isNotNull();\n        \n        CompanyAddressResult.Meta f = CompanyAddressResult.meta();\n        assertThat(f).isNotNull();\n        \n        @SuppressWarnings(\"unchecked\")\n        Documentation.Meta<String> g = Documentation.meta();\n        assertThat(g).isNotNull();\n        \n        Documentation.Meta<String> g2 = Documentation.metaDocumentation(String.class);\n        assertThat(g2).isNotNull();\n        \n        DocumentationHolder.Meta h = DocumentationHolder.meta();\n        assertThat(h).isNotNull();\n        \n        FinalFieldBean.Meta i = FinalFieldBean.meta();\n        assertThat(i).isNotNull();\n        \n        @SuppressWarnings(\"unchecked\")\n        GenericSubWrapper.Meta<Address> j = GenericSubWrapper.meta();\n        assertThat(j).isNotNull();\n        \n        GenericSubWrapper.Meta<Address> j2 = GenericSubWrapper.metaGenericSubWrapper(Address.class);\n        assertThat(j2).isNotNull();\n        \n        @SuppressWarnings(\"unchecked\")\n        GenericWrapperDocumentation.Meta<Address> k = GenericWrapperDocumentation.meta();\n        assertThat(k).isNotNull();\n        \n        GenericWrapperDocumentation.Meta<Address> k2 = GenericWrapperDocumentation.metaGenericWrapperDocumentation(Address.class);\n        assertThat(k2).isNotNull();\n        \n        @SuppressWarnings(\"unchecked\")\n        MidAbstractResult.Meta<Address> l = MidAbstractResult.meta();\n        assertThat(l).isNotNull();\n        \n        MidAbstractResult.Meta<Address> l2 = MidAbstractResult.metaMidAbstractResult(Address.class);\n        assertThat(l2).isNotNull();\n        \n        NoGenEquals.Meta m = NoGenEquals.meta();\n        assertThat(m).isNotNull();\n        \n        NoProperties.Meta n = NoProperties.meta();\n        assertThat(n).isNotNull();\n        \n        Pair.Meta o = Pair.meta();\n        assertThat(o).isNotNull();\n        \n        Person.Meta p = Person.meta();\n        assertThat(p).isNotNull();\n        \n        PersonDocumentation.Meta q = PersonDocumentation.meta();\n        assertThat(q).isNotNull();\n        \n        RWOnlyBean.Meta r = RWOnlyBean.meta();\n        assertThat(r).isNotNull();\n        \n        @SuppressWarnings(\"unchecked\")\n        SubPerson.Meta<String> s = SubPerson.meta();\n        assertThat(s).isNotNull();\n        \n        SubPerson.Meta<String> s2 = SubPerson.metaSubPerson(String.class);\n        assertThat(s2).isNotNull();\n        \n        SubWrapper.Meta t = SubWrapper.meta();\n        assertThat(t).isNotNull();\n        \n        TweakedPair.Meta u = TweakedPair.meta();\n        assertThat(u).isNotNull();\n        \n        ValidateBean.Meta v = ValidateBean.meta();\n        assertThat(v).isNotNull();\n        \n        @SuppressWarnings(\"unchecked\")\n        Wrapper.Meta<Address> w = Wrapper.meta();\n        assertThat(w).isNotNull();\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestMinimal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatExceptionOfType;\n\nimport java.util.ArrayList;\nimport java.util.Currency;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.impl.StandaloneMetaProperty;\nimport org.joda.beans.sample.ImmPerson;\nimport org.joda.beans.sample.LightImmutable;\nimport org.joda.beans.sample.MinimalImmutable;\nimport org.joda.beans.sample.MinimalMutable;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.junit.jupiter.api.Test;\n\nimport com.google.common.base.Optional;\nimport com.google.common.collect.ImmutableList;\n\n/**\n * Test style=minimal.\n */\nclass TestMinimal {\n\n    @Test\n    void test_immutable() {\n        ImmPerson person = ImmPerson.builder().forename(\"John\").surname(\"Doggett\").build();\n        MinimalImmutable bean = MinimalImmutable.meta().builder()\n                .set(\"number\", 12)\n                .set(\"street\", \"Park Lane\")\n                .set(StandaloneMetaProperty.of(\"city\", MinimalImmutable.meta(), String.class), \"Smallville\")\n                .set(\"owner\", person)\n                .set(\"list\", new ArrayList<String>())\n                .set(\"currency\", Currency.getInstance(\"USD\"))\n                .build();\n        \n        assertThat(bean.getNumber()).isEqualTo(12);\n        assertThat(bean.getTown()).isEqualTo(Optional.absent());\n        assertThat(bean.getCity()).isEqualTo(\"Smallville\");\n        assertThat(bean.getStreetName()).isEqualTo(\"Park Lane\");\n        assertThat(bean.getOwner()).isEqualTo(person);\n        assertThat(bean.getList()).isEqualTo(ImmutableList.of());\n        \n        assertThat(bean.metaBean().beanType()).isEqualTo(MinimalImmutable.class);\n        assertThat(bean.metaBean().metaPropertyCount()).isEqualTo(9);\n        assertThat(bean.metaBean().metaPropertyExists(\"number\")).isTrue();\n        assertThat(bean.metaBean().metaPropertyExists(\"town\")).isTrue();\n        assertThat(bean.metaBean().metaPropertyExists(\"address\")).isTrue();\n        assertThat(bean.metaBean().metaPropertyExists(\"foobar\")).isFalse();\n        \n        assertThat(bean.metaBean().metaPropertyExists(\"place\")).isFalse();\n        assertThat(bean.metaBean().metaProperty(\"place\")).isEqualTo(bean.metaBean().metaProperty(\"city\"));\n        MinimalImmutable builtWithAlias = MinimalImmutable.meta().builder()\n                .set(\"place\", \"Place\")\n                .set(\"street\", \"Park Lane\")\n                .set(\"owner\", person)\n                .build();\n        assertThat(builtWithAlias.getCity()).isEqualTo(\"Place\");\n        \n        MetaProperty<Object> mp = bean.metaBean().metaProperty(\"number\");\n        assertThat(mp.propertyType()).isEqualTo(int.class);\n        assertThat(mp.declaringType()).isEqualTo(MinimalImmutable.class);\n        assertThat(mp.get(bean)).isEqualTo(12);\n        assertThat(mp.style()).isEqualTo(PropertyStyle.IMMUTABLE);\n        \n        MetaProperty<Object> mp2 = bean.metaBean().metaProperty(\"town\");\n        assertThat(mp2.propertyType()).isEqualTo(String.class);\n        assertThat(mp2.propertyGenericType()).isEqualTo(String.class);\n        assertThat(mp2.declaringType()).isEqualTo(MinimalImmutable.class);\n        assertThat(mp2.get(bean)).isNull();\n        assertThat(mp2.style()).isEqualTo(PropertyStyle.IMMUTABLE);\n        \n        MetaProperty<Object> mp3 = bean.metaBean().metaProperty(\"address\");\n        assertThat(mp3.propertyType()).isEqualTo(String.class);\n        assertThat(mp3.propertyGenericType()).isEqualTo(String.class);\n        assertThat(mp3.declaringType()).isEqualTo(MinimalImmutable.class);\n        assertThat(mp3.get(bean)).isEqualTo(\"12 Park Lane Smallville\");\n        assertThat(mp3.style()).isEqualTo(PropertyStyle.DERIVED);\n        \n        assertThat(JodaBeanSer.PRETTY.xmlWriter().write(bean)).contains(\"<currency>USD<\");\n        assertThat(JodaBeanSer.PRETTY.xmlWriter().write(bean)).doesNotContain(\"<town>\");\n        \n        assertThatExceptionOfType(NoSuchElementException.class)\n                .isThrownBy(() -> LightImmutable.meta().builder().set(mp3, \"Nothing\"));\n    }\n\n    @Test\n    void test_immutable_order() {\n        ImmPerson person = ImmPerson.builder().forename(\"John\").surname(\"Doggett\").build();\n        MinimalImmutable bean = MinimalImmutable.meta().builder()\n                .set(\"number\", 12)\n                .set(\"street\", \"Park Lane\")\n                .set(StandaloneMetaProperty.of(\"city\", MinimalImmutable.meta(), String.class), \"Smallville\")\n                .set(\"owner\", person)\n                .set(\"list\", new ArrayList<String>())\n                .set(\"currency\", Currency.getInstance(\"USD\"))\n                .build();\n\n        ImmutableList<MetaProperty<?>> mps = ImmutableList.copyOf(bean.metaBean().metaPropertyIterable());\n        assertThat(mps.get(0).name()).isEqualTo(\"number\");\n        assertThat(mps.get(1).name()).isEqualTo(\"flag\");\n        assertThat(mps.get(2).name()).isEqualTo(\"street\");\n        assertThat(mps.get(3).name()).isEqualTo(\"town\");\n        assertThat(mps.get(4).name()).isEqualTo(\"city\");\n        assertThat(mps.get(5).name()).isEqualTo(\"owner\");\n        assertThat(mps.get(6).name()).isEqualTo(\"list\");\n        assertThat(mps.get(7).name()).isEqualTo(\"currency\");\n        assertThat(mps.get(8).name()).isEqualTo(\"address\");\n    }\n\n    @Test\n    void test_mutable() {\n        MinimalMutable bean = MinimalMutable.meta().builder()\n                .set(\"number\", 12)\n                .set(\"street\", \"Park Lane\")\n                .set(StandaloneMetaProperty.of(\"city\", MinimalMutable.meta(), String.class), \"Smallville\")\n                .set(\"list\", new ArrayList<String>())\n                .set(\"currency\", Currency.getInstance(\"USD\"))\n                .build();\n        \n        assertThat(bean.getNumber()).isEqualTo(12);\n        assertThat(bean.getTown()).isEqualTo(Optional.absent());\n        assertThat(bean.getCity()).isEqualTo(\"Smallville\");\n        assertThat(bean.getStreetName()).isEqualTo(\"Park Lane\");\n        assertThat(bean.getList()).isEqualTo(ImmutableList.of());\n        assertThat(bean.getCurrency()).isEqualTo(Optional.of(Currency.getInstance(\"USD\")));\n        \n        bean.setCity(\"Nodnol\");\n        assertThat(bean.getCity()).isEqualTo(\"Nodnol\");\n        \n        bean.property(\"city\").set(\"Paris\");\n        assertThat(bean.getCity()).isEqualTo(\"Paris\");\n        \n        bean.metaBean().metaProperty(\"city\").set(bean, \"London\");\n        assertThat(bean.getCity()).isEqualTo(\"London\");\n        \n        assertThat(bean.metaBean().beanType()).isEqualTo(MinimalMutable.class);\n        assertThat(bean.metaBean().metaPropertyCount()).isEqualTo(8);\n        assertThat(bean.metaBean().metaPropertyExists(\"number\")).isTrue();\n        assertThat(bean.metaBean().metaPropertyExists(\"town\")).isTrue();\n        assertThat(bean.metaBean().metaPropertyExists(\"address\")).isTrue();\n        assertThat(bean.metaBean().metaPropertyExists(\"foobar\")).isFalse();\n        \n        assertThat(bean.metaBean().metaPropertyExists(\"place\")).isFalse();\n        assertThat(bean.metaBean().metaProperty(\"place\")).isEqualTo(bean.metaBean().metaProperty(\"city\"));\n        MinimalMutable builtWithAlias = MinimalMutable.meta().builder()\n                .set(\"place\", \"Place\")\n                .set(\"street\", \"Park Lane\")\n                .build();\n        assertThat(builtWithAlias.getCity()).isEqualTo(\"Place\");\n        \n        MetaProperty<Object> mp = bean.metaBean().metaProperty(\"number\");\n        assertThat(mp.propertyType()).isEqualTo(int.class);\n        assertThat(mp.declaringType()).isEqualTo(MinimalMutable.class);\n        assertThat(mp.get(bean)).isEqualTo(12);\n        assertThat(mp.style()).isEqualTo(PropertyStyle.READ_WRITE);\n        \n        MetaProperty<Object> mp2 = bean.metaBean().metaProperty(\"currency\");\n        assertThat(mp2.propertyType()).isEqualTo(Currency.class);\n        assertThat(mp2.propertyGenericType()).isEqualTo(Currency.class);\n        assertThat(mp2.declaringType()).isEqualTo(MinimalMutable.class);\n        assertThat(mp2.get(bean)).isEqualTo(Currency.getInstance(\"USD\"));\n        assertThat(mp2.style()).isEqualTo(PropertyStyle.READ_WRITE);\n        \n        MetaProperty<Object> mp3 = bean.metaBean().metaProperty(\"address\");\n        assertThat(mp3.propertyType()).isEqualTo(String.class);\n        assertThat(mp3.propertyGenericType()).isEqualTo(String.class);\n        assertThat(mp3.declaringType()).isEqualTo(MinimalMutable.class);\n        assertThat(mp3.get(bean)).isEqualTo(\"12 Park Lane London\");\n        assertThat(mp3.style()).isEqualTo(PropertyStyle.DERIVED);\n        \n        assertThat(JodaBeanSer.PRETTY.xmlWriter().write(bean)).contains(\"<currency>USD<\");\n        assertThat(JodaBeanSer.PRETTY.xmlWriter().write(bean)).doesNotContain(\"<town>\");\n        \n        assertThatExceptionOfType(NoSuchElementException.class)\n                .isThrownBy(() -> LightImmutable.meta().builder().set(mp3, \"Nothing\"));\n    }\n\n    @Test\n    void test_mutable_order() {\n        MinimalMutable bean = MinimalMutable.meta().builder()\n                .set(\"number\", 12)\n                .set(\"street\", \"Park Lane\")\n                .set(StandaloneMetaProperty.of(\"city\", MinimalMutable.meta(), String.class), \"Smallville\")\n                .set(\"list\", new ArrayList<String>())\n                .set(\"currency\", Currency.getInstance(\"USD\"))\n                .build();\n\n        ImmutableList<MetaProperty<?>> mps = ImmutableList.copyOf(bean.metaBean().metaPropertyIterable());\n        assertThat(mps.get(0).name()).isEqualTo(\"number\");\n        assertThat(mps.get(1).name()).isEqualTo(\"flag\");\n        assertThat(mps.get(2).name()).isEqualTo(\"street\");\n        assertThat(mps.get(3).name()).isEqualTo(\"town\");\n        assertThat(mps.get(4).name()).isEqualTo(\"city\");\n        assertThat(mps.get(5).name()).isEqualTo(\"list\");\n        assertThat(mps.get(6).name()).isEqualTo(\"currency\");\n        assertThat(mps.get(7).name()).isEqualTo(\"address\");\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestMutableDerived.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport org.joda.beans.sample.MutableDerivedBean;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test mutable derived beans.\n */\nclass TestMutableDerived {\n\n    @Test\n    void test_mutableDerivedBean() {\n        MutableDerivedBean test = (MutableDerivedBean) MutableDerivedBean.builder()\n                .baseBeanString(\"HopeNotHate\")\n                .build();\n        assertThat(test.getBaseBeanString()).isEqualTo(\"HopeNotHate\");\n        assertThat(test.metaBean().metaPropertyCount()).isEqualTo(1);\n        assertThat(test.metaBean().metaPropertyMap().keySet().iterator().next()).isEqualTo(\"baseBeanString\");\n        assertThat(test.metaBean().baseBeanString().get(test)).isEqualTo(\"HopeNotHate\");\n\n        test.metaBean().baseBeanString().set(test, \"Now\");\n        assertThat(test.getBaseBeanString()).isEqualTo(\"Now\");\n        assertThat(test.metaBean().baseBeanString().get(test)).isEqualTo(\"Now\");\n\n        test.metaBean().baseBeanString().setString(test, \"Please\");\n        assertThat(test.getBaseBeanString()).isEqualTo(\"Please\");\n        assertThat(test.metaBean().baseBeanString().get(test)).isEqualTo(\"Please\");\n    }\n\n    @Test\n    void test_mutableDerivedBean_builder() {\n        MutableDerivedBean test = MutableDerivedBean.builder()\n                .set(\"baseBeanString\", \"HopeNotHate\")\n                .build();\n        assertThat(test.getBaseBeanString()).isEqualTo(\"HopeNotHate\");\n        assertThat(test.metaBean().metaPropertyCount()).isEqualTo(1);\n        assertThat(test.metaBean().metaPropertyMap().keySet().iterator().next()).isEqualTo(\"baseBeanString\");\n        assertThat(test.metaBean().baseBeanString().get(test)).isEqualTo(\"HopeNotHate\");\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestMutableListBeans.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport org.joda.beans.sample.MutableListFinalBean;\nimport org.joda.beans.sample.MutableListNonFinalBean;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test list with builder.\n */\nclass TestMutableListBeans {\n\n    @Test\n    void test_finalBean_noList() {\n        MutableListFinalBean test = MutableListFinalBean.builder().build();\n        assertThat(test.getStrings()).isNull();\n    }\n\n    @Test\n    void test_finalBean_list() {\n        MutableListFinalBean test = MutableListFinalBean.builder().strings(\"A\", \"B\").build();\n        assertThat(test.getStrings()).containsExactly(\"A\", \"B\");\n    }\n\n    @Test\n    void test_nonFinalBean_noList() {\n        MutableListNonFinalBean test = MutableListNonFinalBean.builder().build();\n        assertThat(test.getStrings()).isNull();\n    }\n\n    @Test\n    void test_nonFinalBean_list() {\n        MutableListNonFinalBean test = MutableListNonFinalBean.builder().strings(\"A\", \"B\").build();\n        assertThat(test.getStrings()).containsExactly(\"A\", \"B\");\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestOptionalBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport org.joda.beans.sample.ImmOptional;\nimport org.joda.beans.sample.ImmOptionalMeta;\nimport org.junit.jupiter.api.Test;\n\nimport com.google.common.base.Optional;\n\n/**\n * Test ImmOptional.\n */\nclass TestOptionalBean {\n\n    @Test\n    void test_optional_empty() {\n        ImmOptional test = ImmOptional.builder()\n            .optString(Optional.of(\"A\"))\n            .optStringGetter(\"A\")\n            .build();\n        assertThat(test.getOptString()).isEqualTo(Optional.of(\"A\"));\n        assertThat(test.getOptStringGetter()).isEqualTo(Optional.of(\"A\"));\n        assertThat(test.getOptDoubleGetter()).isEqualTo(Optional.absent());\n        assertThat(test.getOptIntGetter()).isEqualTo(Optional.absent());\n        assertThat(test.getOptLongGetter()).isEqualTo(Optional.absent());\n\n        // check that meta bean can be assigned to the metaImplements interface\n        ImmOptionalMeta<?> meta1 = ImmOptional.meta();\n        ImmOptionalMeta<?> meta2 = test.metaBean();\n        assertThat(meta1.optString().get(test)).isEqualTo(Optional.of(\"A\"));\n        assertThat(meta1.optStringGetter().get(test)).isEqualTo(\"A\");\n        assertThat(meta2.optDoubleGetter().get(test)).isNull();\n    }\n\n    @Test\n    void test_optional_full() {\n        ImmOptional test = ImmOptional.builder()\n            .optString(Optional.of(\"A\"))\n            .optDoubleGetter(1.2d)\n            .optIntGetter(3)\n            .optLongGetter(4L)\n            .build();\n        assertThat(test.getOptString()).isEqualTo(Optional.of(\"A\"));\n        assertThat(test.getOptDoubleGetter()).isEqualTo(Optional.of(1.2d));\n        assertThat(test.getOptIntGetter()).isEqualTo(Optional.of(3));\n        assertThat(test.getOptLongGetter()).isEqualTo(Optional.of(4L));\n    }\n\n    @Test\n    void test_optional_property() {\n        ImmOptional test = ImmOptional.builder()\n            .optStringGetter(\"A\")\n            .build();\n        assertThat(test.getOptStringGetter()).isEqualTo(Optional.of(\"A\"));\n        MetaProperty<Object> mp2 = test.metaBean().metaProperty(\"optStringGetter\");\n        assertThat(mp2.propertyType()).isEqualTo(String.class);\n        assertThat(mp2.propertyGenericType()).isEqualTo(String.class);\n        assertThat(mp2.declaringType()).isEqualTo(ImmOptional.class);\n        assertThat(mp2.get(test)).isEqualTo(\"A\");\n        assertThat(mp2.style()).isEqualTo(PropertyStyle.IMMUTABLE);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestPair.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport org.joda.beans.sample.Pair;\nimport org.joda.beans.sample.TweakedPair;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test Pair.\n */\nclass TestPair {\n\n    @Test\n    void test_equalsHashCode() {\n        // even though TwekedPair adds no new properties, we treat it as different\n        // this can be avoided (see Git history) but at a performance cost\n        Pair a1 = new Pair();\n        Pair a2 = new Pair();\n        TweakedPair b = new TweakedPair();\n        \n        a1.setFirst(\"A\");\n        a2.setFirst(\"A\");\n        b.setFirst(\"A\");\n        \n        assertThat(a1.equals(a1)).isTrue();\n        assertThat(a1.equals(a2)).isTrue();\n        assertThat(a2.equals(a1)).isTrue();\n        assertThat(a2.equals(a2)).isTrue();\n        assertThat(a1.hashCode()).isEqualTo(a2.hashCode());\n        \n        assertThat(a1.equals(b)).isFalse();\n        assertThat(b.equals(a1)).isFalse();\n        \n        Object obj = \"Weird type\";\n        assertThat(b.equals(obj)).isFalse();\n        assertThat(b.equals(null)).isFalse();\n    }\n\n    @Test\n    void test_toString() {\n        Pair test = new Pair();\n        test.setFirst(\"A\");\n        test.setSecond(\"B\");\n        assertThat(test).hasToString(\"Pair{first=A, second=B}\");\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestPerson.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans;\r\n\r\nimport static org.assertj.core.api.Assertions.assertThat;\r\nimport static org.assertj.core.api.Assertions.assertThatExceptionOfType;\r\n\r\nimport java.lang.annotation.Annotation;\r\nimport java.lang.reflect.ParameterizedType;\r\nimport java.lang.reflect.Type;\r\nimport java.util.List;\r\nimport java.util.Map;\r\nimport java.util.NoSuchElementException;\r\n\r\nimport org.joda.beans.gen.BeanDefinition;\r\nimport org.joda.beans.gen.PropertyDefinition;\r\nimport org.joda.beans.impl.flexi.FlexiBean;\r\nimport org.joda.beans.sample.AbstractResult;\r\nimport org.joda.beans.sample.Address;\r\nimport org.joda.beans.sample.ClassAnnotation;\r\nimport org.joda.beans.sample.Person;\r\nimport org.joda.beans.sample.SimpleAnnotation;\r\nimport org.junit.jupiter.api.Test;\r\n\r\n/**\r\n * Test property using Person.\r\n */\r\nclass TestPerson {\r\n\r\n    private static final int NUM_PROPERTIES = 8;\r\n    private static final String FORENAME = \"forename\";\r\n    private static final String SURNAME = \"surname\";\r\n    private static final String NUMBER_OF_CARS = \"numberOfCars\";\r\n\r\n    @Test\r\n    void test_bean() {\r\n        Bean test = Person.meta().builder().build();\r\n        \r\n        assertThat(test instanceof Person).isTrue();\r\n        \r\n        assertThat(test.metaBean()).isEqualTo(Person.meta());\r\n        \r\n        assertThat(test.propertyNames().contains(FORENAME)).isTrue();\r\n        assertThat(test.propertyNames().contains(SURNAME)).isTrue();\r\n        assertThat(test.propertyNames().contains(NUMBER_OF_CARS)).isTrue();\r\n        assertThat(test.propertyNames().contains(\"Rubbish\")).isFalse();\r\n        \r\n        assertThat(test.property(FORENAME).name()).isEqualTo(FORENAME);\r\n        assertThat(test.property(SURNAME).name()).isEqualTo(SURNAME);\r\n        assertThat(test.property(NUMBER_OF_CARS).name()).isEqualTo(NUMBER_OF_CARS);\r\n    }\r\n\r\n    @Test\r\n    void test_bean_invalidPropertyName() {\r\n        Bean test = Person.meta().builder().build();\r\n        assertThatExceptionOfType(NoSuchElementException.class)\r\n                .isThrownBy(() -> test.property(\"Rubbish\"));\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_metaBean() {\r\n        MetaBean test = Person.meta();\r\n        \r\n        assertThat(test.isBuildable()).isTrue();\r\n        assertThat(test.beanType()).isEqualTo(Person.class);\r\n        assertThat(test.beanName()).isEqualTo(Person.class.getName());\r\n        \r\n        assertThat(test.metaPropertyCount()).isEqualTo(NUM_PROPERTIES);\r\n        \r\n        assertThat(test.metaPropertyExists(FORENAME)).isTrue();\r\n        assertThat(test.metaPropertyExists(SURNAME)).isTrue();\r\n        assertThat(test.metaPropertyExists(NUMBER_OF_CARS)).isTrue();\r\n        assertThat(test.metaPropertyExists(\"Rubbish\")).isFalse();\r\n        \r\n        assertThat(test.metaProperty(FORENAME).name()).isEqualTo(FORENAME);\r\n        assertThat(test.metaProperty(SURNAME).name()).isEqualTo(SURNAME);\r\n        assertThat(test.metaProperty(NUMBER_OF_CARS).name()).isEqualTo(NUMBER_OF_CARS);\r\n        \r\n        Map<String, MetaProperty<?>> map = test.metaPropertyMap();\r\n        assertThat(map.size()).isEqualTo(NUM_PROPERTIES);\r\n        assertThat(map.containsKey(FORENAME)).isTrue();\r\n        assertThat(map.containsKey(SURNAME)).isTrue();\r\n        assertThat(map.containsKey(NUMBER_OF_CARS)).isTrue();\r\n    }\r\n\r\n    @Test\r\n    void test_metaBean_invalidPropertyName() {\r\n        MetaBean test = Person.meta();\r\n        assertThatExceptionOfType(NoSuchElementException.class)\r\n                .isThrownBy(() -> test.metaProperty(\"Rubbish\"));\r\n    }\r\n\r\n    @Test\r\n    void test_metaProperty_annotation_notFound() {\r\n        MetaProperty<FlexiBean> prop = Person.meta().extensions();\r\n        assertThatExceptionOfType(NoSuchElementException.class)\r\n            .isThrownBy(() -> prop.annotation(ClassAnnotation.class));\r\n        assertThat(prop.annotationOpt(ClassAnnotation.class)).isEmpty();\r\n    }\r\n\r\n    @Test\r\n    void test_metaBean_abstract() {\r\n        MetaBean test = AbstractResult.meta();\r\n        \r\n        assertThat(test.isBuildable()).isFalse();\r\n        assertThat(test.beanType()).isEqualTo(AbstractResult.class);\r\n        assertThat(test.beanName()).isEqualTo(AbstractResult.class.getName());\r\n        \r\n        assertThat(test.metaPropertyCount()).isEqualTo(2);\r\n        \r\n        assertThat(test.metaPropertyExists(\"docs\")).isTrue();\r\n        assertThat(test.metaPropertyExists(\"Rubbish\")).isFalse();\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_namedPropertyMethod() {\r\n        Person person = new Person();\r\n        Property<String> test = person.forename();\r\n        \r\n        assertThat((Object) test.bean()).isSameAs(person);\r\n        assertThat(test.metaProperty()).isSameAs(Person.meta().forename());\r\n        \r\n        assertThat(test.get()).isNull();\r\n        person.setForename(\"A\");\r\n        assertThat(test.get()).isEqualTo(\"A\");\r\n        test.set(\"B\");\r\n        assertThat(test.get()).isEqualTo(\"B\");\r\n        assertThat(test.put(\"C\")).isEqualTo(\"B\");\r\n        assertThat(test.get()).isEqualTo(\"C\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_property_String() {\r\n        Person person = new Person();\r\n        Property<String> test = person.property(FORENAME);\r\n        \r\n        assertThat((Object) test.bean()).isSameAs(person);\r\n        assertThat(test.metaProperty()).isSameAs(Person.meta().forename());\r\n        \r\n        assertThat(test.get()).isNull();\r\n        person.setForename(\"A\");\r\n        assertThat(test.get()).isEqualTo(\"A\");\r\n        test.set(\"B\");\r\n        assertThat(test.get()).isEqualTo(\"B\");\r\n        assertThat(test.put(\"C\")).isEqualTo(\"B\");\r\n        assertThat(test.get()).isEqualTo(\"C\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_namedMetaPropertyMethod() {\r\n        Person person = new Person();\r\n        MetaProperty<String> test = Person.meta().forename();\r\n        \r\n        assertThat(test.metaBean().beanType()).isEqualTo(Person.class);\r\n        assertThat(test.propertyType()).isEqualTo(String.class);\r\n        assertThat(test.name()).isSameAs(FORENAME);\r\n        assertThat(test.style()).isEqualTo(PropertyStyle.READ_WRITE);\r\n        \r\n        assertThat(test.get(person)).isNull();\r\n        person.setForename(\"A\");\r\n        assertThat(test.get(person)).isEqualTo(\"A\");\r\n        test.set(person, \"B\");\r\n        assertThat(test.get(person)).isEqualTo(\"B\");\r\n        assertThat(test.put(person, \"C\")).isEqualTo(\"B\");\r\n        assertThat(test.get(person)).isEqualTo(\"C\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_metaProperty_String() {\r\n        Person person = new Person();\r\n        MetaProperty<String> test = Person.meta().metaProperty(FORENAME);\r\n        \r\n        assertThat(test.metaBean().beanType()).isEqualTo(Person.class);\r\n        assertThat(test.propertyType()).isEqualTo(String.class);\r\n        assertThat(test.name()).isSameAs(FORENAME);\r\n        assertThat(test.style()).isEqualTo(PropertyStyle.READ_WRITE);\r\n        \r\n        assertThat(test.get(person)).isNull();\r\n        person.setForename(\"A\");\r\n        assertThat(test.get(person)).isEqualTo(\"A\");\r\n        test.set(person, \"B\");\r\n        assertThat(test.get(person)).isEqualTo(\"B\");\r\n        assertThat(test.put(person, \"C\")).isEqualTo(\"B\");\r\n        assertThat(test.get(person)).isEqualTo(\"C\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_metaProperty_types_addressList() {\r\n        MetaProperty<List<Address>> test = Person.meta().addressList();\r\n        \r\n        assertThat(test.metaBean().beanType()).isEqualTo(Person.class);\r\n        assertThat(test.propertyType()).isEqualTo(List.class);\r\n        assertThat(test.propertyGenericType()).isInstanceOf(ParameterizedType.class);\r\n        ParameterizedType pt = (ParameterizedType) test.propertyGenericType();\r\n        assertThat(pt.getRawType()).isEqualTo(List.class);\r\n        assertThat(pt.getOwnerType()).isNull();\r\n        Type[] actualTypes = pt.getActualTypeArguments();\r\n        assertThat(actualTypes.length).isEqualTo(1);\r\n        assertThat(actualTypes[0]).isEqualTo(Address.class);\r\n    }\r\n\r\n    @Test\r\n    void test_BeanUtils_addressList() {\r\n        MetaProperty<List<Address>> test = Person.meta().addressList();\r\n        \r\n        assertThat(test.metaBean().beanType()).isEqualTo(Person.class);\r\n        assertThat(test.propertyType()).isEqualTo(List.class);\r\n        assertThat(test.propertyGenericType()).isInstanceOf(ParameterizedType.class);\r\n        ParameterizedType pt = (ParameterizedType) test.propertyGenericType();\r\n        assertThat(pt.getRawType()).isEqualTo(List.class);\r\n        assertThat(pt.getOwnerType()).isNull();\r\n        Type[] actualTypes = pt.getActualTypeArguments();\r\n        assertThat(actualTypes.length).isEqualTo(1);\r\n        assertThat(actualTypes[0]).isEqualTo(Address.class);\r\n    }\r\n\r\n    @Test\r\n    void test_metaProperty_types_otherAddressMap() {\r\n        MetaProperty<Map<String, Address>> test = Person.meta().otherAddressMap();\r\n        \r\n        assertThat(test.metaBean().beanType()).isEqualTo(Person.class);\r\n        assertThat(test.propertyType()).isEqualTo(Map.class);\r\n        assertThat(test.propertyGenericType()).isInstanceOf(ParameterizedType.class);\r\n        ParameterizedType pt = (ParameterizedType) test.propertyGenericType();\r\n        assertThat(pt.getRawType()).isEqualTo(Map.class);\r\n        assertThat(pt.getOwnerType()).isNull();\r\n        Type[] actualTypes = pt.getActualTypeArguments();\r\n        assertThat(actualTypes.length).isEqualTo(2);\r\n        assertThat(actualTypes[0]).isEqualTo(String.class);\r\n        assertThat(actualTypes[1]).isEqualTo(Address.class);\r\n    }\r\n\r\n    @Test\r\n    void test_metaProperty_annotations_addressList() {\r\n        MetaProperty<List<Address>> prop = Person.meta().addressList();\r\n        List<Annotation> test = prop.annotations();\r\n        \r\n        assertThat(test.size()).isEqualTo(1);\r\n        assertThat(test.get(0) instanceof PropertyDefinition).isTrue();\r\n    }\r\n\r\n    @Test\r\n    void test_metaProperty_annotations_extensions() {\r\n        MetaProperty<FlexiBean> prop = Person.meta().extensions();\r\n        List<Annotation> annos = prop.annotations();\r\n        \r\n        assertThat(annos.size()).isEqualTo(2);\r\n        assertThat(annos.get(0) instanceof PropertyDefinition).isTrue();\r\n        assertThat(annos.get(1) instanceof SimpleAnnotation).isTrue();\r\n        assertThat(prop.annotation(PropertyDefinition.class).get()).isEqualTo(\"smart\");\r\n        assertThat(prop.annotationOpt(PropertyDefinition.class)).isPresent();\r\n        assertThat(prop.annotationOpt(SimpleAnnotation.class)).isPresent();\r\n    }\r\n\r\n    @Test\r\n    void test_metaBean_annotations() {\r\n        Person.Meta meta = Person.meta();\r\n        List<Annotation> annos = meta.annotations();\r\n        \r\n        assertThat(annos.size()).isEqualTo(2);\r\n        assertThat(annos.get(0) instanceof BeanDefinition).isTrue();\r\n        assertThat(annos.get(1) instanceof ClassAnnotation).isTrue();\r\n        assertThat(meta.annotation(BeanDefinition.class).builderScope()).isEqualTo(\"smart\");\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestPropertyPath.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;\n\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.ImmAddress;\nimport org.joda.beans.sample.ImmPerson;\nimport org.joda.beans.sample.Person;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test {@link PropertyPath}.\n */\nclass TestPropertyPath {\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_get() {\n        Person person1 = new Person();\n        person1.setForename(\"Angus\");\n        Address address1 = new Address();\n        address1.setNumber(1);\n        address1.setOwner(person1);\n        Person person2 = new Person();\n        person2.setForename(\"Bob\");\n        Address address2 = new Address();\n        address2.setNumber(2);\n        address2.setOwner(person2);\n        Map<String, Address> addrMap = new HashMap<>();\n        addrMap.put(\"Main\", address1);\n        addrMap.put(\"Other\", address2);\n        Date date = new Date();\n        ImmPerson base = ImmPerson.builder()\n                .forename(\"Zach\")\n                .surname(\"Tidy\")\n                .dateOfBirth(date)\n                .mainAddress(ImmAddress.builder()\n                        .street(\"My Street\")\n                        .city(\"Nodnol\")\n                        .owner(ImmPerson.builder()\n                                .forename(\"Zoe\")\n                                .surname(\"Tidy\")\n                                .build())\n                        .build())\n                .addressList(address1, address2)\n                .otherAddressMap(addrMap)\n                .build();\n\n        assertThatIllegalArgumentException().isThrownBy(() -> PropertyPath.of(\"rubbish[]\", String.class));\n\n        assertThat(PropertyPath.of(\"rubbish\", String.class).get(base)).isEmpty();\n        assertThat(PropertyPath.of(\"rubbish[0]\", String.class).get(base)).isEmpty();\n        assertThat(PropertyPath.of(\"rubbish[-1]\", String.class).get(base)).isEmpty();\n        assertThat(PropertyPath.of(\"rubbish[Main]\", String.class).get(base)).isEmpty();\n\n        assertThat(PropertyPath.of(\"forename\", String.class).get(base)).hasValue(\"Zach\");\n        assertThat(PropertyPath.of(\"forename.rubbish\", String.class).get(base)).isEmpty();\n        assertThat(PropertyPath.of(\"surname\", String.class).get(base)).hasValue(\"Tidy\");\n        assertThat(PropertyPath.of(\"dateOfBirth\", Date.class).get(base)).hasValue(date);\n\n        assertThat(PropertyPath.of(\"mainAddress.city\", String.class).get(base)).hasValue(\"Nodnol\");\n        assertThat(PropertyPath.of(\"mainAddress[0].city\", String.class).get(base)).hasValue(\"Nodnol\");\n        assertThat(PropertyPath.of(\"mainAddress[1].city\", String.class).get(base)).isEmpty();\n        assertThat(PropertyPath.of(\"mainAddress[-1].city\", String.class).get(base)).isEmpty();\n        assertThat(PropertyPath.of(\"mainAddress[Other].city\", String.class).get(base)).isEmpty();\n\n        assertThat(PropertyPath.of(\"addressList\", Address.class).get(base)).hasValue(address1);\n        assertThat(PropertyPath.of(\"addressList[0]\", Address.class).get(base)).hasValue(address1);\n        assertThat(PropertyPath.of(\"addressList[1]\", Address.class).get(base)).hasValue(address2);\n        assertThat(PropertyPath.of(\"addressList[2]\", Address.class).get(base)).isEmpty();\n        assertThat(PropertyPath.of(\"addressList[-1]\", Address.class).get(base)).isEmpty();\n        assertThat(PropertyPath.of(\"addressList[Main]\", Address.class).get(base)).isEmpty();\n\n        assertThat(PropertyPath.of(\"otherAddressMap\", Address.class).get(base)).hasValue(address1);\n        assertThat(PropertyPath.of(\"otherAddressMap[Main]\", Address.class).get(base)).hasValue(address1);\n        assertThat(PropertyPath.of(\"otherAddressMap[Other]\", Address.class).get(base)).hasValue(address2);\n        assertThat(PropertyPath.of(\"otherAddressMap[Rubbish]\", Address.class).get(base)).isEmpty();\n        assertThat(PropertyPath.of(\"otherAddressMap.number\", Integer.class).get(base)).hasValue(1);\n        assertThat(PropertyPath.of(\"otherAddressMap[Main].number\", Integer.class).get(base)).hasValue(1);\n        assertThat(PropertyPath.of(\"otherAddressMap[Other].number\", Integer.class).get(base)).hasValue(2);\n        assertThat(PropertyPath.of(\"otherAddressMap.owner.forename\", String.class).get(base)).hasValue(\"Angus\");\n        assertThat(PropertyPath.of(\"otherAddressMap[Other].owner.forename\", String.class).get(base)).hasValue(\"Bob\");\n\n        assertThat(PropertyPath.of(\"otherAddressMap[Other].owner.forename\", String.class))\n                .hasToString(\"otherAddressMap[Other].owner.forename: java.lang.String\");\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestPropertyStyle.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test {@link PropertyStyle}.\n */\nclass TestPropertyStyle {\n\n    @Test\n    void test_READ_ONLY() {\n        assertThat(PropertyStyle.READ_ONLY.isReadable()).isTrue();\n        assertThat(PropertyStyle.READ_ONLY.isWritable()).isFalse();\n        assertThat(PropertyStyle.READ_ONLY.isBuildable()).isFalse();\n        assertThat(PropertyStyle.READ_ONLY.isReadOnly()).isTrue();\n        assertThat(PropertyStyle.READ_ONLY.isDerived()).isFalse();\n        assertThat(PropertyStyle.READ_ONLY.isSerializable()).isFalse();\n    }\n\n    @Test\n    void test_READ_WRITE() {\n        assertThat(PropertyStyle.READ_WRITE.isReadable()).isTrue();\n        assertThat(PropertyStyle.READ_WRITE.isWritable()).isTrue();\n        assertThat(PropertyStyle.READ_WRITE.isBuildable()).isTrue();\n        assertThat(PropertyStyle.READ_WRITE.isReadOnly()).isFalse();\n        assertThat(PropertyStyle.READ_WRITE.isDerived()).isFalse();\n        assertThat(PropertyStyle.READ_WRITE.isSerializable()).isTrue();\n    }\n\n    @Test\n    void test_WRITE_ONLY() {\n        assertThat(PropertyStyle.WRITE_ONLY.isReadable()).isFalse();\n        assertThat(PropertyStyle.WRITE_ONLY.isWritable()).isTrue();\n        assertThat(PropertyStyle.WRITE_ONLY.isBuildable()).isTrue();\n        assertThat(PropertyStyle.WRITE_ONLY.isReadOnly()).isFalse();\n        assertThat(PropertyStyle.WRITE_ONLY.isDerived()).isFalse();\n        assertThat(PropertyStyle.WRITE_ONLY.isSerializable()).isFalse();\n    }\n\n    @Test\n    void test_DERIVED() {\n        assertThat(PropertyStyle.DERIVED.isReadable()).isTrue();\n        assertThat(PropertyStyle.DERIVED.isWritable()).isFalse();\n        assertThat(PropertyStyle.DERIVED.isBuildable()).isFalse();\n        assertThat(PropertyStyle.DERIVED.isReadOnly()).isTrue();\n        assertThat(PropertyStyle.DERIVED.isDerived()).isTrue();\n        assertThat(PropertyStyle.DERIVED.isSerializable()).isFalse();\n    }\n\n    @Test\n    void test_IMMUTABLE() {\n        assertThat(PropertyStyle.IMMUTABLE.isReadable()).isTrue();\n        assertThat(PropertyStyle.IMMUTABLE.isWritable()).isFalse();\n        assertThat(PropertyStyle.IMMUTABLE.isBuildable()).isTrue();\n        assertThat(PropertyStyle.IMMUTABLE.isReadOnly()).isTrue();\n        assertThat(PropertyStyle.IMMUTABLE.isDerived()).isFalse();\n        assertThat(PropertyStyle.IMMUTABLE.isSerializable()).isTrue();\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestRecordBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatExceptionOfType;\n\nimport java.lang.invoke.MethodHandles;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.impl.RecordBean;\nimport org.joda.beans.sample.Pair;\nimport org.joda.beans.sample.RecordStrIntPair;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test RecordBean.\n */\nclass TestRecordBean {\n\n    private static record StringLongPair(String first, long second) implements RecordBean<StringLongPair> {\n        static {\n            RecordBean.register(StringLongPair.class, MethodHandles.lookup());\n        }\n    }\n\n    @Test\n    void test_metaBean_public() {\n        var test = new RecordStrIntPair(\"A\", 1);\n        assertThat(test.first()).isEqualTo(\"A\");\n        assertThat(test.second()).isEqualTo(1);\n\n        var meta = test.metaBean();\n        assertThat(meta.isBuildable()).isTrue();\n        assertThat(meta.beanType()).isEqualTo(RecordStrIntPair.class);\n        assertThat(meta.metaPropertyCount()).isEqualTo(2);\n\n        var mp1 = meta.metaProperty(\"first\");\n        assertThat(mp1.name()).isEqualTo(\"first\");\n        assertThat(mp1.declaringType()).isEqualTo(RecordStrIntPair.class);\n        assertThat(mp1.metaBean()).isSameAs(meta);\n        assertThat(mp1.get(test)).isEqualTo(\"A\");\n        assertThat(mp1.propertyType()).isEqualTo(String.class);\n        assertThat(mp1.style()).isEqualTo(PropertyStyle.IMMUTABLE);\n\n        var mp2 = meta.metaProperty(\"second\");\n        assertThat(mp2.name()).isEqualTo(\"second\");\n        assertThat(mp2.declaringType()).isEqualTo(RecordStrIntPair.class);\n        assertThat(mp2.metaBean()).isSameAs(meta);\n        assertThat(mp2.get(test)).isEqualTo(1);\n        assertThat(mp2.propertyType()).isEqualTo(int.class);\n        assertThat(mp2.style()).isEqualTo(PropertyStyle.IMMUTABLE);\n\n        assertThat(mp1).isEqualTo(mp1)\n                .isNotEqualTo(mp2)\n                .isNotEqualTo(\"\")\n                .isNotEqualTo(Pair.meta().first())\n                .hasSameHashCodeAs(mp1)\n                .doesNotHaveSameHashCodeAs(mp2);\n\n        var builder = meta.builder();\n        builder.set(\"first\", \"B\");\n        builder.set(\"second\", 2);\n        assertThat(builder.get(\"first\")).isEqualTo(\"B\");\n        assertThat(builder.get(mp1)).isEqualTo(\"B\");\n        assertThat(builder.build()).isEqualTo(new RecordStrIntPair(\"B\", 2));\n\n        builder.set(mp1, \"A\");\n        assertThat(builder.build()).isEqualTo(new RecordStrIntPair(\"A\", 2));\n\n        assertThatExceptionOfType(NoSuchElementException.class)\n                .isThrownBy(() -> builder.get(\"foo\"));\n        assertThatExceptionOfType(NoSuchElementException.class)\n                .isThrownBy(() -> builder.set(\"foo\", \"\"));\n\n        var json = JodaBeanSer.PRETTY.jsonWriter().write(test);\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        assertThat(parsed).isEqualTo(test);\n    }\n\n    @Test\n    void test_metaBean_private() {\n        var test = new StringLongPair(\"A\", 1L);\n        assertThat(test.first()).isEqualTo(\"A\");\n        assertThat(test.second()).isEqualTo(1L);\n\n        var meta = test.metaBean();\n        assertThat(meta.isBuildable()).isTrue();\n        assertThat(meta.beanType()).isEqualTo(StringLongPair.class);\n        assertThat(meta.metaPropertyCount()).isEqualTo(2);\n        \n        var mp1 = meta.metaProperty(\"first\");\n        assertThat(mp1.name()).isEqualTo(\"first\");\n        assertThat(mp1.declaringType()).isEqualTo(StringLongPair.class);\n        assertThat(mp1.metaBean()).isSameAs(meta);\n        assertThat(mp1.get(test)).isEqualTo(\"A\");\n        assertThat(mp1.propertyType()).isEqualTo(String.class);\n        assertThat(mp1.style()).isEqualTo(PropertyStyle.IMMUTABLE);\n\n        var mp2 = meta.metaProperty(\"second\");\n        assertThat(mp2.name()).isEqualTo(\"second\");\n        assertThat(mp2.declaringType()).isEqualTo(StringLongPair.class);\n        assertThat(mp2.metaBean()).isSameAs(meta);\n        assertThat(mp2.get(test)).isEqualTo(1L);\n        assertThat(mp2.propertyType()).isEqualTo(long.class);\n        assertThat(mp2.style()).isEqualTo(PropertyStyle.IMMUTABLE);\n\n        assertThat(mp1).isEqualTo(mp1)\n                .isNotEqualTo(mp2)\n                .isNotEqualTo(\"\")\n                .isNotEqualTo(Pair.meta().first())\n                .hasSameHashCodeAs(mp1)\n                .doesNotHaveSameHashCodeAs(mp2);\n\n        var builder = meta.builder();\n        builder.set(\"first\", \"B\");\n        builder.set(\"second\", 2L);\n        assertThat(builder.get(\"first\")).isEqualTo(\"B\");\n        assertThat(builder.get(mp1)).isEqualTo(\"B\");\n        assertThat(builder.build()).isEqualTo(new StringLongPair(\"B\", 2L));\n\n        builder.set(mp1, \"A\");\n        assertThat(builder.build()).isEqualTo(new StringLongPair(\"A\", 2L));\n\n        assertThatExceptionOfType(NoSuchElementException.class)\n                .isThrownBy(() -> builder.get(\"foo\"));\n        assertThatExceptionOfType(NoSuchElementException.class)\n                .isThrownBy(() -> builder.set(\"foo\", \"\"));\n\n        var json = JodaBeanSer.PRETTY.jsonWriter().write(test);\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        assertThat(parsed).isEqualTo(test);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestReflective.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport org.joda.beans.impl.StandaloneMetaProperty;\nimport org.joda.beans.sample.ReflectiveMutable;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test {@code ReflectiveMetaBean}.\n */\nclass TestReflective {\n\n    @Test\n    void test_mutable() {\n        ReflectiveMutable bean = ReflectiveMutable.META_BEAN.builder()\n                .set(\"number\", 12)\n                .set(\"street\", \"Park Lane\")\n                .set(StandaloneMetaProperty.of(\"city\", ReflectiveMutable.META_BEAN, String.class), \"Smallville\")\n                .build();\n        \n        assertThat(bean.getNumber()).isEqualTo(12);\n        assertThat(bean.getCity()).isEqualTo(\"Smallville\");\n        assertThat(bean.getStreet()).isEqualTo(\"Park Lane\");\n        \n        bean.setCity(\"Nodnol\");\n        assertThat(bean.getCity()).isEqualTo(\"Nodnol\");\n        \n        bean.property(\"city\").set(\"Paris\");\n        assertThat(bean.getCity()).isEqualTo(\"Paris\");\n        \n        bean.metaBean().metaProperty(\"city\").set(bean, \"London\");\n        assertThat(bean.getCity()).isEqualTo(\"London\");\n        \n        assertThat(bean.metaBean().beanType()).isEqualTo(ReflectiveMutable.class);\n        assertThat(bean.metaBean().metaPropertyCount()).isEqualTo(4);\n        assertThat(bean.metaBean().metaPropertyExists(\"number\")).isTrue();\n        assertThat(bean.metaBean().metaPropertyExists(\"foobar\")).isFalse();\n        \n        MetaProperty<Object> mp = bean.metaBean().metaProperty(\"number\");\n        assertThat(mp.propertyType()).isEqualTo(int.class);\n        assertThat(mp.declaringType()).isEqualTo(ReflectiveMutable.class);\n        assertThat(mp.get(bean)).isEqualTo(12);\n        assertThat(mp.style()).isEqualTo(PropertyStyle.READ_WRITE);\n        \n        MetaProperty<Object> mp2 = bean.metaBean().metaProperty(\"street\");\n        assertThat(mp2.propertyType()).isEqualTo(String.class);\n        assertThat(mp2.propertyGenericType()).isEqualTo(String.class);\n        assertThat(mp2.declaringType()).isEqualTo(ReflectiveMutable.class);\n        assertThat(mp2.get(bean)).isEqualTo(\"Park Lane\");\n        assertThat(mp2.style()).isEqualTo(PropertyStyle.READ_WRITE);\n        \n        assertThat(JodaBeanSer.PRETTY.xmlWriter().write(bean)).contains(\"<street>Park Lane<\");\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestResolvedType.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;\n\nimport java.io.Serializable;\nimport java.lang.reflect.Type;\nimport java.math.BigDecimal;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.function.Predicate;\nimport java.util.regex.Pattern;\n\nimport org.joda.beans.sample.AbstractResult;\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.AddressResult;\nimport org.joda.beans.sample.CompanyAddress;\nimport org.joda.beans.sample.CompanyAddressMidResult;\nimport org.joda.beans.sample.CompanyAddressResult;\nimport org.joda.beans.sample.DoubleGenericsNoExtendsNoSuper;\nimport org.joda.beans.sample.DoubleGenericsWithExtendsNoSuper;\nimport org.joda.beans.sample.GenericArray;\nimport org.joda.beans.sample.GenericInterfaceBase;\nimport org.joda.beans.sample.GenericInterfaceChild;\nimport org.joda.beans.sample.GenericInterfaceImpl;\nimport org.joda.beans.sample.GenericInterfaceMid;\nimport org.joda.beans.sample.ImmAddress;\nimport org.joda.beans.sample.ImmArrays;\nimport org.joda.beans.sample.ImmGuava;\nimport org.joda.beans.sample.ImmPerson;\nimport org.joda.beans.sample.MidAbstractResult;\nimport org.joda.beans.sample.Person;\nimport org.joda.beans.sample.RiskLevel;\nimport org.joda.beans.sample.SubDecimal;\nimport org.joda.convert.StringConvert;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.params.ParameterizedTest;\nimport org.junit.jupiter.params.provider.MethodSource;\n\nimport com.google.common.collect.ImmutableList;\nimport com.google.common.collect.ImmutableMap;\nimport com.google.common.collect.ImmutableMultiset;\n\n/**\n * Test {@link ResolvedType}.\n */\nclass TestResolvedType {\n    \n    private static final Predicate<String> HIDDEN_CLASS_PREDICATE = String::isEmpty;\n\n    static Object[][] data_resolvedTypes() {\n        return new Object[][] {\n                {ResolvedType.of(String.class),\n                        String.class, List.of(),\n                        \"String\"},\n                {ResolvedType.of(List.class),\n                        List.class, List.of(),\n                        \"List\"},\n                {ResolvedType.from(String.class),\n                        String.class, List.of(),\n                        \"String\"},\n                {ResolvedType.from(List.class),\n                        List.class, List.of(ResolvedType.OBJECT),\n                        \"List<Object>\"},\n                {ResolvedType.ofFlat(String.class),\n                        String.class, List.of(),\n                        \"String\"},\n                {ResolvedType.ofFlat(List.class, String.class),\n                        List.class, List.of(ResolvedType.of(String.class)),\n                        \"List<String>\"},\n                {ResolvedType.ofFlat(List.class, int.class),\n                            List.class, List.of(ResolvedType.of(int.class)),\n                            \"List<int>\"},\n                {ResolvedType.of(List.class, ResolvedType.STRING),\n                        List.class, List.of(ResolvedType.of(String.class)),\n                        \"List<String>\"},\n                {ResolvedType.ofFlat(Map.class, String.class, Number.class),\n                        Map.class, List.of(ResolvedType.of(String.class), ResolvedType.of(Number.class)),\n                        \"Map<String, Number>\"},\n                {ResolvedType.of(String[].class),\n                        String[].class, List.of(),\n                        \"String[]\"},\n                {ResolvedType.of(List[].class),\n                        List[].class, List.of(),\n                        \"List[]\"},\n                {ResolvedType.ofFlat(List[].class, String.class),\n                        List[].class, List.of(ResolvedType.of(String.class)),\n                        \"List<String>[]\"},\n                {ResolvedType.of(String[][].class),\n                        String[][].class, List.of(),\n                        \"String[][]\"},\n                {ResolvedType.ofFlat(List[][].class, String.class),\n                        List[][].class, List.of(ResolvedType.of(String.class)),\n                        \"List<String>[][]\"},\n                {ResolvedType.from(List[][].class),\n                        List[][].class, List.of(ResolvedType.of(Object.class)),\n                        \"List<Object>[][]\"},\n                {ResolvedType.ofFlat(Map[].class, String.class, List[].class),\n                        Map[].class, List.of(ResolvedType.STRING, ResolvedType.of(List[].class)),\n                        \"Map<String, List[]>[]\"},\n                {ResolvedType.of(Map[].class, ResolvedType.STRING, ResolvedType.ofFlat(List[].class, Number.class)),\n                        Map[].class, List.of(ResolvedType.STRING, ResolvedType.of(List[].class, ResolvedType.of(Number.class))),\n                        \"Map<String, List<Number>[]>[]\"},\n                {ResolvedType.from(Person.meta().addressList().propertyGenericType(), Person.class),\n                        List.class, List.of(ResolvedType.of(Address.class)),\n                        \"List<org.joda.beans.sample.Address>\"},\n                {ResolvedType.from(Person.meta().addressesList().propertyGenericType(), Person.class),\n                        List.class, List.of(ResolvedType.ofFlat(List.class, Address.class)),\n                        \"List<List<org.joda.beans.sample.Address>>\"},\n                {ResolvedType.from(ImmPerson.meta().codeCounts().propertyGenericType(), ImmPerson.class),\n                        ImmutableMultiset.class, List.of(ResolvedType.of(String.class)),\n                        \"com.google.common.collect.ImmutableMultiset<String>\"},\n                {ResolvedType.from(ImmAddress.meta().listNumericInMap().propertyGenericType(), ImmAddress.class),\n                        ImmutableMap.class, List.of(ResolvedType.of(String.class), ResolvedType.ofFlat(List.class, Integer.class)),\n                        \"com.google.common.collect.ImmutableMap<String, List<Integer>>\"},\n                {ResolvedType.from(ImmGuava.meta().mapWildKey().propertyGenericType(), ImmGuava.class),\n                        ImmutableMap.class, List.of(ResolvedType.of(Number.class), ResolvedType.of(String.class)),\n                        \"com.google.common.collect.ImmutableMap<Number, String>\"},\n                {ResolvedType.from(ImmGuava.meta().listWildExtendsComparable().propertyGenericType(), ImmGuava.class),\n                        ImmutableList.class, List.of(ResolvedType.ofFlat(Comparable.class, Object.class)),\n                        \"com.google.common.collect.ImmutableList<java.lang.Comparable<Object>>\"},\n                {ResolvedType.from(ImmGuava.meta().listWildExtendsT().propertyGenericType(), ImmGuava.class),\n                        ImmutableList.class, List.of(ResolvedType.of(Comparable.class, ResolvedType.of(Object.class))),\n                        \"com.google.common.collect.ImmutableList<java.lang.Comparable<Object>>\"},\n                {ResolvedType.from(AddressResult.meta().docs().propertyGenericType(), AddressResult.class),\n                        List.class, List.of(ResolvedType.of(Address.class)),\n                        \"List<org.joda.beans.sample.Address>\"},\n                {ResolvedType.from(AddressResult.meta().docs().propertyGenericType(), CompanyAddressResult.class),\n                        List.class, List.of(ResolvedType.of(CompanyAddress.class)),\n                        \"List<org.joda.beans.sample.CompanyAddress>\"},\n                {ResolvedType.from(AddressResult.meta().docs().propertyGenericType(), MidAbstractResult.class),\n                        List.class, List.of(ResolvedType.of(Address.class)),\n                        \"List<org.joda.beans.sample.Address>\"},\n                {ResolvedType.from(AddressResult.meta().docs().propertyGenericType(), CompanyAddressMidResult.class),\n                        List.class, List.of(ResolvedType.of(CompanyAddress.class)),\n                        \"List<org.joda.beans.sample.CompanyAddress>\"},\n                {ResolvedType.from(ImmArrays.meta().intArray().propertyGenericType(), ImmArrays.class),\n                        int[].class, List.of(),\n                        \"int[]\"},\n                {ResolvedType.from(GenericArray.meta().values().propertyGenericType(), GenericArray.class),\n                        Address[].class, List.of(),\n                        \"org.joda.beans.sample.Address[]\"},\n                {ResolvedType.from(\n                        DoubleGenericsNoExtendsNoSuper.meta().typeTArray().propertyGenericType(),\n                        DoubleGenericsNoExtendsNoSuper.class),\n                        Object[].class, List.of(),\n                        \"Object[]\"},\n                {ResolvedType.from(\n                        DoubleGenericsWithExtendsNoSuper.meta().typeTArray().propertyGenericType(),\n                        DoubleGenericsWithExtendsNoSuper.class),\n                        Serializable[].class, List.of(),\n                        \"java.io.Serializable[]\"},\n                {ResolvedType.from(\n                        DoubleGenericsWithExtendsNoSuper.meta().typeTArrayOfList().propertyGenericType(),\n                        DoubleGenericsWithExtendsNoSuper.class),\n                        List[].class, List.of(ResolvedType.of(Serializable.class)),\n                        \"List<java.io.Serializable>[]\"},\n                {ResolvedType.from(\n                        DoubleGenericsWithExtendsNoSuper.meta().typeTArray2dOfList().propertyGenericType(),\n                        DoubleGenericsWithExtendsNoSuper.class),\n                        List[][].class, List.of(ResolvedType.of(Serializable.class)),\n                        \"List<java.io.Serializable>[][]\"},\n                {ResolvedType.from(GenericInterfaceBase.class.getMethods()[0].getGenericReturnType(), GenericInterfaceBase.class),\n                        List.class, List.of(ResolvedType.of(Serializable.class)),\n                        \"List<java.io.Serializable>\"},\n                {ResolvedType.from(GenericInterfaceBase.class.getMethods()[0].getGenericReturnType(), GenericInterfaceChild.class),\n                        List.class, List.of(ResolvedType.of(Number.class)),\n                        \"List<Number>\"},\n                {ResolvedType.from(GenericInterfaceBase.class.getMethods()[0].getGenericReturnType(), GenericInterfaceMid.class),\n                        List.class, List.of(ResolvedType.of(BigDecimal.class)),\n                        \"List<java.math.BigDecimal>\"},\n                {ResolvedType.from(GenericInterfaceBase.class.getMethods()[0].getGenericReturnType(), GenericInterfaceImpl.class),\n                        List.class, List.of(ResolvedType.of(SubDecimal.class)),\n                        \"List<org.joda.beans.sample.SubDecimal>\"},\n                {ResolvedType.from(List.class, Object.class),\n                        List.class, List.of(ResolvedType.of(Object.class)),\n                        \"List<Object>\"},\n                {ResolvedType.from(List.class, Object.class),\n                        List.class, List.of(ResolvedType.of(Object.class)),\n                        \"List<Object>\"},\n                {ResolvedType.from(AbstractResult.class, AbstractResult.class),\n                        AbstractResult.class, List.of(ResolvedType.of(Address.class)),\n                        \"org.joda.beans.sample.AbstractResult<org.joda.beans.sample.Address>\"},\n                {ResolvedType.from(AbstractResult.class, CompanyAddressResult.class),\n                        AbstractResult.class, List.of(ResolvedType.of(CompanyAddress.class)),\n                        \"org.joda.beans.sample.AbstractResult<org.joda.beans.sample.CompanyAddress>\"},\n                // recursive generics\n                {ResolvedType.of(Enum.class),\n                        Enum.class, List.of(),\n                        \"java.lang.Enum\"},\n                {ResolvedType.from(Enum.class),\n                        Enum.class, List.of(ResolvedType.ofFlat(Enum.class, Object.class)),\n                        \"java.lang.Enum<java.lang.Enum<Object>>\"},\n                {ResolvedType.from(Enum.class, Thread.State.class),  // also test nested classes\n                        Enum.class, List.of(ResolvedType.of(Thread.State.class)),\n                        \"java.lang.Enum<java.lang.Thread$State>\"},\n                // enums with class-per-constant\n                {ResolvedType.from(Enum.class, RiskLevel.class),\n                        Enum.class, List.of(ResolvedType.of(RiskLevel.class)),\n                        \"java.lang.Enum<org.joda.beans.sample.RiskLevel>\"},\n                {ResolvedType.from(Enum.class, RiskLevel.HIGH.getClass()),\n                        Enum.class, List.of(ResolvedType.of(RiskLevel.class)),\n                        \"java.lang.Enum<org.joda.beans.sample.RiskLevel>\"},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_resolvedTypes\")\n    void test_basics(\n            ResolvedType test,\n            Class<?> expectedRawType,\n            List<ResolvedType> expectedArgTypes,\n            String expectedToString) {\n\n        assertThat(test.getRawType()).isEqualTo(expectedRawType);\n        assertThat(test.getArguments()).containsExactlyElementsOf(expectedArgTypes);\n\n        assertThat(test).hasToString(expectedToString);\n        assertThat(test).hasSameHashCodeAs(test);\n        assertThat(test.equals(test)).isTrue();\n        assertThat(test.equals(new Object())).isFalse();\n        assertThat(test.equals(ResolvedType.of(TestResolvedType.class))).isFalse();\n        assertThat(test.equals(ResolvedType.ofFlat(List.class, TestResolvedType.class))).isFalse();\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_resolvedTypes\")\n    void test_queries(\n            ResolvedType test,\n            Class<?> expectedRawType,\n            List<ResolvedType> expectedArgTypes,\n            String expectedToString) {\n\n        var expectedRawTypeWithoutArray = expectedRawType;\n        if (expectedRawTypeWithoutArray.isArray()) {\n            expectedRawTypeWithoutArray = expectedRawTypeWithoutArray.getComponentType();\n            if (expectedRawTypeWithoutArray.isArray()) {\n                expectedRawTypeWithoutArray = expectedRawTypeWithoutArray.getComponentType();\n            }\n        }\n        if (expectedArgTypes.isEmpty()) {\n            assertThat(test.getArgumentOrDefault(0)).isEqualTo(ResolvedType.OBJECT);\n            assertThat(test.isRaw()).isEqualTo(expectedRawTypeWithoutArray.getTypeParameters().length != 0);\n        } else if (expectedArgTypes.size() == 1) {\n            assertThat(test.getArgumentOrDefault(0)).isEqualTo(expectedArgTypes.get(0));\n            assertThat(test.getArgumentOrDefault(1)).isEqualTo(ResolvedType.OBJECT);\n            assertThat(test.isRaw()).isFalse();\n        } else if (expectedArgTypes.size() == 2) {\n            assertThat(test.getArgumentOrDefault(0)).isEqualTo(expectedArgTypes.get(0));\n            assertThat(test.getArgumentOrDefault(1)).isEqualTo(expectedArgTypes.get(1));\n            assertThat(test.getArgumentOrDefault(2)).isEqualTo(ResolvedType.OBJECT);\n            assertThat(test.isRaw()).isFalse();\n        }\n        if (expectedRawType.isArray()) {\n            assertThat(test.isArray()).isTrue();\n            assertThat(test.toComponentType())\n                    .isEqualTo(ResolvedType.of(expectedRawType.getComponentType(), test.getArguments().toArray(new ResolvedType[0])));\n        } else {\n            assertThat(test.isArray()).isFalse();\n            assertThat(test.toComponentType()).isEqualTo(test);\n        }\n        assertThat(test.toArrayType().toComponentType()).isEqualTo(test);\n        assertThat(test.toBaseComponentType().getRawType()).isEqualTo(expectedRawTypeWithoutArray);\n        assertThat(test.toBaseComponentType().getArguments()).isEqualTo(test.getArguments());\n        assertThat(test.isPrimitive()).isEqualTo(expectedRawType.isPrimitive());\n        assertThat(test.isParameterized()).isEqualTo(expectedRawTypeWithoutArray.getTypeParameters().length > 0);\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_resolvedTypes\")\n    void test_javaType(\n            ResolvedType test,\n            Class<?> expectedRawType,\n            List<ResolvedType> expectedArgTypes,\n            String expectedToString) {\n\n        if (test.getArguments().isEmpty()) {\n            assertThat(test.toJavaType()).isEqualTo(expectedRawType);\n        }\n        assertThat(ResolvedType.fromAllowRaw(test.toJavaType(), Object.class)).isEqualTo(test);\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_resolvedTypes\")\n    void test_jodaConvert(\n            ResolvedType test,\n            Class<?> expectedRawType,\n            List<ResolvedType> expectedArgTypes,\n            String expectedToString) {\n\n        var str = StringConvert.INSTANCE.convertToString(test);\n        assertThat(str).isEqualTo(expectedToString);\n        var obj = StringConvert.INSTANCE.convertFromString(ResolvedType.class, str);\n        assertThat(obj).isEqualTo(test);\n    }\n\n    @Test\n    void test_hidden() {\n        var test = ResolvedType.of(HIDDEN_CLASS_PREDICATE.getClass());\n        assertThat(test.isArray()).isFalse();\n        assertThat(test.isParameterized()).isFalse();\n        assertThat(test.isPrimitive()).isFalse();\n        assertThat(test.isRaw()).isFalse();\n        assertThat(test.getRawType()).isSameAs(HIDDEN_CLASS_PREDICATE.getClass());\n        assertThat(test.getArguments()).isEmpty();\n        assertThat(test.toString()).isEqualTo(HIDDEN_CLASS_PREDICATE.getClass().getName());\n        assertThat(test.toJavaType()).isEqualTo(HIDDEN_CLASS_PREDICATE.getClass());\n    }\n\n    //-------------------------------------------------------------------------\n    static Object[][] data_boxed() {\n        return new Object[][] {\n                {String.class, String.class},\n                {long.class, Long.class},\n                {int.class, Integer.class},\n                {short.class, Short.class},\n                {byte.class, Byte.class},\n                {double.class, Double.class},\n                {float.class, Float.class},\n                {char.class, Character.class},\n                {boolean.class, Boolean.class},\n                {void.class, Void.class},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_boxed\")\n    void test_boxed(Class<?> primitive, Class<?> box) {\n        var test = ResolvedType.of(primitive);\n        assertThat(test.isPrimitive()).isEqualTo(primitive != String.class);\n        assertThat(test.toBoxed()).isEqualTo(ResolvedType.of(box));\n    }\n\n    //-------------------------------------------------------------------------\n    static Object[][] data_invalidParse() {\n        return new Object[][] {\n                {\"String,\"},\n                {\"String<\"},\n                {\"String>\"},\n                {\"String]\"},\n                {\"String[]]\"},\n                {\"List<>\"},\n                {\"List<<String\"},\n                {\"List<[]String\"},\n                {\"List<>String\"},\n                {\"List<String><\"},\n                {\"List<String>>\"},\n                {\"List<String>[]<\"},\n                {\"List<String\"},\n                {\"List<List<String\"},\n                {\"List<List<String>\"},\n                {\"List<String>[]String\"},\n                {\"List<String>String\"},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_invalidParse\")\n    void test_invalidParse(String stringToParse) {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> ResolvedType.parse(stringToParse))\n                .withMessageMatching(\n                        \"Unable to parse ResolvedType( from '\" + Pattern.quote(stringToParse) + \"', invalid format|, class not found: .*)\");\n    }\n\n    @Test\n    void test_enumSubclass() {\n        var test = ResolvedType.of(RiskLevel.HIGH.getClass());\n        assertThat(test.getRawType().getSuperclass()).isEqualTo(RiskLevel.class);\n    }\n\n    @SuppressWarnings(\"unused\")\n    private final List<Object> field1 = null;\n    @SuppressWarnings(\"unused\")\n    private final Map<Number, List<Object>> field2 = null;\n    @SuppressWarnings(\"unused\")\n    private final Map<Number, List<Object>[]>[][] field3 = null;\n\n    @SuppressWarnings(\"unused\")\n    private final Optional<String> field0 = null;\n    @SuppressWarnings(\"unused\")\n    private final List<String> field1b = null;\n    @SuppressWarnings(\"unused\")\n    private final Map<Number, List<String>[]>[][] field3b = null;\n\n    //-------------------------------------------------------------------------\n    static Object[][] data_dynamicTypes() throws Exception {\n        return new Object[][] {\n                {String.class},\n                {String[].class},\n                {List[].class},\n                {List[][].class},\n                {TestResolvedType.class.getDeclaredField(\"field1\").getGenericType()},\n                {TestResolvedType.class.getDeclaredField(\"field2\").getGenericType()},\n                {TestResolvedType.class.getDeclaredField(\"field3\").getGenericType()},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_dynamicTypes\")\n    void test_dynamicTypes(Type type) throws Exception {\n        var test = ResolvedType.fromAllowRaw(type, Object.class);\n        assertThat(test.toJavaType())\n                .isEqualTo(type)\n                .isNotEqualTo(\"\")\n                .isNotEqualTo(Object.class)\n                .isNotEqualTo(TestResolvedType.class.getDeclaredField(\"field0\").getGenericType())\n                .isNotEqualTo(TestResolvedType.class.getDeclaredField(\"field1b\").getGenericType())\n                .isNotEqualTo(TestResolvedType.class.getDeclaredField(\"field3b\").getGenericType());\n        assertThat(test.toJavaType().toString()).isEqualTo(type.toString());\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestResult.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatExceptionOfType;\n\nimport java.util.List;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.sample.AbstractResult;\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.AddressResult;\nimport org.joda.beans.sample.CompanyAddress;\nimport org.joda.beans.sample.CompanyAddressMidResult;\nimport org.joda.beans.sample.CompanyAddressResult;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test property using Person.\n */\nclass TestResult {\n\n    @Test\n    void test_bean() {\n        Bean test = new AddressResult();\n        \n        assertThat(test.metaBean()).isEqualTo(AddressResult.meta());\n        \n        assertThat(test.propertyNames().contains(\"docs\")).isTrue();\n        assertThat(test.property(\"docs\").name()).isEqualTo(\"docs\");\n        assertThat(test.toString()).isEqualTo(\"AddressResult{docs=null, resultType=Address}\");\n    }\n\n    @Test\n    void test_bean_invalidPropertyName() {\n        Bean test = AddressResult.meta().builder().build();\n        assertThatExceptionOfType(NoSuchElementException.class)\n                .isThrownBy(() -> test.property(\"Rubbish\"));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_metaBean() {\n        MetaBean test = AddressResult.meta();\n        assertThat(test.beanType()).isEqualTo(AddressResult.class);\n        assertThat(test.beanName()).isEqualTo(AddressResult.class.getName());\n        assertThat(test.metaPropertyCount()).isEqualTo(2);\n        assertThat(test.metaPropertyExists(\"docs\")).isTrue();\n        assertThat(test.metaProperty(\"docs\").name()).isEqualTo(\"docs\");\n        assertThat(test.metaPropertyExists(\"resultType\")).isTrue();\n        assertThat(test.metaProperty(\"resultType\").name()).isEqualTo(\"resultType\");\n    }\n\n    @Test\n    void test_metaBean_invalidPropertyName() {\n        MetaBean test = AddressResult.meta();\n        assertThatExceptionOfType(NoSuchElementException.class)\n                .isThrownBy(() -> test.metaProperty(\"Rubbish\"));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_genericType_abstract() {\n        @SuppressWarnings(\"unchecked\")\n        AbstractResult.Meta<Address> test = AbstractResult.meta();\n        assertThat(test.docs().propertyType()).isEqualTo(List.class);\n        assertThat(JodaBeanUtils.collectionType(test.docs(), AbstractResult.class)).isEqualTo(Address.class);\n    }\n\n    @Test\n    void test_genericType_Address() {\n        AddressResult obj = new AddressResult();\n        AddressResult.Meta test = AddressResult.meta();\n        assertThat(test.docs().propertyType()).isEqualTo(List.class);\n        assertThat(JodaBeanUtils.collectionType(obj.docs())).isEqualTo(Address.class);\n        assertThat(JodaBeanUtils.collectionType(test.docs(), AddressResult.class)).isEqualTo(Address.class);\n    }\n\n    @Test\n    void test_genericType_CompanyAddress() {\n        CompanyAddressResult obj = new CompanyAddressResult();\n        CompanyAddressResult.Meta test = CompanyAddressResult.meta();\n        assertThat(test.docs().propertyType()).isEqualTo(List.class);\n        assertThat(JodaBeanUtils.collectionType(obj.docs())).isEqualTo(CompanyAddress.class);\n        assertThat(JodaBeanUtils.collectionType(test.docs(), test.docs().declaringType())).isEqualTo(Address.class);\n        assertThat(JodaBeanUtils.collectionType(test.docs(), CompanyAddressResult.class)).isEqualTo(CompanyAddress.class);\n    }\n\n    @Test\n    void test_genericType_CompanyAddressMid() {\n        CompanyAddressMidResult obj = new CompanyAddressMidResult();\n        CompanyAddressMidResult.Meta test = CompanyAddressMidResult.meta();\n        assertThat(test.docs().propertyType()).isEqualTo(List.class);\n        assertThat(JodaBeanUtils.collectionType(obj.docs())).isEqualTo(CompanyAddress.class);\n        assertThat(JodaBeanUtils.collectionType(test.docs(), test.docs().declaringType())).isEqualTo(Address.class);\n        assertThat(JodaBeanUtils.collectionType(test.docs(), CompanyAddressResult.class)).isEqualTo(CompanyAddress.class);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestSubBean.java",
    "content": "/*\n *  Copyright 2017-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport org.joda.beans.sample.ImmSubPersonNonFinal;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test beans extending other beans.\n */\nclass TestSubBean {\n\n    @Test\n    void test_subbean_toBuilder() {\n\n        // This sequence needs to be split like this as forename and surname returns ImmPersonNonFinal.Builder\n        // instead of ImmSubPersonNonFinal.Builder\n        ImmSubPersonNonFinal.Builder builder = ImmSubPersonNonFinal.builder();\n        builder\n                .middleName(\"K.\")\n                .forename(\"John\")\n                .surname(\"Doe\");\n        ImmSubPersonNonFinal person = builder.build();\n\n        ImmSubPersonNonFinal rebuilt = person.toBuilder().build();\n        assertThat(rebuilt).isEqualTo(person);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/TestValidateBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans;\n\nimport static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;\n\nimport org.joda.beans.sample.SubValidateBean;\nimport org.joda.beans.sample.ValidateBean;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test ValidateBean.\n */\nclass TestValidateBean {\n\n    @Test\n    void test_notNull_set() {\n        ValidateBean test = new ValidateBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> test.setFirst(null));\n    }\n\n    @Test\n    void test_notNull_propertySet() {\n        ValidateBean test = new ValidateBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> test.first().set(null));\n    }\n\n    @Test\n    void test_notNull_create() {\n        assertThatIllegalArgumentException().isThrownBy(\n                () -> ValidateBean.meta().builder()\n                        .set(\"first\", null)\n                        .set(\"second\", \"B\")\n                        .set(\"third\", \"C\")\n                        .set(\"fourth\", \"D\")\n                        .build());\n    }\n\n    @Test\n    void test_notNull_create_notIncluded() {\n        assertThatIllegalArgumentException().isThrownBy(\n                () -> ValidateBean.meta().builder().set(\"second\", \"B\").set(\"third\", \"C\").set(\"fourth\", \"D\").build());\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_notBlank_set_null() {\n        ValidateBean test = new ValidateBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> test.setFifth(null));\n    }\n\n    @Test\n    void test_notBlank_set_empty() {\n        ValidateBean test = new ValidateBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> test.setFifth(\" \"));\n    }\n\n    @Test\n    void test_notBlank_propertySet_null() {\n        ValidateBean test = new ValidateBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> test.fifth().set(null));\n    }\n\n    @Test\n    void test_notBlank_propertySet_empty() {\n        ValidateBean test = new ValidateBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> test.fifth().set(\" \"));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_notEmpty_set_null() {\n        ValidateBean test = new ValidateBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> test.setSecond(null));\n    }\n\n    @Test\n    void test_notEmpty_set_empty() {\n        ValidateBean test = new ValidateBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> test.setSecond(\"\"));\n    }\n\n    @Test\n    void test_notEmpty_propertySet_null() {\n        ValidateBean test = new ValidateBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> test.second().set(null));\n    }\n\n    @Test\n    void test_notEmpty_propertySet_empty() {\n        ValidateBean test = new ValidateBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> test.second().set(\"\"));\n    }\n\n    @Test\n    void test_notEmpty_create_null() {\n        assertThatIllegalArgumentException().isThrownBy(\n                () -> ValidateBean.meta().builder()\n                        .set(\"first\", \"A\")\n                        .set(\"second\", null)\n                        .set(\"third\", \"C\")\n                        .set(\"fourth\", \"D\").build());\n    }\n\n    @Test\n    void test_notEmpty_create_empty() {\n        assertThatIllegalArgumentException().isThrownBy(\n                () -> ValidateBean.meta().builder()\n                        .set(\"first\", \"A\")\n                        .set(\"second\", \"\")\n                        .set(\"third\", \"C\")\n                        .set(\"fourth\", \"D\")\n                        .build());\n    }\n\n    @Test\n    void test_notEmpty_create_notIncluded() {\n        assertThatIllegalArgumentException().isThrownBy(\n                () -> ValidateBean.meta().builder()\n                        .set(\"first\", \"A\")\n                        .set(\"third\", \"C\")\n                        .set(\"fourth\", \"D\")\n                        .build());\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_static_set() {\n        ValidateBean test = new ValidateBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> test.setThird(null));\n    }\n\n    @Test\n    void test_static_propertySet() {\n        ValidateBean test = new ValidateBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> test.third().set(null));\n    }\n\n    @Test\n    void test_static_create() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(\n                        () -> ValidateBean.meta().builder()\n                                .set(\"first\", \"A\")\n                                .set(\"second\", \"B\")\n                                .set(\"third\", \"NotC\")\n                                .set(\"fourth\", \"D\")\n                                .build())\n                .withMessage(\"third\");\n    }\n\n    @Test\n    void test_static_create_notIncluded() {\n        assertThatIllegalArgumentException().isThrownBy(\n                () -> ValidateBean.meta().builder().set(\"first\", \"A\").set(\"second\", \"B\").set(\"fourth\", \"D\").build());\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_bean_set() {\n        ValidateBean test = new ValidateBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> test.setFourth(null));\n    }\n\n    @Test\n    void test_bean_propertySet() {\n        ValidateBean test = new ValidateBean();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> test.fourth().set(null));\n    }\n\n    @Test\n    void test_bean_create() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> ValidateBean.meta().builder()\n                        .set(\"first\", \"A\")\n                        .set(\"second\", \"B\")\n                        .set(\"third\", \"C\")\n                        .set(\"fourth\", \"NotD\")\n                        .build())\n                .withMessage(\"fourth\");\n    }\n\n    @Test\n    void test_bean_create_notIncluded() {\n        assertThatIllegalArgumentException().isThrownBy(\n                () -> ValidateBean.meta().builder().set(\"first\", \"A\").set(\"second\", \"B\").set(\"third\", \"C\").build());\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_subbean_create_notIncluded() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> SubValidateBean.meta().builder()\n                        .set(\"first\", \"A\")\n                        .set(\"second\", \"B\")\n                        .set(\"third\", \"C\")\n                        .set(\"fourth\", \"D\")\n                        .build())\n                .withMessageContaining(\"sub\");\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/AbstractResult.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.DerivedProperty;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic abstract class AbstractResult<T extends Address> extends DirectBean {\n\n    /** The docs. */\n    @PropertyDefinition\n    private List<T> docs;\n\n    @DerivedProperty\n    public abstract String getResultType();\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code AbstractResult}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static AbstractResult.Meta meta() {\n        return AbstractResult.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code AbstractResult}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Address> AbstractResult.Meta<R> metaAbstractResult(Class<R> cls) {\n        return AbstractResult.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(AbstractResult.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public AbstractResult.Meta<T> metaBean() {\n        return AbstractResult.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the docs.\n     * @return the value of the property\n     */\n    public List<T> getDocs() {\n        return docs;\n    }\n\n    /**\n     * Sets the docs.\n     * @param docs  the new value of the property\n     */\n    public void setDocs(List<T> docs) {\n        this.docs = docs;\n    }\n\n    /**\n     * Gets the the {@code docs} property.\n     * @return the property, not null\n     */\n    public final Property<List<T>> docs() {\n        return metaBean().docs().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the the {@code resultType} property.\n     * @return the property, not null\n     */\n    public final Property<String> resultType() {\n        return metaBean().resultType().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public AbstractResult<T> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            AbstractResult<?> other = (AbstractResult<?>) obj;\n            return JodaBeanUtils.equal(this.getDocs(), other.getDocs());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getDocs());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"AbstractResult{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"docs\").append('=').append(JodaBeanUtils.toString(getDocs())).append(',').append(' ');\n        buf.append(\"resultType\").append('=').append(JodaBeanUtils.toString(getResultType())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code AbstractResult}.\n     * @param <T>  the type\n     */\n    public static class Meta<T extends Address> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code docs} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<T>> docs = DirectMetaProperty.ofReadWrite(\n                this, \"docs\", AbstractResult.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code resultType} property.\n         */\n        private final MetaProperty<String> resultType = DirectMetaProperty.ofDerived(\n                this, \"resultType\", AbstractResult.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"docs\",\n                \"resultType\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3088955:  // docs\n                    return this.docs;\n                case -571837193:  // resultType\n                    return this.resultType;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public boolean isBuildable() {\n            return false;\n        }\n\n        @Override\n        public BeanBuilder<? extends AbstractResult<T>> builder() {\n            throw new UnsupportedOperationException(\"AbstractResult is an abstract class\");\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends AbstractResult<T>> beanType() {\n            return (Class) AbstractResult.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code docs} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<T>> docs() {\n            return docs;\n        }\n\n        /**\n         * The meta-property for the {@code resultType} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> resultType() {\n            return resultType;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3088955:  // docs\n                    return ((AbstractResult<?>) bean).getDocs();\n                case -571837193:  // resultType\n                    return ((AbstractResult<?>) bean).getResultType();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3088955:  // docs\n                    ((AbstractResult<T>) bean).setDocs((List<T>) newValue);\n                    return;\n                case -571837193:  // resultType\n                    if (quiet) {\n                        return;\n                    }\n                    throw new UnsupportedOperationException(\"Property cannot be written: resultType\");\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/Address.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock address JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class Address extends DirectBean {\n\n    /**\n     * The number.\n     * This will be the flat, house number or house name.\n     */\n    @PropertyDefinition\n    private int number;\n    // various empty comments for testing\n    /**\n     *\n     */\n    @PropertyDefinition\n    private String street;\n    /**\n     */\n    @PropertyDefinition\n    private String city;\n    /** */\n    @PropertyDefinition\n    private Person owner;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code Address}.\n     * @return the meta-bean, not null\n     */\n    public static Address.Meta meta() {\n        return Address.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(Address.Meta.INSTANCE);\n    }\n\n    @Override\n    public Address.Meta metaBean() {\n        return Address.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * This will be the flat, house number or house name.\n     * @return the value of the property\n     */\n    public int getNumber() {\n        return number;\n    }\n\n    /**\n     * Sets the number.\n     * This will be the flat, house number or house name.\n     * @param number  the new value of the property\n     */\n    public void setNumber(int number) {\n        this.number = number;\n    }\n\n    /**\n     * Gets the the {@code number} property.\n     * This will be the flat, house number or house name.\n     * @return the property, not null\n     */\n    public final Property<Integer> number() {\n        return metaBean().number().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the street.\n     * @return the value of the property\n     */\n    public String getStreet() {\n        return street;\n    }\n\n    /**\n     * Sets the street.\n     * @param street  the new value of the property\n     */\n    public void setStreet(String street) {\n        this.street = street;\n    }\n\n    /**\n     * Gets the the {@code street} property.\n     * @return the property, not null\n     */\n    public final Property<String> street() {\n        return metaBean().street().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the city.\n     * @return the value of the property\n     */\n    public String getCity() {\n        return city;\n    }\n\n    /**\n     * Sets the city.\n     * @param city  the new value of the property\n     */\n    public void setCity(String city) {\n        this.city = city;\n    }\n\n    /**\n     * Gets the the {@code city} property.\n     * @return the property, not null\n     */\n    public final Property<String> city() {\n        return metaBean().city().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the owner.\n     * @return the value of the property\n     */\n    public Person getOwner() {\n        return owner;\n    }\n\n    /**\n     * Sets the owner.\n     * @param owner  the new value of the property\n     */\n    public void setOwner(Person owner) {\n        this.owner = owner;\n    }\n\n    /**\n     * Gets the the {@code owner} property.\n     * @return the property, not null\n     */\n    public final Property<Person> owner() {\n        return metaBean().owner().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public Address clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            Address other = (Address) obj;\n            return (this.getNumber() == other.getNumber()) &&\n                    JodaBeanUtils.equal(this.getStreet(), other.getStreet()) &&\n                    JodaBeanUtils.equal(this.getCity(), other.getCity()) &&\n                    JodaBeanUtils.equal(this.getOwner(), other.getOwner());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNumber());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getStreet());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getCity());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getOwner());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(160);\n        buf.append(\"Address{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(getNumber())).append(',').append(' ');\n        buf.append(\"street\").append('=').append(JodaBeanUtils.toString(getStreet())).append(',').append(' ');\n        buf.append(\"city\").append('=').append(JodaBeanUtils.toString(getCity())).append(',').append(' ');\n        buf.append(\"owner\").append('=').append(JodaBeanUtils.toString(getOwner())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code Address}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code number} property.\n         */\n        private final MetaProperty<Integer> number = DirectMetaProperty.ofReadWrite(\n                this, \"number\", Address.class, Integer.TYPE);\n        /**\n         * The meta-property for the {@code street} property.\n         */\n        private final MetaProperty<String> street = DirectMetaProperty.ofReadWrite(\n                this, \"street\", Address.class, String.class);\n        /**\n         * The meta-property for the {@code city} property.\n         */\n        private final MetaProperty<String> city = DirectMetaProperty.ofReadWrite(\n                this, \"city\", Address.class, String.class);\n        /**\n         * The meta-property for the {@code owner} property.\n         */\n        private final MetaProperty<Person> owner = DirectMetaProperty.ofReadWrite(\n                this, \"owner\", Address.class, Person.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"number\",\n                \"street\",\n                \"city\",\n                \"owner\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    return this.number;\n                case -891990013:  // street\n                    return this.street;\n                case 3053931:  // city\n                    return this.city;\n                case 106164915:  // owner\n                    return this.owner;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends Address> builder() {\n            return new DirectBeanBuilder<>(new Address());\n        }\n\n        @Override\n        public Class<? extends Address> beanType() {\n            return Address.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code number} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Integer> number() {\n            return number;\n        }\n\n        /**\n         * The meta-property for the {@code street} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> street() {\n            return street;\n        }\n\n        /**\n         * The meta-property for the {@code city} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> city() {\n            return city;\n        }\n\n        /**\n         * The meta-property for the {@code owner} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Person> owner() {\n            return owner;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    return ((Address) bean).getNumber();\n                case -891990013:  // street\n                    return ((Address) bean).getStreet();\n                case 3053931:  // city\n                    return ((Address) bean).getCity();\n                case 106164915:  // owner\n                    return ((Address) bean).getOwner();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    ((Address) bean).setNumber((Integer) newValue);\n                    return;\n                case -891990013:  // street\n                    ((Address) bean).setStreet((String) newValue);\n                    return;\n                case 3053931:  // city\n                    ((Address) bean).setCity((String) newValue);\n                    return;\n                case 106164915:  // owner\n                    ((Address) bean).setOwner((Person) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/AddressResult.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class AddressResult\n        extends AbstractResult<Address> {\n\n    @Override\n    public String getResultType() {\n        return \"Address\";\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code AddressResult}.\n     * @return the meta-bean, not null\n     */\n    public static AddressResult.Meta meta() {\n        return AddressResult.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(AddressResult.Meta.INSTANCE);\n    }\n\n    @Override\n    public AddressResult.Meta metaBean() {\n        return AddressResult.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public AddressResult clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            return super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(32);\n        buf.append(\"AddressResult{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code AddressResult}.\n     */\n    public static class Meta extends AbstractResult.Meta<Address> {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap());\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        public BeanBuilder<? extends AddressResult> builder() {\n            return new DirectBeanBuilder<>(new AddressResult());\n        }\n\n        @Override\n        public Class<? extends AddressResult> beanType() {\n            return AddressResult.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ClassAnnotation.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Used to test annotations.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.TYPE)\npublic @interface ClassAnnotation {\n\n    Class<?> value();\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ClonePerson.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock address JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class ClonePerson\n        implements Bean {\n\n    @PropertyDefinition\n    private List<String> firstNames;\n    @PropertyDefinition\n    private String[] middleNames;\n    @PropertyDefinition\n    private String surname;\n    @PropertyDefinition(validate = \"notNull\")\n    private Date dateOfBirth;\n    @PropertyDefinition\n    private Date dateOfDeath;\n    @PropertyDefinition\n    private final List<Address> addresses = new ArrayList<>();\n    @PropertyDefinition\n    private Company[] companies;\n    @PropertyDefinition\n    private int[] amounts;\n\n    /**\n     * Creates an instance.\n     */\n    public ClonePerson() {\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ClonePerson}.\n     * @return the meta-bean, not null\n     */\n    public static ClonePerson.Meta meta() {\n        return ClonePerson.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ClonePerson.Meta.INSTANCE);\n    }\n\n    @Override\n    public ClonePerson.Meta metaBean() {\n        return ClonePerson.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the firstNames.\n     * @return the value of the property\n     */\n    public List<String> getFirstNames() {\n        return firstNames;\n    }\n\n    /**\n     * Sets the firstNames.\n     * @param firstNames  the new value of the property\n     */\n    public void setFirstNames(List<String> firstNames) {\n        this.firstNames = firstNames;\n    }\n\n    /**\n     * Gets the the {@code firstNames} property.\n     * @return the property, not null\n     */\n    public final Property<List<String>> firstNames() {\n        return metaBean().firstNames().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the middleNames.\n     * @return the value of the property\n     */\n    public String[] getMiddleNames() {\n        return middleNames;\n    }\n\n    /**\n     * Sets the middleNames.\n     * @param middleNames  the new value of the property\n     */\n    public void setMiddleNames(String[] middleNames) {\n        this.middleNames = middleNames;\n    }\n\n    /**\n     * Gets the the {@code middleNames} property.\n     * @return the property, not null\n     */\n    public final Property<String[]> middleNames() {\n        return metaBean().middleNames().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the surname.\n     * @return the value of the property\n     */\n    public String getSurname() {\n        return surname;\n    }\n\n    /**\n     * Sets the surname.\n     * @param surname  the new value of the property\n     */\n    public void setSurname(String surname) {\n        this.surname = surname;\n    }\n\n    /**\n     * Gets the the {@code surname} property.\n     * @return the property, not null\n     */\n    public final Property<String> surname() {\n        return metaBean().surname().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the dateOfBirth.\n     * @return the value of the property, not null\n     */\n    public Date getDateOfBirth() {\n        return dateOfBirth;\n    }\n\n    /**\n     * Sets the dateOfBirth.\n     * @param dateOfBirth  the new value of the property, not null\n     */\n    public void setDateOfBirth(Date dateOfBirth) {\n        JodaBeanUtils.notNull(dateOfBirth, \"dateOfBirth\");\n        this.dateOfBirth = dateOfBirth;\n    }\n\n    /**\n     * Gets the the {@code dateOfBirth} property.\n     * @return the property, not null\n     */\n    public final Property<Date> dateOfBirth() {\n        return metaBean().dateOfBirth().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the dateOfDeath.\n     * @return the value of the property\n     */\n    public Date getDateOfDeath() {\n        return dateOfDeath;\n    }\n\n    /**\n     * Sets the dateOfDeath.\n     * @param dateOfDeath  the new value of the property\n     */\n    public void setDateOfDeath(Date dateOfDeath) {\n        this.dateOfDeath = dateOfDeath;\n    }\n\n    /**\n     * Gets the the {@code dateOfDeath} property.\n     * @return the property, not null\n     */\n    public final Property<Date> dateOfDeath() {\n        return metaBean().dateOfDeath().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the addresses.\n     * @return the value of the property, not null\n     */\n    public List<Address> getAddresses() {\n        return addresses;\n    }\n\n    /**\n     * Sets the addresses.\n     * @param addresses  the new value of the property, not null\n     */\n    public void setAddresses(List<Address> addresses) {\n        JodaBeanUtils.notNull(addresses, \"addresses\");\n        this.addresses.clear();\n        this.addresses.addAll(addresses);\n    }\n\n    /**\n     * Gets the the {@code addresses} property.\n     * @return the property, not null\n     */\n    public final Property<List<Address>> addresses() {\n        return metaBean().addresses().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the companies.\n     * @return the value of the property\n     */\n    public Company[] getCompanies() {\n        return companies;\n    }\n\n    /**\n     * Sets the companies.\n     * @param companies  the new value of the property\n     */\n    public void setCompanies(Company[] companies) {\n        this.companies = companies;\n    }\n\n    /**\n     * Gets the the {@code companies} property.\n     * @return the property, not null\n     */\n    public final Property<Company[]> companies() {\n        return metaBean().companies().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the amounts.\n     * @return the value of the property\n     */\n    public int[] getAmounts() {\n        return amounts;\n    }\n\n    /**\n     * Sets the amounts.\n     * @param amounts  the new value of the property\n     */\n    public void setAmounts(int[] amounts) {\n        this.amounts = amounts;\n    }\n\n    /**\n     * Gets the the {@code amounts} property.\n     * @return the property, not null\n     */\n    public final Property<int[]> amounts() {\n        return metaBean().amounts().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public ClonePerson clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ClonePerson other = (ClonePerson) obj;\n            return JodaBeanUtils.equal(this.getFirstNames(), other.getFirstNames()) &&\n                    JodaBeanUtils.equal(this.getMiddleNames(), other.getMiddleNames()) &&\n                    JodaBeanUtils.equal(this.getSurname(), other.getSurname()) &&\n                    JodaBeanUtils.equal(this.getDateOfBirth(), other.getDateOfBirth()) &&\n                    JodaBeanUtils.equal(this.getDateOfDeath(), other.getDateOfDeath()) &&\n                    JodaBeanUtils.equal(this.getAddresses(), other.getAddresses()) &&\n                    JodaBeanUtils.equal(this.getCompanies(), other.getCompanies()) &&\n                    JodaBeanUtils.equal(this.getAmounts(), other.getAmounts());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getFirstNames());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getMiddleNames());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getSurname());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getDateOfBirth());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getDateOfDeath());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getAddresses());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getCompanies());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getAmounts());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(288);\n        buf.append(\"ClonePerson{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"firstNames\").append('=').append(JodaBeanUtils.toString(getFirstNames())).append(',').append(' ');\n        buf.append(\"middleNames\").append('=').append(JodaBeanUtils.toString(getMiddleNames())).append(',').append(' ');\n        buf.append(\"surname\").append('=').append(JodaBeanUtils.toString(getSurname())).append(',').append(' ');\n        buf.append(\"dateOfBirth\").append('=').append(JodaBeanUtils.toString(getDateOfBirth())).append(',').append(' ');\n        buf.append(\"dateOfDeath\").append('=').append(JodaBeanUtils.toString(getDateOfDeath())).append(',').append(' ');\n        buf.append(\"addresses\").append('=').append(JodaBeanUtils.toString(getAddresses())).append(',').append(' ');\n        buf.append(\"companies\").append('=').append(JodaBeanUtils.toString(getCompanies())).append(',').append(' ');\n        buf.append(\"amounts\").append('=').append(JodaBeanUtils.toString(getAmounts())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ClonePerson}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code firstNames} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<String>> firstNames = DirectMetaProperty.ofReadWrite(\n                this, \"firstNames\", ClonePerson.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code middleNames} property.\n         */\n        private final MetaProperty<String[]> middleNames = DirectMetaProperty.ofReadWrite(\n                this, \"middleNames\", ClonePerson.class, String[].class);\n        /**\n         * The meta-property for the {@code surname} property.\n         */\n        private final MetaProperty<String> surname = DirectMetaProperty.ofReadWrite(\n                this, \"surname\", ClonePerson.class, String.class);\n        /**\n         * The meta-property for the {@code dateOfBirth} property.\n         */\n        private final MetaProperty<Date> dateOfBirth = DirectMetaProperty.ofReadWrite(\n                this, \"dateOfBirth\", ClonePerson.class, Date.class);\n        /**\n         * The meta-property for the {@code dateOfDeath} property.\n         */\n        private final MetaProperty<Date> dateOfDeath = DirectMetaProperty.ofReadWrite(\n                this, \"dateOfDeath\", ClonePerson.class, Date.class);\n        /**\n         * The meta-property for the {@code addresses} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<Address>> addresses = DirectMetaProperty.ofReadWrite(\n                this, \"addresses\", ClonePerson.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code companies} property.\n         */\n        private final MetaProperty<Company[]> companies = DirectMetaProperty.ofReadWrite(\n                this, \"companies\", ClonePerson.class, Company[].class);\n        /**\n         * The meta-property for the {@code amounts} property.\n         */\n        private final MetaProperty<int[]> amounts = DirectMetaProperty.ofReadWrite(\n                this, \"amounts\", ClonePerson.class, int[].class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"firstNames\",\n                \"middleNames\",\n                \"surname\",\n                \"dateOfBirth\",\n                \"dateOfDeath\",\n                \"addresses\",\n                \"companies\",\n                \"amounts\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -177061256:  // firstNames\n                    return this.firstNames;\n                case 404996787:  // middleNames\n                    return this.middleNames;\n                case -1852993317:  // surname\n                    return this.surname;\n                case -386871910:  // dateOfBirth\n                    return this.dateOfBirth;\n                case -385160369:  // dateOfDeath\n                    return this.dateOfDeath;\n                case 874544034:  // addresses\n                    return this.addresses;\n                case -1412832805:  // companies\n                    return this.companies;\n                case -879772901:  // amounts\n                    return this.amounts;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends ClonePerson> builder() {\n            return new DirectBeanBuilder<>(new ClonePerson());\n        }\n\n        @Override\n        public Class<? extends ClonePerson> beanType() {\n            return ClonePerson.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code firstNames} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<String>> firstNames() {\n            return firstNames;\n        }\n\n        /**\n         * The meta-property for the {@code middleNames} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String[]> middleNames() {\n            return middleNames;\n        }\n\n        /**\n         * The meta-property for the {@code surname} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> surname() {\n            return surname;\n        }\n\n        /**\n         * The meta-property for the {@code dateOfBirth} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Date> dateOfBirth() {\n            return dateOfBirth;\n        }\n\n        /**\n         * The meta-property for the {@code dateOfDeath} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Date> dateOfDeath() {\n            return dateOfDeath;\n        }\n\n        /**\n         * The meta-property for the {@code addresses} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<Address>> addresses() {\n            return addresses;\n        }\n\n        /**\n         * The meta-property for the {@code companies} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Company[]> companies() {\n            return companies;\n        }\n\n        /**\n         * The meta-property for the {@code amounts} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<int[]> amounts() {\n            return amounts;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -177061256:  // firstNames\n                    return ((ClonePerson) bean).getFirstNames();\n                case 404996787:  // middleNames\n                    return ((ClonePerson) bean).getMiddleNames();\n                case -1852993317:  // surname\n                    return ((ClonePerson) bean).getSurname();\n                case -386871910:  // dateOfBirth\n                    return ((ClonePerson) bean).getDateOfBirth();\n                case -385160369:  // dateOfDeath\n                    return ((ClonePerson) bean).getDateOfDeath();\n                case 874544034:  // addresses\n                    return ((ClonePerson) bean).getAddresses();\n                case -1412832805:  // companies\n                    return ((ClonePerson) bean).getCompanies();\n                case -879772901:  // amounts\n                    return ((ClonePerson) bean).getAmounts();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -177061256:  // firstNames\n                    ((ClonePerson) bean).setFirstNames((List<String>) newValue);\n                    return;\n                case 404996787:  // middleNames\n                    ((ClonePerson) bean).setMiddleNames((String[]) newValue);\n                    return;\n                case -1852993317:  // surname\n                    ((ClonePerson) bean).setSurname((String) newValue);\n                    return;\n                case -386871910:  // dateOfBirth\n                    ((ClonePerson) bean).setDateOfBirth((Date) newValue);\n                    return;\n                case -385160369:  // dateOfDeath\n                    ((ClonePerson) bean).setDateOfDeath((Date) newValue);\n                    return;\n                case 874544034:  // addresses\n                    ((ClonePerson) bean).setAddresses((List<Address>) newValue);\n                    return;\n                case -1412832805:  // companies\n                    ((ClonePerson) bean).setCompanies((Company[]) newValue);\n                    return;\n                case -879772901:  // amounts\n                    ((ClonePerson) bean).setAmounts((int[]) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n        @Override\n        protected void validate(Bean bean) {\n            JodaBeanUtils.notNull(((ClonePerson) bean).dateOfBirth, \"dateOfBirth\");\n            JodaBeanUtils.notNull(((ClonePerson) bean).addresses, \"addresses\");\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/Company.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock address JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class Company\n        implements Bean {\n\n    /** The company name. */\n    @PropertyDefinition\n    private String companyName;\n\n    /**\n     * Creates an instanec.\n     */\n    public Company() {\n    }\n\n    /**\n     * Creates an instanec.\n     * \n     * @param name  the name\n     */\n    public Company(String name) {\n        companyName = name;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code Company}.\n     * @return the meta-bean, not null\n     */\n    public static Company.Meta meta() {\n        return Company.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(Company.Meta.INSTANCE);\n    }\n\n    @Override\n    public Company.Meta metaBean() {\n        return Company.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the company name.\n     * @return the value of the property\n     */\n    public String getCompanyName() {\n        return companyName;\n    }\n\n    /**\n     * Sets the company name.\n     * @param companyName  the new value of the property\n     */\n    public void setCompanyName(String companyName) {\n        this.companyName = companyName;\n    }\n\n    /**\n     * Gets the the {@code companyName} property.\n     * @return the property, not null\n     */\n    public final Property<String> companyName() {\n        return metaBean().companyName().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public Company clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            Company other = (Company) obj;\n            return JodaBeanUtils.equal(this.getCompanyName(), other.getCompanyName());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getCompanyName());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"Company{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"companyName\").append('=').append(JodaBeanUtils.toString(getCompanyName())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code Company}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code companyName} property.\n         */\n        private final MetaProperty<String> companyName = DirectMetaProperty.ofReadWrite(\n                this, \"companyName\", Company.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"companyName\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -508582744:  // companyName\n                    return this.companyName;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends Company> builder() {\n            return new DirectBeanBuilder<>(new Company());\n        }\n\n        @Override\n        public Class<? extends Company> beanType() {\n            return Company.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code companyName} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> companyName() {\n            return companyName;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -508582744:  // companyName\n                    return ((Company) bean).getCompanyName();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -508582744:  // companyName\n                    ((Company) bean).setCompanyName((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/CompanyAddress.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.beans.PropertyChangeSupport;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock address JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class CompanyAddress extends Address {\n\n    /** The company name. */\n    @PropertyDefinition(set = \"bound\", equalsHashCodeStyle = \"field\", toStringStyle = \"field\")\n    private String companyName;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code CompanyAddress}.\n     * @return the meta-bean, not null\n     */\n    public static CompanyAddress.Meta meta() {\n        return CompanyAddress.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(CompanyAddress.Meta.INSTANCE);\n    }\n\n    /**\n     * The property change support field.\n     */\n    private final transient PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);\n\n    @Override\n    public CompanyAddress.Meta metaBean() {\n        return CompanyAddress.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the company name.\n     * @return the value of the property\n     */\n    public String getCompanyName() {\n        return companyName;\n    }\n\n    /**\n     * Sets the company name.\n     * @param companyName  the new value of the property\n     */\n    public void setCompanyName(String companyName) {\n        String oldCompanyName = this.companyName;\n        this.companyName = companyName;\n        this.propertyChangeSupport.firePropertyChange(\"companyName\", oldCompanyName, companyName);\n    }\n\n    /**\n     * Gets the the {@code companyName} property.\n     * @return the property, not null\n     */\n    public final Property<String> companyName() {\n        return metaBean().companyName().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public CompanyAddress clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            CompanyAddress other = (CompanyAddress) obj;\n            return JodaBeanUtils.equal(this.companyName, other.companyName) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        hash = hash * 31 + JodaBeanUtils.hashCode(companyName);\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"CompanyAddress{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"companyName\").append('=').append(JodaBeanUtils.toString(companyName)).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code CompanyAddress}.\n     */\n    public static class Meta extends Address.Meta {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code companyName} property.\n         */\n        private final MetaProperty<String> companyName = DirectMetaProperty.ofReadWrite(\n                this, \"companyName\", CompanyAddress.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"companyName\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -508582744:  // companyName\n                    return this.companyName;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends CompanyAddress> builder() {\n            return new DirectBeanBuilder<>(new CompanyAddress());\n        }\n\n        @Override\n        public Class<? extends CompanyAddress> beanType() {\n            return CompanyAddress.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code companyName} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> companyName() {\n            return companyName;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -508582744:  // companyName\n                    return ((CompanyAddress) bean).getCompanyName();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -508582744:  // companyName\n                    ((CompanyAddress) bean).setCompanyName((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/CompanyAddressMidResult.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class CompanyAddressMidResult extends MidAbstractResult<CompanyAddress> {\n\n    @Override\n    public String getResultType() {\n        return \"CompanyAddressMid\";\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code CompanyAddressMidResult}.\n     * @return the meta-bean, not null\n     */\n    public static CompanyAddressMidResult.Meta meta() {\n        return CompanyAddressMidResult.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(CompanyAddressMidResult.Meta.INSTANCE);\n    }\n\n    @Override\n    public CompanyAddressMidResult.Meta metaBean() {\n        return CompanyAddressMidResult.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public CompanyAddressMidResult clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            return super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(32);\n        buf.append(\"CompanyAddressMidResult{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code CompanyAddressMidResult}.\n     */\n    public static class Meta extends MidAbstractResult.Meta<CompanyAddress> {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap());\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        public BeanBuilder<? extends CompanyAddressMidResult> builder() {\n            return new DirectBeanBuilder<>(new CompanyAddressMidResult());\n        }\n\n        @Override\n        public Class<? extends CompanyAddressMidResult> beanType() {\n            return CompanyAddressMidResult.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/CompanyAddressResult.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class CompanyAddressResult extends AbstractResult<CompanyAddress> {\n\n    @Override\n    public String getResultType() {\n        return \"CompanyAddress\";\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code CompanyAddressResult}.\n     * @return the meta-bean, not null\n     */\n    public static CompanyAddressResult.Meta meta() {\n        return CompanyAddressResult.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(CompanyAddressResult.Meta.INSTANCE);\n    }\n\n    @Override\n    public CompanyAddressResult.Meta metaBean() {\n        return CompanyAddressResult.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public CompanyAddressResult clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            return super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(32);\n        buf.append(\"CompanyAddressResult{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code CompanyAddressResult}.\n     */\n    public static class Meta extends AbstractResult.Meta<CompanyAddress> {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap());\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        public BeanBuilder<? extends CompanyAddressResult> builder() {\n            return new DirectBeanBuilder<>(new CompanyAddressResult());\n        }\n\n        @Override\n        public Class<? extends CompanyAddressResult> beanType() {\n            return CompanyAddressResult.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ComplexAnnotation.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Used to test annotation parsing.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.TYPE)\npublic @interface ComplexAnnotation {\n\n    SimpleAnnotation[] value();\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/Documentation.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class Documentation<T> extends DirectBean {\n\n    /** The type. */\n    @PropertyDefinition\n    private String type;\n    /** The surname. */\n    @PropertyDefinition\n    private T content;\n    @PropertyDefinition\n    private Map<String, String> map;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code Documentation}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static Documentation.Meta meta() {\n        return Documentation.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code Documentation}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R> Documentation.Meta<R> metaDocumentation(Class<R> cls) {\n        return Documentation.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(Documentation.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public Documentation.Meta<T> metaBean() {\n        return Documentation.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type.\n     * @return the value of the property\n     */\n    public String getType() {\n        return type;\n    }\n\n    /**\n     * Sets the type.\n     * @param type  the new value of the property\n     */\n    public void setType(String type) {\n        this.type = type;\n    }\n\n    /**\n     * Gets the the {@code type} property.\n     * @return the property, not null\n     */\n    public final Property<String> type() {\n        return metaBean().type().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the surname.\n     * @return the value of the property\n     */\n    public T getContent() {\n        return content;\n    }\n\n    /**\n     * Sets the surname.\n     * @param content  the new value of the property\n     */\n    public void setContent(T content) {\n        this.content = content;\n    }\n\n    /**\n     * Gets the the {@code content} property.\n     * @return the property, not null\n     */\n    public final Property<T> content() {\n        return metaBean().content().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the map.\n     * @return the value of the property\n     */\n    public Map<String, String> getMap() {\n        return map;\n    }\n\n    /**\n     * Sets the map.\n     * @param map  the new value of the property\n     */\n    public void setMap(Map<String, String> map) {\n        this.map = map;\n    }\n\n    /**\n     * Gets the the {@code map} property.\n     * @return the property, not null\n     */\n    public final Property<Map<String, String>> map() {\n        return metaBean().map().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public Documentation<T> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            Documentation<?> other = (Documentation<?>) obj;\n            return JodaBeanUtils.equal(this.getType(), other.getType()) &&\n                    JodaBeanUtils.equal(this.getContent(), other.getContent()) &&\n                    JodaBeanUtils.equal(this.getMap(), other.getMap());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getType());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getContent());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getMap());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(128);\n        buf.append(\"Documentation{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"type\").append('=').append(JodaBeanUtils.toString(getType())).append(',').append(' ');\n        buf.append(\"content\").append('=').append(JodaBeanUtils.toString(getContent())).append(',').append(' ');\n        buf.append(\"map\").append('=').append(JodaBeanUtils.toString(getMap())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code Documentation}.\n     * @param <T>  the type\n     */\n    public static class Meta<T> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code type} property.\n         */\n        private final MetaProperty<String> type = DirectMetaProperty.ofReadWrite(\n                this, \"type\", Documentation.class, String.class);\n        /**\n         * The meta-property for the {@code content} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T> content = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"content\", Documentation.class, Object.class);\n        /**\n         * The meta-property for the {@code map} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Map<String, String>> map = DirectMetaProperty.ofReadWrite(\n                this, \"map\", Documentation.class, (Class) Map.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"type\",\n                \"content\",\n                \"map\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3575610:  // type\n                    return this.type;\n                case 951530617:  // content\n                    return this.content;\n                case 107868:  // map\n                    return this.map;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends Documentation<T>> builder() {\n            return new DirectBeanBuilder<>(new Documentation<T>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends Documentation<T>> beanType() {\n            return (Class) Documentation.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code type} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> type() {\n            return type;\n        }\n\n        /**\n         * The meta-property for the {@code content} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T> content() {\n            return content;\n        }\n\n        /**\n         * The meta-property for the {@code map} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Map<String, String>> map() {\n            return map;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3575610:  // type\n                    return ((Documentation<?>) bean).getType();\n                case 951530617:  // content\n                    return ((Documentation<?>) bean).getContent();\n                case 107868:  // map\n                    return ((Documentation<?>) bean).getMap();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3575610:  // type\n                    ((Documentation<T>) bean).setType((String) newValue);\n                    return;\n                case 951530617:  // content\n                    ((Documentation<T>) bean).setContent((T) newValue);\n                    return;\n                case 107868:  // map\n                    ((Documentation<T>) bean).setMap((Map<String, String>) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/DocumentationHolder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * This tests a generic ? property.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class DocumentationHolder extends DirectBean{\n    // NOTE: no space between DirectBean and {\n\n    /** The documentation. */\n    @PropertyDefinition\n    private Documentation<?> documentation;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code DocumentationHolder}.\n     * @return the meta-bean, not null\n     */\n    public static DocumentationHolder.Meta meta() {\n        return DocumentationHolder.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(DocumentationHolder.Meta.INSTANCE);\n    }\n\n    @Override\n    public DocumentationHolder.Meta metaBean() {\n        return DocumentationHolder.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the documentation.\n     * @return the value of the property\n     */\n    public Documentation<?> getDocumentation() {\n        return documentation;\n    }\n\n    /**\n     * Sets the documentation.\n     * @param documentation  the new value of the property\n     */\n    public void setDocumentation(Documentation<?> documentation) {\n        this.documentation = documentation;\n    }\n\n    /**\n     * Gets the the {@code documentation} property.\n     * @return the property, not null\n     */\n    public final Property<Documentation<?>> documentation() {\n        return metaBean().documentation().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public DocumentationHolder clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            DocumentationHolder other = (DocumentationHolder) obj;\n            return JodaBeanUtils.equal(this.getDocumentation(), other.getDocumentation());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getDocumentation());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"DocumentationHolder{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"documentation\").append('=').append(JodaBeanUtils.toString(getDocumentation())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code DocumentationHolder}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code documentation} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Documentation<?>> documentation = DirectMetaProperty.ofReadWrite(\n                this, \"documentation\", DocumentationHolder.class, (Class) Documentation.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"documentation\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 1587405498:  // documentation\n                    return this.documentation;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends DocumentationHolder> builder() {\n            return new DirectBeanBuilder<>(new DocumentationHolder());\n        }\n\n        @Override\n        public Class<? extends DocumentationHolder> beanType() {\n            return DocumentationHolder.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code documentation} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Documentation<?>> documentation() {\n            return documentation;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 1587405498:  // documentation\n                    return ((DocumentationHolder) bean).getDocumentation();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 1587405498:  // documentation\n                    ((DocumentationHolder) bean).setDocumentation((Documentation<?>) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/DoubleGenericsComplexExtendsSuperTwoGenerics.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class DoubleGenericsComplexExtendsSuperTwoGenerics<T extends Comparable<T>, U extends Number> extends DoubleGenericsSimpleSuper<T, U> {\n\n    /** The normal type. */\n    @PropertyDefinition\n    private String normalType;\n    /** The type T value. */\n    @PropertyDefinition\n    private T typeT;\n    /** The type U value. */\n    @PropertyDefinition\n    private U typeU;\n    /** The type T value. */\n    @PropertyDefinition\n    private List<T> typeTList;\n    /** The type U value. */\n    @PropertyDefinition\n    private List<U> typeUList;\n    /** The type T value. */\n    @PropertyDefinition\n    private T[] typeTArray;\n    /** The type U value. */\n    @PropertyDefinition\n    private U[] typeUArray;\n\n    /**\n     * Creates an instance.\n     */\n    public DoubleGenericsComplexExtendsSuperTwoGenerics() {\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code DoubleGenericsComplexExtendsSuperTwoGenerics}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static DoubleGenericsComplexExtendsSuperTwoGenerics.Meta meta() {\n        return DoubleGenericsComplexExtendsSuperTwoGenerics.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code DoubleGenericsComplexExtendsSuperTwoGenerics}.\n     * @param <R>  the first generic type\n     * @param <S>  the second generic type\n     * @param cls1  the first generic type\n     * @param cls2  the second generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Comparable<R>, S extends Number> DoubleGenericsComplexExtendsSuperTwoGenerics.Meta<R, S> metaDoubleGenericsComplexExtendsSuperTwoGenerics(Class<R> cls1, Class<S> cls2) {\n        return DoubleGenericsComplexExtendsSuperTwoGenerics.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(DoubleGenericsComplexExtendsSuperTwoGenerics.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public DoubleGenericsComplexExtendsSuperTwoGenerics.Meta<T, U> metaBean() {\n        return DoubleGenericsComplexExtendsSuperTwoGenerics.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the normal type.\n     * @return the value of the property\n     */\n    public String getNormalType() {\n        return normalType;\n    }\n\n    /**\n     * Sets the normal type.\n     * @param normalType  the new value of the property\n     */\n    public void setNormalType(String normalType) {\n        this.normalType = normalType;\n    }\n\n    /**\n     * Gets the the {@code normalType} property.\n     * @return the property, not null\n     */\n    public final Property<String> normalType() {\n        return metaBean().normalType().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public T getTypeT() {\n        return typeT;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeT  the new value of the property\n     */\n    public void setTypeT(T typeT) {\n        this.typeT = typeT;\n    }\n\n    /**\n     * Gets the the {@code typeT} property.\n     * @return the property, not null\n     */\n    public final Property<T> typeT() {\n        return metaBean().typeT().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public U getTypeU() {\n        return typeU;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeU  the new value of the property\n     */\n    public void setTypeU(U typeU) {\n        this.typeU = typeU;\n    }\n\n    /**\n     * Gets the the {@code typeU} property.\n     * @return the property, not null\n     */\n    public final Property<U> typeU() {\n        return metaBean().typeU().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public List<T> getTypeTList() {\n        return typeTList;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeTList  the new value of the property\n     */\n    public void setTypeTList(List<T> typeTList) {\n        this.typeTList = typeTList;\n    }\n\n    /**\n     * Gets the the {@code typeTList} property.\n     * @return the property, not null\n     */\n    public final Property<List<T>> typeTList() {\n        return metaBean().typeTList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public List<U> getTypeUList() {\n        return typeUList;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeUList  the new value of the property\n     */\n    public void setTypeUList(List<U> typeUList) {\n        this.typeUList = typeUList;\n    }\n\n    /**\n     * Gets the the {@code typeUList} property.\n     * @return the property, not null\n     */\n    public final Property<List<U>> typeUList() {\n        return metaBean().typeUList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public T[] getTypeTArray() {\n        return typeTArray;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeTArray  the new value of the property\n     */\n    public void setTypeTArray(T[] typeTArray) {\n        this.typeTArray = typeTArray;\n    }\n\n    /**\n     * Gets the the {@code typeTArray} property.\n     * @return the property, not null\n     */\n    public final Property<T[]> typeTArray() {\n        return metaBean().typeTArray().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public U[] getTypeUArray() {\n        return typeUArray;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeUArray  the new value of the property\n     */\n    public void setTypeUArray(U[] typeUArray) {\n        this.typeUArray = typeUArray;\n    }\n\n    /**\n     * Gets the the {@code typeUArray} property.\n     * @return the property, not null\n     */\n    public final Property<U[]> typeUArray() {\n        return metaBean().typeUArray().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public DoubleGenericsComplexExtendsSuperTwoGenerics<T, U> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            DoubleGenericsComplexExtendsSuperTwoGenerics<?, ?> other = (DoubleGenericsComplexExtendsSuperTwoGenerics<?, ?>) obj;\n            return JodaBeanUtils.equal(this.getNormalType(), other.getNormalType()) &&\n                    JodaBeanUtils.equal(this.getTypeT(), other.getTypeT()) &&\n                    JodaBeanUtils.equal(this.getTypeU(), other.getTypeU()) &&\n                    JodaBeanUtils.equal(this.getTypeTList(), other.getTypeTList()) &&\n                    JodaBeanUtils.equal(this.getTypeUList(), other.getTypeUList()) &&\n                    JodaBeanUtils.equal(this.getTypeTArray(), other.getTypeTArray()) &&\n                    JodaBeanUtils.equal(this.getTypeUArray(), other.getTypeUArray()) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNormalType());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeT());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeU());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeTList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeUList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeTArray());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeUArray());\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(256);\n        buf.append(\"DoubleGenericsComplexExtendsSuperTwoGenerics{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"normalType\").append('=').append(JodaBeanUtils.toString(getNormalType())).append(',').append(' ');\n        buf.append(\"typeT\").append('=').append(JodaBeanUtils.toString(getTypeT())).append(',').append(' ');\n        buf.append(\"typeU\").append('=').append(JodaBeanUtils.toString(getTypeU())).append(',').append(' ');\n        buf.append(\"typeTList\").append('=').append(JodaBeanUtils.toString(getTypeTList())).append(',').append(' ');\n        buf.append(\"typeUList\").append('=').append(JodaBeanUtils.toString(getTypeUList())).append(',').append(' ');\n        buf.append(\"typeTArray\").append('=').append(JodaBeanUtils.toString(getTypeTArray())).append(',').append(' ');\n        buf.append(\"typeUArray\").append('=').append(JodaBeanUtils.toString(getTypeUArray())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code DoubleGenericsComplexExtendsSuperTwoGenerics}.\n     * @param <T>  the type\n     * @param <U>  the type\n     */\n    public static class Meta<T extends Comparable<T>, U extends Number> extends DoubleGenericsSimpleSuper.Meta<T, U> {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code normalType} property.\n         */\n        private final MetaProperty<String> normalType = DirectMetaProperty.ofReadWrite(\n                this, \"normalType\", DoubleGenericsComplexExtendsSuperTwoGenerics.class, String.class);\n        /**\n         * The meta-property for the {@code typeT} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T> typeT = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeT\", DoubleGenericsComplexExtendsSuperTwoGenerics.class, Object.class);\n        /**\n         * The meta-property for the {@code typeU} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<U> typeU = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeU\", DoubleGenericsComplexExtendsSuperTwoGenerics.class, Object.class);\n        /**\n         * The meta-property for the {@code typeTList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<T>> typeTList = DirectMetaProperty.ofReadWrite(\n                this, \"typeTList\", DoubleGenericsComplexExtendsSuperTwoGenerics.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code typeUList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<U>> typeUList = DirectMetaProperty.ofReadWrite(\n                this, \"typeUList\", DoubleGenericsComplexExtendsSuperTwoGenerics.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code typeTArray} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T[]> typeTArray = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeTArray\", DoubleGenericsComplexExtendsSuperTwoGenerics.class, Object[].class);\n        /**\n         * The meta-property for the {@code typeUArray} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<U[]> typeUArray = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeUArray\", DoubleGenericsComplexExtendsSuperTwoGenerics.class, Object[].class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"normalType\",\n                \"typeT\",\n                \"typeU\",\n                \"typeTList\",\n                \"typeUList\",\n                \"typeTArray\",\n                \"typeUArray\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    return this.normalType;\n                case 110843994:  // typeT\n                    return this.typeT;\n                case 110843995:  // typeU\n                    return this.typeU;\n                case 508018712:  // typeTList\n                    return this.typeTList;\n                case 508942233:  // typeUList\n                    return this.typeUList;\n                case -1441181153:  // typeTArray\n                    return this.typeTArray;\n                case -1412552002:  // typeUArray\n                    return this.typeUArray;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends DoubleGenericsComplexExtendsSuperTwoGenerics<T, U>> builder() {\n            return new DirectBeanBuilder<>(new DoubleGenericsComplexExtendsSuperTwoGenerics<T, U>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends DoubleGenericsComplexExtendsSuperTwoGenerics<T, U>> beanType() {\n            return (Class) DoubleGenericsComplexExtendsSuperTwoGenerics.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code normalType} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> normalType() {\n            return normalType;\n        }\n\n        /**\n         * The meta-property for the {@code typeT} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T> typeT() {\n            return typeT;\n        }\n\n        /**\n         * The meta-property for the {@code typeU} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<U> typeU() {\n            return typeU;\n        }\n\n        /**\n         * The meta-property for the {@code typeTList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<T>> typeTList() {\n            return typeTList;\n        }\n\n        /**\n         * The meta-property for the {@code typeUList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<U>> typeUList() {\n            return typeUList;\n        }\n\n        /**\n         * The meta-property for the {@code typeTArray} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T[]> typeTArray() {\n            return typeTArray;\n        }\n\n        /**\n         * The meta-property for the {@code typeUArray} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<U[]> typeUArray() {\n            return typeUArray;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    return ((DoubleGenericsComplexExtendsSuperTwoGenerics<?, ?>) bean).getNormalType();\n                case 110843994:  // typeT\n                    return ((DoubleGenericsComplexExtendsSuperTwoGenerics<?, ?>) bean).getTypeT();\n                case 110843995:  // typeU\n                    return ((DoubleGenericsComplexExtendsSuperTwoGenerics<?, ?>) bean).getTypeU();\n                case 508018712:  // typeTList\n                    return ((DoubleGenericsComplexExtendsSuperTwoGenerics<?, ?>) bean).getTypeTList();\n                case 508942233:  // typeUList\n                    return ((DoubleGenericsComplexExtendsSuperTwoGenerics<?, ?>) bean).getTypeUList();\n                case -1441181153:  // typeTArray\n                    return ((DoubleGenericsComplexExtendsSuperTwoGenerics<?, ?>) bean).getTypeTArray();\n                case -1412552002:  // typeUArray\n                    return ((DoubleGenericsComplexExtendsSuperTwoGenerics<?, ?>) bean).getTypeUArray();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    ((DoubleGenericsComplexExtendsSuperTwoGenerics<T, U>) bean).setNormalType((String) newValue);\n                    return;\n                case 110843994:  // typeT\n                    ((DoubleGenericsComplexExtendsSuperTwoGenerics<T, U>) bean).setTypeT((T) newValue);\n                    return;\n                case 110843995:  // typeU\n                    ((DoubleGenericsComplexExtendsSuperTwoGenerics<T, U>) bean).setTypeU((U) newValue);\n                    return;\n                case 508018712:  // typeTList\n                    ((DoubleGenericsComplexExtendsSuperTwoGenerics<T, U>) bean).setTypeTList((List<T>) newValue);\n                    return;\n                case 508942233:  // typeUList\n                    ((DoubleGenericsComplexExtendsSuperTwoGenerics<T, U>) bean).setTypeUList((List<U>) newValue);\n                    return;\n                case -1441181153:  // typeTArray\n                    ((DoubleGenericsComplexExtendsSuperTwoGenerics<T, U>) bean).setTypeTArray((T[]) newValue);\n                    return;\n                case -1412552002:  // typeUArray\n                    ((DoubleGenericsComplexExtendsSuperTwoGenerics<T, U>) bean).setTypeUArray((U[]) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/DoubleGenericsNoExtendsNoSuper.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class DoubleGenericsNoExtendsNoSuper<T, U>\n        implements Bean {\n\n    /** The normal type. */\n    @PropertyDefinition\n    private String normalType;\n    /** The type T value. */\n    @PropertyDefinition\n    private T typeT;\n    /** The type U value. */\n    @PropertyDefinition\n    private U typeU;\n    /** The type T value. */\n    @PropertyDefinition\n    private List<T> typeTList;\n    /** The type U value. */\n    @PropertyDefinition\n    private List<U> typeUList;\n    /** The type T value. */\n    @PropertyDefinition\n    private T[] typeTArray;\n    /** The type U value. */\n    @PropertyDefinition\n    private U[] typeUArray;\n\n    /**\n     * Creates an instance.\n     */\n    public DoubleGenericsNoExtendsNoSuper() {\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code DoubleGenericsNoExtendsNoSuper}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static DoubleGenericsNoExtendsNoSuper.Meta meta() {\n        return DoubleGenericsNoExtendsNoSuper.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code DoubleGenericsNoExtendsNoSuper}.\n     * @param <R>  the first generic type\n     * @param <S>  the second generic type\n     * @param cls1  the first generic type\n     * @param cls2  the second generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R, S> DoubleGenericsNoExtendsNoSuper.Meta<R, S> metaDoubleGenericsNoExtendsNoSuper(Class<R> cls1, Class<S> cls2) {\n        return DoubleGenericsNoExtendsNoSuper.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(DoubleGenericsNoExtendsNoSuper.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public DoubleGenericsNoExtendsNoSuper.Meta<T, U> metaBean() {\n        return DoubleGenericsNoExtendsNoSuper.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the normal type.\n     * @return the value of the property\n     */\n    public String getNormalType() {\n        return normalType;\n    }\n\n    /**\n     * Sets the normal type.\n     * @param normalType  the new value of the property\n     */\n    public void setNormalType(String normalType) {\n        this.normalType = normalType;\n    }\n\n    /**\n     * Gets the the {@code normalType} property.\n     * @return the property, not null\n     */\n    public final Property<String> normalType() {\n        return metaBean().normalType().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public T getTypeT() {\n        return typeT;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeT  the new value of the property\n     */\n    public void setTypeT(T typeT) {\n        this.typeT = typeT;\n    }\n\n    /**\n     * Gets the the {@code typeT} property.\n     * @return the property, not null\n     */\n    public final Property<T> typeT() {\n        return metaBean().typeT().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public U getTypeU() {\n        return typeU;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeU  the new value of the property\n     */\n    public void setTypeU(U typeU) {\n        this.typeU = typeU;\n    }\n\n    /**\n     * Gets the the {@code typeU} property.\n     * @return the property, not null\n     */\n    public final Property<U> typeU() {\n        return metaBean().typeU().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public List<T> getTypeTList() {\n        return typeTList;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeTList  the new value of the property\n     */\n    public void setTypeTList(List<T> typeTList) {\n        this.typeTList = typeTList;\n    }\n\n    /**\n     * Gets the the {@code typeTList} property.\n     * @return the property, not null\n     */\n    public final Property<List<T>> typeTList() {\n        return metaBean().typeTList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public List<U> getTypeUList() {\n        return typeUList;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeUList  the new value of the property\n     */\n    public void setTypeUList(List<U> typeUList) {\n        this.typeUList = typeUList;\n    }\n\n    /**\n     * Gets the the {@code typeUList} property.\n     * @return the property, not null\n     */\n    public final Property<List<U>> typeUList() {\n        return metaBean().typeUList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public T[] getTypeTArray() {\n        return typeTArray;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeTArray  the new value of the property\n     */\n    public void setTypeTArray(T[] typeTArray) {\n        this.typeTArray = typeTArray;\n    }\n\n    /**\n     * Gets the the {@code typeTArray} property.\n     * @return the property, not null\n     */\n    public final Property<T[]> typeTArray() {\n        return metaBean().typeTArray().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public U[] getTypeUArray() {\n        return typeUArray;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeUArray  the new value of the property\n     */\n    public void setTypeUArray(U[] typeUArray) {\n        this.typeUArray = typeUArray;\n    }\n\n    /**\n     * Gets the the {@code typeUArray} property.\n     * @return the property, not null\n     */\n    public final Property<U[]> typeUArray() {\n        return metaBean().typeUArray().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public DoubleGenericsNoExtendsNoSuper<T, U> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            DoubleGenericsNoExtendsNoSuper<?, ?> other = (DoubleGenericsNoExtendsNoSuper<?, ?>) obj;\n            return JodaBeanUtils.equal(this.getNormalType(), other.getNormalType()) &&\n                    JodaBeanUtils.equal(this.getTypeT(), other.getTypeT()) &&\n                    JodaBeanUtils.equal(this.getTypeU(), other.getTypeU()) &&\n                    JodaBeanUtils.equal(this.getTypeTList(), other.getTypeTList()) &&\n                    JodaBeanUtils.equal(this.getTypeUList(), other.getTypeUList()) &&\n                    JodaBeanUtils.equal(this.getTypeTArray(), other.getTypeTArray()) &&\n                    JodaBeanUtils.equal(this.getTypeUArray(), other.getTypeUArray());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNormalType());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeT());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeU());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeTList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeUList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeTArray());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeUArray());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(256);\n        buf.append(\"DoubleGenericsNoExtendsNoSuper{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"normalType\").append('=').append(JodaBeanUtils.toString(getNormalType())).append(',').append(' ');\n        buf.append(\"typeT\").append('=').append(JodaBeanUtils.toString(getTypeT())).append(',').append(' ');\n        buf.append(\"typeU\").append('=').append(JodaBeanUtils.toString(getTypeU())).append(',').append(' ');\n        buf.append(\"typeTList\").append('=').append(JodaBeanUtils.toString(getTypeTList())).append(',').append(' ');\n        buf.append(\"typeUList\").append('=').append(JodaBeanUtils.toString(getTypeUList())).append(',').append(' ');\n        buf.append(\"typeTArray\").append('=').append(JodaBeanUtils.toString(getTypeTArray())).append(',').append(' ');\n        buf.append(\"typeUArray\").append('=').append(JodaBeanUtils.toString(getTypeUArray())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code DoubleGenericsNoExtendsNoSuper}.\n     * @param <T>  the type\n     * @param <U>  the type\n     */\n    public static class Meta<T, U> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code normalType} property.\n         */\n        private final MetaProperty<String> normalType = DirectMetaProperty.ofReadWrite(\n                this, \"normalType\", DoubleGenericsNoExtendsNoSuper.class, String.class);\n        /**\n         * The meta-property for the {@code typeT} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T> typeT = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeT\", DoubleGenericsNoExtendsNoSuper.class, Object.class);\n        /**\n         * The meta-property for the {@code typeU} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<U> typeU = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeU\", DoubleGenericsNoExtendsNoSuper.class, Object.class);\n        /**\n         * The meta-property for the {@code typeTList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<T>> typeTList = DirectMetaProperty.ofReadWrite(\n                this, \"typeTList\", DoubleGenericsNoExtendsNoSuper.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code typeUList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<U>> typeUList = DirectMetaProperty.ofReadWrite(\n                this, \"typeUList\", DoubleGenericsNoExtendsNoSuper.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code typeTArray} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T[]> typeTArray = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeTArray\", DoubleGenericsNoExtendsNoSuper.class, Object[].class);\n        /**\n         * The meta-property for the {@code typeUArray} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<U[]> typeUArray = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeUArray\", DoubleGenericsNoExtendsNoSuper.class, Object[].class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"normalType\",\n                \"typeT\",\n                \"typeU\",\n                \"typeTList\",\n                \"typeUList\",\n                \"typeTArray\",\n                \"typeUArray\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    return this.normalType;\n                case 110843994:  // typeT\n                    return this.typeT;\n                case 110843995:  // typeU\n                    return this.typeU;\n                case 508018712:  // typeTList\n                    return this.typeTList;\n                case 508942233:  // typeUList\n                    return this.typeUList;\n                case -1441181153:  // typeTArray\n                    return this.typeTArray;\n                case -1412552002:  // typeUArray\n                    return this.typeUArray;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends DoubleGenericsNoExtendsNoSuper<T, U>> builder() {\n            return new DirectBeanBuilder<>(new DoubleGenericsNoExtendsNoSuper<T, U>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends DoubleGenericsNoExtendsNoSuper<T, U>> beanType() {\n            return (Class) DoubleGenericsNoExtendsNoSuper.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code normalType} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> normalType() {\n            return normalType;\n        }\n\n        /**\n         * The meta-property for the {@code typeT} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T> typeT() {\n            return typeT;\n        }\n\n        /**\n         * The meta-property for the {@code typeU} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<U> typeU() {\n            return typeU;\n        }\n\n        /**\n         * The meta-property for the {@code typeTList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<T>> typeTList() {\n            return typeTList;\n        }\n\n        /**\n         * The meta-property for the {@code typeUList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<U>> typeUList() {\n            return typeUList;\n        }\n\n        /**\n         * The meta-property for the {@code typeTArray} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T[]> typeTArray() {\n            return typeTArray;\n        }\n\n        /**\n         * The meta-property for the {@code typeUArray} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<U[]> typeUArray() {\n            return typeUArray;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    return ((DoubleGenericsNoExtendsNoSuper<?, ?>) bean).getNormalType();\n                case 110843994:  // typeT\n                    return ((DoubleGenericsNoExtendsNoSuper<?, ?>) bean).getTypeT();\n                case 110843995:  // typeU\n                    return ((DoubleGenericsNoExtendsNoSuper<?, ?>) bean).getTypeU();\n                case 508018712:  // typeTList\n                    return ((DoubleGenericsNoExtendsNoSuper<?, ?>) bean).getTypeTList();\n                case 508942233:  // typeUList\n                    return ((DoubleGenericsNoExtendsNoSuper<?, ?>) bean).getTypeUList();\n                case -1441181153:  // typeTArray\n                    return ((DoubleGenericsNoExtendsNoSuper<?, ?>) bean).getTypeTArray();\n                case -1412552002:  // typeUArray\n                    return ((DoubleGenericsNoExtendsNoSuper<?, ?>) bean).getTypeUArray();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    ((DoubleGenericsNoExtendsNoSuper<T, U>) bean).setNormalType((String) newValue);\n                    return;\n                case 110843994:  // typeT\n                    ((DoubleGenericsNoExtendsNoSuper<T, U>) bean).setTypeT((T) newValue);\n                    return;\n                case 110843995:  // typeU\n                    ((DoubleGenericsNoExtendsNoSuper<T, U>) bean).setTypeU((U) newValue);\n                    return;\n                case 508018712:  // typeTList\n                    ((DoubleGenericsNoExtendsNoSuper<T, U>) bean).setTypeTList((List<T>) newValue);\n                    return;\n                case 508942233:  // typeUList\n                    ((DoubleGenericsNoExtendsNoSuper<T, U>) bean).setTypeUList((List<U>) newValue);\n                    return;\n                case -1441181153:  // typeTArray\n                    ((DoubleGenericsNoExtendsNoSuper<T, U>) bean).setTypeTArray((T[]) newValue);\n                    return;\n                case -1412552002:  // typeUArray\n                    ((DoubleGenericsNoExtendsNoSuper<T, U>) bean).setTypeUArray((U[]) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/DoubleGenericsSimpleSuper.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class DoubleGenericsSimpleSuper<T, U>\n        implements Bean {\n\n    /** The normal type. */\n    @PropertyDefinition\n    private String baseType;\n    /** The type T value. */\n    @PropertyDefinition\n    private T baseT;\n    /** The type U value. */\n    @PropertyDefinition\n    private U baseU;\n\n    /**\n     * Creates an instance.\n     */\n    public DoubleGenericsSimpleSuper() {\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code DoubleGenericsSimpleSuper}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static DoubleGenericsSimpleSuper.Meta meta() {\n        return DoubleGenericsSimpleSuper.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code DoubleGenericsSimpleSuper}.\n     * @param <R>  the first generic type\n     * @param <S>  the second generic type\n     * @param cls1  the first generic type\n     * @param cls2  the second generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R, S> DoubleGenericsSimpleSuper.Meta<R, S> metaDoubleGenericsSimpleSuper(Class<R> cls1, Class<S> cls2) {\n        return DoubleGenericsSimpleSuper.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(DoubleGenericsSimpleSuper.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public DoubleGenericsSimpleSuper.Meta<T, U> metaBean() {\n        return DoubleGenericsSimpleSuper.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the normal type.\n     * @return the value of the property\n     */\n    public String getBaseType() {\n        return baseType;\n    }\n\n    /**\n     * Sets the normal type.\n     * @param baseType  the new value of the property\n     */\n    public void setBaseType(String baseType) {\n        this.baseType = baseType;\n    }\n\n    /**\n     * Gets the the {@code baseType} property.\n     * @return the property, not null\n     */\n    public final Property<String> baseType() {\n        return metaBean().baseType().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public T getBaseT() {\n        return baseT;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param baseT  the new value of the property\n     */\n    public void setBaseT(T baseT) {\n        this.baseT = baseT;\n    }\n\n    /**\n     * Gets the the {@code baseT} property.\n     * @return the property, not null\n     */\n    public final Property<T> baseT() {\n        return metaBean().baseT().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public U getBaseU() {\n        return baseU;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param baseU  the new value of the property\n     */\n    public void setBaseU(U baseU) {\n        this.baseU = baseU;\n    }\n\n    /**\n     * Gets the the {@code baseU} property.\n     * @return the property, not null\n     */\n    public final Property<U> baseU() {\n        return metaBean().baseU().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public DoubleGenericsSimpleSuper<T, U> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            DoubleGenericsSimpleSuper<?, ?> other = (DoubleGenericsSimpleSuper<?, ?>) obj;\n            return JodaBeanUtils.equal(this.getBaseType(), other.getBaseType()) &&\n                    JodaBeanUtils.equal(this.getBaseT(), other.getBaseT()) &&\n                    JodaBeanUtils.equal(this.getBaseU(), other.getBaseU());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getBaseType());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getBaseT());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getBaseU());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(128);\n        buf.append(\"DoubleGenericsSimpleSuper{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"baseType\").append('=').append(JodaBeanUtils.toString(getBaseType())).append(',').append(' ');\n        buf.append(\"baseT\").append('=').append(JodaBeanUtils.toString(getBaseT())).append(',').append(' ');\n        buf.append(\"baseU\").append('=').append(JodaBeanUtils.toString(getBaseU())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code DoubleGenericsSimpleSuper}.\n     * @param <T>  the type\n     * @param <U>  the type\n     */\n    public static class Meta<T, U> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code baseType} property.\n         */\n        private final MetaProperty<String> baseType = DirectMetaProperty.ofReadWrite(\n                this, \"baseType\", DoubleGenericsSimpleSuper.class, String.class);\n        /**\n         * The meta-property for the {@code baseT} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T> baseT = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"baseT\", DoubleGenericsSimpleSuper.class, Object.class);\n        /**\n         * The meta-property for the {@code baseU} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<U> baseU = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"baseU\", DoubleGenericsSimpleSuper.class, Object.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"baseType\",\n                \"baseT\",\n                \"baseU\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1721484885:  // baseType\n                    return this.baseType;\n                case 93508515:  // baseT\n                    return this.baseT;\n                case 93508516:  // baseU\n                    return this.baseU;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends DoubleGenericsSimpleSuper<T, U>> builder() {\n            return new DirectBeanBuilder<>(new DoubleGenericsSimpleSuper<T, U>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends DoubleGenericsSimpleSuper<T, U>> beanType() {\n            return (Class) DoubleGenericsSimpleSuper.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code baseType} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> baseType() {\n            return baseType;\n        }\n\n        /**\n         * The meta-property for the {@code baseT} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T> baseT() {\n            return baseT;\n        }\n\n        /**\n         * The meta-property for the {@code baseU} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<U> baseU() {\n            return baseU;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1721484885:  // baseType\n                    return ((DoubleGenericsSimpleSuper<?, ?>) bean).getBaseType();\n                case 93508515:  // baseT\n                    return ((DoubleGenericsSimpleSuper<?, ?>) bean).getBaseT();\n                case 93508516:  // baseU\n                    return ((DoubleGenericsSimpleSuper<?, ?>) bean).getBaseU();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1721484885:  // baseType\n                    ((DoubleGenericsSimpleSuper<T, U>) bean).setBaseType((String) newValue);\n                    return;\n                case 93508515:  // baseT\n                    ((DoubleGenericsSimpleSuper<T, U>) bean).setBaseT((T) newValue);\n                    return;\n                case 93508516:  // baseU\n                    ((DoubleGenericsSimpleSuper<T, U>) bean).setBaseU((U) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/DoubleGenericsWithExtendsNoSuper.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class DoubleGenericsWithExtendsNoSuper<T extends Serializable, U extends Number>\n        implements Bean {\n\n    /** The normal type. */\n    @PropertyDefinition\n    private String normalType;\n    /** The type T value. */\n    @PropertyDefinition\n    private T typeT;\n    /** The type U value. */\n    @PropertyDefinition\n    private U typeU;\n    /** The type T value. */\n    @PropertyDefinition\n    private List<T> typeTList;\n    /** The type U value. */\n    @PropertyDefinition\n    private List<U> typeUList;\n    /** The type T value. */\n    @PropertyDefinition\n    private T[] typeTArray;\n    /** The type U value. */\n    @PropertyDefinition\n    private U[] typeUArray;\n    /** The list of generic T as an array. */\n    @PropertyDefinition\n    private List<T>[] typeTArrayOfList;\n    /** The list of generic T as an array. */\n    @PropertyDefinition\n    private List<T>[][] typeTArray2dOfList;\n\n    /**\n     * Creates an instance.\n     */\n    public DoubleGenericsWithExtendsNoSuper() {\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code DoubleGenericsWithExtendsNoSuper}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static DoubleGenericsWithExtendsNoSuper.Meta meta() {\n        return DoubleGenericsWithExtendsNoSuper.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code DoubleGenericsWithExtendsNoSuper}.\n     * @param <R>  the first generic type\n     * @param <S>  the second generic type\n     * @param cls1  the first generic type\n     * @param cls2  the second generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Serializable, S extends Number> DoubleGenericsWithExtendsNoSuper.Meta<R, S> metaDoubleGenericsWithExtendsNoSuper(Class<R> cls1, Class<S> cls2) {\n        return DoubleGenericsWithExtendsNoSuper.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(DoubleGenericsWithExtendsNoSuper.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public DoubleGenericsWithExtendsNoSuper.Meta<T, U> metaBean() {\n        return DoubleGenericsWithExtendsNoSuper.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the normal type.\n     * @return the value of the property\n     */\n    public String getNormalType() {\n        return normalType;\n    }\n\n    /**\n     * Sets the normal type.\n     * @param normalType  the new value of the property\n     */\n    public void setNormalType(String normalType) {\n        this.normalType = normalType;\n    }\n\n    /**\n     * Gets the the {@code normalType} property.\n     * @return the property, not null\n     */\n    public final Property<String> normalType() {\n        return metaBean().normalType().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public T getTypeT() {\n        return typeT;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeT  the new value of the property\n     */\n    public void setTypeT(T typeT) {\n        this.typeT = typeT;\n    }\n\n    /**\n     * Gets the the {@code typeT} property.\n     * @return the property, not null\n     */\n    public final Property<T> typeT() {\n        return metaBean().typeT().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public U getTypeU() {\n        return typeU;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeU  the new value of the property\n     */\n    public void setTypeU(U typeU) {\n        this.typeU = typeU;\n    }\n\n    /**\n     * Gets the the {@code typeU} property.\n     * @return the property, not null\n     */\n    public final Property<U> typeU() {\n        return metaBean().typeU().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public List<T> getTypeTList() {\n        return typeTList;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeTList  the new value of the property\n     */\n    public void setTypeTList(List<T> typeTList) {\n        this.typeTList = typeTList;\n    }\n\n    /**\n     * Gets the the {@code typeTList} property.\n     * @return the property, not null\n     */\n    public final Property<List<T>> typeTList() {\n        return metaBean().typeTList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public List<U> getTypeUList() {\n        return typeUList;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeUList  the new value of the property\n     */\n    public void setTypeUList(List<U> typeUList) {\n        this.typeUList = typeUList;\n    }\n\n    /**\n     * Gets the the {@code typeUList} property.\n     * @return the property, not null\n     */\n    public final Property<List<U>> typeUList() {\n        return metaBean().typeUList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public T[] getTypeTArray() {\n        return typeTArray;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeTArray  the new value of the property\n     */\n    public void setTypeTArray(T[] typeTArray) {\n        this.typeTArray = typeTArray;\n    }\n\n    /**\n     * Gets the the {@code typeTArray} property.\n     * @return the property, not null\n     */\n    public final Property<T[]> typeTArray() {\n        return metaBean().typeTArray().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public U[] getTypeUArray() {\n        return typeUArray;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeUArray  the new value of the property\n     */\n    public void setTypeUArray(U[] typeUArray) {\n        this.typeUArray = typeUArray;\n    }\n\n    /**\n     * Gets the the {@code typeUArray} property.\n     * @return the property, not null\n     */\n    public final Property<U[]> typeUArray() {\n        return metaBean().typeUArray().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the list of generic T as an array.\n     * @return the value of the property\n     */\n    public List<T>[] getTypeTArrayOfList() {\n        return typeTArrayOfList;\n    }\n\n    /**\n     * Sets the list of generic T as an array.\n     * @param typeTArrayOfList  the new value of the property\n     */\n    public void setTypeTArrayOfList(List<T>[] typeTArrayOfList) {\n        this.typeTArrayOfList = typeTArrayOfList;\n    }\n\n    /**\n     * Gets the the {@code typeTArrayOfList} property.\n     * @return the property, not null\n     */\n    public final Property<List<T>[]> typeTArrayOfList() {\n        return metaBean().typeTArrayOfList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the list of generic T as an array.\n     * @return the value of the property\n     */\n    public List<T>[][] getTypeTArray2dOfList() {\n        return typeTArray2dOfList;\n    }\n\n    /**\n     * Sets the list of generic T as an array.\n     * @param typeTArray2dOfList  the new value of the property\n     */\n    public void setTypeTArray2dOfList(List<T>[][] typeTArray2dOfList) {\n        this.typeTArray2dOfList = typeTArray2dOfList;\n    }\n\n    /**\n     * Gets the the {@code typeTArray2dOfList} property.\n     * @return the property, not null\n     */\n    public final Property<List<T>[][]> typeTArray2dOfList() {\n        return metaBean().typeTArray2dOfList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public DoubleGenericsWithExtendsNoSuper<T, U> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            DoubleGenericsWithExtendsNoSuper<?, ?> other = (DoubleGenericsWithExtendsNoSuper<?, ?>) obj;\n            return JodaBeanUtils.equal(this.getNormalType(), other.getNormalType()) &&\n                    JodaBeanUtils.equal(this.getTypeT(), other.getTypeT()) &&\n                    JodaBeanUtils.equal(this.getTypeU(), other.getTypeU()) &&\n                    JodaBeanUtils.equal(this.getTypeTList(), other.getTypeTList()) &&\n                    JodaBeanUtils.equal(this.getTypeUList(), other.getTypeUList()) &&\n                    JodaBeanUtils.equal(this.getTypeTArray(), other.getTypeTArray()) &&\n                    JodaBeanUtils.equal(this.getTypeUArray(), other.getTypeUArray()) &&\n                    JodaBeanUtils.equal(this.getTypeTArrayOfList(), other.getTypeTArrayOfList()) &&\n                    JodaBeanUtils.equal(this.getTypeTArray2dOfList(), other.getTypeTArray2dOfList());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNormalType());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeT());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeU());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeTList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeUList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeTArray());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeUArray());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeTArrayOfList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeTArray2dOfList());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(320);\n        buf.append(\"DoubleGenericsWithExtendsNoSuper{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"normalType\").append('=').append(JodaBeanUtils.toString(getNormalType())).append(',').append(' ');\n        buf.append(\"typeT\").append('=').append(JodaBeanUtils.toString(getTypeT())).append(',').append(' ');\n        buf.append(\"typeU\").append('=').append(JodaBeanUtils.toString(getTypeU())).append(',').append(' ');\n        buf.append(\"typeTList\").append('=').append(JodaBeanUtils.toString(getTypeTList())).append(',').append(' ');\n        buf.append(\"typeUList\").append('=').append(JodaBeanUtils.toString(getTypeUList())).append(',').append(' ');\n        buf.append(\"typeTArray\").append('=').append(JodaBeanUtils.toString(getTypeTArray())).append(',').append(' ');\n        buf.append(\"typeUArray\").append('=').append(JodaBeanUtils.toString(getTypeUArray())).append(',').append(' ');\n        buf.append(\"typeTArrayOfList\").append('=').append(JodaBeanUtils.toString(getTypeTArrayOfList())).append(',').append(' ');\n        buf.append(\"typeTArray2dOfList\").append('=').append(JodaBeanUtils.toString(getTypeTArray2dOfList())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code DoubleGenericsWithExtendsNoSuper}.\n     * @param <T>  the type\n     * @param <U>  the type\n     */\n    public static class Meta<T extends Serializable, U extends Number> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code normalType} property.\n         */\n        private final MetaProperty<String> normalType = DirectMetaProperty.ofReadWrite(\n                this, \"normalType\", DoubleGenericsWithExtendsNoSuper.class, String.class);\n        /**\n         * The meta-property for the {@code typeT} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T> typeT = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeT\", DoubleGenericsWithExtendsNoSuper.class, Object.class);\n        /**\n         * The meta-property for the {@code typeU} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<U> typeU = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeU\", DoubleGenericsWithExtendsNoSuper.class, Object.class);\n        /**\n         * The meta-property for the {@code typeTList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<T>> typeTList = DirectMetaProperty.ofReadWrite(\n                this, \"typeTList\", DoubleGenericsWithExtendsNoSuper.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code typeUList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<U>> typeUList = DirectMetaProperty.ofReadWrite(\n                this, \"typeUList\", DoubleGenericsWithExtendsNoSuper.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code typeTArray} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T[]> typeTArray = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeTArray\", DoubleGenericsWithExtendsNoSuper.class, Object[].class);\n        /**\n         * The meta-property for the {@code typeUArray} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<U[]> typeUArray = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeUArray\", DoubleGenericsWithExtendsNoSuper.class, Object[].class);\n        /**\n         * The meta-property for the {@code typeTArrayOfList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<T>[]> typeTArrayOfList = DirectMetaProperty.ofReadWrite(\n                this, \"typeTArrayOfList\", DoubleGenericsWithExtendsNoSuper.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code typeTArray2dOfList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<T>[][]> typeTArray2dOfList = DirectMetaProperty.ofReadWrite(\n                this, \"typeTArray2dOfList\", DoubleGenericsWithExtendsNoSuper.class, (Class) List.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"normalType\",\n                \"typeT\",\n                \"typeU\",\n                \"typeTList\",\n                \"typeUList\",\n                \"typeTArray\",\n                \"typeUArray\",\n                \"typeTArrayOfList\",\n                \"typeTArray2dOfList\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    return this.normalType;\n                case 110843994:  // typeT\n                    return this.typeT;\n                case 110843995:  // typeU\n                    return this.typeU;\n                case 508018712:  // typeTList\n                    return this.typeTList;\n                case 508942233:  // typeUList\n                    return this.typeUList;\n                case -1441181153:  // typeTArray\n                    return this.typeTArray;\n                case -1412552002:  // typeUArray\n                    return this.typeUArray;\n                case -1497015788:  // typeTArrayOfList\n                    return this.typeTArrayOfList;\n                case -513079482:  // typeTArray2dOfList\n                    return this.typeTArray2dOfList;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends DoubleGenericsWithExtendsNoSuper<T, U>> builder() {\n            return new DirectBeanBuilder<>(new DoubleGenericsWithExtendsNoSuper<T, U>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends DoubleGenericsWithExtendsNoSuper<T, U>> beanType() {\n            return (Class) DoubleGenericsWithExtendsNoSuper.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code normalType} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> normalType() {\n            return normalType;\n        }\n\n        /**\n         * The meta-property for the {@code typeT} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T> typeT() {\n            return typeT;\n        }\n\n        /**\n         * The meta-property for the {@code typeU} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<U> typeU() {\n            return typeU;\n        }\n\n        /**\n         * The meta-property for the {@code typeTList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<T>> typeTList() {\n            return typeTList;\n        }\n\n        /**\n         * The meta-property for the {@code typeUList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<U>> typeUList() {\n            return typeUList;\n        }\n\n        /**\n         * The meta-property for the {@code typeTArray} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T[]> typeTArray() {\n            return typeTArray;\n        }\n\n        /**\n         * The meta-property for the {@code typeUArray} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<U[]> typeUArray() {\n            return typeUArray;\n        }\n\n        /**\n         * The meta-property for the {@code typeTArrayOfList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<T>[]> typeTArrayOfList() {\n            return typeTArrayOfList;\n        }\n\n        /**\n         * The meta-property for the {@code typeTArray2dOfList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<T>[][]> typeTArray2dOfList() {\n            return typeTArray2dOfList;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    return ((DoubleGenericsWithExtendsNoSuper<?, ?>) bean).getNormalType();\n                case 110843994:  // typeT\n                    return ((DoubleGenericsWithExtendsNoSuper<?, ?>) bean).getTypeT();\n                case 110843995:  // typeU\n                    return ((DoubleGenericsWithExtendsNoSuper<?, ?>) bean).getTypeU();\n                case 508018712:  // typeTList\n                    return ((DoubleGenericsWithExtendsNoSuper<?, ?>) bean).getTypeTList();\n                case 508942233:  // typeUList\n                    return ((DoubleGenericsWithExtendsNoSuper<?, ?>) bean).getTypeUList();\n                case -1441181153:  // typeTArray\n                    return ((DoubleGenericsWithExtendsNoSuper<?, ?>) bean).getTypeTArray();\n                case -1412552002:  // typeUArray\n                    return ((DoubleGenericsWithExtendsNoSuper<?, ?>) bean).getTypeUArray();\n                case -1497015788:  // typeTArrayOfList\n                    return ((DoubleGenericsWithExtendsNoSuper<?, ?>) bean).getTypeTArrayOfList();\n                case -513079482:  // typeTArray2dOfList\n                    return ((DoubleGenericsWithExtendsNoSuper<?, ?>) bean).getTypeTArray2dOfList();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    ((DoubleGenericsWithExtendsNoSuper<T, U>) bean).setNormalType((String) newValue);\n                    return;\n                case 110843994:  // typeT\n                    ((DoubleGenericsWithExtendsNoSuper<T, U>) bean).setTypeT((T) newValue);\n                    return;\n                case 110843995:  // typeU\n                    ((DoubleGenericsWithExtendsNoSuper<T, U>) bean).setTypeU((U) newValue);\n                    return;\n                case 508018712:  // typeTList\n                    ((DoubleGenericsWithExtendsNoSuper<T, U>) bean).setTypeTList((List<T>) newValue);\n                    return;\n                case 508942233:  // typeUList\n                    ((DoubleGenericsWithExtendsNoSuper<T, U>) bean).setTypeUList((List<U>) newValue);\n                    return;\n                case -1441181153:  // typeTArray\n                    ((DoubleGenericsWithExtendsNoSuper<T, U>) bean).setTypeTArray((T[]) newValue);\n                    return;\n                case -1412552002:  // typeUArray\n                    ((DoubleGenericsWithExtendsNoSuper<T, U>) bean).setTypeUArray((U[]) newValue);\n                    return;\n                case -1497015788:  // typeTArrayOfList\n                    ((DoubleGenericsWithExtendsNoSuper<T, U>) bean).setTypeTArrayOfList((List<T>[]) newValue);\n                    return;\n                case -513079482:  // typeTArray2dOfList\n                    ((DoubleGenericsWithExtendsNoSuper<T, U>) bean).setTypeTArray2dOfList((List<T>[][]) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/DoubleGenericsWithExtendsSuperNoGenerics.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class DoubleGenericsWithExtendsSuperNoGenerics<T extends Serializable, U extends Number>\n        extends Company {\n\n    /** The normal type. */\n    @PropertyDefinition\n    private String normalType;\n    /** The type T value. */\n    @PropertyDefinition\n    private T typeT;\n    /** The type U value. */\n    @PropertyDefinition\n    private U typeU;\n    /** The type T value. */\n    @PropertyDefinition\n    private List<T> typeTList;\n    /** The type U value. */\n    @PropertyDefinition\n    private List<U> typeUList;\n    /** The type T value. */\n    @PropertyDefinition\n    private T[] typeTArray;\n    /** The type U value. */\n    @PropertyDefinition\n    private U[] typeUArray;\n\n    /**\n     * Creates an instance.\n     */\n    public DoubleGenericsWithExtendsSuperNoGenerics() {\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code DoubleGenericsWithExtendsSuperNoGenerics}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static DoubleGenericsWithExtendsSuperNoGenerics.Meta meta() {\n        return DoubleGenericsWithExtendsSuperNoGenerics.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code DoubleGenericsWithExtendsSuperNoGenerics}.\n     * @param <R>  the first generic type\n     * @param <S>  the second generic type\n     * @param cls1  the first generic type\n     * @param cls2  the second generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Serializable, S extends Number> DoubleGenericsWithExtendsSuperNoGenerics.Meta<R, S> metaDoubleGenericsWithExtendsSuperNoGenerics(Class<R> cls1, Class<S> cls2) {\n        return DoubleGenericsWithExtendsSuperNoGenerics.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(DoubleGenericsWithExtendsSuperNoGenerics.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public DoubleGenericsWithExtendsSuperNoGenerics.Meta<T, U> metaBean() {\n        return DoubleGenericsWithExtendsSuperNoGenerics.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the normal type.\n     * @return the value of the property\n     */\n    public String getNormalType() {\n        return normalType;\n    }\n\n    /**\n     * Sets the normal type.\n     * @param normalType  the new value of the property\n     */\n    public void setNormalType(String normalType) {\n        this.normalType = normalType;\n    }\n\n    /**\n     * Gets the the {@code normalType} property.\n     * @return the property, not null\n     */\n    public final Property<String> normalType() {\n        return metaBean().normalType().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public T getTypeT() {\n        return typeT;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeT  the new value of the property\n     */\n    public void setTypeT(T typeT) {\n        this.typeT = typeT;\n    }\n\n    /**\n     * Gets the the {@code typeT} property.\n     * @return the property, not null\n     */\n    public final Property<T> typeT() {\n        return metaBean().typeT().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public U getTypeU() {\n        return typeU;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeU  the new value of the property\n     */\n    public void setTypeU(U typeU) {\n        this.typeU = typeU;\n    }\n\n    /**\n     * Gets the the {@code typeU} property.\n     * @return the property, not null\n     */\n    public final Property<U> typeU() {\n        return metaBean().typeU().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public List<T> getTypeTList() {\n        return typeTList;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeTList  the new value of the property\n     */\n    public void setTypeTList(List<T> typeTList) {\n        this.typeTList = typeTList;\n    }\n\n    /**\n     * Gets the the {@code typeTList} property.\n     * @return the property, not null\n     */\n    public final Property<List<T>> typeTList() {\n        return metaBean().typeTList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public List<U> getTypeUList() {\n        return typeUList;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeUList  the new value of the property\n     */\n    public void setTypeUList(List<U> typeUList) {\n        this.typeUList = typeUList;\n    }\n\n    /**\n     * Gets the the {@code typeUList} property.\n     * @return the property, not null\n     */\n    public final Property<List<U>> typeUList() {\n        return metaBean().typeUList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public T[] getTypeTArray() {\n        return typeTArray;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeTArray  the new value of the property\n     */\n    public void setTypeTArray(T[] typeTArray) {\n        this.typeTArray = typeTArray;\n    }\n\n    /**\n     * Gets the the {@code typeTArray} property.\n     * @return the property, not null\n     */\n    public final Property<T[]> typeTArray() {\n        return metaBean().typeTArray().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public U[] getTypeUArray() {\n        return typeUArray;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeUArray  the new value of the property\n     */\n    public void setTypeUArray(U[] typeUArray) {\n        this.typeUArray = typeUArray;\n    }\n\n    /**\n     * Gets the the {@code typeUArray} property.\n     * @return the property, not null\n     */\n    public final Property<U[]> typeUArray() {\n        return metaBean().typeUArray().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public DoubleGenericsWithExtendsSuperNoGenerics<T, U> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            DoubleGenericsWithExtendsSuperNoGenerics<?, ?> other = (DoubleGenericsWithExtendsSuperNoGenerics<?, ?>) obj;\n            return JodaBeanUtils.equal(this.getNormalType(), other.getNormalType()) &&\n                    JodaBeanUtils.equal(this.getTypeT(), other.getTypeT()) &&\n                    JodaBeanUtils.equal(this.getTypeU(), other.getTypeU()) &&\n                    JodaBeanUtils.equal(this.getTypeTList(), other.getTypeTList()) &&\n                    JodaBeanUtils.equal(this.getTypeUList(), other.getTypeUList()) &&\n                    JodaBeanUtils.equal(this.getTypeTArray(), other.getTypeTArray()) &&\n                    JodaBeanUtils.equal(this.getTypeUArray(), other.getTypeUArray()) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNormalType());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeT());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeU());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeTList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeUList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeTArray());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeUArray());\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(256);\n        buf.append(\"DoubleGenericsWithExtendsSuperNoGenerics{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"normalType\").append('=').append(JodaBeanUtils.toString(getNormalType())).append(',').append(' ');\n        buf.append(\"typeT\").append('=').append(JodaBeanUtils.toString(getTypeT())).append(',').append(' ');\n        buf.append(\"typeU\").append('=').append(JodaBeanUtils.toString(getTypeU())).append(',').append(' ');\n        buf.append(\"typeTList\").append('=').append(JodaBeanUtils.toString(getTypeTList())).append(',').append(' ');\n        buf.append(\"typeUList\").append('=').append(JodaBeanUtils.toString(getTypeUList())).append(',').append(' ');\n        buf.append(\"typeTArray\").append('=').append(JodaBeanUtils.toString(getTypeTArray())).append(',').append(' ');\n        buf.append(\"typeUArray\").append('=').append(JodaBeanUtils.toString(getTypeUArray())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code DoubleGenericsWithExtendsSuperNoGenerics}.\n     * @param <T>  the type\n     * @param <U>  the type\n     */\n    public static class Meta<T extends Serializable, U extends Number> extends Company.Meta {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code normalType} property.\n         */\n        private final MetaProperty<String> normalType = DirectMetaProperty.ofReadWrite(\n                this, \"normalType\", DoubleGenericsWithExtendsSuperNoGenerics.class, String.class);\n        /**\n         * The meta-property for the {@code typeT} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T> typeT = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeT\", DoubleGenericsWithExtendsSuperNoGenerics.class, Object.class);\n        /**\n         * The meta-property for the {@code typeU} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<U> typeU = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeU\", DoubleGenericsWithExtendsSuperNoGenerics.class, Object.class);\n        /**\n         * The meta-property for the {@code typeTList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<T>> typeTList = DirectMetaProperty.ofReadWrite(\n                this, \"typeTList\", DoubleGenericsWithExtendsSuperNoGenerics.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code typeUList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<U>> typeUList = DirectMetaProperty.ofReadWrite(\n                this, \"typeUList\", DoubleGenericsWithExtendsSuperNoGenerics.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code typeTArray} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T[]> typeTArray = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeTArray\", DoubleGenericsWithExtendsSuperNoGenerics.class, Object[].class);\n        /**\n         * The meta-property for the {@code typeUArray} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<U[]> typeUArray = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeUArray\", DoubleGenericsWithExtendsSuperNoGenerics.class, Object[].class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"normalType\",\n                \"typeT\",\n                \"typeU\",\n                \"typeTList\",\n                \"typeUList\",\n                \"typeTArray\",\n                \"typeUArray\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    return this.normalType;\n                case 110843994:  // typeT\n                    return this.typeT;\n                case 110843995:  // typeU\n                    return this.typeU;\n                case 508018712:  // typeTList\n                    return this.typeTList;\n                case 508942233:  // typeUList\n                    return this.typeUList;\n                case -1441181153:  // typeTArray\n                    return this.typeTArray;\n                case -1412552002:  // typeUArray\n                    return this.typeUArray;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends DoubleGenericsWithExtendsSuperNoGenerics<T, U>> builder() {\n            return new DirectBeanBuilder<>(new DoubleGenericsWithExtendsSuperNoGenerics<T, U>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends DoubleGenericsWithExtendsSuperNoGenerics<T, U>> beanType() {\n            return (Class) DoubleGenericsWithExtendsSuperNoGenerics.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code normalType} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> normalType() {\n            return normalType;\n        }\n\n        /**\n         * The meta-property for the {@code typeT} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T> typeT() {\n            return typeT;\n        }\n\n        /**\n         * The meta-property for the {@code typeU} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<U> typeU() {\n            return typeU;\n        }\n\n        /**\n         * The meta-property for the {@code typeTList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<T>> typeTList() {\n            return typeTList;\n        }\n\n        /**\n         * The meta-property for the {@code typeUList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<U>> typeUList() {\n            return typeUList;\n        }\n\n        /**\n         * The meta-property for the {@code typeTArray} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T[]> typeTArray() {\n            return typeTArray;\n        }\n\n        /**\n         * The meta-property for the {@code typeUArray} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<U[]> typeUArray() {\n            return typeUArray;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    return ((DoubleGenericsWithExtendsSuperNoGenerics<?, ?>) bean).getNormalType();\n                case 110843994:  // typeT\n                    return ((DoubleGenericsWithExtendsSuperNoGenerics<?, ?>) bean).getTypeT();\n                case 110843995:  // typeU\n                    return ((DoubleGenericsWithExtendsSuperNoGenerics<?, ?>) bean).getTypeU();\n                case 508018712:  // typeTList\n                    return ((DoubleGenericsWithExtendsSuperNoGenerics<?, ?>) bean).getTypeTList();\n                case 508942233:  // typeUList\n                    return ((DoubleGenericsWithExtendsSuperNoGenerics<?, ?>) bean).getTypeUList();\n                case -1441181153:  // typeTArray\n                    return ((DoubleGenericsWithExtendsSuperNoGenerics<?, ?>) bean).getTypeTArray();\n                case -1412552002:  // typeUArray\n                    return ((DoubleGenericsWithExtendsSuperNoGenerics<?, ?>) bean).getTypeUArray();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    ((DoubleGenericsWithExtendsSuperNoGenerics<T, U>) bean).setNormalType((String) newValue);\n                    return;\n                case 110843994:  // typeT\n                    ((DoubleGenericsWithExtendsSuperNoGenerics<T, U>) bean).setTypeT((T) newValue);\n                    return;\n                case 110843995:  // typeU\n                    ((DoubleGenericsWithExtendsSuperNoGenerics<T, U>) bean).setTypeU((U) newValue);\n                    return;\n                case 508018712:  // typeTList\n                    ((DoubleGenericsWithExtendsSuperNoGenerics<T, U>) bean).setTypeTList((List<T>) newValue);\n                    return;\n                case 508942233:  // typeUList\n                    ((DoubleGenericsWithExtendsSuperNoGenerics<T, U>) bean).setTypeUList((List<U>) newValue);\n                    return;\n                case -1441181153:  // typeTArray\n                    ((DoubleGenericsWithExtendsSuperNoGenerics<T, U>) bean).setTypeTArray((T[]) newValue);\n                    return;\n                case -1412552002:  // typeUArray\n                    ((DoubleGenericsWithExtendsSuperNoGenerics<T, U>) bean).setTypeUArray((U[]) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/DoubleGenericsWithExtendsSuperOneGeneric.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class DoubleGenericsWithExtendsSuperOneGeneric<T extends Serializable, U extends Number>\n        extends Documentation<T> {\n\n    /** The normal type. */\n    @PropertyDefinition\n    private String normalType;\n    /** The type T value. */\n    @PropertyDefinition\n    private T typeT;\n    /** The type U value. */\n    @PropertyDefinition\n    private U typeU;\n    /** The type T value. */\n    @PropertyDefinition\n    private List<T> typeTList;\n    /** The type U value. */\n    @PropertyDefinition\n    private List<U> typeUList;\n    /** The type T value. */\n    @PropertyDefinition\n    private T[] typeTArray;\n    /** The type U value. */\n    @PropertyDefinition\n    private U[] typeUArray;\n\n    /**\n     * Creates an instance.\n     */\n    public DoubleGenericsWithExtendsSuperOneGeneric() {\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code DoubleGenericsWithExtendsSuperOneGeneric}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static DoubleGenericsWithExtendsSuperOneGeneric.Meta meta() {\n        return DoubleGenericsWithExtendsSuperOneGeneric.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code DoubleGenericsWithExtendsSuperOneGeneric}.\n     * @param <R>  the first generic type\n     * @param <S>  the second generic type\n     * @param cls1  the first generic type\n     * @param cls2  the second generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Serializable, S extends Number> DoubleGenericsWithExtendsSuperOneGeneric.Meta<R, S> metaDoubleGenericsWithExtendsSuperOneGeneric(Class<R> cls1, Class<S> cls2) {\n        return DoubleGenericsWithExtendsSuperOneGeneric.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(DoubleGenericsWithExtendsSuperOneGeneric.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public DoubleGenericsWithExtendsSuperOneGeneric.Meta<T, U> metaBean() {\n        return DoubleGenericsWithExtendsSuperOneGeneric.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the normal type.\n     * @return the value of the property\n     */\n    public String getNormalType() {\n        return normalType;\n    }\n\n    /**\n     * Sets the normal type.\n     * @param normalType  the new value of the property\n     */\n    public void setNormalType(String normalType) {\n        this.normalType = normalType;\n    }\n\n    /**\n     * Gets the the {@code normalType} property.\n     * @return the property, not null\n     */\n    public final Property<String> normalType() {\n        return metaBean().normalType().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public T getTypeT() {\n        return typeT;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeT  the new value of the property\n     */\n    public void setTypeT(T typeT) {\n        this.typeT = typeT;\n    }\n\n    /**\n     * Gets the the {@code typeT} property.\n     * @return the property, not null\n     */\n    public final Property<T> typeT() {\n        return metaBean().typeT().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public U getTypeU() {\n        return typeU;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeU  the new value of the property\n     */\n    public void setTypeU(U typeU) {\n        this.typeU = typeU;\n    }\n\n    /**\n     * Gets the the {@code typeU} property.\n     * @return the property, not null\n     */\n    public final Property<U> typeU() {\n        return metaBean().typeU().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public List<T> getTypeTList() {\n        return typeTList;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeTList  the new value of the property\n     */\n    public void setTypeTList(List<T> typeTList) {\n        this.typeTList = typeTList;\n    }\n\n    /**\n     * Gets the the {@code typeTList} property.\n     * @return the property, not null\n     */\n    public final Property<List<T>> typeTList() {\n        return metaBean().typeTList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public List<U> getTypeUList() {\n        return typeUList;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeUList  the new value of the property\n     */\n    public void setTypeUList(List<U> typeUList) {\n        this.typeUList = typeUList;\n    }\n\n    /**\n     * Gets the the {@code typeUList} property.\n     * @return the property, not null\n     */\n    public final Property<List<U>> typeUList() {\n        return metaBean().typeUList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public T[] getTypeTArray() {\n        return typeTArray;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeTArray  the new value of the property\n     */\n    public void setTypeTArray(T[] typeTArray) {\n        this.typeTArray = typeTArray;\n    }\n\n    /**\n     * Gets the the {@code typeTArray} property.\n     * @return the property, not null\n     */\n    public final Property<T[]> typeTArray() {\n        return metaBean().typeTArray().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public U[] getTypeUArray() {\n        return typeUArray;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeUArray  the new value of the property\n     */\n    public void setTypeUArray(U[] typeUArray) {\n        this.typeUArray = typeUArray;\n    }\n\n    /**\n     * Gets the the {@code typeUArray} property.\n     * @return the property, not null\n     */\n    public final Property<U[]> typeUArray() {\n        return metaBean().typeUArray().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public DoubleGenericsWithExtendsSuperOneGeneric<T, U> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            DoubleGenericsWithExtendsSuperOneGeneric<?, ?> other = (DoubleGenericsWithExtendsSuperOneGeneric<?, ?>) obj;\n            return JodaBeanUtils.equal(this.getNormalType(), other.getNormalType()) &&\n                    JodaBeanUtils.equal(this.getTypeT(), other.getTypeT()) &&\n                    JodaBeanUtils.equal(this.getTypeU(), other.getTypeU()) &&\n                    JodaBeanUtils.equal(this.getTypeTList(), other.getTypeTList()) &&\n                    JodaBeanUtils.equal(this.getTypeUList(), other.getTypeUList()) &&\n                    JodaBeanUtils.equal(this.getTypeTArray(), other.getTypeTArray()) &&\n                    JodaBeanUtils.equal(this.getTypeUArray(), other.getTypeUArray()) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNormalType());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeT());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeU());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeTList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeUList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeTArray());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeUArray());\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(256);\n        buf.append(\"DoubleGenericsWithExtendsSuperOneGeneric{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"normalType\").append('=').append(JodaBeanUtils.toString(getNormalType())).append(',').append(' ');\n        buf.append(\"typeT\").append('=').append(JodaBeanUtils.toString(getTypeT())).append(',').append(' ');\n        buf.append(\"typeU\").append('=').append(JodaBeanUtils.toString(getTypeU())).append(',').append(' ');\n        buf.append(\"typeTList\").append('=').append(JodaBeanUtils.toString(getTypeTList())).append(',').append(' ');\n        buf.append(\"typeUList\").append('=').append(JodaBeanUtils.toString(getTypeUList())).append(',').append(' ');\n        buf.append(\"typeTArray\").append('=').append(JodaBeanUtils.toString(getTypeTArray())).append(',').append(' ');\n        buf.append(\"typeUArray\").append('=').append(JodaBeanUtils.toString(getTypeUArray())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code DoubleGenericsWithExtendsSuperOneGeneric}.\n     * @param <T>  the type\n     * @param <U>  the type\n     */\n    public static class Meta<T extends Serializable, U extends Number> extends Documentation.Meta<T> {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code normalType} property.\n         */\n        private final MetaProperty<String> normalType = DirectMetaProperty.ofReadWrite(\n                this, \"normalType\", DoubleGenericsWithExtendsSuperOneGeneric.class, String.class);\n        /**\n         * The meta-property for the {@code typeT} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T> typeT = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeT\", DoubleGenericsWithExtendsSuperOneGeneric.class, Object.class);\n        /**\n         * The meta-property for the {@code typeU} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<U> typeU = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeU\", DoubleGenericsWithExtendsSuperOneGeneric.class, Object.class);\n        /**\n         * The meta-property for the {@code typeTList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<T>> typeTList = DirectMetaProperty.ofReadWrite(\n                this, \"typeTList\", DoubleGenericsWithExtendsSuperOneGeneric.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code typeUList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<U>> typeUList = DirectMetaProperty.ofReadWrite(\n                this, \"typeUList\", DoubleGenericsWithExtendsSuperOneGeneric.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code typeTArray} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T[]> typeTArray = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeTArray\", DoubleGenericsWithExtendsSuperOneGeneric.class, Object[].class);\n        /**\n         * The meta-property for the {@code typeUArray} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<U[]> typeUArray = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeUArray\", DoubleGenericsWithExtendsSuperOneGeneric.class, Object[].class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"normalType\",\n                \"typeT\",\n                \"typeU\",\n                \"typeTList\",\n                \"typeUList\",\n                \"typeTArray\",\n                \"typeUArray\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    return this.normalType;\n                case 110843994:  // typeT\n                    return this.typeT;\n                case 110843995:  // typeU\n                    return this.typeU;\n                case 508018712:  // typeTList\n                    return this.typeTList;\n                case 508942233:  // typeUList\n                    return this.typeUList;\n                case -1441181153:  // typeTArray\n                    return this.typeTArray;\n                case -1412552002:  // typeUArray\n                    return this.typeUArray;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends DoubleGenericsWithExtendsSuperOneGeneric<T, U>> builder() {\n            return new DirectBeanBuilder<>(new DoubleGenericsWithExtendsSuperOneGeneric<T, U>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends DoubleGenericsWithExtendsSuperOneGeneric<T, U>> beanType() {\n            return (Class) DoubleGenericsWithExtendsSuperOneGeneric.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code normalType} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> normalType() {\n            return normalType;\n        }\n\n        /**\n         * The meta-property for the {@code typeT} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T> typeT() {\n            return typeT;\n        }\n\n        /**\n         * The meta-property for the {@code typeU} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<U> typeU() {\n            return typeU;\n        }\n\n        /**\n         * The meta-property for the {@code typeTList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<T>> typeTList() {\n            return typeTList;\n        }\n\n        /**\n         * The meta-property for the {@code typeUList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<U>> typeUList() {\n            return typeUList;\n        }\n\n        /**\n         * The meta-property for the {@code typeTArray} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T[]> typeTArray() {\n            return typeTArray;\n        }\n\n        /**\n         * The meta-property for the {@code typeUArray} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<U[]> typeUArray() {\n            return typeUArray;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    return ((DoubleGenericsWithExtendsSuperOneGeneric<?, ?>) bean).getNormalType();\n                case 110843994:  // typeT\n                    return ((DoubleGenericsWithExtendsSuperOneGeneric<?, ?>) bean).getTypeT();\n                case 110843995:  // typeU\n                    return ((DoubleGenericsWithExtendsSuperOneGeneric<?, ?>) bean).getTypeU();\n                case 508018712:  // typeTList\n                    return ((DoubleGenericsWithExtendsSuperOneGeneric<?, ?>) bean).getTypeTList();\n                case 508942233:  // typeUList\n                    return ((DoubleGenericsWithExtendsSuperOneGeneric<?, ?>) bean).getTypeUList();\n                case -1441181153:  // typeTArray\n                    return ((DoubleGenericsWithExtendsSuperOneGeneric<?, ?>) bean).getTypeTArray();\n                case -1412552002:  // typeUArray\n                    return ((DoubleGenericsWithExtendsSuperOneGeneric<?, ?>) bean).getTypeUArray();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    ((DoubleGenericsWithExtendsSuperOneGeneric<T, U>) bean).setNormalType((String) newValue);\n                    return;\n                case 110843994:  // typeT\n                    ((DoubleGenericsWithExtendsSuperOneGeneric<T, U>) bean).setTypeT((T) newValue);\n                    return;\n                case 110843995:  // typeU\n                    ((DoubleGenericsWithExtendsSuperOneGeneric<T, U>) bean).setTypeU((U) newValue);\n                    return;\n                case 508018712:  // typeTList\n                    ((DoubleGenericsWithExtendsSuperOneGeneric<T, U>) bean).setTypeTList((List<T>) newValue);\n                    return;\n                case 508942233:  // typeUList\n                    ((DoubleGenericsWithExtendsSuperOneGeneric<T, U>) bean).setTypeUList((List<U>) newValue);\n                    return;\n                case -1441181153:  // typeTArray\n                    ((DoubleGenericsWithExtendsSuperOneGeneric<T, U>) bean).setTypeTArray((T[]) newValue);\n                    return;\n                case -1412552002:  // typeUArray\n                    ((DoubleGenericsWithExtendsSuperOneGeneric<T, U>) bean).setTypeUArray((U[]) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/DoubleGenericsWithExtendsSuperTwoGenerics.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class DoubleGenericsWithExtendsSuperTwoGenerics<T extends Serializable, U extends Number>\n        extends DoubleGenericsSimpleSuper<T, Number> {\n\n    /** The normal type. */\n    @PropertyDefinition\n    private String normalType;\n    /** The type T value. */\n    @PropertyDefinition\n    private T typeT;\n    /** The type U value. */\n    @PropertyDefinition\n    private U typeU;\n    /** The type T value. */\n    @PropertyDefinition\n    private List<T> typeTList;\n    /** The type U value. */\n    @PropertyDefinition\n    private List<U> typeUList;\n    /** The type T value. */\n    @PropertyDefinition\n    private T[] typeTArray;\n    /** The type U value. */\n    @PropertyDefinition\n    private U[] typeUArray;\n\n    /**\n     * Creates an instance.\n     */\n    public DoubleGenericsWithExtendsSuperTwoGenerics() {\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code DoubleGenericsWithExtendsSuperTwoGenerics}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static DoubleGenericsWithExtendsSuperTwoGenerics.Meta meta() {\n        return DoubleGenericsWithExtendsSuperTwoGenerics.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code DoubleGenericsWithExtendsSuperTwoGenerics}.\n     * @param <R>  the first generic type\n     * @param <S>  the second generic type\n     * @param cls1  the first generic type\n     * @param cls2  the second generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Serializable, S extends Number> DoubleGenericsWithExtendsSuperTwoGenerics.Meta<R, S> metaDoubleGenericsWithExtendsSuperTwoGenerics(Class<R> cls1, Class<S> cls2) {\n        return DoubleGenericsWithExtendsSuperTwoGenerics.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(DoubleGenericsWithExtendsSuperTwoGenerics.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public DoubleGenericsWithExtendsSuperTwoGenerics.Meta<T, U> metaBean() {\n        return DoubleGenericsWithExtendsSuperTwoGenerics.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the normal type.\n     * @return the value of the property\n     */\n    public String getNormalType() {\n        return normalType;\n    }\n\n    /**\n     * Sets the normal type.\n     * @param normalType  the new value of the property\n     */\n    public void setNormalType(String normalType) {\n        this.normalType = normalType;\n    }\n\n    /**\n     * Gets the the {@code normalType} property.\n     * @return the property, not null\n     */\n    public final Property<String> normalType() {\n        return metaBean().normalType().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public T getTypeT() {\n        return typeT;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeT  the new value of the property\n     */\n    public void setTypeT(T typeT) {\n        this.typeT = typeT;\n    }\n\n    /**\n     * Gets the the {@code typeT} property.\n     * @return the property, not null\n     */\n    public final Property<T> typeT() {\n        return metaBean().typeT().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public U getTypeU() {\n        return typeU;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeU  the new value of the property\n     */\n    public void setTypeU(U typeU) {\n        this.typeU = typeU;\n    }\n\n    /**\n     * Gets the the {@code typeU} property.\n     * @return the property, not null\n     */\n    public final Property<U> typeU() {\n        return metaBean().typeU().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public List<T> getTypeTList() {\n        return typeTList;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeTList  the new value of the property\n     */\n    public void setTypeTList(List<T> typeTList) {\n        this.typeTList = typeTList;\n    }\n\n    /**\n     * Gets the the {@code typeTList} property.\n     * @return the property, not null\n     */\n    public final Property<List<T>> typeTList() {\n        return metaBean().typeTList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public List<U> getTypeUList() {\n        return typeUList;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeUList  the new value of the property\n     */\n    public void setTypeUList(List<U> typeUList) {\n        this.typeUList = typeUList;\n    }\n\n    /**\n     * Gets the the {@code typeUList} property.\n     * @return the property, not null\n     */\n    public final Property<List<U>> typeUList() {\n        return metaBean().typeUList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type T value.\n     * @return the value of the property\n     */\n    public T[] getTypeTArray() {\n        return typeTArray;\n    }\n\n    /**\n     * Sets the type T value.\n     * @param typeTArray  the new value of the property\n     */\n    public void setTypeTArray(T[] typeTArray) {\n        this.typeTArray = typeTArray;\n    }\n\n    /**\n     * Gets the the {@code typeTArray} property.\n     * @return the property, not null\n     */\n    public final Property<T[]> typeTArray() {\n        return metaBean().typeTArray().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type U value.\n     * @return the value of the property\n     */\n    public U[] getTypeUArray() {\n        return typeUArray;\n    }\n\n    /**\n     * Sets the type U value.\n     * @param typeUArray  the new value of the property\n     */\n    public void setTypeUArray(U[] typeUArray) {\n        this.typeUArray = typeUArray;\n    }\n\n    /**\n     * Gets the the {@code typeUArray} property.\n     * @return the property, not null\n     */\n    public final Property<U[]> typeUArray() {\n        return metaBean().typeUArray().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public DoubleGenericsWithExtendsSuperTwoGenerics<T, U> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            DoubleGenericsWithExtendsSuperTwoGenerics<?, ?> other = (DoubleGenericsWithExtendsSuperTwoGenerics<?, ?>) obj;\n            return JodaBeanUtils.equal(this.getNormalType(), other.getNormalType()) &&\n                    JodaBeanUtils.equal(this.getTypeT(), other.getTypeT()) &&\n                    JodaBeanUtils.equal(this.getTypeU(), other.getTypeU()) &&\n                    JodaBeanUtils.equal(this.getTypeTList(), other.getTypeTList()) &&\n                    JodaBeanUtils.equal(this.getTypeUList(), other.getTypeUList()) &&\n                    JodaBeanUtils.equal(this.getTypeTArray(), other.getTypeTArray()) &&\n                    JodaBeanUtils.equal(this.getTypeUArray(), other.getTypeUArray()) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNormalType());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeT());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeU());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeTList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeUList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeTArray());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTypeUArray());\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(256);\n        buf.append(\"DoubleGenericsWithExtendsSuperTwoGenerics{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"normalType\").append('=').append(JodaBeanUtils.toString(getNormalType())).append(',').append(' ');\n        buf.append(\"typeT\").append('=').append(JodaBeanUtils.toString(getTypeT())).append(',').append(' ');\n        buf.append(\"typeU\").append('=').append(JodaBeanUtils.toString(getTypeU())).append(',').append(' ');\n        buf.append(\"typeTList\").append('=').append(JodaBeanUtils.toString(getTypeTList())).append(',').append(' ');\n        buf.append(\"typeUList\").append('=').append(JodaBeanUtils.toString(getTypeUList())).append(',').append(' ');\n        buf.append(\"typeTArray\").append('=').append(JodaBeanUtils.toString(getTypeTArray())).append(',').append(' ');\n        buf.append(\"typeUArray\").append('=').append(JodaBeanUtils.toString(getTypeUArray())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code DoubleGenericsWithExtendsSuperTwoGenerics}.\n     * @param <T>  the type\n     * @param <U>  the type\n     */\n    public static class Meta<T extends Serializable, U extends Number> extends DoubleGenericsSimpleSuper.Meta<T, Number> {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code normalType} property.\n         */\n        private final MetaProperty<String> normalType = DirectMetaProperty.ofReadWrite(\n                this, \"normalType\", DoubleGenericsWithExtendsSuperTwoGenerics.class, String.class);\n        /**\n         * The meta-property for the {@code typeT} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T> typeT = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeT\", DoubleGenericsWithExtendsSuperTwoGenerics.class, Object.class);\n        /**\n         * The meta-property for the {@code typeU} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<U> typeU = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeU\", DoubleGenericsWithExtendsSuperTwoGenerics.class, Object.class);\n        /**\n         * The meta-property for the {@code typeTList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<T>> typeTList = DirectMetaProperty.ofReadWrite(\n                this, \"typeTList\", DoubleGenericsWithExtendsSuperTwoGenerics.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code typeUList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<U>> typeUList = DirectMetaProperty.ofReadWrite(\n                this, \"typeUList\", DoubleGenericsWithExtendsSuperTwoGenerics.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code typeTArray} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T[]> typeTArray = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeTArray\", DoubleGenericsWithExtendsSuperTwoGenerics.class, Object[].class);\n        /**\n         * The meta-property for the {@code typeUArray} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<U[]> typeUArray = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"typeUArray\", DoubleGenericsWithExtendsSuperTwoGenerics.class, Object[].class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"normalType\",\n                \"typeT\",\n                \"typeU\",\n                \"typeTList\",\n                \"typeUList\",\n                \"typeTArray\",\n                \"typeUArray\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    return this.normalType;\n                case 110843994:  // typeT\n                    return this.typeT;\n                case 110843995:  // typeU\n                    return this.typeU;\n                case 508018712:  // typeTList\n                    return this.typeTList;\n                case 508942233:  // typeUList\n                    return this.typeUList;\n                case -1441181153:  // typeTArray\n                    return this.typeTArray;\n                case -1412552002:  // typeUArray\n                    return this.typeUArray;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends DoubleGenericsWithExtendsSuperTwoGenerics<T, U>> builder() {\n            return new DirectBeanBuilder<>(new DoubleGenericsWithExtendsSuperTwoGenerics<T, U>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends DoubleGenericsWithExtendsSuperTwoGenerics<T, U>> beanType() {\n            return (Class) DoubleGenericsWithExtendsSuperTwoGenerics.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code normalType} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> normalType() {\n            return normalType;\n        }\n\n        /**\n         * The meta-property for the {@code typeT} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T> typeT() {\n            return typeT;\n        }\n\n        /**\n         * The meta-property for the {@code typeU} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<U> typeU() {\n            return typeU;\n        }\n\n        /**\n         * The meta-property for the {@code typeTList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<T>> typeTList() {\n            return typeTList;\n        }\n\n        /**\n         * The meta-property for the {@code typeUList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<U>> typeUList() {\n            return typeUList;\n        }\n\n        /**\n         * The meta-property for the {@code typeTArray} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T[]> typeTArray() {\n            return typeTArray;\n        }\n\n        /**\n         * The meta-property for the {@code typeUArray} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<U[]> typeUArray() {\n            return typeUArray;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    return ((DoubleGenericsWithExtendsSuperTwoGenerics<?, ?>) bean).getNormalType();\n                case 110843994:  // typeT\n                    return ((DoubleGenericsWithExtendsSuperTwoGenerics<?, ?>) bean).getTypeT();\n                case 110843995:  // typeU\n                    return ((DoubleGenericsWithExtendsSuperTwoGenerics<?, ?>) bean).getTypeU();\n                case 508018712:  // typeTList\n                    return ((DoubleGenericsWithExtendsSuperTwoGenerics<?, ?>) bean).getTypeTList();\n                case 508942233:  // typeUList\n                    return ((DoubleGenericsWithExtendsSuperTwoGenerics<?, ?>) bean).getTypeUList();\n                case -1441181153:  // typeTArray\n                    return ((DoubleGenericsWithExtendsSuperTwoGenerics<?, ?>) bean).getTypeTArray();\n                case -1412552002:  // typeUArray\n                    return ((DoubleGenericsWithExtendsSuperTwoGenerics<?, ?>) bean).getTypeUArray();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1255672639:  // normalType\n                    ((DoubleGenericsWithExtendsSuperTwoGenerics<T, U>) bean).setNormalType((String) newValue);\n                    return;\n                case 110843994:  // typeT\n                    ((DoubleGenericsWithExtendsSuperTwoGenerics<T, U>) bean).setTypeT((T) newValue);\n                    return;\n                case 110843995:  // typeU\n                    ((DoubleGenericsWithExtendsSuperTwoGenerics<T, U>) bean).setTypeU((U) newValue);\n                    return;\n                case 508018712:  // typeTList\n                    ((DoubleGenericsWithExtendsSuperTwoGenerics<T, U>) bean).setTypeTList((List<T>) newValue);\n                    return;\n                case 508942233:  // typeUList\n                    ((DoubleGenericsWithExtendsSuperTwoGenerics<T, U>) bean).setTypeUList((List<U>) newValue);\n                    return;\n                case -1441181153:  // typeTArray\n                    ((DoubleGenericsWithExtendsSuperTwoGenerics<T, U>) bean).setTypeTArray((T[]) newValue);\n                    return;\n                case -1412552002:  // typeUArray\n                    ((DoubleGenericsWithExtendsSuperTwoGenerics<T, U>) bean).setTypeUArray((U[]) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/FieldNamesImmutable.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n */\n@BeanDefinition(builderScope = \"public\", factoryName = \"of\")\npublic final class FieldNamesImmutable implements ImmutableBean {\n\n    /** Field named 'obj' to check for name clashes. */\n    @PropertyDefinition\n    private final String obj;\n    /** Field named 'other' to check for name clashes. */\n    @PropertyDefinition\n    private final String other;\n    /** Field named 'propertyName' to check for name clashes. */\n    @PropertyDefinition\n    private final String propertyName;\n    /** Field named 'newValue' to check for name clashes. */\n    @PropertyDefinition\n    private final String newValue;\n    /** Field named 'bean' to check for name clashes. */\n    @PropertyDefinition\n    private final String bean;\n    /** Field named 'beanToCopy' to check for name clashes. */\n    @PropertyDefinition\n    private final String beanToCopy;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code FieldNamesImmutable}.\n     * @return the meta-bean, not null\n     */\n    public static FieldNamesImmutable.Meta meta() {\n        return FieldNamesImmutable.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(FieldNamesImmutable.Meta.INSTANCE);\n    }\n\n    /**\n     * Obtains an instance.\n     * @param obj  the value of the property\n     * @param other  the value of the property\n     * @param propertyName  the value of the property\n     * @param newValue  the value of the property\n     * @param bean  the value of the property\n     * @param beanToCopy  the value of the property\n     * @return the instance\n     */\n    public static FieldNamesImmutable of(\n            String obj,\n            String other,\n            String propertyName,\n            String newValue,\n            String bean,\n            String beanToCopy) {\n        return new FieldNamesImmutable(\n            obj,\n            other,\n            propertyName,\n            newValue,\n            bean,\n            beanToCopy);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static FieldNamesImmutable.Builder builder() {\n        return new FieldNamesImmutable.Builder();\n    }\n\n    private FieldNamesImmutable(\n            String obj,\n            String other,\n            String propertyName,\n            String newValue,\n            String bean,\n            String beanToCopy) {\n        this.obj = obj;\n        this.other = other;\n        this.propertyName = propertyName;\n        this.newValue = newValue;\n        this.bean = bean;\n        this.beanToCopy = beanToCopy;\n    }\n\n    @Override\n    public FieldNamesImmutable.Meta metaBean() {\n        return FieldNamesImmutable.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets field named 'obj' to check for name clashes.\n     * @return the value of the property\n     */\n    public String getObj() {\n        return obj;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets field named 'other' to check for name clashes.\n     * @return the value of the property\n     */\n    public String getOther() {\n        return other;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets field named 'propertyName' to check for name clashes.\n     * @return the value of the property\n     */\n    public String getPropertyName() {\n        return propertyName;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets field named 'newValue' to check for name clashes.\n     * @return the value of the property\n     */\n    public String getNewValue() {\n        return newValue;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets field named 'bean' to check for name clashes.\n     * @return the value of the property\n     */\n    public String getBean() {\n        return bean;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets field named 'beanToCopy' to check for name clashes.\n     * @return the value of the property\n     */\n    public String getBeanToCopy() {\n        return beanToCopy;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            FieldNamesImmutable other = (FieldNamesImmutable) obj;\n            return JodaBeanUtils.equal(this.obj, other.obj) &&\n                    JodaBeanUtils.equal(this.other, other.other) &&\n                    JodaBeanUtils.equal(this.propertyName, other.propertyName) &&\n                    JodaBeanUtils.equal(this.newValue, other.newValue) &&\n                    JodaBeanUtils.equal(this.bean, other.bean) &&\n                    JodaBeanUtils.equal(this.beanToCopy, other.beanToCopy);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(obj);\n        hash = hash * 31 + JodaBeanUtils.hashCode(other);\n        hash = hash * 31 + JodaBeanUtils.hashCode(propertyName);\n        hash = hash * 31 + JodaBeanUtils.hashCode(newValue);\n        hash = hash * 31 + JodaBeanUtils.hashCode(bean);\n        hash = hash * 31 + JodaBeanUtils.hashCode(beanToCopy);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(224);\n        buf.append(\"FieldNamesImmutable{\");\n        buf.append(\"obj\").append('=').append(JodaBeanUtils.toString(obj)).append(',').append(' ');\n        buf.append(\"other\").append('=').append(JodaBeanUtils.toString(other)).append(',').append(' ');\n        buf.append(\"propertyName\").append('=').append(JodaBeanUtils.toString(propertyName)).append(',').append(' ');\n        buf.append(\"newValue\").append('=').append(JodaBeanUtils.toString(newValue)).append(',').append(' ');\n        buf.append(\"bean\").append('=').append(JodaBeanUtils.toString(bean)).append(',').append(' ');\n        buf.append(\"beanToCopy\").append('=').append(JodaBeanUtils.toString(beanToCopy));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code FieldNamesImmutable}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code obj} property.\n         */\n        private final MetaProperty<String> obj = DirectMetaProperty.ofImmutable(\n                this, \"obj\", FieldNamesImmutable.class, String.class);\n        /**\n         * The meta-property for the {@code other} property.\n         */\n        private final MetaProperty<String> other = DirectMetaProperty.ofImmutable(\n                this, \"other\", FieldNamesImmutable.class, String.class);\n        /**\n         * The meta-property for the {@code propertyName} property.\n         */\n        private final MetaProperty<String> propertyName = DirectMetaProperty.ofImmutable(\n                this, \"propertyName\", FieldNamesImmutable.class, String.class);\n        /**\n         * The meta-property for the {@code newValue} property.\n         */\n        private final MetaProperty<String> newValue = DirectMetaProperty.ofImmutable(\n                this, \"newValue\", FieldNamesImmutable.class, String.class);\n        /**\n         * The meta-property for the {@code bean} property.\n         */\n        private final MetaProperty<String> bean = DirectMetaProperty.ofImmutable(\n                this, \"bean\", FieldNamesImmutable.class, String.class);\n        /**\n         * The meta-property for the {@code beanToCopy} property.\n         */\n        private final MetaProperty<String> beanToCopy = DirectMetaProperty.ofImmutable(\n                this, \"beanToCopy\", FieldNamesImmutable.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"obj\",\n                \"other\",\n                \"propertyName\",\n                \"newValue\",\n                \"bean\",\n                \"beanToCopy\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 109815:  // obj\n                    return this.obj;\n                case 106069776:  // other\n                    return this.other;\n                case -864691712:  // propertyName\n                    return this.propertyName;\n                case 1368456113:  // newValue\n                    return this.newValue;\n                case 3019696:  // bean\n                    return this.bean;\n                case -1343227808:  // beanToCopy\n                    return this.beanToCopy;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public FieldNamesImmutable.Builder builder() {\n            return new FieldNamesImmutable.Builder();\n        }\n\n        @Override\n        public Class<? extends FieldNamesImmutable> beanType() {\n            return FieldNamesImmutable.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code obj} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> obj() {\n            return obj;\n        }\n\n        /**\n         * The meta-property for the {@code other} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> other() {\n            return other;\n        }\n\n        /**\n         * The meta-property for the {@code propertyName} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> propertyName() {\n            return propertyName;\n        }\n\n        /**\n         * The meta-property for the {@code newValue} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> newValue() {\n            return newValue;\n        }\n\n        /**\n         * The meta-property for the {@code bean} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> bean() {\n            return bean;\n        }\n\n        /**\n         * The meta-property for the {@code beanToCopy} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> beanToCopy() {\n            return beanToCopy;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 109815:  // obj\n                    return ((FieldNamesImmutable) bean).getObj();\n                case 106069776:  // other\n                    return ((FieldNamesImmutable) bean).getOther();\n                case -864691712:  // propertyName\n                    return ((FieldNamesImmutable) bean).getPropertyName();\n                case 1368456113:  // newValue\n                    return ((FieldNamesImmutable) bean).getNewValue();\n                case 3019696:  // bean\n                    return ((FieldNamesImmutable) bean).getBean();\n                case -1343227808:  // beanToCopy\n                    return ((FieldNamesImmutable) bean).getBeanToCopy();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code FieldNamesImmutable}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<FieldNamesImmutable> {\n\n        private String obj;\n        private String other;\n        private String propertyName;\n        private String newValue;\n        private String bean;\n        private String beanToCopy;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(FieldNamesImmutable beanToCopy) {\n            this.obj = beanToCopy.getObj();\n            this.other = beanToCopy.getOther();\n            this.propertyName = beanToCopy.getPropertyName();\n            this.newValue = beanToCopy.getNewValue();\n            this.bean = beanToCopy.getBean();\n            this.beanToCopy = beanToCopy.getBeanToCopy();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 109815:  // obj\n                    return this.obj;\n                case 106069776:  // other\n                    return this.other;\n                case -864691712:  // propertyName\n                    return this.propertyName;\n                case 1368456113:  // newValue\n                    return this.newValue;\n                case 3019696:  // bean\n                    return this.bean;\n                case -1343227808:  // beanToCopy\n                    return this.beanToCopy;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 109815:  // obj\n                    this.obj = (String) newValue;\n                    break;\n                case 106069776:  // other\n                    this.other = (String) newValue;\n                    break;\n                case -864691712:  // propertyName\n                    this.propertyName = (String) newValue;\n                    break;\n                case 1368456113:  // newValue\n                    this.newValue = (String) newValue;\n                    break;\n                case 3019696:  // bean\n                    this.bean = (String) newValue;\n                    break;\n                case -1343227808:  // beanToCopy\n                    this.beanToCopy = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public FieldNamesImmutable build() {\n            return new FieldNamesImmutable(\n                    obj,\n                    other,\n                    propertyName,\n                    newValue,\n                    bean,\n                    beanToCopy);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets field named 'obj' to check for name clashes.\n         * @param obj  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder obj(String obj) {\n            this.obj = obj;\n            return this;\n        }\n\n        /**\n         * Sets field named 'other' to check for name clashes.\n         * @param other  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder other(String other) {\n            this.other = other;\n            return this;\n        }\n\n        /**\n         * Sets field named 'propertyName' to check for name clashes.\n         * @param propertyName  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder propertyName(String propertyName) {\n            this.propertyName = propertyName;\n            return this;\n        }\n\n        /**\n         * Sets field named 'newValue' to check for name clashes.\n         * @param newValue  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder newValue(String newValue) {\n            this.newValue = newValue;\n            return this;\n        }\n\n        /**\n         * Sets field named 'bean' to check for name clashes.\n         * @param bean  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder bean(String bean) {\n            this.bean = bean;\n            return this;\n        }\n\n        /**\n         * Sets field named 'beanToCopy' to check for name clashes.\n         * @param beanToCopy  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder beanToCopy(String beanToCopy) {\n            this.beanToCopy = beanToCopy;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(224);\n            buf.append(\"FieldNamesImmutable.Builder{\");\n            buf.append(\"obj\").append('=').append(JodaBeanUtils.toString(obj)).append(',').append(' ');\n            buf.append(\"other\").append('=').append(JodaBeanUtils.toString(other)).append(',').append(' ');\n            buf.append(\"propertyName\").append('=').append(JodaBeanUtils.toString(propertyName)).append(',').append(' ');\n            buf.append(\"newValue\").append('=').append(JodaBeanUtils.toString(newValue)).append(',').append(' ');\n            buf.append(\"bean\").append('=').append(JodaBeanUtils.toString(bean)).append(',').append(' ');\n            buf.append(\"beanToCopy\").append('=').append(JodaBeanUtils.toString(beanToCopy));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/FieldNamesImmutableMinimal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.MinimalMetaBean;\n\n/**\n * Mock JavaBean, used for testing.\n */\n@BeanDefinition(style = \"minimal\")\npublic final class FieldNamesImmutableMinimal implements ImmutableBean {\n\n    /** Field named 'obj' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private final String obj;\n    /** Field named 'other' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private final String other;\n    /** Field named 'propertyName' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private final String propertyName;\n    /** Field named 'newValue' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private final String newValue;\n    /** Field named 'bean' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private final String bean;\n    /** Field named 'beanToCopy' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private final String beanToCopy;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code FieldNamesImmutableMinimal}.\n     */\n    private static final TypedMetaBean<FieldNamesImmutableMinimal> META_BEAN =\n            MinimalMetaBean.of(\n                    FieldNamesImmutableMinimal.class,\n                    new String[] {\n                            \"obj\",\n                            \"other\",\n                            \"propertyName\",\n                            \"newValue\",\n                            \"bean\",\n                            \"beanToCopy\"},\n                    () -> new FieldNamesImmutableMinimal.Builder(),\n                    b -> b.obj,\n                    b -> b.other,\n                    b -> b.propertyName,\n                    b -> b.newValue,\n                    b -> b.bean,\n                    b -> b.beanToCopy);\n\n    /**\n     * The meta-bean for {@code FieldNamesImmutableMinimal}.\n     * @return the meta-bean, not null\n     */\n    public static TypedMetaBean<FieldNamesImmutableMinimal> meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static FieldNamesImmutableMinimal.Builder builder() {\n        return new FieldNamesImmutableMinimal.Builder();\n    }\n\n    private FieldNamesImmutableMinimal(\n            String obj,\n            String other,\n            String propertyName,\n            String newValue,\n            String bean,\n            String beanToCopy) {\n        this.obj = obj;\n        this.other = other;\n        this.propertyName = propertyName;\n        this.newValue = newValue;\n        this.bean = bean;\n        this.beanToCopy = beanToCopy;\n    }\n\n    @Override\n    public TypedMetaBean<FieldNamesImmutableMinimal> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            FieldNamesImmutableMinimal other = (FieldNamesImmutableMinimal) obj;\n            return JodaBeanUtils.equal(this.obj, other.obj) &&\n                    JodaBeanUtils.equal(this.other, other.other) &&\n                    JodaBeanUtils.equal(this.propertyName, other.propertyName) &&\n                    JodaBeanUtils.equal(this.newValue, other.newValue) &&\n                    JodaBeanUtils.equal(this.bean, other.bean) &&\n                    JodaBeanUtils.equal(this.beanToCopy, other.beanToCopy);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(obj);\n        hash = hash * 31 + JodaBeanUtils.hashCode(other);\n        hash = hash * 31 + JodaBeanUtils.hashCode(propertyName);\n        hash = hash * 31 + JodaBeanUtils.hashCode(newValue);\n        hash = hash * 31 + JodaBeanUtils.hashCode(bean);\n        hash = hash * 31 + JodaBeanUtils.hashCode(beanToCopy);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(224);\n        buf.append(\"FieldNamesImmutableMinimal{\");\n        buf.append(\"obj\").append('=').append(JodaBeanUtils.toString(obj)).append(',').append(' ');\n        buf.append(\"other\").append('=').append(JodaBeanUtils.toString(other)).append(',').append(' ');\n        buf.append(\"propertyName\").append('=').append(JodaBeanUtils.toString(propertyName)).append(',').append(' ');\n        buf.append(\"newValue\").append('=').append(JodaBeanUtils.toString(newValue)).append(',').append(' ');\n        buf.append(\"bean\").append('=').append(JodaBeanUtils.toString(bean)).append(',').append(' ');\n        buf.append(\"beanToCopy\").append('=').append(JodaBeanUtils.toString(beanToCopy));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code FieldNamesImmutableMinimal}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<FieldNamesImmutableMinimal> {\n\n        private String obj;\n        private String other;\n        private String propertyName;\n        private String newValue;\n        private String bean;\n        private String beanToCopy;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(FieldNamesImmutableMinimal beanToCopy) {\n            this.obj = beanToCopy.obj;\n            this.other = beanToCopy.other;\n            this.propertyName = beanToCopy.propertyName;\n            this.newValue = beanToCopy.newValue;\n            this.bean = beanToCopy.bean;\n            this.beanToCopy = beanToCopy.beanToCopy;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 109815:  // obj\n                    return this.obj;\n                case 106069776:  // other\n                    return this.other;\n                case -864691712:  // propertyName\n                    return this.propertyName;\n                case 1368456113:  // newValue\n                    return this.newValue;\n                case 3019696:  // bean\n                    return this.bean;\n                case -1343227808:  // beanToCopy\n                    return this.beanToCopy;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 109815:  // obj\n                    this.obj = (String) newValue;\n                    break;\n                case 106069776:  // other\n                    this.other = (String) newValue;\n                    break;\n                case -864691712:  // propertyName\n                    this.propertyName = (String) newValue;\n                    break;\n                case 1368456113:  // newValue\n                    this.newValue = (String) newValue;\n                    break;\n                case 3019696:  // bean\n                    this.bean = (String) newValue;\n                    break;\n                case -1343227808:  // beanToCopy\n                    this.beanToCopy = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public FieldNamesImmutableMinimal build() {\n            return new FieldNamesImmutableMinimal(\n                    obj,\n                    other,\n                    propertyName,\n                    newValue,\n                    bean,\n                    beanToCopy);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets field named 'obj' to check for name clashes.\n         * @param obj  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder obj(String obj) {\n            this.obj = obj;\n            return this;\n        }\n\n        /**\n         * Sets field named 'other' to check for name clashes.\n         * @param other  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder other(String other) {\n            this.other = other;\n            return this;\n        }\n\n        /**\n         * Sets field named 'propertyName' to check for name clashes.\n         * @param propertyName  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder propertyName(String propertyName) {\n            this.propertyName = propertyName;\n            return this;\n        }\n\n        /**\n         * Sets field named 'newValue' to check for name clashes.\n         * @param newValue  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder newValue(String newValue) {\n            this.newValue = newValue;\n            return this;\n        }\n\n        /**\n         * Sets field named 'bean' to check for name clashes.\n         * @param bean  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder bean(String bean) {\n            this.bean = bean;\n            return this;\n        }\n\n        /**\n         * Sets field named 'beanToCopy' to check for name clashes.\n         * @param beanToCopy  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder beanToCopy(String beanToCopy) {\n            this.beanToCopy = beanToCopy;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(224);\n            buf.append(\"FieldNamesImmutableMinimal.Builder{\");\n            buf.append(\"obj\").append('=').append(JodaBeanUtils.toString(obj)).append(',').append(' ');\n            buf.append(\"other\").append('=').append(JodaBeanUtils.toString(other)).append(',').append(' ');\n            buf.append(\"propertyName\").append('=').append(JodaBeanUtils.toString(propertyName)).append(',').append(' ');\n            buf.append(\"newValue\").append('=').append(JodaBeanUtils.toString(newValue)).append(',').append(' ');\n            buf.append(\"bean\").append('=').append(JodaBeanUtils.toString(bean)).append(',').append(' ');\n            buf.append(\"beanToCopy\").append('=').append(JodaBeanUtils.toString(beanToCopy));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/FieldNamesLight.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.lang.invoke.MethodHandles;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.light.LightMetaBean;\n\n/**\n * Mock JavaBean, used for testing.\n */\n@BeanDefinition(style = \"light\", builderScope = \"public\")\npublic final class FieldNamesLight implements ImmutableBean {\n\n    /** Field named 'obj' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private final String obj;\n    /** Field named 'other' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private final String other;\n    /** Field named 'propertyName' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private final String propertyName;\n    /** Field named 'newValue' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private final String newValue;\n    /** Field named 'bean' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private final String bean;\n    /** Field named 'beanToCopy' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private final String beanToCopy;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code FieldNamesLight}.\n     */\n    private static final TypedMetaBean<FieldNamesLight> META_BEAN =\n            LightMetaBean.of(\n                    FieldNamesLight.class,\n                    MethodHandles.lookup(),\n                    new String[] {\n                            \"obj\",\n                            \"other\",\n                            \"propertyName\",\n                            \"newValue\",\n                            \"bean\",\n                            \"beanToCopy\"},\n                    new Object[0]);\n\n    /**\n     * The meta-bean for {@code FieldNamesLight}.\n     * @return the meta-bean, not null\n     */\n    public static TypedMetaBean<FieldNamesLight> meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    private FieldNamesLight(\n            String obj,\n            String other,\n            String propertyName,\n            String newValue,\n            String bean,\n            String beanToCopy) {\n        this.obj = obj;\n        this.other = other;\n        this.propertyName = propertyName;\n        this.newValue = newValue;\n        this.bean = bean;\n        this.beanToCopy = beanToCopy;\n    }\n\n    @Override\n    public TypedMetaBean<FieldNamesLight> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            FieldNamesLight other = (FieldNamesLight) obj;\n            return JodaBeanUtils.equal(this.obj, other.obj) &&\n                    JodaBeanUtils.equal(this.other, other.other) &&\n                    JodaBeanUtils.equal(this.propertyName, other.propertyName) &&\n                    JodaBeanUtils.equal(this.newValue, other.newValue) &&\n                    JodaBeanUtils.equal(this.bean, other.bean) &&\n                    JodaBeanUtils.equal(this.beanToCopy, other.beanToCopy);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(obj);\n        hash = hash * 31 + JodaBeanUtils.hashCode(other);\n        hash = hash * 31 + JodaBeanUtils.hashCode(propertyName);\n        hash = hash * 31 + JodaBeanUtils.hashCode(newValue);\n        hash = hash * 31 + JodaBeanUtils.hashCode(bean);\n        hash = hash * 31 + JodaBeanUtils.hashCode(beanToCopy);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(224);\n        buf.append(\"FieldNamesLight{\");\n        buf.append(\"obj\").append('=').append(JodaBeanUtils.toString(obj)).append(',').append(' ');\n        buf.append(\"other\").append('=').append(JodaBeanUtils.toString(other)).append(',').append(' ');\n        buf.append(\"propertyName\").append('=').append(JodaBeanUtils.toString(propertyName)).append(',').append(' ');\n        buf.append(\"newValue\").append('=').append(JodaBeanUtils.toString(newValue)).append(',').append(' ');\n        buf.append(\"bean\").append('=').append(JodaBeanUtils.toString(bean)).append(',').append(' ');\n        buf.append(\"beanToCopy\").append('=').append(JodaBeanUtils.toString(beanToCopy));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/FieldNamesMutable.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n */\n@BeanDefinition(builderScope = \"public\")\npublic final class FieldNamesMutable implements Bean {\n\n    /** Field named 'obj' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private String obj;\n    /** Field named 'other' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private String other;\n    /** Field named 'propertyName' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private String propertyName;\n    /** Field named 'newValue' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private String newValue;\n    /** Field named 'bean' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private String bean;\n    /** Field named 'beanToCopy' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private String beanToCopy;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code FieldNamesMutable}.\n     * @return the meta-bean, not null\n     */\n    public static FieldNamesMutable.Meta meta() {\n        return FieldNamesMutable.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(FieldNamesMutable.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static FieldNamesMutable.Builder builder() {\n        return new FieldNamesMutable.Builder();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    private FieldNamesMutable(FieldNamesMutable.Builder builder) {\n        this.obj = builder.obj;\n        this.other = builder.other;\n        this.propertyName = builder.propertyName;\n        this.newValue = builder.newValue;\n        this.bean = builder.bean;\n        this.beanToCopy = builder.beanToCopy;\n    }\n\n    @Override\n    public FieldNamesMutable.Meta metaBean() {\n        return FieldNamesMutable.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets field named 'obj' to check for name clashes.\n     * @param obj  the new value of the property\n     */\n    public void setObj(String obj) {\n        this.obj = obj;\n    }\n\n    /**\n     * Gets the the {@code obj} property.\n     * @return the property, not null\n     */\n    public Property<String> obj() {\n        return metaBean().obj().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets field named 'other' to check for name clashes.\n     * @param other  the new value of the property\n     */\n    public void setOther(String other) {\n        this.other = other;\n    }\n\n    /**\n     * Gets the the {@code other} property.\n     * @return the property, not null\n     */\n    public Property<String> other() {\n        return metaBean().other().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets field named 'propertyName' to check for name clashes.\n     * @param propertyName  the new value of the property\n     */\n    public void setPropertyName(String propertyName) {\n        this.propertyName = propertyName;\n    }\n\n    /**\n     * Gets the the {@code propertyName} property.\n     * @return the property, not null\n     */\n    public Property<String> propertyName() {\n        return metaBean().propertyName().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets field named 'newValue' to check for name clashes.\n     * @param newValue  the new value of the property\n     */\n    public void setNewValue(String newValue) {\n        this.newValue = newValue;\n    }\n\n    /**\n     * Gets the the {@code newValue} property.\n     * @return the property, not null\n     */\n    public Property<String> newValue() {\n        return metaBean().newValue().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets field named 'bean' to check for name clashes.\n     * @param bean  the new value of the property\n     */\n    public void setBean(String bean) {\n        this.bean = bean;\n    }\n\n    /**\n     * Gets the the {@code bean} property.\n     * @return the property, not null\n     */\n    public Property<String> bean() {\n        return metaBean().bean().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets field named 'beanToCopy' to check for name clashes.\n     * @param beanToCopy  the new value of the property\n     */\n    public void setBeanToCopy(String beanToCopy) {\n        this.beanToCopy = beanToCopy;\n    }\n\n    /**\n     * Gets the the {@code beanToCopy} property.\n     * @return the property, not null\n     */\n    public Property<String> beanToCopy() {\n        return metaBean().beanToCopy().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public FieldNamesMutable clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            FieldNamesMutable other = (FieldNamesMutable) obj;\n            return JodaBeanUtils.equal(this.obj, other.obj) &&\n                    JodaBeanUtils.equal(this.other, other.other) &&\n                    JodaBeanUtils.equal(this.propertyName, other.propertyName) &&\n                    JodaBeanUtils.equal(this.newValue, other.newValue) &&\n                    JodaBeanUtils.equal(this.bean, other.bean) &&\n                    JodaBeanUtils.equal(this.beanToCopy, other.beanToCopy);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(obj);\n        hash = hash * 31 + JodaBeanUtils.hashCode(other);\n        hash = hash * 31 + JodaBeanUtils.hashCode(propertyName);\n        hash = hash * 31 + JodaBeanUtils.hashCode(newValue);\n        hash = hash * 31 + JodaBeanUtils.hashCode(bean);\n        hash = hash * 31 + JodaBeanUtils.hashCode(beanToCopy);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(224);\n        buf.append(\"FieldNamesMutable{\");\n        buf.append(\"obj\").append('=').append(JodaBeanUtils.toString(obj)).append(',').append(' ');\n        buf.append(\"other\").append('=').append(JodaBeanUtils.toString(other)).append(',').append(' ');\n        buf.append(\"propertyName\").append('=').append(JodaBeanUtils.toString(propertyName)).append(',').append(' ');\n        buf.append(\"newValue\").append('=').append(JodaBeanUtils.toString(newValue)).append(',').append(' ');\n        buf.append(\"bean\").append('=').append(JodaBeanUtils.toString(bean)).append(',').append(' ');\n        buf.append(\"beanToCopy\").append('=').append(JodaBeanUtils.toString(beanToCopy));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code FieldNamesMutable}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code obj} property.\n         */\n        private final MetaProperty<String> obj = DirectMetaProperty.ofReadWrite(\n                this, \"obj\", FieldNamesMutable.class, String.class);\n        /**\n         * The meta-property for the {@code other} property.\n         */\n        private final MetaProperty<String> other = DirectMetaProperty.ofReadWrite(\n                this, \"other\", FieldNamesMutable.class, String.class);\n        /**\n         * The meta-property for the {@code propertyName} property.\n         */\n        private final MetaProperty<String> propertyName = DirectMetaProperty.ofReadWrite(\n                this, \"propertyName\", FieldNamesMutable.class, String.class);\n        /**\n         * The meta-property for the {@code newValue} property.\n         */\n        private final MetaProperty<String> newValue = DirectMetaProperty.ofReadWrite(\n                this, \"newValue\", FieldNamesMutable.class, String.class);\n        /**\n         * The meta-property for the {@code bean} property.\n         */\n        private final MetaProperty<String> bean = DirectMetaProperty.ofReadWrite(\n                this, \"bean\", FieldNamesMutable.class, String.class);\n        /**\n         * The meta-property for the {@code beanToCopy} property.\n         */\n        private final MetaProperty<String> beanToCopy = DirectMetaProperty.ofReadWrite(\n                this, \"beanToCopy\", FieldNamesMutable.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"obj\",\n                \"other\",\n                \"propertyName\",\n                \"newValue\",\n                \"bean\",\n                \"beanToCopy\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 109815:  // obj\n                    return this.obj;\n                case 106069776:  // other\n                    return this.other;\n                case -864691712:  // propertyName\n                    return this.propertyName;\n                case 1368456113:  // newValue\n                    return this.newValue;\n                case 3019696:  // bean\n                    return this.bean;\n                case -1343227808:  // beanToCopy\n                    return this.beanToCopy;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public FieldNamesMutable.Builder builder() {\n            return new FieldNamesMutable.Builder();\n        }\n\n        @Override\n        public Class<? extends FieldNamesMutable> beanType() {\n            return FieldNamesMutable.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code obj} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> obj() {\n            return obj;\n        }\n\n        /**\n         * The meta-property for the {@code other} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> other() {\n            return other;\n        }\n\n        /**\n         * The meta-property for the {@code propertyName} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> propertyName() {\n            return propertyName;\n        }\n\n        /**\n         * The meta-property for the {@code newValue} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> newValue() {\n            return newValue;\n        }\n\n        /**\n         * The meta-property for the {@code bean} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> bean() {\n            return bean;\n        }\n\n        /**\n         * The meta-property for the {@code beanToCopy} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> beanToCopy() {\n            return beanToCopy;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 109815:  // obj\n                    return ((FieldNamesMutable) bean).obj;\n                case 106069776:  // other\n                    return ((FieldNamesMutable) bean).other;\n                case -864691712:  // propertyName\n                    return ((FieldNamesMutable) bean).propertyName;\n                case 1368456113:  // newValue\n                    return ((FieldNamesMutable) bean).newValue;\n                case 3019696:  // bean\n                    return ((FieldNamesMutable) bean).bean;\n                case -1343227808:  // beanToCopy\n                    return ((FieldNamesMutable) bean).beanToCopy;\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 109815:  // obj\n                    ((FieldNamesMutable) bean).setObj((String) newValue);\n                    return;\n                case 106069776:  // other\n                    ((FieldNamesMutable) bean).setOther((String) newValue);\n                    return;\n                case -864691712:  // propertyName\n                    ((FieldNamesMutable) bean).setPropertyName((String) newValue);\n                    return;\n                case 1368456113:  // newValue\n                    ((FieldNamesMutable) bean).setNewValue((String) newValue);\n                    return;\n                case 3019696:  // bean\n                    ((FieldNamesMutable) bean).setBean((String) newValue);\n                    return;\n                case -1343227808:  // beanToCopy\n                    ((FieldNamesMutable) bean).setBeanToCopy((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code FieldNamesMutable}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<FieldNamesMutable> {\n\n        private String obj;\n        private String other;\n        private String propertyName;\n        private String newValue;\n        private String bean;\n        private String beanToCopy;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(FieldNamesMutable beanToCopy) {\n            this.obj = beanToCopy.obj;\n            this.other = beanToCopy.other;\n            this.propertyName = beanToCopy.propertyName;\n            this.newValue = beanToCopy.newValue;\n            this.bean = beanToCopy.bean;\n            this.beanToCopy = beanToCopy.beanToCopy;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 109815:  // obj\n                    return this.obj;\n                case 106069776:  // other\n                    return this.other;\n                case -864691712:  // propertyName\n                    return this.propertyName;\n                case 1368456113:  // newValue\n                    return this.newValue;\n                case 3019696:  // bean\n                    return this.bean;\n                case -1343227808:  // beanToCopy\n                    return this.beanToCopy;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 109815:  // obj\n                    this.obj = (String) newValue;\n                    break;\n                case 106069776:  // other\n                    this.other = (String) newValue;\n                    break;\n                case -864691712:  // propertyName\n                    this.propertyName = (String) newValue;\n                    break;\n                case 1368456113:  // newValue\n                    this.newValue = (String) newValue;\n                    break;\n                case 3019696:  // bean\n                    this.bean = (String) newValue;\n                    break;\n                case -1343227808:  // beanToCopy\n                    this.beanToCopy = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public FieldNamesMutable build() {\n            return new FieldNamesMutable(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets field named 'obj' to check for name clashes.\n         * @param obj  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder obj(String obj) {\n            this.obj = obj;\n            return this;\n        }\n\n        /**\n         * Sets field named 'other' to check for name clashes.\n         * @param other  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder other(String other) {\n            this.other = other;\n            return this;\n        }\n\n        /**\n         * Sets field named 'propertyName' to check for name clashes.\n         * @param propertyName  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder propertyName(String propertyName) {\n            this.propertyName = propertyName;\n            return this;\n        }\n\n        /**\n         * Sets field named 'newValue' to check for name clashes.\n         * @param newValue  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder newValue(String newValue) {\n            this.newValue = newValue;\n            return this;\n        }\n\n        /**\n         * Sets field named 'bean' to check for name clashes.\n         * @param bean  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder bean(String bean) {\n            this.bean = bean;\n            return this;\n        }\n\n        /**\n         * Sets field named 'beanToCopy' to check for name clashes.\n         * @param beanToCopy  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder beanToCopy(String beanToCopy) {\n            this.beanToCopy = beanToCopy;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(224);\n            buf.append(\"FieldNamesMutable.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        protected void toString(StringBuilder buf) {\n            buf.append(\"obj\").append('=').append(JodaBeanUtils.toString(obj)).append(',').append(' ');\n            buf.append(\"other\").append('=').append(JodaBeanUtils.toString(other)).append(',').append(' ');\n            buf.append(\"propertyName\").append('=').append(JodaBeanUtils.toString(propertyName)).append(',').append(' ');\n            buf.append(\"newValue\").append('=').append(JodaBeanUtils.toString(newValue)).append(',').append(' ');\n            buf.append(\"bean\").append('=').append(JodaBeanUtils.toString(bean)).append(',').append(' ');\n            buf.append(\"beanToCopy\").append('=').append(JodaBeanUtils.toString(beanToCopy)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/FieldNamesMutableMinimal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Arrays;\nimport java.util.function.BiConsumer;\nimport java.util.function.Function;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.BasicBeanBuilder;\nimport org.joda.beans.impl.direct.MinimalMetaBean;\n\n/**\n * Mock JavaBean, used for testing.\n */\n@BeanDefinition(style = \"minimal\")\npublic final class FieldNamesMutableMinimal implements Bean {\n\n    /** Field named 'obj' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private String obj;\n    /** Field named 'other' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private String other;\n    /** Field named 'propertyName' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private String propertyName;\n    /** Field named 'newValue' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private String newValue;\n    /** Field named 'bean' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private String bean;\n    /** Field named 'beanToCopy' to check for name clashes. */\n    @PropertyDefinition(get = \"field\")\n    private String beanToCopy;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code FieldNamesMutableMinimal}.\n     */\n    private static final TypedMetaBean<FieldNamesMutableMinimal> META_BEAN =\n            MinimalMetaBean.of(\n                    FieldNamesMutableMinimal.class,\n                    new String[] {\n                            \"obj\",\n                            \"other\",\n                            \"propertyName\",\n                            \"newValue\",\n                            \"bean\",\n                            \"beanToCopy\"},\n                    () -> new BasicBeanBuilder<>(new FieldNamesMutableMinimal()),\n                    Arrays.<Function<FieldNamesMutableMinimal, Object>>asList(\n                            b -> b.obj,\n                            b -> b.other,\n                            b -> b.propertyName,\n                            b -> b.newValue,\n                            b -> b.bean,\n                            b -> b.beanToCopy),\n                    Arrays.<BiConsumer<FieldNamesMutableMinimal, Object>>asList(\n                            (b, v) -> b.setObj((String) v),\n                            (b, v) -> b.setOther((String) v),\n                            (b, v) -> b.setPropertyName((String) v),\n                            (b, v) -> b.setNewValue((String) v),\n                            (b, v) -> b.setBean((String) v),\n                            (b, v) -> b.setBeanToCopy((String) v)));\n\n    /**\n     * The meta-bean for {@code FieldNamesMutableMinimal}.\n     * @return the meta-bean, not null\n     */\n    public static TypedMetaBean<FieldNamesMutableMinimal> meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    @Override\n    public TypedMetaBean<FieldNamesMutableMinimal> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets field named 'obj' to check for name clashes.\n     * @param obj  the new value of the property\n     */\n    public void setObj(String obj) {\n        this.obj = obj;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets field named 'other' to check for name clashes.\n     * @param other  the new value of the property\n     */\n    public void setOther(String other) {\n        this.other = other;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets field named 'propertyName' to check for name clashes.\n     * @param propertyName  the new value of the property\n     */\n    public void setPropertyName(String propertyName) {\n        this.propertyName = propertyName;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets field named 'newValue' to check for name clashes.\n     * @param newValue  the new value of the property\n     */\n    public void setNewValue(String newValue) {\n        this.newValue = newValue;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets field named 'bean' to check for name clashes.\n     * @param bean  the new value of the property\n     */\n    public void setBean(String bean) {\n        this.bean = bean;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets field named 'beanToCopy' to check for name clashes.\n     * @param beanToCopy  the new value of the property\n     */\n    public void setBeanToCopy(String beanToCopy) {\n        this.beanToCopy = beanToCopy;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public FieldNamesMutableMinimal clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            FieldNamesMutableMinimal other = (FieldNamesMutableMinimal) obj;\n            return JodaBeanUtils.equal(this.obj, other.obj) &&\n                    JodaBeanUtils.equal(this.other, other.other) &&\n                    JodaBeanUtils.equal(this.propertyName, other.propertyName) &&\n                    JodaBeanUtils.equal(this.newValue, other.newValue) &&\n                    JodaBeanUtils.equal(this.bean, other.bean) &&\n                    JodaBeanUtils.equal(this.beanToCopy, other.beanToCopy);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(obj);\n        hash = hash * 31 + JodaBeanUtils.hashCode(other);\n        hash = hash * 31 + JodaBeanUtils.hashCode(propertyName);\n        hash = hash * 31 + JodaBeanUtils.hashCode(newValue);\n        hash = hash * 31 + JodaBeanUtils.hashCode(bean);\n        hash = hash * 31 + JodaBeanUtils.hashCode(beanToCopy);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(224);\n        buf.append(\"FieldNamesMutableMinimal{\");\n        buf.append(\"obj\").append('=').append(JodaBeanUtils.toString(obj)).append(',').append(' ');\n        buf.append(\"other\").append('=').append(JodaBeanUtils.toString(other)).append(',').append(' ');\n        buf.append(\"propertyName\").append('=').append(JodaBeanUtils.toString(propertyName)).append(',').append(' ');\n        buf.append(\"newValue\").append('=').append(JodaBeanUtils.toString(newValue)).append(',').append(' ');\n        buf.append(\"bean\").append('=').append(JodaBeanUtils.toString(bean)).append(',').append(' ');\n        buf.append(\"beanToCopy\").append('=').append(JodaBeanUtils.toString(beanToCopy));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/FinalFieldBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\nimport org.joda.beans.impl.flexi.FlexiBean;\n\n/**\n * Mock used for test equals.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class FinalFieldBean extends DirectBean {\n\n    /**\n     * The field that is final.\n     */\n    @PropertyDefinition\n    private final String  fieldFinal;\n    /**\n     * The field that is not final.\n     */\n    @PropertyDefinition\n    private String fieldNonFinal;\n    /**\n     * The list that is final.\n     */\n    @PropertyDefinition\n    private final List<String> listFinal = new ArrayList<>();\n    /**\n     * The flexi that is final.\n     */\n    @PropertyDefinition\n    private final FlexiBean flexiFinal = new FlexiBean();\n    /**\n     * The person that is final.\n     */\n    @PropertyDefinition\n    private final Person personFinal = new Person();\n\n    /**\n     * Creates an instance.\n     */\n    public FinalFieldBean() {\n        this.fieldFinal = null;\n    }\n\n    /**\n     * Creates an instance.\n     * \n     * @param fieldFinal  the final field\n     */\n    public FinalFieldBean(String fieldFinal) {\n        this.fieldFinal = fieldFinal;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code FinalFieldBean}.\n     * @return the meta-bean, not null\n     */\n    public static FinalFieldBean.Meta meta() {\n        return FinalFieldBean.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(FinalFieldBean.Meta.INSTANCE);\n    }\n\n    @Override\n    public FinalFieldBean.Meta metaBean() {\n        return FinalFieldBean.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the field that is final.\n     * @return the value of the property\n     */\n    public String getFieldFinal() {\n        return fieldFinal;\n    }\n\n    /**\n     * Gets the the {@code fieldFinal} property.\n     * @return the property, not null\n     */\n    public final Property<String> fieldFinal() {\n        return metaBean().fieldFinal().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the field that is not final.\n     * @return the value of the property\n     */\n    public String getFieldNonFinal() {\n        return fieldNonFinal;\n    }\n\n    /**\n     * Sets the field that is not final.\n     * @param fieldNonFinal  the new value of the property\n     */\n    public void setFieldNonFinal(String fieldNonFinal) {\n        this.fieldNonFinal = fieldNonFinal;\n    }\n\n    /**\n     * Gets the the {@code fieldNonFinal} property.\n     * @return the property, not null\n     */\n    public final Property<String> fieldNonFinal() {\n        return metaBean().fieldNonFinal().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the list that is final.\n     * @return the value of the property, not null\n     */\n    public List<String> getListFinal() {\n        return listFinal;\n    }\n\n    /**\n     * Sets the list that is final.\n     * @param listFinal  the new value of the property, not null\n     */\n    public void setListFinal(List<String> listFinal) {\n        JodaBeanUtils.notNull(listFinal, \"listFinal\");\n        this.listFinal.clear();\n        this.listFinal.addAll(listFinal);\n    }\n\n    /**\n     * Gets the the {@code listFinal} property.\n     * @return the property, not null\n     */\n    public final Property<List<String>> listFinal() {\n        return metaBean().listFinal().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the flexi that is final.\n     * @return the value of the property, not null\n     */\n    public FlexiBean getFlexiFinal() {\n        return flexiFinal;\n    }\n\n    /**\n     * Sets the flexi that is final.\n     * @param flexiFinal  the new value of the property, not null\n     */\n    public void setFlexiFinal(FlexiBean flexiFinal) {\n        JodaBeanUtils.notNull(flexiFinal, \"flexiFinal\");\n        this.flexiFinal.clear();\n        this.flexiFinal.putAll(flexiFinal);\n    }\n\n    /**\n     * Gets the the {@code flexiFinal} property.\n     * @return the property, not null\n     */\n    public final Property<FlexiBean> flexiFinal() {\n        return metaBean().flexiFinal().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the person that is final.\n     * @return the value of the property, not null\n     */\n    public Person getPersonFinal() {\n        return personFinal;\n    }\n\n    /**\n     * Gets the the {@code personFinal} property.\n     * @return the property, not null\n     */\n    public final Property<Person> personFinal() {\n        return metaBean().personFinal().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public FinalFieldBean clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            FinalFieldBean other = (FinalFieldBean) obj;\n            return JodaBeanUtils.equal(this.getFieldFinal(), other.getFieldFinal()) &&\n                    JodaBeanUtils.equal(this.getFieldNonFinal(), other.getFieldNonFinal()) &&\n                    JodaBeanUtils.equal(this.getListFinal(), other.getListFinal()) &&\n                    JodaBeanUtils.equal(this.getFlexiFinal(), other.getFlexiFinal()) &&\n                    JodaBeanUtils.equal(this.getPersonFinal(), other.getPersonFinal());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getFieldFinal());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getFieldNonFinal());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getListFinal());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getFlexiFinal());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getPersonFinal());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(192);\n        buf.append(\"FinalFieldBean{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"fieldFinal\").append('=').append(JodaBeanUtils.toString(getFieldFinal())).append(',').append(' ');\n        buf.append(\"fieldNonFinal\").append('=').append(JodaBeanUtils.toString(getFieldNonFinal())).append(',').append(' ');\n        buf.append(\"listFinal\").append('=').append(JodaBeanUtils.toString(getListFinal())).append(',').append(' ');\n        buf.append(\"flexiFinal\").append('=').append(JodaBeanUtils.toString(getFlexiFinal())).append(',').append(' ');\n        buf.append(\"personFinal\").append('=').append(JodaBeanUtils.toString(getPersonFinal())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code FinalFieldBean}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code fieldFinal} property.\n         */\n        private final MetaProperty<String> fieldFinal = DirectMetaProperty.ofReadOnly(\n                this, \"fieldFinal\", FinalFieldBean.class, String.class);\n        /**\n         * The meta-property for the {@code fieldNonFinal} property.\n         */\n        private final MetaProperty<String> fieldNonFinal = DirectMetaProperty.ofReadWrite(\n                this, \"fieldNonFinal\", FinalFieldBean.class, String.class);\n        /**\n         * The meta-property for the {@code listFinal} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<String>> listFinal = DirectMetaProperty.ofReadWrite(\n                this, \"listFinal\", FinalFieldBean.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code flexiFinal} property.\n         */\n        private final MetaProperty<FlexiBean> flexiFinal = DirectMetaProperty.ofReadWrite(\n                this, \"flexiFinal\", FinalFieldBean.class, FlexiBean.class);\n        /**\n         * The meta-property for the {@code personFinal} property.\n         */\n        private final MetaProperty<Person> personFinal = DirectMetaProperty.ofReadOnly(\n                this, \"personFinal\", FinalFieldBean.class, Person.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"fieldFinal\",\n                \"fieldNonFinal\",\n                \"listFinal\",\n                \"flexiFinal\",\n                \"personFinal\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 553434268:  // fieldFinal\n                    return this.fieldFinal;\n                case 1043548611:  // fieldNonFinal\n                    return this.fieldNonFinal;\n                case -1247489160:  // listFinal\n                    return this.listFinal;\n                case 1629293510:  // flexiFinal\n                    return this.flexiFinal;\n                case -448986335:  // personFinal\n                    return this.personFinal;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends FinalFieldBean> builder() {\n            return new DirectBeanBuilder<>(new FinalFieldBean());\n        }\n\n        @Override\n        public Class<? extends FinalFieldBean> beanType() {\n            return FinalFieldBean.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code fieldFinal} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> fieldFinal() {\n            return fieldFinal;\n        }\n\n        /**\n         * The meta-property for the {@code fieldNonFinal} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> fieldNonFinal() {\n            return fieldNonFinal;\n        }\n\n        /**\n         * The meta-property for the {@code listFinal} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<String>> listFinal() {\n            return listFinal;\n        }\n\n        /**\n         * The meta-property for the {@code flexiFinal} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<FlexiBean> flexiFinal() {\n            return flexiFinal;\n        }\n\n        /**\n         * The meta-property for the {@code personFinal} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Person> personFinal() {\n            return personFinal;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 553434268:  // fieldFinal\n                    return ((FinalFieldBean) bean).getFieldFinal();\n                case 1043548611:  // fieldNonFinal\n                    return ((FinalFieldBean) bean).getFieldNonFinal();\n                case -1247489160:  // listFinal\n                    return ((FinalFieldBean) bean).getListFinal();\n                case 1629293510:  // flexiFinal\n                    return ((FinalFieldBean) bean).getFlexiFinal();\n                case -448986335:  // personFinal\n                    return ((FinalFieldBean) bean).getPersonFinal();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 553434268:  // fieldFinal\n                    if (quiet) {\n                        return;\n                    }\n                    throw new UnsupportedOperationException(\"Property cannot be written: fieldFinal\");\n                case 1043548611:  // fieldNonFinal\n                    ((FinalFieldBean) bean).setFieldNonFinal((String) newValue);\n                    return;\n                case -1247489160:  // listFinal\n                    ((FinalFieldBean) bean).setListFinal((List<String>) newValue);\n                    return;\n                case 1629293510:  // flexiFinal\n                    ((FinalFieldBean) bean).setFlexiFinal((FlexiBean) newValue);\n                    return;\n                case -448986335:  // personFinal\n                    if (quiet) {\n                        return;\n                    }\n                    throw new UnsupportedOperationException(\"Property cannot be written: personFinal\");\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n        @Override\n        protected void validate(Bean bean) {\n            JodaBeanUtils.notNull(((FinalFieldBean) bean).listFinal, \"listFinal\");\n            JodaBeanUtils.notNull(((FinalFieldBean) bean).flexiFinal, \"flexiFinal\");\n            JodaBeanUtils.notNull(((FinalFieldBean) bean).personFinal, \"personFinal\");\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/GenericAllFinal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class GenericAllFinal<T> implements Bean {\n\n    /** The name. */\n    @PropertyDefinition(validate = \"notNull\")\n    private final String name;\n    /** The value. */\n    @PropertyDefinition(validate = \"notNull\")\n    private final T value;\n\n    public GenericAllFinal() {\n        name = \"foo\";\n        value = null;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code GenericAllFinal}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static GenericAllFinal.Meta meta() {\n        return GenericAllFinal.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code GenericAllFinal}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R> GenericAllFinal.Meta<R> metaGenericAllFinal(Class<R> cls) {\n        return GenericAllFinal.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(GenericAllFinal.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public GenericAllFinal.Meta<T> metaBean() {\n        return GenericAllFinal.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property, not null\n     */\n    public String getName() {\n        return name;\n    }\n\n    /**\n     * Gets the the {@code name} property.\n     * @return the property, not null\n     */\n    public final Property<String> name() {\n        return metaBean().name().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the value.\n     * @return the value of the property, not null\n     */\n    public T getValue() {\n        return value;\n    }\n\n    /**\n     * Gets the the {@code value} property.\n     * @return the property, not null\n     */\n    public final Property<T> value() {\n        return metaBean().value().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public GenericAllFinal<T> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            GenericAllFinal<?> other = (GenericAllFinal<?>) obj;\n            return JodaBeanUtils.equal(this.getName(), other.getName()) &&\n                    JodaBeanUtils.equal(this.getValue(), other.getValue());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getName());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getValue());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"GenericAllFinal{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"name\").append('=').append(JodaBeanUtils.toString(getName())).append(',').append(' ');\n        buf.append(\"value\").append('=').append(JodaBeanUtils.toString(getValue())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code GenericAllFinal}.\n     * @param <T>  the type\n     */\n    public static class Meta<T> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code name} property.\n         */\n        private final MetaProperty<String> name = DirectMetaProperty.ofReadOnly(\n                this, \"name\", GenericAllFinal.class, String.class);\n        /**\n         * The meta-property for the {@code value} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T> value = (DirectMetaProperty) DirectMetaProperty.ofReadOnly(\n                this, \"value\", GenericAllFinal.class, Object.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"name\",\n                \"value\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n                case 111972721:  // value\n                    return this.value;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends GenericAllFinal<T>> builder() {\n            return new DirectBeanBuilder<>(new GenericAllFinal<T>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends GenericAllFinal<T>> beanType() {\n            return (Class) GenericAllFinal.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code name} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> name() {\n            return name;\n        }\n\n        /**\n         * The meta-property for the {@code value} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T> value() {\n            return value;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return ((GenericAllFinal<?>) bean).getName();\n                case 111972721:  // value\n                    return ((GenericAllFinal<?>) bean).getValue();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    if (quiet) {\n                        return;\n                    }\n                    throw new UnsupportedOperationException(\"Property cannot be written: name\");\n                case 111972721:  // value\n                    if (quiet) {\n                        return;\n                    }\n                    throw new UnsupportedOperationException(\"Property cannot be written: value\");\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n        @Override\n        protected void validate(Bean bean) {\n            JodaBeanUtils.notNull(((GenericAllFinal<?>) bean).name, \"name\");\n            JodaBeanUtils.notNull(((GenericAllFinal<?>) bean).value, \"value\");\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/GenericArray.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class GenericArray<T extends Address> implements Bean {\n\n    /** The name. */\n    @PropertyDefinition(validate = \"notNull\")\n    private T[] values;\n    @PropertyDefinition(get = \"cloneArray\", set = \"cloneArray\")\n    private int[][] intArray2d;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code GenericArray}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static GenericArray.Meta meta() {\n        return GenericArray.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code GenericArray}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Address> GenericArray.Meta<R> metaGenericArray(Class<R> cls) {\n        return GenericArray.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(GenericArray.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public GenericArray.Meta<T> metaBean() {\n        return GenericArray.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property, not null\n     */\n    public T[] getValues() {\n        return values;\n    }\n\n    /**\n     * Sets the name.\n     * @param values  the new value of the property, not null\n     */\n    public void setValues(T[] values) {\n        JodaBeanUtils.notNull(values, \"values\");\n        this.values = values;\n    }\n\n    /**\n     * Gets the the {@code values} property.\n     * @return the property, not null\n     */\n    public final Property<T[]> values() {\n        return metaBean().values().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the intArray2d.\n     * @return the value of the property\n     */\n    public int[][] getIntArray2d() {\n        return (int[][]) JodaBeanUtils.cloneArray(intArray2d);\n    }\n\n    /**\n     * Sets the intArray2d.\n     * @param intArray2d  the new value of the property\n     */\n    public void setIntArray2d(int[][] intArray2d) {\n        this.intArray2d = (int[][]) JodaBeanUtils.cloneArray(intArray2d);\n    }\n\n    /**\n     * Gets the the {@code intArray2d} property.\n     * @return the property, not null\n     */\n    public final Property<int[][]> intArray2d() {\n        return metaBean().intArray2d().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public GenericArray<T> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            GenericArray<?> other = (GenericArray<?>) obj;\n            return JodaBeanUtils.equal(this.getValues(), other.getValues()) &&\n                    JodaBeanUtils.equal(this.getIntArray2d(), other.getIntArray2d());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getValues());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getIntArray2d());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"GenericArray{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"values\").append('=').append(JodaBeanUtils.toString(getValues())).append(',').append(' ');\n        buf.append(\"intArray2d\").append('=').append(JodaBeanUtils.toString(getIntArray2d())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code GenericArray}.\n     * @param <T>  the type\n     */\n    public static class Meta<T extends Address> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code values} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T[]> values = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"values\", GenericArray.class, Object[].class);\n        /**\n         * The meta-property for the {@code intArray2d} property.\n         */\n        private final MetaProperty<int[][]> intArray2d = DirectMetaProperty.ofReadWrite(\n                this, \"intArray2d\", GenericArray.class, int[][].class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"values\",\n                \"intArray2d\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -823812830:  // values\n                    return this.values;\n                case 822168476:  // intArray2d\n                    return this.intArray2d;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends GenericArray<T>> builder() {\n            return new DirectBeanBuilder<>(new GenericArray<T>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends GenericArray<T>> beanType() {\n            return (Class) GenericArray.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code values} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T[]> values() {\n            return values;\n        }\n\n        /**\n         * The meta-property for the {@code intArray2d} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<int[][]> intArray2d() {\n            return intArray2d;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -823812830:  // values\n                    return ((GenericArray<?>) bean).getValues();\n                case 822168476:  // intArray2d\n                    return ((GenericArray<?>) bean).getIntArray2d();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -823812830:  // values\n                    ((GenericArray<T>) bean).setValues((T[]) newValue);\n                    return;\n                case 822168476:  // intArray2d\n                    ((GenericArray<T>) bean).setIntArray2d((int[][]) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n        @Override\n        protected void validate(Bean bean) {\n            JodaBeanUtils.notNull(((GenericArray<?>) bean).values, \"values\");\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/GenericInterfaceBase.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.List;\n\n/**\n * Mock, used for testing.\n * @param <T> the type\n */\npublic interface GenericInterfaceBase<T extends Serializable> {\n\n    public abstract List<T> getBase1();\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/GenericInterfaceChild.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.List;\n\n/**\n * Mock, used for testing.\n * @param <N> the type\n */\npublic interface GenericInterfaceChild<N extends Number> extends GenericInterfaceBase<N> {\n\n    @Override\n    public abstract List<N> getBase1();\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/GenericInterfaceImpl.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\n/**\n * Mock, used for testing.\n */\npublic abstract class GenericInterfaceImpl extends GenericInterfaceMid<SubDecimal> {\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/GenericInterfaceMid.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.math.BigDecimal;\n\n/**\n * Mock, used for testing.\n * \n * @param <X> the type\n */\npublic abstract class GenericInterfaceMid<X extends BigDecimal> implements GenericInterfaceChild<X> {\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/GenericSubWrapper.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class GenericSubWrapper<T extends Address> extends Wrapper<T> {\n\n    /** The name. */\n    @PropertyDefinition(validate = \"notNull\")\n    private String name;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code GenericSubWrapper}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static GenericSubWrapper.Meta meta() {\n        return GenericSubWrapper.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code GenericSubWrapper}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Address> GenericSubWrapper.Meta<R> metaGenericSubWrapper(Class<R> cls) {\n        return GenericSubWrapper.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(GenericSubWrapper.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public GenericSubWrapper.Meta<T> metaBean() {\n        return GenericSubWrapper.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property, not null\n     */\n    public String getName() {\n        return name;\n    }\n\n    /**\n     * Sets the name.\n     * @param name  the new value of the property, not null\n     */\n    public void setName(String name) {\n        JodaBeanUtils.notNull(name, \"name\");\n        this.name = name;\n    }\n\n    /**\n     * Gets the the {@code name} property.\n     * @return the property, not null\n     */\n    public final Property<String> name() {\n        return metaBean().name().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public GenericSubWrapper<T> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            GenericSubWrapper<?> other = (GenericSubWrapper<?>) obj;\n            return JodaBeanUtils.equal(this.getName(), other.getName()) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        hash = hash * 31 + JodaBeanUtils.hashCode(getName());\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"GenericSubWrapper{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"name\").append('=').append(JodaBeanUtils.toString(getName())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code GenericSubWrapper}.\n     * @param <T>  the type\n     */\n    public static class Meta<T extends Address> extends Wrapper.Meta<T> {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code name} property.\n         */\n        private final MetaProperty<String> name = DirectMetaProperty.ofReadWrite(\n                this, \"name\", GenericSubWrapper.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"name\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends GenericSubWrapper<T>> builder() {\n            return new DirectBeanBuilder<>(new GenericSubWrapper<T>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends GenericSubWrapper<T>> beanType() {\n            return (Class) GenericSubWrapper.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code name} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> name() {\n            return name;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return ((GenericSubWrapper<?>) bean).getName();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    ((GenericSubWrapper<T>) bean).setName((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n        @Override\n        protected void validate(Bean bean) {\n            JodaBeanUtils.notNull(((GenericSubWrapper<?>) bean).name, \"name\");\n            super.validate(bean);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/GenericUnionType.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class GenericUnionType<T extends Number & Serializable & Cloneable> implements Bean {\n\n    /** The name. */\n    @PropertyDefinition(validate = \"notNull\")\n    private String name;\n    /** The value. */\n    @PropertyDefinition(validate = \"notNull\")\n    private T value;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code GenericUnionType}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static GenericUnionType.Meta meta() {\n        return GenericUnionType.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code GenericUnionType}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Number & Serializable & Cloneable> GenericUnionType.Meta<R> metaGenericUnionType(Class<R> cls) {\n        return GenericUnionType.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(GenericUnionType.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public GenericUnionType.Meta<T> metaBean() {\n        return GenericUnionType.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property, not null\n     */\n    public String getName() {\n        return name;\n    }\n\n    /**\n     * Sets the name.\n     * @param name  the new value of the property, not null\n     */\n    public void setName(String name) {\n        JodaBeanUtils.notNull(name, \"name\");\n        this.name = name;\n    }\n\n    /**\n     * Gets the the {@code name} property.\n     * @return the property, not null\n     */\n    public final Property<String> name() {\n        return metaBean().name().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the value.\n     * @return the value of the property, not null\n     */\n    public T getValue() {\n        return value;\n    }\n\n    /**\n     * Sets the value.\n     * @param value  the new value of the property, not null\n     */\n    public void setValue(T value) {\n        JodaBeanUtils.notNull(value, \"value\");\n        this.value = value;\n    }\n\n    /**\n     * Gets the the {@code value} property.\n     * @return the property, not null\n     */\n    public final Property<T> value() {\n        return metaBean().value().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public GenericUnionType<T> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            GenericUnionType<?> other = (GenericUnionType<?>) obj;\n            return JodaBeanUtils.equal(this.getName(), other.getName()) &&\n                    JodaBeanUtils.equal(this.getValue(), other.getValue());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getName());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getValue());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"GenericUnionType{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"name\").append('=').append(JodaBeanUtils.toString(getName())).append(',').append(' ');\n        buf.append(\"value\").append('=').append(JodaBeanUtils.toString(getValue())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code GenericUnionType}.\n     * @param <T>  the type\n     */\n    public static class Meta<T extends Number & Serializable & Cloneable> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code name} property.\n         */\n        private final MetaProperty<String> name = DirectMetaProperty.ofReadWrite(\n                this, \"name\", GenericUnionType.class, String.class);\n        /**\n         * The meta-property for the {@code value} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T> value = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"value\", GenericUnionType.class, Object.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"name\",\n                \"value\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n                case 111972721:  // value\n                    return this.value;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends GenericUnionType<T>> builder() {\n            return new DirectBeanBuilder<>(new GenericUnionType<T>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends GenericUnionType<T>> beanType() {\n            return (Class) GenericUnionType.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code name} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> name() {\n            return name;\n        }\n\n        /**\n         * The meta-property for the {@code value} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T> value() {\n            return value;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return ((GenericUnionType<?>) bean).getName();\n                case 111972721:  // value\n                    return ((GenericUnionType<?>) bean).getValue();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    ((GenericUnionType<T>) bean).setName((String) newValue);\n                    return;\n                case 111972721:  // value\n                    ((GenericUnionType<T>) bean).setValue((T) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n        @Override\n        protected void validate(Bean bean) {\n            JodaBeanUtils.notNull(((GenericUnionType<?>) bean).name, \"name\");\n            JodaBeanUtils.notNull(((GenericUnionType<?>) bean).value, \"value\");\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/GenericWrapperDocumentation.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class GenericWrapperDocumentation<T extends Address> extends Documentation<Wrapper<T>> {\n\n    /** The name. */\n    @PropertyDefinition\n    private String name;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code GenericWrapperDocumentation}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static GenericWrapperDocumentation.Meta meta() {\n        return GenericWrapperDocumentation.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code GenericWrapperDocumentation}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Address> GenericWrapperDocumentation.Meta<R> metaGenericWrapperDocumentation(Class<R> cls) {\n        return GenericWrapperDocumentation.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(GenericWrapperDocumentation.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public GenericWrapperDocumentation.Meta<T> metaBean() {\n        return GenericWrapperDocumentation.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property\n     */\n    public String getName() {\n        return name;\n    }\n\n    /**\n     * Sets the name.\n     * @param name  the new value of the property\n     */\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    /**\n     * Gets the the {@code name} property.\n     * @return the property, not null\n     */\n    public final Property<String> name() {\n        return metaBean().name().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public GenericWrapperDocumentation<T> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            GenericWrapperDocumentation<?> other = (GenericWrapperDocumentation<?>) obj;\n            return JodaBeanUtils.equal(this.getName(), other.getName()) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        hash = hash * 31 + JodaBeanUtils.hashCode(getName());\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"GenericWrapperDocumentation{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"name\").append('=').append(JodaBeanUtils.toString(getName())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code GenericWrapperDocumentation}.\n     * @param <T>  the type\n     */\n    public static class Meta<T extends Address> extends Documentation.Meta<Wrapper<T>> {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code name} property.\n         */\n        private final MetaProperty<String> name = DirectMetaProperty.ofReadWrite(\n                this, \"name\", GenericWrapperDocumentation.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"name\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends GenericWrapperDocumentation<T>> builder() {\n            return new DirectBeanBuilder<>(new GenericWrapperDocumentation<T>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends GenericWrapperDocumentation<T>> beanType() {\n            return (Class) GenericWrapperDocumentation.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code name} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> name() {\n            return name;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return ((GenericWrapperDocumentation<?>) bean).getName();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    ((GenericWrapperDocumentation<T>) bean).setName((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/IKey.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\n/**\n * Mock key interface, used for testing.\n */\npublic interface IKey {\n\n    /**\n     * Gets the name of the key.\n     * \n     * @return the name\n     */\n    String getName();\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/INamedKey.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport org.joda.convert.FromString;\nimport org.joda.convert.ToString;\n\n/**\n * Mock key Joda-Convert extending an interface, used for testing.\n */\npublic interface INamedKey extends IKey {\n\n    @FromString\n    public static INamedKey of(String uniqueName) {\n        return ImmNamedKey.of(uniqueName);\n    }\n\n    /**\n     * Gets the name.\n     * The name is unique in conjunction with the type.\n     * @return the value of the property, not empty\n     */\n    @Override\n    @ToString\n    public abstract String getName();\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/IPerson.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\n/**\n * Mock person interface, used for testing.\n */\npublic interface IPerson {\n\n    /**\n     * Gets the forename.\n     * @return the value of the property\n     */\n    String getForename();\n\n    /**\n     * Gets the surname.\n     * @return the value of the property\n     */\n    String getSurname();\n\n    /**\n     * Sets the surname.\n     * @param surname  the new value of the property\n     */\n    void setSurname(String surname);\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmAddress.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.Arrays;\nimport java.util.EnumSet;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\nimport java.util.Set;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\nimport org.joda.collect.grid.Grid;\nimport org.joda.collect.grid.ImmutableGrid;\n\nimport com.google.common.collect.ImmutableMap;\nimport com.google.common.collect.ImmutableTable;\nimport com.google.common.collect.Table;\n\n/**\n * Mock address JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(constructorScope = \"private\")\npublic final class ImmAddress implements ImmutableBean, Serializable {\n\n    /**\n     * The number.\n     * This will be the flat, house number or house name.\n     */\n    @PropertyDefinition\n    private final int number;\n    /**\n     * The street.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final String street;\n    /**\n     * The city.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final String city;\n    /**\n     * The abstract number.\n     */\n    @PropertyDefinition\n    private final Number abstractNumber;\n    /**\n     * The extra data.\n     */\n    @PropertyDefinition\n    private final byte[] data;\n    /**\n     * The 2D array.\n     */\n    @PropertyDefinition\n    private final String[][] array2d;\n    /**\n     * The owner.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmPerson owner;\n    /**\n     * The object field.\n     */\n    @PropertyDefinition\n    private final Object object1;\n    /**\n     * The object field.\n     */\n    @PropertyDefinition\n    private final Object object2;\n    /**\n     * The risk field.\n     */\n    @PropertyDefinition\n    private final Risk risk;\n    /**\n     * The risk level field, testing an {@code Enum}.\n     */\n    @PropertyDefinition\n    private final RiskLevel riskLevel;\n    /**\n     * The risk levels field, testing {@code EnumSet}.\n     */\n    @PropertyDefinition\n    private final EnumSet<RiskLevel> riskLevels;\n    /**\n     * The serializable field.\n     */\n    @PropertyDefinition\n    private final Serializable serializable;\n    /**\n     * The object in map field.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableMap<String, Object> objectInMap;\n    /**\n     * The list in map field.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableMap<String, List<String>> listInMap;\n    /**\n     * The list in map field.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableMap<String, List<Integer>> listNumericInMap;\n    /**\n     * The list in list in map field.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableMap<String, List<List<Integer>>> listInListInMap;\n    /**\n     * The object list in list in map field.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableMap<String, List<List<Object>>> objectListInListInMap;\n    /**\n     * The map in map field.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableMap<ImmPerson, Map<String, ImmPerson>> mapInMap;\n    /**\n     * The simple table.\n     */\n    @PropertyDefinition\n    private final ImmutableTable<Integer, Integer, String> simpleTable;\n    /**\n     * The compound table.\n     */\n    @PropertyDefinition\n    private final ImmutableTable<Integer, Integer, ImmPerson> compoundTable;\n    /**\n     * The grid.\n     */\n    @PropertyDefinition\n    private final ImmutableGrid<ImmPerson> sparseGrid;\n    /**\n     * The grid.\n     */\n    @PropertyDefinition\n    @SimpleAnnotation(first = \"a\",\n            second = \"b\",\n            third = \"c\")\n    private final ImmutableGrid<ImmPerson> denseGrid;\n    /**\n     * The bean key and bean value field.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    // comment is ignored\n    private final ImmutableMap<ImmPerson, ImmAddress> beanBeanMap;\n    /**\n     * The array.\n     */\n    @PropertyDefinition\n    private final double[] doubleVector;\n    /**\n     * The matrix.\n     */\n    @PropertyDefinition\n\n    private final double[][] matrix;\n    // blank line above is ignored\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmAddress}.\n     * @return the meta-bean, not null\n     */\n    public static ImmAddress.Meta meta() {\n        return ImmAddress.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmAddress.Meta.INSTANCE);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmAddress.Builder builder() {\n        return new ImmAddress.Builder();\n    }\n\n    private ImmAddress(\n            int number,\n            String street,\n            String city,\n            Number abstractNumber,\n            byte[] data,\n            String[][] array2d,\n            ImmPerson owner,\n            Object object1,\n            Object object2,\n            Risk risk,\n            RiskLevel riskLevel,\n            Set<RiskLevel> riskLevels,\n            Serializable serializable,\n            Map<String, Object> objectInMap,\n            Map<String, List<String>> listInMap,\n            Map<String, List<Integer>> listNumericInMap,\n            Map<String, List<List<Integer>>> listInListInMap,\n            Map<String, List<List<Object>>> objectListInListInMap,\n            Map<ImmPerson, Map<String, ImmPerson>> mapInMap,\n            Table<Integer, Integer, String> simpleTable,\n            Table<Integer, Integer, ImmPerson> compoundTable,\n            Grid<ImmPerson> sparseGrid,\n            Grid<ImmPerson> denseGrid,\n            Map<ImmPerson, ImmAddress> beanBeanMap,\n            double[] doubleVector,\n            double[][] matrix) {\n        JodaBeanUtils.notNull(street, \"street\");\n        JodaBeanUtils.notNull(city, \"city\");\n        JodaBeanUtils.notNull(owner, \"owner\");\n        JodaBeanUtils.notNull(objectInMap, \"objectInMap\");\n        JodaBeanUtils.notNull(listInMap, \"listInMap\");\n        JodaBeanUtils.notNull(listNumericInMap, \"listNumericInMap\");\n        JodaBeanUtils.notNull(listInListInMap, \"listInListInMap\");\n        JodaBeanUtils.notNull(objectListInListInMap, \"objectListInListInMap\");\n        JodaBeanUtils.notNull(mapInMap, \"mapInMap\");\n        JodaBeanUtils.notNull(beanBeanMap, \"beanBeanMap\");\n        this.number = number;\n        this.street = street;\n        this.city = city;\n        this.abstractNumber = abstractNumber;\n        this.data = (data != null ? data.clone() : null);\n        this.array2d = (String[][]) JodaBeanUtils.cloneArray(array2d);\n        this.owner = owner;\n        this.object1 = object1;\n        this.object2 = object2;\n        this.risk = risk;\n        this.riskLevel = riskLevel;\n        this.riskLevels = (riskLevels != null ? EnumSet.copyOf(riskLevels) : null);\n        this.serializable = serializable;\n        this.objectInMap = ImmutableMap.copyOf(objectInMap);\n        this.listInMap = ImmutableMap.copyOf(listInMap);\n        this.listNumericInMap = ImmutableMap.copyOf(listNumericInMap);\n        this.listInListInMap = ImmutableMap.copyOf(listInListInMap);\n        this.objectListInListInMap = ImmutableMap.copyOf(objectListInListInMap);\n        this.mapInMap = ImmutableMap.copyOf(mapInMap);\n        this.simpleTable = (simpleTable != null ? ImmutableTable.copyOf(simpleTable) : null);\n        this.compoundTable = (compoundTable != null ? ImmutableTable.copyOf(compoundTable) : null);\n        this.sparseGrid = (sparseGrid != null ? ImmutableGrid.copyOf(sparseGrid) : null);\n        this.denseGrid = (denseGrid != null ? ImmutableGrid.copyOf(denseGrid) : null);\n        this.beanBeanMap = ImmutableMap.copyOf(beanBeanMap);\n        this.doubleVector = (doubleVector != null ? doubleVector.clone() : null);\n        this.matrix = (double[][]) JodaBeanUtils.cloneArray(matrix);\n    }\n\n    @Override\n    public ImmAddress.Meta metaBean() {\n        return ImmAddress.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * This will be the flat, house number or house name.\n     * @return the value of the property\n     */\n    public int getNumber() {\n        return number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the street.\n     * @return the value of the property, not null\n     */\n    public String getStreet() {\n        return street;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the city.\n     * @return the value of the property, not null\n     */\n    public String getCity() {\n        return city;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the abstract number.\n     * @return the value of the property\n     */\n    public Number getAbstractNumber() {\n        return abstractNumber;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the extra data.\n     * @return the value of the property\n     */\n    public byte[] getData() {\n        return (data != null ? data.clone() : null);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the 2D array.\n     * @return the value of the property\n     */\n    public String[][] getArray2d() {\n        return (String[][]) JodaBeanUtils.cloneArray(array2d);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the owner.\n     * @return the value of the property, not null\n     */\n    public ImmPerson getOwner() {\n        return owner;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the object field.\n     * @return the value of the property\n     */\n    public Object getObject1() {\n        return object1;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the object field.\n     * @return the value of the property\n     */\n    public Object getObject2() {\n        return object2;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the risk field.\n     * @return the value of the property\n     */\n    public Risk getRisk() {\n        return risk;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the risk level field, testing an {@code Enum}.\n     * @return the value of the property\n     */\n    public RiskLevel getRiskLevel() {\n        return riskLevel;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the risk levels field, testing {@code EnumSet}.\n     * @return the value of the property\n     */\n    public EnumSet<RiskLevel> getRiskLevels() {\n        return riskLevels;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the serializable field.\n     * @return the value of the property\n     */\n    public Serializable getSerializable() {\n        return serializable;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the object in map field.\n     * @return the value of the property, not null\n     */\n    public ImmutableMap<String, Object> getObjectInMap() {\n        return objectInMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the list in map field.\n     * @return the value of the property, not null\n     */\n    public ImmutableMap<String, List<String>> getListInMap() {\n        return listInMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the list in map field.\n     * @return the value of the property, not null\n     */\n    public ImmutableMap<String, List<Integer>> getListNumericInMap() {\n        return listNumericInMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the list in list in map field.\n     * @return the value of the property, not null\n     */\n    public ImmutableMap<String, List<List<Integer>>> getListInListInMap() {\n        return listInListInMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the object list in list in map field.\n     * @return the value of the property, not null\n     */\n    public ImmutableMap<String, List<List<Object>>> getObjectListInListInMap() {\n        return objectListInListInMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the map in map field.\n     * @return the value of the property, not null\n     */\n    public ImmutableMap<ImmPerson, Map<String, ImmPerson>> getMapInMap() {\n        return mapInMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the simple table.\n     * @return the value of the property\n     */\n    public ImmutableTable<Integer, Integer, String> getSimpleTable() {\n        return simpleTable;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the compound table.\n     * @return the value of the property\n     */\n    public ImmutableTable<Integer, Integer, ImmPerson> getCompoundTable() {\n        return compoundTable;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the grid.\n     * @return the value of the property\n     */\n    public ImmutableGrid<ImmPerson> getSparseGrid() {\n        return sparseGrid;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the grid.\n     * @return the value of the property\n     */\n    public ImmutableGrid<ImmPerson> getDenseGrid() {\n        return denseGrid;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the bean key and bean value field.\n     * @return the value of the property, not null\n     */\n    public ImmutableMap<ImmPerson, ImmAddress> getBeanBeanMap() {\n        return beanBeanMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the array.\n     * @return the value of the property\n     */\n    public double[] getDoubleVector() {\n        return (doubleVector != null ? doubleVector.clone() : null);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the matrix.\n     * @return the value of the property\n     */\n    public double[][] getMatrix() {\n        return (double[][]) JodaBeanUtils.cloneArray(matrix);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmAddress other = (ImmAddress) obj;\n            return (this.number == other.number) &&\n                    JodaBeanUtils.equal(this.street, other.street) &&\n                    JodaBeanUtils.equal(this.city, other.city) &&\n                    JodaBeanUtils.equal(this.abstractNumber, other.abstractNumber) &&\n                    JodaBeanUtils.equal(this.data, other.data) &&\n                    JodaBeanUtils.equal(this.array2d, other.array2d) &&\n                    JodaBeanUtils.equal(this.owner, other.owner) &&\n                    JodaBeanUtils.equal(this.object1, other.object1) &&\n                    JodaBeanUtils.equal(this.object2, other.object2) &&\n                    JodaBeanUtils.equal(this.risk, other.risk) &&\n                    JodaBeanUtils.equal(this.riskLevel, other.riskLevel) &&\n                    JodaBeanUtils.equal(this.riskLevels, other.riskLevels) &&\n                    JodaBeanUtils.equal(this.serializable, other.serializable) &&\n                    JodaBeanUtils.equal(this.objectInMap, other.objectInMap) &&\n                    JodaBeanUtils.equal(this.listInMap, other.listInMap) &&\n                    JodaBeanUtils.equal(this.listNumericInMap, other.listNumericInMap) &&\n                    JodaBeanUtils.equal(this.listInListInMap, other.listInListInMap) &&\n                    JodaBeanUtils.equal(this.objectListInListInMap, other.objectListInListInMap) &&\n                    JodaBeanUtils.equal(this.mapInMap, other.mapInMap) &&\n                    JodaBeanUtils.equal(this.simpleTable, other.simpleTable) &&\n                    JodaBeanUtils.equal(this.compoundTable, other.compoundTable) &&\n                    JodaBeanUtils.equal(this.sparseGrid, other.sparseGrid) &&\n                    JodaBeanUtils.equal(this.denseGrid, other.denseGrid) &&\n                    JodaBeanUtils.equal(this.beanBeanMap, other.beanBeanMap) &&\n                    JodaBeanUtils.equal(this.doubleVector, other.doubleVector) &&\n                    JodaBeanUtils.equal(this.matrix, other.matrix);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(number);\n        hash = hash * 31 + JodaBeanUtils.hashCode(street);\n        hash = hash * 31 + JodaBeanUtils.hashCode(city);\n        hash = hash * 31 + JodaBeanUtils.hashCode(abstractNumber);\n        hash = hash * 31 + JodaBeanUtils.hashCode(data);\n        hash = hash * 31 + JodaBeanUtils.hashCode(array2d);\n        hash = hash * 31 + JodaBeanUtils.hashCode(owner);\n        hash = hash * 31 + JodaBeanUtils.hashCode(object1);\n        hash = hash * 31 + JodaBeanUtils.hashCode(object2);\n        hash = hash * 31 + JodaBeanUtils.hashCode(risk);\n        hash = hash * 31 + JodaBeanUtils.hashCode(riskLevel);\n        hash = hash * 31 + JodaBeanUtils.hashCode(riskLevels);\n        hash = hash * 31 + JodaBeanUtils.hashCode(serializable);\n        hash = hash * 31 + JodaBeanUtils.hashCode(objectInMap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listInMap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listNumericInMap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listInListInMap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(objectListInListInMap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(mapInMap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(simpleTable);\n        hash = hash * 31 + JodaBeanUtils.hashCode(compoundTable);\n        hash = hash * 31 + JodaBeanUtils.hashCode(sparseGrid);\n        hash = hash * 31 + JodaBeanUtils.hashCode(denseGrid);\n        hash = hash * 31 + JodaBeanUtils.hashCode(beanBeanMap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(doubleVector);\n        hash = hash * 31 + JodaBeanUtils.hashCode(matrix);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(864);\n        buf.append(\"ImmAddress{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n        buf.append(\"street\").append('=').append(JodaBeanUtils.toString(street)).append(',').append(' ');\n        buf.append(\"city\").append('=').append(JodaBeanUtils.toString(city)).append(',').append(' ');\n        buf.append(\"abstractNumber\").append('=').append(JodaBeanUtils.toString(abstractNumber)).append(',').append(' ');\n        buf.append(\"data\").append('=').append(JodaBeanUtils.toString(data)).append(',').append(' ');\n        buf.append(\"array2d\").append('=').append(JodaBeanUtils.toString(array2d)).append(',').append(' ');\n        buf.append(\"owner\").append('=').append(JodaBeanUtils.toString(owner)).append(',').append(' ');\n        buf.append(\"object1\").append('=').append(JodaBeanUtils.toString(object1)).append(',').append(' ');\n        buf.append(\"object2\").append('=').append(JodaBeanUtils.toString(object2)).append(',').append(' ');\n        buf.append(\"risk\").append('=').append(JodaBeanUtils.toString(risk)).append(',').append(' ');\n        buf.append(\"riskLevel\").append('=').append(JodaBeanUtils.toString(riskLevel)).append(',').append(' ');\n        buf.append(\"riskLevels\").append('=').append(JodaBeanUtils.toString(riskLevels)).append(',').append(' ');\n        buf.append(\"serializable\").append('=').append(JodaBeanUtils.toString(serializable)).append(',').append(' ');\n        buf.append(\"objectInMap\").append('=').append(JodaBeanUtils.toString(objectInMap)).append(',').append(' ');\n        buf.append(\"listInMap\").append('=').append(JodaBeanUtils.toString(listInMap)).append(',').append(' ');\n        buf.append(\"listNumericInMap\").append('=').append(JodaBeanUtils.toString(listNumericInMap)).append(',').append(' ');\n        buf.append(\"listInListInMap\").append('=').append(JodaBeanUtils.toString(listInListInMap)).append(',').append(' ');\n        buf.append(\"objectListInListInMap\").append('=').append(JodaBeanUtils.toString(objectListInListInMap)).append(',').append(' ');\n        buf.append(\"mapInMap\").append('=').append(JodaBeanUtils.toString(mapInMap)).append(',').append(' ');\n        buf.append(\"simpleTable\").append('=').append(JodaBeanUtils.toString(simpleTable)).append(',').append(' ');\n        buf.append(\"compoundTable\").append('=').append(JodaBeanUtils.toString(compoundTable)).append(',').append(' ');\n        buf.append(\"sparseGrid\").append('=').append(JodaBeanUtils.toString(sparseGrid)).append(',').append(' ');\n        buf.append(\"denseGrid\").append('=').append(JodaBeanUtils.toString(denseGrid)).append(',').append(' ');\n        buf.append(\"beanBeanMap\").append('=').append(JodaBeanUtils.toString(beanBeanMap)).append(',').append(' ');\n        buf.append(\"doubleVector\").append('=').append(JodaBeanUtils.toString(doubleVector)).append(',').append(' ');\n        buf.append(\"matrix\").append('=').append(JodaBeanUtils.toString(matrix));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmAddress}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code number} property.\n         */\n        private final MetaProperty<Integer> number = DirectMetaProperty.ofImmutable(\n                this, \"number\", ImmAddress.class, Integer.TYPE);\n        /**\n         * The meta-property for the {@code street} property.\n         */\n        private final MetaProperty<String> street = DirectMetaProperty.ofImmutable(\n                this, \"street\", ImmAddress.class, String.class);\n        /**\n         * The meta-property for the {@code city} property.\n         */\n        private final MetaProperty<String> city = DirectMetaProperty.ofImmutable(\n                this, \"city\", ImmAddress.class, String.class);\n        /**\n         * The meta-property for the {@code abstractNumber} property.\n         */\n        private final MetaProperty<Number> abstractNumber = DirectMetaProperty.ofImmutable(\n                this, \"abstractNumber\", ImmAddress.class, Number.class);\n        /**\n         * The meta-property for the {@code data} property.\n         */\n        private final MetaProperty<byte[]> data = DirectMetaProperty.ofImmutable(\n                this, \"data\", ImmAddress.class, byte[].class);\n        /**\n         * The meta-property for the {@code array2d} property.\n         */\n        private final MetaProperty<String[][]> array2d = DirectMetaProperty.ofImmutable(\n                this, \"array2d\", ImmAddress.class, String[][].class);\n        /**\n         * The meta-property for the {@code owner} property.\n         */\n        private final MetaProperty<ImmPerson> owner = DirectMetaProperty.ofImmutable(\n                this, \"owner\", ImmAddress.class, ImmPerson.class);\n        /**\n         * The meta-property for the {@code object1} property.\n         */\n        private final MetaProperty<Object> object1 = DirectMetaProperty.ofImmutable(\n                this, \"object1\", ImmAddress.class, Object.class);\n        /**\n         * The meta-property for the {@code object2} property.\n         */\n        private final MetaProperty<Object> object2 = DirectMetaProperty.ofImmutable(\n                this, \"object2\", ImmAddress.class, Object.class);\n        /**\n         * The meta-property for the {@code risk} property.\n         */\n        private final MetaProperty<Risk> risk = DirectMetaProperty.ofImmutable(\n                this, \"risk\", ImmAddress.class, Risk.class);\n        /**\n         * The meta-property for the {@code riskLevel} property.\n         */\n        private final MetaProperty<RiskLevel> riskLevel = DirectMetaProperty.ofImmutable(\n                this, \"riskLevel\", ImmAddress.class, RiskLevel.class);\n        /**\n         * The meta-property for the {@code riskLevels} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<EnumSet<RiskLevel>> riskLevels = DirectMetaProperty.ofImmutable(\n                this, \"riskLevels\", ImmAddress.class, (Class) EnumSet.class);\n        /**\n         * The meta-property for the {@code serializable} property.\n         */\n        private final MetaProperty<Serializable> serializable = DirectMetaProperty.ofImmutable(\n                this, \"serializable\", ImmAddress.class, Serializable.class);\n        /**\n         * The meta-property for the {@code objectInMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<String, Object>> objectInMap = DirectMetaProperty.ofImmutable(\n                this, \"objectInMap\", ImmAddress.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-property for the {@code listInMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<String, List<String>>> listInMap = DirectMetaProperty.ofImmutable(\n                this, \"listInMap\", ImmAddress.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-property for the {@code listNumericInMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<String, List<Integer>>> listNumericInMap = DirectMetaProperty.ofImmutable(\n                this, \"listNumericInMap\", ImmAddress.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-property for the {@code listInListInMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<String, List<List<Integer>>>> listInListInMap = DirectMetaProperty.ofImmutable(\n                this, \"listInListInMap\", ImmAddress.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-property for the {@code objectListInListInMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<String, List<List<Object>>>> objectListInListInMap = DirectMetaProperty.ofImmutable(\n                this, \"objectListInListInMap\", ImmAddress.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-property for the {@code mapInMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<ImmPerson, Map<String, ImmPerson>>> mapInMap = DirectMetaProperty.ofImmutable(\n                this, \"mapInMap\", ImmAddress.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-property for the {@code simpleTable} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableTable<Integer, Integer, String>> simpleTable = DirectMetaProperty.ofImmutable(\n                this, \"simpleTable\", ImmAddress.class, (Class) ImmutableTable.class);\n        /**\n         * The meta-property for the {@code compoundTable} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableTable<Integer, Integer, ImmPerson>> compoundTable = DirectMetaProperty.ofImmutable(\n                this, \"compoundTable\", ImmAddress.class, (Class) ImmutableTable.class);\n        /**\n         * The meta-property for the {@code sparseGrid} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableGrid<ImmPerson>> sparseGrid = DirectMetaProperty.ofImmutable(\n                this, \"sparseGrid\", ImmAddress.class, (Class) ImmutableGrid.class);\n        /**\n         * The meta-property for the {@code denseGrid} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableGrid<ImmPerson>> denseGrid = DirectMetaProperty.ofImmutable(\n                this, \"denseGrid\", ImmAddress.class, (Class) ImmutableGrid.class);\n        /**\n         * The meta-property for the {@code beanBeanMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<ImmPerson, ImmAddress>> beanBeanMap = DirectMetaProperty.ofImmutable(\n                this, \"beanBeanMap\", ImmAddress.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-property for the {@code doubleVector} property.\n         */\n        private final MetaProperty<double[]> doubleVector = DirectMetaProperty.ofImmutable(\n                this, \"doubleVector\", ImmAddress.class, double[].class);\n        /**\n         * The meta-property for the {@code matrix} property.\n         */\n        private final MetaProperty<double[][]> matrix = DirectMetaProperty.ofImmutable(\n                this, \"matrix\", ImmAddress.class, double[][].class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"number\",\n                \"street\",\n                \"city\",\n                \"abstractNumber\",\n                \"data\",\n                \"array2d\",\n                \"owner\",\n                \"object1\",\n                \"object2\",\n                \"risk\",\n                \"riskLevel\",\n                \"riskLevels\",\n                \"serializable\",\n                \"objectInMap\",\n                \"listInMap\",\n                \"listNumericInMap\",\n                \"listInListInMap\",\n                \"objectListInListInMap\",\n                \"mapInMap\",\n                \"simpleTable\",\n                \"compoundTable\",\n                \"sparseGrid\",\n                \"denseGrid\",\n                \"beanBeanMap\",\n                \"doubleVector\",\n                \"matrix\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    return this.number;\n                case -891990013:  // street\n                    return this.street;\n                case 3053931:  // city\n                    return this.city;\n                case 1986500107:  // abstractNumber\n                    return this.abstractNumber;\n                case 3076010:  // data\n                    return this.data;\n                case -734443893:  // array2d\n                    return this.array2d;\n                case 106164915:  // owner\n                    return this.owner;\n                case -1659648814:  // object1\n                    return this.object1;\n                case -1659648813:  // object2\n                    return this.object2;\n                case 3500751:  // risk\n                    return this.risk;\n                case 540453365:  // riskLevel\n                    return this.riskLevel;\n                case -425814754:  // riskLevels\n                    return this.riskLevels;\n                case 861034751:  // serializable\n                    return this.serializable;\n                case -1297715720:  // objectInMap\n                    return this.objectInMap;\n                case -1244601351:  // listInMap\n                    return this.listInMap;\n                case 391098024:  // listNumericInMap\n                    return this.listNumericInMap;\n                case -940836650:  // listInListInMap\n                    return this.listInListInMap;\n                case -861321321:  // objectListInListInMap\n                    return this.objectListInListInMap;\n                case 158545403:  // mapInMap\n                    return this.mapInMap;\n                case -1429579460:  // simpleTable\n                    return this.simpleTable;\n                case 103339235:  // compoundTable\n                    return this.compoundTable;\n                case 1337284998:  // sparseGrid\n                    return this.sparseGrid;\n                case 1802377989:  // denseGrid\n                    return this.denseGrid;\n                case -2039203396:  // beanBeanMap\n                    return this.beanBeanMap;\n                case 1118070900:  // doubleVector\n                    return this.doubleVector;\n                case -1081239615:  // matrix\n                    return this.matrix;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmAddress.Builder builder() {\n            return new ImmAddress.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmAddress> beanType() {\n            return ImmAddress.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code number} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Integer> number() {\n            return number;\n        }\n\n        /**\n         * The meta-property for the {@code street} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> street() {\n            return street;\n        }\n\n        /**\n         * The meta-property for the {@code city} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> city() {\n            return city;\n        }\n\n        /**\n         * The meta-property for the {@code abstractNumber} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Number> abstractNumber() {\n            return abstractNumber;\n        }\n\n        /**\n         * The meta-property for the {@code data} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<byte[]> data() {\n            return data;\n        }\n\n        /**\n         * The meta-property for the {@code array2d} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String[][]> array2d() {\n            return array2d;\n        }\n\n        /**\n         * The meta-property for the {@code owner} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmPerson> owner() {\n            return owner;\n        }\n\n        /**\n         * The meta-property for the {@code object1} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Object> object1() {\n            return object1;\n        }\n\n        /**\n         * The meta-property for the {@code object2} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Object> object2() {\n            return object2;\n        }\n\n        /**\n         * The meta-property for the {@code risk} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Risk> risk() {\n            return risk;\n        }\n\n        /**\n         * The meta-property for the {@code riskLevel} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<RiskLevel> riskLevel() {\n            return riskLevel;\n        }\n\n        /**\n         * The meta-property for the {@code riskLevels} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<EnumSet<RiskLevel>> riskLevels() {\n            return riskLevels;\n        }\n\n        /**\n         * The meta-property for the {@code serializable} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Serializable> serializable() {\n            return serializable;\n        }\n\n        /**\n         * The meta-property for the {@code objectInMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<String, Object>> objectInMap() {\n            return objectInMap;\n        }\n\n        /**\n         * The meta-property for the {@code listInMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<String, List<String>>> listInMap() {\n            return listInMap;\n        }\n\n        /**\n         * The meta-property for the {@code listNumericInMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<String, List<Integer>>> listNumericInMap() {\n            return listNumericInMap;\n        }\n\n        /**\n         * The meta-property for the {@code listInListInMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<String, List<List<Integer>>>> listInListInMap() {\n            return listInListInMap;\n        }\n\n        /**\n         * The meta-property for the {@code objectListInListInMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<String, List<List<Object>>>> objectListInListInMap() {\n            return objectListInListInMap;\n        }\n\n        /**\n         * The meta-property for the {@code mapInMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<ImmPerson, Map<String, ImmPerson>>> mapInMap() {\n            return mapInMap;\n        }\n\n        /**\n         * The meta-property for the {@code simpleTable} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableTable<Integer, Integer, String>> simpleTable() {\n            return simpleTable;\n        }\n\n        /**\n         * The meta-property for the {@code compoundTable} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableTable<Integer, Integer, ImmPerson>> compoundTable() {\n            return compoundTable;\n        }\n\n        /**\n         * The meta-property for the {@code sparseGrid} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableGrid<ImmPerson>> sparseGrid() {\n            return sparseGrid;\n        }\n\n        /**\n         * The meta-property for the {@code denseGrid} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableGrid<ImmPerson>> denseGrid() {\n            return denseGrid;\n        }\n\n        /**\n         * The meta-property for the {@code beanBeanMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<ImmPerson, ImmAddress>> beanBeanMap() {\n            return beanBeanMap;\n        }\n\n        /**\n         * The meta-property for the {@code doubleVector} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<double[]> doubleVector() {\n            return doubleVector;\n        }\n\n        /**\n         * The meta-property for the {@code matrix} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<double[][]> matrix() {\n            return matrix;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    return ((ImmAddress) bean).getNumber();\n                case -891990013:  // street\n                    return ((ImmAddress) bean).getStreet();\n                case 3053931:  // city\n                    return ((ImmAddress) bean).getCity();\n                case 1986500107:  // abstractNumber\n                    return ((ImmAddress) bean).getAbstractNumber();\n                case 3076010:  // data\n                    return ((ImmAddress) bean).getData();\n                case -734443893:  // array2d\n                    return ((ImmAddress) bean).getArray2d();\n                case 106164915:  // owner\n                    return ((ImmAddress) bean).getOwner();\n                case -1659648814:  // object1\n                    return ((ImmAddress) bean).getObject1();\n                case -1659648813:  // object2\n                    return ((ImmAddress) bean).getObject2();\n                case 3500751:  // risk\n                    return ((ImmAddress) bean).getRisk();\n                case 540453365:  // riskLevel\n                    return ((ImmAddress) bean).getRiskLevel();\n                case -425814754:  // riskLevels\n                    return ((ImmAddress) bean).getRiskLevels();\n                case 861034751:  // serializable\n                    return ((ImmAddress) bean).getSerializable();\n                case -1297715720:  // objectInMap\n                    return ((ImmAddress) bean).getObjectInMap();\n                case -1244601351:  // listInMap\n                    return ((ImmAddress) bean).getListInMap();\n                case 391098024:  // listNumericInMap\n                    return ((ImmAddress) bean).getListNumericInMap();\n                case -940836650:  // listInListInMap\n                    return ((ImmAddress) bean).getListInListInMap();\n                case -861321321:  // objectListInListInMap\n                    return ((ImmAddress) bean).getObjectListInListInMap();\n                case 158545403:  // mapInMap\n                    return ((ImmAddress) bean).getMapInMap();\n                case -1429579460:  // simpleTable\n                    return ((ImmAddress) bean).getSimpleTable();\n                case 103339235:  // compoundTable\n                    return ((ImmAddress) bean).getCompoundTable();\n                case 1337284998:  // sparseGrid\n                    return ((ImmAddress) bean).getSparseGrid();\n                case 1802377989:  // denseGrid\n                    return ((ImmAddress) bean).getDenseGrid();\n                case -2039203396:  // beanBeanMap\n                    return ((ImmAddress) bean).getBeanBeanMap();\n                case 1118070900:  // doubleVector\n                    return ((ImmAddress) bean).getDoubleVector();\n                case -1081239615:  // matrix\n                    return ((ImmAddress) bean).getMatrix();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmAddress}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmAddress> {\n\n        private int number;\n        private String street;\n        private String city;\n        private Number abstractNumber;\n        private byte[] data;\n        private String[][] array2d;\n        private ImmPerson owner;\n        private Object object1;\n        private Object object2;\n        private Risk risk;\n        private RiskLevel riskLevel;\n        private Set<RiskLevel> riskLevels;\n        private Serializable serializable;\n        private Map<String, Object> objectInMap = ImmutableMap.of();\n        private Map<String, List<String>> listInMap = ImmutableMap.of();\n        private Map<String, List<Integer>> listNumericInMap = ImmutableMap.of();\n        private Map<String, List<List<Integer>>> listInListInMap = ImmutableMap.of();\n        private Map<String, List<List<Object>>> objectListInListInMap = ImmutableMap.of();\n        private Map<ImmPerson, Map<String, ImmPerson>> mapInMap = ImmutableMap.of();\n        private Table<Integer, Integer, String> simpleTable;\n        private Table<Integer, Integer, ImmPerson> compoundTable;\n        private Grid<ImmPerson> sparseGrid;\n        private Grid<ImmPerson> denseGrid;\n        private Map<ImmPerson, ImmAddress> beanBeanMap = ImmutableMap.of();\n        private double[] doubleVector;\n        private double[][] matrix;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmAddress beanToCopy) {\n            this.number = beanToCopy.getNumber();\n            this.street = beanToCopy.getStreet();\n            this.city = beanToCopy.getCity();\n            this.abstractNumber = beanToCopy.getAbstractNumber();\n            this.data = (beanToCopy.getData() != null ? beanToCopy.getData().clone() : null);\n            this.array2d = (String[][]) JodaBeanUtils.cloneArray(beanToCopy.getArray2d());\n            this.owner = beanToCopy.getOwner();\n            this.object1 = beanToCopy.getObject1();\n            this.object2 = beanToCopy.getObject2();\n            this.risk = beanToCopy.getRisk();\n            this.riskLevel = beanToCopy.getRiskLevel();\n            this.riskLevels = (beanToCopy.getRiskLevels() != null ? new HashSet<>(beanToCopy.getRiskLevels()) : null);\n            this.serializable = beanToCopy.getSerializable();\n            this.objectInMap = beanToCopy.getObjectInMap();\n            this.listInMap = beanToCopy.getListInMap();\n            this.listNumericInMap = beanToCopy.getListNumericInMap();\n            this.listInListInMap = beanToCopy.getListInListInMap();\n            this.objectListInListInMap = beanToCopy.getObjectListInListInMap();\n            this.mapInMap = beanToCopy.getMapInMap();\n            this.simpleTable = beanToCopy.getSimpleTable();\n            this.compoundTable = beanToCopy.getCompoundTable();\n            this.sparseGrid = beanToCopy.getSparseGrid();\n            this.denseGrid = beanToCopy.getDenseGrid();\n            this.beanBeanMap = beanToCopy.getBeanBeanMap();\n            this.doubleVector = (beanToCopy.getDoubleVector() != null ? beanToCopy.getDoubleVector().clone() : null);\n            this.matrix = (double[][]) JodaBeanUtils.cloneArray(beanToCopy.getMatrix());\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    return this.number;\n                case -891990013:  // street\n                    return this.street;\n                case 3053931:  // city\n                    return this.city;\n                case 1986500107:  // abstractNumber\n                    return this.abstractNumber;\n                case 3076010:  // data\n                    return this.data;\n                case -734443893:  // array2d\n                    return this.array2d;\n                case 106164915:  // owner\n                    return this.owner;\n                case -1659648814:  // object1\n                    return this.object1;\n                case -1659648813:  // object2\n                    return this.object2;\n                case 3500751:  // risk\n                    return this.risk;\n                case 540453365:  // riskLevel\n                    return this.riskLevel;\n                case -425814754:  // riskLevels\n                    return this.riskLevels;\n                case 861034751:  // serializable\n                    return this.serializable;\n                case -1297715720:  // objectInMap\n                    return this.objectInMap;\n                case -1244601351:  // listInMap\n                    return this.listInMap;\n                case 391098024:  // listNumericInMap\n                    return this.listNumericInMap;\n                case -940836650:  // listInListInMap\n                    return this.listInListInMap;\n                case -861321321:  // objectListInListInMap\n                    return this.objectListInListInMap;\n                case 158545403:  // mapInMap\n                    return this.mapInMap;\n                case -1429579460:  // simpleTable\n                    return this.simpleTable;\n                case 103339235:  // compoundTable\n                    return this.compoundTable;\n                case 1337284998:  // sparseGrid\n                    return this.sparseGrid;\n                case 1802377989:  // denseGrid\n                    return this.denseGrid;\n                case -2039203396:  // beanBeanMap\n                    return this.beanBeanMap;\n                case 1118070900:  // doubleVector\n                    return this.doubleVector;\n                case -1081239615:  // matrix\n                    return this.matrix;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    this.number = (Integer) newValue;\n                    break;\n                case -891990013:  // street\n                    this.street = (String) newValue;\n                    break;\n                case 3053931:  // city\n                    this.city = (String) newValue;\n                    break;\n                case 1986500107:  // abstractNumber\n                    this.abstractNumber = (Number) newValue;\n                    break;\n                case 3076010:  // data\n                    this.data = (byte[]) newValue;\n                    break;\n                case -734443893:  // array2d\n                    this.array2d = (String[][]) newValue;\n                    break;\n                case 106164915:  // owner\n                    this.owner = (ImmPerson) newValue;\n                    break;\n                case -1659648814:  // object1\n                    this.object1 = (Object) newValue;\n                    break;\n                case -1659648813:  // object2\n                    this.object2 = (Object) newValue;\n                    break;\n                case 3500751:  // risk\n                    this.risk = (Risk) newValue;\n                    break;\n                case 540453365:  // riskLevel\n                    this.riskLevel = (RiskLevel) newValue;\n                    break;\n                case -425814754:  // riskLevels\n                    this.riskLevels = (Set<RiskLevel>) newValue;\n                    break;\n                case 861034751:  // serializable\n                    this.serializable = (Serializable) newValue;\n                    break;\n                case -1297715720:  // objectInMap\n                    this.objectInMap = (Map<String, Object>) newValue;\n                    break;\n                case -1244601351:  // listInMap\n                    this.listInMap = (Map<String, List<String>>) newValue;\n                    break;\n                case 391098024:  // listNumericInMap\n                    this.listNumericInMap = (Map<String, List<Integer>>) newValue;\n                    break;\n                case -940836650:  // listInListInMap\n                    this.listInListInMap = (Map<String, List<List<Integer>>>) newValue;\n                    break;\n                case -861321321:  // objectListInListInMap\n                    this.objectListInListInMap = (Map<String, List<List<Object>>>) newValue;\n                    break;\n                case 158545403:  // mapInMap\n                    this.mapInMap = (Map<ImmPerson, Map<String, ImmPerson>>) newValue;\n                    break;\n                case -1429579460:  // simpleTable\n                    this.simpleTable = (Table<Integer, Integer, String>) newValue;\n                    break;\n                case 103339235:  // compoundTable\n                    this.compoundTable = (Table<Integer, Integer, ImmPerson>) newValue;\n                    break;\n                case 1337284998:  // sparseGrid\n                    this.sparseGrid = (Grid<ImmPerson>) newValue;\n                    break;\n                case 1802377989:  // denseGrid\n                    this.denseGrid = (Grid<ImmPerson>) newValue;\n                    break;\n                case -2039203396:  // beanBeanMap\n                    this.beanBeanMap = (Map<ImmPerson, ImmAddress>) newValue;\n                    break;\n                case 1118070900:  // doubleVector\n                    this.doubleVector = (double[]) newValue;\n                    break;\n                case -1081239615:  // matrix\n                    this.matrix = (double[][]) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmAddress build() {\n            return new ImmAddress(\n                    number,\n                    street,\n                    city,\n                    abstractNumber,\n                    data,\n                    array2d,\n                    owner,\n                    object1,\n                    object2,\n                    risk,\n                    riskLevel,\n                    riskLevels,\n                    serializable,\n                    objectInMap,\n                    listInMap,\n                    listNumericInMap,\n                    listInListInMap,\n                    objectListInListInMap,\n                    mapInMap,\n                    simpleTable,\n                    compoundTable,\n                    sparseGrid,\n                    denseGrid,\n                    beanBeanMap,\n                    doubleVector,\n                    matrix);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the number.\n         * This will be the flat, house number or house name.\n         * @param number  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder number(int number) {\n            this.number = number;\n            return this;\n        }\n\n        /**\n         * Sets the street.\n         * @param street  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder street(String street) {\n            JodaBeanUtils.notNull(street, \"street\");\n            this.street = street;\n            return this;\n        }\n\n        /**\n         * Sets the city.\n         * @param city  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder city(String city) {\n            JodaBeanUtils.notNull(city, \"city\");\n            this.city = city;\n            return this;\n        }\n\n        /**\n         * Sets the abstract number.\n         * @param abstractNumber  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder abstractNumber(Number abstractNumber) {\n            this.abstractNumber = abstractNumber;\n            return this;\n        }\n\n        /**\n         * Sets the extra data.\n         * @param data  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder data(byte[] data) {\n            this.data = data;\n            return this;\n        }\n\n        /**\n         * Sets the 2D array.\n         * @param array2d  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder array2d(String[][] array2d) {\n            this.array2d = array2d;\n            return this;\n        }\n\n        /**\n         * Sets the owner.\n         * @param owner  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder owner(ImmPerson owner) {\n            JodaBeanUtils.notNull(owner, \"owner\");\n            this.owner = owner;\n            return this;\n        }\n\n        /**\n         * Sets the object field.\n         * @param object1  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder object1(Object object1) {\n            this.object1 = object1;\n            return this;\n        }\n\n        /**\n         * Sets the object field.\n         * @param object2  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder object2(Object object2) {\n            this.object2 = object2;\n            return this;\n        }\n\n        /**\n         * Sets the risk field.\n         * @param risk  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder risk(Risk risk) {\n            this.risk = risk;\n            return this;\n        }\n\n        /**\n         * Sets the risk level field, testing an {@code Enum}.\n         * @param riskLevel  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder riskLevel(RiskLevel riskLevel) {\n            this.riskLevel = riskLevel;\n            return this;\n        }\n\n        /**\n         * Sets the risk levels field, testing {@code EnumSet}.\n         * @param riskLevels  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder riskLevels(Set<RiskLevel> riskLevels) {\n            this.riskLevels = riskLevels;\n            return this;\n        }\n\n        /**\n         * Sets the {@code riskLevels} property in the builder\n         * from an array of objects.\n         * @param riskLevels  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder riskLevels(RiskLevel... riskLevels) {\n            return riskLevels(EnumSet.copyOf(Arrays.asList(riskLevels)));\n        }\n\n        /**\n         * Sets the serializable field.\n         * @param serializable  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder serializable(Serializable serializable) {\n            this.serializable = serializable;\n            return this;\n        }\n\n        /**\n         * Sets the object in map field.\n         * @param objectInMap  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder objectInMap(Map<String, Object> objectInMap) {\n            JodaBeanUtils.notNull(objectInMap, \"objectInMap\");\n            this.objectInMap = objectInMap;\n            return this;\n        }\n\n        /**\n         * Sets the list in map field.\n         * @param listInMap  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder listInMap(Map<String, List<String>> listInMap) {\n            JodaBeanUtils.notNull(listInMap, \"listInMap\");\n            this.listInMap = listInMap;\n            return this;\n        }\n\n        /**\n         * Sets the list in map field.\n         * @param listNumericInMap  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder listNumericInMap(Map<String, List<Integer>> listNumericInMap) {\n            JodaBeanUtils.notNull(listNumericInMap, \"listNumericInMap\");\n            this.listNumericInMap = listNumericInMap;\n            return this;\n        }\n\n        /**\n         * Sets the list in list in map field.\n         * @param listInListInMap  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder listInListInMap(Map<String, List<List<Integer>>> listInListInMap) {\n            JodaBeanUtils.notNull(listInListInMap, \"listInListInMap\");\n            this.listInListInMap = listInListInMap;\n            return this;\n        }\n\n        /**\n         * Sets the object list in list in map field.\n         * @param objectListInListInMap  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder objectListInListInMap(Map<String, List<List<Object>>> objectListInListInMap) {\n            JodaBeanUtils.notNull(objectListInListInMap, \"objectListInListInMap\");\n            this.objectListInListInMap = objectListInListInMap;\n            return this;\n        }\n\n        /**\n         * Sets the map in map field.\n         * @param mapInMap  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder mapInMap(Map<ImmPerson, Map<String, ImmPerson>> mapInMap) {\n            JodaBeanUtils.notNull(mapInMap, \"mapInMap\");\n            this.mapInMap = mapInMap;\n            return this;\n        }\n\n        /**\n         * Sets the simple table.\n         * @param simpleTable  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder simpleTable(Table<Integer, Integer, String> simpleTable) {\n            this.simpleTable = simpleTable;\n            return this;\n        }\n\n        /**\n         * Sets the compound table.\n         * @param compoundTable  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder compoundTable(Table<Integer, Integer, ImmPerson> compoundTable) {\n            this.compoundTable = compoundTable;\n            return this;\n        }\n\n        /**\n         * Sets the grid.\n         * @param sparseGrid  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder sparseGrid(Grid<ImmPerson> sparseGrid) {\n            this.sparseGrid = sparseGrid;\n            return this;\n        }\n\n        /**\n         * Sets the grid.\n         * @param denseGrid  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder denseGrid(Grid<ImmPerson> denseGrid) {\n            this.denseGrid = denseGrid;\n            return this;\n        }\n\n        /**\n         * Sets the bean key and bean value field.\n         * @param beanBeanMap  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder beanBeanMap(Map<ImmPerson, ImmAddress> beanBeanMap) {\n            JodaBeanUtils.notNull(beanBeanMap, \"beanBeanMap\");\n            this.beanBeanMap = beanBeanMap;\n            return this;\n        }\n\n        /**\n         * Sets the array.\n         * @param doubleVector  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder doubleVector(double... doubleVector) {\n            this.doubleVector = doubleVector;\n            return this;\n        }\n\n        /**\n         * Sets the matrix.\n         * @param matrix  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder matrix(double[][] matrix) {\n            this.matrix = matrix;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(864);\n            buf.append(\"ImmAddress.Builder{\");\n            buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n            buf.append(\"street\").append('=').append(JodaBeanUtils.toString(street)).append(',').append(' ');\n            buf.append(\"city\").append('=').append(JodaBeanUtils.toString(city)).append(',').append(' ');\n            buf.append(\"abstractNumber\").append('=').append(JodaBeanUtils.toString(abstractNumber)).append(',').append(' ');\n            buf.append(\"data\").append('=').append(JodaBeanUtils.toString(data)).append(',').append(' ');\n            buf.append(\"array2d\").append('=').append(JodaBeanUtils.toString(array2d)).append(',').append(' ');\n            buf.append(\"owner\").append('=').append(JodaBeanUtils.toString(owner)).append(',').append(' ');\n            buf.append(\"object1\").append('=').append(JodaBeanUtils.toString(object1)).append(',').append(' ');\n            buf.append(\"object2\").append('=').append(JodaBeanUtils.toString(object2)).append(',').append(' ');\n            buf.append(\"risk\").append('=').append(JodaBeanUtils.toString(risk)).append(',').append(' ');\n            buf.append(\"riskLevel\").append('=').append(JodaBeanUtils.toString(riskLevel)).append(',').append(' ');\n            buf.append(\"riskLevels\").append('=').append(JodaBeanUtils.toString(riskLevels)).append(',').append(' ');\n            buf.append(\"serializable\").append('=').append(JodaBeanUtils.toString(serializable)).append(',').append(' ');\n            buf.append(\"objectInMap\").append('=').append(JodaBeanUtils.toString(objectInMap)).append(',').append(' ');\n            buf.append(\"listInMap\").append('=').append(JodaBeanUtils.toString(listInMap)).append(',').append(' ');\n            buf.append(\"listNumericInMap\").append('=').append(JodaBeanUtils.toString(listNumericInMap)).append(',').append(' ');\n            buf.append(\"listInListInMap\").append('=').append(JodaBeanUtils.toString(listInListInMap)).append(',').append(' ');\n            buf.append(\"objectListInListInMap\").append('=').append(JodaBeanUtils.toString(objectListInListInMap)).append(',').append(' ');\n            buf.append(\"mapInMap\").append('=').append(JodaBeanUtils.toString(mapInMap)).append(',').append(' ');\n            buf.append(\"simpleTable\").append('=').append(JodaBeanUtils.toString(simpleTable)).append(',').append(' ');\n            buf.append(\"compoundTable\").append('=').append(JodaBeanUtils.toString(compoundTable)).append(',').append(' ');\n            buf.append(\"sparseGrid\").append('=').append(JodaBeanUtils.toString(sparseGrid)).append(',').append(' ');\n            buf.append(\"denseGrid\").append('=').append(JodaBeanUtils.toString(denseGrid)).append(',').append(' ');\n            buf.append(\"beanBeanMap\").append('=').append(JodaBeanUtils.toString(beanBeanMap)).append(',').append(' ');\n            buf.append(\"doubleVector\").append('=').append(JodaBeanUtils.toString(doubleVector)).append(',').append(' ');\n            buf.append(\"matrix\").append('=').append(JodaBeanUtils.toString(matrix));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmArrays.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock bean for primitive array testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(factoryName = \"of\")\npublic final class ImmArrays implements ImmutableBean {\n\n    @PropertyDefinition\n    private final int[] intArray;\n    @PropertyDefinition\n    private final long[] longArray;\n    @PropertyDefinition\n    private final double[] doubleArray;\n    @PropertyDefinition\n    private final boolean[] booleanArray;\n    @PropertyDefinition\n    private final int[][] intArray2d;\n    @PropertyDefinition\n    private final boolean[][] booleanArray2d;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmArrays}.\n     * @return the meta-bean, not null\n     */\n    public static ImmArrays.Meta meta() {\n        return ImmArrays.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmArrays.Meta.INSTANCE);\n    }\n\n    /**\n     * Obtains an instance.\n     * @param intArray  the value of the property\n     * @param longArray  the value of the property\n     * @param doubleArray  the value of the property\n     * @param booleanArray  the value of the property\n     * @param intArray2d  the value of the property\n     * @param booleanArray2d  the value of the property\n     * @return the instance\n     */\n    public static ImmArrays of(\n            int[] intArray,\n            long[] longArray,\n            double[] doubleArray,\n            boolean[] booleanArray,\n            int[][] intArray2d,\n            boolean[][] booleanArray2d) {\n        return new ImmArrays(\n            intArray,\n            longArray,\n            doubleArray,\n            booleanArray,\n            intArray2d,\n            booleanArray2d);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmArrays.Builder builder() {\n        return new ImmArrays.Builder();\n    }\n\n    private ImmArrays(\n            int[] intArray,\n            long[] longArray,\n            double[] doubleArray,\n            boolean[] booleanArray,\n            int[][] intArray2d,\n            boolean[][] booleanArray2d) {\n        this.intArray = (intArray != null ? intArray.clone() : null);\n        this.longArray = (longArray != null ? longArray.clone() : null);\n        this.doubleArray = (doubleArray != null ? doubleArray.clone() : null);\n        this.booleanArray = (booleanArray != null ? booleanArray.clone() : null);\n        this.intArray2d = (int[][]) JodaBeanUtils.cloneArray(intArray2d);\n        this.booleanArray2d = (boolean[][]) JodaBeanUtils.cloneArray(booleanArray2d);\n    }\n\n    @Override\n    public ImmArrays.Meta metaBean() {\n        return ImmArrays.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the intArray.\n     * @return the value of the property\n     */\n    public int[] getIntArray() {\n        return (intArray != null ? intArray.clone() : null);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the longArray.\n     * @return the value of the property\n     */\n    public long[] getLongArray() {\n        return (longArray != null ? longArray.clone() : null);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the doubleArray.\n     * @return the value of the property\n     */\n    public double[] getDoubleArray() {\n        return (doubleArray != null ? doubleArray.clone() : null);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the booleanArray.\n     * @return the value of the property\n     */\n    public boolean[] getBooleanArray() {\n        return (booleanArray != null ? booleanArray.clone() : null);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the intArray2d.\n     * @return the value of the property\n     */\n    public int[][] getIntArray2d() {\n        return (int[][]) JodaBeanUtils.cloneArray(intArray2d);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the booleanArray2d.\n     * @return the value of the property\n     */\n    public boolean[][] getBooleanArray2d() {\n        return (boolean[][]) JodaBeanUtils.cloneArray(booleanArray2d);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmArrays other = (ImmArrays) obj;\n            return JodaBeanUtils.equal(this.intArray, other.intArray) &&\n                    JodaBeanUtils.equal(this.longArray, other.longArray) &&\n                    JodaBeanUtils.equal(this.doubleArray, other.doubleArray) &&\n                    JodaBeanUtils.equal(this.booleanArray, other.booleanArray) &&\n                    JodaBeanUtils.equal(this.intArray2d, other.intArray2d) &&\n                    JodaBeanUtils.equal(this.booleanArray2d, other.booleanArray2d);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(intArray);\n        hash = hash * 31 + JodaBeanUtils.hashCode(longArray);\n        hash = hash * 31 + JodaBeanUtils.hashCode(doubleArray);\n        hash = hash * 31 + JodaBeanUtils.hashCode(booleanArray);\n        hash = hash * 31 + JodaBeanUtils.hashCode(intArray2d);\n        hash = hash * 31 + JodaBeanUtils.hashCode(booleanArray2d);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(224);\n        buf.append(\"ImmArrays{\");\n        buf.append(\"intArray\").append('=').append(JodaBeanUtils.toString(intArray)).append(',').append(' ');\n        buf.append(\"longArray\").append('=').append(JodaBeanUtils.toString(longArray)).append(',').append(' ');\n        buf.append(\"doubleArray\").append('=').append(JodaBeanUtils.toString(doubleArray)).append(',').append(' ');\n        buf.append(\"booleanArray\").append('=').append(JodaBeanUtils.toString(booleanArray)).append(',').append(' ');\n        buf.append(\"intArray2d\").append('=').append(JodaBeanUtils.toString(intArray2d)).append(',').append(' ');\n        buf.append(\"booleanArray2d\").append('=').append(JodaBeanUtils.toString(booleanArray2d));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmArrays}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code intArray} property.\n         */\n        private final MetaProperty<int[]> intArray = DirectMetaProperty.ofImmutable(\n                this, \"intArray\", ImmArrays.class, int[].class);\n        /**\n         * The meta-property for the {@code longArray} property.\n         */\n        private final MetaProperty<long[]> longArray = DirectMetaProperty.ofImmutable(\n                this, \"longArray\", ImmArrays.class, long[].class);\n        /**\n         * The meta-property for the {@code doubleArray} property.\n         */\n        private final MetaProperty<double[]> doubleArray = DirectMetaProperty.ofImmutable(\n                this, \"doubleArray\", ImmArrays.class, double[].class);\n        /**\n         * The meta-property for the {@code booleanArray} property.\n         */\n        private final MetaProperty<boolean[]> booleanArray = DirectMetaProperty.ofImmutable(\n                this, \"booleanArray\", ImmArrays.class, boolean[].class);\n        /**\n         * The meta-property for the {@code intArray2d} property.\n         */\n        private final MetaProperty<int[][]> intArray2d = DirectMetaProperty.ofImmutable(\n                this, \"intArray2d\", ImmArrays.class, int[][].class);\n        /**\n         * The meta-property for the {@code booleanArray2d} property.\n         */\n        private final MetaProperty<boolean[][]> booleanArray2d = DirectMetaProperty.ofImmutable(\n                this, \"booleanArray2d\", ImmArrays.class, boolean[][].class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"intArray\",\n                \"longArray\",\n                \"doubleArray\",\n                \"booleanArray\",\n                \"intArray2d\",\n                \"booleanArray2d\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 537167786:  // intArray\n                    return this.intArray;\n                case 100362557:  // longArray\n                    return this.longArray;\n                case -1645494008:  // doubleArray\n                    return this.doubleArray;\n                case -1066176751:  // booleanArray\n                    return this.booleanArray;\n                case 822168476:  // intArray2d\n                    return this.intArray2d;\n                case 1901327683:  // booleanArray2d\n                    return this.booleanArray2d;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmArrays.Builder builder() {\n            return new ImmArrays.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmArrays> beanType() {\n            return ImmArrays.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code intArray} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<int[]> intArray() {\n            return intArray;\n        }\n\n        /**\n         * The meta-property for the {@code longArray} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<long[]> longArray() {\n            return longArray;\n        }\n\n        /**\n         * The meta-property for the {@code doubleArray} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<double[]> doubleArray() {\n            return doubleArray;\n        }\n\n        /**\n         * The meta-property for the {@code booleanArray} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<boolean[]> booleanArray() {\n            return booleanArray;\n        }\n\n        /**\n         * The meta-property for the {@code intArray2d} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<int[][]> intArray2d() {\n            return intArray2d;\n        }\n\n        /**\n         * The meta-property for the {@code booleanArray2d} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<boolean[][]> booleanArray2d() {\n            return booleanArray2d;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 537167786:  // intArray\n                    return ((ImmArrays) bean).getIntArray();\n                case 100362557:  // longArray\n                    return ((ImmArrays) bean).getLongArray();\n                case -1645494008:  // doubleArray\n                    return ((ImmArrays) bean).getDoubleArray();\n                case -1066176751:  // booleanArray\n                    return ((ImmArrays) bean).getBooleanArray();\n                case 822168476:  // intArray2d\n                    return ((ImmArrays) bean).getIntArray2d();\n                case 1901327683:  // booleanArray2d\n                    return ((ImmArrays) bean).getBooleanArray2d();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmArrays}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmArrays> {\n\n        private int[] intArray;\n        private long[] longArray;\n        private double[] doubleArray;\n        private boolean[] booleanArray;\n        private int[][] intArray2d;\n        private boolean[][] booleanArray2d;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmArrays beanToCopy) {\n            this.intArray = (beanToCopy.getIntArray() != null ? beanToCopy.getIntArray().clone() : null);\n            this.longArray = (beanToCopy.getLongArray() != null ? beanToCopy.getLongArray().clone() : null);\n            this.doubleArray = (beanToCopy.getDoubleArray() != null ? beanToCopy.getDoubleArray().clone() : null);\n            this.booleanArray = (beanToCopy.getBooleanArray() != null ? beanToCopy.getBooleanArray().clone() : null);\n            this.intArray2d = (int[][]) JodaBeanUtils.cloneArray(beanToCopy.getIntArray2d());\n            this.booleanArray2d = (boolean[][]) JodaBeanUtils.cloneArray(beanToCopy.getBooleanArray2d());\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 537167786:  // intArray\n                    return this.intArray;\n                case 100362557:  // longArray\n                    return this.longArray;\n                case -1645494008:  // doubleArray\n                    return this.doubleArray;\n                case -1066176751:  // booleanArray\n                    return this.booleanArray;\n                case 822168476:  // intArray2d\n                    return this.intArray2d;\n                case 1901327683:  // booleanArray2d\n                    return this.booleanArray2d;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 537167786:  // intArray\n                    this.intArray = (int[]) newValue;\n                    break;\n                case 100362557:  // longArray\n                    this.longArray = (long[]) newValue;\n                    break;\n                case -1645494008:  // doubleArray\n                    this.doubleArray = (double[]) newValue;\n                    break;\n                case -1066176751:  // booleanArray\n                    this.booleanArray = (boolean[]) newValue;\n                    break;\n                case 822168476:  // intArray2d\n                    this.intArray2d = (int[][]) newValue;\n                    break;\n                case 1901327683:  // booleanArray2d\n                    this.booleanArray2d = (boolean[][]) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmArrays build() {\n            return new ImmArrays(\n                    intArray,\n                    longArray,\n                    doubleArray,\n                    booleanArray,\n                    intArray2d,\n                    booleanArray2d);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the intArray.\n         * @param intArray  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder intArray(int... intArray) {\n            this.intArray = intArray;\n            return this;\n        }\n\n        /**\n         * Sets the longArray.\n         * @param longArray  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder longArray(long... longArray) {\n            this.longArray = longArray;\n            return this;\n        }\n\n        /**\n         * Sets the doubleArray.\n         * @param doubleArray  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder doubleArray(double... doubleArray) {\n            this.doubleArray = doubleArray;\n            return this;\n        }\n\n        /**\n         * Sets the booleanArray.\n         * @param booleanArray  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder booleanArray(boolean... booleanArray) {\n            this.booleanArray = booleanArray;\n            return this;\n        }\n\n        /**\n         * Sets the intArray2d.\n         * @param intArray2d  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder intArray2d(int[][] intArray2d) {\n            this.intArray2d = intArray2d;\n            return this;\n        }\n\n        /**\n         * Sets the booleanArray2d.\n         * @param booleanArray2d  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder booleanArray2d(boolean[][] booleanArray2d) {\n            this.booleanArray2d = booleanArray2d;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(224);\n            buf.append(\"ImmArrays.Builder{\");\n            buf.append(\"intArray\").append('=').append(JodaBeanUtils.toString(intArray)).append(',').append(' ');\n            buf.append(\"longArray\").append('=').append(JodaBeanUtils.toString(longArray)).append(',').append(' ');\n            buf.append(\"doubleArray\").append('=').append(JodaBeanUtils.toString(doubleArray)).append(',').append(' ');\n            buf.append(\"booleanArray\").append('=').append(JodaBeanUtils.toString(booleanArray)).append(',').append(' ');\n            buf.append(\"intArray2d\").append('=').append(JodaBeanUtils.toString(intArray2d)).append(',').append(' ');\n            buf.append(\"booleanArray2d\").append('=').append(JodaBeanUtils.toString(booleanArray2d));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmClone.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.Date;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock immutable bean to test cloning.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic final class ImmClone implements ImmutableBean, Serializable{\n    // NOTE: no space between Serializable and {\n\n    // clone non-null\n    @PropertyDefinition(validate = \"notNull\")\n    private final Date date;\n    @PropertyDefinition(validate = \"notNull\")\n    private final String[] array1;\n    @PropertyDefinition(validate = \"notNull\", get = \"clone\")\n    private final String[] array2;\n    @PropertyDefinition(validate = \"notNull\", get = \"cloneCast\")\n    private final String[] array3;\n    // clone nuallable\n    @PropertyDefinition()\n    private final Date dateNullable;\n    @PropertyDefinition()\n    private final String[] array1Nullable;\n    @PropertyDefinition(get = \"cloneCast\")\n    private final String[] array2Nullable;\n    @PropertyDefinition(get = \"clone\")\n    private final String[] array3Nullable;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmClone}.\n     * @return the meta-bean, not null\n     */\n    public static ImmClone.Meta meta() {\n        return ImmClone.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmClone.Meta.INSTANCE);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmClone.Builder builder() {\n        return new ImmClone.Builder();\n    }\n\n    private ImmClone(\n            Date date,\n            String[] array1,\n            String[] array2,\n            String[] array3,\n            Date dateNullable,\n            String[] array1Nullable,\n            String[] array2Nullable,\n            String[] array3Nullable) {\n        JodaBeanUtils.notNull(date, \"date\");\n        JodaBeanUtils.notNull(array1, \"array1\");\n        JodaBeanUtils.notNull(array2, \"array2\");\n        JodaBeanUtils.notNull(array3, \"array3\");\n        this.date = (Date) date.clone();\n        this.array1 = array1.clone();\n        this.array2 = array2.clone();\n        this.array3 = array3.clone();\n        this.dateNullable = (dateNullable != null ? (Date) dateNullable.clone() : null);\n        this.array1Nullable = (array1Nullable != null ? array1Nullable.clone() : null);\n        this.array2Nullable = (array2Nullable != null ? array2Nullable.clone() : null);\n        this.array3Nullable = (array3Nullable != null ? array3Nullable.clone() : null);\n    }\n\n    @Override\n    public ImmClone.Meta metaBean() {\n        return ImmClone.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the date.\n     * @return the value of the property, not null\n     */\n    public Date getDate() {\n        return (Date) date.clone();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the array1.\n     * @return the value of the property, not null\n     */\n    public String[] getArray1() {\n        return array1.clone();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the array2.\n     * @return the value of the property, not null\n     */\n    public String[] getArray2() {\n        return array2.clone();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the array3.\n     * @return the value of the property, not null\n     */\n    public String[] getArray3() {\n        return (String[]) array3.clone();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the dateNullable.\n     * @return the value of the property\n     */\n    public Date getDateNullable() {\n        return (dateNullable != null ? (Date) dateNullable.clone() : null);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the array1Nullable.\n     * @return the value of the property\n     */\n    public String[] getArray1Nullable() {\n        return (array1Nullable != null ? array1Nullable.clone() : null);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the array2Nullable.\n     * @return the value of the property\n     */\n    public String[] getArray2Nullable() {\n        return (array2Nullable != null ? (String[]) array2Nullable.clone() : null);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the array3Nullable.\n     * @return the value of the property\n     */\n    public String[] getArray3Nullable() {\n        return (array3Nullable != null ? array3Nullable.clone() : null);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmClone other = (ImmClone) obj;\n            return JodaBeanUtils.equal(this.date, other.date) &&\n                    JodaBeanUtils.equal(this.array1, other.array1) &&\n                    JodaBeanUtils.equal(this.array2, other.array2) &&\n                    JodaBeanUtils.equal(this.array3, other.array3) &&\n                    JodaBeanUtils.equal(this.dateNullable, other.dateNullable) &&\n                    JodaBeanUtils.equal(this.array1Nullable, other.array1Nullable) &&\n                    JodaBeanUtils.equal(this.array2Nullable, other.array2Nullable) &&\n                    JodaBeanUtils.equal(this.array3Nullable, other.array3Nullable);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(date);\n        hash = hash * 31 + JodaBeanUtils.hashCode(array1);\n        hash = hash * 31 + JodaBeanUtils.hashCode(array2);\n        hash = hash * 31 + JodaBeanUtils.hashCode(array3);\n        hash = hash * 31 + JodaBeanUtils.hashCode(dateNullable);\n        hash = hash * 31 + JodaBeanUtils.hashCode(array1Nullable);\n        hash = hash * 31 + JodaBeanUtils.hashCode(array2Nullable);\n        hash = hash * 31 + JodaBeanUtils.hashCode(array3Nullable);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(288);\n        buf.append(\"ImmClone{\");\n        buf.append(\"date\").append('=').append(JodaBeanUtils.toString(date)).append(',').append(' ');\n        buf.append(\"array1\").append('=').append(JodaBeanUtils.toString(array1)).append(',').append(' ');\n        buf.append(\"array2\").append('=').append(JodaBeanUtils.toString(array2)).append(',').append(' ');\n        buf.append(\"array3\").append('=').append(JodaBeanUtils.toString(array3)).append(',').append(' ');\n        buf.append(\"dateNullable\").append('=').append(JodaBeanUtils.toString(dateNullable)).append(',').append(' ');\n        buf.append(\"array1Nullable\").append('=').append(JodaBeanUtils.toString(array1Nullable)).append(',').append(' ');\n        buf.append(\"array2Nullable\").append('=').append(JodaBeanUtils.toString(array2Nullable)).append(',').append(' ');\n        buf.append(\"array3Nullable\").append('=').append(JodaBeanUtils.toString(array3Nullable));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmClone}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code date} property.\n         */\n        private final MetaProperty<Date> date = DirectMetaProperty.ofImmutable(\n                this, \"date\", ImmClone.class, Date.class);\n        /**\n         * The meta-property for the {@code array1} property.\n         */\n        private final MetaProperty<String[]> array1 = DirectMetaProperty.ofImmutable(\n                this, \"array1\", ImmClone.class, String[].class);\n        /**\n         * The meta-property for the {@code array2} property.\n         */\n        private final MetaProperty<String[]> array2 = DirectMetaProperty.ofImmutable(\n                this, \"array2\", ImmClone.class, String[].class);\n        /**\n         * The meta-property for the {@code array3} property.\n         */\n        private final MetaProperty<String[]> array3 = DirectMetaProperty.ofImmutable(\n                this, \"array3\", ImmClone.class, String[].class);\n        /**\n         * The meta-property for the {@code dateNullable} property.\n         */\n        private final MetaProperty<Date> dateNullable = DirectMetaProperty.ofImmutable(\n                this, \"dateNullable\", ImmClone.class, Date.class);\n        /**\n         * The meta-property for the {@code array1Nullable} property.\n         */\n        private final MetaProperty<String[]> array1Nullable = DirectMetaProperty.ofImmutable(\n                this, \"array1Nullable\", ImmClone.class, String[].class);\n        /**\n         * The meta-property for the {@code array2Nullable} property.\n         */\n        private final MetaProperty<String[]> array2Nullable = DirectMetaProperty.ofImmutable(\n                this, \"array2Nullable\", ImmClone.class, String[].class);\n        /**\n         * The meta-property for the {@code array3Nullable} property.\n         */\n        private final MetaProperty<String[]> array3Nullable = DirectMetaProperty.ofImmutable(\n                this, \"array3Nullable\", ImmClone.class, String[].class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"date\",\n                \"array1\",\n                \"array2\",\n                \"array3\",\n                \"dateNullable\",\n                \"array1Nullable\",\n                \"array2Nullable\",\n                \"array3Nullable\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3076014:  // date\n                    return this.date;\n                case -1409165064:  // array1\n                    return this.array1;\n                case -1409165063:  // array2\n                    return this.array2;\n                case -1409165062:  // array3\n                    return this.array3;\n                case 781387055:  // dateNullable\n                    return this.dateNullable;\n                case 221578361:  // array1Nullable\n                    return this.array1Nullable;\n                case -1585876102:  // array2Nullable\n                    return this.array2Nullable;\n                case 901636731:  // array3Nullable\n                    return this.array3Nullable;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmClone.Builder builder() {\n            return new ImmClone.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmClone> beanType() {\n            return ImmClone.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code date} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Date> date() {\n            return date;\n        }\n\n        /**\n         * The meta-property for the {@code array1} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String[]> array1() {\n            return array1;\n        }\n\n        /**\n         * The meta-property for the {@code array2} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String[]> array2() {\n            return array2;\n        }\n\n        /**\n         * The meta-property for the {@code array3} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String[]> array3() {\n            return array3;\n        }\n\n        /**\n         * The meta-property for the {@code dateNullable} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Date> dateNullable() {\n            return dateNullable;\n        }\n\n        /**\n         * The meta-property for the {@code array1Nullable} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String[]> array1Nullable() {\n            return array1Nullable;\n        }\n\n        /**\n         * The meta-property for the {@code array2Nullable} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String[]> array2Nullable() {\n            return array2Nullable;\n        }\n\n        /**\n         * The meta-property for the {@code array3Nullable} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String[]> array3Nullable() {\n            return array3Nullable;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3076014:  // date\n                    return ((ImmClone) bean).getDate();\n                case -1409165064:  // array1\n                    return ((ImmClone) bean).getArray1();\n                case -1409165063:  // array2\n                    return ((ImmClone) bean).getArray2();\n                case -1409165062:  // array3\n                    return ((ImmClone) bean).getArray3();\n                case 781387055:  // dateNullable\n                    return ((ImmClone) bean).getDateNullable();\n                case 221578361:  // array1Nullable\n                    return ((ImmClone) bean).getArray1Nullable();\n                case -1585876102:  // array2Nullable\n                    return ((ImmClone) bean).getArray2Nullable();\n                case 901636731:  // array3Nullable\n                    return ((ImmClone) bean).getArray3Nullable();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmClone}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmClone> {\n\n        private Date date;\n        private String[] array1;\n        private String[] array2;\n        private String[] array3;\n        private Date dateNullable;\n        private String[] array1Nullable;\n        private String[] array2Nullable;\n        private String[] array3Nullable;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmClone beanToCopy) {\n            this.date = (Date) beanToCopy.getDate().clone();\n            this.array1 = beanToCopy.getArray1().clone();\n            this.array2 = beanToCopy.getArray2().clone();\n            this.array3 = beanToCopy.getArray3().clone();\n            this.dateNullable = (beanToCopy.getDateNullable() != null ? (Date) beanToCopy.getDateNullable().clone() : null);\n            this.array1Nullable = (beanToCopy.getArray1Nullable() != null ? beanToCopy.getArray1Nullable().clone() : null);\n            this.array2Nullable = (beanToCopy.getArray2Nullable() != null ? beanToCopy.getArray2Nullable().clone() : null);\n            this.array3Nullable = (beanToCopy.getArray3Nullable() != null ? beanToCopy.getArray3Nullable().clone() : null);\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3076014:  // date\n                    return this.date;\n                case -1409165064:  // array1\n                    return this.array1;\n                case -1409165063:  // array2\n                    return this.array2;\n                case -1409165062:  // array3\n                    return this.array3;\n                case 781387055:  // dateNullable\n                    return this.dateNullable;\n                case 221578361:  // array1Nullable\n                    return this.array1Nullable;\n                case -1585876102:  // array2Nullable\n                    return this.array2Nullable;\n                case 901636731:  // array3Nullable\n                    return this.array3Nullable;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 3076014:  // date\n                    this.date = (Date) newValue;\n                    break;\n                case -1409165064:  // array1\n                    this.array1 = (String[]) newValue;\n                    break;\n                case -1409165063:  // array2\n                    this.array2 = (String[]) newValue;\n                    break;\n                case -1409165062:  // array3\n                    this.array3 = (String[]) newValue;\n                    break;\n                case 781387055:  // dateNullable\n                    this.dateNullable = (Date) newValue;\n                    break;\n                case 221578361:  // array1Nullable\n                    this.array1Nullable = (String[]) newValue;\n                    break;\n                case -1585876102:  // array2Nullable\n                    this.array2Nullable = (String[]) newValue;\n                    break;\n                case 901636731:  // array3Nullable\n                    this.array3Nullable = (String[]) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmClone build() {\n            return new ImmClone(\n                    date,\n                    array1,\n                    array2,\n                    array3,\n                    dateNullable,\n                    array1Nullable,\n                    array2Nullable,\n                    array3Nullable);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the date.\n         * @param date  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder date(Date date) {\n            JodaBeanUtils.notNull(date, \"date\");\n            this.date = date;\n            return this;\n        }\n\n        /**\n         * Sets the array1.\n         * @param array1  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder array1(String... array1) {\n            JodaBeanUtils.notNull(array1, \"array1\");\n            this.array1 = array1;\n            return this;\n        }\n\n        /**\n         * Sets the array2.\n         * @param array2  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder array2(String... array2) {\n            JodaBeanUtils.notNull(array2, \"array2\");\n            this.array2 = array2;\n            return this;\n        }\n\n        /**\n         * Sets the array3.\n         * @param array3  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder array3(String... array3) {\n            JodaBeanUtils.notNull(array3, \"array3\");\n            this.array3 = array3;\n            return this;\n        }\n\n        /**\n         * Sets the dateNullable.\n         * @param dateNullable  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder dateNullable(Date dateNullable) {\n            this.dateNullable = dateNullable;\n            return this;\n        }\n\n        /**\n         * Sets the array1Nullable.\n         * @param array1Nullable  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder array1Nullable(String... array1Nullable) {\n            this.array1Nullable = array1Nullable;\n            return this;\n        }\n\n        /**\n         * Sets the array2Nullable.\n         * @param array2Nullable  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder array2Nullable(String... array2Nullable) {\n            this.array2Nullable = array2Nullable;\n            return this;\n        }\n\n        /**\n         * Sets the array3Nullable.\n         * @param array3Nullable  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder array3Nullable(String... array3Nullable) {\n            this.array3Nullable = array3Nullable;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(288);\n            buf.append(\"ImmClone.Builder{\");\n            buf.append(\"date\").append('=').append(JodaBeanUtils.toString(date)).append(',').append(' ');\n            buf.append(\"array1\").append('=').append(JodaBeanUtils.toString(array1)).append(',').append(' ');\n            buf.append(\"array2\").append('=').append(JodaBeanUtils.toString(array2)).append(',').append(' ');\n            buf.append(\"array3\").append('=').append(JodaBeanUtils.toString(array3)).append(',').append(' ');\n            buf.append(\"dateNullable\").append('=').append(JodaBeanUtils.toString(dateNullable)).append(',').append(' ');\n            buf.append(\"array1Nullable\").append('=').append(JodaBeanUtils.toString(array1Nullable)).append(',').append(' ');\n            buf.append(\"array2Nullable\").append('=').append(JodaBeanUtils.toString(array2Nullable)).append(',').append(' ');\n            buf.append(\"array3Nullable\").append('=').append(JodaBeanUtils.toString(array3Nullable));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmComplexAnnotation.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n* Mock bean for complex annotation testing.\n*/\n@BeanDefinition(cacheHashCode = true, factoryName = \"create\")\n@ClassAnnotation(ImmComplexAnnotation.class)\n@ComplexAnnotation({\n    @SimpleAnnotation(first = \"1\", second = \"2\", third = \"3\"),\n    @SimpleAnnotation(first = \"1\", second = \"2\", third = \"3\")\n}) \npublic final class ImmComplexAnnotation\n      implements ImmutableBean,\n      Cloneable,\n      Serializable {\n\n    @PropertyDefinition\n    private final double value;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmComplexAnnotation}.\n     * @return the meta-bean, not null\n     */\n    public static ImmComplexAnnotation.Meta meta() {\n        return ImmComplexAnnotation.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmComplexAnnotation.Meta.INSTANCE);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * The cached hash code, using the racy single-check idiom.\n     */\n    private transient int cacheHashCode;\n\n    /**\n     * Obtains an instance.\n     * @param value  the value of the property\n     * @return the instance\n     */\n    public static ImmComplexAnnotation create(\n            double value) {\n        return new ImmComplexAnnotation(\n            value);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmComplexAnnotation.Builder builder() {\n        return new ImmComplexAnnotation.Builder();\n    }\n\n    private ImmComplexAnnotation(\n            double value) {\n        this.value = value;\n    }\n\n    @Override\n    public ImmComplexAnnotation.Meta metaBean() {\n        return ImmComplexAnnotation.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the value.\n     * @return the value of the property\n     */\n    public double getValue() {\n        return value;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmComplexAnnotation other = (ImmComplexAnnotation) obj;\n            return JodaBeanUtils.equal(this.value, other.value);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = cacheHashCode;\n        if (hash == 0) {\n            hash = getClass().hashCode();\n            hash = hash * 31 + JodaBeanUtils.hashCode(value);\n            cacheHashCode = hash;\n        }\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmComplexAnnotation{\");\n        buf.append(\"value\").append('=').append(JodaBeanUtils.toString(value));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmComplexAnnotation}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code value} property.\n         */\n        private final MetaProperty<Double> value = DirectMetaProperty.ofImmutable(\n                this, \"value\", ImmComplexAnnotation.class, Double.TYPE);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"value\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmComplexAnnotation.Builder builder() {\n            return new ImmComplexAnnotation.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmComplexAnnotation> beanType() {\n            return ImmComplexAnnotation.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code value} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Double> value() {\n            return value;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return ((ImmComplexAnnotation) bean).getValue();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmComplexAnnotation}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmComplexAnnotation> {\n\n        private double value;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmComplexAnnotation beanToCopy) {\n            this.value = beanToCopy.getValue();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    this.value = (Double) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmComplexAnnotation build() {\n            return new ImmComplexAnnotation(\n                    value);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the value.\n         * @param value  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder value(double value) {\n            this.value = value;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmComplexAnnotation.Builder{\");\n            buf.append(\"value\").append('=').append(JodaBeanUtils.toString(value));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmDefault.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.ImmutableDefaults;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Wraps a defaulted value, used for testing.\n */\n@BeanDefinition(factoryName = \"of\")\npublic final class ImmDefault implements ImmutableBean {\n    \n    /**\n     * The value.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final String value;\n    \n    @ImmutableDefaults\n    private static void applyDefaults(Builder builder) {\n        builder.value = \"Defaulted\";\n    }\n    \n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmDefault}.\n     * @return the meta-bean, not null\n     */\n    public static ImmDefault.Meta meta() {\n        return ImmDefault.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmDefault.Meta.INSTANCE);\n    }\n\n    /**\n     * Obtains an instance.\n     * @param value  the value of the property, not null\n     * @return the instance\n     */\n    public static ImmDefault of(\n            String value) {\n        return new ImmDefault(\n            value);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmDefault.Builder builder() {\n        return new ImmDefault.Builder();\n    }\n\n    private ImmDefault(\n            String value) {\n        JodaBeanUtils.notNull(value, \"value\");\n        this.value = value;\n    }\n\n    @Override\n    public ImmDefault.Meta metaBean() {\n        return ImmDefault.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the value.\n     * @return the value of the property, not null\n     */\n    public String getValue() {\n        return value;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmDefault other = (ImmDefault) obj;\n            return JodaBeanUtils.equal(this.value, other.value);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(value);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmDefault{\");\n        buf.append(\"value\").append('=').append(JodaBeanUtils.toString(value));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmDefault}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code value} property.\n         */\n        private final MetaProperty<String> value = DirectMetaProperty.ofImmutable(\n                this, \"value\", ImmDefault.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"value\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmDefault.Builder builder() {\n            return new ImmDefault.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmDefault> beanType() {\n            return ImmDefault.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code value} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> value() {\n            return value;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return ((ImmDefault) bean).getValue();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmDefault}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmDefault> {\n\n        private String value;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n            applyDefaults(this);\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmDefault beanToCopy) {\n            this.value = beanToCopy.getValue();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    this.value = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmDefault build() {\n            return new ImmDefault(\n                    value);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the value.\n         * @param value  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder value(String value) {\n            JodaBeanUtils.notNull(value, \"value\");\n            this.value = value;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmDefault.Builder{\");\n            buf.append(\"value\").append('=').append(JodaBeanUtils.toString(value));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmDeprecated.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\nimport java.util.Optional;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock person JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic final class ImmDeprecated implements Cloneable, ImmutableBean {\n\n    /**\n     * The field with deprecated annotation and Javadoc tag.\n     * @deprecated Use something else\n     */\n    @Deprecated\n    @PropertyDefinition\n    private final String deprecatedBoth;\n\n    /**\n     * The field with deprecated Javadoc tag only.\n     * @deprecated Use something else\n     */\n    @PropertyDefinition\n    private final String deprecatedJavadoc;\n\n    @Deprecated\n    @PropertyDefinition\n    private final String deprecatedAnnotation;\n\n    @Deprecated\n    @PropertyDefinition(get = \"optional\")\n    private final String deprecatedOptional;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmDeprecated}.\n     * @return the meta-bean, not null\n     */\n    public static ImmDeprecated.Meta meta() {\n        return ImmDeprecated.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmDeprecated.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmDeprecated.Builder builder() {\n        return new ImmDeprecated.Builder();\n    }\n\n    private ImmDeprecated(\n            String deprecatedBoth,\n            String deprecatedJavadoc,\n            String deprecatedAnnotation,\n            String deprecatedOptional) {\n        this.deprecatedBoth = deprecatedBoth;\n        this.deprecatedJavadoc = deprecatedJavadoc;\n        this.deprecatedAnnotation = deprecatedAnnotation;\n        this.deprecatedOptional = deprecatedOptional;\n    }\n\n    @Override\n    public ImmDeprecated.Meta metaBean() {\n        return ImmDeprecated.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the field with deprecated annotation and Javadoc tag.\n     * @return the value of the property\n     * @deprecated Use something else\n     */\n    @Deprecated\n    public String getDeprecatedBoth() {\n        return deprecatedBoth;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the field with deprecated Javadoc tag only.\n     * @return the value of the property\n     * @deprecated Use something else\n     */\n    @Deprecated\n    public String getDeprecatedJavadoc() {\n        return deprecatedJavadoc;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the deprecatedAnnotation.\n     * @return the value of the property\n     * @deprecated Deprecated\n     */\n    @Deprecated\n    public String getDeprecatedAnnotation() {\n        return deprecatedAnnotation;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the deprecatedOptional.\n     * @return the optional value of the property, not null\n     * @deprecated Deprecated\n     */\n    @Deprecated\n    public Optional<String> getDeprecatedOptional() {\n        return Optional.ofNullable(deprecatedOptional);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmDeprecated other = (ImmDeprecated) obj;\n            return JodaBeanUtils.equal(this.deprecatedBoth, other.deprecatedBoth) &&\n                    JodaBeanUtils.equal(this.deprecatedJavadoc, other.deprecatedJavadoc) &&\n                    JodaBeanUtils.equal(this.deprecatedAnnotation, other.deprecatedAnnotation) &&\n                    JodaBeanUtils.equal(this.deprecatedOptional, other.deprecatedOptional);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(deprecatedBoth);\n        hash = hash * 31 + JodaBeanUtils.hashCode(deprecatedJavadoc);\n        hash = hash * 31 + JodaBeanUtils.hashCode(deprecatedAnnotation);\n        hash = hash * 31 + JodaBeanUtils.hashCode(deprecatedOptional);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(160);\n        buf.append(\"ImmDeprecated{\");\n        buf.append(\"deprecatedBoth\").append('=').append(JodaBeanUtils.toString(deprecatedBoth)).append(',').append(' ');\n        buf.append(\"deprecatedJavadoc\").append('=').append(JodaBeanUtils.toString(deprecatedJavadoc)).append(',').append(' ');\n        buf.append(\"deprecatedAnnotation\").append('=').append(JodaBeanUtils.toString(deprecatedAnnotation)).append(',').append(' ');\n        buf.append(\"deprecatedOptional\").append('=').append(JodaBeanUtils.toString(deprecatedOptional));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmDeprecated}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code deprecatedBoth} property.\n         */\n        private final MetaProperty<String> deprecatedBoth = DirectMetaProperty.ofImmutable(\n                this, \"deprecatedBoth\", ImmDeprecated.class, String.class);\n        /**\n         * The meta-property for the {@code deprecatedJavadoc} property.\n         */\n        private final MetaProperty<String> deprecatedJavadoc = DirectMetaProperty.ofImmutable(\n                this, \"deprecatedJavadoc\", ImmDeprecated.class, String.class);\n        /**\n         * The meta-property for the {@code deprecatedAnnotation} property.\n         */\n        private final MetaProperty<String> deprecatedAnnotation = DirectMetaProperty.ofImmutable(\n                this, \"deprecatedAnnotation\", ImmDeprecated.class, String.class);\n        /**\n         * The meta-property for the {@code deprecatedOptional} property.\n         */\n        private final MetaProperty<String> deprecatedOptional = DirectMetaProperty.ofImmutable(\n                this, \"deprecatedOptional\", ImmDeprecated.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"deprecatedBoth\",\n                \"deprecatedJavadoc\",\n                \"deprecatedAnnotation\",\n                \"deprecatedOptional\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1108081708:  // deprecatedBoth\n                    return this.deprecatedBoth;\n                case -1632501085:  // deprecatedJavadoc\n                    return this.deprecatedJavadoc;\n                case 1044703554:  // deprecatedAnnotation\n                    return this.deprecatedAnnotation;\n                case 1434300979:  // deprecatedOptional\n                    return this.deprecatedOptional;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmDeprecated.Builder builder() {\n            return new ImmDeprecated.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmDeprecated> beanType() {\n            return ImmDeprecated.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code deprecatedBoth} property.\n         * @return the meta-property, not null\n         * @deprecated Use something else\n         */\n        @Deprecated\n        public MetaProperty<String> deprecatedBoth() {\n            return deprecatedBoth;\n        }\n\n        /**\n         * The meta-property for the {@code deprecatedJavadoc} property.\n         * @return the meta-property, not null\n         * @deprecated Use something else\n         */\n        @Deprecated\n        public MetaProperty<String> deprecatedJavadoc() {\n            return deprecatedJavadoc;\n        }\n\n        /**\n         * The meta-property for the {@code deprecatedAnnotation} property.\n         * @return the meta-property, not null\n         * @deprecated Deprecated\n         */\n        @Deprecated\n        public MetaProperty<String> deprecatedAnnotation() {\n            return deprecatedAnnotation;\n        }\n\n        /**\n         * The meta-property for the {@code deprecatedOptional} property.\n         * @return the meta-property, not null\n         * @deprecated Deprecated\n         */\n        @Deprecated\n        public MetaProperty<String> deprecatedOptional() {\n            return deprecatedOptional;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1108081708:  // deprecatedBoth\n                    return ((ImmDeprecated) bean).getDeprecatedBoth();\n                case -1632501085:  // deprecatedJavadoc\n                    return ((ImmDeprecated) bean).getDeprecatedJavadoc();\n                case 1044703554:  // deprecatedAnnotation\n                    return ((ImmDeprecated) bean).getDeprecatedAnnotation();\n                case 1434300979:  // deprecatedOptional\n                    return ((ImmDeprecated) bean).deprecatedOptional;\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmDeprecated}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmDeprecated> {\n\n        private String deprecatedBoth;\n        private String deprecatedJavadoc;\n        private String deprecatedAnnotation;\n        private String deprecatedOptional;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmDeprecated beanToCopy) {\n            this.deprecatedBoth = beanToCopy.getDeprecatedBoth();\n            this.deprecatedJavadoc = beanToCopy.getDeprecatedJavadoc();\n            this.deprecatedAnnotation = beanToCopy.getDeprecatedAnnotation();\n            this.deprecatedOptional = beanToCopy.deprecatedOptional;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1108081708:  // deprecatedBoth\n                    return this.deprecatedBoth;\n                case -1632501085:  // deprecatedJavadoc\n                    return this.deprecatedJavadoc;\n                case 1044703554:  // deprecatedAnnotation\n                    return this.deprecatedAnnotation;\n                case 1434300979:  // deprecatedOptional\n                    return this.deprecatedOptional;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -1108081708:  // deprecatedBoth\n                    this.deprecatedBoth = (String) newValue;\n                    break;\n                case -1632501085:  // deprecatedJavadoc\n                    this.deprecatedJavadoc = (String) newValue;\n                    break;\n                case 1044703554:  // deprecatedAnnotation\n                    this.deprecatedAnnotation = (String) newValue;\n                    break;\n                case 1434300979:  // deprecatedOptional\n                    this.deprecatedOptional = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmDeprecated build() {\n            return new ImmDeprecated(\n                    deprecatedBoth,\n                    deprecatedJavadoc,\n                    deprecatedAnnotation,\n                    deprecatedOptional);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the field with deprecated annotation and Javadoc tag.\n         * @param deprecatedBoth  the new value\n         * @return this, for chaining, not null\n         * @deprecated Use something else\n         */\n        @Deprecated\n        public Builder deprecatedBoth(String deprecatedBoth) {\n            this.deprecatedBoth = deprecatedBoth;\n            return this;\n        }\n\n        /**\n         * Sets the field with deprecated Javadoc tag only.\n         * @param deprecatedJavadoc  the new value\n         * @return this, for chaining, not null\n         * @deprecated Use something else\n         */\n        @Deprecated\n        public Builder deprecatedJavadoc(String deprecatedJavadoc) {\n            this.deprecatedJavadoc = deprecatedJavadoc;\n            return this;\n        }\n\n        /**\n         * Sets the deprecatedAnnotation.\n         * @param deprecatedAnnotation  the new value\n         * @return this, for chaining, not null\n         * @deprecated Deprecated\n         */\n        @Deprecated\n        public Builder deprecatedAnnotation(String deprecatedAnnotation) {\n            this.deprecatedAnnotation = deprecatedAnnotation;\n            return this;\n        }\n\n        /**\n         * Sets the deprecatedOptional.\n         * @param deprecatedOptional  the new value\n         * @return this, for chaining, not null\n         * @deprecated Deprecated\n         */\n        @Deprecated\n        public Builder deprecatedOptional(String deprecatedOptional) {\n            this.deprecatedOptional = deprecatedOptional;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(160);\n            buf.append(\"ImmDeprecated.Builder{\");\n            buf.append(\"deprecatedBoth\").append('=').append(JodaBeanUtils.toString(deprecatedBoth)).append(',').append(' ');\n            buf.append(\"deprecatedJavadoc\").append('=').append(JodaBeanUtils.toString(deprecatedJavadoc)).append(',').append(' ');\n            buf.append(\"deprecatedAnnotation\").append('=').append(JodaBeanUtils.toString(deprecatedAnnotation)).append(',').append(' ');\n            buf.append(\"deprecatedOptional\").append('=').append(JodaBeanUtils.toString(deprecatedOptional));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmDocumentationHolder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.ImmutableConstructor;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * This tests a generic ? property with a manual argument constructor.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic final class ImmDocumentationHolder<T>\n        implements ImmutableBean, Serializable {\n\n    /** Serialization. */\n    private static final long serialVersionUID = 1L;\n\n    /** The documentation. */\n    @PropertyDefinition\n    private final Documentation<T> documentation;\n\n    @ImmutableConstructor\n    private ImmDocumentationHolder(\n            Documentation<T> documentation) {\n        this.documentation = documentation;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmDocumentationHolder}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static ImmDocumentationHolder.Meta meta() {\n        return ImmDocumentationHolder.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code ImmDocumentationHolder}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R> ImmDocumentationHolder.Meta<R> metaImmDocumentationHolder(Class<R> cls) {\n        return ImmDocumentationHolder.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmDocumentationHolder.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @param <T>  the type\n     * @return the builder, not null\n     */\n    public static <T> ImmDocumentationHolder.Builder<T> builder() {\n        return new ImmDocumentationHolder.Builder<>();\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public ImmDocumentationHolder.Meta<T> metaBean() {\n        return ImmDocumentationHolder.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the documentation.\n     * @return the value of the property\n     */\n    public Documentation<T> getDocumentation() {\n        return documentation;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder<T> toBuilder() {\n        return new Builder<>(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmDocumentationHolder<?> other = (ImmDocumentationHolder<?>) obj;\n            return JodaBeanUtils.equal(this.documentation, other.documentation);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(documentation);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmDocumentationHolder{\");\n        buf.append(\"documentation\").append('=').append(JodaBeanUtils.toString(documentation));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmDocumentationHolder}.\n     * @param <T>  the type\n     */\n    public static final class Meta<T> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code documentation} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Documentation<T>> documentation = DirectMetaProperty.ofImmutable(\n                this, \"documentation\", ImmDocumentationHolder.class, (Class) Documentation.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"documentation\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 1587405498:  // documentation\n                    return this.documentation;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmDocumentationHolder.Builder<T> builder() {\n            return new ImmDocumentationHolder.Builder<>();\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends ImmDocumentationHolder<T>> beanType() {\n            return (Class) ImmDocumentationHolder.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code documentation} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Documentation<T>> documentation() {\n            return documentation;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 1587405498:  // documentation\n                    return ((ImmDocumentationHolder<?>) bean).getDocumentation();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmDocumentationHolder}.\n     * @param <T>  the type\n     */\n    public static final class Builder<T> extends DirectFieldsBeanBuilder<ImmDocumentationHolder<T>> {\n\n        private Documentation<T> documentation;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmDocumentationHolder<T> beanToCopy) {\n            this.documentation = beanToCopy.getDocumentation();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 1587405498:  // documentation\n                    return this.documentation;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder<T> set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 1587405498:  // documentation\n                    this.documentation = (Documentation<T>) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder<T> set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmDocumentationHolder<T> build() {\n            return new ImmDocumentationHolder<>(\n                    documentation);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the documentation.\n         * @param documentation  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder<T> documentation(Documentation<T> documentation) {\n            this.documentation = documentation;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmDocumentationHolder.Builder{\");\n            buf.append(\"documentation\").append('=').append(JodaBeanUtils.toString(documentation));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmDocumentationResult.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.ImmutableConstructor;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * This tests a generic ? property with a manual builder constructor.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic final class ImmDocumentationResult<T> implements ImmutableBean {\n\n    /** The documentation. */\n    @PropertyDefinition(alias = \"underlying\")\n    private final Documentation<T> documentation;\n\n    @ImmutableConstructor\n    private ImmDocumentationResult(Builder<T> builder) {\n        this.documentation = builder.documentation;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmDocumentationResult}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static ImmDocumentationResult.Meta meta() {\n        return ImmDocumentationResult.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code ImmDocumentationResult}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R> ImmDocumentationResult.Meta<R> metaImmDocumentationResult(Class<R> cls) {\n        return ImmDocumentationResult.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmDocumentationResult.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @param <T>  the type\n     * @return the builder, not null\n     */\n    public static <T> ImmDocumentationResult.Builder<T> builder() {\n        return new ImmDocumentationResult.Builder<>();\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public ImmDocumentationResult.Meta<T> metaBean() {\n        return ImmDocumentationResult.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the documentation.\n     * @return the value of the property\n     */\n    public Documentation<T> getDocumentation() {\n        return documentation;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder<T> toBuilder() {\n        return new Builder<>(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmDocumentationResult<?> other = (ImmDocumentationResult<?>) obj;\n            return JodaBeanUtils.equal(this.documentation, other.documentation);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(documentation);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmDocumentationResult{\");\n        buf.append(\"documentation\").append('=').append(JodaBeanUtils.toString(documentation));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmDocumentationResult}.\n     * @param <T>  the type\n     */\n    public static final class Meta<T> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code documentation} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Documentation<T>> documentation = DirectMetaProperty.ofImmutable(\n                this, \"documentation\", ImmDocumentationResult.class, (Class) Documentation.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"documentation\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 1587405498:  // documentation\n                case -1770633379:  // underlying (alias)\n                    return this.documentation;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmDocumentationResult.Builder<T> builder() {\n            return new ImmDocumentationResult.Builder<>();\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends ImmDocumentationResult<T>> beanType() {\n            return (Class) ImmDocumentationResult.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code documentation} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Documentation<T>> documentation() {\n            return documentation;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 1587405498:  // documentation\n                case -1770633379:  // underlying (alias)\n                    return ((ImmDocumentationResult<?>) bean).getDocumentation();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmDocumentationResult}.\n     * @param <T>  the type\n     */\n    public static final class Builder<T> extends DirectFieldsBeanBuilder<ImmDocumentationResult<T>> {\n\n        private Documentation<T> documentation;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmDocumentationResult<T> beanToCopy) {\n            this.documentation = beanToCopy.getDocumentation();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 1587405498:  // documentation\n                case -1770633379:  // underlying (alias)\n                    return this.documentation;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder<T> set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 1587405498:  // documentation\n                case -1770633379:  // underlying (alias)\n                    this.documentation = (Documentation<T>) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder<T> set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmDocumentationResult<T> build() {\n            return new ImmDocumentationResult<>(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the documentation.\n         * @param documentation  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder<T> documentation(Documentation<T> documentation) {\n            this.documentation = documentation;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmDocumentationResult.Builder{\");\n            buf.append(\"documentation\").append('=').append(JodaBeanUtils.toString(documentation));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmDoubleArray.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\nimport org.joda.beans.impl.direct.DirectPrivateBeanBuilder;\n\n/**\n * Mock JavaBean, used for testing.\n */\n@BeanDefinition(builderScope = \"private\", factoryName = \"of\")\npublic final class ImmDoubleArray<T> implements Serializable, ImmutableBean {\n\n    /** The double values. */\n    @PropertyDefinition(validate = \"notNull\")\n    private final double[] values;\n\n    /** The second lot of values. */\n    @PropertyDefinition(validate = \"notNull\")\n    private final double[] values2;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmDoubleArray}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static ImmDoubleArray.Meta meta() {\n        return ImmDoubleArray.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code ImmDoubleArray}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R> ImmDoubleArray.Meta<R> metaImmDoubleArray(Class<R> cls) {\n        return ImmDoubleArray.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmDoubleArray.Meta.INSTANCE);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Obtains an instance.\n     * @param <T>  the type\n     * @param values  the value of the property, not null\n     * @param values2  the value of the property, not null\n     * @return the instance\n     */\n    public static <T> ImmDoubleArray<T> of(\n            double[] values,\n            double[] values2) {\n        return new ImmDoubleArray<>(\n            values,\n            values2);\n    }\n\n    private ImmDoubleArray(\n            double[] values,\n            double[] values2) {\n        JodaBeanUtils.notNull(values, \"values\");\n        JodaBeanUtils.notNull(values2, \"values2\");\n        this.values = values.clone();\n        this.values2 = values2.clone();\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public ImmDoubleArray.Meta<T> metaBean() {\n        return ImmDoubleArray.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the double values.\n     * @return the value of the property, not null\n     */\n    public double[] getValues() {\n        return values.clone();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the second lot of values.\n     * @return the value of the property, not null\n     */\n    public double[] getValues2() {\n        return values2.clone();\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmDoubleArray<?> other = (ImmDoubleArray<?>) obj;\n            return JodaBeanUtils.equal(this.values, other.values) &&\n                    JodaBeanUtils.equal(this.values2, other.values2);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(values);\n        hash = hash * 31 + JodaBeanUtils.hashCode(values2);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"ImmDoubleArray{\");\n        buf.append(\"values\").append('=').append(JodaBeanUtils.toString(values)).append(',').append(' ');\n        buf.append(\"values2\").append('=').append(JodaBeanUtils.toString(values2));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmDoubleArray}.\n     * @param <T>  the type\n     */\n    public static final class Meta<T> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code values} property.\n         */\n        private final MetaProperty<double[]> values = DirectMetaProperty.ofImmutable(\n                this, \"values\", ImmDoubleArray.class, double[].class);\n        /**\n         * The meta-property for the {@code values2} property.\n         */\n        private final MetaProperty<double[]> values2 = DirectMetaProperty.ofImmutable(\n                this, \"values2\", ImmDoubleArray.class, double[].class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"values\",\n                \"values2\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -823812830:  // values\n                    return this.values;\n                case 231606096:  // values2\n                    return this.values2;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends ImmDoubleArray<T>> builder() {\n            return new ImmDoubleArray.Builder<>();\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends ImmDoubleArray<T>> beanType() {\n            return (Class) ImmDoubleArray.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code values} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<double[]> values() {\n            return values;\n        }\n\n        /**\n         * The meta-property for the {@code values2} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<double[]> values2() {\n            return values2;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -823812830:  // values\n                    return ((ImmDoubleArray<?>) bean).getValues();\n                case 231606096:  // values2\n                    return ((ImmDoubleArray<?>) bean).getValues2();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmDoubleArray}.\n     * @param <T>  the type\n     */\n    private static final class Builder<T> extends DirectPrivateBeanBuilder<ImmDoubleArray<T>> {\n\n        private double[] values;\n        private double[] values2;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -823812830:  // values\n                    return this.values;\n                case 231606096:  // values2\n                    return this.values2;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder<T> set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -823812830:  // values\n                    this.values = (double[]) newValue;\n                    break;\n                case 231606096:  // values2\n                    this.values2 = (double[]) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public ImmDoubleArray<T> build() {\n            return new ImmDoubleArray<>(\n                    values,\n                    values2);\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(96);\n            buf.append(\"ImmDoubleArray.Builder{\");\n            buf.append(\"values\").append('=').append(JodaBeanUtils.toString(values)).append(',').append(' ');\n            buf.append(\"values2\").append('=').append(JodaBeanUtils.toString(values2));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmDoubleFloat.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock immutable bean, used for testing deserialization.\n */\n@BeanDefinition\npublic final class ImmDoubleFloat implements ImmutableBean {\n    \n    @PropertyDefinition\n    private final double a;\n    @PropertyDefinition\n    private final double b;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmDoubleFloat}.\n     * @return the meta-bean, not null\n     */\n    public static ImmDoubleFloat.Meta meta() {\n        return ImmDoubleFloat.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmDoubleFloat.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmDoubleFloat.Builder builder() {\n        return new ImmDoubleFloat.Builder();\n    }\n\n    private ImmDoubleFloat(\n            double a,\n            double b) {\n        this.a = a;\n        this.b = b;\n    }\n\n    @Override\n    public ImmDoubleFloat.Meta metaBean() {\n        return ImmDoubleFloat.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the a.\n     * @return the value of the property\n     */\n    public double getA() {\n        return a;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the b.\n     * @return the value of the property\n     */\n    public double getB() {\n        return b;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmDoubleFloat other = (ImmDoubleFloat) obj;\n            return JodaBeanUtils.equal(this.a, other.a) &&\n                    JodaBeanUtils.equal(this.b, other.b);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(a);\n        hash = hash * 31 + JodaBeanUtils.hashCode(b);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"ImmDoubleFloat{\");\n        buf.append(\"a\").append('=').append(JodaBeanUtils.toString(a)).append(',').append(' ');\n        buf.append(\"b\").append('=').append(JodaBeanUtils.toString(b));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmDoubleFloat}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code a} property.\n         */\n        private final MetaProperty<Double> a = DirectMetaProperty.ofImmutable(\n                this, \"a\", ImmDoubleFloat.class, Double.TYPE);\n        /**\n         * The meta-property for the {@code b} property.\n         */\n        private final MetaProperty<Double> b = DirectMetaProperty.ofImmutable(\n                this, \"b\", ImmDoubleFloat.class, Double.TYPE);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"a\",\n                \"b\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 97:  // a\n                    return this.a;\n                case 98:  // b\n                    return this.b;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmDoubleFloat.Builder builder() {\n            return new ImmDoubleFloat.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmDoubleFloat> beanType() {\n            return ImmDoubleFloat.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code a} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Double> a() {\n            return a;\n        }\n\n        /**\n         * The meta-property for the {@code b} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Double> b() {\n            return b;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 97:  // a\n                    return ((ImmDoubleFloat) bean).getA();\n                case 98:  // b\n                    return ((ImmDoubleFloat) bean).getB();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmDoubleFloat}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmDoubleFloat> {\n\n        private double a;\n        private double b;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmDoubleFloat beanToCopy) {\n            this.a = beanToCopy.getA();\n            this.b = beanToCopy.getB();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 97:  // a\n                    return this.a;\n                case 98:  // b\n                    return this.b;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 97:  // a\n                    this.a = (Double) newValue;\n                    break;\n                case 98:  // b\n                    this.b = (Double) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmDoubleFloat build() {\n            return new ImmDoubleFloat(\n                    a,\n                    b);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the a.\n         * @param a  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder a(double a) {\n            this.a = a;\n            return this;\n        }\n\n        /**\n         * Sets the b.\n         * @param b  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder b(double b) {\n            this.b = b;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(96);\n            buf.append(\"ImmDoubleFloat.Builder{\");\n            buf.append(\"a\").append('=').append(JodaBeanUtils.toString(a)).append(',').append(' ');\n            buf.append(\"b\").append('=').append(JodaBeanUtils.toString(b));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmEmpty.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.beans.ConstructorProperties;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\nimport java.util.Objects;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock immutable empty bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(constructorScope = \"public@ConstructorProperties\")\npublic final class ImmEmpty implements ImmutableBean\n{\n    // NOTE: open braces on a new line\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmEmpty}.\n     * @return the meta-bean, not null\n     */\n    public static ImmEmpty.Meta meta() {\n        return ImmEmpty.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmEmpty.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmEmpty.Builder builder() {\n        return new ImmEmpty.Builder();\n    }\n\n    /**\n     * Creates an instance.\n     */\n    @ConstructorProperties({})\n    public ImmEmpty() {\n    }\n\n    @Override\n    public ImmEmpty.Meta metaBean() {\n        return ImmEmpty.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(32);\n        buf.append(\"ImmEmpty{\");\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmEmpty}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null);\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        public ImmEmpty.Builder builder() {\n            return new ImmEmpty.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmEmpty> beanType() {\n            return ImmEmpty.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmEmpty}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmEmpty> {\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmEmpty build() {\n            return new ImmEmpty();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            return \"ImmEmpty.Builder{}\";\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n\n    // an inner class with equals/hashCode/toString\n    static class InnerClass {\n        private final String value;\n\n        public InnerClass(String value) {\n            this.value = value;\n        }\n\n        @Override\n        public int hashCode() {\n            return Objects.hashCode(value);\n        }\n\n        @Override\n        public boolean equals(Object obj) {\n            return obj instanceof InnerClass other && Objects.equals(value, other.value);\n        }\n\n        @Override\n        public String toString() {\n            return value;\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmFieldGetter.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic final class ImmFieldGetter<T> implements ImmutableBean {\n\n    @PropertyDefinition(get = \"field\")\n    private final String value;\n\n    public String getValue() {\n        if (value == null) {\n            throw new NullPointerException();\n        }\n        return value;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmFieldGetter}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static ImmFieldGetter.Meta meta() {\n        return ImmFieldGetter.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code ImmFieldGetter}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R> ImmFieldGetter.Meta<R> metaImmFieldGetter(Class<R> cls) {\n        return ImmFieldGetter.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmFieldGetter.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @param <T>  the type\n     * @return the builder, not null\n     */\n    public static <T> ImmFieldGetter.Builder<T> builder() {\n        return new ImmFieldGetter.Builder<>();\n    }\n\n    private ImmFieldGetter(\n            String value) {\n        this.value = value;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public ImmFieldGetter.Meta<T> metaBean() {\n        return ImmFieldGetter.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder<T> toBuilder() {\n        return new Builder<>(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmFieldGetter<?> other = (ImmFieldGetter<?>) obj;\n            return JodaBeanUtils.equal(this.value, other.value);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(value);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmFieldGetter{\");\n        buf.append(\"value\").append('=').append(JodaBeanUtils.toString(value));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmFieldGetter}.\n     * @param <T>  the type\n     */\n    public static final class Meta<T> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code value} property.\n         */\n        private final MetaProperty<String> value = DirectMetaProperty.ofImmutable(\n                this, \"value\", ImmFieldGetter.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"value\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmFieldGetter.Builder<T> builder() {\n            return new ImmFieldGetter.Builder<>();\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends ImmFieldGetter<T>> beanType() {\n            return (Class) ImmFieldGetter.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code value} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> value() {\n            return value;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return ((ImmFieldGetter<?>) bean).value;\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmFieldGetter}.\n     * @param <T>  the type\n     */\n    public static final class Builder<T> extends DirectFieldsBeanBuilder<ImmFieldGetter<T>> {\n\n        private String value;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmFieldGetter<T> beanToCopy) {\n            this.value = beanToCopy.value;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder<T> set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    this.value = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder<T> set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmFieldGetter<T> build() {\n            return new ImmFieldGetter<>(\n                    value);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the value.\n         * @param value  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder<T> value(String value) {\n            this.value = value;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmFieldGetter.Builder{\");\n            buf.append(\"value\").append('=').append(JodaBeanUtils.toString(value));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmGeneric.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(builderScope = \"public\", factoryName = \"of\")\npublic final class ImmGeneric<T> implements ImmutableBean {\n\n    /** The name. */\n    @PropertyDefinition(validate = \"notNull\")\n    private final T value;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmGeneric}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static ImmGeneric.Meta meta() {\n        return ImmGeneric.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code ImmGeneric}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R> ImmGeneric.Meta<R> metaImmGeneric(Class<R> cls) {\n        return ImmGeneric.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmGeneric.Meta.INSTANCE);\n    }\n\n    /**\n     * Obtains an instance.\n     * @param <T>  the type\n     * @param value  the value of the property, not null\n     * @return the instance\n     */\n    public static <T> ImmGeneric<T> of(\n            T value) {\n        return new ImmGeneric<>(\n            value);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @param <T>  the type\n     * @return the builder, not null\n     */\n    public static <T> ImmGeneric.Builder<T> builder() {\n        return new ImmGeneric.Builder<>();\n    }\n\n    private ImmGeneric(\n            T value) {\n        JodaBeanUtils.notNull(value, \"value\");\n        this.value = value;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public ImmGeneric.Meta<T> metaBean() {\n        return ImmGeneric.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property, not null\n     */\n    public T getValue() {\n        return value;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder<T> toBuilder() {\n        return new Builder<>(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmGeneric<?> other = (ImmGeneric<?>) obj;\n            return JodaBeanUtils.equal(this.value, other.value);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(value);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmGeneric{\");\n        buf.append(\"value\").append('=').append(JodaBeanUtils.toString(value));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmGeneric}.\n     * @param <T>  the type\n     */\n    public static final class Meta<T> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code value} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T> value = (DirectMetaProperty) DirectMetaProperty.ofImmutable(\n                this, \"value\", ImmGeneric.class, Object.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"value\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmGeneric.Builder<T> builder() {\n            return new ImmGeneric.Builder<>();\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends ImmGeneric<T>> beanType() {\n            return (Class) ImmGeneric.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code value} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<T> value() {\n            return value;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return ((ImmGeneric<?>) bean).getValue();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmGeneric}.\n     * @param <T>  the type\n     */\n    public static final class Builder<T> extends DirectFieldsBeanBuilder<ImmGeneric<T>> {\n\n        private T value;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmGeneric<T> beanToCopy) {\n            this.value = beanToCopy.getValue();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder<T> set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    this.value = (T) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder<T> set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmGeneric<T> build() {\n            return new ImmGeneric<>(\n                    value);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the name.\n         * @param value  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> value(T value) {\n            JodaBeanUtils.notNull(value, \"value\");\n            this.value = value;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmGeneric.Builder{\");\n            buf.append(\"value\").append('=').append(JodaBeanUtils.toString(value));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmGenericArray.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\nimport org.joda.beans.impl.direct.DirectPrivateBeanBuilder;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(builderScope = \"private\", factoryName = \"of\")\npublic final class ImmGenericArray<T>\n        implements\n            Serializable,\n            ImmutableBean {\n    // note each element on a new line\n\n    /** The name. */\n    @PropertyDefinition(validate = \"notNull\")\n    private final T[] values;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmGenericArray}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static ImmGenericArray.Meta meta() {\n        return ImmGenericArray.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code ImmGenericArray}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R> ImmGenericArray.Meta<R> metaImmGenericArray(Class<R> cls) {\n        return ImmGenericArray.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmGenericArray.Meta.INSTANCE);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Obtains an instance.\n     * @param <T>  the type\n     * @param values  the value of the property, not null\n     * @return the instance\n     */\n    public static <T> ImmGenericArray<T> of(\n            T[] values) {\n        return new ImmGenericArray<>(\n            values);\n    }\n\n    private ImmGenericArray(\n            T[] values) {\n        JodaBeanUtils.notNull(values, \"values\");\n        this.values = values;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public ImmGenericArray.Meta<T> metaBean() {\n        return ImmGenericArray.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property, not null\n     */\n    public T[] getValues() {\n        return values;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmGenericArray<?> other = (ImmGenericArray<?>) obj;\n            return JodaBeanUtils.equal(this.values, other.values);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(values);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmGenericArray{\");\n        buf.append(\"values\").append('=').append(JodaBeanUtils.toString(values));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmGenericArray}.\n     * @param <T>  the type\n     */\n    public static final class Meta<T> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code values} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T[]> values = (DirectMetaProperty) DirectMetaProperty.ofImmutable(\n                this, \"values\", ImmGenericArray.class, Object[].class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"values\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -823812830:  // values\n                    return this.values;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends ImmGenericArray<T>> builder() {\n            return new ImmGenericArray.Builder<>();\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends ImmGenericArray<T>> beanType() {\n            return (Class) ImmGenericArray.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code values} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<T[]> values() {\n            return values;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -823812830:  // values\n                    return ((ImmGenericArray<?>) bean).getValues();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmGenericArray}.\n     * @param <T>  the type\n     */\n    private static final class Builder<T> extends DirectPrivateBeanBuilder<ImmGenericArray<T>> {\n\n        private T[] values;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -823812830:  // values\n                    return this.values;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder<T> set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -823812830:  // values\n                    this.values = (T[]) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public ImmGenericArray<T> build() {\n            return new ImmGenericArray<>(\n                    values);\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmGenericArray.Builder{\");\n            buf.append(\"values\").append('=').append(JodaBeanUtils.toString(values));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmGenericCollections.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.collect.ImmutableMap;\n\n/**\n * Immutable bean with nested generic types, used for testing.\n */\n@BeanDefinition\npublic class ImmGenericCollections<T> implements ImmutableBean {\n\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableMap<String, T> map;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmGenericCollections}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static ImmGenericCollections.Meta meta() {\n        return ImmGenericCollections.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code ImmGenericCollections}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R> ImmGenericCollections.Meta<R> metaImmGenericCollections(Class<R> cls) {\n        return ImmGenericCollections.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmGenericCollections.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @param <T>  the type\n     * @return the builder, not null\n     */\n    public static <T> ImmGenericCollections.Builder<T> builder() {\n        return new ImmGenericCollections.Builder<>();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    protected ImmGenericCollections(ImmGenericCollections.Builder<T> builder) {\n        JodaBeanUtils.notNull(builder.map, \"map\");\n        this.map = ImmutableMap.copyOf(builder.map);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public ImmGenericCollections.Meta<T> metaBean() {\n        return ImmGenericCollections.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the map.\n     * @return the value of the property, not null\n     */\n    public ImmutableMap<String, T> getMap() {\n        return map;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder<T> toBuilder() {\n        return new Builder<>(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmGenericCollections<?> other = (ImmGenericCollections<?>) obj;\n            return JodaBeanUtils.equal(this.map, other.map);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(map);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmGenericCollections{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"map\").append('=').append(JodaBeanUtils.toString(map)).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmGenericCollections}.\n     * @param <T>  the type\n     */\n    public static class Meta<T> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code map} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<String, T>> map = DirectMetaProperty.ofImmutable(\n                this, \"map\", ImmGenericCollections.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"map\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 107868:  // map\n                    return this.map;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmGenericCollections.Builder<T> builder() {\n            return new ImmGenericCollections.Builder<>();\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends ImmGenericCollections<T>> beanType() {\n            return (Class) ImmGenericCollections.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code map} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<ImmutableMap<String, T>> map() {\n            return map;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 107868:  // map\n                    return ((ImmGenericCollections<?>) bean).getMap();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmGenericCollections}.\n     * @param <T>  the type\n     */\n    public static class Builder<T> extends DirectFieldsBeanBuilder<ImmGenericCollections<T>> {\n\n        private Map<String, T> map = ImmutableMap.of();\n\n        /**\n         * Restricted constructor.\n         */\n        protected Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        protected Builder(ImmGenericCollections<T> beanToCopy) {\n            this.map = beanToCopy.getMap();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 107868:  // map\n                    return this.map;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder<T> set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 107868:  // map\n                    this.map = (Map<String, T>) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder<T> set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmGenericCollections<T> build() {\n            return new ImmGenericCollections<>(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the map.\n         * @param map  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> map(Map<String, T> map) {\n            JodaBeanUtils.notNull(map, \"map\");\n            this.map = map;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmGenericCollections.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        protected void toString(StringBuilder buf) {\n            buf.append(\"map\").append('=').append(JodaBeanUtils.toString(map)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmGenericLinkedRefs.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic final class ImmGenericLinkedRefs<A, B extends Comparable<A>> implements ImmutableBean {\n    // two generic types are linked\n\n    /** The name. */\n    @PropertyDefinition(validate = \"notNull\")\n    private final A value;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmGenericLinkedRefs}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static ImmGenericLinkedRefs.Meta meta() {\n        return ImmGenericLinkedRefs.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code ImmGenericLinkedRefs}.\n     * @param <R>  the first generic type\n     * @param <S>  the second generic type\n     * @param cls1  the first generic type\n     * @param cls2  the second generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R, S extends Comparable<R>> ImmGenericLinkedRefs.Meta<R, S> metaImmGenericLinkedRefs(Class<R> cls1, Class<S> cls2) {\n        return ImmGenericLinkedRefs.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmGenericLinkedRefs.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @param <A>  the type\n     * @param <B>  the type\n     * @return the builder, not null\n     */\n    public static <A, B extends Comparable<A>> ImmGenericLinkedRefs.Builder<A, B> builder() {\n        return new ImmGenericLinkedRefs.Builder<>();\n    }\n\n    private ImmGenericLinkedRefs(\n            A value) {\n        JodaBeanUtils.notNull(value, \"value\");\n        this.value = value;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public ImmGenericLinkedRefs.Meta<A, B> metaBean() {\n        return ImmGenericLinkedRefs.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property, not null\n     */\n    public A getValue() {\n        return value;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder<A, B> toBuilder() {\n        return new Builder<>(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmGenericLinkedRefs<?, ?> other = (ImmGenericLinkedRefs<?, ?>) obj;\n            return JodaBeanUtils.equal(this.value, other.value);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(value);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmGenericLinkedRefs{\");\n        buf.append(\"value\").append('=').append(JodaBeanUtils.toString(value));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmGenericLinkedRefs}.\n     * @param <A>  the type\n     * @param <B>  the type\n     */\n    public static final class Meta<A, B extends Comparable<A>> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code value} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<A> value = (DirectMetaProperty) DirectMetaProperty.ofImmutable(\n                this, \"value\", ImmGenericLinkedRefs.class, Object.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"value\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmGenericLinkedRefs.Builder<A, B> builder() {\n            return new ImmGenericLinkedRefs.Builder<>();\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends ImmGenericLinkedRefs<A, B>> beanType() {\n            return (Class) ImmGenericLinkedRefs.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code value} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<A> value() {\n            return value;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return ((ImmGenericLinkedRefs<?, ?>) bean).getValue();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmGenericLinkedRefs}.\n     * @param <A>  the type\n     * @param <B>  the type\n     */\n    public static final class Builder<A, B extends Comparable<A>> extends DirectFieldsBeanBuilder<ImmGenericLinkedRefs<A, B>> {\n\n        private A value;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmGenericLinkedRefs<A, B> beanToCopy) {\n            this.value = beanToCopy.getValue();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder<A, B> set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    this.value = (A) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder<A, B> set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmGenericLinkedRefs<A, B> build() {\n            return new ImmGenericLinkedRefs<>(\n                    value);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the name.\n         * @param value  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<A, B> value(A value) {\n            JodaBeanUtils.notNull(value, \"value\");\n            this.value = value;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmGenericLinkedRefs.Builder{\");\n            buf.append(\"value\").append('=').append(JodaBeanUtils.toString(value));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmGenericNonFinal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(builderScope = \"public\")\npublic class ImmGenericNonFinal<T extends Address> implements ImmutableBean {\n\n    /** The name. */\n    @PropertyDefinition(validate = \"notNull\")\n    private final T value;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmGenericNonFinal}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static ImmGenericNonFinal.Meta meta() {\n        return ImmGenericNonFinal.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code ImmGenericNonFinal}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Address> ImmGenericNonFinal.Meta<R> metaImmGenericNonFinal(Class<R> cls) {\n        return ImmGenericNonFinal.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmGenericNonFinal.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @param <T>  the type\n     * @return the builder, not null\n     */\n    public static <T extends Address> ImmGenericNonFinal.Builder<T> builder() {\n        return new ImmGenericNonFinal.Builder<>();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    protected ImmGenericNonFinal(ImmGenericNonFinal.Builder<T> builder) {\n        JodaBeanUtils.notNull(builder.value, \"value\");\n        this.value = builder.value;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public ImmGenericNonFinal.Meta<T> metaBean() {\n        return ImmGenericNonFinal.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property, not null\n     */\n    public T getValue() {\n        return value;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder<T> toBuilder() {\n        return new Builder<>(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmGenericNonFinal<?> other = (ImmGenericNonFinal<?>) obj;\n            return JodaBeanUtils.equal(this.value, other.value);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(value);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmGenericNonFinal{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"value\").append('=').append(JodaBeanUtils.toString(value)).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmGenericNonFinal}.\n     * @param <T>  the type\n     */\n    public static class Meta<T extends Address> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code value} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T> value = (DirectMetaProperty) DirectMetaProperty.ofImmutable(\n                this, \"value\", ImmGenericNonFinal.class, Object.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"value\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmGenericNonFinal.Builder<T> builder() {\n            return new ImmGenericNonFinal.Builder<>();\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends ImmGenericNonFinal<T>> beanType() {\n            return (Class) ImmGenericNonFinal.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code value} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T> value() {\n            return value;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return ((ImmGenericNonFinal<?>) bean).getValue();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmGenericNonFinal}.\n     * @param <T>  the type\n     */\n    public static class Builder<T extends Address> extends DirectFieldsBeanBuilder<ImmGenericNonFinal<T>> {\n\n        private T value;\n\n        /**\n         * Restricted constructor.\n         */\n        protected Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        protected Builder(ImmGenericNonFinal<T> beanToCopy) {\n            this.value = beanToCopy.getValue();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder<T> set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    this.value = (T) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder<T> set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmGenericNonFinal<T> build() {\n            return new ImmGenericNonFinal<>(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the name.\n         * @param value  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> value(T value) {\n            JodaBeanUtils.notNull(value, \"value\");\n            this.value = value;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmGenericNonFinal.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        protected void toString(StringBuilder buf) {\n            buf.append(\"value\").append('=').append(JodaBeanUtils.toString(value)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmGuava.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\nimport java.util.Set;\nimport java.util.SortedMap;\nimport java.util.SortedSet;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.collect.BiMap;\nimport com.google.common.collect.ImmutableBiMap;\nimport com.google.common.collect.ImmutableCollection;\nimport com.google.common.collect.ImmutableList;\nimport com.google.common.collect.ImmutableListMultimap;\nimport com.google.common.collect.ImmutableMap;\nimport com.google.common.collect.ImmutableMultimap;\nimport com.google.common.collect.ImmutableMultiset;\nimport com.google.common.collect.ImmutableSet;\nimport com.google.common.collect.ImmutableSetMultimap;\nimport com.google.common.collect.ImmutableSortedMap;\nimport com.google.common.collect.ImmutableSortedMultiset;\nimport com.google.common.collect.ImmutableSortedSet;\nimport com.google.common.collect.ImmutableTable;\nimport com.google.common.collect.ListMultimap;\nimport com.google.common.collect.Multimap;\nimport com.google.common.collect.Multiset;\nimport com.google.common.collect.SetMultimap;\nimport com.google.common.collect.SortedMultiset;\nimport com.google.common.collect.Table;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(builderScope = \"public\", constructorScope = \"public\")\npublic final class ImmGuava<T extends Comparable<T>> implements ImmutableBean {\n\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableCollection<T> collection;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableList<T> list;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableSet<T> set;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableSortedSet<T> sortedSet;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableMap<T, String> map;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableSortedMap<T, String> sortedMap;\n\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableBiMap<T, String> biMap;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableMultimap<T, String> multimap;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableListMultimap<T, String> listMultimap;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableSetMultimap<T, String> setMultimap;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableMultiset<T> multiset;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableSortedMultiset<T> sortedMultiset;\n\n    @PropertyDefinition(validate = \"notNull\")\n    private final Collection<T> collectionInterface;\n    @PropertyDefinition(validate = \"notNull\")\n    private final List<T> listInterface;\n    @PropertyDefinition(validate = \"notNull\")\n    private final Set<T> setInterface;\n    @PropertyDefinition(validate = \"notNull\")\n    private final SortedSet<T> sortedSetInterface;\n    @PropertyDefinition(validate = \"notNull\")\n    private final Map<T, String> mapInterface;\n    @PropertyDefinition(validate = \"notNull\")\n    private final SortedMap<T, String> sortedMapInterface;\n\n    @PropertyDefinition(validate = \"notNull\")\n    private final BiMap<T, String> biMapInterface;\n    @PropertyDefinition(validate = \"notNull\")\n    private final Multimap<T, String> multimapInterface;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ListMultimap<T, String> listMultimapInterface;\n    @PropertyDefinition(validate = \"notNull\")\n    private final SetMultimap<T, String> setMultimapInterface;\n    @PropertyDefinition(validate = \"notNull\")\n    private final Multiset<T> multisetInterface;\n    @PropertyDefinition(validate = \"notNull\")\n    private final SortedMultiset<T> sortedMultisetInterface;\n\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableList<? extends T> listWildExtendsT;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableList<? extends Number> listWildExtendsNumber;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableList<? extends Comparable<?>> listWildExtendsComparable;\n\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableSet<? extends T> setWildExtendsT;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableSet<? extends Number> setWildExtendsNumber;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableSet<? extends Comparable<?>> setWildExtendsComparable;\n\n//    @PropertyDefinition(validate = \"notNull\")\n//    private final ArrayListMultimap<T, String> listMultimapArray;\n//    @PropertyDefinition(validate = \"notNull\")\n//    private final LinkedListMultimap<T, String> listMultimapLinked;\n//    @PropertyDefinition(validate = \"notNull\")\n//    private final HashMultimap<T, String> setMultimapHash;\n//    @PropertyDefinition(validate = \"notNull\")\n//    private final LinkedHashMultimap<T, String> setMultimapLinkedHash;\n\n\n    @PropertyDefinition(validate = \"notNull\", builderType = \"List<?>\")\n    private final ImmutableList<Object> listWildBuilder1;\n    @PropertyDefinition(validate = \"notNull\", builderType = \"List<? extends Address>\")\n    private final ImmutableList<Address> listWildBuilder2;\n    @PropertyDefinition(validate = \"notNull\", builderType = \"Map<String, ? extends Address>\")\n    private final ImmutableMap<String, Address> mapWildBuilder1;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableMap<? extends Number, String> mapWildKey;\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableTable<String, Integer, String> table;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmGuava}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static ImmGuava.Meta meta() {\n        return ImmGuava.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code ImmGuava}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Comparable<R>> ImmGuava.Meta<R> metaImmGuava(Class<R> cls) {\n        return ImmGuava.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmGuava.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @param <T>  the type\n     * @return the builder, not null\n     */\n    public static <T extends Comparable<T>> ImmGuava.Builder<T> builder() {\n        return new ImmGuava.Builder<>();\n    }\n\n    /**\n     * Creates an instance.\n     * @param collection  the value of the property, not null\n     * @param list  the value of the property, not null\n     * @param set  the value of the property, not null\n     * @param sortedSet  the value of the property, not null\n     * @param map  the value of the property, not null\n     * @param sortedMap  the value of the property, not null\n     * @param biMap  the value of the property, not null\n     * @param multimap  the value of the property, not null\n     * @param listMultimap  the value of the property, not null\n     * @param setMultimap  the value of the property, not null\n     * @param multiset  the value of the property, not null\n     * @param sortedMultiset  the value of the property, not null\n     * @param collectionInterface  the value of the property, not null\n     * @param listInterface  the value of the property, not null\n     * @param setInterface  the value of the property, not null\n     * @param sortedSetInterface  the value of the property, not null\n     * @param mapInterface  the value of the property, not null\n     * @param sortedMapInterface  the value of the property, not null\n     * @param biMapInterface  the value of the property, not null\n     * @param multimapInterface  the value of the property, not null\n     * @param listMultimapInterface  the value of the property, not null\n     * @param setMultimapInterface  the value of the property, not null\n     * @param multisetInterface  the value of the property, not null\n     * @param sortedMultisetInterface  the value of the property, not null\n     * @param listWildExtendsT  the value of the property, not null\n     * @param listWildExtendsNumber  the value of the property, not null\n     * @param listWildExtendsComparable  the value of the property, not null\n     * @param setWildExtendsT  the value of the property, not null\n     * @param setWildExtendsNumber  the value of the property, not null\n     * @param setWildExtendsComparable  the value of the property, not null\n     * @param listWildBuilder1  the value of the property, not null\n     * @param listWildBuilder2  the value of the property, not null\n     * @param mapWildBuilder1  the value of the property, not null\n     * @param mapWildKey  the value of the property, not null\n     * @param table  the value of the property, not null\n     */\n    public ImmGuava(\n            Collection<T> collection,\n            List<T> list,\n            Set<T> set,\n            SortedSet<T> sortedSet,\n            Map<T, String> map,\n            SortedMap<T, String> sortedMap,\n            BiMap<T, String> biMap,\n            Multimap<T, String> multimap,\n            ListMultimap<T, String> listMultimap,\n            SetMultimap<T, String> setMultimap,\n            Multiset<T> multiset,\n            SortedMultiset<T> sortedMultiset,\n            Collection<T> collectionInterface,\n            List<T> listInterface,\n            Set<T> setInterface,\n            SortedSet<T> sortedSetInterface,\n            Map<T, String> mapInterface,\n            SortedMap<T, String> sortedMapInterface,\n            BiMap<T, String> biMapInterface,\n            Multimap<T, String> multimapInterface,\n            ListMultimap<T, String> listMultimapInterface,\n            SetMultimap<T, String> setMultimapInterface,\n            Multiset<T> multisetInterface,\n            SortedMultiset<T> sortedMultisetInterface,\n            List<? extends T> listWildExtendsT,\n            List<? extends Number> listWildExtendsNumber,\n            List<? extends Comparable<?>> listWildExtendsComparable,\n            Set<? extends T> setWildExtendsT,\n            Set<? extends Number> setWildExtendsNumber,\n            Set<? extends Comparable<?>> setWildExtendsComparable,\n            List<?> listWildBuilder1,\n            List<? extends Address> listWildBuilder2,\n            Map<String, ? extends Address> mapWildBuilder1,\n            Map<? extends Number, String> mapWildKey,\n            Table<String, Integer, String> table) {\n        JodaBeanUtils.notNull(collection, \"collection\");\n        JodaBeanUtils.notNull(list, \"list\");\n        JodaBeanUtils.notNull(set, \"set\");\n        JodaBeanUtils.notNull(sortedSet, \"sortedSet\");\n        JodaBeanUtils.notNull(map, \"map\");\n        JodaBeanUtils.notNull(sortedMap, \"sortedMap\");\n        JodaBeanUtils.notNull(biMap, \"biMap\");\n        JodaBeanUtils.notNull(multimap, \"multimap\");\n        JodaBeanUtils.notNull(listMultimap, \"listMultimap\");\n        JodaBeanUtils.notNull(setMultimap, \"setMultimap\");\n        JodaBeanUtils.notNull(multiset, \"multiset\");\n        JodaBeanUtils.notNull(sortedMultiset, \"sortedMultiset\");\n        JodaBeanUtils.notNull(collectionInterface, \"collectionInterface\");\n        JodaBeanUtils.notNull(listInterface, \"listInterface\");\n        JodaBeanUtils.notNull(setInterface, \"setInterface\");\n        JodaBeanUtils.notNull(sortedSetInterface, \"sortedSetInterface\");\n        JodaBeanUtils.notNull(mapInterface, \"mapInterface\");\n        JodaBeanUtils.notNull(sortedMapInterface, \"sortedMapInterface\");\n        JodaBeanUtils.notNull(biMapInterface, \"biMapInterface\");\n        JodaBeanUtils.notNull(multimapInterface, \"multimapInterface\");\n        JodaBeanUtils.notNull(listMultimapInterface, \"listMultimapInterface\");\n        JodaBeanUtils.notNull(setMultimapInterface, \"setMultimapInterface\");\n        JodaBeanUtils.notNull(multisetInterface, \"multisetInterface\");\n        JodaBeanUtils.notNull(sortedMultisetInterface, \"sortedMultisetInterface\");\n        JodaBeanUtils.notNull(listWildExtendsT, \"listWildExtendsT\");\n        JodaBeanUtils.notNull(listWildExtendsNumber, \"listWildExtendsNumber\");\n        JodaBeanUtils.notNull(listWildExtendsComparable, \"listWildExtendsComparable\");\n        JodaBeanUtils.notNull(setWildExtendsT, \"setWildExtendsT\");\n        JodaBeanUtils.notNull(setWildExtendsNumber, \"setWildExtendsNumber\");\n        JodaBeanUtils.notNull(setWildExtendsComparable, \"setWildExtendsComparable\");\n        JodaBeanUtils.notNull(listWildBuilder1, \"listWildBuilder1\");\n        JodaBeanUtils.notNull(listWildBuilder2, \"listWildBuilder2\");\n        JodaBeanUtils.notNull(mapWildBuilder1, \"mapWildBuilder1\");\n        JodaBeanUtils.notNull(mapWildKey, \"mapWildKey\");\n        JodaBeanUtils.notNull(table, \"table\");\n        this.collection = ImmutableList.copyOf(collection);\n        this.list = ImmutableList.copyOf(list);\n        this.set = ImmutableSet.copyOf(set);\n        this.sortedSet = ImmutableSortedSet.copyOfSorted(sortedSet);\n        this.map = ImmutableMap.copyOf(map);\n        this.sortedMap = ImmutableSortedMap.copyOfSorted(sortedMap);\n        this.biMap = ImmutableBiMap.copyOf(biMap);\n        this.multimap = ImmutableMultimap.copyOf(multimap);\n        this.listMultimap = ImmutableListMultimap.copyOf(listMultimap);\n        this.setMultimap = ImmutableSetMultimap.copyOf(setMultimap);\n        this.multiset = ImmutableMultiset.copyOf(multiset);\n        this.sortedMultiset = ImmutableSortedMultiset.copyOfSorted(sortedMultiset);\n        this.collectionInterface = ImmutableList.copyOf(collectionInterface);\n        this.listInterface = ImmutableList.copyOf(listInterface);\n        this.setInterface = ImmutableSet.copyOf(setInterface);\n        this.sortedSetInterface = ImmutableSortedSet.copyOfSorted(sortedSetInterface);\n        this.mapInterface = ImmutableMap.copyOf(mapInterface);\n        this.sortedMapInterface = ImmutableSortedMap.copyOfSorted(sortedMapInterface);\n        this.biMapInterface = ImmutableBiMap.copyOf(biMapInterface);\n        this.multimapInterface = ImmutableMultimap.copyOf(multimapInterface);\n        this.listMultimapInterface = ImmutableListMultimap.copyOf(listMultimapInterface);\n        this.setMultimapInterface = ImmutableSetMultimap.copyOf(setMultimapInterface);\n        this.multisetInterface = ImmutableMultiset.copyOf(multisetInterface);\n        this.sortedMultisetInterface = ImmutableSortedMultiset.copyOfSorted(sortedMultisetInterface);\n        this.listWildExtendsT = ImmutableList.copyOf(listWildExtendsT);\n        this.listWildExtendsNumber = ImmutableList.copyOf(listWildExtendsNumber);\n        this.listWildExtendsComparable = ImmutableList.copyOf(listWildExtendsComparable);\n        this.setWildExtendsT = ImmutableSet.copyOf(setWildExtendsT);\n        this.setWildExtendsNumber = ImmutableSet.copyOf(setWildExtendsNumber);\n        this.setWildExtendsComparable = ImmutableSet.copyOf(setWildExtendsComparable);\n        this.listWildBuilder1 = ImmutableList.copyOf(listWildBuilder1);\n        this.listWildBuilder2 = ImmutableList.copyOf(listWildBuilder2);\n        this.mapWildBuilder1 = ImmutableMap.copyOf(mapWildBuilder1);\n        this.mapWildKey = ImmutableMap.copyOf(mapWildKey);\n        this.table = ImmutableTable.copyOf(table);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public ImmGuava.Meta<T> metaBean() {\n        return ImmGuava.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the collection.\n     * @return the value of the property, not null\n     */\n    public ImmutableCollection<T> getCollection() {\n        return collection;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the list.\n     * @return the value of the property, not null\n     */\n    public ImmutableList<T> getList() {\n        return list;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the set.\n     * @return the value of the property, not null\n     */\n    public ImmutableSet<T> getSet() {\n        return set;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the sortedSet.\n     * @return the value of the property, not null\n     */\n    public ImmutableSortedSet<T> getSortedSet() {\n        return sortedSet;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the map.\n     * @return the value of the property, not null\n     */\n    public ImmutableMap<T, String> getMap() {\n        return map;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the sortedMap.\n     * @return the value of the property, not null\n     */\n    public ImmutableSortedMap<T, String> getSortedMap() {\n        return sortedMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the biMap.\n     * @return the value of the property, not null\n     */\n    public ImmutableBiMap<T, String> getBiMap() {\n        return biMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the multimap.\n     * @return the value of the property, not null\n     */\n    public ImmutableMultimap<T, String> getMultimap() {\n        return multimap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listMultimap.\n     * @return the value of the property, not null\n     */\n    public ImmutableListMultimap<T, String> getListMultimap() {\n        return listMultimap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the setMultimap.\n     * @return the value of the property, not null\n     */\n    public ImmutableSetMultimap<T, String> getSetMultimap() {\n        return setMultimap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the multiset.\n     * @return the value of the property, not null\n     */\n    public ImmutableMultiset<T> getMultiset() {\n        return multiset;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the sortedMultiset.\n     * @return the value of the property, not null\n     */\n    public ImmutableSortedMultiset<T> getSortedMultiset() {\n        return sortedMultiset;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the collectionInterface.\n     * @return the value of the property, not null\n     */\n    public Collection<T> getCollectionInterface() {\n        return collectionInterface;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listInterface.\n     * @return the value of the property, not null\n     */\n    public List<T> getListInterface() {\n        return listInterface;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the setInterface.\n     * @return the value of the property, not null\n     */\n    public Set<T> getSetInterface() {\n        return setInterface;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the sortedSetInterface.\n     * @return the value of the property, not null\n     */\n    public SortedSet<T> getSortedSetInterface() {\n        return sortedSetInterface;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the mapInterface.\n     * @return the value of the property, not null\n     */\n    public Map<T, String> getMapInterface() {\n        return mapInterface;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the sortedMapInterface.\n     * @return the value of the property, not null\n     */\n    public SortedMap<T, String> getSortedMapInterface() {\n        return sortedMapInterface;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the biMapInterface.\n     * @return the value of the property, not null\n     */\n    public BiMap<T, String> getBiMapInterface() {\n        return biMapInterface;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the multimapInterface.\n     * @return the value of the property, not null\n     */\n    public Multimap<T, String> getMultimapInterface() {\n        return multimapInterface;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listMultimapInterface.\n     * @return the value of the property, not null\n     */\n    public ListMultimap<T, String> getListMultimapInterface() {\n        return listMultimapInterface;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the setMultimapInterface.\n     * @return the value of the property, not null\n     */\n    public SetMultimap<T, String> getSetMultimapInterface() {\n        return setMultimapInterface;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the multisetInterface.\n     * @return the value of the property, not null\n     */\n    public Multiset<T> getMultisetInterface() {\n        return multisetInterface;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the sortedMultisetInterface.\n     * @return the value of the property, not null\n     */\n    public SortedMultiset<T> getSortedMultisetInterface() {\n        return sortedMultisetInterface;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listWildExtendsT.\n     * @return the value of the property, not null\n     */\n    public ImmutableList<? extends T> getListWildExtendsT() {\n        return listWildExtendsT;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listWildExtendsNumber.\n     * @return the value of the property, not null\n     */\n    public ImmutableList<? extends Number> getListWildExtendsNumber() {\n        return listWildExtendsNumber;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listWildExtendsComparable.\n     * @return the value of the property, not null\n     */\n    public ImmutableList<? extends Comparable<?>> getListWildExtendsComparable() {\n        return listWildExtendsComparable;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the setWildExtendsT.\n     * @return the value of the property, not null\n     */\n    public ImmutableSet<? extends T> getSetWildExtendsT() {\n        return setWildExtendsT;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the setWildExtendsNumber.\n     * @return the value of the property, not null\n     */\n    public ImmutableSet<? extends Number> getSetWildExtendsNumber() {\n        return setWildExtendsNumber;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the setWildExtendsComparable.\n     * @return the value of the property, not null\n     */\n    public ImmutableSet<? extends Comparable<?>> getSetWildExtendsComparable() {\n        return setWildExtendsComparable;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listWildBuilder1.\n     * @return the value of the property, not null\n     */\n    public ImmutableList<Object> getListWildBuilder1() {\n        return listWildBuilder1;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listWildBuilder2.\n     * @return the value of the property, not null\n     */\n    public ImmutableList<Address> getListWildBuilder2() {\n        return listWildBuilder2;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the mapWildBuilder1.\n     * @return the value of the property, not null\n     */\n    public ImmutableMap<String, Address> getMapWildBuilder1() {\n        return mapWildBuilder1;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the mapWildKey.\n     * @return the value of the property, not null\n     */\n    public ImmutableMap<? extends Number, String> getMapWildKey() {\n        return mapWildKey;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the table.\n     * @return the value of the property, not null\n     */\n    public ImmutableTable<String, Integer, String> getTable() {\n        return table;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder<T> toBuilder() {\n        return new Builder<>(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmGuava<?> other = (ImmGuava<?>) obj;\n            return JodaBeanUtils.equal(this.collection, other.collection) &&\n                    JodaBeanUtils.equal(this.list, other.list) &&\n                    JodaBeanUtils.equal(this.set, other.set) &&\n                    JodaBeanUtils.equal(this.sortedSet, other.sortedSet) &&\n                    JodaBeanUtils.equal(this.map, other.map) &&\n                    JodaBeanUtils.equal(this.sortedMap, other.sortedMap) &&\n                    JodaBeanUtils.equal(this.biMap, other.biMap) &&\n                    JodaBeanUtils.equal(this.multimap, other.multimap) &&\n                    JodaBeanUtils.equal(this.listMultimap, other.listMultimap) &&\n                    JodaBeanUtils.equal(this.setMultimap, other.setMultimap) &&\n                    JodaBeanUtils.equal(this.multiset, other.multiset) &&\n                    JodaBeanUtils.equal(this.sortedMultiset, other.sortedMultiset) &&\n                    JodaBeanUtils.equal(this.collectionInterface, other.collectionInterface) &&\n                    JodaBeanUtils.equal(this.listInterface, other.listInterface) &&\n                    JodaBeanUtils.equal(this.setInterface, other.setInterface) &&\n                    JodaBeanUtils.equal(this.sortedSetInterface, other.sortedSetInterface) &&\n                    JodaBeanUtils.equal(this.mapInterface, other.mapInterface) &&\n                    JodaBeanUtils.equal(this.sortedMapInterface, other.sortedMapInterface) &&\n                    JodaBeanUtils.equal(this.biMapInterface, other.biMapInterface) &&\n                    JodaBeanUtils.equal(this.multimapInterface, other.multimapInterface) &&\n                    JodaBeanUtils.equal(this.listMultimapInterface, other.listMultimapInterface) &&\n                    JodaBeanUtils.equal(this.setMultimapInterface, other.setMultimapInterface) &&\n                    JodaBeanUtils.equal(this.multisetInterface, other.multisetInterface) &&\n                    JodaBeanUtils.equal(this.sortedMultisetInterface, other.sortedMultisetInterface) &&\n                    JodaBeanUtils.equal(this.listWildExtendsT, other.listWildExtendsT) &&\n                    JodaBeanUtils.equal(this.listWildExtendsNumber, other.listWildExtendsNumber) &&\n                    JodaBeanUtils.equal(this.listWildExtendsComparable, other.listWildExtendsComparable) &&\n                    JodaBeanUtils.equal(this.setWildExtendsT, other.setWildExtendsT) &&\n                    JodaBeanUtils.equal(this.setWildExtendsNumber, other.setWildExtendsNumber) &&\n                    JodaBeanUtils.equal(this.setWildExtendsComparable, other.setWildExtendsComparable) &&\n                    JodaBeanUtils.equal(this.listWildBuilder1, other.listWildBuilder1) &&\n                    JodaBeanUtils.equal(this.listWildBuilder2, other.listWildBuilder2) &&\n                    JodaBeanUtils.equal(this.mapWildBuilder1, other.mapWildBuilder1) &&\n                    JodaBeanUtils.equal(this.mapWildKey, other.mapWildKey) &&\n                    JodaBeanUtils.equal(this.table, other.table);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(collection);\n        hash = hash * 31 + JodaBeanUtils.hashCode(list);\n        hash = hash * 31 + JodaBeanUtils.hashCode(set);\n        hash = hash * 31 + JodaBeanUtils.hashCode(sortedSet);\n        hash = hash * 31 + JodaBeanUtils.hashCode(map);\n        hash = hash * 31 + JodaBeanUtils.hashCode(sortedMap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(biMap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(multimap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listMultimap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(setMultimap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(multiset);\n        hash = hash * 31 + JodaBeanUtils.hashCode(sortedMultiset);\n        hash = hash * 31 + JodaBeanUtils.hashCode(collectionInterface);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listInterface);\n        hash = hash * 31 + JodaBeanUtils.hashCode(setInterface);\n        hash = hash * 31 + JodaBeanUtils.hashCode(sortedSetInterface);\n        hash = hash * 31 + JodaBeanUtils.hashCode(mapInterface);\n        hash = hash * 31 + JodaBeanUtils.hashCode(sortedMapInterface);\n        hash = hash * 31 + JodaBeanUtils.hashCode(biMapInterface);\n        hash = hash * 31 + JodaBeanUtils.hashCode(multimapInterface);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listMultimapInterface);\n        hash = hash * 31 + JodaBeanUtils.hashCode(setMultimapInterface);\n        hash = hash * 31 + JodaBeanUtils.hashCode(multisetInterface);\n        hash = hash * 31 + JodaBeanUtils.hashCode(sortedMultisetInterface);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listWildExtendsT);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listWildExtendsNumber);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listWildExtendsComparable);\n        hash = hash * 31 + JodaBeanUtils.hashCode(setWildExtendsT);\n        hash = hash * 31 + JodaBeanUtils.hashCode(setWildExtendsNumber);\n        hash = hash * 31 + JodaBeanUtils.hashCode(setWildExtendsComparable);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listWildBuilder1);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listWildBuilder2);\n        hash = hash * 31 + JodaBeanUtils.hashCode(mapWildBuilder1);\n        hash = hash * 31 + JodaBeanUtils.hashCode(mapWildKey);\n        hash = hash * 31 + JodaBeanUtils.hashCode(table);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(1152);\n        buf.append(\"ImmGuava{\");\n        buf.append(\"collection\").append('=').append(JodaBeanUtils.toString(collection)).append(',').append(' ');\n        buf.append(\"list\").append('=').append(JodaBeanUtils.toString(list)).append(',').append(' ');\n        buf.append(\"set\").append('=').append(JodaBeanUtils.toString(set)).append(',').append(' ');\n        buf.append(\"sortedSet\").append('=').append(JodaBeanUtils.toString(sortedSet)).append(',').append(' ');\n        buf.append(\"map\").append('=').append(JodaBeanUtils.toString(map)).append(',').append(' ');\n        buf.append(\"sortedMap\").append('=').append(JodaBeanUtils.toString(sortedMap)).append(',').append(' ');\n        buf.append(\"biMap\").append('=').append(JodaBeanUtils.toString(biMap)).append(',').append(' ');\n        buf.append(\"multimap\").append('=').append(JodaBeanUtils.toString(multimap)).append(',').append(' ');\n        buf.append(\"listMultimap\").append('=').append(JodaBeanUtils.toString(listMultimap)).append(',').append(' ');\n        buf.append(\"setMultimap\").append('=').append(JodaBeanUtils.toString(setMultimap)).append(',').append(' ');\n        buf.append(\"multiset\").append('=').append(JodaBeanUtils.toString(multiset)).append(',').append(' ');\n        buf.append(\"sortedMultiset\").append('=').append(JodaBeanUtils.toString(sortedMultiset)).append(',').append(' ');\n        buf.append(\"collectionInterface\").append('=').append(JodaBeanUtils.toString(collectionInterface)).append(',').append(' ');\n        buf.append(\"listInterface\").append('=').append(JodaBeanUtils.toString(listInterface)).append(',').append(' ');\n        buf.append(\"setInterface\").append('=').append(JodaBeanUtils.toString(setInterface)).append(',').append(' ');\n        buf.append(\"sortedSetInterface\").append('=').append(JodaBeanUtils.toString(sortedSetInterface)).append(',').append(' ');\n        buf.append(\"mapInterface\").append('=').append(JodaBeanUtils.toString(mapInterface)).append(',').append(' ');\n        buf.append(\"sortedMapInterface\").append('=').append(JodaBeanUtils.toString(sortedMapInterface)).append(',').append(' ');\n        buf.append(\"biMapInterface\").append('=').append(JodaBeanUtils.toString(biMapInterface)).append(',').append(' ');\n        buf.append(\"multimapInterface\").append('=').append(JodaBeanUtils.toString(multimapInterface)).append(',').append(' ');\n        buf.append(\"listMultimapInterface\").append('=').append(JodaBeanUtils.toString(listMultimapInterface)).append(',').append(' ');\n        buf.append(\"setMultimapInterface\").append('=').append(JodaBeanUtils.toString(setMultimapInterface)).append(',').append(' ');\n        buf.append(\"multisetInterface\").append('=').append(JodaBeanUtils.toString(multisetInterface)).append(',').append(' ');\n        buf.append(\"sortedMultisetInterface\").append('=').append(JodaBeanUtils.toString(sortedMultisetInterface)).append(',').append(' ');\n        buf.append(\"listWildExtendsT\").append('=').append(JodaBeanUtils.toString(listWildExtendsT)).append(',').append(' ');\n        buf.append(\"listWildExtendsNumber\").append('=').append(JodaBeanUtils.toString(listWildExtendsNumber)).append(',').append(' ');\n        buf.append(\"listWildExtendsComparable\").append('=').append(JodaBeanUtils.toString(listWildExtendsComparable)).append(',').append(' ');\n        buf.append(\"setWildExtendsT\").append('=').append(JodaBeanUtils.toString(setWildExtendsT)).append(',').append(' ');\n        buf.append(\"setWildExtendsNumber\").append('=').append(JodaBeanUtils.toString(setWildExtendsNumber)).append(',').append(' ');\n        buf.append(\"setWildExtendsComparable\").append('=').append(JodaBeanUtils.toString(setWildExtendsComparable)).append(',').append(' ');\n        buf.append(\"listWildBuilder1\").append('=').append(JodaBeanUtils.toString(listWildBuilder1)).append(',').append(' ');\n        buf.append(\"listWildBuilder2\").append('=').append(JodaBeanUtils.toString(listWildBuilder2)).append(',').append(' ');\n        buf.append(\"mapWildBuilder1\").append('=').append(JodaBeanUtils.toString(mapWildBuilder1)).append(',').append(' ');\n        buf.append(\"mapWildKey\").append('=').append(JodaBeanUtils.toString(mapWildKey)).append(',').append(' ');\n        buf.append(\"table\").append('=').append(JodaBeanUtils.toString(table));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmGuava}.\n     * @param <T>  the type\n     */\n    public static final class Meta<T extends Comparable<T>> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code collection} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableCollection<T>> collection = DirectMetaProperty.ofImmutable(\n                this, \"collection\", ImmGuava.class, (Class) ImmutableCollection.class);\n        /**\n         * The meta-property for the {@code list} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableList<T>> list = DirectMetaProperty.ofImmutable(\n                this, \"list\", ImmGuava.class, (Class) ImmutableList.class);\n        /**\n         * The meta-property for the {@code set} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableSet<T>> set = DirectMetaProperty.ofImmutable(\n                this, \"set\", ImmGuava.class, (Class) ImmutableSet.class);\n        /**\n         * The meta-property for the {@code sortedSet} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableSortedSet<T>> sortedSet = DirectMetaProperty.ofImmutable(\n                this, \"sortedSet\", ImmGuava.class, (Class) ImmutableSortedSet.class);\n        /**\n         * The meta-property for the {@code map} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<T, String>> map = DirectMetaProperty.ofImmutable(\n                this, \"map\", ImmGuava.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-property for the {@code sortedMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableSortedMap<T, String>> sortedMap = DirectMetaProperty.ofImmutable(\n                this, \"sortedMap\", ImmGuava.class, (Class) ImmutableSortedMap.class);\n        /**\n         * The meta-property for the {@code biMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableBiMap<T, String>> biMap = DirectMetaProperty.ofImmutable(\n                this, \"biMap\", ImmGuava.class, (Class) ImmutableBiMap.class);\n        /**\n         * The meta-property for the {@code multimap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMultimap<T, String>> multimap = DirectMetaProperty.ofImmutable(\n                this, \"multimap\", ImmGuava.class, (Class) ImmutableMultimap.class);\n        /**\n         * The meta-property for the {@code listMultimap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableListMultimap<T, String>> listMultimap = DirectMetaProperty.ofImmutable(\n                this, \"listMultimap\", ImmGuava.class, (Class) ImmutableListMultimap.class);\n        /**\n         * The meta-property for the {@code setMultimap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableSetMultimap<T, String>> setMultimap = DirectMetaProperty.ofImmutable(\n                this, \"setMultimap\", ImmGuava.class, (Class) ImmutableSetMultimap.class);\n        /**\n         * The meta-property for the {@code multiset} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMultiset<T>> multiset = DirectMetaProperty.ofImmutable(\n                this, \"multiset\", ImmGuava.class, (Class) ImmutableMultiset.class);\n        /**\n         * The meta-property for the {@code sortedMultiset} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableSortedMultiset<T>> sortedMultiset = DirectMetaProperty.ofImmutable(\n                this, \"sortedMultiset\", ImmGuava.class, (Class) ImmutableSortedMultiset.class);\n        /**\n         * The meta-property for the {@code collectionInterface} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Collection<T>> collectionInterface = DirectMetaProperty.ofImmutable(\n                this, \"collectionInterface\", ImmGuava.class, (Class) Collection.class);\n        /**\n         * The meta-property for the {@code listInterface} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<T>> listInterface = DirectMetaProperty.ofImmutable(\n                this, \"listInterface\", ImmGuava.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code setInterface} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Set<T>> setInterface = DirectMetaProperty.ofImmutable(\n                this, \"setInterface\", ImmGuava.class, (Class) Set.class);\n        /**\n         * The meta-property for the {@code sortedSetInterface} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<SortedSet<T>> sortedSetInterface = DirectMetaProperty.ofImmutable(\n                this, \"sortedSetInterface\", ImmGuava.class, (Class) SortedSet.class);\n        /**\n         * The meta-property for the {@code mapInterface} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Map<T, String>> mapInterface = DirectMetaProperty.ofImmutable(\n                this, \"mapInterface\", ImmGuava.class, (Class) Map.class);\n        /**\n         * The meta-property for the {@code sortedMapInterface} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<SortedMap<T, String>> sortedMapInterface = DirectMetaProperty.ofImmutable(\n                this, \"sortedMapInterface\", ImmGuava.class, (Class) SortedMap.class);\n        /**\n         * The meta-property for the {@code biMapInterface} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<BiMap<T, String>> biMapInterface = DirectMetaProperty.ofImmutable(\n                this, \"biMapInterface\", ImmGuava.class, (Class) BiMap.class);\n        /**\n         * The meta-property for the {@code multimapInterface} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Multimap<T, String>> multimapInterface = DirectMetaProperty.ofImmutable(\n                this, \"multimapInterface\", ImmGuava.class, (Class) Multimap.class);\n        /**\n         * The meta-property for the {@code listMultimapInterface} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ListMultimap<T, String>> listMultimapInterface = DirectMetaProperty.ofImmutable(\n                this, \"listMultimapInterface\", ImmGuava.class, (Class) ListMultimap.class);\n        /**\n         * The meta-property for the {@code setMultimapInterface} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<SetMultimap<T, String>> setMultimapInterface = DirectMetaProperty.ofImmutable(\n                this, \"setMultimapInterface\", ImmGuava.class, (Class) SetMultimap.class);\n        /**\n         * The meta-property for the {@code multisetInterface} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Multiset<T>> multisetInterface = DirectMetaProperty.ofImmutable(\n                this, \"multisetInterface\", ImmGuava.class, (Class) Multiset.class);\n        /**\n         * The meta-property for the {@code sortedMultisetInterface} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<SortedMultiset<T>> sortedMultisetInterface = DirectMetaProperty.ofImmutable(\n                this, \"sortedMultisetInterface\", ImmGuava.class, (Class) SortedMultiset.class);\n        /**\n         * The meta-property for the {@code listWildExtendsT} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableList<? extends T>> listWildExtendsT = DirectMetaProperty.ofImmutable(\n                this, \"listWildExtendsT\", ImmGuava.class, (Class) ImmutableList.class);\n        /**\n         * The meta-property for the {@code listWildExtendsNumber} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableList<? extends Number>> listWildExtendsNumber = DirectMetaProperty.ofImmutable(\n                this, \"listWildExtendsNumber\", ImmGuava.class, (Class) ImmutableList.class);\n        /**\n         * The meta-property for the {@code listWildExtendsComparable} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableList<? extends Comparable<?>>> listWildExtendsComparable = DirectMetaProperty.ofImmutable(\n                this, \"listWildExtendsComparable\", ImmGuava.class, (Class) ImmutableList.class);\n        /**\n         * The meta-property for the {@code setWildExtendsT} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableSet<? extends T>> setWildExtendsT = DirectMetaProperty.ofImmutable(\n                this, \"setWildExtendsT\", ImmGuava.class, (Class) ImmutableSet.class);\n        /**\n         * The meta-property for the {@code setWildExtendsNumber} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableSet<? extends Number>> setWildExtendsNumber = DirectMetaProperty.ofImmutable(\n                this, \"setWildExtendsNumber\", ImmGuava.class, (Class) ImmutableSet.class);\n        /**\n         * The meta-property for the {@code setWildExtendsComparable} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableSet<? extends Comparable<?>>> setWildExtendsComparable = DirectMetaProperty.ofImmutable(\n                this, \"setWildExtendsComparable\", ImmGuava.class, (Class) ImmutableSet.class);\n        /**\n         * The meta-property for the {@code listWildBuilder1} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableList<Object>> listWildBuilder1 = DirectMetaProperty.ofImmutable(\n                this, \"listWildBuilder1\", ImmGuava.class, (Class) ImmutableList.class);\n        /**\n         * The meta-property for the {@code listWildBuilder2} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableList<Address>> listWildBuilder2 = DirectMetaProperty.ofImmutable(\n                this, \"listWildBuilder2\", ImmGuava.class, (Class) ImmutableList.class);\n        /**\n         * The meta-property for the {@code mapWildBuilder1} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<String, Address>> mapWildBuilder1 = DirectMetaProperty.ofImmutable(\n                this, \"mapWildBuilder1\", ImmGuava.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-property for the {@code mapWildKey} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<? extends Number, String>> mapWildKey = DirectMetaProperty.ofImmutable(\n                this, \"mapWildKey\", ImmGuava.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-property for the {@code table} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableTable<String, Integer, String>> table = DirectMetaProperty.ofImmutable(\n                this, \"table\", ImmGuava.class, (Class) ImmutableTable.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"collection\",\n                \"list\",\n                \"set\",\n                \"sortedSet\",\n                \"map\",\n                \"sortedMap\",\n                \"biMap\",\n                \"multimap\",\n                \"listMultimap\",\n                \"setMultimap\",\n                \"multiset\",\n                \"sortedMultiset\",\n                \"collectionInterface\",\n                \"listInterface\",\n                \"setInterface\",\n                \"sortedSetInterface\",\n                \"mapInterface\",\n                \"sortedMapInterface\",\n                \"biMapInterface\",\n                \"multimapInterface\",\n                \"listMultimapInterface\",\n                \"setMultimapInterface\",\n                \"multisetInterface\",\n                \"sortedMultisetInterface\",\n                \"listWildExtendsT\",\n                \"listWildExtendsNumber\",\n                \"listWildExtendsComparable\",\n                \"setWildExtendsT\",\n                \"setWildExtendsNumber\",\n                \"setWildExtendsComparable\",\n                \"listWildBuilder1\",\n                \"listWildBuilder2\",\n                \"mapWildBuilder1\",\n                \"mapWildKey\",\n                \"table\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1741312354:  // collection\n                    return this.collection;\n                case 3322014:  // list\n                    return this.list;\n                case 113762:  // set\n                    return this.set;\n                case -6890395:  // sortedSet\n                    return this.sortedSet;\n                case 107868:  // map\n                    return this.map;\n                case -6896289:  // sortedMap\n                    return this.sortedMap;\n                case 93710229:  // biMap\n                    return this.biMap;\n                case 653826435:  // multimap\n                    return this.multimap;\n                case 1737633857:  // listMultimap\n                    return this.listMultimap;\n                case -1651820539:  // setMultimap\n                    return this.setMultimap;\n                case 653832329:  // multiset\n                    return this.multiset;\n                case 1018567270:  // sortedMultiset\n                    return this.sortedMultiset;\n                case 420048955:  // collectionInterface\n                    return this.collectionInterface;\n                case -259084741:  // listInterface\n                    return this.listInterface;\n                case 2042011383:  // setInterface\n                    return this.setInterface;\n                case 1019335252:  // sortedSetInterface\n                    return this.sortedSetInterface;\n                case 651439933:  // mapInterface\n                    return this.mapInterface;\n                case -371236198:  // sortedMapInterface\n                    return this.sortedMapInterface;\n                case 2068077860:  // biMapInterface\n                    return this.biMapInterface;\n                case -1415579914:  // multimapInterface\n                    return this.multimapInterface;\n                case 1576080888:  // listMultimapInterface\n                    return this.listMultimapInterface;\n                case -630551884:  // setMultimapInterface\n                    return this.setMultimapInterface;\n                case -25008464:  // multisetInterface\n                    return this.multisetInterface;\n                case 271697267:  // sortedMultisetInterface\n                    return this.sortedMultisetInterface;\n                case -826400637:  // listWildExtendsT\n                    return this.listWildExtendsT;\n                case 789015706:  // listWildExtendsNumber\n                    return this.listWildExtendsNumber;\n                case 857377195:  // listWildExtendsComparable\n                    return this.listWildExtendsComparable;\n                case -844782009:  // setWildExtendsT\n                    return this.setWildExtendsT;\n                case -1417617066:  // setWildExtendsNumber\n                    return this.setWildExtendsNumber;\n                case 940785767:  // setWildExtendsComparable\n                    return this.setWildExtendsComparable;\n                case -436161122:  // listWildBuilder1\n                    return this.listWildBuilder1;\n                case -436161121:  // listWildBuilder2\n                    return this.listWildBuilder2;\n                case -2009039524:  // mapWildBuilder1\n                    return this.mapWildBuilder1;\n                case 1463967033:  // mapWildKey\n                    return this.mapWildKey;\n                case 110115790:  // table\n                    return this.table;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmGuava.Builder<T> builder() {\n            return new ImmGuava.Builder<>();\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends ImmGuava<T>> beanType() {\n            return (Class) ImmGuava.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code collection} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableCollection<T>> collection() {\n            return collection;\n        }\n\n        /**\n         * The meta-property for the {@code list} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableList<T>> list() {\n            return list;\n        }\n\n        /**\n         * The meta-property for the {@code set} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableSet<T>> set() {\n            return set;\n        }\n\n        /**\n         * The meta-property for the {@code sortedSet} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableSortedSet<T>> sortedSet() {\n            return sortedSet;\n        }\n\n        /**\n         * The meta-property for the {@code map} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<T, String>> map() {\n            return map;\n        }\n\n        /**\n         * The meta-property for the {@code sortedMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableSortedMap<T, String>> sortedMap() {\n            return sortedMap;\n        }\n\n        /**\n         * The meta-property for the {@code biMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableBiMap<T, String>> biMap() {\n            return biMap;\n        }\n\n        /**\n         * The meta-property for the {@code multimap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMultimap<T, String>> multimap() {\n            return multimap;\n        }\n\n        /**\n         * The meta-property for the {@code listMultimap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableListMultimap<T, String>> listMultimap() {\n            return listMultimap;\n        }\n\n        /**\n         * The meta-property for the {@code setMultimap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableSetMultimap<T, String>> setMultimap() {\n            return setMultimap;\n        }\n\n        /**\n         * The meta-property for the {@code multiset} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMultiset<T>> multiset() {\n            return multiset;\n        }\n\n        /**\n         * The meta-property for the {@code sortedMultiset} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableSortedMultiset<T>> sortedMultiset() {\n            return sortedMultiset;\n        }\n\n        /**\n         * The meta-property for the {@code collectionInterface} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Collection<T>> collectionInterface() {\n            return collectionInterface;\n        }\n\n        /**\n         * The meta-property for the {@code listInterface} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<List<T>> listInterface() {\n            return listInterface;\n        }\n\n        /**\n         * The meta-property for the {@code setInterface} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Set<T>> setInterface() {\n            return setInterface;\n        }\n\n        /**\n         * The meta-property for the {@code sortedSetInterface} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<SortedSet<T>> sortedSetInterface() {\n            return sortedSetInterface;\n        }\n\n        /**\n         * The meta-property for the {@code mapInterface} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Map<T, String>> mapInterface() {\n            return mapInterface;\n        }\n\n        /**\n         * The meta-property for the {@code sortedMapInterface} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<SortedMap<T, String>> sortedMapInterface() {\n            return sortedMapInterface;\n        }\n\n        /**\n         * The meta-property for the {@code biMapInterface} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<BiMap<T, String>> biMapInterface() {\n            return biMapInterface;\n        }\n\n        /**\n         * The meta-property for the {@code multimapInterface} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Multimap<T, String>> multimapInterface() {\n            return multimapInterface;\n        }\n\n        /**\n         * The meta-property for the {@code listMultimapInterface} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ListMultimap<T, String>> listMultimapInterface() {\n            return listMultimapInterface;\n        }\n\n        /**\n         * The meta-property for the {@code setMultimapInterface} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<SetMultimap<T, String>> setMultimapInterface() {\n            return setMultimapInterface;\n        }\n\n        /**\n         * The meta-property for the {@code multisetInterface} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Multiset<T>> multisetInterface() {\n            return multisetInterface;\n        }\n\n        /**\n         * The meta-property for the {@code sortedMultisetInterface} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<SortedMultiset<T>> sortedMultisetInterface() {\n            return sortedMultisetInterface;\n        }\n\n        /**\n         * The meta-property for the {@code listWildExtendsT} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableList<? extends T>> listWildExtendsT() {\n            return listWildExtendsT;\n        }\n\n        /**\n         * The meta-property for the {@code listWildExtendsNumber} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableList<? extends Number>> listWildExtendsNumber() {\n            return listWildExtendsNumber;\n        }\n\n        /**\n         * The meta-property for the {@code listWildExtendsComparable} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableList<? extends Comparable<?>>> listWildExtendsComparable() {\n            return listWildExtendsComparable;\n        }\n\n        /**\n         * The meta-property for the {@code setWildExtendsT} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableSet<? extends T>> setWildExtendsT() {\n            return setWildExtendsT;\n        }\n\n        /**\n         * The meta-property for the {@code setWildExtendsNumber} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableSet<? extends Number>> setWildExtendsNumber() {\n            return setWildExtendsNumber;\n        }\n\n        /**\n         * The meta-property for the {@code setWildExtendsComparable} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableSet<? extends Comparable<?>>> setWildExtendsComparable() {\n            return setWildExtendsComparable;\n        }\n\n        /**\n         * The meta-property for the {@code listWildBuilder1} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableList<Object>> listWildBuilder1() {\n            return listWildBuilder1;\n        }\n\n        /**\n         * The meta-property for the {@code listWildBuilder2} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableList<Address>> listWildBuilder2() {\n            return listWildBuilder2;\n        }\n\n        /**\n         * The meta-property for the {@code mapWildBuilder1} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<String, Address>> mapWildBuilder1() {\n            return mapWildBuilder1;\n        }\n\n        /**\n         * The meta-property for the {@code mapWildKey} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<? extends Number, String>> mapWildKey() {\n            return mapWildKey;\n        }\n\n        /**\n         * The meta-property for the {@code table} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableTable<String, Integer, String>> table() {\n            return table;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1741312354:  // collection\n                    return ((ImmGuava<?>) bean).getCollection();\n                case 3322014:  // list\n                    return ((ImmGuava<?>) bean).getList();\n                case 113762:  // set\n                    return ((ImmGuava<?>) bean).getSet();\n                case -6890395:  // sortedSet\n                    return ((ImmGuava<?>) bean).getSortedSet();\n                case 107868:  // map\n                    return ((ImmGuava<?>) bean).getMap();\n                case -6896289:  // sortedMap\n                    return ((ImmGuava<?>) bean).getSortedMap();\n                case 93710229:  // biMap\n                    return ((ImmGuava<?>) bean).getBiMap();\n                case 653826435:  // multimap\n                    return ((ImmGuava<?>) bean).getMultimap();\n                case 1737633857:  // listMultimap\n                    return ((ImmGuava<?>) bean).getListMultimap();\n                case -1651820539:  // setMultimap\n                    return ((ImmGuava<?>) bean).getSetMultimap();\n                case 653832329:  // multiset\n                    return ((ImmGuava<?>) bean).getMultiset();\n                case 1018567270:  // sortedMultiset\n                    return ((ImmGuava<?>) bean).getSortedMultiset();\n                case 420048955:  // collectionInterface\n                    return ((ImmGuava<?>) bean).getCollectionInterface();\n                case -259084741:  // listInterface\n                    return ((ImmGuava<?>) bean).getListInterface();\n                case 2042011383:  // setInterface\n                    return ((ImmGuava<?>) bean).getSetInterface();\n                case 1019335252:  // sortedSetInterface\n                    return ((ImmGuava<?>) bean).getSortedSetInterface();\n                case 651439933:  // mapInterface\n                    return ((ImmGuava<?>) bean).getMapInterface();\n                case -371236198:  // sortedMapInterface\n                    return ((ImmGuava<?>) bean).getSortedMapInterface();\n                case 2068077860:  // biMapInterface\n                    return ((ImmGuava<?>) bean).getBiMapInterface();\n                case -1415579914:  // multimapInterface\n                    return ((ImmGuava<?>) bean).getMultimapInterface();\n                case 1576080888:  // listMultimapInterface\n                    return ((ImmGuava<?>) bean).getListMultimapInterface();\n                case -630551884:  // setMultimapInterface\n                    return ((ImmGuava<?>) bean).getSetMultimapInterface();\n                case -25008464:  // multisetInterface\n                    return ((ImmGuava<?>) bean).getMultisetInterface();\n                case 271697267:  // sortedMultisetInterface\n                    return ((ImmGuava<?>) bean).getSortedMultisetInterface();\n                case -826400637:  // listWildExtendsT\n                    return ((ImmGuava<?>) bean).getListWildExtendsT();\n                case 789015706:  // listWildExtendsNumber\n                    return ((ImmGuava<?>) bean).getListWildExtendsNumber();\n                case 857377195:  // listWildExtendsComparable\n                    return ((ImmGuava<?>) bean).getListWildExtendsComparable();\n                case -844782009:  // setWildExtendsT\n                    return ((ImmGuava<?>) bean).getSetWildExtendsT();\n                case -1417617066:  // setWildExtendsNumber\n                    return ((ImmGuava<?>) bean).getSetWildExtendsNumber();\n                case 940785767:  // setWildExtendsComparable\n                    return ((ImmGuava<?>) bean).getSetWildExtendsComparable();\n                case -436161122:  // listWildBuilder1\n                    return ((ImmGuava<?>) bean).getListWildBuilder1();\n                case -436161121:  // listWildBuilder2\n                    return ((ImmGuava<?>) bean).getListWildBuilder2();\n                case -2009039524:  // mapWildBuilder1\n                    return ((ImmGuava<?>) bean).getMapWildBuilder1();\n                case 1463967033:  // mapWildKey\n                    return ((ImmGuava<?>) bean).getMapWildKey();\n                case 110115790:  // table\n                    return ((ImmGuava<?>) bean).getTable();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmGuava}.\n     * @param <T>  the type\n     */\n    public static final class Builder<T extends Comparable<T>> extends DirectFieldsBeanBuilder<ImmGuava<T>> {\n\n        private Collection<T> collection = ImmutableList.of();\n        private List<T> list = ImmutableList.of();\n        private Set<T> set = ImmutableSet.of();\n        private SortedSet<T> sortedSet = ImmutableSortedSet.of();\n        private Map<T, String> map = ImmutableMap.of();\n        private SortedMap<T, String> sortedMap = ImmutableSortedMap.of();\n        private BiMap<T, String> biMap = ImmutableBiMap.of();\n        private Multimap<T, String> multimap = ImmutableMultimap.of();\n        private ListMultimap<T, String> listMultimap = ImmutableListMultimap.of();\n        private SetMultimap<T, String> setMultimap = ImmutableSetMultimap.of();\n        private Multiset<T> multiset = ImmutableMultiset.of();\n        private SortedMultiset<T> sortedMultiset = ImmutableSortedMultiset.of();\n        private Collection<T> collectionInterface = ImmutableList.of();\n        private List<T> listInterface = ImmutableList.of();\n        private Set<T> setInterface = ImmutableSet.of();\n        private SortedSet<T> sortedSetInterface = ImmutableSortedSet.of();\n        private Map<T, String> mapInterface = ImmutableMap.of();\n        private SortedMap<T, String> sortedMapInterface = ImmutableSortedMap.of();\n        private BiMap<T, String> biMapInterface = ImmutableBiMap.of();\n        private Multimap<T, String> multimapInterface = ImmutableMultimap.of();\n        private ListMultimap<T, String> listMultimapInterface = ImmutableListMultimap.of();\n        private SetMultimap<T, String> setMultimapInterface = ImmutableSetMultimap.of();\n        private Multiset<T> multisetInterface = ImmutableMultiset.of();\n        private SortedMultiset<T> sortedMultisetInterface = ImmutableSortedMultiset.of();\n        private List<? extends T> listWildExtendsT = ImmutableList.of();\n        private List<? extends Number> listWildExtendsNumber = ImmutableList.of();\n        private List<? extends Comparable<?>> listWildExtendsComparable = ImmutableList.of();\n        private Set<? extends T> setWildExtendsT = ImmutableSet.of();\n        private Set<? extends Number> setWildExtendsNumber = ImmutableSet.of();\n        private Set<? extends Comparable<?>> setWildExtendsComparable = ImmutableSet.of();\n        private List<?> listWildBuilder1 = ImmutableList.of();\n        private List<? extends Address> listWildBuilder2 = ImmutableList.of();\n        private Map<String, ? extends Address> mapWildBuilder1 = ImmutableMap.of();\n        private Map<? extends Number, String> mapWildKey = ImmutableMap.of();\n        private Table<String, Integer, String> table = ImmutableTable.of();\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmGuava<T> beanToCopy) {\n            this.collection = beanToCopy.getCollection();\n            this.list = beanToCopy.getList();\n            this.set = beanToCopy.getSet();\n            this.sortedSet = beanToCopy.getSortedSet();\n            this.map = beanToCopy.getMap();\n            this.sortedMap = beanToCopy.getSortedMap();\n            this.biMap = beanToCopy.getBiMap();\n            this.multimap = beanToCopy.getMultimap();\n            this.listMultimap = beanToCopy.getListMultimap();\n            this.setMultimap = beanToCopy.getSetMultimap();\n            this.multiset = beanToCopy.getMultiset();\n            this.sortedMultiset = beanToCopy.getSortedMultiset();\n            this.collectionInterface = ImmutableList.copyOf(beanToCopy.getCollectionInterface());\n            this.listInterface = ImmutableList.copyOf(beanToCopy.getListInterface());\n            this.setInterface = ImmutableSet.copyOf(beanToCopy.getSetInterface());\n            this.sortedSetInterface = ImmutableSortedSet.copyOfSorted(beanToCopy.getSortedSetInterface());\n            this.mapInterface = ImmutableMap.copyOf(beanToCopy.getMapInterface());\n            this.sortedMapInterface = ImmutableSortedMap.copyOfSorted(beanToCopy.getSortedMapInterface());\n            this.biMapInterface = ImmutableBiMap.copyOf(beanToCopy.getBiMapInterface());\n            this.multimapInterface = ImmutableMultimap.copyOf(beanToCopy.getMultimapInterface());\n            this.listMultimapInterface = ImmutableListMultimap.copyOf(beanToCopy.getListMultimapInterface());\n            this.setMultimapInterface = ImmutableSetMultimap.copyOf(beanToCopy.getSetMultimapInterface());\n            this.multisetInterface = ImmutableMultiset.copyOf(beanToCopy.getMultisetInterface());\n            this.sortedMultisetInterface = ImmutableSortedMultiset.copyOfSorted(beanToCopy.getSortedMultisetInterface());\n            this.listWildExtendsT = beanToCopy.getListWildExtendsT();\n            this.listWildExtendsNumber = beanToCopy.getListWildExtendsNumber();\n            this.listWildExtendsComparable = beanToCopy.getListWildExtendsComparable();\n            this.setWildExtendsT = beanToCopy.getSetWildExtendsT();\n            this.setWildExtendsNumber = beanToCopy.getSetWildExtendsNumber();\n            this.setWildExtendsComparable = beanToCopy.getSetWildExtendsComparable();\n            this.listWildBuilder1 = beanToCopy.getListWildBuilder1();\n            this.listWildBuilder2 = beanToCopy.getListWildBuilder2();\n            this.mapWildBuilder1 = beanToCopy.getMapWildBuilder1();\n            this.mapWildKey = beanToCopy.getMapWildKey();\n            this.table = beanToCopy.getTable();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1741312354:  // collection\n                    return this.collection;\n                case 3322014:  // list\n                    return this.list;\n                case 113762:  // set\n                    return this.set;\n                case -6890395:  // sortedSet\n                    return this.sortedSet;\n                case 107868:  // map\n                    return this.map;\n                case -6896289:  // sortedMap\n                    return this.sortedMap;\n                case 93710229:  // biMap\n                    return this.biMap;\n                case 653826435:  // multimap\n                    return this.multimap;\n                case 1737633857:  // listMultimap\n                    return this.listMultimap;\n                case -1651820539:  // setMultimap\n                    return this.setMultimap;\n                case 653832329:  // multiset\n                    return this.multiset;\n                case 1018567270:  // sortedMultiset\n                    return this.sortedMultiset;\n                case 420048955:  // collectionInterface\n                    return this.collectionInterface;\n                case -259084741:  // listInterface\n                    return this.listInterface;\n                case 2042011383:  // setInterface\n                    return this.setInterface;\n                case 1019335252:  // sortedSetInterface\n                    return this.sortedSetInterface;\n                case 651439933:  // mapInterface\n                    return this.mapInterface;\n                case -371236198:  // sortedMapInterface\n                    return this.sortedMapInterface;\n                case 2068077860:  // biMapInterface\n                    return this.biMapInterface;\n                case -1415579914:  // multimapInterface\n                    return this.multimapInterface;\n                case 1576080888:  // listMultimapInterface\n                    return this.listMultimapInterface;\n                case -630551884:  // setMultimapInterface\n                    return this.setMultimapInterface;\n                case -25008464:  // multisetInterface\n                    return this.multisetInterface;\n                case 271697267:  // sortedMultisetInterface\n                    return this.sortedMultisetInterface;\n                case -826400637:  // listWildExtendsT\n                    return this.listWildExtendsT;\n                case 789015706:  // listWildExtendsNumber\n                    return this.listWildExtendsNumber;\n                case 857377195:  // listWildExtendsComparable\n                    return this.listWildExtendsComparable;\n                case -844782009:  // setWildExtendsT\n                    return this.setWildExtendsT;\n                case -1417617066:  // setWildExtendsNumber\n                    return this.setWildExtendsNumber;\n                case 940785767:  // setWildExtendsComparable\n                    return this.setWildExtendsComparable;\n                case -436161122:  // listWildBuilder1\n                    return this.listWildBuilder1;\n                case -436161121:  // listWildBuilder2\n                    return this.listWildBuilder2;\n                case -2009039524:  // mapWildBuilder1\n                    return this.mapWildBuilder1;\n                case 1463967033:  // mapWildKey\n                    return this.mapWildKey;\n                case 110115790:  // table\n                    return this.table;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder<T> set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -1741312354:  // collection\n                    this.collection = (Collection<T>) newValue;\n                    break;\n                case 3322014:  // list\n                    this.list = (List<T>) newValue;\n                    break;\n                case 113762:  // set\n                    this.set = (Set<T>) newValue;\n                    break;\n                case -6890395:  // sortedSet\n                    this.sortedSet = (SortedSet<T>) newValue;\n                    break;\n                case 107868:  // map\n                    this.map = (Map<T, String>) newValue;\n                    break;\n                case -6896289:  // sortedMap\n                    this.sortedMap = (SortedMap<T, String>) newValue;\n                    break;\n                case 93710229:  // biMap\n                    this.biMap = (BiMap<T, String>) newValue;\n                    break;\n                case 653826435:  // multimap\n                    this.multimap = (Multimap<T, String>) newValue;\n                    break;\n                case 1737633857:  // listMultimap\n                    this.listMultimap = (ListMultimap<T, String>) newValue;\n                    break;\n                case -1651820539:  // setMultimap\n                    this.setMultimap = (SetMultimap<T, String>) newValue;\n                    break;\n                case 653832329:  // multiset\n                    this.multiset = (Multiset<T>) newValue;\n                    break;\n                case 1018567270:  // sortedMultiset\n                    this.sortedMultiset = (SortedMultiset<T>) newValue;\n                    break;\n                case 420048955:  // collectionInterface\n                    this.collectionInterface = (Collection<T>) newValue;\n                    break;\n                case -259084741:  // listInterface\n                    this.listInterface = (List<T>) newValue;\n                    break;\n                case 2042011383:  // setInterface\n                    this.setInterface = (Set<T>) newValue;\n                    break;\n                case 1019335252:  // sortedSetInterface\n                    this.sortedSetInterface = (SortedSet<T>) newValue;\n                    break;\n                case 651439933:  // mapInterface\n                    this.mapInterface = (Map<T, String>) newValue;\n                    break;\n                case -371236198:  // sortedMapInterface\n                    this.sortedMapInterface = (SortedMap<T, String>) newValue;\n                    break;\n                case 2068077860:  // biMapInterface\n                    this.biMapInterface = (BiMap<T, String>) newValue;\n                    break;\n                case -1415579914:  // multimapInterface\n                    this.multimapInterface = (Multimap<T, String>) newValue;\n                    break;\n                case 1576080888:  // listMultimapInterface\n                    this.listMultimapInterface = (ListMultimap<T, String>) newValue;\n                    break;\n                case -630551884:  // setMultimapInterface\n                    this.setMultimapInterface = (SetMultimap<T, String>) newValue;\n                    break;\n                case -25008464:  // multisetInterface\n                    this.multisetInterface = (Multiset<T>) newValue;\n                    break;\n                case 271697267:  // sortedMultisetInterface\n                    this.sortedMultisetInterface = (SortedMultiset<T>) newValue;\n                    break;\n                case -826400637:  // listWildExtendsT\n                    this.listWildExtendsT = (List<? extends T>) newValue;\n                    break;\n                case 789015706:  // listWildExtendsNumber\n                    this.listWildExtendsNumber = (List<? extends Number>) newValue;\n                    break;\n                case 857377195:  // listWildExtendsComparable\n                    this.listWildExtendsComparable = (List<? extends Comparable<?>>) newValue;\n                    break;\n                case -844782009:  // setWildExtendsT\n                    this.setWildExtendsT = (Set<? extends T>) newValue;\n                    break;\n                case -1417617066:  // setWildExtendsNumber\n                    this.setWildExtendsNumber = (Set<? extends Number>) newValue;\n                    break;\n                case 940785767:  // setWildExtendsComparable\n                    this.setWildExtendsComparable = (Set<? extends Comparable<?>>) newValue;\n                    break;\n                case -436161122:  // listWildBuilder1\n                    this.listWildBuilder1 = (List<?>) newValue;\n                    break;\n                case -436161121:  // listWildBuilder2\n                    this.listWildBuilder2 = (List<? extends Address>) newValue;\n                    break;\n                case -2009039524:  // mapWildBuilder1\n                    this.mapWildBuilder1 = (Map<String, ? extends Address>) newValue;\n                    break;\n                case 1463967033:  // mapWildKey\n                    this.mapWildKey = (Map<? extends Number, String>) newValue;\n                    break;\n                case 110115790:  // table\n                    this.table = (Table<String, Integer, String>) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder<T> set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmGuava<T> build() {\n            return new ImmGuava<>(\n                    collection,\n                    list,\n                    set,\n                    sortedSet,\n                    map,\n                    sortedMap,\n                    biMap,\n                    multimap,\n                    listMultimap,\n                    setMultimap,\n                    multiset,\n                    sortedMultiset,\n                    collectionInterface,\n                    listInterface,\n                    setInterface,\n                    sortedSetInterface,\n                    mapInterface,\n                    sortedMapInterface,\n                    biMapInterface,\n                    multimapInterface,\n                    listMultimapInterface,\n                    setMultimapInterface,\n                    multisetInterface,\n                    sortedMultisetInterface,\n                    listWildExtendsT,\n                    listWildExtendsNumber,\n                    listWildExtendsComparable,\n                    setWildExtendsT,\n                    setWildExtendsNumber,\n                    setWildExtendsComparable,\n                    listWildBuilder1,\n                    listWildBuilder2,\n                    mapWildBuilder1,\n                    mapWildKey,\n                    table);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the collection.\n         * @param collection  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> collection(Collection<T> collection) {\n            JodaBeanUtils.notNull(collection, \"collection\");\n            this.collection = collection;\n            return this;\n        }\n\n        /**\n         * Sets the {@code collection} property in the builder\n         * from an array of objects.\n         * @param collection  the new value, not null\n         * @return this, for chaining, not null\n         */\n        @SafeVarargs\n        public final Builder<T> collection(T... collection) {\n            return collection(ImmutableList.copyOf(collection));\n        }\n\n        /**\n         * Sets the list.\n         * @param list  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> list(List<T> list) {\n            JodaBeanUtils.notNull(list, \"list\");\n            this.list = list;\n            return this;\n        }\n\n        /**\n         * Sets the {@code list} property in the builder\n         * from an array of objects.\n         * @param list  the new value, not null\n         * @return this, for chaining, not null\n         */\n        @SafeVarargs\n        public final Builder<T> list(T... list) {\n            return list(ImmutableList.copyOf(list));\n        }\n\n        /**\n         * Sets the set.\n         * @param set  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> set(Set<T> set) {\n            JodaBeanUtils.notNull(set, \"set\");\n            this.set = set;\n            return this;\n        }\n\n        /**\n         * Sets the {@code set} property in the builder\n         * from an array of objects.\n         * @param set  the new value, not null\n         * @return this, for chaining, not null\n         */\n        @SafeVarargs\n        public final Builder<T> set(T... set) {\n            return set(ImmutableSet.copyOf(set));\n        }\n\n        /**\n         * Sets the sortedSet.\n         * @param sortedSet  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> sortedSet(SortedSet<T> sortedSet) {\n            JodaBeanUtils.notNull(sortedSet, \"sortedSet\");\n            this.sortedSet = sortedSet;\n            return this;\n        }\n\n        /**\n         * Sets the {@code sortedSet} property in the builder\n         * from an array of objects.\n         * @param sortedSet  the new value, not null\n         * @return this, for chaining, not null\n         */\n        @SafeVarargs\n        public final Builder<T> sortedSet(T... sortedSet) {\n            return sortedSet(ImmutableSortedSet.copyOf(sortedSet));\n        }\n\n        /**\n         * Sets the map.\n         * @param map  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> map(Map<T, String> map) {\n            JodaBeanUtils.notNull(map, \"map\");\n            this.map = map;\n            return this;\n        }\n\n        /**\n         * Sets the sortedMap.\n         * @param sortedMap  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> sortedMap(SortedMap<T, String> sortedMap) {\n            JodaBeanUtils.notNull(sortedMap, \"sortedMap\");\n            this.sortedMap = sortedMap;\n            return this;\n        }\n\n        /**\n         * Sets the biMap.\n         * @param biMap  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> biMap(BiMap<T, String> biMap) {\n            JodaBeanUtils.notNull(biMap, \"biMap\");\n            this.biMap = biMap;\n            return this;\n        }\n\n        /**\n         * Sets the multimap.\n         * @param multimap  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> multimap(Multimap<T, String> multimap) {\n            JodaBeanUtils.notNull(multimap, \"multimap\");\n            this.multimap = multimap;\n            return this;\n        }\n\n        /**\n         * Sets the listMultimap.\n         * @param listMultimap  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listMultimap(ListMultimap<T, String> listMultimap) {\n            JodaBeanUtils.notNull(listMultimap, \"listMultimap\");\n            this.listMultimap = listMultimap;\n            return this;\n        }\n\n        /**\n         * Sets the setMultimap.\n         * @param setMultimap  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> setMultimap(SetMultimap<T, String> setMultimap) {\n            JodaBeanUtils.notNull(setMultimap, \"setMultimap\");\n            this.setMultimap = setMultimap;\n            return this;\n        }\n\n        /**\n         * Sets the multiset.\n         * @param multiset  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> multiset(Multiset<T> multiset) {\n            JodaBeanUtils.notNull(multiset, \"multiset\");\n            this.multiset = multiset;\n            return this;\n        }\n\n        /**\n         * Sets the sortedMultiset.\n         * @param sortedMultiset  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> sortedMultiset(SortedMultiset<T> sortedMultiset) {\n            JodaBeanUtils.notNull(sortedMultiset, \"sortedMultiset\");\n            this.sortedMultiset = sortedMultiset;\n            return this;\n        }\n\n        /**\n         * Sets the collectionInterface.\n         * @param collectionInterface  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> collectionInterface(Collection<T> collectionInterface) {\n            JodaBeanUtils.notNull(collectionInterface, \"collectionInterface\");\n            this.collectionInterface = collectionInterface;\n            return this;\n        }\n\n        /**\n         * Sets the {@code collectionInterface} property in the builder\n         * from an array of objects.\n         * @param collectionInterface  the new value, not null\n         * @return this, for chaining, not null\n         */\n        @SafeVarargs\n        public final Builder<T> collectionInterface(T... collectionInterface) {\n            return collectionInterface(ImmutableList.copyOf(collectionInterface));\n        }\n\n        /**\n         * Sets the listInterface.\n         * @param listInterface  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listInterface(List<T> listInterface) {\n            JodaBeanUtils.notNull(listInterface, \"listInterface\");\n            this.listInterface = listInterface;\n            return this;\n        }\n\n        /**\n         * Sets the {@code listInterface} property in the builder\n         * from an array of objects.\n         * @param listInterface  the new value, not null\n         * @return this, for chaining, not null\n         */\n        @SafeVarargs\n        public final Builder<T> listInterface(T... listInterface) {\n            return listInterface(ImmutableList.copyOf(listInterface));\n        }\n\n        /**\n         * Sets the setInterface.\n         * @param setInterface  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> setInterface(Set<T> setInterface) {\n            JodaBeanUtils.notNull(setInterface, \"setInterface\");\n            this.setInterface = setInterface;\n            return this;\n        }\n\n        /**\n         * Sets the {@code setInterface} property in the builder\n         * from an array of objects.\n         * @param setInterface  the new value, not null\n         * @return this, for chaining, not null\n         */\n        @SafeVarargs\n        public final Builder<T> setInterface(T... setInterface) {\n            return setInterface(ImmutableSet.copyOf(setInterface));\n        }\n\n        /**\n         * Sets the sortedSetInterface.\n         * @param sortedSetInterface  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> sortedSetInterface(SortedSet<T> sortedSetInterface) {\n            JodaBeanUtils.notNull(sortedSetInterface, \"sortedSetInterface\");\n            this.sortedSetInterface = sortedSetInterface;\n            return this;\n        }\n\n        /**\n         * Sets the {@code sortedSetInterface} property in the builder\n         * from an array of objects.\n         * @param sortedSetInterface  the new value, not null\n         * @return this, for chaining, not null\n         */\n        @SafeVarargs\n        public final Builder<T> sortedSetInterface(T... sortedSetInterface) {\n            return sortedSetInterface(ImmutableSortedSet.copyOf(sortedSetInterface));\n        }\n\n        /**\n         * Sets the mapInterface.\n         * @param mapInterface  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> mapInterface(Map<T, String> mapInterface) {\n            JodaBeanUtils.notNull(mapInterface, \"mapInterface\");\n            this.mapInterface = mapInterface;\n            return this;\n        }\n\n        /**\n         * Sets the sortedMapInterface.\n         * @param sortedMapInterface  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> sortedMapInterface(SortedMap<T, String> sortedMapInterface) {\n            JodaBeanUtils.notNull(sortedMapInterface, \"sortedMapInterface\");\n            this.sortedMapInterface = sortedMapInterface;\n            return this;\n        }\n\n        /**\n         * Sets the biMapInterface.\n         * @param biMapInterface  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> biMapInterface(BiMap<T, String> biMapInterface) {\n            JodaBeanUtils.notNull(biMapInterface, \"biMapInterface\");\n            this.biMapInterface = biMapInterface;\n            return this;\n        }\n\n        /**\n         * Sets the multimapInterface.\n         * @param multimapInterface  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> multimapInterface(Multimap<T, String> multimapInterface) {\n            JodaBeanUtils.notNull(multimapInterface, \"multimapInterface\");\n            this.multimapInterface = multimapInterface;\n            return this;\n        }\n\n        /**\n         * Sets the listMultimapInterface.\n         * @param listMultimapInterface  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listMultimapInterface(ListMultimap<T, String> listMultimapInterface) {\n            JodaBeanUtils.notNull(listMultimapInterface, \"listMultimapInterface\");\n            this.listMultimapInterface = listMultimapInterface;\n            return this;\n        }\n\n        /**\n         * Sets the setMultimapInterface.\n         * @param setMultimapInterface  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> setMultimapInterface(SetMultimap<T, String> setMultimapInterface) {\n            JodaBeanUtils.notNull(setMultimapInterface, \"setMultimapInterface\");\n            this.setMultimapInterface = setMultimapInterface;\n            return this;\n        }\n\n        /**\n         * Sets the multisetInterface.\n         * @param multisetInterface  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> multisetInterface(Multiset<T> multisetInterface) {\n            JodaBeanUtils.notNull(multisetInterface, \"multisetInterface\");\n            this.multisetInterface = multisetInterface;\n            return this;\n        }\n\n        /**\n         * Sets the sortedMultisetInterface.\n         * @param sortedMultisetInterface  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> sortedMultisetInterface(SortedMultiset<T> sortedMultisetInterface) {\n            JodaBeanUtils.notNull(sortedMultisetInterface, \"sortedMultisetInterface\");\n            this.sortedMultisetInterface = sortedMultisetInterface;\n            return this;\n        }\n\n        /**\n         * Sets the listWildExtendsT.\n         * @param listWildExtendsT  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWildExtendsT(List<? extends T> listWildExtendsT) {\n            JodaBeanUtils.notNull(listWildExtendsT, \"listWildExtendsT\");\n            this.listWildExtendsT = listWildExtendsT;\n            return this;\n        }\n\n        /**\n         * Sets the {@code listWildExtendsT} property in the builder\n         * from an array of objects.\n         * @param listWildExtendsT  the new value, not null\n         * @return this, for chaining, not null\n         */\n        @SafeVarargs\n        public final Builder<T> listWildExtendsT(T... listWildExtendsT) {\n            return listWildExtendsT(ImmutableList.copyOf(listWildExtendsT));\n        }\n\n        /**\n         * Sets the listWildExtendsNumber.\n         * @param listWildExtendsNumber  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWildExtendsNumber(List<? extends Number> listWildExtendsNumber) {\n            JodaBeanUtils.notNull(listWildExtendsNumber, \"listWildExtendsNumber\");\n            this.listWildExtendsNumber = listWildExtendsNumber;\n            return this;\n        }\n\n        /**\n         * Sets the {@code listWildExtendsNumber} property in the builder\n         * from an array of objects.\n         * @param listWildExtendsNumber  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWildExtendsNumber(Number... listWildExtendsNumber) {\n            return listWildExtendsNumber(ImmutableList.copyOf(listWildExtendsNumber));\n        }\n\n        /**\n         * Sets the listWildExtendsComparable.\n         * @param listWildExtendsComparable  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWildExtendsComparable(List<? extends Comparable<?>> listWildExtendsComparable) {\n            JodaBeanUtils.notNull(listWildExtendsComparable, \"listWildExtendsComparable\");\n            this.listWildExtendsComparable = listWildExtendsComparable;\n            return this;\n        }\n\n        /**\n         * Sets the {@code listWildExtendsComparable} property in the builder\n         * from an array of objects.\n         * @param listWildExtendsComparable  the new value, not null\n         * @return this, for chaining, not null\n         */\n        @SafeVarargs\n        public final Builder<T> listWildExtendsComparable(Comparable<?>... listWildExtendsComparable) {\n            return listWildExtendsComparable(ImmutableList.copyOf(listWildExtendsComparable));\n        }\n\n        /**\n         * Sets the setWildExtendsT.\n         * @param setWildExtendsT  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> setWildExtendsT(Set<? extends T> setWildExtendsT) {\n            JodaBeanUtils.notNull(setWildExtendsT, \"setWildExtendsT\");\n            this.setWildExtendsT = setWildExtendsT;\n            return this;\n        }\n\n        /**\n         * Sets the {@code setWildExtendsT} property in the builder\n         * from an array of objects.\n         * @param setWildExtendsT  the new value, not null\n         * @return this, for chaining, not null\n         */\n        @SafeVarargs\n        public final Builder<T> setWildExtendsT(T... setWildExtendsT) {\n            return setWildExtendsT(ImmutableSet.copyOf(setWildExtendsT));\n        }\n\n        /**\n         * Sets the setWildExtendsNumber.\n         * @param setWildExtendsNumber  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> setWildExtendsNumber(Set<? extends Number> setWildExtendsNumber) {\n            JodaBeanUtils.notNull(setWildExtendsNumber, \"setWildExtendsNumber\");\n            this.setWildExtendsNumber = setWildExtendsNumber;\n            return this;\n        }\n\n        /**\n         * Sets the {@code setWildExtendsNumber} property in the builder\n         * from an array of objects.\n         * @param setWildExtendsNumber  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> setWildExtendsNumber(Number... setWildExtendsNumber) {\n            return setWildExtendsNumber(ImmutableSet.copyOf(setWildExtendsNumber));\n        }\n\n        /**\n         * Sets the setWildExtendsComparable.\n         * @param setWildExtendsComparable  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> setWildExtendsComparable(Set<? extends Comparable<?>> setWildExtendsComparable) {\n            JodaBeanUtils.notNull(setWildExtendsComparable, \"setWildExtendsComparable\");\n            this.setWildExtendsComparable = setWildExtendsComparable;\n            return this;\n        }\n\n        /**\n         * Sets the {@code setWildExtendsComparable} property in the builder\n         * from an array of objects.\n         * @param setWildExtendsComparable  the new value, not null\n         * @return this, for chaining, not null\n         */\n        @SafeVarargs\n        public final Builder<T> setWildExtendsComparable(Comparable<?>... setWildExtendsComparable) {\n            return setWildExtendsComparable(ImmutableSet.copyOf(setWildExtendsComparable));\n        }\n\n        /**\n         * Sets the listWildBuilder1.\n         * @param listWildBuilder1  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWildBuilder1(List<?> listWildBuilder1) {\n            JodaBeanUtils.notNull(listWildBuilder1, \"listWildBuilder1\");\n            this.listWildBuilder1 = listWildBuilder1;\n            return this;\n        }\n\n        /**\n         * Sets the {@code listWildBuilder1} property in the builder\n         * from an array of objects.\n         * @param listWildBuilder1  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWildBuilder1(Object... listWildBuilder1) {\n            return listWildBuilder1(ImmutableList.copyOf(listWildBuilder1));\n        }\n\n        /**\n         * Sets the listWildBuilder2.\n         * @param listWildBuilder2  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWildBuilder2(List<? extends Address> listWildBuilder2) {\n            JodaBeanUtils.notNull(listWildBuilder2, \"listWildBuilder2\");\n            this.listWildBuilder2 = listWildBuilder2;\n            return this;\n        }\n\n        /**\n         * Sets the {@code listWildBuilder2} property in the builder\n         * from an array of objects.\n         * @param listWildBuilder2  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWildBuilder2(Address... listWildBuilder2) {\n            return listWildBuilder2(ImmutableList.copyOf(listWildBuilder2));\n        }\n\n        /**\n         * Sets the mapWildBuilder1.\n         * @param mapWildBuilder1  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> mapWildBuilder1(Map<String, ? extends Address> mapWildBuilder1) {\n            JodaBeanUtils.notNull(mapWildBuilder1, \"mapWildBuilder1\");\n            this.mapWildBuilder1 = mapWildBuilder1;\n            return this;\n        }\n\n        /**\n         * Sets the mapWildKey.\n         * @param mapWildKey  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> mapWildKey(Map<? extends Number, String> mapWildKey) {\n            JodaBeanUtils.notNull(mapWildKey, \"mapWildKey\");\n            this.mapWildKey = mapWildKey;\n            return this;\n        }\n\n        /**\n         * Sets the table.\n         * @param table  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> table(Table<String, Integer, String> table) {\n            JodaBeanUtils.notNull(table, \"table\");\n            this.table = table;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(1152);\n            buf.append(\"ImmGuava.Builder{\");\n            buf.append(\"collection\").append('=').append(JodaBeanUtils.toString(collection)).append(',').append(' ');\n            buf.append(\"list\").append('=').append(JodaBeanUtils.toString(list)).append(',').append(' ');\n            buf.append(\"set\").append('=').append(JodaBeanUtils.toString(set)).append(',').append(' ');\n            buf.append(\"sortedSet\").append('=').append(JodaBeanUtils.toString(sortedSet)).append(',').append(' ');\n            buf.append(\"map\").append('=').append(JodaBeanUtils.toString(map)).append(',').append(' ');\n            buf.append(\"sortedMap\").append('=').append(JodaBeanUtils.toString(sortedMap)).append(',').append(' ');\n            buf.append(\"biMap\").append('=').append(JodaBeanUtils.toString(biMap)).append(',').append(' ');\n            buf.append(\"multimap\").append('=').append(JodaBeanUtils.toString(multimap)).append(',').append(' ');\n            buf.append(\"listMultimap\").append('=').append(JodaBeanUtils.toString(listMultimap)).append(',').append(' ');\n            buf.append(\"setMultimap\").append('=').append(JodaBeanUtils.toString(setMultimap)).append(',').append(' ');\n            buf.append(\"multiset\").append('=').append(JodaBeanUtils.toString(multiset)).append(',').append(' ');\n            buf.append(\"sortedMultiset\").append('=').append(JodaBeanUtils.toString(sortedMultiset)).append(',').append(' ');\n            buf.append(\"collectionInterface\").append('=').append(JodaBeanUtils.toString(collectionInterface)).append(',').append(' ');\n            buf.append(\"listInterface\").append('=').append(JodaBeanUtils.toString(listInterface)).append(',').append(' ');\n            buf.append(\"setInterface\").append('=').append(JodaBeanUtils.toString(setInterface)).append(',').append(' ');\n            buf.append(\"sortedSetInterface\").append('=').append(JodaBeanUtils.toString(sortedSetInterface)).append(',').append(' ');\n            buf.append(\"mapInterface\").append('=').append(JodaBeanUtils.toString(mapInterface)).append(',').append(' ');\n            buf.append(\"sortedMapInterface\").append('=').append(JodaBeanUtils.toString(sortedMapInterface)).append(',').append(' ');\n            buf.append(\"biMapInterface\").append('=').append(JodaBeanUtils.toString(biMapInterface)).append(',').append(' ');\n            buf.append(\"multimapInterface\").append('=').append(JodaBeanUtils.toString(multimapInterface)).append(',').append(' ');\n            buf.append(\"listMultimapInterface\").append('=').append(JodaBeanUtils.toString(listMultimapInterface)).append(',').append(' ');\n            buf.append(\"setMultimapInterface\").append('=').append(JodaBeanUtils.toString(setMultimapInterface)).append(',').append(' ');\n            buf.append(\"multisetInterface\").append('=').append(JodaBeanUtils.toString(multisetInterface)).append(',').append(' ');\n            buf.append(\"sortedMultisetInterface\").append('=').append(JodaBeanUtils.toString(sortedMultisetInterface)).append(',').append(' ');\n            buf.append(\"listWildExtendsT\").append('=').append(JodaBeanUtils.toString(listWildExtendsT)).append(',').append(' ');\n            buf.append(\"listWildExtendsNumber\").append('=').append(JodaBeanUtils.toString(listWildExtendsNumber)).append(',').append(' ');\n            buf.append(\"listWildExtendsComparable\").append('=').append(JodaBeanUtils.toString(listWildExtendsComparable)).append(',').append(' ');\n            buf.append(\"setWildExtendsT\").append('=').append(JodaBeanUtils.toString(setWildExtendsT)).append(',').append(' ');\n            buf.append(\"setWildExtendsNumber\").append('=').append(JodaBeanUtils.toString(setWildExtendsNumber)).append(',').append(' ');\n            buf.append(\"setWildExtendsComparable\").append('=').append(JodaBeanUtils.toString(setWildExtendsComparable)).append(',').append(' ');\n            buf.append(\"listWildBuilder1\").append('=').append(JodaBeanUtils.toString(listWildBuilder1)).append(',').append(' ');\n            buf.append(\"listWildBuilder2\").append('=').append(JodaBeanUtils.toString(listWildBuilder2)).append(',').append(' ');\n            buf.append(\"mapWildBuilder1\").append('=').append(JodaBeanUtils.toString(mapWildBuilder1)).append(',').append(' ');\n            buf.append(\"mapWildKey\").append('=').append(JodaBeanUtils.toString(mapWildKey)).append(',').append(' ');\n            buf.append(\"table\").append('=').append(JodaBeanUtils.toString(table));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmJodaConvertBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\nimport org.joda.convert.FromString;\nimport org.joda.convert.ToString;\n\n/**\n * An immutable bean that is also a Joda-Convert type, used for testing.\n */\n@BeanDefinition\npublic final class ImmJodaConvertBean implements ImmutableBean {\n\n    /**\n     * The base value.\n     */\n    @PropertyDefinition\n    private final String base;\n    /**\n     * The extra value.\n     */\n    @PropertyDefinition\n    private final int extra;\n\n    @FromString\n    public ImmJodaConvertBean(String text) {\n        base = text.substring(0, text.indexOf(':'));\n        extra = Integer.parseInt(text.substring(text.indexOf(':') + 1));\n    }\n\n    @ToString\n    public String formattedString() {\n        return base + \":\" + extra;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmJodaConvertBean}.\n     * @return the meta-bean, not null\n     */\n    public static ImmJodaConvertBean.Meta meta() {\n        return ImmJodaConvertBean.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmJodaConvertBean.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmJodaConvertBean.Builder builder() {\n        return new ImmJodaConvertBean.Builder();\n    }\n\n    private ImmJodaConvertBean(\n            String base,\n            int extra) {\n        this.base = base;\n        this.extra = extra;\n    }\n\n    @Override\n    public ImmJodaConvertBean.Meta metaBean() {\n        return ImmJodaConvertBean.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the base value.\n     * @return the value of the property\n     */\n    public String getBase() {\n        return base;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the extra value.\n     * @return the value of the property\n     */\n    public int getExtra() {\n        return extra;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmJodaConvertBean other = (ImmJodaConvertBean) obj;\n            return JodaBeanUtils.equal(this.base, other.base) &&\n                    (this.extra == other.extra);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(base);\n        hash = hash * 31 + JodaBeanUtils.hashCode(extra);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"ImmJodaConvertBean{\");\n        buf.append(\"base\").append('=').append(JodaBeanUtils.toString(base)).append(',').append(' ');\n        buf.append(\"extra\").append('=').append(JodaBeanUtils.toString(extra));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmJodaConvertBean}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code base} property.\n         */\n        private final MetaProperty<String> base = DirectMetaProperty.ofImmutable(\n                this, \"base\", ImmJodaConvertBean.class, String.class);\n        /**\n         * The meta-property for the {@code extra} property.\n         */\n        private final MetaProperty<Integer> extra = DirectMetaProperty.ofImmutable(\n                this, \"extra\", ImmJodaConvertBean.class, Integer.TYPE);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"base\",\n                \"extra\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3016401:  // base\n                    return this.base;\n                case 96965648:  // extra\n                    return this.extra;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmJodaConvertBean.Builder builder() {\n            return new ImmJodaConvertBean.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmJodaConvertBean> beanType() {\n            return ImmJodaConvertBean.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code base} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> base() {\n            return base;\n        }\n\n        /**\n         * The meta-property for the {@code extra} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Integer> extra() {\n            return extra;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3016401:  // base\n                    return ((ImmJodaConvertBean) bean).getBase();\n                case 96965648:  // extra\n                    return ((ImmJodaConvertBean) bean).getExtra();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmJodaConvertBean}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmJodaConvertBean> {\n\n        private String base;\n        private int extra;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmJodaConvertBean beanToCopy) {\n            this.base = beanToCopy.getBase();\n            this.extra = beanToCopy.getExtra();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3016401:  // base\n                    return this.base;\n                case 96965648:  // extra\n                    return this.extra;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 3016401:  // base\n                    this.base = (String) newValue;\n                    break;\n                case 96965648:  // extra\n                    this.extra = (Integer) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmJodaConvertBean build() {\n            return new ImmJodaConvertBean(\n                    base,\n                    extra);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the base value.\n         * @param base  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder base(String base) {\n            this.base = base;\n            return this;\n        }\n\n        /**\n         * Sets the extra value.\n         * @param extra  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder extra(int extra) {\n            this.extra = extra;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(96);\n            buf.append(\"ImmJodaConvertBean.Builder{\");\n            buf.append(\"base\").append('=').append(JodaBeanUtils.toString(base)).append(',').append(' ');\n            buf.append(\"extra\").append('=').append(JodaBeanUtils.toString(extra));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmJodaConvertWrapper.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Wraps {@code ImmJodaConvertBean}, used for testing.\n */\n@BeanDefinition(factoryName = \"of\")\npublic final class ImmJodaConvertWrapper implements ImmutableBean {\n\n    /**\n     * The base value.\n     */\n    @PropertyDefinition\n    private final ImmJodaConvertBean bean;\n    /**\n     * The extra value.\n     */\n    @PropertyDefinition\n    private final String description;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmJodaConvertWrapper}.\n     * @return the meta-bean, not null\n     */\n    public static ImmJodaConvertWrapper.Meta meta() {\n        return ImmJodaConvertWrapper.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmJodaConvertWrapper.Meta.INSTANCE);\n    }\n\n    /**\n     * Obtains an instance.\n     * @param bean  the value of the property\n     * @param description  the value of the property\n     * @return the instance\n     */\n    public static ImmJodaConvertWrapper of(\n            ImmJodaConvertBean bean,\n            String description) {\n        return new ImmJodaConvertWrapper(\n            bean,\n            description);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmJodaConvertWrapper.Builder builder() {\n        return new ImmJodaConvertWrapper.Builder();\n    }\n\n    private ImmJodaConvertWrapper(\n            ImmJodaConvertBean bean,\n            String description) {\n        this.bean = bean;\n        this.description = description;\n    }\n\n    @Override\n    public ImmJodaConvertWrapper.Meta metaBean() {\n        return ImmJodaConvertWrapper.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the base value.\n     * @return the value of the property\n     */\n    public ImmJodaConvertBean getBean() {\n        return bean;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the extra value.\n     * @return the value of the property\n     */\n    public String getDescription() {\n        return description;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmJodaConvertWrapper other = (ImmJodaConvertWrapper) obj;\n            return JodaBeanUtils.equal(this.bean, other.bean) &&\n                    JodaBeanUtils.equal(this.description, other.description);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(bean);\n        hash = hash * 31 + JodaBeanUtils.hashCode(description);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"ImmJodaConvertWrapper{\");\n        buf.append(\"bean\").append('=').append(JodaBeanUtils.toString(bean)).append(',').append(' ');\n        buf.append(\"description\").append('=').append(JodaBeanUtils.toString(description));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmJodaConvertWrapper}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code bean} property.\n         */\n        private final MetaProperty<ImmJodaConvertBean> bean = DirectMetaProperty.ofImmutable(\n                this, \"bean\", ImmJodaConvertWrapper.class, ImmJodaConvertBean.class);\n        /**\n         * The meta-property for the {@code description} property.\n         */\n        private final MetaProperty<String> description = DirectMetaProperty.ofImmutable(\n                this, \"description\", ImmJodaConvertWrapper.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"bean\",\n                \"description\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3019696:  // bean\n                    return this.bean;\n                case -1724546052:  // description\n                    return this.description;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmJodaConvertWrapper.Builder builder() {\n            return new ImmJodaConvertWrapper.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmJodaConvertWrapper> beanType() {\n            return ImmJodaConvertWrapper.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code bean} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmJodaConvertBean> bean() {\n            return bean;\n        }\n\n        /**\n         * The meta-property for the {@code description} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> description() {\n            return description;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3019696:  // bean\n                    return ((ImmJodaConvertWrapper) bean).getBean();\n                case -1724546052:  // description\n                    return ((ImmJodaConvertWrapper) bean).getDescription();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmJodaConvertWrapper}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmJodaConvertWrapper> {\n\n        private ImmJodaConvertBean bean;\n        private String description;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmJodaConvertWrapper beanToCopy) {\n            this.bean = beanToCopy.getBean();\n            this.description = beanToCopy.getDescription();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3019696:  // bean\n                    return this.bean;\n                case -1724546052:  // description\n                    return this.description;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 3019696:  // bean\n                    this.bean = (ImmJodaConvertBean) newValue;\n                    break;\n                case -1724546052:  // description\n                    this.description = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmJodaConvertWrapper build() {\n            return new ImmJodaConvertWrapper(\n                    bean,\n                    description);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the base value.\n         * @param bean  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder bean(ImmJodaConvertBean bean) {\n            this.bean = bean;\n            return this;\n        }\n\n        /**\n         * Sets the extra value.\n         * @param description  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder description(String description) {\n            this.description = description;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(96);\n            buf.append(\"ImmJodaConvertWrapper.Builder{\");\n            buf.append(\"bean\").append('=').append(JodaBeanUtils.toString(bean)).append(',').append(' ');\n            buf.append(\"description\").append('=').append(JodaBeanUtils.toString(description));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmKey.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\nimport org.joda.beans.ser.SerDeserializer;\n\n/**\n * Mock key JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(constructorScope = \"private\")\npublic final class ImmKey implements ImmutableBean, IKey, Serializable {\n\n    /**\n     * The name.\n     * The name is unique in conjunction with the type.\n     */\n    @PropertyDefinition(validate = \"notEmpty\", overrideGet = true)\n    private final String name;\n\n    /**\n     * The deserializer.\n     */\n    public static final SerDeserializer DESERIALIZER = new ImmKeyDeserializer();\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmKey}.\n     * @return the meta-bean, not null\n     */\n    public static ImmKey.Meta meta() {\n        return ImmKey.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmKey.Meta.INSTANCE);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmKey.Builder builder() {\n        return new ImmKey.Builder();\n    }\n\n    private ImmKey(\n            String name) {\n        JodaBeanUtils.notEmpty(name, \"name\");\n        this.name = name;\n    }\n\n    @Override\n    public ImmKey.Meta metaBean() {\n        return ImmKey.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * The name is unique in conjunction with the type.\n     * @return the value of the property, not empty\n     */\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmKey other = (ImmKey) obj;\n            return JodaBeanUtils.equal(this.name, other.name);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(name);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmKey{\");\n        buf.append(\"name\").append('=').append(JodaBeanUtils.toString(name));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmKey}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code name} property.\n         */\n        private final MetaProperty<String> name = DirectMetaProperty.ofImmutable(\n                this, \"name\", ImmKey.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"name\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmKey.Builder builder() {\n            return new ImmKey.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmKey> beanType() {\n            return ImmKey.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code name} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> name() {\n            return name;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return ((ImmKey) bean).getName();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmKey}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmKey> {\n\n        private String name;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmKey beanToCopy) {\n            this.name = beanToCopy.getName();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    this.name = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmKey build() {\n            return new ImmKey(\n                    name);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the name.\n         * The name is unique in conjunction with the type.\n         * @param name  the new value, not empty\n         * @return this, for chaining, not null\n         */\n        public Builder name(String name) {\n            JodaBeanUtils.notEmpty(name, \"name\");\n            this.name = name;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmKey.Builder{\");\n            buf.append(\"name\").append('=').append(JodaBeanUtils.toString(name));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmKeyDeserializer.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.ser.DefaultDeserializer;\n\n/**\n * Mock deserializer.\n */\nfinal class ImmKeyDeserializer extends DefaultDeserializer {\n\n    @Override\n    public MetaProperty<?> findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName) {\n        if (\"key\".equals(propertyName)) {\n            return metaBean.metaProperty(\"name\");\n        }\n        return super.findMetaProperty(beanType, metaBean, propertyName);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmKeyHolder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\nimport org.joda.beans.ser.SerDeserializer;\n\n/**\n * Mock key JavaBean, used for testing.\n */\n@BeanDefinition\npublic final class ImmKeyHolder implements ImmutableBean, Serializable {\n\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmKey value;\n\n    /**\n     * The deserializer.\n     */\n    public static final SerDeserializer DESERIALIZER = new ImmKeyHolderDeserializer();\n  \n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmKeyHolder}.\n     * @return the meta-bean, not null\n     */\n    public static ImmKeyHolder.Meta meta() {\n        return ImmKeyHolder.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmKeyHolder.Meta.INSTANCE);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmKeyHolder.Builder builder() {\n        return new ImmKeyHolder.Builder();\n    }\n\n    private ImmKeyHolder(\n            ImmKey value) {\n        JodaBeanUtils.notNull(value, \"value\");\n        this.value = value;\n    }\n\n    @Override\n    public ImmKeyHolder.Meta metaBean() {\n        return ImmKeyHolder.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the value.\n     * @return the value of the property, not null\n     */\n    public ImmKey getValue() {\n        return value;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmKeyHolder other = (ImmKeyHolder) obj;\n            return JodaBeanUtils.equal(this.value, other.value);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(value);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmKeyHolder{\");\n        buf.append(\"value\").append('=').append(JodaBeanUtils.toString(value));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmKeyHolder}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code value} property.\n         */\n        private final MetaProperty<ImmKey> value = DirectMetaProperty.ofImmutable(\n                this, \"value\", ImmKeyHolder.class, ImmKey.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"value\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmKeyHolder.Builder builder() {\n            return new ImmKeyHolder.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmKeyHolder> beanType() {\n            return ImmKeyHolder.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code value} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmKey> value() {\n            return value;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return ((ImmKeyHolder) bean).getValue();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmKeyHolder}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmKeyHolder> {\n\n        private ImmKey value;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmKeyHolder beanToCopy) {\n            this.value = beanToCopy.getValue();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    this.value = (ImmKey) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmKeyHolder build() {\n            return new ImmKeyHolder(\n                    value);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the value.\n         * @param value  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder value(ImmKey value) {\n            JodaBeanUtils.notNull(value, \"value\");\n            this.value = value;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmKeyHolder.Builder{\");\n            buf.append(\"value\").append('=').append(JodaBeanUtils.toString(value));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmKeyHolderDeserializer.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.lang.reflect.Type;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.impl.BufferingBeanBuilder;\nimport org.joda.beans.impl.StandaloneMetaProperty;\nimport org.joda.beans.ser.DefaultDeserializer;\n\nimport com.google.common.reflect.TypeToken;\n\n/**\n * Mock deserializer.\n */\nfinal class ImmKeyHolderDeserializer extends DefaultDeserializer {\n\n    @SuppressWarnings(\"serial\")\n    private static final Type VALUE_TYPE = new TypeToken<ImmGeneric<String>>() {\n    }.getType();\n\n    @SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n    private static final StandaloneMetaProperty<ImmGeneric<String>> VALUE_PROPERTY = StandaloneMetaProperty.of(\n            \"value\",\n            ImmKeyHolder.meta(),\n            (Class) ImmGeneric.class,\n            VALUE_TYPE);\n\n    ImmKeyHolderDeserializer() {\n    }\n\n    @Override\n    public BeanBuilder<?> createBuilder(Class<?> beanType, MetaBean metaBean) {\n        return BufferingBeanBuilder.of(metaBean);\n    }\n\n    @Override\n    public MetaProperty<?> findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName) {\n        if (propertyName.equals(VALUE_PROPERTY.name())) {\n            return VALUE_PROPERTY;\n        } else {\n            return metaBean.metaProperty(propertyName);\n        }\n    }\n\n    @Override\n    public void setValue(BeanBuilder<?> builder, MetaProperty<?> metaProp, Object value) {\n        if (metaProp.equals(VALUE_PROPERTY)) {\n            ImmGeneric<?> generic = (ImmGeneric<?>) value;\n            builder.set(ImmKeyHolder.meta().value(), toImmKey(generic));\n        } else {\n            builder.set(metaProp, value);\n        }\n    }\n\n    private ImmKey toImmKey(ImmGeneric<?> generic) {\n        return ImmKey.builder()\n                .name(String.valueOf(generic.getValue()))\n                .build();\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmKeyList.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.collect.ImmutableList;\n\n/**\n * Mock list of keys JavaBean, used for testing.\n */\n@BeanDefinition(constructorScope = \"private\")\npublic final class ImmKeyList implements ImmutableBean, Serializable {\n\n    /**\n     * The keys.\n     */\n    @PropertyDefinition(validate = \"notEmpty\")\n    private final ImmutableList<IKey> keys;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmKeyList}.\n     * @return the meta-bean, not null\n     */\n    public static ImmKeyList.Meta meta() {\n        return ImmKeyList.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmKeyList.Meta.INSTANCE);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmKeyList.Builder builder() {\n        return new ImmKeyList.Builder();\n    }\n\n    private ImmKeyList(\n            List<IKey> keys) {\n        JodaBeanUtils.notEmpty(keys, \"keys\");\n        this.keys = ImmutableList.copyOf(keys);\n    }\n\n    @Override\n    public ImmKeyList.Meta metaBean() {\n        return ImmKeyList.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the keys.\n     * @return the value of the property, not empty\n     */\n    public ImmutableList<IKey> getKeys() {\n        return keys;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmKeyList other = (ImmKeyList) obj;\n            return JodaBeanUtils.equal(this.keys, other.keys);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(keys);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmKeyList{\");\n        buf.append(\"keys\").append('=').append(JodaBeanUtils.toString(keys));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmKeyList}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code keys} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableList<IKey>> keys = DirectMetaProperty.ofImmutable(\n                this, \"keys\", ImmKeyList.class, (Class) ImmutableList.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"keys\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3288564:  // keys\n                    return this.keys;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmKeyList.Builder builder() {\n            return new ImmKeyList.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmKeyList> beanType() {\n            return ImmKeyList.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code keys} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableList<IKey>> keys() {\n            return keys;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3288564:  // keys\n                    return ((ImmKeyList) bean).getKeys();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmKeyList}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmKeyList> {\n\n        private List<IKey> keys = ImmutableList.of();\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmKeyList beanToCopy) {\n            this.keys = beanToCopy.getKeys();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3288564:  // keys\n                    return this.keys;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 3288564:  // keys\n                    this.keys = (List<IKey>) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmKeyList build() {\n            return new ImmKeyList(\n                    keys);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the keys.\n         * @param keys  the new value, not empty\n         * @return this, for chaining, not null\n         */\n        public Builder keys(List<IKey> keys) {\n            JodaBeanUtils.notEmpty(keys, \"keys\");\n            this.keys = keys;\n            return this;\n        }\n\n        /**\n         * Sets the {@code keys} property in the builder\n         * from an array of objects.\n         * @param keys  the new value, not empty\n         * @return this, for chaining, not null\n         */\n        public Builder keys(IKey... keys) {\n            return keys(ImmutableList.copyOf(keys));\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmKeyList.Builder{\");\n            buf.append(\"keys\").append('=').append(JodaBeanUtils.toString(keys));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmMappedKey.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.collect.ImmutableMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(constructorScope = \"private\")\npublic final class ImmMappedKey\n        implements\n                ImmutableBean, \n                Serializable {\n    // note each element on a new line\n\n    /**\n     * The map of data, keyed by an arbitrary key interface.\n     */\n    @PropertyDefinition(validate = \"notNull\", builderType = \"Map<? extends IKey, ?>\")\n    private final ImmutableMap<IKey, Object> data;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmMappedKey}.\n     * @return the meta-bean, not null\n     */\n    public static ImmMappedKey.Meta meta() {\n        return ImmMappedKey.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmMappedKey.Meta.INSTANCE);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmMappedKey.Builder builder() {\n        return new ImmMappedKey.Builder();\n    }\n\n    private ImmMappedKey(\n            Map<? extends IKey, ?> data) {\n        JodaBeanUtils.notNull(data, \"data\");\n        this.data = ImmutableMap.copyOf(data);\n    }\n\n    @Override\n    public ImmMappedKey.Meta metaBean() {\n        return ImmMappedKey.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the map of data, keyed by an arbitrary key interface.\n     * @return the value of the property, not null\n     */\n    public ImmutableMap<IKey, Object> getData() {\n        return data;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmMappedKey other = (ImmMappedKey) obj;\n            return JodaBeanUtils.equal(this.data, other.data);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(data);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmMappedKey{\");\n        buf.append(\"data\").append('=').append(JodaBeanUtils.toString(data));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmMappedKey}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code data} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<IKey, Object>> data = DirectMetaProperty.ofImmutable(\n                this, \"data\", ImmMappedKey.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"data\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3076010:  // data\n                    return this.data;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmMappedKey.Builder builder() {\n            return new ImmMappedKey.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmMappedKey> beanType() {\n            return ImmMappedKey.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code data} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<IKey, Object>> data() {\n            return data;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3076010:  // data\n                    return ((ImmMappedKey) bean).getData();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmMappedKey}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmMappedKey> {\n\n        private Map<? extends IKey, ?> data = ImmutableMap.of();\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmMappedKey beanToCopy) {\n            this.data = beanToCopy.getData();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3076010:  // data\n                    return this.data;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 3076010:  // data\n                    this.data = (Map<? extends IKey, ?>) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmMappedKey build() {\n            return new ImmMappedKey(\n                    data);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the map of data, keyed by an arbitrary key interface.\n         * @param data  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder data(Map<? extends IKey, ?> data) {\n            JodaBeanUtils.notNull(data, \"data\");\n            this.data = data;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmMappedKey.Builder{\");\n            buf.append(\"data\").append('=').append(JodaBeanUtils.toString(data));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmMinimalMetaBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectPrivateBeanBuilder;\nimport org.joda.beans.impl.direct.MinimalMetaBean;\n\n/**\n * Mock address JavaBean, used for testing.\n * <p>\n * Minimal with private scope meta and builder.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"minimal\", builderScope = \"private\", metaScope = \"private\")\npublic final class ImmMinimalMetaBuilder implements ImmutableBean {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final int number;\n    /**\n     * The street.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final String street;\n    /**\n     * The city.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final String city;\n    /**\n     * The owner.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmPerson owner;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmMinimalMetaBuilder}.\n     */\n    private static final TypedMetaBean<ImmMinimalMetaBuilder> META_BEAN =\n            MinimalMetaBean.of(\n                    ImmMinimalMetaBuilder.class,\n                    new String[] {\n                            \"number\",\n                            \"street\",\n                            \"city\",\n                            \"owner\"},\n                    () -> new ImmMinimalMetaBuilder.Builder(),\n                    b -> b.getNumber(),\n                    b -> b.getStreet(),\n                    b -> b.getCity(),\n                    b -> b.getOwner());\n\n    /**\n     * The meta-bean for {@code ImmMinimalMetaBuilder}.\n     * @return the meta-bean, not null\n     */\n    public static TypedMetaBean<ImmMinimalMetaBuilder> meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    private ImmMinimalMetaBuilder(\n            int number,\n            String street,\n            String city,\n            ImmPerson owner) {\n        JodaBeanUtils.notNull(street, \"street\");\n        JodaBeanUtils.notNull(city, \"city\");\n        JodaBeanUtils.notNull(owner, \"owner\");\n        this.number = number;\n        this.street = street;\n        this.city = city;\n        this.owner = owner;\n    }\n\n    @Override\n    public TypedMetaBean<ImmMinimalMetaBuilder> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public int getNumber() {\n        return number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the street.\n     * @return the value of the property, not null\n     */\n    public String getStreet() {\n        return street;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the city.\n     * @return the value of the property, not null\n     */\n    public String getCity() {\n        return city;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the owner.\n     * @return the value of the property, not null\n     */\n    public ImmPerson getOwner() {\n        return owner;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmMinimalMetaBuilder other = (ImmMinimalMetaBuilder) obj;\n            return (this.number == other.number) &&\n                    JodaBeanUtils.equal(this.street, other.street) &&\n                    JodaBeanUtils.equal(this.city, other.city) &&\n                    JodaBeanUtils.equal(this.owner, other.owner);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(number);\n        hash = hash * 31 + JodaBeanUtils.hashCode(street);\n        hash = hash * 31 + JodaBeanUtils.hashCode(city);\n        hash = hash * 31 + JodaBeanUtils.hashCode(owner);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(160);\n        buf.append(\"ImmMinimalMetaBuilder{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n        buf.append(\"street\").append('=').append(JodaBeanUtils.toString(street)).append(',').append(' ');\n        buf.append(\"city\").append('=').append(JodaBeanUtils.toString(city)).append(',').append(' ');\n        buf.append(\"owner\").append('=').append(JodaBeanUtils.toString(owner));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmMinimalMetaBuilder}.\n     */\n    private static final class Builder extends DirectPrivateBeanBuilder<ImmMinimalMetaBuilder> {\n\n        private int number;\n        private String street;\n        private String city;\n        private ImmPerson owner;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    return this.number;\n                case -891990013:  // street\n                    return this.street;\n                case 3053931:  // city\n                    return this.city;\n                case 106164915:  // owner\n                    return this.owner;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    this.number = (Integer) newValue;\n                    break;\n                case -891990013:  // street\n                    this.street = (String) newValue;\n                    break;\n                case 3053931:  // city\n                    this.city = (String) newValue;\n                    break;\n                case 106164915:  // owner\n                    this.owner = (ImmPerson) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public ImmMinimalMetaBuilder build() {\n            return new ImmMinimalMetaBuilder(\n                    number,\n                    street,\n                    city,\n                    owner);\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(160);\n            buf.append(\"ImmMinimalMetaBuilder.Builder{\");\n            buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n            buf.append(\"street\").append('=').append(JodaBeanUtils.toString(street)).append(',').append(' ');\n            buf.append(\"city\").append('=').append(JodaBeanUtils.toString(city)).append(',').append(' ');\n            buf.append(\"owner\").append('=').append(JodaBeanUtils.toString(owner));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmMinimalPrivateBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectPrivateBeanBuilder;\nimport org.joda.beans.impl.direct.MinimalMetaBean;\n\n/**\n * Mock address JavaBean, used for testing.\n * <p>\n * Minimal with private scope builder.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"minimal\", builderScope = \"private\")\npublic final class ImmMinimalPrivateBuilder implements ImmutableBean {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final int number;\n    /**\n     * The street.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final String street;\n    /**\n     * The city.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final String city;\n    /**\n     * The owner.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmPerson owner;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmMinimalPrivateBuilder}.\n     */\n    private static final TypedMetaBean<ImmMinimalPrivateBuilder> META_BEAN =\n            MinimalMetaBean.of(\n                    ImmMinimalPrivateBuilder.class,\n                    new String[] {\n                            \"number\",\n                            \"street\",\n                            \"city\",\n                            \"owner\"},\n                    () -> new ImmMinimalPrivateBuilder.Builder(),\n                    b -> b.getNumber(),\n                    b -> b.getStreet(),\n                    b -> b.getCity(),\n                    b -> b.getOwner());\n\n    /**\n     * The meta-bean for {@code ImmMinimalPrivateBuilder}.\n     * @return the meta-bean, not null\n     */\n    public static TypedMetaBean<ImmMinimalPrivateBuilder> meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    private ImmMinimalPrivateBuilder(\n            int number,\n            String street,\n            String city,\n            ImmPerson owner) {\n        JodaBeanUtils.notNull(street, \"street\");\n        JodaBeanUtils.notNull(city, \"city\");\n        JodaBeanUtils.notNull(owner, \"owner\");\n        this.number = number;\n        this.street = street;\n        this.city = city;\n        this.owner = owner;\n    }\n\n    @Override\n    public TypedMetaBean<ImmMinimalPrivateBuilder> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public int getNumber() {\n        return number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the street.\n     * @return the value of the property, not null\n     */\n    public String getStreet() {\n        return street;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the city.\n     * @return the value of the property, not null\n     */\n    public String getCity() {\n        return city;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the owner.\n     * @return the value of the property, not null\n     */\n    public ImmPerson getOwner() {\n        return owner;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmMinimalPrivateBuilder other = (ImmMinimalPrivateBuilder) obj;\n            return (this.number == other.number) &&\n                    JodaBeanUtils.equal(this.street, other.street) &&\n                    JodaBeanUtils.equal(this.city, other.city) &&\n                    JodaBeanUtils.equal(this.owner, other.owner);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(number);\n        hash = hash * 31 + JodaBeanUtils.hashCode(street);\n        hash = hash * 31 + JodaBeanUtils.hashCode(city);\n        hash = hash * 31 + JodaBeanUtils.hashCode(owner);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(160);\n        buf.append(\"ImmMinimalPrivateBuilder{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n        buf.append(\"street\").append('=').append(JodaBeanUtils.toString(street)).append(',').append(' ');\n        buf.append(\"city\").append('=').append(JodaBeanUtils.toString(city)).append(',').append(' ');\n        buf.append(\"owner\").append('=').append(JodaBeanUtils.toString(owner));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmMinimalPrivateBuilder}.\n     */\n    private static final class Builder extends DirectPrivateBeanBuilder<ImmMinimalPrivateBuilder> {\n\n        private int number;\n        private String street;\n        private String city;\n        private ImmPerson owner;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    return this.number;\n                case -891990013:  // street\n                    return this.street;\n                case 3053931:  // city\n                    return this.city;\n                case 106164915:  // owner\n                    return this.owner;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    this.number = (Integer) newValue;\n                    break;\n                case -891990013:  // street\n                    this.street = (String) newValue;\n                    break;\n                case 3053931:  // city\n                    this.city = (String) newValue;\n                    break;\n                case 106164915:  // owner\n                    this.owner = (ImmPerson) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public ImmMinimalPrivateBuilder build() {\n            return new ImmMinimalPrivateBuilder(\n                    number,\n                    street,\n                    city,\n                    owner);\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(160);\n            buf.append(\"ImmMinimalPrivateBuilder.Builder{\");\n            buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n            buf.append(\"street\").append('=').append(JodaBeanUtils.toString(street)).append(',').append(' ');\n            buf.append(\"city\").append('=').append(JodaBeanUtils.toString(city)).append(',').append(' ');\n            buf.append(\"owner\").append('=').append(JodaBeanUtils.toString(owner));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmNamedKey.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock key JavaBean implementing Joda-Convert interface, used for testing.\n */\n@BeanDefinition(constructorScope = \"private\", factoryName = \"of\")\npublic final class ImmNamedKey implements ImmutableBean, INamedKey, Serializable {\n\n    /**\n     * The name.\n     */\n    @PropertyDefinition(validate = \"notEmpty\", overrideGet = true)\n    private final String name;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmNamedKey}.\n     * @return the meta-bean, not null\n     */\n    public static ImmNamedKey.Meta meta() {\n        return ImmNamedKey.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmNamedKey.Meta.INSTANCE);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Obtains an instance.\n     * @param name  the value of the property, not empty\n     * @return the instance\n     */\n    public static ImmNamedKey of(\n            String name) {\n        return new ImmNamedKey(\n            name);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmNamedKey.Builder builder() {\n        return new ImmNamedKey.Builder();\n    }\n\n    private ImmNamedKey(\n            String name) {\n        JodaBeanUtils.notEmpty(name, \"name\");\n        this.name = name;\n    }\n\n    @Override\n    public ImmNamedKey.Meta metaBean() {\n        return ImmNamedKey.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property, not empty\n     */\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmNamedKey other = (ImmNamedKey) obj;\n            return JodaBeanUtils.equal(this.name, other.name);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(name);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmNamedKey{\");\n        buf.append(\"name\").append('=').append(JodaBeanUtils.toString(name));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmNamedKey}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code name} property.\n         */\n        private final MetaProperty<String> name = DirectMetaProperty.ofImmutable(\n                this, \"name\", ImmNamedKey.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"name\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmNamedKey.Builder builder() {\n            return new ImmNamedKey.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmNamedKey> beanType() {\n            return ImmNamedKey.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code name} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> name() {\n            return name;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return ((ImmNamedKey) bean).getName();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmNamedKey}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmNamedKey> {\n\n        private String name;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmNamedKey beanToCopy) {\n            this.name = beanToCopy.getName();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    this.name = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmNamedKey build() {\n            return new ImmNamedKey(\n                    name);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the name.\n         * @param name  the new value, not empty\n         * @return this, for chaining, not null\n         */\n        public Builder name(String name) {\n            JodaBeanUtils.notEmpty(name, \"name\");\n            this.name = name;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmNamedKey.Builder{\");\n            buf.append(\"name\").append('=').append(JodaBeanUtils.toString(name));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmOptional.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.DerivedProperty;\nimport org.joda.beans.gen.ImmutableDefaults;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.base.Optional;\n\n/**\n * Mock.\n */\n@BeanDefinition(factoryName = \"of\", metaImplements = \"ImmOptionalMeta<String>\")\npublic final class ImmOptional implements ImmutableBean {\n\n    // this works but in serialization they fail for lists/maps\n    @PropertyDefinition(validate = \"notNull\")\n    private final Optional<String> optString;\n    @PropertyDefinition(validate = \"notNull\")\n    private final Optional<String> optStringEmpty;\n    // these are the recommended approach, nullable fields, optional getters\n    // remove \"Guava\" to test Java 8 generation\n    @PropertyDefinition(get = \"optionalGuava\")\n    private final String optStringGetter;\n    @PropertyDefinition(get = \"optionalGuava\")\n    private final Long optLongGetter;\n    @PropertyDefinition(get = \"optionalGuava\")\n    private final Integer optIntGetter;\n    @PropertyDefinition(get = \"optionalGuava\")\n    private final Double optDoubleGetter;\n\n    @DerivedProperty\n    public int getTwelve() {\n        return 12;\n    }\n    \n    @ImmutableDefaults\n    private static void applyDefaults(Builder builder) {\n        builder.optString = Optional.absent();\n        builder.optStringEmpty = Optional.absent();\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmOptional}.\n     * @return the meta-bean, not null\n     */\n    public static ImmOptional.Meta meta() {\n        return ImmOptional.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmOptional.Meta.INSTANCE);\n    }\n\n    /**\n     * Obtains an instance.\n     * @param optString  the value of the property, not null\n     * @param optStringEmpty  the value of the property, not null\n     * @param optStringGetter  the value of the property\n     * @param optLongGetter  the value of the property\n     * @param optIntGetter  the value of the property\n     * @param optDoubleGetter  the value of the property\n     * @return the instance\n     */\n    public static ImmOptional of(\n            Optional<String> optString,\n            Optional<String> optStringEmpty,\n            String optStringGetter,\n            Long optLongGetter,\n            Integer optIntGetter,\n            Double optDoubleGetter) {\n        return new ImmOptional(\n            optString,\n            optStringEmpty,\n            optStringGetter,\n            optLongGetter,\n            optIntGetter,\n            optDoubleGetter);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmOptional.Builder builder() {\n        return new ImmOptional.Builder();\n    }\n\n    private ImmOptional(\n            Optional<String> optString,\n            Optional<String> optStringEmpty,\n            String optStringGetter,\n            Long optLongGetter,\n            Integer optIntGetter,\n            Double optDoubleGetter) {\n        JodaBeanUtils.notNull(optString, \"optString\");\n        JodaBeanUtils.notNull(optStringEmpty, \"optStringEmpty\");\n        this.optString = optString;\n        this.optStringEmpty = optStringEmpty;\n        this.optStringGetter = optStringGetter;\n        this.optLongGetter = optLongGetter;\n        this.optIntGetter = optIntGetter;\n        this.optDoubleGetter = optDoubleGetter;\n    }\n\n    @Override\n    public ImmOptional.Meta metaBean() {\n        return ImmOptional.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the optString.\n     * @return the value of the property, not null\n     */\n    public Optional<String> getOptString() {\n        return optString;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the optStringEmpty.\n     * @return the value of the property, not null\n     */\n    public Optional<String> getOptStringEmpty() {\n        return optStringEmpty;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the optStringGetter.\n     * @return the optional value of the property, not null\n     */\n    public Optional<String> getOptStringGetter() {\n        return Optional.fromNullable(optStringGetter);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the optLongGetter.\n     * @return the optional value of the property, not null\n     */\n    public Optional<Long> getOptLongGetter() {\n        return Optional.fromNullable(optLongGetter);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the optIntGetter.\n     * @return the optional value of the property, not null\n     */\n    public Optional<Integer> getOptIntGetter() {\n        return Optional.fromNullable(optIntGetter);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the optDoubleGetter.\n     * @return the optional value of the property, not null\n     */\n    public Optional<Double> getOptDoubleGetter() {\n        return Optional.fromNullable(optDoubleGetter);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmOptional other = (ImmOptional) obj;\n            return JodaBeanUtils.equal(this.optString, other.optString) &&\n                    JodaBeanUtils.equal(this.optStringEmpty, other.optStringEmpty) &&\n                    JodaBeanUtils.equal(this.optStringGetter, other.optStringGetter) &&\n                    JodaBeanUtils.equal(this.optLongGetter, other.optLongGetter) &&\n                    JodaBeanUtils.equal(this.optIntGetter, other.optIntGetter) &&\n                    JodaBeanUtils.equal(this.optDoubleGetter, other.optDoubleGetter);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(optString);\n        hash = hash * 31 + JodaBeanUtils.hashCode(optStringEmpty);\n        hash = hash * 31 + JodaBeanUtils.hashCode(optStringGetter);\n        hash = hash * 31 + JodaBeanUtils.hashCode(optLongGetter);\n        hash = hash * 31 + JodaBeanUtils.hashCode(optIntGetter);\n        hash = hash * 31 + JodaBeanUtils.hashCode(optDoubleGetter);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(256);\n        buf.append(\"ImmOptional{\");\n        buf.append(\"optString\").append('=').append(JodaBeanUtils.toString(optString)).append(',').append(' ');\n        buf.append(\"optStringEmpty\").append('=').append(JodaBeanUtils.toString(optStringEmpty)).append(',').append(' ');\n        buf.append(\"optStringGetter\").append('=').append(JodaBeanUtils.toString(optStringGetter)).append(',').append(' ');\n        buf.append(\"optLongGetter\").append('=').append(JodaBeanUtils.toString(optLongGetter)).append(',').append(' ');\n        buf.append(\"optIntGetter\").append('=').append(JodaBeanUtils.toString(optIntGetter)).append(',').append(' ');\n        buf.append(\"optDoubleGetter\").append('=').append(JodaBeanUtils.toString(optDoubleGetter)).append(',').append(' ');\n        buf.append(\"twelve\").append('=').append(JodaBeanUtils.toString(getTwelve()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmOptional}.\n     */\n    public static final class Meta extends DirectMetaBean implements ImmOptionalMeta<String> {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code optString} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Optional<String>> optString = DirectMetaProperty.ofImmutable(\n                this, \"optString\", ImmOptional.class, (Class) Optional.class);\n        /**\n         * The meta-property for the {@code optStringEmpty} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Optional<String>> optStringEmpty = DirectMetaProperty.ofImmutable(\n                this, \"optStringEmpty\", ImmOptional.class, (Class) Optional.class);\n        /**\n         * The meta-property for the {@code optStringGetter} property.\n         */\n        private final MetaProperty<String> optStringGetter = DirectMetaProperty.ofImmutable(\n                this, \"optStringGetter\", ImmOptional.class, String.class);\n        /**\n         * The meta-property for the {@code optLongGetter} property.\n         */\n        private final MetaProperty<Long> optLongGetter = DirectMetaProperty.ofImmutable(\n                this, \"optLongGetter\", ImmOptional.class, Long.class);\n        /**\n         * The meta-property for the {@code optIntGetter} property.\n         */\n        private final MetaProperty<Integer> optIntGetter = DirectMetaProperty.ofImmutable(\n                this, \"optIntGetter\", ImmOptional.class, Integer.class);\n        /**\n         * The meta-property for the {@code optDoubleGetter} property.\n         */\n        private final MetaProperty<Double> optDoubleGetter = DirectMetaProperty.ofImmutable(\n                this, \"optDoubleGetter\", ImmOptional.class, Double.class);\n        /**\n         * The meta-property for the {@code twelve} property.\n         */\n        private final MetaProperty<Integer> twelve = DirectMetaProperty.ofDerived(\n                this, \"twelve\", ImmOptional.class, Integer.TYPE);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"optString\",\n                \"optStringEmpty\",\n                \"optStringGetter\",\n                \"optLongGetter\",\n                \"optIntGetter\",\n                \"optDoubleGetter\",\n                \"twelve\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 1220339876:  // optString\n                    return this.optString;\n                case -856788215:  // optStringEmpty\n                    return this.optStringEmpty;\n                case -740642097:  // optStringGetter\n                    return this.optStringGetter;\n                case 2046023098:  // optLongGetter\n                    return this.optLongGetter;\n                case -1931360153:  // optIntGetter\n                    return this.optIntGetter;\n                case 224984719:  // optDoubleGetter\n                    return this.optDoubleGetter;\n                case -860970343:  // twelve\n                    return this.twelve;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmOptional.Builder builder() {\n            return new ImmOptional.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmOptional> beanType() {\n            return ImmOptional.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code optString} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Optional<String>> optString() {\n            return optString;\n        }\n\n        /**\n         * The meta-property for the {@code optStringEmpty} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Optional<String>> optStringEmpty() {\n            return optStringEmpty;\n        }\n\n        /**\n         * The meta-property for the {@code optStringGetter} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> optStringGetter() {\n            return optStringGetter;\n        }\n\n        /**\n         * The meta-property for the {@code optLongGetter} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Long> optLongGetter() {\n            return optLongGetter;\n        }\n\n        /**\n         * The meta-property for the {@code optIntGetter} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Integer> optIntGetter() {\n            return optIntGetter;\n        }\n\n        /**\n         * The meta-property for the {@code optDoubleGetter} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Double> optDoubleGetter() {\n            return optDoubleGetter;\n        }\n\n        /**\n         * The meta-property for the {@code twelve} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Integer> twelve() {\n            return twelve;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 1220339876:  // optString\n                    return ((ImmOptional) bean).getOptString();\n                case -856788215:  // optStringEmpty\n                    return ((ImmOptional) bean).getOptStringEmpty();\n                case -740642097:  // optStringGetter\n                    return ((ImmOptional) bean).optStringGetter;\n                case 2046023098:  // optLongGetter\n                    return ((ImmOptional) bean).optLongGetter;\n                case -1931360153:  // optIntGetter\n                    return ((ImmOptional) bean).optIntGetter;\n                case 224984719:  // optDoubleGetter\n                    return ((ImmOptional) bean).optDoubleGetter;\n                case -860970343:  // twelve\n                    return ((ImmOptional) bean).getTwelve();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmOptional}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmOptional> {\n\n        private Optional<String> optString;\n        private Optional<String> optStringEmpty;\n        private String optStringGetter;\n        private Long optLongGetter;\n        private Integer optIntGetter;\n        private Double optDoubleGetter;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n            applyDefaults(this);\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmOptional beanToCopy) {\n            this.optString = beanToCopy.getOptString();\n            this.optStringEmpty = beanToCopy.getOptStringEmpty();\n            this.optStringGetter = beanToCopy.optStringGetter;\n            this.optLongGetter = beanToCopy.optLongGetter;\n            this.optIntGetter = beanToCopy.optIntGetter;\n            this.optDoubleGetter = beanToCopy.optDoubleGetter;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 1220339876:  // optString\n                    return this.optString;\n                case -856788215:  // optStringEmpty\n                    return this.optStringEmpty;\n                case -740642097:  // optStringGetter\n                    return this.optStringGetter;\n                case 2046023098:  // optLongGetter\n                    return this.optLongGetter;\n                case -1931360153:  // optIntGetter\n                    return this.optIntGetter;\n                case 224984719:  // optDoubleGetter\n                    return this.optDoubleGetter;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 1220339876:  // optString\n                    this.optString = (Optional<String>) newValue;\n                    break;\n                case -856788215:  // optStringEmpty\n                    this.optStringEmpty = (Optional<String>) newValue;\n                    break;\n                case -740642097:  // optStringGetter\n                    this.optStringGetter = (String) newValue;\n                    break;\n                case 2046023098:  // optLongGetter\n                    this.optLongGetter = (Long) newValue;\n                    break;\n                case -1931360153:  // optIntGetter\n                    this.optIntGetter = (Integer) newValue;\n                    break;\n                case 224984719:  // optDoubleGetter\n                    this.optDoubleGetter = (Double) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmOptional build() {\n            return new ImmOptional(\n                    optString,\n                    optStringEmpty,\n                    optStringGetter,\n                    optLongGetter,\n                    optIntGetter,\n                    optDoubleGetter);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the optString.\n         * @param optString  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder optString(Optional<String> optString) {\n            JodaBeanUtils.notNull(optString, \"optString\");\n            this.optString = optString;\n            return this;\n        }\n\n        /**\n         * Sets the optStringEmpty.\n         * @param optStringEmpty  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder optStringEmpty(Optional<String> optStringEmpty) {\n            JodaBeanUtils.notNull(optStringEmpty, \"optStringEmpty\");\n            this.optStringEmpty = optStringEmpty;\n            return this;\n        }\n\n        /**\n         * Sets the optStringGetter.\n         * @param optStringGetter  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder optStringGetter(String optStringGetter) {\n            this.optStringGetter = optStringGetter;\n            return this;\n        }\n\n        /**\n         * Sets the optLongGetter.\n         * @param optLongGetter  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder optLongGetter(Long optLongGetter) {\n            this.optLongGetter = optLongGetter;\n            return this;\n        }\n\n        /**\n         * Sets the optIntGetter.\n         * @param optIntGetter  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder optIntGetter(Integer optIntGetter) {\n            this.optIntGetter = optIntGetter;\n            return this;\n        }\n\n        /**\n         * Sets the optDoubleGetter.\n         * @param optDoubleGetter  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder optDoubleGetter(Double optDoubleGetter) {\n            this.optDoubleGetter = optDoubleGetter;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(256);\n            buf.append(\"ImmOptional.Builder{\");\n            buf.append(\"optString\").append('=').append(JodaBeanUtils.toString(optString)).append(',').append(' ');\n            buf.append(\"optStringEmpty\").append('=').append(JodaBeanUtils.toString(optStringEmpty)).append(',').append(' ');\n            buf.append(\"optStringGetter\").append('=').append(JodaBeanUtils.toString(optStringGetter)).append(',').append(' ');\n            buf.append(\"optLongGetter\").append('=').append(JodaBeanUtils.toString(optLongGetter)).append(',').append(' ');\n            buf.append(\"optIntGetter\").append('=').append(JodaBeanUtils.toString(optIntGetter)).append(',').append(' ');\n            buf.append(\"optDoubleGetter\").append('=').append(JodaBeanUtils.toString(optDoubleGetter)).append(',').append(' ');\n            buf.append(\"twelve\").append('=').append(JodaBeanUtils.toString(null));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmOptionalMeta.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport org.joda.beans.MetaProperty;\n\nimport com.google.common.base.Optional;\n\n/**\n * Mock.\n * @param <T> the type\n */\npublic interface ImmOptionalMeta<T> {\n\n    /**\n     * The meta-property for the {@code optString} property.\n     * @return the meta-property, not null\n     */\n    public abstract MetaProperty<Optional<T>> optString();\n\n    /**\n     * The meta-property for the {@code optStringEmpty} property.\n     * @return the meta-property, not null\n     */\n    public abstract MetaProperty<Optional<String>> optStringEmpty();\n\n    /**\n     * The meta-property for the {@code optStringGetter} property.\n     * @return the meta-property, not null\n     */\n    public abstract MetaProperty<String> optStringGetter();\n\n    /**\n     * The meta-property for the {@code optLongGetter} property.\n     * @return the meta-property, not null\n     */\n    public abstract MetaProperty<Long> optLongGetter();\n\n    /**\n     * The meta-property for the {@code optIntGetter} property.\n     * @return the meta-property, not null\n     */\n    public abstract MetaProperty<Integer> optIntGetter();\n\n    /**\n     * The meta-property for the {@code optDoubleGetter} property.\n     * @return the meta-property, not null\n     */\n    public abstract MetaProperty<Double> optDoubleGetter();\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmPackageScoped.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock immutable package scoped bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(constructorScope = \"package\")\nfinal class ImmPackageScoped implements ImmutableBean {\n\n    @PropertyDefinition(validate = \"notNull\")\n    private final String name;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmPackageScoped}.\n     * @return the meta-bean, not null\n     */\n    public static ImmPackageScoped.Meta meta() {\n        return ImmPackageScoped.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmPackageScoped.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    static ImmPackageScoped.Builder builder() {\n        return new ImmPackageScoped.Builder();\n    }\n\n    /**\n     * Creates an instance.\n     * @param name  the value of the property, not null\n     */\n    ImmPackageScoped(\n            String name) {\n        JodaBeanUtils.notNull(name, \"name\");\n        this.name = name;\n    }\n\n    @Override\n    public ImmPackageScoped.Meta metaBean() {\n        return ImmPackageScoped.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property, not null\n     */\n    public String getName() {\n        return name;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmPackageScoped other = (ImmPackageScoped) obj;\n            return JodaBeanUtils.equal(this.name, other.name);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(name);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmPackageScoped{\");\n        buf.append(\"name\").append('=').append(JodaBeanUtils.toString(name));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmPackageScoped}.\n     */\n    static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code name} property.\n         */\n        private final MetaProperty<String> name = DirectMetaProperty.ofImmutable(\n                this, \"name\", ImmPackageScoped.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"name\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmPackageScoped.Builder builder() {\n            return new ImmPackageScoped.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmPackageScoped> beanType() {\n            return ImmPackageScoped.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code name} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> name() {\n            return name;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return ((ImmPackageScoped) bean).getName();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmPackageScoped}.\n     */\n    static final class Builder extends DirectFieldsBeanBuilder<ImmPackageScoped> {\n\n        private String name;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmPackageScoped beanToCopy) {\n            this.name = beanToCopy.getName();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    this.name = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmPackageScoped build() {\n            return new ImmPackageScoped(\n                    name);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the name.\n         * @param name  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder name(String name) {\n            JodaBeanUtils.notNull(name, \"name\");\n            this.name = name;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmPackageScoped.Builder{\");\n            buf.append(\"name\").append('=').append(JodaBeanUtils.toString(name));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmPair.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.lang.invoke.MethodHandles;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.light.LightMetaBean;\n\n/**\n * Mock pair, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"light\", factoryName = \"of\")\npublic final class ImmPair<A, B> implements ImmutableBean {\n\n    /**\n     * The first value.\n     */\n    @PropertyDefinition\n    private final A first;\n    /**\n     * The second value.\n     */\n    @PropertyDefinition\n    private final B second;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmPair}.\n     */\n    private static final MetaBean META_BEAN =\n            LightMetaBean.of(\n                    ImmPair.class,\n                    MethodHandles.lookup(),\n                    new String[] {\n                            \"first\",\n                            \"second\"},\n                    new Object[0]);\n\n    /**\n     * The meta-bean for {@code ImmPair}.\n     * @return the meta-bean, not null\n     */\n    public static MetaBean meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * Obtains an instance.\n     * @param <A>  the type\n     * @param <B>  the type\n     * @param first  the value of the property\n     * @param second  the value of the property\n     * @return the instance\n     */\n    public static <A, B> ImmPair<A, B> of(\n            A first,\n            B second) {\n        return new ImmPair<>(\n            first,\n            second);\n    }\n\n    private ImmPair(\n            A first,\n            B second) {\n        this.first = first;\n        this.second = second;\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public TypedMetaBean<ImmPair<A, B>> metaBean() {\n        return (TypedMetaBean<ImmPair<A, B>>) META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the first value.\n     * @return the value of the property\n     */\n    public A getFirst() {\n        return first;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the second value.\n     * @return the value of the property\n     */\n    public B getSecond() {\n        return second;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmPair<?, ?> other = (ImmPair<?, ?>) obj;\n            return JodaBeanUtils.equal(this.first, other.first) &&\n                    JodaBeanUtils.equal(this.second, other.second);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(first);\n        hash = hash * 31 + JodaBeanUtils.hashCode(second);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"ImmPair{\");\n        buf.append(\"first\").append('=').append(JodaBeanUtils.toString(first)).append(',').append(' ');\n        buf.append(\"second\").append('=').append(JodaBeanUtils.toString(second));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmPerson.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Date;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.DerivedProperty;\nimport org.joda.beans.gen.ImmutableDefaults;\nimport org.joda.beans.gen.ImmutablePreBuild;\nimport org.joda.beans.gen.ImmutableValidator;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.collect.ImmutableList;\nimport com.google.common.collect.ImmutableMap;\nimport com.google.common.collect.ImmutableMultiset;\nimport com.google.common.collect.Multiset;\n\n/**\n * Mock immutable person JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(cacheHashCode = true, cloneStyle = \"generate\")\npublic final class ImmPerson implements ImmutableBean {\n\n    /** The forename. */\n    @PropertyDefinition\n    private final String forename;\n    /** The surname. */\n    @PropertyDefinition\n    private final String surname;\n    /** The number of cars. */\n    @PropertyDefinition\n    @SimpleAnnotation(second = \"2\")\n    private transient final int numberOfCars;\n    /** The date of birth. */\n    @PropertyDefinition\n    private transient final Date dateOfBirth;\n    /** The middle names. */\n    @PropertyDefinition\n    private transient final String[] middleNames;\n    @PropertyDefinition\n    private final ImmutableList<Address> addressList;\n    @PropertyDefinition\n    private final Map<String, Address> otherAddressMap;\n    @PropertyDefinition\n    private final List<List<Address>> addressesList;\n    @PropertyDefinition\n    private final ImmAddress mainAddress;\n    @PropertyDefinition\n    private final ImmutableMultiset<String> codeCounts;\n\n    @DerivedProperty\n    @SimpleAnnotation(first = \"1\")\n    public int getAge() {\n        return 12;\n    }\n\n    @ImmutableValidator\n    private void validate() {\n        if (getSurname() == null && getForename() == null) {\n            throw new IllegalArgumentException();\n        }\n    }\n\n    @ImmutableDefaults\n    private static void applyDefaults(Builder builder) {\n        builder.numberOfCars(1);  // default numberOfCars to one\n    }\n\n    @ImmutablePreBuild\n    private static void preBuild(Builder builder) {\n        if (builder.middleNames == null) {\n            builder.middleNames = new String[0];\n        }\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmPerson}.\n     * @return the meta-bean, not null\n     */\n    public static ImmPerson.Meta meta() {\n        return ImmPerson.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmPerson.Meta.INSTANCE);\n    }\n\n    /**\n     * The cached hash code, using the racy single-check idiom.\n     */\n    private transient int cacheHashCode;\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmPerson.Builder builder() {\n        return new ImmPerson.Builder();\n    }\n\n    private ImmPerson(\n            String forename,\n            String surname,\n            int numberOfCars,\n            Date dateOfBirth,\n            String[] middleNames,\n            List<Address> addressList,\n            Map<String, Address> otherAddressMap,\n            List<List<Address>> addressesList,\n            ImmAddress mainAddress,\n            Multiset<String> codeCounts) {\n        this.forename = forename;\n        this.surname = surname;\n        this.numberOfCars = numberOfCars;\n        this.dateOfBirth = (dateOfBirth != null ? (Date) dateOfBirth.clone() : null);\n        this.middleNames = (middleNames != null ? middleNames.clone() : null);\n        this.addressList = (addressList != null ? ImmutableList.copyOf(addressList) : null);\n        this.otherAddressMap = (otherAddressMap != null ? ImmutableMap.copyOf(otherAddressMap) : null);\n        this.addressesList = (addressesList != null ? ImmutableList.copyOf(addressesList) : null);\n        this.mainAddress = mainAddress;\n        this.codeCounts = (codeCounts != null ? ImmutableMultiset.copyOf(codeCounts) : null);\n        validate();\n    }\n\n    @Override\n    public ImmPerson.Meta metaBean() {\n        return ImmPerson.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the forename.\n     * @return the value of the property\n     */\n    public String getForename() {\n        return forename;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the surname.\n     * @return the value of the property\n     */\n    public String getSurname() {\n        return surname;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number of cars.\n     * @return the value of the property\n     */\n    public int getNumberOfCars() {\n        return numberOfCars;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the date of birth.\n     * @return the value of the property\n     */\n    public Date getDateOfBirth() {\n        return (dateOfBirth != null ? (Date) dateOfBirth.clone() : null);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the middle names.\n     * @return the value of the property\n     */\n    public String[] getMiddleNames() {\n        return (middleNames != null ? middleNames.clone() : null);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the addressList.\n     * @return the value of the property\n     */\n    public ImmutableList<Address> getAddressList() {\n        return addressList;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the otherAddressMap.\n     * @return the value of the property\n     */\n    public Map<String, Address> getOtherAddressMap() {\n        return otherAddressMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the addressesList.\n     * @return the value of the property\n     */\n    public List<List<Address>> getAddressesList() {\n        return addressesList;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the mainAddress.\n     * @return the value of the property\n     */\n    public ImmAddress getMainAddress() {\n        return mainAddress;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the codeCounts.\n     * @return the value of the property\n     */\n    public ImmutableMultiset<String> getCodeCounts() {\n        return codeCounts;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public ImmPerson clone() {\n        return this;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmPerson other = (ImmPerson) obj;\n            return JodaBeanUtils.equal(this.forename, other.forename) &&\n                    JodaBeanUtils.equal(this.surname, other.surname) &&\n                    (this.numberOfCars == other.numberOfCars) &&\n                    JodaBeanUtils.equal(this.dateOfBirth, other.dateOfBirth) &&\n                    JodaBeanUtils.equal(this.middleNames, other.middleNames) &&\n                    JodaBeanUtils.equal(this.addressList, other.addressList) &&\n                    JodaBeanUtils.equal(this.otherAddressMap, other.otherAddressMap) &&\n                    JodaBeanUtils.equal(this.addressesList, other.addressesList) &&\n                    JodaBeanUtils.equal(this.mainAddress, other.mainAddress) &&\n                    JodaBeanUtils.equal(this.codeCounts, other.codeCounts);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = cacheHashCode;\n        if (hash == 0) {\n            hash = getClass().hashCode();\n            hash = hash * 31 + JodaBeanUtils.hashCode(forename);\n            hash = hash * 31 + JodaBeanUtils.hashCode(surname);\n            hash = hash * 31 + JodaBeanUtils.hashCode(numberOfCars);\n            hash = hash * 31 + JodaBeanUtils.hashCode(dateOfBirth);\n            hash = hash * 31 + JodaBeanUtils.hashCode(middleNames);\n            hash = hash * 31 + JodaBeanUtils.hashCode(addressList);\n            hash = hash * 31 + JodaBeanUtils.hashCode(otherAddressMap);\n            hash = hash * 31 + JodaBeanUtils.hashCode(addressesList);\n            hash = hash * 31 + JodaBeanUtils.hashCode(mainAddress);\n            hash = hash * 31 + JodaBeanUtils.hashCode(codeCounts);\n            cacheHashCode = hash;\n        }\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(384);\n        buf.append(\"ImmPerson{\");\n        buf.append(\"forename\").append('=').append(JodaBeanUtils.toString(forename)).append(',').append(' ');\n        buf.append(\"surname\").append('=').append(JodaBeanUtils.toString(surname)).append(',').append(' ');\n        buf.append(\"numberOfCars\").append('=').append(JodaBeanUtils.toString(numberOfCars)).append(',').append(' ');\n        buf.append(\"dateOfBirth\").append('=').append(JodaBeanUtils.toString(dateOfBirth)).append(',').append(' ');\n        buf.append(\"middleNames\").append('=').append(JodaBeanUtils.toString(middleNames)).append(',').append(' ');\n        buf.append(\"addressList\").append('=').append(JodaBeanUtils.toString(addressList)).append(',').append(' ');\n        buf.append(\"otherAddressMap\").append('=').append(JodaBeanUtils.toString(otherAddressMap)).append(',').append(' ');\n        buf.append(\"addressesList\").append('=').append(JodaBeanUtils.toString(addressesList)).append(',').append(' ');\n        buf.append(\"mainAddress\").append('=').append(JodaBeanUtils.toString(mainAddress)).append(',').append(' ');\n        buf.append(\"codeCounts\").append('=').append(JodaBeanUtils.toString(codeCounts)).append(',').append(' ');\n        buf.append(\"age\").append('=').append(JodaBeanUtils.toString(getAge()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmPerson}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code forename} property.\n         */\n        private final MetaProperty<String> forename = DirectMetaProperty.ofImmutable(\n                this, \"forename\", ImmPerson.class, String.class);\n        /**\n         * The meta-property for the {@code surname} property.\n         */\n        private final MetaProperty<String> surname = DirectMetaProperty.ofImmutable(\n                this, \"surname\", ImmPerson.class, String.class);\n        /**\n         * The meta-property for the {@code numberOfCars} property.\n         */\n        private final MetaProperty<Integer> numberOfCars = DirectMetaProperty.ofImmutable(\n                this, \"numberOfCars\", ImmPerson.class, Integer.TYPE);\n        /**\n         * The meta-property for the {@code dateOfBirth} property.\n         */\n        private final MetaProperty<Date> dateOfBirth = DirectMetaProperty.ofImmutable(\n                this, \"dateOfBirth\", ImmPerson.class, Date.class);\n        /**\n         * The meta-property for the {@code middleNames} property.\n         */\n        private final MetaProperty<String[]> middleNames = DirectMetaProperty.ofImmutable(\n                this, \"middleNames\", ImmPerson.class, String[].class);\n        /**\n         * The meta-property for the {@code addressList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableList<Address>> addressList = DirectMetaProperty.ofImmutable(\n                this, \"addressList\", ImmPerson.class, (Class) ImmutableList.class);\n        /**\n         * The meta-property for the {@code otherAddressMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Map<String, Address>> otherAddressMap = DirectMetaProperty.ofImmutable(\n                this, \"otherAddressMap\", ImmPerson.class, (Class) Map.class);\n        /**\n         * The meta-property for the {@code addressesList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<List<Address>>> addressesList = DirectMetaProperty.ofImmutable(\n                this, \"addressesList\", ImmPerson.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code mainAddress} property.\n         */\n        private final MetaProperty<ImmAddress> mainAddress = DirectMetaProperty.ofImmutable(\n                this, \"mainAddress\", ImmPerson.class, ImmAddress.class);\n        /**\n         * The meta-property for the {@code codeCounts} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMultiset<String>> codeCounts = DirectMetaProperty.ofImmutable(\n                this, \"codeCounts\", ImmPerson.class, (Class) ImmutableMultiset.class);\n        /**\n         * The meta-property for the {@code age} property.\n         */\n        private final MetaProperty<Integer> age = DirectMetaProperty.ofDerived(\n                this, \"age\", ImmPerson.class, Integer.TYPE);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"forename\",\n                \"surname\",\n                \"numberOfCars\",\n                \"dateOfBirth\",\n                \"middleNames\",\n                \"addressList\",\n                \"otherAddressMap\",\n                \"addressesList\",\n                \"mainAddress\",\n                \"codeCounts\",\n                \"age\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return this.forename;\n                case -1852993317:  // surname\n                    return this.surname;\n                case 926656063:  // numberOfCars\n                    return this.numberOfCars;\n                case -386871910:  // dateOfBirth\n                    return this.dateOfBirth;\n                case 404996787:  // middleNames\n                    return this.middleNames;\n                case -1377524046:  // addressList\n                    return this.addressList;\n                case 1368089592:  // otherAddressMap\n                    return this.otherAddressMap;\n                case -226885792:  // addressesList\n                    return this.addressesList;\n                case -2032731141:  // mainAddress\n                    return this.mainAddress;\n                case -1383758447:  // codeCounts\n                    return this.codeCounts;\n                case 96511:  // age\n                    return this.age;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmPerson.Builder builder() {\n            return new ImmPerson.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmPerson> beanType() {\n            return ImmPerson.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code forename} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> forename() {\n            return forename;\n        }\n\n        /**\n         * The meta-property for the {@code surname} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> surname() {\n            return surname;\n        }\n\n        /**\n         * The meta-property for the {@code numberOfCars} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Integer> numberOfCars() {\n            return numberOfCars;\n        }\n\n        /**\n         * The meta-property for the {@code dateOfBirth} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Date> dateOfBirth() {\n            return dateOfBirth;\n        }\n\n        /**\n         * The meta-property for the {@code middleNames} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String[]> middleNames() {\n            return middleNames;\n        }\n\n        /**\n         * The meta-property for the {@code addressList} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableList<Address>> addressList() {\n            return addressList;\n        }\n\n        /**\n         * The meta-property for the {@code otherAddressMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Map<String, Address>> otherAddressMap() {\n            return otherAddressMap;\n        }\n\n        /**\n         * The meta-property for the {@code addressesList} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<List<List<Address>>> addressesList() {\n            return addressesList;\n        }\n\n        /**\n         * The meta-property for the {@code mainAddress} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmAddress> mainAddress() {\n            return mainAddress;\n        }\n\n        /**\n         * The meta-property for the {@code codeCounts} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMultiset<String>> codeCounts() {\n            return codeCounts;\n        }\n\n        /**\n         * The meta-property for the {@code age} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Integer> age() {\n            return age;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return ((ImmPerson) bean).getForename();\n                case -1852993317:  // surname\n                    return ((ImmPerson) bean).getSurname();\n                case 926656063:  // numberOfCars\n                    return ((ImmPerson) bean).getNumberOfCars();\n                case -386871910:  // dateOfBirth\n                    return ((ImmPerson) bean).getDateOfBirth();\n                case 404996787:  // middleNames\n                    return ((ImmPerson) bean).getMiddleNames();\n                case -1377524046:  // addressList\n                    return ((ImmPerson) bean).getAddressList();\n                case 1368089592:  // otherAddressMap\n                    return ((ImmPerson) bean).getOtherAddressMap();\n                case -226885792:  // addressesList\n                    return ((ImmPerson) bean).getAddressesList();\n                case -2032731141:  // mainAddress\n                    return ((ImmPerson) bean).getMainAddress();\n                case -1383758447:  // codeCounts\n                    return ((ImmPerson) bean).getCodeCounts();\n                case 96511:  // age\n                    return ((ImmPerson) bean).getAge();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmPerson}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmPerson> {\n\n        private String forename;\n        private String surname;\n        private int numberOfCars;\n        private Date dateOfBirth;\n        private String[] middleNames;\n        private List<Address> addressList;\n        private Map<String, Address> otherAddressMap;\n        private List<List<Address>> addressesList;\n        private ImmAddress mainAddress;\n        private Multiset<String> codeCounts;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n            applyDefaults(this);\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmPerson beanToCopy) {\n            this.forename = beanToCopy.getForename();\n            this.surname = beanToCopy.getSurname();\n            this.numberOfCars = beanToCopy.getNumberOfCars();\n            this.dateOfBirth = (beanToCopy.getDateOfBirth() != null ? (Date) beanToCopy.getDateOfBirth().clone() : null);\n            this.middleNames = (beanToCopy.getMiddleNames() != null ? beanToCopy.getMiddleNames().clone() : null);\n            this.addressList = beanToCopy.getAddressList();\n            this.otherAddressMap = (beanToCopy.getOtherAddressMap() != null ? ImmutableMap.copyOf(beanToCopy.getOtherAddressMap()) : null);\n            this.addressesList = (beanToCopy.getAddressesList() != null ? ImmutableList.copyOf(beanToCopy.getAddressesList()) : null);\n            this.mainAddress = beanToCopy.getMainAddress();\n            this.codeCounts = beanToCopy.getCodeCounts();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return this.forename;\n                case -1852993317:  // surname\n                    return this.surname;\n                case 926656063:  // numberOfCars\n                    return this.numberOfCars;\n                case -386871910:  // dateOfBirth\n                    return this.dateOfBirth;\n                case 404996787:  // middleNames\n                    return this.middleNames;\n                case -1377524046:  // addressList\n                    return this.addressList;\n                case 1368089592:  // otherAddressMap\n                    return this.otherAddressMap;\n                case -226885792:  // addressesList\n                    return this.addressesList;\n                case -2032731141:  // mainAddress\n                    return this.mainAddress;\n                case -1383758447:  // codeCounts\n                    return this.codeCounts;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    this.forename = (String) newValue;\n                    break;\n                case -1852993317:  // surname\n                    this.surname = (String) newValue;\n                    break;\n                case 926656063:  // numberOfCars\n                    this.numberOfCars = (Integer) newValue;\n                    break;\n                case -386871910:  // dateOfBirth\n                    this.dateOfBirth = (Date) newValue;\n                    break;\n                case 404996787:  // middleNames\n                    this.middleNames = (String[]) newValue;\n                    break;\n                case -1377524046:  // addressList\n                    this.addressList = (List<Address>) newValue;\n                    break;\n                case 1368089592:  // otherAddressMap\n                    this.otherAddressMap = (Map<String, Address>) newValue;\n                    break;\n                case -226885792:  // addressesList\n                    this.addressesList = (List<List<Address>>) newValue;\n                    break;\n                case -2032731141:  // mainAddress\n                    this.mainAddress = (ImmAddress) newValue;\n                    break;\n                case -1383758447:  // codeCounts\n                    this.codeCounts = (Multiset<String>) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmPerson build() {\n            preBuild(this);\n            return new ImmPerson(\n                    forename,\n                    surname,\n                    numberOfCars,\n                    dateOfBirth,\n                    middleNames,\n                    addressList,\n                    otherAddressMap,\n                    addressesList,\n                    mainAddress,\n                    codeCounts);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the forename.\n         * @param forename  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder forename(String forename) {\n            this.forename = forename;\n            return this;\n        }\n\n        /**\n         * Sets the surname.\n         * @param surname  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder surname(String surname) {\n            this.surname = surname;\n            return this;\n        }\n\n        /**\n         * Sets the number of cars.\n         * @param numberOfCars  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder numberOfCars(int numberOfCars) {\n            this.numberOfCars = numberOfCars;\n            return this;\n        }\n\n        /**\n         * Sets the date of birth.\n         * @param dateOfBirth  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder dateOfBirth(Date dateOfBirth) {\n            this.dateOfBirth = dateOfBirth;\n            return this;\n        }\n\n        /**\n         * Sets the middle names.\n         * @param middleNames  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder middleNames(String... middleNames) {\n            this.middleNames = middleNames;\n            return this;\n        }\n\n        /**\n         * Sets the addressList.\n         * @param addressList  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder addressList(List<Address> addressList) {\n            this.addressList = addressList;\n            return this;\n        }\n\n        /**\n         * Sets the {@code addressList} property in the builder\n         * from an array of objects.\n         * @param addressList  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder addressList(Address... addressList) {\n            return addressList(ImmutableList.copyOf(addressList));\n        }\n\n        /**\n         * Sets the otherAddressMap.\n         * @param otherAddressMap  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder otherAddressMap(Map<String, Address> otherAddressMap) {\n            this.otherAddressMap = otherAddressMap;\n            return this;\n        }\n\n        /**\n         * Sets the addressesList.\n         * @param addressesList  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder addressesList(List<List<Address>> addressesList) {\n            this.addressesList = addressesList;\n            return this;\n        }\n\n        /**\n         * Sets the {@code addressesList} property in the builder\n         * from an array of objects.\n         * @param addressesList  the new value\n         * @return this, for chaining, not null\n         */\n        @SafeVarargs\n        public final Builder addressesList(List<Address>... addressesList) {\n            return addressesList(ImmutableList.copyOf(addressesList));\n        }\n\n        /**\n         * Sets the mainAddress.\n         * @param mainAddress  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder mainAddress(ImmAddress mainAddress) {\n            this.mainAddress = mainAddress;\n            return this;\n        }\n\n        /**\n         * Sets the codeCounts.\n         * @param codeCounts  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder codeCounts(Multiset<String> codeCounts) {\n            this.codeCounts = codeCounts;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(384);\n            buf.append(\"ImmPerson.Builder{\");\n            buf.append(\"forename\").append('=').append(JodaBeanUtils.toString(forename)).append(',').append(' ');\n            buf.append(\"surname\").append('=').append(JodaBeanUtils.toString(surname)).append(',').append(' ');\n            buf.append(\"numberOfCars\").append('=').append(JodaBeanUtils.toString(numberOfCars)).append(',').append(' ');\n            buf.append(\"dateOfBirth\").append('=').append(JodaBeanUtils.toString(dateOfBirth)).append(',').append(' ');\n            buf.append(\"middleNames\").append('=').append(JodaBeanUtils.toString(middleNames)).append(',').append(' ');\n            buf.append(\"addressList\").append('=').append(JodaBeanUtils.toString(addressList)).append(',').append(' ');\n            buf.append(\"otherAddressMap\").append('=').append(JodaBeanUtils.toString(otherAddressMap)).append(',').append(' ');\n            buf.append(\"addressesList\").append('=').append(JodaBeanUtils.toString(addressesList)).append(',').append(' ');\n            buf.append(\"mainAddress\").append('=').append(JodaBeanUtils.toString(mainAddress)).append(',').append(' ');\n            buf.append(\"codeCounts\").append('=').append(JodaBeanUtils.toString(codeCounts)).append(',').append(' ');\n            buf.append(\"age\").append('=').append(JodaBeanUtils.toString(null));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmPersonAbstract.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.DerivedProperty;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock immutable person JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(constructorScope = \"public\")\npublic abstract class ImmPersonAbstract implements ImmutableBean {\n\n    /** The forename. */\n    @PropertyDefinition\n    private final String forename;\n    /** The surname. */\n    @PropertyDefinition\n    private final String surname;\n\n    @DerivedProperty\n    public int getAge() {\n        return 12;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmPersonAbstract}.\n     * @return the meta-bean, not null\n     */\n    public static ImmPersonAbstract.Meta meta() {\n        return ImmPersonAbstract.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmPersonAbstract.Meta.INSTANCE);\n    }\n\n    /**\n     * Creates an instance.\n     * @param forename  the value of the property\n     * @param surname  the value of the property\n     */\n    public ImmPersonAbstract(\n            String forename,\n            String surname) {\n        this.forename = forename;\n        this.surname = surname;\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    protected ImmPersonAbstract(ImmPersonAbstract.Builder builder) {\n        this.forename = builder.forename;\n        this.surname = builder.surname;\n    }\n\n    @Override\n    public ImmPersonAbstract.Meta metaBean() {\n        return ImmPersonAbstract.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the forename.\n     * @return the value of the property\n     */\n    public String getForename() {\n        return forename;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the surname.\n     * @return the value of the property\n     */\n    public String getSurname() {\n        return surname;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public abstract Builder toBuilder();\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmPersonAbstract other = (ImmPersonAbstract) obj;\n            return JodaBeanUtils.equal(this.forename, other.forename) &&\n                    JodaBeanUtils.equal(this.surname, other.surname);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(forename);\n        hash = hash * 31 + JodaBeanUtils.hashCode(surname);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(128);\n        buf.append(\"ImmPersonAbstract{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"forename\").append('=').append(JodaBeanUtils.toString(forename)).append(',').append(' ');\n        buf.append(\"surname\").append('=').append(JodaBeanUtils.toString(surname)).append(',').append(' ');\n        buf.append(\"age\").append('=').append(JodaBeanUtils.toString(getAge())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmPersonAbstract}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code forename} property.\n         */\n        private final MetaProperty<String> forename = DirectMetaProperty.ofImmutable(\n                this, \"forename\", ImmPersonAbstract.class, String.class);\n        /**\n         * The meta-property for the {@code surname} property.\n         */\n        private final MetaProperty<String> surname = DirectMetaProperty.ofImmutable(\n                this, \"surname\", ImmPersonAbstract.class, String.class);\n        /**\n         * The meta-property for the {@code age} property.\n         */\n        private final MetaProperty<Integer> age = DirectMetaProperty.ofDerived(\n                this, \"age\", ImmPersonAbstract.class, Integer.TYPE);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"forename\",\n                \"surname\",\n                \"age\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return this.forename;\n                case -1852993317:  // surname\n                    return this.surname;\n                case 96511:  // age\n                    return this.age;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public boolean isBuildable() {\n            return false;\n        }\n\n        @Override\n        public ImmPersonAbstract.Builder builder() {\n            throw new UnsupportedOperationException(\"ImmPersonAbstract is an abstract class\");\n        }\n\n        @Override\n        public Class<? extends ImmPersonAbstract> beanType() {\n            return ImmPersonAbstract.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code forename} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> forename() {\n            return forename;\n        }\n\n        /**\n         * The meta-property for the {@code surname} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> surname() {\n            return surname;\n        }\n\n        /**\n         * The meta-property for the {@code age} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Integer> age() {\n            return age;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return ((ImmPersonAbstract) bean).getForename();\n                case -1852993317:  // surname\n                    return ((ImmPersonAbstract) bean).getSurname();\n                case 96511:  // age\n                    return ((ImmPersonAbstract) bean).getAge();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmPersonAbstract}.\n     */\n    public abstract static class Builder extends DirectFieldsBeanBuilder<ImmPersonAbstract> {\n\n        private String forename;\n        private String surname;\n\n        /**\n         * Restricted constructor.\n         */\n        protected Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        protected Builder(ImmPersonAbstract beanToCopy) {\n            this.forename = beanToCopy.getForename();\n            this.surname = beanToCopy.getSurname();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return this.forename;\n                case -1852993317:  // surname\n                    return this.surname;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    this.forename = (String) newValue;\n                    break;\n                case -1852993317:  // surname\n                    this.surname = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the forename.\n         * @param forename  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder forename(String forename) {\n            this.forename = forename;\n            return this;\n        }\n\n        /**\n         * Sets the surname.\n         * @param surname  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder surname(String surname) {\n            this.surname = surname;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(128);\n            buf.append(\"ImmPersonAbstract.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        protected void toString(StringBuilder buf) {\n            buf.append(\"forename\").append('=').append(JodaBeanUtils.toString(forename)).append(',').append(' ');\n            buf.append(\"surname\").append('=').append(JodaBeanUtils.toString(surname)).append(',').append(' ');\n            buf.append(\"age\").append('=').append(JodaBeanUtils.toString(null)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmPersonNonFinal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.DerivedProperty;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock immutable person JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(constructorScope = \"package\")\npublic class ImmPersonNonFinal implements ImmutableBean {\n\n    /** The forename. */\n    @PropertyDefinition\n    private final String forename;\n    /** The surname. */\n    @PropertyDefinition\n    private final String surname;\n\n    @DerivedProperty\n    public int getAge() {\n        return 12;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmPersonNonFinal}.\n     * @return the meta-bean, not null\n     */\n    public static ImmPersonNonFinal.Meta meta() {\n        return ImmPersonNonFinal.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmPersonNonFinal.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmPersonNonFinal.Builder builder() {\n        return new ImmPersonNonFinal.Builder();\n    }\n\n    /**\n     * Creates an instance.\n     * @param forename  the value of the property\n     * @param surname  the value of the property\n     */\n    ImmPersonNonFinal(\n            String forename,\n            String surname) {\n        this.forename = forename;\n        this.surname = surname;\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    protected ImmPersonNonFinal(ImmPersonNonFinal.Builder builder) {\n        this.forename = builder.forename;\n        this.surname = builder.surname;\n    }\n\n    @Override\n    public ImmPersonNonFinal.Meta metaBean() {\n        return ImmPersonNonFinal.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the forename.\n     * @return the value of the property\n     */\n    public String getForename() {\n        return forename;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the surname.\n     * @return the value of the property\n     */\n    public String getSurname() {\n        return surname;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmPersonNonFinal other = (ImmPersonNonFinal) obj;\n            return JodaBeanUtils.equal(this.forename, other.forename) &&\n                    JodaBeanUtils.equal(this.surname, other.surname);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(forename);\n        hash = hash * 31 + JodaBeanUtils.hashCode(surname);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(128);\n        buf.append(\"ImmPersonNonFinal{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"forename\").append('=').append(JodaBeanUtils.toString(forename)).append(',').append(' ');\n        buf.append(\"surname\").append('=').append(JodaBeanUtils.toString(surname)).append(',').append(' ');\n        buf.append(\"age\").append('=').append(JodaBeanUtils.toString(getAge())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmPersonNonFinal}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code forename} property.\n         */\n        private final MetaProperty<String> forename = DirectMetaProperty.ofImmutable(\n                this, \"forename\", ImmPersonNonFinal.class, String.class);\n        /**\n         * The meta-property for the {@code surname} property.\n         */\n        private final MetaProperty<String> surname = DirectMetaProperty.ofImmutable(\n                this, \"surname\", ImmPersonNonFinal.class, String.class);\n        /**\n         * The meta-property for the {@code age} property.\n         */\n        private final MetaProperty<Integer> age = DirectMetaProperty.ofDerived(\n                this, \"age\", ImmPersonNonFinal.class, Integer.TYPE);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"forename\",\n                \"surname\",\n                \"age\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return this.forename;\n                case -1852993317:  // surname\n                    return this.surname;\n                case 96511:  // age\n                    return this.age;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmPersonNonFinal.Builder builder() {\n            return new ImmPersonNonFinal.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmPersonNonFinal> beanType() {\n            return ImmPersonNonFinal.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code forename} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> forename() {\n            return forename;\n        }\n\n        /**\n         * The meta-property for the {@code surname} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> surname() {\n            return surname;\n        }\n\n        /**\n         * The meta-property for the {@code age} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Integer> age() {\n            return age;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return ((ImmPersonNonFinal) bean).getForename();\n                case -1852993317:  // surname\n                    return ((ImmPersonNonFinal) bean).getSurname();\n                case 96511:  // age\n                    return ((ImmPersonNonFinal) bean).getAge();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmPersonNonFinal}.\n     */\n    public static class Builder extends DirectFieldsBeanBuilder<ImmPersonNonFinal> {\n\n        private String forename;\n        private String surname;\n\n        /**\n         * Restricted constructor.\n         */\n        protected Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        protected Builder(ImmPersonNonFinal beanToCopy) {\n            this.forename = beanToCopy.getForename();\n            this.surname = beanToCopy.getSurname();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return this.forename;\n                case -1852993317:  // surname\n                    return this.surname;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    this.forename = (String) newValue;\n                    break;\n                case -1852993317:  // surname\n                    this.surname = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmPersonNonFinal build() {\n            return new ImmPersonNonFinal(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the forename.\n         * @param forename  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder forename(String forename) {\n            this.forename = forename;\n            return this;\n        }\n\n        /**\n         * Sets the surname.\n         * @param surname  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder surname(String surname) {\n            this.surname = surname;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(128);\n            buf.append(\"ImmPersonNonFinal.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        protected void toString(StringBuilder buf) {\n            buf.append(\"forename\").append('=').append(JodaBeanUtils.toString(forename)).append(',').append(' ');\n            buf.append(\"surname\").append('=').append(JodaBeanUtils.toString(surname)).append(',').append(' ');\n            buf.append(\"age\").append('=').append(JodaBeanUtils.toString(null)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmPrivateMeta.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock address JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(metaScope = \"private\")\npublic final class ImmPrivateMeta implements ImmutableBean {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final int number;\n    /**\n     * The street.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final String street;\n    /**\n     * The city.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final String city;\n    /**\n     * The owner.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmPerson owner;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmPrivateMeta}.\n     * @return the meta-bean, not null\n     */\n    public static MetaBean meta() {\n        return ImmPrivateMeta.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmPrivateMeta.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmPrivateMeta.Builder builder() {\n        return new ImmPrivateMeta.Builder();\n    }\n\n    private ImmPrivateMeta(\n            int number,\n            String street,\n            String city,\n            ImmPerson owner) {\n        JodaBeanUtils.notNull(street, \"street\");\n        JodaBeanUtils.notNull(city, \"city\");\n        JodaBeanUtils.notNull(owner, \"owner\");\n        this.number = number;\n        this.street = street;\n        this.city = city;\n        this.owner = owner;\n    }\n\n    @Override\n    public MetaBean metaBean() {\n        return ImmPrivateMeta.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public int getNumber() {\n        return number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the street.\n     * @return the value of the property, not null\n     */\n    public String getStreet() {\n        return street;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the city.\n     * @return the value of the property, not null\n     */\n    public String getCity() {\n        return city;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the owner.\n     * @return the value of the property, not null\n     */\n    public ImmPerson getOwner() {\n        return owner;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmPrivateMeta other = (ImmPrivateMeta) obj;\n            return (this.number == other.number) &&\n                    JodaBeanUtils.equal(this.street, other.street) &&\n                    JodaBeanUtils.equal(this.city, other.city) &&\n                    JodaBeanUtils.equal(this.owner, other.owner);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(number);\n        hash = hash * 31 + JodaBeanUtils.hashCode(street);\n        hash = hash * 31 + JodaBeanUtils.hashCode(city);\n        hash = hash * 31 + JodaBeanUtils.hashCode(owner);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(160);\n        buf.append(\"ImmPrivateMeta{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n        buf.append(\"street\").append('=').append(JodaBeanUtils.toString(street)).append(',').append(' ');\n        buf.append(\"city\").append('=').append(JodaBeanUtils.toString(city)).append(',').append(' ');\n        buf.append(\"owner\").append('=').append(JodaBeanUtils.toString(owner));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmPrivateMeta}.\n     */\n    private static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code number} property.\n         */\n        private final MetaProperty<Integer> number = DirectMetaProperty.ofImmutable(\n                this, \"number\", ImmPrivateMeta.class, Integer.TYPE);\n        /**\n         * The meta-property for the {@code street} property.\n         */\n        private final MetaProperty<String> street = DirectMetaProperty.ofImmutable(\n                this, \"street\", ImmPrivateMeta.class, String.class);\n        /**\n         * The meta-property for the {@code city} property.\n         */\n        private final MetaProperty<String> city = DirectMetaProperty.ofImmutable(\n                this, \"city\", ImmPrivateMeta.class, String.class);\n        /**\n         * The meta-property for the {@code owner} property.\n         */\n        private final MetaProperty<ImmPerson> owner = DirectMetaProperty.ofImmutable(\n                this, \"owner\", ImmPrivateMeta.class, ImmPerson.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"number\",\n                \"street\",\n                \"city\",\n                \"owner\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    return this.number;\n                case -891990013:  // street\n                    return this.street;\n                case 3053931:  // city\n                    return this.city;\n                case 106164915:  // owner\n                    return this.owner;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmPrivateMeta.Builder builder() {\n            return new ImmPrivateMeta.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmPrivateMeta> beanType() {\n            return ImmPrivateMeta.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    return ((ImmPrivateMeta) bean).getNumber();\n                case -891990013:  // street\n                    return ((ImmPrivateMeta) bean).getStreet();\n                case 3053931:  // city\n                    return ((ImmPrivateMeta) bean).getCity();\n                case 106164915:  // owner\n                    return ((ImmPrivateMeta) bean).getOwner();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmPrivateMeta}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmPrivateMeta> {\n\n        private int number;\n        private String street;\n        private String city;\n        private ImmPerson owner;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmPrivateMeta beanToCopy) {\n            this.number = beanToCopy.getNumber();\n            this.street = beanToCopy.getStreet();\n            this.city = beanToCopy.getCity();\n            this.owner = beanToCopy.getOwner();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    return this.number;\n                case -891990013:  // street\n                    return this.street;\n                case 3053931:  // city\n                    return this.city;\n                case 106164915:  // owner\n                    return this.owner;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    this.number = (Integer) newValue;\n                    break;\n                case -891990013:  // street\n                    this.street = (String) newValue;\n                    break;\n                case 3053931:  // city\n                    this.city = (String) newValue;\n                    break;\n                case 106164915:  // owner\n                    this.owner = (ImmPerson) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmPrivateMeta build() {\n            return new ImmPrivateMeta(\n                    number,\n                    street,\n                    city,\n                    owner);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the number.\n         * @param number  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder number(int number) {\n            this.number = number;\n            return this;\n        }\n\n        /**\n         * Sets the street.\n         * @param street  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder street(String street) {\n            JodaBeanUtils.notNull(street, \"street\");\n            this.street = street;\n            return this;\n        }\n\n        /**\n         * Sets the city.\n         * @param city  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder city(String city) {\n            JodaBeanUtils.notNull(city, \"city\");\n            this.city = city;\n            return this;\n        }\n\n        /**\n         * Sets the owner.\n         * @param owner  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder owner(ImmPerson owner) {\n            JodaBeanUtils.notNull(owner, \"owner\");\n            this.owner = owner;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(160);\n            buf.append(\"ImmPrivateMeta.Builder{\");\n            buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n            buf.append(\"street\").append('=').append(JodaBeanUtils.toString(street)).append(',').append(' ');\n            buf.append(\"city\").append('=').append(JodaBeanUtils.toString(city)).append(',').append(' ');\n            buf.append(\"owner\").append('=').append(JodaBeanUtils.toString(owner));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmSubPersonFromAbstract.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.collect.ImmutableList;\n\n/**\n * Mock immutable person JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(hierarchy = \"immutable\")\npublic class ImmSubPersonFromAbstract extends ImmPersonAbstract {\n\n    /** The middle name. */\n    @PropertyDefinition\n    private final String middleName;\n    /** The list of addresses. */\n    @PropertyDefinition\n    private final ImmutableList<Address> addressList;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmSubPersonFromAbstract}.\n     * @return the meta-bean, not null\n     */\n    public static ImmSubPersonFromAbstract.Meta meta() {\n        return ImmSubPersonFromAbstract.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmSubPersonFromAbstract.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmSubPersonFromAbstract.Builder builder() {\n        return new ImmSubPersonFromAbstract.Builder();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    protected ImmSubPersonFromAbstract(ImmSubPersonFromAbstract.Builder builder) {\n        super(builder);\n        this.middleName = builder.middleName;\n        this.addressList = (builder.addressList != null ? ImmutableList.copyOf(builder.addressList) : null);\n    }\n\n    @Override\n    public ImmSubPersonFromAbstract.Meta metaBean() {\n        return ImmSubPersonFromAbstract.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the middle name.\n     * @return the value of the property\n     */\n    public String getMiddleName() {\n        return middleName;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the list of addresses.\n     * @return the value of the property\n     */\n    public ImmutableList<Address> getAddressList() {\n        return addressList;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    @Override\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmSubPersonFromAbstract other = (ImmSubPersonFromAbstract) obj;\n            return JodaBeanUtils.equal(this.middleName, other.middleName) &&\n                    JodaBeanUtils.equal(this.addressList, other.addressList) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        hash = hash * 31 + JodaBeanUtils.hashCode(middleName);\n        hash = hash * 31 + JodaBeanUtils.hashCode(addressList);\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"ImmSubPersonFromAbstract{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"middleName\").append('=').append(JodaBeanUtils.toString(middleName)).append(',').append(' ');\n        buf.append(\"addressList\").append('=').append(JodaBeanUtils.toString(addressList)).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmSubPersonFromAbstract}.\n     */\n    public static class Meta extends ImmPersonAbstract.Meta {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code middleName} property.\n         */\n        private final MetaProperty<String> middleName = DirectMetaProperty.ofImmutable(\n                this, \"middleName\", ImmSubPersonFromAbstract.class, String.class);\n        /**\n         * The meta-property for the {@code addressList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableList<Address>> addressList = DirectMetaProperty.ofImmutable(\n                this, \"addressList\", ImmSubPersonFromAbstract.class, (Class) ImmutableList.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"middleName\",\n                \"addressList\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    return this.middleName;\n                case -1377524046:  // addressList\n                    return this.addressList;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmSubPersonFromAbstract.Builder builder() {\n            return new ImmSubPersonFromAbstract.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmSubPersonFromAbstract> beanType() {\n            return ImmSubPersonFromAbstract.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code middleName} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> middleName() {\n            return middleName;\n        }\n\n        /**\n         * The meta-property for the {@code addressList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<ImmutableList<Address>> addressList() {\n            return addressList;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    return ((ImmSubPersonFromAbstract) bean).getMiddleName();\n                case -1377524046:  // addressList\n                    return ((ImmSubPersonFromAbstract) bean).getAddressList();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmSubPersonFromAbstract}.\n     */\n    public static class Builder extends ImmPersonAbstract.Builder {\n\n        private String middleName;\n        private List<Address> addressList;\n\n        /**\n         * Restricted constructor.\n         */\n        protected Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        protected Builder(ImmSubPersonFromAbstract beanToCopy) {\n            super(beanToCopy);\n            this.middleName = beanToCopy.getMiddleName();\n            this.addressList = beanToCopy.getAddressList();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    return this.middleName;\n                case -1377524046:  // addressList\n                    return this.addressList;\n                default:\n                    return super.get(propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    this.middleName = (String) newValue;\n                    break;\n                case -1377524046:  // addressList\n                    this.addressList = (List<Address>) newValue;\n                    break;\n                default:\n                    super.set(propertyName, newValue);\n                    break;\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmSubPersonFromAbstract build() {\n            return new ImmSubPersonFromAbstract(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the middle name.\n         * @param middleName  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder middleName(String middleName) {\n            this.middleName = middleName;\n            return this;\n        }\n\n        /**\n         * Sets the list of addresses.\n         * @param addressList  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder addressList(List<Address> addressList) {\n            this.addressList = addressList;\n            return this;\n        }\n\n        /**\n         * Sets the {@code addressList} property in the builder\n         * from an array of objects.\n         * @param addressList  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder addressList(Address... addressList) {\n            return addressList(ImmutableList.copyOf(addressList));\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(96);\n            buf.append(\"ImmSubPersonFromAbstract.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        @Override\n        protected void toString(StringBuilder buf) {\n            super.toString(buf);\n            buf.append(\"middleName\").append('=').append(JodaBeanUtils.toString(middleName)).append(',').append(' ');\n            buf.append(\"addressList\").append('=').append(JodaBeanUtils.toString(addressList)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmSubPersonNonFinal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.collect.ImmutableList;\n\n/**\n * Mock immutable person JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(hierarchy = \"immutable\")\npublic class ImmSubPersonNonFinal extends ImmPersonNonFinal {\n\n    /** The middle name. */\n    @PropertyDefinition\n    private final String middleName;\n    /** The list of addresses. */\n    @PropertyDefinition\n    private final ImmutableList<Address> addressList;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmSubPersonNonFinal}.\n     * @return the meta-bean, not null\n     */\n    public static ImmSubPersonNonFinal.Meta meta() {\n        return ImmSubPersonNonFinal.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmSubPersonNonFinal.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmSubPersonNonFinal.Builder builder() {\n        return new ImmSubPersonNonFinal.Builder();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    protected ImmSubPersonNonFinal(ImmSubPersonNonFinal.Builder builder) {\n        super(builder);\n        this.middleName = builder.middleName;\n        this.addressList = (builder.addressList != null ? ImmutableList.copyOf(builder.addressList) : null);\n    }\n\n    @Override\n    public ImmSubPersonNonFinal.Meta metaBean() {\n        return ImmSubPersonNonFinal.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the middle name.\n     * @return the value of the property\n     */\n    public String getMiddleName() {\n        return middleName;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the list of addresses.\n     * @return the value of the property\n     */\n    public ImmutableList<Address> getAddressList() {\n        return addressList;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    @Override\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmSubPersonNonFinal other = (ImmSubPersonNonFinal) obj;\n            return JodaBeanUtils.equal(this.middleName, other.middleName) &&\n                    JodaBeanUtils.equal(this.addressList, other.addressList) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        hash = hash * 31 + JodaBeanUtils.hashCode(middleName);\n        hash = hash * 31 + JodaBeanUtils.hashCode(addressList);\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"ImmSubPersonNonFinal{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"middleName\").append('=').append(JodaBeanUtils.toString(middleName)).append(',').append(' ');\n        buf.append(\"addressList\").append('=').append(JodaBeanUtils.toString(addressList)).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmSubPersonNonFinal}.\n     */\n    public static class Meta extends ImmPersonNonFinal.Meta {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code middleName} property.\n         */\n        private final MetaProperty<String> middleName = DirectMetaProperty.ofImmutable(\n                this, \"middleName\", ImmSubPersonNonFinal.class, String.class);\n        /**\n         * The meta-property for the {@code addressList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableList<Address>> addressList = DirectMetaProperty.ofImmutable(\n                this, \"addressList\", ImmSubPersonNonFinal.class, (Class) ImmutableList.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"middleName\",\n                \"addressList\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    return this.middleName;\n                case -1377524046:  // addressList\n                    return this.addressList;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmSubPersonNonFinal.Builder builder() {\n            return new ImmSubPersonNonFinal.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmSubPersonNonFinal> beanType() {\n            return ImmSubPersonNonFinal.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code middleName} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> middleName() {\n            return middleName;\n        }\n\n        /**\n         * The meta-property for the {@code addressList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<ImmutableList<Address>> addressList() {\n            return addressList;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    return ((ImmSubPersonNonFinal) bean).getMiddleName();\n                case -1377524046:  // addressList\n                    return ((ImmSubPersonNonFinal) bean).getAddressList();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmSubPersonNonFinal}.\n     */\n    public static class Builder extends ImmPersonNonFinal.Builder {\n\n        private String middleName;\n        private List<Address> addressList;\n\n        /**\n         * Restricted constructor.\n         */\n        protected Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        protected Builder(ImmSubPersonNonFinal beanToCopy) {\n            super(beanToCopy);\n            this.middleName = beanToCopy.getMiddleName();\n            this.addressList = beanToCopy.getAddressList();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    return this.middleName;\n                case -1377524046:  // addressList\n                    return this.addressList;\n                default:\n                    return super.get(propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    this.middleName = (String) newValue;\n                    break;\n                case -1377524046:  // addressList\n                    this.addressList = (List<Address>) newValue;\n                    break;\n                default:\n                    super.set(propertyName, newValue);\n                    break;\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmSubPersonNonFinal build() {\n            return new ImmSubPersonNonFinal(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the middle name.\n         * @param middleName  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder middleName(String middleName) {\n            this.middleName = middleName;\n            return this;\n        }\n\n        /**\n         * Sets the list of addresses.\n         * @param addressList  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder addressList(List<Address> addressList) {\n            this.addressList = addressList;\n            return this;\n        }\n\n        /**\n         * Sets the {@code addressList} property in the builder\n         * from an array of objects.\n         * @param addressList  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder addressList(Address... addressList) {\n            return addressList(ImmutableList.copyOf(addressList));\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(96);\n            buf.append(\"ImmSubPersonNonFinal.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        @Override\n        protected void toString(StringBuilder buf) {\n            super.toString(buf);\n            buf.append(\"middleName\").append('=').append(JodaBeanUtils.toString(middleName)).append(',').append(' ');\n            buf.append(\"addressList\").append('=').append(JodaBeanUtils.toString(addressList)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmSubSubPersonFinal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.collect.ImmutableMultiset;\nimport com.google.common.collect.Multiset;\n\n/**\n * Mock immutable person JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(hierarchy = \"immutable\", cacheHashCode = true)\npublic final class ImmSubSubPersonFinal extends ImmSubPersonNonFinal {\n\n    @PropertyDefinition\n    private final ImmutableMultiset<String> codeCounts;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmSubSubPersonFinal}.\n     * @return the meta-bean, not null\n     */\n    public static ImmSubSubPersonFinal.Meta meta() {\n        return ImmSubSubPersonFinal.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmSubSubPersonFinal.Meta.INSTANCE);\n    }\n\n    /**\n     * The cached hash code, using the racy single-check idiom.\n     */\n    private transient int cacheHashCode;\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmSubSubPersonFinal.Builder builder() {\n        return new ImmSubSubPersonFinal.Builder();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    private ImmSubSubPersonFinal(ImmSubSubPersonFinal.Builder builder) {\n        super(builder);\n        this.codeCounts = (builder.codeCounts != null ? ImmutableMultiset.copyOf(builder.codeCounts) : null);\n    }\n\n    @Override\n    public ImmSubSubPersonFinal.Meta metaBean() {\n        return ImmSubSubPersonFinal.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the codeCounts.\n     * @return the value of the property\n     */\n    public ImmutableMultiset<String> getCodeCounts() {\n        return codeCounts;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    @Override\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmSubSubPersonFinal other = (ImmSubSubPersonFinal) obj;\n            return JodaBeanUtils.equal(this.codeCounts, other.codeCounts) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = cacheHashCode;\n        if (hash == 0) {\n            hash = 7;\n            hash = hash * 31 + JodaBeanUtils.hashCode(codeCounts);\n            hash = hash ^ super.hashCode();\n            cacheHashCode = hash;\n        }\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmSubSubPersonFinal{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"codeCounts\").append('=').append(JodaBeanUtils.toString(codeCounts)).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmSubSubPersonFinal}.\n     */\n    public static final class Meta extends ImmSubPersonNonFinal.Meta {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code codeCounts} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMultiset<String>> codeCounts = DirectMetaProperty.ofImmutable(\n                this, \"codeCounts\", ImmSubSubPersonFinal.class, (Class) ImmutableMultiset.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"codeCounts\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1383758447:  // codeCounts\n                    return this.codeCounts;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmSubSubPersonFinal.Builder builder() {\n            return new ImmSubSubPersonFinal.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmSubSubPersonFinal> beanType() {\n            return ImmSubSubPersonFinal.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code codeCounts} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMultiset<String>> codeCounts() {\n            return codeCounts;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1383758447:  // codeCounts\n                    return ((ImmSubSubPersonFinal) bean).getCodeCounts();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmSubSubPersonFinal}.\n     */\n    public static final class Builder extends ImmSubPersonNonFinal.Builder {\n\n        private Multiset<String> codeCounts;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmSubSubPersonFinal beanToCopy) {\n            super(beanToCopy);\n            this.codeCounts = beanToCopy.getCodeCounts();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1383758447:  // codeCounts\n                    return this.codeCounts;\n                default:\n                    return super.get(propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -1383758447:  // codeCounts\n                    this.codeCounts = (Multiset<String>) newValue;\n                    break;\n                default:\n                    super.set(propertyName, newValue);\n                    break;\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmSubSubPersonFinal build() {\n            return new ImmSubSubPersonFinal(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the codeCounts.\n         * @param codeCounts  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder codeCounts(Multiset<String> codeCounts) {\n            this.codeCounts = codeCounts;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmSubSubPersonFinal.Builder{\");\n            buf.append(\"codeCounts\").append('=').append(JodaBeanUtils.toString(codeCounts));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmTolerance.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock bean for tolerance testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(cacheHashCode = true, factoryName = \"create\")\npublic final class ImmTolerance implements ImmutableBean {\n\n    @PropertyDefinition\n    private final double value;\n    @PropertyDefinition\n    private final double[] array;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmTolerance}.\n     * @return the meta-bean, not null\n     */\n    public static ImmTolerance.Meta meta() {\n        return ImmTolerance.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmTolerance.Meta.INSTANCE);\n    }\n\n    /**\n     * The cached hash code, using the racy single-check idiom.\n     */\n    private transient int cacheHashCode;\n\n    /**\n     * Obtains an instance.\n     * @param value  the value of the property\n     * @param array  the value of the property\n     * @return the instance\n     */\n    public static ImmTolerance create(\n            double value,\n            double[] array) {\n        return new ImmTolerance(\n            value,\n            array);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmTolerance.Builder builder() {\n        return new ImmTolerance.Builder();\n    }\n\n    private ImmTolerance(\n            double value,\n            double[] array) {\n        this.value = value;\n        this.array = (array != null ? array.clone() : null);\n    }\n\n    @Override\n    public ImmTolerance.Meta metaBean() {\n        return ImmTolerance.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the value.\n     * @return the value of the property\n     */\n    public double getValue() {\n        return value;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the array.\n     * @return the value of the property\n     */\n    public double[] getArray() {\n        return (array != null ? array.clone() : null);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmTolerance other = (ImmTolerance) obj;\n            return JodaBeanUtils.equal(this.value, other.value) &&\n                    JodaBeanUtils.equal(this.array, other.array);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = cacheHashCode;\n        if (hash == 0) {\n            hash = getClass().hashCode();\n            hash = hash * 31 + JodaBeanUtils.hashCode(value);\n            hash = hash * 31 + JodaBeanUtils.hashCode(array);\n            cacheHashCode = hash;\n        }\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"ImmTolerance{\");\n        buf.append(\"value\").append('=').append(JodaBeanUtils.toString(value)).append(',').append(' ');\n        buf.append(\"array\").append('=').append(JodaBeanUtils.toString(array));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmTolerance}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code value} property.\n         */\n        private final MetaProperty<Double> value = DirectMetaProperty.ofImmutable(\n                this, \"value\", ImmTolerance.class, Double.TYPE);\n        /**\n         * The meta-property for the {@code array} property.\n         */\n        private final MetaProperty<double[]> array = DirectMetaProperty.ofImmutable(\n                this, \"array\", ImmTolerance.class, double[].class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"value\",\n                \"array\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n                case 93090393:  // array\n                    return this.array;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmTolerance.Builder builder() {\n            return new ImmTolerance.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmTolerance> beanType() {\n            return ImmTolerance.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code value} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Double> value() {\n            return value;\n        }\n\n        /**\n         * The meta-property for the {@code array} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<double[]> array() {\n            return array;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return ((ImmTolerance) bean).getValue();\n                case 93090393:  // array\n                    return ((ImmTolerance) bean).getArray();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmTolerance}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmTolerance> {\n\n        private double value;\n        private double[] array;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmTolerance beanToCopy) {\n            this.value = beanToCopy.getValue();\n            this.array = (beanToCopy.getArray() != null ? beanToCopy.getArray().clone() : null);\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n                case 93090393:  // array\n                    return this.array;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    this.value = (Double) newValue;\n                    break;\n                case 93090393:  // array\n                    this.array = (double[]) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmTolerance build() {\n            return new ImmTolerance(\n                    value,\n                    array);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the value.\n         * @param value  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder value(double value) {\n            this.value = value;\n            return this;\n        }\n\n        /**\n         * Sets the array.\n         * @param array  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder array(double... array) {\n            this.array = array;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(96);\n            buf.append(\"ImmTolerance.Builder{\");\n            buf.append(\"value\").append('=').append(JodaBeanUtils.toString(value)).append(',').append(' ');\n            buf.append(\"array\").append('=').append(JodaBeanUtils.toString(array));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmTreeNode.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.beans.ConstructorProperties;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.collect.ImmutableList;\n\n/**\n * Mock immutable tree node, used for iterator testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(cacheHashCode = true, constructorScope = \"public@ConstructorProperties\", factoryName = \"of\")\npublic final class ImmTreeNode implements ImmutableBean{\n    // NOTE: no space between ImmutableBean and {\n\n    @PropertyDefinition(validate = \"notNull\")\n    private final String name;\n    @PropertyDefinition(equalsHashCodeStyle = \"getter\", toStringStyle = \"getter\")\n    private final ImmTreeNode child1;\n    @PropertyDefinition(equalsHashCodeStyle = \"getter\")\n    private final ImmTreeNode child2;\n    @PropertyDefinition(toStringStyle = \"getter\")\n    private final ImmTreeNode child3;\n    @PropertyDefinition(validate = \"notNull\", equalsHashCodeStyle = \"omit\", toStringStyle = \"omit\")\n    private final List<ImmTreeNode> childList;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmTreeNode}.\n     * @return the meta-bean, not null\n     */\n    public static ImmTreeNode.Meta meta() {\n        return ImmTreeNode.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmTreeNode.Meta.INSTANCE);\n    }\n\n    /**\n     * The cached hash code, using the racy single-check idiom.\n     */\n    private transient int cacheHashCode;\n\n    /**\n     * Obtains an instance.\n     * @param name  the value of the property, not null\n     * @param child1  the value of the property\n     * @param child2  the value of the property\n     * @param child3  the value of the property\n     * @param childList  the value of the property, not null\n     * @return the instance\n     */\n    public static ImmTreeNode of(\n            String name,\n            ImmTreeNode child1,\n            ImmTreeNode child2,\n            ImmTreeNode child3,\n            List<ImmTreeNode> childList) {\n        return new ImmTreeNode(\n            name,\n            child1,\n            child2,\n            child3,\n            childList);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static ImmTreeNode.Builder builder() {\n        return new ImmTreeNode.Builder();\n    }\n\n    /**\n     * Creates an instance.\n     * @param name  the value of the property, not null\n     * @param child1  the value of the property\n     * @param child2  the value of the property\n     * @param child3  the value of the property\n     * @param childList  the value of the property, not null\n     */\n    @ConstructorProperties({\"name\", \"child1\", \"child2\", \"child3\", \"childList\"})\n    public ImmTreeNode(\n            String name,\n            ImmTreeNode child1,\n            ImmTreeNode child2,\n            ImmTreeNode child3,\n            List<ImmTreeNode> childList) {\n        JodaBeanUtils.notNull(name, \"name\");\n        JodaBeanUtils.notNull(childList, \"childList\");\n        this.name = name;\n        this.child1 = child1;\n        this.child2 = child2;\n        this.child3 = child3;\n        this.childList = ImmutableList.copyOf(childList);\n    }\n\n    @Override\n    public ImmTreeNode.Meta metaBean() {\n        return ImmTreeNode.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property, not null\n     */\n    public String getName() {\n        return name;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the child1.\n     * @return the value of the property\n     */\n    public ImmTreeNode getChild1() {\n        return child1;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the child2.\n     * @return the value of the property\n     */\n    public ImmTreeNode getChild2() {\n        return child2;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the child3.\n     * @return the value of the property\n     */\n    public ImmTreeNode getChild3() {\n        return child3;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the childList.\n     * @return the value of the property, not null\n     */\n    public List<ImmTreeNode> getChildList() {\n        return childList;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmTreeNode other = (ImmTreeNode) obj;\n            return JodaBeanUtils.equal(this.name, other.name) &&\n                    JodaBeanUtils.equal(this.getChild1(), other.getChild1()) &&\n                    JodaBeanUtils.equal(this.getChild2(), other.getChild2()) &&\n                    JodaBeanUtils.equal(this.child3, other.child3);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = cacheHashCode;\n        if (hash == 0) {\n            hash = getClass().hashCode();\n            hash = hash * 31 + JodaBeanUtils.hashCode(name);\n            hash = hash * 31 + JodaBeanUtils.hashCode(getChild1());\n            hash = hash * 31 + JodaBeanUtils.hashCode(getChild2());\n            hash = hash * 31 + JodaBeanUtils.hashCode(child3);\n            cacheHashCode = hash;\n        }\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(160);\n        buf.append(\"ImmTreeNode{\");\n        buf.append(\"name\").append('=').append(JodaBeanUtils.toString(name)).append(',').append(' ');\n        buf.append(\"child1\").append('=').append(JodaBeanUtils.toString(getChild1())).append(',').append(' ');\n        buf.append(\"child2\").append('=').append(JodaBeanUtils.toString(child2)).append(',').append(' ');\n        buf.append(\"child3\").append('=').append(JodaBeanUtils.toString(getChild3()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmTreeNode}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code name} property.\n         */\n        private final MetaProperty<String> name = DirectMetaProperty.ofImmutable(\n                this, \"name\", ImmTreeNode.class, String.class);\n        /**\n         * The meta-property for the {@code child1} property.\n         */\n        private final MetaProperty<ImmTreeNode> child1 = DirectMetaProperty.ofImmutable(\n                this, \"child1\", ImmTreeNode.class, ImmTreeNode.class);\n        /**\n         * The meta-property for the {@code child2} property.\n         */\n        private final MetaProperty<ImmTreeNode> child2 = DirectMetaProperty.ofImmutable(\n                this, \"child2\", ImmTreeNode.class, ImmTreeNode.class);\n        /**\n         * The meta-property for the {@code child3} property.\n         */\n        private final MetaProperty<ImmTreeNode> child3 = DirectMetaProperty.ofImmutable(\n                this, \"child3\", ImmTreeNode.class, ImmTreeNode.class);\n        /**\n         * The meta-property for the {@code childList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<ImmTreeNode>> childList = DirectMetaProperty.ofImmutable(\n                this, \"childList\", ImmTreeNode.class, (Class) List.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"name\",\n                \"child1\",\n                \"child2\",\n                \"child3\",\n                \"childList\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n                case -1361400171:  // child1\n                    return this.child1;\n                case -1361400170:  // child2\n                    return this.child2;\n                case -1361400169:  // child3\n                    return this.child3;\n                case -95409190:  // childList\n                    return this.childList;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmTreeNode.Builder builder() {\n            return new ImmTreeNode.Builder();\n        }\n\n        @Override\n        public Class<? extends ImmTreeNode> beanType() {\n            return ImmTreeNode.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code name} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> name() {\n            return name;\n        }\n\n        /**\n         * The meta-property for the {@code child1} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmTreeNode> child1() {\n            return child1;\n        }\n\n        /**\n         * The meta-property for the {@code child2} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmTreeNode> child2() {\n            return child2;\n        }\n\n        /**\n         * The meta-property for the {@code child3} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmTreeNode> child3() {\n            return child3;\n        }\n\n        /**\n         * The meta-property for the {@code childList} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<List<ImmTreeNode>> childList() {\n            return childList;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return ((ImmTreeNode) bean).getName();\n                case -1361400171:  // child1\n                    return ((ImmTreeNode) bean).getChild1();\n                case -1361400170:  // child2\n                    return ((ImmTreeNode) bean).getChild2();\n                case -1361400169:  // child3\n                    return ((ImmTreeNode) bean).getChild3();\n                case -95409190:  // childList\n                    return ((ImmTreeNode) bean).getChildList();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmTreeNode}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<ImmTreeNode> {\n\n        private String name;\n        private ImmTreeNode child1;\n        private ImmTreeNode child2;\n        private ImmTreeNode child3;\n        private List<ImmTreeNode> childList = ImmutableList.of();\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmTreeNode beanToCopy) {\n            this.name = beanToCopy.getName();\n            this.child1 = beanToCopy.getChild1();\n            this.child2 = beanToCopy.getChild2();\n            this.child3 = beanToCopy.getChild3();\n            this.childList = ImmutableList.copyOf(beanToCopy.getChildList());\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n                case -1361400171:  // child1\n                    return this.child1;\n                case -1361400170:  // child2\n                    return this.child2;\n                case -1361400169:  // child3\n                    return this.child3;\n                case -95409190:  // childList\n                    return this.childList;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    this.name = (String) newValue;\n                    break;\n                case -1361400171:  // child1\n                    this.child1 = (ImmTreeNode) newValue;\n                    break;\n                case -1361400170:  // child2\n                    this.child2 = (ImmTreeNode) newValue;\n                    break;\n                case -1361400169:  // child3\n                    this.child3 = (ImmTreeNode) newValue;\n                    break;\n                case -95409190:  // childList\n                    this.childList = (List<ImmTreeNode>) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmTreeNode build() {\n            return new ImmTreeNode(\n                    name,\n                    child1,\n                    child2,\n                    child3,\n                    childList);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the name.\n         * @param name  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder name(String name) {\n            JodaBeanUtils.notNull(name, \"name\");\n            this.name = name;\n            return this;\n        }\n\n        /**\n         * Sets the child1.\n         * @param child1  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder child1(ImmTreeNode child1) {\n            this.child1 = child1;\n            return this;\n        }\n\n        /**\n         * Sets the child2.\n         * @param child2  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder child2(ImmTreeNode child2) {\n            this.child2 = child2;\n            return this;\n        }\n\n        /**\n         * Sets the child3.\n         * @param child3  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder child3(ImmTreeNode child3) {\n            this.child3 = child3;\n            return this;\n        }\n\n        /**\n         * Sets the childList.\n         * @param childList  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder childList(List<ImmTreeNode> childList) {\n            JodaBeanUtils.notNull(childList, \"childList\");\n            this.childList = childList;\n            return this;\n        }\n\n        /**\n         * Sets the {@code childList} property in the builder\n         * from an array of objects.\n         * @param childList  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder childList(ImmTreeNode... childList) {\n            return childList(ImmutableList.copyOf(childList));\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(160);\n            buf.append(\"ImmTreeNode.Builder{\");\n            buf.append(\"name\").append('=').append(JodaBeanUtils.toString(name)).append(',').append(' ');\n            buf.append(\"child1\").append('=').append(JodaBeanUtils.toString(child1)).append(',').append(' ');\n            buf.append(\"child2\").append('=').append(JodaBeanUtils.toString(child2)).append(',').append(' ');\n            buf.append(\"child3\").append('=').append(JodaBeanUtils.toString(child3));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmTypes.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.collect.ImmutableList;\nimport com.google.common.collect.ImmutableMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(builderScope = \"public\", factoryName = \"of\")\npublic final class ImmTypes<T extends Comparable<T>> implements ImmutableBean {\n\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableList<?> listWild;\n    @PropertyDefinition(validate = \"notNull\", type = \"List<?>\")\n    private final List<Object> listWildPublic1;\n    @PropertyDefinition(validate = \"notNull\", type = \"ImmutableList<?>\")\n    private final ImmutableList<Object> listWildPublic2;\n\n    @PropertyDefinition(validate = \"notNull\", builderType = \"List<?>\")\n    private final List<Object> listWildBuilder1;\n    @PropertyDefinition(validate = \"notNull\", builderType = \"List<? extends Address>\")\n    private final List<Address> listWildBuilder2;\n    @PropertyDefinition(validate = \"notNull\", builderType = \"Map<String, ? extends Address>\")\n    private final Map<String, Address> mapWildBuilder1;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmTypes}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static ImmTypes.Meta meta() {\n        return ImmTypes.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code ImmTypes}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Comparable<R>> ImmTypes.Meta<R> metaImmTypes(Class<R> cls) {\n        return ImmTypes.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmTypes.Meta.INSTANCE);\n    }\n\n    /**\n     * Obtains an instance.\n     * @param <T>  the type\n     * @param listWild  the value of the property, not null\n     * @param listWildPublic1  the value of the property, not null\n     * @param listWildPublic2  the value of the property, not null\n     * @param listWildBuilder1  the value of the property, not null\n     * @param listWildBuilder2  the value of the property, not null\n     * @param mapWildBuilder1  the value of the property, not null\n     * @return the instance\n     */\n    public static <T extends Comparable<T>> ImmTypes<T> of(\n            List<?> listWild,\n            List<?> listWildPublic1,\n            List<?> listWildPublic2,\n            List<?> listWildBuilder1,\n            List<? extends Address> listWildBuilder2,\n            Map<String, ? extends Address> mapWildBuilder1) {\n        return new ImmTypes<>(\n            listWild,\n            listWildPublic1,\n            listWildPublic2,\n            listWildBuilder1,\n            listWildBuilder2,\n            mapWildBuilder1);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @param <T>  the type\n     * @return the builder, not null\n     */\n    public static <T extends Comparable<T>> ImmTypes.Builder<T> builder() {\n        return new ImmTypes.Builder<>();\n    }\n\n    private ImmTypes(\n            List<?> listWild,\n            List<?> listWildPublic1,\n            List<?> listWildPublic2,\n            List<?> listWildBuilder1,\n            List<? extends Address> listWildBuilder2,\n            Map<String, ? extends Address> mapWildBuilder1) {\n        JodaBeanUtils.notNull(listWild, \"listWild\");\n        JodaBeanUtils.notNull(listWildPublic1, \"listWildPublic1\");\n        JodaBeanUtils.notNull(listWildPublic2, \"listWildPublic2\");\n        JodaBeanUtils.notNull(listWildBuilder1, \"listWildBuilder1\");\n        JodaBeanUtils.notNull(listWildBuilder2, \"listWildBuilder2\");\n        JodaBeanUtils.notNull(mapWildBuilder1, \"mapWildBuilder1\");\n        this.listWild = ImmutableList.copyOf(listWild);\n        this.listWildPublic1 = ImmutableList.copyOf(listWildPublic1);\n        this.listWildPublic2 = ImmutableList.copyOf(listWildPublic2);\n        this.listWildBuilder1 = ImmutableList.copyOf(listWildBuilder1);\n        this.listWildBuilder2 = ImmutableList.copyOf(listWildBuilder2);\n        this.mapWildBuilder1 = ImmutableMap.copyOf(mapWildBuilder1);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public ImmTypes.Meta<T> metaBean() {\n        return ImmTypes.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listWild.\n     * @return the value of the property, not null\n     */\n    public ImmutableList<?> getListWild() {\n        return listWild;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listWildPublic1.\n     * @return the value of the property, not null\n     */\n    public List<?> getListWildPublic1() {\n        return listWildPublic1;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listWildPublic2.\n     * @return the value of the property, not null\n     */\n    public ImmutableList<?> getListWildPublic2() {\n        return listWildPublic2;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listWildBuilder1.\n     * @return the value of the property, not null\n     */\n    public List<Object> getListWildBuilder1() {\n        return listWildBuilder1;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listWildBuilder2.\n     * @return the value of the property, not null\n     */\n    public List<Address> getListWildBuilder2() {\n        return listWildBuilder2;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the mapWildBuilder1.\n     * @return the value of the property, not null\n     */\n    public Map<String, Address> getMapWildBuilder1() {\n        return mapWildBuilder1;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder<T> toBuilder() {\n        return new Builder<>(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmTypes<?> other = (ImmTypes<?>) obj;\n            return JodaBeanUtils.equal(this.listWild, other.listWild) &&\n                    JodaBeanUtils.equal(this.listWildPublic1, other.listWildPublic1) &&\n                    JodaBeanUtils.equal(this.listWildPublic2, other.listWildPublic2) &&\n                    JodaBeanUtils.equal(this.listWildBuilder1, other.listWildBuilder1) &&\n                    JodaBeanUtils.equal(this.listWildBuilder2, other.listWildBuilder2) &&\n                    JodaBeanUtils.equal(this.mapWildBuilder1, other.mapWildBuilder1);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(listWild);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listWildPublic1);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listWildPublic2);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listWildBuilder1);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listWildBuilder2);\n        hash = hash * 31 + JodaBeanUtils.hashCode(mapWildBuilder1);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(224);\n        buf.append(\"ImmTypes{\");\n        buf.append(\"listWild\").append('=').append(JodaBeanUtils.toString(listWild)).append(',').append(' ');\n        buf.append(\"listWildPublic1\").append('=').append(JodaBeanUtils.toString(listWildPublic1)).append(',').append(' ');\n        buf.append(\"listWildPublic2\").append('=').append(JodaBeanUtils.toString(listWildPublic2)).append(',').append(' ');\n        buf.append(\"listWildBuilder1\").append('=').append(JodaBeanUtils.toString(listWildBuilder1)).append(',').append(' ');\n        buf.append(\"listWildBuilder2\").append('=').append(JodaBeanUtils.toString(listWildBuilder2)).append(',').append(' ');\n        buf.append(\"mapWildBuilder1\").append('=').append(JodaBeanUtils.toString(mapWildBuilder1));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmTypes}.\n     * @param <T>  the type\n     */\n    public static final class Meta<T extends Comparable<T>> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code listWild} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableList<?>> listWild = DirectMetaProperty.ofImmutable(\n                this, \"listWild\", ImmTypes.class, (Class) ImmutableList.class);\n        /**\n         * The meta-property for the {@code listWildPublic1} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<?>> listWildPublic1 = DirectMetaProperty.ofImmutable(\n                this, \"listWildPublic1\", ImmTypes.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code listWildPublic2} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableList<?>> listWildPublic2 = DirectMetaProperty.ofImmutable(\n                this, \"listWildPublic2\", ImmTypes.class, (Class) ImmutableList.class);\n        /**\n         * The meta-property for the {@code listWildBuilder1} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<Object>> listWildBuilder1 = DirectMetaProperty.ofImmutable(\n                this, \"listWildBuilder1\", ImmTypes.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code listWildBuilder2} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<Address>> listWildBuilder2 = DirectMetaProperty.ofImmutable(\n                this, \"listWildBuilder2\", ImmTypes.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code mapWildBuilder1} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Map<String, Address>> mapWildBuilder1 = DirectMetaProperty.ofImmutable(\n                this, \"mapWildBuilder1\", ImmTypes.class, (Class) Map.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"listWild\",\n                \"listWildPublic1\",\n                \"listWildPublic2\",\n                \"listWildBuilder1\",\n                \"listWildBuilder2\",\n                \"mapWildBuilder1\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 1345738120:  // listWild\n                    return this.listWild;\n                case 1874924608:  // listWildPublic1\n                    return this.listWildPublic1;\n                case 1874924609:  // listWildPublic2\n                    return this.listWildPublic2;\n                case -436161122:  // listWildBuilder1\n                    return this.listWildBuilder1;\n                case -436161121:  // listWildBuilder2\n                    return this.listWildBuilder2;\n                case -2009039524:  // mapWildBuilder1\n                    return this.mapWildBuilder1;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmTypes.Builder<T> builder() {\n            return new ImmTypes.Builder<>();\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends ImmTypes<T>> beanType() {\n            return (Class) ImmTypes.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code listWild} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableList<?>> listWild() {\n            return listWild;\n        }\n\n        /**\n         * The meta-property for the {@code listWildPublic1} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<List<?>> listWildPublic1() {\n            return listWildPublic1;\n        }\n\n        /**\n         * The meta-property for the {@code listWildPublic2} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableList<?>> listWildPublic2() {\n            return listWildPublic2;\n        }\n\n        /**\n         * The meta-property for the {@code listWildBuilder1} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<List<Object>> listWildBuilder1() {\n            return listWildBuilder1;\n        }\n\n        /**\n         * The meta-property for the {@code listWildBuilder2} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<List<Address>> listWildBuilder2() {\n            return listWildBuilder2;\n        }\n\n        /**\n         * The meta-property for the {@code mapWildBuilder1} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Map<String, Address>> mapWildBuilder1() {\n            return mapWildBuilder1;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 1345738120:  // listWild\n                    return ((ImmTypes<?>) bean).getListWild();\n                case 1874924608:  // listWildPublic1\n                    return ((ImmTypes<?>) bean).getListWildPublic1();\n                case 1874924609:  // listWildPublic2\n                    return ((ImmTypes<?>) bean).getListWildPublic2();\n                case -436161122:  // listWildBuilder1\n                    return ((ImmTypes<?>) bean).getListWildBuilder1();\n                case -436161121:  // listWildBuilder2\n                    return ((ImmTypes<?>) bean).getListWildBuilder2();\n                case -2009039524:  // mapWildBuilder1\n                    return ((ImmTypes<?>) bean).getMapWildBuilder1();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmTypes}.\n     * @param <T>  the type\n     */\n    public static final class Builder<T extends Comparable<T>> extends DirectFieldsBeanBuilder<ImmTypes<T>> {\n\n        private List<?> listWild = ImmutableList.of();\n        private List<?> listWildPublic1 = ImmutableList.of();\n        private List<?> listWildPublic2 = ImmutableList.of();\n        private List<?> listWildBuilder1 = ImmutableList.of();\n        private List<? extends Address> listWildBuilder2 = ImmutableList.of();\n        private Map<String, ? extends Address> mapWildBuilder1 = ImmutableMap.of();\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmTypes<T> beanToCopy) {\n            this.listWild = beanToCopy.getListWild();\n            this.listWildPublic1 = ImmutableList.copyOf(beanToCopy.getListWildPublic1());\n            this.listWildPublic2 = beanToCopy.getListWildPublic2();\n            this.listWildBuilder1 = ImmutableList.copyOf(beanToCopy.getListWildBuilder1());\n            this.listWildBuilder2 = ImmutableList.copyOf(beanToCopy.getListWildBuilder2());\n            this.mapWildBuilder1 = ImmutableMap.copyOf(beanToCopy.getMapWildBuilder1());\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 1345738120:  // listWild\n                    return this.listWild;\n                case 1874924608:  // listWildPublic1\n                    return this.listWildPublic1;\n                case 1874924609:  // listWildPublic2\n                    return this.listWildPublic2;\n                case -436161122:  // listWildBuilder1\n                    return this.listWildBuilder1;\n                case -436161121:  // listWildBuilder2\n                    return this.listWildBuilder2;\n                case -2009039524:  // mapWildBuilder1\n                    return this.mapWildBuilder1;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder<T> set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 1345738120:  // listWild\n                    this.listWild = (List<?>) newValue;\n                    break;\n                case 1874924608:  // listWildPublic1\n                    this.listWildPublic1 = (List<?>) newValue;\n                    break;\n                case 1874924609:  // listWildPublic2\n                    this.listWildPublic2 = (List<?>) newValue;\n                    break;\n                case -436161122:  // listWildBuilder1\n                    this.listWildBuilder1 = (List<?>) newValue;\n                    break;\n                case -436161121:  // listWildBuilder2\n                    this.listWildBuilder2 = (List<? extends Address>) newValue;\n                    break;\n                case -2009039524:  // mapWildBuilder1\n                    this.mapWildBuilder1 = (Map<String, ? extends Address>) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder<T> set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmTypes<T> build() {\n            return new ImmTypes<>(\n                    listWild,\n                    listWildPublic1,\n                    listWildPublic2,\n                    listWildBuilder1,\n                    listWildBuilder2,\n                    mapWildBuilder1);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the listWild.\n         * @param listWild  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWild(List<?> listWild) {\n            JodaBeanUtils.notNull(listWild, \"listWild\");\n            this.listWild = listWild;\n            return this;\n        }\n\n        /**\n         * Sets the {@code listWild} property in the builder\n         * from an array of objects.\n         * @param listWild  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWild(Object... listWild) {\n            return listWild(ImmutableList.copyOf(listWild));\n        }\n\n        /**\n         * Sets the listWildPublic1.\n         * @param listWildPublic1  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWildPublic1(List<?> listWildPublic1) {\n            JodaBeanUtils.notNull(listWildPublic1, \"listWildPublic1\");\n            this.listWildPublic1 = listWildPublic1;\n            return this;\n        }\n\n        /**\n         * Sets the {@code listWildPublic1} property in the builder\n         * from an array of objects.\n         * @param listWildPublic1  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWildPublic1(Object... listWildPublic1) {\n            return listWildPublic1(ImmutableList.copyOf(listWildPublic1));\n        }\n\n        /**\n         * Sets the listWildPublic2.\n         * @param listWildPublic2  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWildPublic2(List<?> listWildPublic2) {\n            JodaBeanUtils.notNull(listWildPublic2, \"listWildPublic2\");\n            this.listWildPublic2 = listWildPublic2;\n            return this;\n        }\n\n        /**\n         * Sets the {@code listWildPublic2} property in the builder\n         * from an array of objects.\n         * @param listWildPublic2  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWildPublic2(Object... listWildPublic2) {\n            return listWildPublic2(ImmutableList.copyOf(listWildPublic2));\n        }\n\n        /**\n         * Sets the listWildBuilder1.\n         * @param listWildBuilder1  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWildBuilder1(List<?> listWildBuilder1) {\n            JodaBeanUtils.notNull(listWildBuilder1, \"listWildBuilder1\");\n            this.listWildBuilder1 = listWildBuilder1;\n            return this;\n        }\n\n        /**\n         * Sets the {@code listWildBuilder1} property in the builder\n         * from an array of objects.\n         * @param listWildBuilder1  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWildBuilder1(Object... listWildBuilder1) {\n            return listWildBuilder1(ImmutableList.copyOf(listWildBuilder1));\n        }\n\n        /**\n         * Sets the listWildBuilder2.\n         * @param listWildBuilder2  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWildBuilder2(List<? extends Address> listWildBuilder2) {\n            JodaBeanUtils.notNull(listWildBuilder2, \"listWildBuilder2\");\n            this.listWildBuilder2 = listWildBuilder2;\n            return this;\n        }\n\n        /**\n         * Sets the {@code listWildBuilder2} property in the builder\n         * from an array of objects.\n         * @param listWildBuilder2  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> listWildBuilder2(Address... listWildBuilder2) {\n            return listWildBuilder2(ImmutableList.copyOf(listWildBuilder2));\n        }\n\n        /**\n         * Sets the mapWildBuilder1.\n         * @param mapWildBuilder1  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> mapWildBuilder1(Map<String, ? extends Address> mapWildBuilder1) {\n            JodaBeanUtils.notNull(mapWildBuilder1, \"mapWildBuilder1\");\n            this.mapWildBuilder1 = mapWildBuilder1;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(224);\n            buf.append(\"ImmTypes.Builder{\");\n            buf.append(\"listWild\").append('=').append(JodaBeanUtils.toString(listWild)).append(',').append(' ');\n            buf.append(\"listWildPublic1\").append('=').append(JodaBeanUtils.toString(listWildPublic1)).append(',').append(' ');\n            buf.append(\"listWildPublic2\").append('=').append(JodaBeanUtils.toString(listWildPublic2)).append(',').append(' ');\n            buf.append(\"listWildBuilder1\").append('=').append(JodaBeanUtils.toString(listWildBuilder1)).append(',').append(' ');\n            buf.append(\"listWildBuilder2\").append('=').append(JodaBeanUtils.toString(listWildBuilder2)).append(',').append(' ');\n            buf.append(\"mapWildBuilder1\").append('=').append(JodaBeanUtils.toString(mapWildBuilder1));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ImmUnusedGeneric.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(builderScope = \"package\", factoryName = \"of\")\npublic final class ImmUnusedGeneric<T> implements ImmutableBean {\n\n    @PropertyDefinition(validate = \"notNull\")\n    private final String errorMessage;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ImmUnusedGeneric}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static ImmUnusedGeneric.Meta meta() {\n        return ImmUnusedGeneric.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code ImmUnusedGeneric}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R> ImmUnusedGeneric.Meta<R> metaImmUnusedGeneric(Class<R> cls) {\n        return ImmUnusedGeneric.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ImmUnusedGeneric.Meta.INSTANCE);\n    }\n\n    /**\n     * Obtains an instance.\n     * @param <T>  the type\n     * @param errorMessage  the value of the property, not null\n     * @return the instance\n     */\n    public static <T> ImmUnusedGeneric<T> of(\n            String errorMessage) {\n        return new ImmUnusedGeneric<>(\n            errorMessage);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @param <T>  the type\n     * @return the builder, not null\n     */\n    static <T> ImmUnusedGeneric.Builder<T> builder() {\n        return new ImmUnusedGeneric.Builder<>();\n    }\n\n    private ImmUnusedGeneric(\n            String errorMessage) {\n        JodaBeanUtils.notNull(errorMessage, \"errorMessage\");\n        this.errorMessage = errorMessage;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public ImmUnusedGeneric.Meta<T> metaBean() {\n        return ImmUnusedGeneric.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the errorMessage.\n     * @return the value of the property, not null\n     */\n    public String getErrorMessage() {\n        return errorMessage;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    Builder<T> toBuilder() {\n        return new Builder<>(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ImmUnusedGeneric<?> other = (ImmUnusedGeneric<?>) obj;\n            return JodaBeanUtils.equal(this.errorMessage, other.errorMessage);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(errorMessage);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"ImmUnusedGeneric{\");\n        buf.append(\"errorMessage\").append('=').append(JodaBeanUtils.toString(errorMessage));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ImmUnusedGeneric}.\n     * @param <T>  the type\n     */\n    public static final class Meta<T> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code errorMessage} property.\n         */\n        private final MetaProperty<String> errorMessage = DirectMetaProperty.ofImmutable(\n                this, \"errorMessage\", ImmUnusedGeneric.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"errorMessage\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 1203236063:  // errorMessage\n                    return this.errorMessage;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public ImmUnusedGeneric.Builder<T> builder() {\n            return new ImmUnusedGeneric.Builder<>();\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends ImmUnusedGeneric<T>> beanType() {\n            return (Class) ImmUnusedGeneric.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code errorMessage} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> errorMessage() {\n            return errorMessage;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 1203236063:  // errorMessage\n                    return ((ImmUnusedGeneric<?>) bean).getErrorMessage();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code ImmUnusedGeneric}.\n     * @param <T>  the type\n     */\n    static final class Builder<T> extends DirectFieldsBeanBuilder<ImmUnusedGeneric<T>> {\n\n        private String errorMessage;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(ImmUnusedGeneric<T> beanToCopy) {\n            this.errorMessage = beanToCopy.getErrorMessage();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 1203236063:  // errorMessage\n                    return this.errorMessage;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder<T> set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 1203236063:  // errorMessage\n                    this.errorMessage = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder<T> set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public ImmUnusedGeneric<T> build() {\n            return new ImmUnusedGeneric<>(\n                    errorMessage);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the errorMessage.\n         * @param errorMessage  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder<T> errorMessage(String errorMessage) {\n            JodaBeanUtils.notNull(errorMessage, \"errorMessage\");\n            this.errorMessage = errorMessage;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"ImmUnusedGeneric.Builder{\");\n            buf.append(\"errorMessage\").append('=').append(JodaBeanUtils.toString(errorMessage));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/JodaConvertBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\nimport org.joda.convert.FromString;\nimport org.joda.convert.ToString;\n\n/**\n * A bean that is also a Joda-Convert type, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class JodaConvertBean extends DirectBean {\n\n    /**\n     * The base value.\n     */\n    @PropertyDefinition\n    private String base;\n    /**\n     * The extra value.\n     */\n    @PropertyDefinition\n    private int extra;\n\n    public JodaConvertBean() {\n    }\n\n    @FromString\n    public JodaConvertBean(String text) {\n        base = text.substring(0, text.indexOf(':'));\n        extra = Integer.parseInt(text.substring(text.indexOf(':') + 1));\n    }\n\n    @ToString\n    public String formattedString() {\n        return base + \":\" + extra;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code JodaConvertBean}.\n     * @return the meta-bean, not null\n     */\n    public static JodaConvertBean.Meta meta() {\n        return JodaConvertBean.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(JodaConvertBean.Meta.INSTANCE);\n    }\n\n    @Override\n    public JodaConvertBean.Meta metaBean() {\n        return JodaConvertBean.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the base value.\n     * @return the value of the property\n     */\n    public String getBase() {\n        return base;\n    }\n\n    /**\n     * Sets the base value.\n     * @param base  the new value of the property\n     */\n    public void setBase(String base) {\n        this.base = base;\n    }\n\n    /**\n     * Gets the the {@code base} property.\n     * @return the property, not null\n     */\n    public final Property<String> base() {\n        return metaBean().base().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the extra value.\n     * @return the value of the property\n     */\n    public int getExtra() {\n        return extra;\n    }\n\n    /**\n     * Sets the extra value.\n     * @param extra  the new value of the property\n     */\n    public void setExtra(int extra) {\n        this.extra = extra;\n    }\n\n    /**\n     * Gets the the {@code extra} property.\n     * @return the property, not null\n     */\n    public final Property<Integer> extra() {\n        return metaBean().extra().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public JodaConvertBean clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            JodaConvertBean other = (JodaConvertBean) obj;\n            return JodaBeanUtils.equal(this.getBase(), other.getBase()) &&\n                    (this.getExtra() == other.getExtra());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getBase());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getExtra());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"JodaConvertBean{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"base\").append('=').append(JodaBeanUtils.toString(getBase())).append(',').append(' ');\n        buf.append(\"extra\").append('=').append(JodaBeanUtils.toString(getExtra())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code JodaConvertBean}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code base} property.\n         */\n        private final MetaProperty<String> base = DirectMetaProperty.ofReadWrite(\n                this, \"base\", JodaConvertBean.class, String.class);\n        /**\n         * The meta-property for the {@code extra} property.\n         */\n        private final MetaProperty<Integer> extra = DirectMetaProperty.ofReadWrite(\n                this, \"extra\", JodaConvertBean.class, Integer.TYPE);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"base\",\n                \"extra\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3016401:  // base\n                    return this.base;\n                case 96965648:  // extra\n                    return this.extra;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends JodaConvertBean> builder() {\n            return new DirectBeanBuilder<>(new JodaConvertBean());\n        }\n\n        @Override\n        public Class<? extends JodaConvertBean> beanType() {\n            return JodaConvertBean.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code base} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> base() {\n            return base;\n        }\n\n        /**\n         * The meta-property for the {@code extra} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Integer> extra() {\n            return extra;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3016401:  // base\n                    return ((JodaConvertBean) bean).getBase();\n                case 96965648:  // extra\n                    return ((JodaConvertBean) bean).getExtra();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3016401:  // base\n                    ((JodaConvertBean) bean).setBase((String) newValue);\n                    return;\n                case 96965648:  // extra\n                    ((JodaConvertBean) bean).setExtra((Integer) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/JodaConvertInterface.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport org.joda.convert.FromString;\nimport org.joda.convert.ToString;\n\n/**\n * Mock JodaConvert interface, used for testing.\n */\npublic interface JodaConvertInterface extends IKey {\n\n    @FromString\n    public static JodaConvertInterface of(String uniqueName) {\n        return uniqueName.equalsIgnoreCase(First.INSTANCE.toString()) ?\n            First.INSTANCE :\n            Second.INSTANCE;\n    }\n\n    @ToString\n    @Override\n    public abstract String toString();\n    \n    @Override\n    public default String getName() {\n        return toString();\n    }\n\n    final class First implements JodaConvertInterface {\n\n        static final First INSTANCE = new First();\n\n        @Override\n        public String toString() {\n            return \"First\";\n        }\n    }\n\n    final class Second implements JodaConvertInterface {\n\n        static final Second INSTANCE = new Second();\n\n        @Override\n        public String toString() {\n            return \"Second\";\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/JodaConvertWrapper.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Wraps {@code JodaConvertBean}, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class JodaConvertWrapper extends DirectBean {\n\n    /**\n     * The base value.\n     */\n    @PropertyDefinition\n    private JodaConvertBean bean;\n    /**\n     * The extra value.\n     */\n    @PropertyDefinition\n    private String description;\n\n    public JodaConvertWrapper() {\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code JodaConvertWrapper}.\n     * @return the meta-bean, not null\n     */\n    public static JodaConvertWrapper.Meta meta() {\n        return JodaConvertWrapper.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(JodaConvertWrapper.Meta.INSTANCE);\n    }\n\n    @Override\n    public JodaConvertWrapper.Meta metaBean() {\n        return JodaConvertWrapper.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the base value.\n     * @return the value of the property\n     */\n    public JodaConvertBean getBean() {\n        return bean;\n    }\n\n    /**\n     * Sets the base value.\n     * @param bean  the new value of the property\n     */\n    public void setBean(JodaConvertBean bean) {\n        this.bean = bean;\n    }\n\n    /**\n     * Gets the the {@code bean} property.\n     * @return the property, not null\n     */\n    public final Property<JodaConvertBean> bean() {\n        return metaBean().bean().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the extra value.\n     * @return the value of the property\n     */\n    public String getDescription() {\n        return description;\n    }\n\n    /**\n     * Sets the extra value.\n     * @param description  the new value of the property\n     */\n    public void setDescription(String description) {\n        this.description = description;\n    }\n\n    /**\n     * Gets the the {@code description} property.\n     * @return the property, not null\n     */\n    public final Property<String> description() {\n        return metaBean().description().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public JodaConvertWrapper clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            JodaConvertWrapper other = (JodaConvertWrapper) obj;\n            return JodaBeanUtils.equal(this.getBean(), other.getBean()) &&\n                    JodaBeanUtils.equal(this.getDescription(), other.getDescription());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getBean());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getDescription());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"JodaConvertWrapper{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"bean\").append('=').append(JodaBeanUtils.toString(getBean())).append(',').append(' ');\n        buf.append(\"description\").append('=').append(JodaBeanUtils.toString(getDescription())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code JodaConvertWrapper}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code bean} property.\n         */\n        private final MetaProperty<JodaConvertBean> bean = DirectMetaProperty.ofReadWrite(\n                this, \"bean\", JodaConvertWrapper.class, JodaConvertBean.class);\n        /**\n         * The meta-property for the {@code description} property.\n         */\n        private final MetaProperty<String> description = DirectMetaProperty.ofReadWrite(\n                this, \"description\", JodaConvertWrapper.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"bean\",\n                \"description\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3019696:  // bean\n                    return this.bean;\n                case -1724546052:  // description\n                    return this.description;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends JodaConvertWrapper> builder() {\n            return new DirectBeanBuilder<>(new JodaConvertWrapper());\n        }\n\n        @Override\n        public Class<? extends JodaConvertWrapper> beanType() {\n            return JodaConvertWrapper.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code bean} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<JodaConvertBean> bean() {\n            return bean;\n        }\n\n        /**\n         * The meta-property for the {@code description} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> description() {\n            return description;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3019696:  // bean\n                    return ((JodaConvertWrapper) bean).getBean();\n                case -1724546052:  // description\n                    return ((JodaConvertWrapper) bean).getDescription();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3019696:  // bean\n                    ((JodaConvertWrapper) bean).setBean((JodaConvertBean) newValue);\n                    return;\n                case -1724546052:  // description\n                    ((JodaConvertWrapper) bean).setDescription((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/LightEmpty.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.lang.invoke.MethodHandles;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.impl.light.LightMetaBean;\n\n/**\n * Mock immutable empty bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"light\")\npublic final class LightEmpty implements ImmutableBean {\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code LightEmpty}.\n     */\n    private static final TypedMetaBean<LightEmpty> META_BEAN =\n            LightMetaBean.of(LightEmpty.class, MethodHandles.lookup());\n\n    /**\n     * The meta-bean for {@code LightEmpty}.\n     * @return the meta-bean, not null\n     */\n    public static TypedMetaBean<LightEmpty> meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    private LightEmpty() {\n    }\n\n    @Override\n    public TypedMetaBean<LightEmpty> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(32);\n        buf.append(\"LightEmpty{\");\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/LightImmutable.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.lang.invoke.MethodHandles;\nimport java.util.Currency;\nimport java.util.List;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.DerivedProperty;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.light.LightMetaBean;\n\nimport com.google.common.base.Optional;\nimport com.google.common.collect.ImmutableList;\n\n/**\n * Mock light bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"light\", constructorScope = \"package\")\npublic final class LightImmutable implements ImmutableBean, Serializable {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final int number;\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final boolean flag;\n    /**\n     * The street.\n     */\n    @PropertyDefinition(validate = \"notNull\", get = \"field\")\n    private final String street;\n    /**\n     * The town.\n     */\n    @PropertyDefinition(get = \"optionalGuava\")\n    private final String town;\n    /**\n     * The city.\n     */\n    @PropertyDefinition(validate = \"notNull\", alias = \"place\")\n    private final String city;\n    /**\n     * The owner.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmPerson owner;\n    /**\n     * The list.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableList<String> list;\n    /**\n     * The currency.\n     */\n    @PropertyDefinition(get = \"optionalGuava\")\n    private final Currency currency;\n    /**\n     * The hidden text.\n     */\n    @PropertyDefinition(get = \"\")\n    private final String hiddenText;\n    /**\n     * The long.\n     */\n    @PropertyDefinition\n    private final long valueLong;\n    /**\n     * The short.\n     */\n    @PropertyDefinition\n    private final short valueShort;\n    /**\n     * The char.\n     */\n    @PropertyDefinition\n    private final char valueChar;\n    /**\n     * The byte.\n     */\n    @PropertyDefinition\n    private final byte valueByte;\n\n    //-----------------------------------------------------------------------\n    // manual getter with a different name\n    public String getStreetName() {\n        return street;\n    }\n\n    // derived\n    @DerivedProperty\n    public String getAddress() {\n        return number + \" \" + street + \" \" + city;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code LightImmutable}.\n     */\n    private static final TypedMetaBean<LightImmutable> META_BEAN =\n            LightMetaBean.of(\n                    LightImmutable.class,\n                    MethodHandles.lookup(),\n                    new String[] {\n                            \"number\",\n                            \"flag\",\n                            \"street\",\n                            \"town\",\n                            \"city\",\n                            \"owner\",\n                            \"list\",\n                            \"currency\",\n                            \"hiddenText\",\n                            \"valueLong\",\n                            \"valueShort\",\n                            \"valueChar\",\n                            \"valueByte\"},\n                    0,\n                    Boolean.FALSE,\n                    null,\n                    null,\n                    null,\n                    null,\n                    ImmutableList.of(),\n                    null,\n                    null,\n                    0L,\n                    (short) 0,\n                    '\\u0000',\n                    (byte) 0)\n                    .withAlias(\"place\", \"city\");\n\n    /**\n     * The meta-bean for {@code LightImmutable}.\n     * @return the meta-bean, not null\n     */\n    public static TypedMetaBean<LightImmutable> meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Creates an instance.\n     * @param number  the value of the property\n     * @param flag  the value of the property\n     * @param street  the value of the property, not null\n     * @param town  the value of the property\n     * @param city  the value of the property, not null\n     * @param owner  the value of the property, not null\n     * @param list  the value of the property, not null\n     * @param currency  the value of the property\n     * @param hiddenText  the value of the property\n     * @param valueLong  the value of the property\n     * @param valueShort  the value of the property\n     * @param valueChar  the value of the property\n     * @param valueByte  the value of the property\n     */\n    LightImmutable(\n            int number,\n            boolean flag,\n            String street,\n            String town,\n            String city,\n            ImmPerson owner,\n            List<String> list,\n            Currency currency,\n            String hiddenText,\n            long valueLong,\n            short valueShort,\n            char valueChar,\n            byte valueByte) {\n        JodaBeanUtils.notNull(street, \"street\");\n        JodaBeanUtils.notNull(city, \"city\");\n        JodaBeanUtils.notNull(owner, \"owner\");\n        JodaBeanUtils.notNull(list, \"list\");\n        this.number = number;\n        this.flag = flag;\n        this.street = street;\n        this.town = town;\n        this.city = city;\n        this.owner = owner;\n        this.list = ImmutableList.copyOf(list);\n        this.currency = currency;\n        this.hiddenText = hiddenText;\n        this.valueLong = valueLong;\n        this.valueShort = valueShort;\n        this.valueChar = valueChar;\n        this.valueByte = valueByte;\n    }\n\n    @Override\n    public TypedMetaBean<LightImmutable> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public int getNumber() {\n        return number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public boolean isFlag() {\n        return flag;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the town.\n     * @return the optional value of the property, not null\n     */\n    public Optional<String> getTown() {\n        return Optional.fromNullable(town);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the city.\n     * @return the value of the property, not null\n     */\n    public String getCity() {\n        return city;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the owner.\n     * @return the value of the property, not null\n     */\n    public ImmPerson getOwner() {\n        return owner;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the list.\n     * @return the value of the property, not null\n     */\n    public ImmutableList<String> getList() {\n        return list;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the currency.\n     * @return the optional value of the property, not null\n     */\n    public Optional<Currency> getCurrency() {\n        return Optional.fromNullable(currency);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the long.\n     * @return the value of the property\n     */\n    public long getValueLong() {\n        return valueLong;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the short.\n     * @return the value of the property\n     */\n    public short getValueShort() {\n        return valueShort;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the char.\n     * @return the value of the property\n     */\n    public char getValueChar() {\n        return valueChar;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the byte.\n     * @return the value of the property\n     */\n    public byte getValueByte() {\n        return valueByte;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            LightImmutable other = (LightImmutable) obj;\n            return (this.number == other.number) &&\n                    (this.flag == other.flag) &&\n                    JodaBeanUtils.equal(this.street, other.street) &&\n                    JodaBeanUtils.equal(this.town, other.town) &&\n                    JodaBeanUtils.equal(this.city, other.city) &&\n                    JodaBeanUtils.equal(this.owner, other.owner) &&\n                    JodaBeanUtils.equal(this.list, other.list) &&\n                    JodaBeanUtils.equal(this.currency, other.currency) &&\n                    JodaBeanUtils.equal(this.hiddenText, other.hiddenText) &&\n                    (this.valueLong == other.valueLong) &&\n                    (this.valueShort == other.valueShort) &&\n                    (this.valueChar == other.valueChar) &&\n                    (this.valueByte == other.valueByte);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(number);\n        hash = hash * 31 + JodaBeanUtils.hashCode(flag);\n        hash = hash * 31 + JodaBeanUtils.hashCode(street);\n        hash = hash * 31 + JodaBeanUtils.hashCode(town);\n        hash = hash * 31 + JodaBeanUtils.hashCode(city);\n        hash = hash * 31 + JodaBeanUtils.hashCode(owner);\n        hash = hash * 31 + JodaBeanUtils.hashCode(list);\n        hash = hash * 31 + JodaBeanUtils.hashCode(currency);\n        hash = hash * 31 + JodaBeanUtils.hashCode(hiddenText);\n        hash = hash * 31 + JodaBeanUtils.hashCode(valueLong);\n        hash = hash * 31 + JodaBeanUtils.hashCode(valueShort);\n        hash = hash * 31 + JodaBeanUtils.hashCode(valueChar);\n        hash = hash * 31 + JodaBeanUtils.hashCode(valueByte);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(480);\n        buf.append(\"LightImmutable{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n        buf.append(\"flag\").append('=').append(JodaBeanUtils.toString(flag)).append(',').append(' ');\n        buf.append(\"street\").append('=').append(JodaBeanUtils.toString(street)).append(',').append(' ');\n        buf.append(\"town\").append('=').append(JodaBeanUtils.toString(town)).append(',').append(' ');\n        buf.append(\"city\").append('=').append(JodaBeanUtils.toString(city)).append(',').append(' ');\n        buf.append(\"owner\").append('=').append(JodaBeanUtils.toString(owner)).append(',').append(' ');\n        buf.append(\"list\").append('=').append(JodaBeanUtils.toString(list)).append(',').append(' ');\n        buf.append(\"currency\").append('=').append(JodaBeanUtils.toString(currency)).append(',').append(' ');\n        buf.append(\"hiddenText\").append('=').append(JodaBeanUtils.toString(hiddenText)).append(',').append(' ');\n        buf.append(\"valueLong\").append('=').append(JodaBeanUtils.toString(valueLong)).append(',').append(' ');\n        buf.append(\"valueShort\").append('=').append(JodaBeanUtils.toString(valueShort)).append(',').append(' ');\n        buf.append(\"valueChar\").append('=').append(JodaBeanUtils.toString(valueChar)).append(',').append(' ');\n        buf.append(\"valueByte\").append('=').append(JodaBeanUtils.toString(valueByte)).append(',').append(' ');\n        buf.append(\"address\").append('=').append(JodaBeanUtils.toString(getAddress()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/LightImmutableGeneric.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.lang.invoke.MethodHandles;\nimport java.util.List;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.light.LightMetaBean;\n\nimport com.google.common.collect.ImmutableList;\n\n/**\n * Mock light bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"light\")\npublic final class LightImmutableGeneric<T extends Number> implements ImmutableBean, Serializable {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final T number;\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final List<T> list;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code LightImmutableGeneric}.\n     */\n    private static final MetaBean META_BEAN =\n            LightMetaBean.of(\n                    LightImmutableGeneric.class,\n                    MethodHandles.lookup(),\n                    new String[] {\n                            \"number\",\n                            \"list\"},\n                    null,\n                    ImmutableList.of());\n\n    /**\n     * The meta-bean for {@code LightImmutableGeneric}.\n     * @return the meta-bean, not null\n     */\n    public static MetaBean meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    private LightImmutableGeneric(\n            T number,\n            List<T> list) {\n        this.number = number;\n        this.list = (list != null ? ImmutableList.copyOf(list) : null);\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public TypedMetaBean<LightImmutableGeneric<T>> metaBean() {\n        return (TypedMetaBean<LightImmutableGeneric<T>>) META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public T getNumber() {\n        return number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public List<T> getList() {\n        return list;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            LightImmutableGeneric<?> other = (LightImmutableGeneric<?>) obj;\n            return JodaBeanUtils.equal(this.number, other.number) &&\n                    JodaBeanUtils.equal(this.list, other.list);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(number);\n        hash = hash * 31 + JodaBeanUtils.hashCode(list);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"LightImmutableGeneric{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n        buf.append(\"list\").append('=').append(JodaBeanUtils.toString(list));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/LightImmutableSimple.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.lang.invoke.MethodHandles;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.light.LightMetaBean;\n\n/**\n * Mock light bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"light\", constructorScope = \"package\")\npublic final class LightImmutableSimple implements ImmutableBean, Serializable {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final int number;\n    /**\n     * The text.\n     */\n    @PropertyDefinition\n    private final String text;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code LightImmutableSimple}.\n     */\n    private static final TypedMetaBean<LightImmutableSimple> META_BEAN =\n            LightMetaBean.of(\n                    LightImmutableSimple.class,\n                    MethodHandles.lookup(),\n                    new String[] {\n                            \"number\",\n                            \"text\"},\n                    new Object[0]);\n\n    /**\n     * The meta-bean for {@code LightImmutableSimple}.\n     * @return the meta-bean, not null\n     */\n    public static TypedMetaBean<LightImmutableSimple> meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Creates an instance.\n     * @param number  the value of the property\n     * @param text  the value of the property\n     */\n    LightImmutableSimple(\n            int number,\n            String text) {\n        this.number = number;\n        this.text = text;\n    }\n\n    @Override\n    public TypedMetaBean<LightImmutableSimple> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public int getNumber() {\n        return number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the text.\n     * @return the value of the property\n     */\n    public String getText() {\n        return text;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            LightImmutableSimple other = (LightImmutableSimple) obj;\n            return (this.number == other.number) &&\n                    JodaBeanUtils.equal(this.text, other.text);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(number);\n        hash = hash * 31 + JodaBeanUtils.hashCode(text);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"LightImmutableSimple{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n        buf.append(\"text\").append('=').append(JodaBeanUtils.toString(text));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/LightMutable.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.lang.invoke.MethodHandles;\nimport java.util.ArrayList;\nimport java.util.Currency;\nimport java.util.List;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.DerivedProperty;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.light.LightMetaBean;\n\nimport com.google.common.base.Optional;\nimport com.google.common.collect.ImmutableList;\n\n/**\n * Mock light bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"light\", constructorScope = \"package\")\npublic final class LightMutable implements Bean, Serializable {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private int number;\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private boolean flag;\n    /**\n     * The street.\n     */\n    @PropertyDefinition(validate = \"notNull\", get = \"field\")\n    private String street;\n    /**\n     * The text.\n     */\n    @PropertyDefinition(get = \"optionalGuava\")\n    private String town;\n    /**\n     * The city.\n     */\n    @PropertyDefinition(validate = \"notNull\", alias = \"place\")\n    private String city;\n    /**\n     * The list.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final List<String> list = new ArrayList<>();\n    /**\n     * The currency.\n     */\n    @PropertyDefinition(get = \"optionalGuava\")\n    private Currency currency;\n    /**\n     * The hidden text.\n     */\n    @PropertyDefinition(get = \"\")\n    private String hiddenText;\n\n    //-----------------------------------------------------------------------\n    // manual getter with a different name\n    public String getStreetName() {\n        return street;\n    }\n\n    // derived\n    @DerivedProperty\n    public String getAddress() {\n        return number + \" \" + street + \" \" + city;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code LightMutable}.\n     */\n    private static final TypedMetaBean<LightMutable> META_BEAN =\n            LightMetaBean.of(\n                    LightMutable.class,\n                    MethodHandles.lookup(),\n                    new String[] {\n                            \"number\",\n                            \"flag\",\n                            \"street\",\n                            \"town\",\n                            \"city\",\n                            \"list\",\n                            \"currency\",\n                            \"hiddenText\"},\n                    0,\n                    Boolean.FALSE,\n                    null,\n                    null,\n                    null,\n                    ImmutableList.of(),\n                    null,\n                    null)\n                    .withAlias(\"place\", \"city\");\n\n    /**\n     * The meta-bean for {@code LightMutable}.\n     * @return the meta-bean, not null\n     */\n    public static TypedMetaBean<LightMutable> meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Creates an instance.\n     * @param number  the value of the property\n     * @param flag  the value of the property\n     * @param street  the value of the property, not null\n     * @param town  the value of the property\n     * @param city  the value of the property, not null\n     * @param list  the value of the property, not null\n     * @param currency  the value of the property\n     * @param hiddenText  the value of the property\n     */\n    LightMutable(\n            int number,\n            boolean flag,\n            String street,\n            String town,\n            String city,\n            List<String> list,\n            Currency currency,\n            String hiddenText) {\n        setNumber(number);\n        setFlag(flag);\n        setStreet(street);\n        setTown(town);\n        setCity(city);\n        setList(list);\n        setCurrency(currency);\n        setHiddenText(hiddenText);\n    }\n\n    @Override\n    public TypedMetaBean<LightMutable> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public int getNumber() {\n        return number;\n    }\n\n    /**\n     * Sets the number.\n     * @param number  the new value of the property\n     */\n    public void setNumber(int number) {\n        this.number = number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public boolean isFlag() {\n        return flag;\n    }\n\n    /**\n     * Sets the number.\n     * @param flag  the new value of the property\n     */\n    public void setFlag(boolean flag) {\n        this.flag = flag;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets the street.\n     * @param street  the new value of the property, not null\n     */\n    public void setStreet(String street) {\n        JodaBeanUtils.notNull(street, \"street\");\n        this.street = street;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the text.\n     * @return the optional value of the property, not null\n     */\n    public Optional<String> getTown() {\n        return Optional.fromNullable(town);\n    }\n\n    /**\n     * Sets the text.\n     * @param town  the new value of the property\n     */\n    public void setTown(String town) {\n        this.town = town;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the city.\n     * @return the value of the property, not null\n     */\n    public String getCity() {\n        return city;\n    }\n\n    /**\n     * Sets the city.\n     * @param city  the new value of the property, not null\n     */\n    public void setCity(String city) {\n        JodaBeanUtils.notNull(city, \"city\");\n        this.city = city;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the list.\n     * @return the value of the property, not null\n     */\n    public List<String> getList() {\n        return list;\n    }\n\n    /**\n     * Sets the list.\n     * @param list  the new value of the property, not null\n     */\n    public void setList(List<String> list) {\n        JodaBeanUtils.notNull(list, \"list\");\n        this.list.clear();\n        this.list.addAll(list);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the currency.\n     * @return the optional value of the property, not null\n     */\n    public Optional<Currency> getCurrency() {\n        return Optional.fromNullable(currency);\n    }\n\n    /**\n     * Sets the currency.\n     * @param currency  the new value of the property\n     */\n    public void setCurrency(Currency currency) {\n        this.currency = currency;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets the hidden text.\n     * @param hiddenText  the new value of the property\n     */\n    public void setHiddenText(String hiddenText) {\n        this.hiddenText = hiddenText;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public LightMutable clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            LightMutable other = (LightMutable) obj;\n            return (this.getNumber() == other.getNumber()) &&\n                    (this.isFlag() == other.isFlag()) &&\n                    JodaBeanUtils.equal(this.street, other.street) &&\n                    JodaBeanUtils.equal(this.town, other.town) &&\n                    JodaBeanUtils.equal(this.getCity(), other.getCity()) &&\n                    JodaBeanUtils.equal(this.getList(), other.getList()) &&\n                    JodaBeanUtils.equal(this.currency, other.currency) &&\n                    JodaBeanUtils.equal(this.hiddenText, other.hiddenText);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNumber());\n        hash = hash * 31 + JodaBeanUtils.hashCode(isFlag());\n        hash = hash * 31 + JodaBeanUtils.hashCode(street);\n        hash = hash * 31 + JodaBeanUtils.hashCode(town);\n        hash = hash * 31 + JodaBeanUtils.hashCode(getCity());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(currency);\n        hash = hash * 31 + JodaBeanUtils.hashCode(hiddenText);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(320);\n        buf.append(\"LightMutable{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(getNumber())).append(',').append(' ');\n        buf.append(\"flag\").append('=').append(JodaBeanUtils.toString(isFlag())).append(',').append(' ');\n        buf.append(\"street\").append('=').append(JodaBeanUtils.toString(street)).append(',').append(' ');\n        buf.append(\"town\").append('=').append(JodaBeanUtils.toString(town)).append(',').append(' ');\n        buf.append(\"city\").append('=').append(JodaBeanUtils.toString(getCity())).append(',').append(' ');\n        buf.append(\"list\").append('=').append(JodaBeanUtils.toString(getList())).append(',').append(' ');\n        buf.append(\"currency\").append('=').append(JodaBeanUtils.toString(currency)).append(',').append(' ');\n        buf.append(\"hiddenText\").append('=').append(JodaBeanUtils.toString(hiddenText)).append(',').append(' ');\n        buf.append(\"address\").append('=').append(JodaBeanUtils.toString(getAddress()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/LightMutableGeneric.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.lang.invoke.MethodHandles;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.light.LightMetaBean;\n\nimport com.google.common.collect.ImmutableList;\n\n/**\n * Mock light bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"light\")\npublic final class LightMutableGeneric<T extends Number> implements Bean, Serializable {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private T number;\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final List<T> list = new ArrayList<>();\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code LightMutableGeneric}.\n     */\n    private static final MetaBean META_BEAN =\n            LightMetaBean.of(\n                    LightMutableGeneric.class,\n                    MethodHandles.lookup(),\n                    new String[] {\n                            \"number\",\n                            \"list\"},\n                    null,\n                    ImmutableList.of());\n\n    /**\n     * The meta-bean for {@code LightMutableGeneric}.\n     * @return the meta-bean, not null\n     */\n    public static MetaBean meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    private LightMutableGeneric(\n            T number,\n            List<T> list) {\n        setNumber(number);\n        setList(list);\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public TypedMetaBean<LightMutableGeneric<T>> metaBean() {\n        return (TypedMetaBean<LightMutableGeneric<T>>) META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public T getNumber() {\n        return number;\n    }\n\n    /**\n     * Sets the number.\n     * @param number  the new value of the property\n     */\n    public void setNumber(T number) {\n        this.number = number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property, not null\n     */\n    public List<T> getList() {\n        return list;\n    }\n\n    /**\n     * Sets the number.\n     * @param list  the new value of the property, not null\n     */\n    public void setList(List<T> list) {\n        JodaBeanUtils.notNull(list, \"list\");\n        this.list.clear();\n        this.list.addAll(list);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public LightMutableGeneric<T> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            LightMutableGeneric<?> other = (LightMutableGeneric<?>) obj;\n            return JodaBeanUtils.equal(this.getNumber(), other.getNumber()) &&\n                    JodaBeanUtils.equal(this.getList(), other.getList());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNumber());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getList());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"LightMutableGeneric{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(getNumber())).append(',').append(' ');\n        buf.append(\"list\").append('=').append(JodaBeanUtils.toString(getList()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/LightMutableSimple.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.lang.invoke.MethodHandles;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.light.LightMetaBean;\n\n/**\n * Mock light bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"light\", constructorScope = \"package\")\npublic final class LightMutableSimple implements Bean, Serializable {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private int number;\n    /**\n     * The text.\n     */\n    @PropertyDefinition\n    private String text;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code LightMutableSimple}.\n     */\n    private static final TypedMetaBean<LightMutableSimple> META_BEAN =\n            LightMetaBean.of(\n                    LightMutableSimple.class,\n                    MethodHandles.lookup(),\n                    new String[] {\n                            \"number\",\n                            \"text\"},\n                    new Object[0]);\n\n    /**\n     * The meta-bean for {@code LightMutableSimple}.\n     * @return the meta-bean, not null\n     */\n    public static TypedMetaBean<LightMutableSimple> meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Creates an instance.\n     * @param number  the value of the property\n     * @param text  the value of the property\n     */\n    LightMutableSimple(\n            int number,\n            String text) {\n        setNumber(number);\n        setText(text);\n    }\n\n    @Override\n    public TypedMetaBean<LightMutableSimple> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public int getNumber() {\n        return number;\n    }\n\n    /**\n     * Sets the number.\n     * @param number  the new value of the property\n     */\n    public void setNumber(int number) {\n        this.number = number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the text.\n     * @return the value of the property\n     */\n    public String getText() {\n        return text;\n    }\n\n    /**\n     * Sets the text.\n     * @param text  the new value of the property\n     */\n    public void setText(String text) {\n        this.text = text;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public LightMutableSimple clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            LightMutableSimple other = (LightMutableSimple) obj;\n            return (this.getNumber() == other.getNumber()) &&\n                    JodaBeanUtils.equal(this.getText(), other.getText());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNumber());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getText());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"LightMutableSimple{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(getNumber())).append(',').append(' ');\n        buf.append(\"text\").append('=').append(JodaBeanUtils.toString(getText()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MetaBeanLoad.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Used only in one place to test meta-bean registration.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class MetaBeanLoad\n        implements Bean {\n\n    /** The name. */\n    @PropertyDefinition\n    private String name;\n\n    /**\n     * Creates an instanec.\n     */\n    public MetaBeanLoad() {\n    }\n\n    /**\n     * Creates an instanec.\n     * \n     * @param name  the name\n     */\n    public MetaBeanLoad(String name) {\n        this.name = name;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MetaBeanLoad}.\n     * @return the meta-bean, not null\n     */\n    public static MetaBeanLoad.Meta meta() {\n        return MetaBeanLoad.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(MetaBeanLoad.Meta.INSTANCE);\n    }\n\n    @Override\n    public MetaBeanLoad.Meta metaBean() {\n        return MetaBeanLoad.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property\n     */\n    public String getName() {\n        return name;\n    }\n\n    /**\n     * Sets the name.\n     * @param name  the new value of the property\n     */\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    /**\n     * Gets the the {@code name} property.\n     * @return the property, not null\n     */\n    public final Property<String> name() {\n        return metaBean().name().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MetaBeanLoad clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            MetaBeanLoad other = (MetaBeanLoad) obj;\n            return JodaBeanUtils.equal(this.getName(), other.getName());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getName());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"MetaBeanLoad{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"name\").append('=').append(JodaBeanUtils.toString(getName())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code MetaBeanLoad}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code name} property.\n         */\n        private final MetaProperty<String> name = DirectMetaProperty.ofReadWrite(\n                this, \"name\", MetaBeanLoad.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"name\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends MetaBeanLoad> builder() {\n            return new DirectBeanBuilder<>(new MetaBeanLoad());\n        }\n\n        @Override\n        public Class<? extends MetaBeanLoad> beanType() {\n            return MetaBeanLoad.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code name} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> name() {\n            return name;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return ((MetaBeanLoad) bean).getName();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    ((MetaBeanLoad) bean).setName((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MidAbstractResult.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic abstract class MidAbstractResult<S extends Address> extends AbstractResult<S> {\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MidAbstractResult}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static MidAbstractResult.Meta meta() {\n        return MidAbstractResult.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code MidAbstractResult}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Address> MidAbstractResult.Meta<R> metaMidAbstractResult(Class<R> cls) {\n        return MidAbstractResult.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(MidAbstractResult.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public MidAbstractResult.Meta<S> metaBean() {\n        return MidAbstractResult.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            return super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(32);\n        buf.append(\"MidAbstractResult{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code MidAbstractResult}.\n     * @param <S>  the type\n     */\n    public static class Meta<S extends Address> extends AbstractResult.Meta<S> {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap());\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        public boolean isBuildable() {\n            return false;\n        }\n\n        @Override\n        public BeanBuilder<? extends MidAbstractResult<S>> builder() {\n            throw new UnsupportedOperationException(\"MidAbstractResult is an abstract class\");\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends MidAbstractResult<S>> beanType() {\n            return (Class) MidAbstractResult.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MinimalEmpty.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.MinimalMetaBean;\n\n/**\n * Mock immutable empty bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"minimal\")\npublic final class MinimalEmpty implements ImmutableBean {\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MinimalEmpty}.\n     */\n    private static final TypedMetaBean<MinimalEmpty> META_BEAN =\n            MinimalMetaBean.of(\n                    MinimalEmpty.class,\n                    new String[0],\n                    () -> new MinimalEmpty.Builder());\n\n    /**\n     * The meta-bean for {@code MinimalEmpty}.\n     * @return the meta-bean, not null\n     */\n    public static TypedMetaBean<MinimalEmpty> meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static MinimalEmpty.Builder builder() {\n        return new MinimalEmpty.Builder();\n    }\n\n    private MinimalEmpty() {\n    }\n\n    @Override\n    public TypedMetaBean<MinimalEmpty> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(32);\n        buf.append(\"MinimalEmpty{\");\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code MinimalEmpty}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<MinimalEmpty> {\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public MinimalEmpty build() {\n            return new MinimalEmpty();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            return \"MinimalEmpty.Builder{}\";\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MinimalImmutable.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.Currency;\nimport java.util.List;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.DerivedProperty;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.MinimalMetaBean;\n\nimport com.google.common.base.Optional;\nimport com.google.common.collect.ImmutableList;\n\n/**\n * Mock minimal bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"minimal\", constructorScope = \"package\")\npublic final class MinimalImmutable implements ImmutableBean, Serializable {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final int number;\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final boolean flag;\n    /**\n     * The street.\n     */\n    @PropertyDefinition(validate = \"notNull\", get = \"field\")\n    private final String street;\n    /**\n     * The town.\n     */\n    @PropertyDefinition(get = \"optionalGuava\")\n    private final String town;\n    /**\n     * The city.\n     */\n    @PropertyDefinition(validate = \"notNull\", alias = \"place\")\n    private final String city;\n    /**\n     * The owner.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmPerson owner;\n    /**\n     * The list.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final ImmutableList<String> list;\n    /**\n     * The currency.\n     */\n    @PropertyDefinition(get = \"optionalGuava\")\n    private final Currency currency;\n\n    //-----------------------------------------------------------------------\n    // manual getter with a different name\n    public String getStreetName() {\n        return street;\n    }\n\n    // derived\n    @DerivedProperty\n    public String getAddress() {\n        return number + \" \" + street + \" \" + city;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MinimalImmutable}.\n     */\n    private static final TypedMetaBean<MinimalImmutable> META_BEAN =\n            MinimalMetaBean.of(\n                    MinimalImmutable.class,\n                    new String[] {\n                            \"number\",\n                            \"flag\",\n                            \"street\",\n                            \"town\",\n                            \"city\",\n                            \"owner\",\n                            \"list\",\n                            \"currency\"},\n                    () -> new MinimalImmutable.Builder(),\n                    b -> b.getNumber(),\n                    b -> b.isFlag(),\n                    b -> b.street,\n                    b -> b.town,\n                    b -> b.getCity(),\n                    b -> b.getOwner(),\n                    b -> b.getList(),\n                    b -> b.currency)\n                    .withAlias(\"place\", \"city\");\n\n    /**\n     * The meta-bean for {@code MinimalImmutable}.\n     * @return the meta-bean, not null\n     */\n    public static TypedMetaBean<MinimalImmutable> meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static MinimalImmutable.Builder builder() {\n        return new MinimalImmutable.Builder();\n    }\n\n    /**\n     * Creates an instance.\n     * @param number  the value of the property\n     * @param flag  the value of the property\n     * @param street  the value of the property, not null\n     * @param town  the value of the property\n     * @param city  the value of the property, not null\n     * @param owner  the value of the property, not null\n     * @param list  the value of the property, not null\n     * @param currency  the value of the property\n     */\n    MinimalImmutable(\n            int number,\n            boolean flag,\n            String street,\n            String town,\n            String city,\n            ImmPerson owner,\n            List<String> list,\n            Currency currency) {\n        JodaBeanUtils.notNull(street, \"street\");\n        JodaBeanUtils.notNull(city, \"city\");\n        JodaBeanUtils.notNull(owner, \"owner\");\n        JodaBeanUtils.notNull(list, \"list\");\n        this.number = number;\n        this.flag = flag;\n        this.street = street;\n        this.town = town;\n        this.city = city;\n        this.owner = owner;\n        this.list = ImmutableList.copyOf(list);\n        this.currency = currency;\n    }\n\n    @Override\n    public TypedMetaBean<MinimalImmutable> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public int getNumber() {\n        return number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public boolean isFlag() {\n        return flag;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the town.\n     * @return the optional value of the property, not null\n     */\n    public Optional<String> getTown() {\n        return Optional.fromNullable(town);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the city.\n     * @return the value of the property, not null\n     */\n    public String getCity() {\n        return city;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the owner.\n     * @return the value of the property, not null\n     */\n    public ImmPerson getOwner() {\n        return owner;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the list.\n     * @return the value of the property, not null\n     */\n    public ImmutableList<String> getList() {\n        return list;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the currency.\n     * @return the optional value of the property, not null\n     */\n    public Optional<Currency> getCurrency() {\n        return Optional.fromNullable(currency);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            MinimalImmutable other = (MinimalImmutable) obj;\n            return (this.number == other.number) &&\n                    (this.flag == other.flag) &&\n                    JodaBeanUtils.equal(this.street, other.street) &&\n                    JodaBeanUtils.equal(this.town, other.town) &&\n                    JodaBeanUtils.equal(this.city, other.city) &&\n                    JodaBeanUtils.equal(this.owner, other.owner) &&\n                    JodaBeanUtils.equal(this.list, other.list) &&\n                    JodaBeanUtils.equal(this.currency, other.currency);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(number);\n        hash = hash * 31 + JodaBeanUtils.hashCode(flag);\n        hash = hash * 31 + JodaBeanUtils.hashCode(street);\n        hash = hash * 31 + JodaBeanUtils.hashCode(town);\n        hash = hash * 31 + JodaBeanUtils.hashCode(city);\n        hash = hash * 31 + JodaBeanUtils.hashCode(owner);\n        hash = hash * 31 + JodaBeanUtils.hashCode(list);\n        hash = hash * 31 + JodaBeanUtils.hashCode(currency);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(320);\n        buf.append(\"MinimalImmutable{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n        buf.append(\"flag\").append('=').append(JodaBeanUtils.toString(flag)).append(',').append(' ');\n        buf.append(\"street\").append('=').append(JodaBeanUtils.toString(street)).append(',').append(' ');\n        buf.append(\"town\").append('=').append(JodaBeanUtils.toString(town)).append(',').append(' ');\n        buf.append(\"city\").append('=').append(JodaBeanUtils.toString(city)).append(',').append(' ');\n        buf.append(\"owner\").append('=').append(JodaBeanUtils.toString(owner)).append(',').append(' ');\n        buf.append(\"list\").append('=').append(JodaBeanUtils.toString(list)).append(',').append(' ');\n        buf.append(\"currency\").append('=').append(JodaBeanUtils.toString(currency)).append(',').append(' ');\n        buf.append(\"address\").append('=').append(JodaBeanUtils.toString(getAddress()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code MinimalImmutable}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<MinimalImmutable> {\n\n        private int number;\n        private boolean flag;\n        private String street;\n        private String town;\n        private String city;\n        private ImmPerson owner;\n        private List<String> list = ImmutableList.of();\n        private Currency currency;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(MinimalImmutable beanToCopy) {\n            this.number = beanToCopy.getNumber();\n            this.flag = beanToCopy.isFlag();\n            this.street = beanToCopy.street;\n            this.town = beanToCopy.town;\n            this.city = beanToCopy.getCity();\n            this.owner = beanToCopy.getOwner();\n            this.list = beanToCopy.getList();\n            this.currency = beanToCopy.currency;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    return this.number;\n                case 3145580:  // flag\n                    return this.flag;\n                case -891990013:  // street\n                    return this.street;\n                case 3566226:  // town\n                    return this.town;\n                case 3053931:  // city\n                case 106748167:  // place (alias)\n                    return this.city;\n                case 106164915:  // owner\n                    return this.owner;\n                case 3322014:  // list\n                    return this.list;\n                case 575402001:  // currency\n                    return this.currency;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    this.number = (Integer) newValue;\n                    break;\n                case 3145580:  // flag\n                    this.flag = (Boolean) newValue;\n                    break;\n                case -891990013:  // street\n                    this.street = (String) newValue;\n                    break;\n                case 3566226:  // town\n                    this.town = (String) newValue;\n                    break;\n                case 3053931:  // city\n                case 106748167:  // place (alias)\n                    this.city = (String) newValue;\n                    break;\n                case 106164915:  // owner\n                    this.owner = (ImmPerson) newValue;\n                    break;\n                case 3322014:  // list\n                    this.list = (List<String>) newValue;\n                    break;\n                case 575402001:  // currency\n                    this.currency = (Currency) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public MinimalImmutable build() {\n            return new MinimalImmutable(\n                    number,\n                    flag,\n                    street,\n                    town,\n                    city,\n                    owner,\n                    list,\n                    currency);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the number.\n         * @param number  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder number(int number) {\n            this.number = number;\n            return this;\n        }\n\n        /**\n         * Sets the number.\n         * @param flag  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder flag(boolean flag) {\n            this.flag = flag;\n            return this;\n        }\n\n        /**\n         * Sets the street.\n         * @param street  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder street(String street) {\n            JodaBeanUtils.notNull(street, \"street\");\n            this.street = street;\n            return this;\n        }\n\n        /**\n         * Sets the town.\n         * @param town  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder town(String town) {\n            this.town = town;\n            return this;\n        }\n\n        /**\n         * Sets the city.\n         * @param city  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder city(String city) {\n            JodaBeanUtils.notNull(city, \"city\");\n            this.city = city;\n            return this;\n        }\n\n        /**\n         * Sets the owner.\n         * @param owner  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder owner(ImmPerson owner) {\n            JodaBeanUtils.notNull(owner, \"owner\");\n            this.owner = owner;\n            return this;\n        }\n\n        /**\n         * Sets the list.\n         * @param list  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder list(List<String> list) {\n            JodaBeanUtils.notNull(list, \"list\");\n            this.list = list;\n            return this;\n        }\n\n        /**\n         * Sets the {@code list} property in the builder\n         * from an array of objects.\n         * @param list  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder list(String... list) {\n            return list(ImmutableList.copyOf(list));\n        }\n\n        /**\n         * Sets the currency.\n         * @param currency  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder currency(Currency currency) {\n            this.currency = currency;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(320);\n            buf.append(\"MinimalImmutable.Builder{\");\n            buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n            buf.append(\"flag\").append('=').append(JodaBeanUtils.toString(flag)).append(',').append(' ');\n            buf.append(\"street\").append('=').append(JodaBeanUtils.toString(street)).append(',').append(' ');\n            buf.append(\"town\").append('=').append(JodaBeanUtils.toString(town)).append(',').append(' ');\n            buf.append(\"city\").append('=').append(JodaBeanUtils.toString(city)).append(',').append(' ');\n            buf.append(\"owner\").append('=').append(JodaBeanUtils.toString(owner)).append(',').append(' ');\n            buf.append(\"list\").append('=').append(JodaBeanUtils.toString(list)).append(',').append(' ');\n            buf.append(\"currency\").append('=').append(JodaBeanUtils.toString(currency)).append(',').append(' ');\n            buf.append(\"address\").append('=').append(JodaBeanUtils.toString(null));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MinimalImmutableGeneric.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.MinimalMetaBean;\n\nimport com.google.common.collect.ImmutableList;\nimport com.google.common.collect.ImmutableMap;\n\n/**\n * Mock minimal bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"minimal\")\npublic final class MinimalImmutableGeneric<T extends Number> implements ImmutableBean, Serializable {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final T number;\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final List<T> list;\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final Map<String, T> map;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MinimalImmutableGeneric}.\n     */\n    @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n    private static final MetaBean META_BEAN =\n            MinimalMetaBean.of(\n                    MinimalImmutableGeneric.class,\n                    new String[] {\n                            \"number\",\n                            \"list\",\n                            \"map\"},\n                    () -> new MinimalImmutableGeneric.Builder(),\n                    b -> b.getNumber(),\n                    b -> b.getList(),\n                    b -> b.getMap());\n\n    /**\n     * The meta-bean for {@code MinimalImmutableGeneric}.\n     * @return the meta-bean, not null\n     */\n    public static MetaBean meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @param <T>  the type\n     * @return the builder, not null\n     */\n    public static <T extends Number> MinimalImmutableGeneric.Builder<T> builder() {\n        return new MinimalImmutableGeneric.Builder<>();\n    }\n\n    private MinimalImmutableGeneric(\n            T number,\n            List<T> list,\n            Map<String, T> map) {\n        this.number = number;\n        this.list = (list != null ? ImmutableList.copyOf(list) : null);\n        this.map = (map != null ? ImmutableMap.copyOf(map) : null);\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public TypedMetaBean<MinimalImmutableGeneric<T>> metaBean() {\n        return (TypedMetaBean<MinimalImmutableGeneric<T>>) META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public T getNumber() {\n        return number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public List<T> getList() {\n        return list;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public Map<String, T> getMap() {\n        return map;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder<T> toBuilder() {\n        return new Builder<>(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            MinimalImmutableGeneric<?> other = (MinimalImmutableGeneric<?>) obj;\n            return JodaBeanUtils.equal(this.number, other.number) &&\n                    JodaBeanUtils.equal(this.list, other.list) &&\n                    JodaBeanUtils.equal(this.map, other.map);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(number);\n        hash = hash * 31 + JodaBeanUtils.hashCode(list);\n        hash = hash * 31 + JodaBeanUtils.hashCode(map);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(128);\n        buf.append(\"MinimalImmutableGeneric{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n        buf.append(\"list\").append('=').append(JodaBeanUtils.toString(list)).append(',').append(' ');\n        buf.append(\"map\").append('=').append(JodaBeanUtils.toString(map));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code MinimalImmutableGeneric}.\n     * @param <T>  the type\n     */\n    public static final class Builder<T extends Number> extends DirectFieldsBeanBuilder<MinimalImmutableGeneric<T>> {\n\n        private T number;\n        private List<T> list;\n        private Map<String, T> map;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(MinimalImmutableGeneric<T> beanToCopy) {\n            this.number = beanToCopy.getNumber();\n            this.list = (beanToCopy.getList() != null ? ImmutableList.copyOf(beanToCopy.getList()) : null);\n            this.map = (beanToCopy.getMap() != null ? ImmutableMap.copyOf(beanToCopy.getMap()) : null);\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    return this.number;\n                case 3322014:  // list\n                    return this.list;\n                case 107868:  // map\n                    return this.map;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder<T> set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    this.number = (T) newValue;\n                    break;\n                case 3322014:  // list\n                    this.list = (List<T>) newValue;\n                    break;\n                case 107868:  // map\n                    this.map = (Map<String, T>) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder<T> set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public MinimalImmutableGeneric<T> build() {\n            return new MinimalImmutableGeneric<>(\n                    number,\n                    list,\n                    map);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the number.\n         * @param number  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder<T> number(T number) {\n            this.number = number;\n            return this;\n        }\n\n        /**\n         * Sets the number.\n         * @param list  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder<T> list(List<T> list) {\n            this.list = list;\n            return this;\n        }\n\n        /**\n         * Sets the {@code list} property in the builder\n         * from an array of objects.\n         * @param list  the new value\n         * @return this, for chaining, not null\n         */\n        @SafeVarargs\n        public final Builder<T> list(T... list) {\n            return list(ImmutableList.copyOf(list));\n        }\n\n        /**\n         * Sets the number.\n         * @param map  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder<T> map(Map<String, T> map) {\n            this.map = map;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(128);\n            buf.append(\"MinimalImmutableGeneric.Builder{\");\n            buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n            buf.append(\"list\").append('=').append(JodaBeanUtils.toString(list)).append(',').append(' ');\n            buf.append(\"map\").append('=').append(JodaBeanUtils.toString(map));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MinimalImmutableSimple.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.MinimalMetaBean;\n\n/**\n * Mock minimal bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"minimal\", constructorScope = \"package\")\npublic final class MinimalImmutableSimple implements ImmutableBean, Serializable {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final int number;\n    /**\n     * The text.\n     */\n    @PropertyDefinition\n    private final String text;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MinimalImmutableSimple}.\n     */\n    private static final TypedMetaBean<MinimalImmutableSimple> META_BEAN =\n            MinimalMetaBean.of(\n                    MinimalImmutableSimple.class,\n                    new String[] {\n                            \"number\",\n                            \"text\"},\n                    () -> new MinimalImmutableSimple.Builder(),\n                    b -> b.getNumber(),\n                    b -> b.getText());\n\n    /**\n     * The meta-bean for {@code MinimalImmutableSimple}.\n     * @return the meta-bean, not null\n     */\n    public static TypedMetaBean<MinimalImmutableSimple> meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static MinimalImmutableSimple.Builder builder() {\n        return new MinimalImmutableSimple.Builder();\n    }\n\n    /**\n     * Creates an instance.\n     * @param number  the value of the property\n     * @param text  the value of the property\n     */\n    MinimalImmutableSimple(\n            int number,\n            String text) {\n        this.number = number;\n        this.text = text;\n    }\n\n    @Override\n    public TypedMetaBean<MinimalImmutableSimple> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public int getNumber() {\n        return number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the text.\n     * @return the value of the property\n     */\n    public String getText() {\n        return text;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            MinimalImmutableSimple other = (MinimalImmutableSimple) obj;\n            return (this.number == other.number) &&\n                    JodaBeanUtils.equal(this.text, other.text);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(number);\n        hash = hash * 31 + JodaBeanUtils.hashCode(text);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"MinimalImmutableSimple{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n        buf.append(\"text\").append('=').append(JodaBeanUtils.toString(text));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code MinimalImmutableSimple}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<MinimalImmutableSimple> {\n\n        private int number;\n        private String text;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(MinimalImmutableSimple beanToCopy) {\n            this.number = beanToCopy.getNumber();\n            this.text = beanToCopy.getText();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    return this.number;\n                case 3556653:  // text\n                    return this.text;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -1034364087:  // number\n                    this.number = (Integer) newValue;\n                    break;\n                case 3556653:  // text\n                    this.text = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public MinimalImmutableSimple build() {\n            return new MinimalImmutableSimple(\n                    number,\n                    text);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the number.\n         * @param number  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder number(int number) {\n            this.number = number;\n            return this;\n        }\n\n        /**\n         * Sets the text.\n         * @param text  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder text(String text) {\n            this.text = text;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(96);\n            buf.append(\"MinimalImmutableSimple.Builder{\");\n            buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n            buf.append(\"text\").append('=').append(JodaBeanUtils.toString(text));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MinimalManualBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.MinimalMetaBean;\n\n/**\n * Mock minimal bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"minimal\", builderName = \"Builder\")\npublic final class MinimalManualBuilder implements ImmutableBean, Serializable {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final int number;\n    /**\n     * The text.\n     */\n    @PropertyDefinition\n    private final String text;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MinimalManualBuilder}.\n     */\n    private static final TypedMetaBean<MinimalManualBuilder> META_BEAN =\n            MinimalMetaBean.of(\n                    MinimalManualBuilder.class,\n                    new String[] {\n                            \"number\",\n                            \"text\"},\n                    () -> new Builder(),\n                    b -> b.getNumber(),\n                    b -> b.getText());\n\n    /**\n     * The meta-bean for {@code MinimalManualBuilder}.\n     * @return the meta-bean, not null\n     */\n    public static TypedMetaBean<MinimalManualBuilder> meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static Builder builder() {\n        return new Builder();\n    }\n\n    private MinimalManualBuilder(\n            int number,\n            String text) {\n        this.number = number;\n        this.text = text;\n    }\n\n    @Override\n    public TypedMetaBean<MinimalManualBuilder> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public int getNumber() {\n        return number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the text.\n     * @return the value of the property\n     */\n    public String getText() {\n        return text;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            MinimalManualBuilder other = (MinimalManualBuilder) obj;\n            return (this.number == other.number) &&\n                    JodaBeanUtils.equal(this.text, other.text);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(number);\n        hash = hash * 31 + JodaBeanUtils.hashCode(text);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"MinimalManualBuilder{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(number)).append(',').append(' ');\n        buf.append(\"text\").append('=').append(JodaBeanUtils.toString(text));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n\n    /**\n     * The bean-builder for {@code MinimalImmutableSimple}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<MinimalManualBuilder> {\n\n        private int number;\n        private String text;\n\n        private Builder() {\n        }\n\n        private Builder(MinimalManualBuilder beanToCopy) {\n            this.number = beanToCopy.getNumber();\n            this.text = beanToCopy.getText();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName) {\n                case \"number\":\n                    return number;\n                case \"text\":\n                    return text;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName) {\n                case \"number\":\n                    this.number = (Integer) newValue;\n                    break;\n                case \"text\":\n                    this.text = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public MinimalManualBuilder build() {\n            return new MinimalManualBuilder(number, text);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the number.\n         * @param number  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder number(int number) {\n            this.number = number;\n            return this;\n        }\n\n        /**\n         * Sets the text.\n         * @param text  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder text(String text) {\n            this.text = text;\n            return this;\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MinimalMutable.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Currency;\nimport java.util.List;\nimport java.util.function.BiConsumer;\nimport java.util.function.Function;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.DerivedProperty;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.BasicBeanBuilder;\nimport org.joda.beans.impl.direct.MinimalMetaBean;\n\nimport com.google.common.base.Optional;\n\n/**\n * Mock minimal bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"minimal\")\npublic final class MinimalMutable implements Bean, Serializable {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private int number;\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private boolean flag;\n    /**\n     * The street.\n     */\n    @PropertyDefinition(validate = \"notNull\", get = \"field\")\n    private String street;\n    /**\n     * The text.\n     */\n    @PropertyDefinition(get = \"optionalGuava\")\n    private String town;\n    /**\n     * The city.\n     */\n    @PropertyDefinition(validate = \"notNull\", alias = \"place\")\n    private String city;\n    /**\n     * The list.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private final List<String> list = new ArrayList<>();\n    /**\n     * The currency.\n     */\n    @PropertyDefinition(get = \"optionalGuava\")\n    private Currency currency;\n\n    //-----------------------------------------------------------------------\n    // manual getter with a different name\n    public String getStreetName() {\n        return street;\n    }\n\n    // derived\n    @DerivedProperty\n    public String getAddress() {\n        return number + \" \" + street + \" \" + city;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MinimalMutable}.\n     */\n    @SuppressWarnings(\"unchecked\")\n    private static final TypedMetaBean<MinimalMutable> META_BEAN =\n            MinimalMetaBean.of(\n                    MinimalMutable.class,\n                    new String[] {\n                            \"number\",\n                            \"flag\",\n                            \"street\",\n                            \"town\",\n                            \"city\",\n                            \"list\",\n                            \"currency\"},\n                    () -> new BasicBeanBuilder<>(new MinimalMutable()),\n                    Arrays.<Function<MinimalMutable, Object>>asList(\n                            b -> b.getNumber(),\n                            b -> b.isFlag(),\n                            b -> b.street,\n                            b -> b.town,\n                            b -> b.getCity(),\n                            b -> b.getList(),\n                            b -> b.currency),\n                    Arrays.<BiConsumer<MinimalMutable, Object>>asList(\n                            (b, v) -> b.setNumber((Integer) v),\n                            (b, v) -> b.setFlag((Boolean) v),\n                            (b, v) -> b.setStreet((String) v),\n                            (b, v) -> b.setTown((String) v),\n                            (b, v) -> b.setCity((String) v),\n                            (b, v) -> b.setList((List<String>) v),\n                            (b, v) -> b.setCurrency((Currency) v)))\n                    .withAlias(\"place\", \"city\");\n\n    /**\n     * The meta-bean for {@code MinimalMutable}.\n     * @return the meta-bean, not null\n     */\n    public static TypedMetaBean<MinimalMutable> meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    @Override\n    public TypedMetaBean<MinimalMutable> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public int getNumber() {\n        return number;\n    }\n\n    /**\n     * Sets the number.\n     * @param number  the new value of the property\n     */\n    public void setNumber(int number) {\n        this.number = number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public boolean isFlag() {\n        return flag;\n    }\n\n    /**\n     * Sets the number.\n     * @param flag  the new value of the property\n     */\n    public void setFlag(boolean flag) {\n        this.flag = flag;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets the street.\n     * @param street  the new value of the property, not null\n     */\n    public void setStreet(String street) {\n        JodaBeanUtils.notNull(street, \"street\");\n        this.street = street;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the text.\n     * @return the optional value of the property, not null\n     */\n    public Optional<String> getTown() {\n        return Optional.fromNullable(town);\n    }\n\n    /**\n     * Sets the text.\n     * @param town  the new value of the property\n     */\n    public void setTown(String town) {\n        this.town = town;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the city.\n     * @return the value of the property, not null\n     */\n    public String getCity() {\n        return city;\n    }\n\n    /**\n     * Sets the city.\n     * @param city  the new value of the property, not null\n     */\n    public void setCity(String city) {\n        JodaBeanUtils.notNull(city, \"city\");\n        this.city = city;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the list.\n     * @return the value of the property, not null\n     */\n    public List<String> getList() {\n        return list;\n    }\n\n    /**\n     * Sets the list.\n     * @param list  the new value of the property, not null\n     */\n    public void setList(List<String> list) {\n        JodaBeanUtils.notNull(list, \"list\");\n        this.list.clear();\n        this.list.addAll(list);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the currency.\n     * @return the optional value of the property, not null\n     */\n    public Optional<Currency> getCurrency() {\n        return Optional.fromNullable(currency);\n    }\n\n    /**\n     * Sets the currency.\n     * @param currency  the new value of the property\n     */\n    public void setCurrency(Currency currency) {\n        this.currency = currency;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MinimalMutable clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            MinimalMutable other = (MinimalMutable) obj;\n            return (this.getNumber() == other.getNumber()) &&\n                    (this.isFlag() == other.isFlag()) &&\n                    JodaBeanUtils.equal(this.street, other.street) &&\n                    JodaBeanUtils.equal(this.town, other.town) &&\n                    JodaBeanUtils.equal(this.getCity(), other.getCity()) &&\n                    JodaBeanUtils.equal(this.getList(), other.getList()) &&\n                    JodaBeanUtils.equal(this.currency, other.currency);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNumber());\n        hash = hash * 31 + JodaBeanUtils.hashCode(isFlag());\n        hash = hash * 31 + JodaBeanUtils.hashCode(street);\n        hash = hash * 31 + JodaBeanUtils.hashCode(town);\n        hash = hash * 31 + JodaBeanUtils.hashCode(getCity());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(currency);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(288);\n        buf.append(\"MinimalMutable{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(getNumber())).append(',').append(' ');\n        buf.append(\"flag\").append('=').append(JodaBeanUtils.toString(isFlag())).append(',').append(' ');\n        buf.append(\"street\").append('=').append(JodaBeanUtils.toString(street)).append(',').append(' ');\n        buf.append(\"town\").append('=').append(JodaBeanUtils.toString(town)).append(',').append(' ');\n        buf.append(\"city\").append('=').append(JodaBeanUtils.toString(getCity())).append(',').append(' ');\n        buf.append(\"list\").append('=').append(JodaBeanUtils.toString(getList())).append(',').append(' ');\n        buf.append(\"currency\").append('=').append(JodaBeanUtils.toString(currency)).append(',').append(' ');\n        buf.append(\"address\").append('=').append(JodaBeanUtils.toString(getAddress()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MinimalMutableGeneric.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.function.BiConsumer;\nimport java.util.function.Function;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.BasicBeanBuilder;\nimport org.joda.beans.impl.direct.MinimalMetaBean;\n\n/**\n * Mock minimal bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"minimal\")\npublic final class MinimalMutableGeneric<T extends Number> implements Bean, Serializable {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private T number;\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final List<T> list = new ArrayList<>();\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private final Map<String, T> map = new HashMap<>();\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MinimalMutableGeneric}.\n     */\n    @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n    private static final MetaBean META_BEAN =\n            MinimalMetaBean.of(\n                    MinimalMutableGeneric.class,\n                    new String[] {\n                            \"number\",\n                            \"list\",\n                            \"map\"},\n                    () -> new BasicBeanBuilder<>(new MinimalMutableGeneric<>()),\n                    Arrays.<Function<MinimalMutableGeneric, Object>>asList(\n                            b -> b.getNumber(),\n                            b -> b.getList(),\n                            b -> b.getMap()),\n                    Arrays.<BiConsumer<MinimalMutableGeneric, Object>>asList(\n                            (b, v) -> b.setNumber((Number) v),\n                            (b, v) -> b.setList((List<Number>) v),\n                            (b, v) -> b.setMap((Map<String, Number>) v)));\n\n    /**\n     * The meta-bean for {@code MinimalMutableGeneric}.\n     * @return the meta-bean, not null\n     */\n    public static MetaBean meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public TypedMetaBean<MinimalMutableGeneric<T>> metaBean() {\n        return (TypedMetaBean<MinimalMutableGeneric<T>>) META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public T getNumber() {\n        return number;\n    }\n\n    /**\n     * Sets the number.\n     * @param number  the new value of the property\n     */\n    public void setNumber(T number) {\n        this.number = number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property, not null\n     */\n    public List<T> getList() {\n        return list;\n    }\n\n    /**\n     * Sets the number.\n     * @param list  the new value of the property, not null\n     */\n    public void setList(List<T> list) {\n        JodaBeanUtils.notNull(list, \"list\");\n        this.list.clear();\n        this.list.addAll(list);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property, not null\n     */\n    public Map<String, T> getMap() {\n        return map;\n    }\n\n    /**\n     * Sets the number.\n     * @param map  the new value of the property, not null\n     */\n    public void setMap(Map<String, T> map) {\n        JodaBeanUtils.notNull(map, \"map\");\n        this.map.clear();\n        this.map.putAll(map);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MinimalMutableGeneric<T> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            MinimalMutableGeneric<?> other = (MinimalMutableGeneric<?>) obj;\n            return JodaBeanUtils.equal(this.getNumber(), other.getNumber()) &&\n                    JodaBeanUtils.equal(this.getList(), other.getList()) &&\n                    JodaBeanUtils.equal(this.getMap(), other.getMap());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNumber());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getMap());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(128);\n        buf.append(\"MinimalMutableGeneric{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(getNumber())).append(',').append(' ');\n        buf.append(\"list\").append('=').append(JodaBeanUtils.toString(getList())).append(',').append(' ');\n        buf.append(\"map\").append('=').append(JodaBeanUtils.toString(getMap()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MinimalMutableGenericSimple.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.Arrays;\nimport java.util.function.BiConsumer;\nimport java.util.function.Function;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.BasicBeanBuilder;\nimport org.joda.beans.impl.direct.MinimalMetaBean;\n\n/**\n * Mock minimal bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"minimal\")\npublic final class MinimalMutableGenericSimple<T extends Number> implements Bean, Serializable {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private int number;\n    /**\n     * The text.\n     */\n    @PropertyDefinition\n    private String text;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MinimalMutableGenericSimple}.\n     */\n    @SuppressWarnings(\"rawtypes\")\n    private static final MetaBean META_BEAN =\n            MinimalMetaBean.of(\n                    MinimalMutableGenericSimple.class,\n                    new String[] {\n                            \"number\",\n                            \"text\"},\n                    () -> new BasicBeanBuilder<>(new MinimalMutableGenericSimple<>()),\n                    Arrays.<Function<MinimalMutableGenericSimple, Object>>asList(\n                            b -> b.getNumber(),\n                            b -> b.getText()),\n                    Arrays.<BiConsumer<MinimalMutableGenericSimple, Object>>asList(\n                            (b, v) -> b.setNumber((Integer) v),\n                            (b, v) -> b.setText((String) v)));\n\n    /**\n     * The meta-bean for {@code MinimalMutableGenericSimple}.\n     * @return the meta-bean, not null\n     */\n    public static MetaBean meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public TypedMetaBean<MinimalMutableGenericSimple<T>> metaBean() {\n        return (TypedMetaBean<MinimalMutableGenericSimple<T>>) META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public int getNumber() {\n        return number;\n    }\n\n    /**\n     * Sets the number.\n     * @param number  the new value of the property\n     */\n    public void setNumber(int number) {\n        this.number = number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the text.\n     * @return the value of the property\n     */\n    public String getText() {\n        return text;\n    }\n\n    /**\n     * Sets the text.\n     * @param text  the new value of the property\n     */\n    public void setText(String text) {\n        this.text = text;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MinimalMutableGenericSimple<T> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            MinimalMutableGenericSimple<?> other = (MinimalMutableGenericSimple<?>) obj;\n            return (this.getNumber() == other.getNumber()) &&\n                    JodaBeanUtils.equal(this.getText(), other.getText());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNumber());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getText());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"MinimalMutableGenericSimple{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(getNumber())).append(',').append(' ');\n        buf.append(\"text\").append('=').append(JodaBeanUtils.toString(getText()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MinimalMutableSimple.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.Arrays;\nimport java.util.function.BiConsumer;\nimport java.util.function.Function;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.BasicBeanBuilder;\nimport org.joda.beans.impl.direct.MinimalMetaBean;\n\n/**\n * Mock minimal bean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(style = \"minimal\")\npublic final class MinimalMutableSimple implements Bean, Serializable {\n\n    /**\n     * The number.\n     */\n    @PropertyDefinition\n    private int number;\n    /**\n     * The text.\n     */\n    @PropertyDefinition\n    private String text;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MinimalMutableSimple}.\n     */\n    private static final TypedMetaBean<MinimalMutableSimple> META_BEAN =\n            MinimalMetaBean.of(\n                    MinimalMutableSimple.class,\n                    new String[] {\n                            \"number\",\n                            \"text\"},\n                    () -> new BasicBeanBuilder<>(new MinimalMutableSimple()),\n                    Arrays.<Function<MinimalMutableSimple, Object>>asList(\n                            b -> b.getNumber(),\n                            b -> b.getText()),\n                    Arrays.<BiConsumer<MinimalMutableSimple, Object>>asList(\n                            (b, v) -> b.setNumber((Integer) v),\n                            (b, v) -> b.setText((String) v)));\n\n    /**\n     * The meta-bean for {@code MinimalMutableSimple}.\n     * @return the meta-bean, not null\n     */\n    public static TypedMetaBean<MinimalMutableSimple> meta() {\n        return META_BEAN;\n    }\n\n    static {\n        MetaBean.register(META_BEAN);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    @Override\n    public TypedMetaBean<MinimalMutableSimple> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public int getNumber() {\n        return number;\n    }\n\n    /**\n     * Sets the number.\n     * @param number  the new value of the property\n     */\n    public void setNumber(int number) {\n        this.number = number;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the text.\n     * @return the value of the property\n     */\n    public String getText() {\n        return text;\n    }\n\n    /**\n     * Sets the text.\n     * @param text  the new value of the property\n     */\n    public void setText(String text) {\n        this.text = text;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MinimalMutableSimple clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            MinimalMutableSimple other = (MinimalMutableSimple) obj;\n            return (this.getNumber() == other.getNumber()) &&\n                    JodaBeanUtils.equal(this.getText(), other.getText());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNumber());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getText());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"MinimalMutableSimple{\");\n        buf.append(\"number\").append('=').append(JodaBeanUtils.toString(getNumber())).append(',').append(' ');\n        buf.append(\"text\").append('=').append(JodaBeanUtils.toString(getText()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MutableBaseBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock.\n */\n@BeanDefinition(builderScope = \"public\")\npublic class MutableBaseBean implements Bean {\n\n    @PropertyDefinition\n    private String baseBeanString;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MutableBaseBean}.\n     * @return the meta-bean, not null\n     */\n    public static MutableBaseBean.Meta meta() {\n        return MutableBaseBean.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(MutableBaseBean.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static MutableBaseBean.Builder builder() {\n        return new MutableBaseBean.Builder();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    protected MutableBaseBean(MutableBaseBean.Builder builder) {\n        this.baseBeanString = builder.baseBeanString;\n    }\n\n    @Override\n    public MutableBaseBean.Meta metaBean() {\n        return MutableBaseBean.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the baseBeanString.\n     * @return the value of the property\n     */\n    public String getBaseBeanString() {\n        return baseBeanString;\n    }\n\n    /**\n     * Sets the baseBeanString.\n     * @param baseBeanString  the new value of the property\n     */\n    public void setBaseBeanString(String baseBeanString) {\n        this.baseBeanString = baseBeanString;\n    }\n\n    /**\n     * Gets the the {@code baseBeanString} property.\n     * @return the property, not null\n     */\n    public final Property<String> baseBeanString() {\n        return metaBean().baseBeanString().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public MutableBaseBean clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            MutableBaseBean other = (MutableBaseBean) obj;\n            return JodaBeanUtils.equal(this.getBaseBeanString(), other.getBaseBeanString());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getBaseBeanString());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"MutableBaseBean{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"baseBeanString\").append('=').append(JodaBeanUtils.toString(getBaseBeanString())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code MutableBaseBean}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code baseBeanString} property.\n         */\n        private final MetaProperty<String> baseBeanString = DirectMetaProperty.ofReadWrite(\n                this, \"baseBeanString\", MutableBaseBean.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"baseBeanString\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 788344210:  // baseBeanString\n                    return this.baseBeanString;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public MutableBaseBean.Builder builder() {\n            return new MutableBaseBean.Builder();\n        }\n\n        @Override\n        public Class<? extends MutableBaseBean> beanType() {\n            return MutableBaseBean.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code baseBeanString} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> baseBeanString() {\n            return baseBeanString;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 788344210:  // baseBeanString\n                    return ((MutableBaseBean) bean).getBaseBeanString();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 788344210:  // baseBeanString\n                    ((MutableBaseBean) bean).setBaseBeanString((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code MutableBaseBean}.\n     */\n    public static class Builder extends DirectFieldsBeanBuilder<MutableBaseBean> {\n\n        private String baseBeanString;\n\n        /**\n         * Restricted constructor.\n         */\n        protected Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        protected Builder(MutableBaseBean beanToCopy) {\n            this.baseBeanString = beanToCopy.getBaseBeanString();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 788344210:  // baseBeanString\n                    return this.baseBeanString;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 788344210:  // baseBeanString\n                    this.baseBeanString = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public MutableBaseBean build() {\n            return new MutableBaseBean(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the baseBeanString.\n         * @param baseBeanString  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder baseBeanString(String baseBeanString) {\n            this.baseBeanString = baseBeanString;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"MutableBaseBean.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        protected void toString(StringBuilder buf) {\n            buf.append(\"baseBeanString\").append('=').append(JodaBeanUtils.toString(baseBeanString)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MutableDeprecated.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.Optional;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock person JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic final class MutableDeprecated implements Cloneable, Bean {\n\n    /**\n     * The field with deprecated annotation and Javadoc tag.\n     * @deprecated Use something else\n     */\n    @Deprecated\n    @PropertyDefinition\n    private String deprecatedBoth;\n\n    /**\n     * The field with deprecated Javadoc tag only.\n     * @deprecated Use something else\n     */\n    @PropertyDefinition\n    private String deprecatedJavadoc;\n\n    @Deprecated\n    @PropertyDefinition\n    private String deprecatedAnnotation;\n\n    @Deprecated\n    @PropertyDefinition(get = \"optional\")\n    private String deprecatedOptional;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MutableDeprecated}.\n     * @return the meta-bean, not null\n     */\n    public static MutableDeprecated.Meta meta() {\n        return MutableDeprecated.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(MutableDeprecated.Meta.INSTANCE);\n    }\n\n    @Override\n    public MutableDeprecated.Meta metaBean() {\n        return MutableDeprecated.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the field with deprecated annotation and Javadoc tag.\n     * @return the value of the property\n     * @deprecated Use something else\n     */\n    @Deprecated\n    public String getDeprecatedBoth() {\n        return deprecatedBoth;\n    }\n\n    /**\n     * Sets the field with deprecated annotation and Javadoc tag.\n     * @param deprecatedBoth  the new value of the property\n     * @deprecated Use something else\n     */\n    @Deprecated\n    public void setDeprecatedBoth(String deprecatedBoth) {\n        this.deprecatedBoth = deprecatedBoth;\n    }\n\n    /**\n     * Gets the the {@code deprecatedBoth} property.\n     * @return the property, not null\n     * @deprecated Use something else\n     */\n    @Deprecated\n    public Property<String> deprecatedBoth() {\n        return metaBean().deprecatedBoth().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the field with deprecated Javadoc tag only.\n     * @return the value of the property\n     * @deprecated Use something else\n     */\n    @Deprecated\n    public String getDeprecatedJavadoc() {\n        return deprecatedJavadoc;\n    }\n\n    /**\n     * Sets the field with deprecated Javadoc tag only.\n     * @param deprecatedJavadoc  the new value of the property\n     * @deprecated Use something else\n     */\n    @Deprecated\n    public void setDeprecatedJavadoc(String deprecatedJavadoc) {\n        this.deprecatedJavadoc = deprecatedJavadoc;\n    }\n\n    /**\n     * Gets the the {@code deprecatedJavadoc} property.\n     * @return the property, not null\n     * @deprecated Use something else\n     */\n    @Deprecated\n    public Property<String> deprecatedJavadoc() {\n        return metaBean().deprecatedJavadoc().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the deprecatedAnnotation.\n     * @return the value of the property\n     * @deprecated Deprecated\n     */\n    @Deprecated\n    public String getDeprecatedAnnotation() {\n        return deprecatedAnnotation;\n    }\n\n    /**\n     * Sets the deprecatedAnnotation.\n     * @param deprecatedAnnotation  the new value of the property\n     * @deprecated Deprecated\n     */\n    @Deprecated\n    public void setDeprecatedAnnotation(String deprecatedAnnotation) {\n        this.deprecatedAnnotation = deprecatedAnnotation;\n    }\n\n    /**\n     * Gets the the {@code deprecatedAnnotation} property.\n     * @return the property, not null\n     * @deprecated Deprecated\n     */\n    @Deprecated\n    public Property<String> deprecatedAnnotation() {\n        return metaBean().deprecatedAnnotation().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the deprecatedOptional.\n     * @return the optional value of the property, not null\n     * @deprecated Deprecated\n     */\n    @Deprecated\n    public Optional<String> getDeprecatedOptional() {\n        return Optional.ofNullable(deprecatedOptional);\n    }\n\n    /**\n     * Sets the deprecatedOptional.\n     * @param deprecatedOptional  the new value of the property\n     * @deprecated Deprecated\n     */\n    @Deprecated\n    public void setDeprecatedOptional(String deprecatedOptional) {\n        this.deprecatedOptional = deprecatedOptional;\n    }\n\n    /**\n     * Gets the the {@code deprecatedOptional} property.\n     * @return the property, not null\n     * @deprecated Deprecated\n     */\n    @Deprecated\n    public Property<String> deprecatedOptional() {\n        return metaBean().deprecatedOptional().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MutableDeprecated clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            MutableDeprecated other = (MutableDeprecated) obj;\n            return JodaBeanUtils.equal(this.getDeprecatedBoth(), other.getDeprecatedBoth()) &&\n                    JodaBeanUtils.equal(this.getDeprecatedJavadoc(), other.getDeprecatedJavadoc()) &&\n                    JodaBeanUtils.equal(this.getDeprecatedAnnotation(), other.getDeprecatedAnnotation()) &&\n                    JodaBeanUtils.equal(this.deprecatedOptional, other.deprecatedOptional);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getDeprecatedBoth());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getDeprecatedJavadoc());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getDeprecatedAnnotation());\n        hash = hash * 31 + JodaBeanUtils.hashCode(deprecatedOptional);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(160);\n        buf.append(\"MutableDeprecated{\");\n        buf.append(\"deprecatedBoth\").append('=').append(JodaBeanUtils.toString(getDeprecatedBoth())).append(',').append(' ');\n        buf.append(\"deprecatedJavadoc\").append('=').append(JodaBeanUtils.toString(getDeprecatedJavadoc())).append(',').append(' ');\n        buf.append(\"deprecatedAnnotation\").append('=').append(JodaBeanUtils.toString(getDeprecatedAnnotation())).append(',').append(' ');\n        buf.append(\"deprecatedOptional\").append('=').append(JodaBeanUtils.toString(deprecatedOptional));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code MutableDeprecated}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code deprecatedBoth} property.\n         */\n        private final MetaProperty<String> deprecatedBoth = DirectMetaProperty.ofReadWrite(\n                this, \"deprecatedBoth\", MutableDeprecated.class, String.class);\n        /**\n         * The meta-property for the {@code deprecatedJavadoc} property.\n         */\n        private final MetaProperty<String> deprecatedJavadoc = DirectMetaProperty.ofReadWrite(\n                this, \"deprecatedJavadoc\", MutableDeprecated.class, String.class);\n        /**\n         * The meta-property for the {@code deprecatedAnnotation} property.\n         */\n        private final MetaProperty<String> deprecatedAnnotation = DirectMetaProperty.ofReadWrite(\n                this, \"deprecatedAnnotation\", MutableDeprecated.class, String.class);\n        /**\n         * The meta-property for the {@code deprecatedOptional} property.\n         */\n        private final MetaProperty<String> deprecatedOptional = DirectMetaProperty.ofReadWrite(\n                this, \"deprecatedOptional\", MutableDeprecated.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"deprecatedBoth\",\n                \"deprecatedJavadoc\",\n                \"deprecatedAnnotation\",\n                \"deprecatedOptional\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1108081708:  // deprecatedBoth\n                    return this.deprecatedBoth;\n                case -1632501085:  // deprecatedJavadoc\n                    return this.deprecatedJavadoc;\n                case 1044703554:  // deprecatedAnnotation\n                    return this.deprecatedAnnotation;\n                case 1434300979:  // deprecatedOptional\n                    return this.deprecatedOptional;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends MutableDeprecated> builder() {\n            return new DirectBeanBuilder<>(new MutableDeprecated());\n        }\n\n        @Override\n        public Class<? extends MutableDeprecated> beanType() {\n            return MutableDeprecated.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code deprecatedBoth} property.\n         * @return the meta-property, not null\n         * @deprecated Use something else\n         */\n        @Deprecated\n        public MetaProperty<String> deprecatedBoth() {\n            return deprecatedBoth;\n        }\n\n        /**\n         * The meta-property for the {@code deprecatedJavadoc} property.\n         * @return the meta-property, not null\n         * @deprecated Use something else\n         */\n        @Deprecated\n        public MetaProperty<String> deprecatedJavadoc() {\n            return deprecatedJavadoc;\n        }\n\n        /**\n         * The meta-property for the {@code deprecatedAnnotation} property.\n         * @return the meta-property, not null\n         * @deprecated Deprecated\n         */\n        @Deprecated\n        public MetaProperty<String> deprecatedAnnotation() {\n            return deprecatedAnnotation;\n        }\n\n        /**\n         * The meta-property for the {@code deprecatedOptional} property.\n         * @return the meta-property, not null\n         * @deprecated Deprecated\n         */\n        @Deprecated\n        public MetaProperty<String> deprecatedOptional() {\n            return deprecatedOptional;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1108081708:  // deprecatedBoth\n                    return ((MutableDeprecated) bean).getDeprecatedBoth();\n                case -1632501085:  // deprecatedJavadoc\n                    return ((MutableDeprecated) bean).getDeprecatedJavadoc();\n                case 1044703554:  // deprecatedAnnotation\n                    return ((MutableDeprecated) bean).getDeprecatedAnnotation();\n                case 1434300979:  // deprecatedOptional\n                    return ((MutableDeprecated) bean).deprecatedOptional;\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1108081708:  // deprecatedBoth\n                    ((MutableDeprecated) bean).setDeprecatedBoth((String) newValue);\n                    return;\n                case -1632501085:  // deprecatedJavadoc\n                    ((MutableDeprecated) bean).setDeprecatedJavadoc((String) newValue);\n                    return;\n                case 1044703554:  // deprecatedAnnotation\n                    ((MutableDeprecated) bean).setDeprecatedAnnotation((String) newValue);\n                    return;\n                case 1434300979:  // deprecatedOptional\n                    ((MutableDeprecated) bean).setDeprecatedOptional((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MutableDerived.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock bean, used for testing.\n */\n@BeanDefinition(builderScope = \"public\")\npublic class MutableDerived extends MutableEmptyBase {\n\n    @PropertyDefinition\n    private final String name;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MutableDerived}.\n     * @return the meta-bean, not null\n     */\n    public static MutableDerived.Meta meta() {\n        return MutableDerived.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(MutableDerived.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static MutableDerived.Builder builder() {\n        return new MutableDerived.Builder();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    protected MutableDerived(MutableDerived.Builder builder) {\n        super(builder);\n        this.name = builder.name;\n    }\n\n    @Override\n    public MutableDerived.Meta metaBean() {\n        return MutableDerived.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property\n     */\n    public String getName() {\n        return name;\n    }\n\n    /**\n     * Gets the the {@code name} property.\n     * @return the property, not null\n     */\n    public final Property<String> name() {\n        return metaBean().name().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    @Override\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public MutableDerived clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            MutableDerived other = (MutableDerived) obj;\n            return JodaBeanUtils.equal(this.getName(), other.getName()) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        hash = hash * 31 + JodaBeanUtils.hashCode(getName());\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"MutableDerived{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"name\").append('=').append(JodaBeanUtils.toString(getName())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code MutableDerived}.\n     */\n    public static class Meta extends MutableEmptyBase.Meta {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code name} property.\n         */\n        private final MetaProperty<String> name = DirectMetaProperty.ofReadOnlyBuildable(\n                this, \"name\", MutableDerived.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"name\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public MutableDerived.Builder builder() {\n            return new MutableDerived.Builder();\n        }\n\n        @Override\n        public Class<? extends MutableDerived> beanType() {\n            return MutableDerived.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code name} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> name() {\n            return name;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return ((MutableDerived) bean).getName();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    if (quiet) {\n                        return;\n                    }\n                    throw new UnsupportedOperationException(\"Property cannot be written: name\");\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code MutableDerived}.\n     */\n    public static class Builder extends MutableEmptyBase.Builder {\n\n        private String name;\n\n        /**\n         * Restricted constructor.\n         */\n        protected Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        protected Builder(MutableDerived beanToCopy) {\n            super(beanToCopy);\n            this.name = beanToCopy.getName();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n                default:\n                    return super.get(propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    this.name = (String) newValue;\n                    break;\n                default:\n                    super.set(propertyName, newValue);\n                    break;\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public MutableDerived build() {\n            return new MutableDerived(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the name.\n         * @param name  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder name(String name) {\n            this.name = name;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"MutableDerived.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        @Override\n        protected void toString(StringBuilder buf) {\n            super.toString(buf);\n            buf.append(\"name\").append('=').append(JodaBeanUtils.toString(name)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MutableDerivedBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock.\n */\n@BeanDefinition(builderScope = \"public\")\npublic class MutableDerivedBean extends MutableBaseBean {\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MutableDerivedBean}.\n     * @return the meta-bean, not null\n     */\n    public static MutableDerivedBean.Meta meta() {\n        return MutableDerivedBean.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(MutableDerivedBean.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static MutableDerivedBean.Builder builder() {\n        return new MutableDerivedBean.Builder();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    protected MutableDerivedBean(MutableDerivedBean.Builder builder) {\n        super(builder);\n    }\n\n    @Override\n    public MutableDerivedBean.Meta metaBean() {\n        return MutableDerivedBean.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    @Override\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public MutableDerivedBean clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            return super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(32);\n        buf.append(\"MutableDerivedBean{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code MutableDerivedBean}.\n     */\n    public static class Meta extends MutableBaseBean.Meta {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap());\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        public MutableDerivedBean.Builder builder() {\n            return new MutableDerivedBean.Builder();\n        }\n\n        @Override\n        public Class<? extends MutableDerivedBean> beanType() {\n            return MutableDerivedBean.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code MutableDerivedBean}.\n     */\n    public static class Builder extends MutableBaseBean.Builder {\n\n        /**\n         * Restricted constructor.\n         */\n        protected Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        protected Builder(MutableDerivedBean beanToCopy) {\n            super(beanToCopy);\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            return super.get(propertyName);\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            super.set(propertyName, newValue);\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public MutableDerivedBean build() {\n            return new MutableDerivedBean(this);\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(32);\n            buf.append(\"MutableDerivedBean.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        @Override\n        protected void toString(StringBuilder buf) {\n            super.toString(buf);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MutableEmptyBase.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock bean, used for testing.\n */\n@BeanDefinition(builderScope = \"public\")\npublic class MutableEmptyBase implements Bean {\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MutableEmptyBase}.\n     * @return the meta-bean, not null\n     */\n    public static MutableEmptyBase.Meta meta() {\n        return MutableEmptyBase.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(MutableEmptyBase.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static MutableEmptyBase.Builder builder() {\n        return new MutableEmptyBase.Builder();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    protected MutableEmptyBase(MutableEmptyBase.Builder builder) {\n    }\n\n    @Override\n    public MutableEmptyBase.Meta metaBean() {\n        return MutableEmptyBase.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public MutableEmptyBase clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(32);\n        buf.append(\"MutableEmptyBase{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code MutableEmptyBase}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null);\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        public MutableEmptyBase.Builder builder() {\n            return new MutableEmptyBase.Builder();\n        }\n\n        @Override\n        public Class<? extends MutableEmptyBase> beanType() {\n            return MutableEmptyBase.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code MutableEmptyBase}.\n     */\n    public static class Builder extends DirectFieldsBeanBuilder<MutableEmptyBase> {\n\n        /**\n         * Restricted constructor.\n         */\n        protected Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        protected Builder(MutableEmptyBase beanToCopy) {\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public MutableEmptyBase build() {\n            return new MutableEmptyBase(this);\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(32);\n            buf.append(\"MutableEmptyBase.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        protected void toString(StringBuilder buf) {\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MutableListFinalBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.collect.ImmutableList;\nimport com.google.common.collect.ImmutableMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(builderScope = \"public\")\npublic final class MutableListFinalBean implements Bean {\n\n    @PropertyDefinition\n    private List<String> strings;\n\n    @PropertyDefinition\n    private Map<String, Integer> numberMap;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MutableListFinalBean}.\n     * @return the meta-bean, not null\n     */\n    public static MutableListFinalBean.Meta meta() {\n        return MutableListFinalBean.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(MutableListFinalBean.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static MutableListFinalBean.Builder builder() {\n        return new MutableListFinalBean.Builder();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    private MutableListFinalBean(MutableListFinalBean.Builder builder) {\n        this.strings = builder.strings;\n        this.numberMap = builder.numberMap;\n    }\n\n    @Override\n    public MutableListFinalBean.Meta metaBean() {\n        return MutableListFinalBean.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the strings.\n     * @return the value of the property\n     */\n    public List<String> getStrings() {\n        return strings;\n    }\n\n    /**\n     * Sets the strings.\n     * @param strings  the new value of the property\n     */\n    public void setStrings(List<String> strings) {\n        this.strings = strings;\n    }\n\n    /**\n     * Gets the the {@code strings} property.\n     * @return the property, not null\n     */\n    public Property<List<String>> strings() {\n        return metaBean().strings().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the numberMap.\n     * @return the value of the property\n     */\n    public Map<String, Integer> getNumberMap() {\n        return numberMap;\n    }\n\n    /**\n     * Sets the numberMap.\n     * @param numberMap  the new value of the property\n     */\n    public void setNumberMap(Map<String, Integer> numberMap) {\n        this.numberMap = numberMap;\n    }\n\n    /**\n     * Gets the the {@code numberMap} property.\n     * @return the property, not null\n     */\n    public Property<Map<String, Integer>> numberMap() {\n        return metaBean().numberMap().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public MutableListFinalBean clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            MutableListFinalBean other = (MutableListFinalBean) obj;\n            return JodaBeanUtils.equal(this.getStrings(), other.getStrings()) &&\n                    JodaBeanUtils.equal(this.getNumberMap(), other.getNumberMap());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getStrings());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNumberMap());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"MutableListFinalBean{\");\n        buf.append(\"strings\").append('=').append(JodaBeanUtils.toString(getStrings())).append(',').append(' ');\n        buf.append(\"numberMap\").append('=').append(JodaBeanUtils.toString(getNumberMap()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code MutableListFinalBean}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code strings} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<String>> strings = DirectMetaProperty.ofReadWrite(\n                this, \"strings\", MutableListFinalBean.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code numberMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Map<String, Integer>> numberMap = DirectMetaProperty.ofReadWrite(\n                this, \"numberMap\", MutableListFinalBean.class, (Class) Map.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"strings\",\n                \"numberMap\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1881759102:  // strings\n                    return this.strings;\n                case 1649910099:  // numberMap\n                    return this.numberMap;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public MutableListFinalBean.Builder builder() {\n            return new MutableListFinalBean.Builder();\n        }\n\n        @Override\n        public Class<? extends MutableListFinalBean> beanType() {\n            return MutableListFinalBean.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code strings} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<List<String>> strings() {\n            return strings;\n        }\n\n        /**\n         * The meta-property for the {@code numberMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Map<String, Integer>> numberMap() {\n            return numberMap;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1881759102:  // strings\n                    return ((MutableListFinalBean) bean).getStrings();\n                case 1649910099:  // numberMap\n                    return ((MutableListFinalBean) bean).getNumberMap();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1881759102:  // strings\n                    ((MutableListFinalBean) bean).setStrings((List<String>) newValue);\n                    return;\n                case 1649910099:  // numberMap\n                    ((MutableListFinalBean) bean).setNumberMap((Map<String, Integer>) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code MutableListFinalBean}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<MutableListFinalBean> {\n\n        private List<String> strings;\n        private Map<String, Integer> numberMap;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(MutableListFinalBean beanToCopy) {\n            this.strings = (beanToCopy.getStrings() != null ? ImmutableList.copyOf(beanToCopy.getStrings()) : null);\n            this.numberMap = (beanToCopy.getNumberMap() != null ? ImmutableMap.copyOf(beanToCopy.getNumberMap()) : null);\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1881759102:  // strings\n                    return this.strings;\n                case 1649910099:  // numberMap\n                    return this.numberMap;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -1881759102:  // strings\n                    this.strings = (List<String>) newValue;\n                    break;\n                case 1649910099:  // numberMap\n                    this.numberMap = (Map<String, Integer>) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public MutableListFinalBean build() {\n            return new MutableListFinalBean(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the strings.\n         * @param strings  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder strings(List<String> strings) {\n            this.strings = strings;\n            return this;\n        }\n\n        /**\n         * Sets the {@code strings} property in the builder\n         * from an array of objects.\n         * @param strings  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder strings(String... strings) {\n            return strings(ImmutableList.copyOf(strings));\n        }\n\n        /**\n         * Sets the numberMap.\n         * @param numberMap  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder numberMap(Map<String, Integer> numberMap) {\n            this.numberMap = numberMap;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(96);\n            buf.append(\"MutableListFinalBean.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        protected void toString(StringBuilder buf) {\n            buf.append(\"strings\").append('=').append(JodaBeanUtils.toString(strings)).append(',').append(' ');\n            buf.append(\"numberMap\").append('=').append(JodaBeanUtils.toString(numberMap)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MutableListNonFinalBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.collect.ImmutableList;\nimport com.google.common.collect.ImmutableMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(builderScope = \"public\")\npublic class MutableListNonFinalBean implements Bean {\n\n    @PropertyDefinition\n    private List<String> strings;\n\n    @PropertyDefinition\n    private Map<String, Integer> numberMap;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MutableListNonFinalBean}.\n     * @return the meta-bean, not null\n     */\n    public static MutableListNonFinalBean.Meta meta() {\n        return MutableListNonFinalBean.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(MutableListNonFinalBean.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static MutableListNonFinalBean.Builder builder() {\n        return new MutableListNonFinalBean.Builder();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    protected MutableListNonFinalBean(MutableListNonFinalBean.Builder builder) {\n        this.strings = builder.strings;\n        this.numberMap = builder.numberMap;\n    }\n\n    @Override\n    public MutableListNonFinalBean.Meta metaBean() {\n        return MutableListNonFinalBean.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the strings.\n     * @return the value of the property\n     */\n    public List<String> getStrings() {\n        return strings;\n    }\n\n    /**\n     * Sets the strings.\n     * @param strings  the new value of the property\n     */\n    public void setStrings(List<String> strings) {\n        this.strings = strings;\n    }\n\n    /**\n     * Gets the the {@code strings} property.\n     * @return the property, not null\n     */\n    public final Property<List<String>> strings() {\n        return metaBean().strings().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the numberMap.\n     * @return the value of the property\n     */\n    public Map<String, Integer> getNumberMap() {\n        return numberMap;\n    }\n\n    /**\n     * Sets the numberMap.\n     * @param numberMap  the new value of the property\n     */\n    public void setNumberMap(Map<String, Integer> numberMap) {\n        this.numberMap = numberMap;\n    }\n\n    /**\n     * Gets the the {@code numberMap} property.\n     * @return the property, not null\n     */\n    public final Property<Map<String, Integer>> numberMap() {\n        return metaBean().numberMap().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public MutableListNonFinalBean clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            MutableListNonFinalBean other = (MutableListNonFinalBean) obj;\n            return JodaBeanUtils.equal(this.getStrings(), other.getStrings()) &&\n                    JodaBeanUtils.equal(this.getNumberMap(), other.getNumberMap());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getStrings());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNumberMap());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"MutableListNonFinalBean{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"strings\").append('=').append(JodaBeanUtils.toString(getStrings())).append(',').append(' ');\n        buf.append(\"numberMap\").append('=').append(JodaBeanUtils.toString(getNumberMap())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code MutableListNonFinalBean}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code strings} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<String>> strings = DirectMetaProperty.ofReadWrite(\n                this, \"strings\", MutableListNonFinalBean.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code numberMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Map<String, Integer>> numberMap = DirectMetaProperty.ofReadWrite(\n                this, \"numberMap\", MutableListNonFinalBean.class, (Class) Map.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"strings\",\n                \"numberMap\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1881759102:  // strings\n                    return this.strings;\n                case 1649910099:  // numberMap\n                    return this.numberMap;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public MutableListNonFinalBean.Builder builder() {\n            return new MutableListNonFinalBean.Builder();\n        }\n\n        @Override\n        public Class<? extends MutableListNonFinalBean> beanType() {\n            return MutableListNonFinalBean.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code strings} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<String>> strings() {\n            return strings;\n        }\n\n        /**\n         * The meta-property for the {@code numberMap} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Map<String, Integer>> numberMap() {\n            return numberMap;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1881759102:  // strings\n                    return ((MutableListNonFinalBean) bean).getStrings();\n                case 1649910099:  // numberMap\n                    return ((MutableListNonFinalBean) bean).getNumberMap();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -1881759102:  // strings\n                    ((MutableListNonFinalBean) bean).setStrings((List<String>) newValue);\n                    return;\n                case 1649910099:  // numberMap\n                    ((MutableListNonFinalBean) bean).setNumberMap((Map<String, Integer>) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code MutableListNonFinalBean}.\n     */\n    public static class Builder extends DirectFieldsBeanBuilder<MutableListNonFinalBean> {\n\n        private List<String> strings;\n        private Map<String, Integer> numberMap;\n\n        /**\n         * Restricted constructor.\n         */\n        protected Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        protected Builder(MutableListNonFinalBean beanToCopy) {\n            this.strings = (beanToCopy.getStrings() != null ? ImmutableList.copyOf(beanToCopy.getStrings()) : null);\n            this.numberMap = (beanToCopy.getNumberMap() != null ? ImmutableMap.copyOf(beanToCopy.getNumberMap()) : null);\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -1881759102:  // strings\n                    return this.strings;\n                case 1649910099:  // numberMap\n                    return this.numberMap;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -1881759102:  // strings\n                    this.strings = (List<String>) newValue;\n                    break;\n                case 1649910099:  // numberMap\n                    this.numberMap = (Map<String, Integer>) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public MutableListNonFinalBean build() {\n            return new MutableListNonFinalBean(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the strings.\n         * @param strings  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder strings(List<String> strings) {\n            this.strings = strings;\n            return this;\n        }\n\n        /**\n         * Sets the {@code strings} property in the builder\n         * from an array of objects.\n         * @param strings  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder strings(String... strings) {\n            return strings(ImmutableList.copyOf(strings));\n        }\n\n        /**\n         * Sets the numberMap.\n         * @param numberMap  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder numberMap(Map<String, Integer> numberMap) {\n            this.numberMap = numberMap;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(96);\n            buf.append(\"MutableListNonFinalBean.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        protected void toString(StringBuilder buf) {\n            buf.append(\"strings\").append('=').append(JodaBeanUtils.toString(strings)).append(',').append(' ');\n            buf.append(\"numberMap\").append('=').append(JodaBeanUtils.toString(numberMap)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MutableOptional.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.base.Optional;\n\n/**\n * Mock.\n */\n@BeanDefinition\npublic final class MutableOptional implements Bean {\n\n    // this works but not in serialization\n    @PropertyDefinition(validate = \"notNull\")\n    private Optional<String> optString;\n    // these are the recommended approach, nullable fields, optional getters\n    // remove \"Guava\" to test Java 8 generation\n    @PropertyDefinition(get = \"optionalGuava\")\n    private String optStringGetter;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MutableOptional}.\n     * @return the meta-bean, not null\n     */\n    public static MutableOptional.Meta meta() {\n        return MutableOptional.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(MutableOptional.Meta.INSTANCE);\n    }\n\n    @Override\n    public MutableOptional.Meta metaBean() {\n        return MutableOptional.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the optString.\n     * @return the value of the property, not null\n     */\n    public Optional<String> getOptString() {\n        return optString;\n    }\n\n    /**\n     * Sets the optString.\n     * @param optString  the new value of the property, not null\n     */\n    public void setOptString(Optional<String> optString) {\n        JodaBeanUtils.notNull(optString, \"optString\");\n        this.optString = optString;\n    }\n\n    /**\n     * Gets the the {@code optString} property.\n     * @return the property, not null\n     */\n    public Property<Optional<String>> optString() {\n        return metaBean().optString().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the optStringGetter.\n     * @return the optional value of the property, not null\n     */\n    public Optional<String> getOptStringGetter() {\n        return Optional.fromNullable(optStringGetter);\n    }\n\n    /**\n     * Sets the optStringGetter.\n     * @param optStringGetter  the new value of the property\n     */\n    public void setOptStringGetter(String optStringGetter) {\n        this.optStringGetter = optStringGetter;\n    }\n\n    /**\n     * Gets the the {@code optStringGetter} property.\n     * @return the property, not null\n     */\n    public Property<String> optStringGetter() {\n        return metaBean().optStringGetter().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MutableOptional clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            MutableOptional other = (MutableOptional) obj;\n            return JodaBeanUtils.equal(this.getOptString(), other.getOptString()) &&\n                    JodaBeanUtils.equal(this.optStringGetter, other.optStringGetter);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getOptString());\n        hash = hash * 31 + JodaBeanUtils.hashCode(optStringGetter);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"MutableOptional{\");\n        buf.append(\"optString\").append('=').append(JodaBeanUtils.toString(getOptString())).append(',').append(' ');\n        buf.append(\"optStringGetter\").append('=').append(JodaBeanUtils.toString(optStringGetter));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code MutableOptional}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code optString} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Optional<String>> optString = DirectMetaProperty.ofReadWrite(\n                this, \"optString\", MutableOptional.class, (Class) Optional.class);\n        /**\n         * The meta-property for the {@code optStringGetter} property.\n         */\n        private final MetaProperty<String> optStringGetter = DirectMetaProperty.ofReadWrite(\n                this, \"optStringGetter\", MutableOptional.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"optString\",\n                \"optStringGetter\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 1220339876:  // optString\n                    return this.optString;\n                case -740642097:  // optStringGetter\n                    return this.optStringGetter;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends MutableOptional> builder() {\n            return new DirectBeanBuilder<>(new MutableOptional());\n        }\n\n        @Override\n        public Class<? extends MutableOptional> beanType() {\n            return MutableOptional.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code optString} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Optional<String>> optString() {\n            return optString;\n        }\n\n        /**\n         * The meta-property for the {@code optStringGetter} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> optStringGetter() {\n            return optStringGetter;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 1220339876:  // optString\n                    return ((MutableOptional) bean).getOptString();\n                case -740642097:  // optStringGetter\n                    return ((MutableOptional) bean).optStringGetter;\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 1220339876:  // optString\n                    ((MutableOptional) bean).setOptString((Optional<String>) newValue);\n                    return;\n                case -740642097:  // optStringGetter\n                    ((MutableOptional) bean).setOptStringGetter((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n        @Override\n        protected void validate(Bean bean) {\n            JodaBeanUtils.notNull(((MutableOptional) bean).optString, \"optString\");\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/MutableTypes.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic final class MutableTypes<T extends Comparable<T>> implements Bean {\n\n    // not supported, the other two options below are good enough\n//    @PropertyDefinition(validate = \"notNull\")\n//    private final List<?> listWild = new ArrayList<Object>();\n    @PropertyDefinition\n    private List<?> listWildNullable;\n    @PropertyDefinition(validate = \"notNull\", type = \"List<?>\")\n    private final List<Object> listWildPublic = new ArrayList<>();\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code MutableTypes}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static MutableTypes.Meta meta() {\n        return MutableTypes.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code MutableTypes}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Comparable<R>> MutableTypes.Meta<R> metaMutableTypes(Class<R> cls) {\n        return MutableTypes.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(MutableTypes.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public MutableTypes.Meta<T> metaBean() {\n        return MutableTypes.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listWildNullable.\n     * @return the value of the property\n     */\n    public List<?> getListWildNullable() {\n        return listWildNullable;\n    }\n\n    /**\n     * Sets the listWildNullable.\n     * @param listWildNullable  the new value of the property\n     */\n    public void setListWildNullable(List<?> listWildNullable) {\n        this.listWildNullable = listWildNullable;\n    }\n\n    /**\n     * Gets the the {@code listWildNullable} property.\n     * @return the property, not null\n     */\n    public Property<List<?>> listWildNullable() {\n        return metaBean().listWildNullable().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listWildPublic.\n     * @return the value of the property, not null\n     */\n    public List<?> getListWildPublic() {\n        return listWildPublic;\n    }\n\n    /**\n     * Sets the listWildPublic.\n     * @param listWildPublic  the new value of the property, not null\n     */\n    public void setListWildPublic(List<?> listWildPublic) {\n        JodaBeanUtils.notNull(listWildPublic, \"listWildPublic\");\n        this.listWildPublic.clear();\n        this.listWildPublic.addAll(listWildPublic);\n    }\n\n    /**\n     * Gets the the {@code listWildPublic} property.\n     * @return the property, not null\n     */\n    public Property<List<?>> listWildPublic() {\n        return metaBean().listWildPublic().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MutableTypes<T> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            MutableTypes<?> other = (MutableTypes<?>) obj;\n            return JodaBeanUtils.equal(this.getListWildNullable(), other.getListWildNullable()) &&\n                    JodaBeanUtils.equal(this.getListWildPublic(), other.getListWildPublic());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getListWildNullable());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getListWildPublic());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"MutableTypes{\");\n        buf.append(\"listWildNullable\").append('=').append(JodaBeanUtils.toString(getListWildNullable())).append(',').append(' ');\n        buf.append(\"listWildPublic\").append('=').append(JodaBeanUtils.toString(getListWildPublic()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code MutableTypes}.\n     * @param <T>  the type\n     */\n    public static final class Meta<T extends Comparable<T>> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code listWildNullable} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<?>> listWildNullable = DirectMetaProperty.ofReadWrite(\n                this, \"listWildNullable\", MutableTypes.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code listWildPublic} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<?>> listWildPublic = DirectMetaProperty.ofReadWrite(\n                this, \"listWildPublic\", MutableTypes.class, (Class) List.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"listWildNullable\",\n                \"listWildPublic\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -911478519:  // listWildNullable\n                    return this.listWildNullable;\n                case -355160559:  // listWildPublic\n                    return this.listWildPublic;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends MutableTypes<T>> builder() {\n            return new DirectBeanBuilder<>(new MutableTypes<T>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends MutableTypes<T>> beanType() {\n            return (Class) MutableTypes.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code listWildNullable} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<List<?>> listWildNullable() {\n            return listWildNullable;\n        }\n\n        /**\n         * The meta-property for the {@code listWildPublic} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<List<?>> listWildPublic() {\n            return listWildPublic;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -911478519:  // listWildNullable\n                    return ((MutableTypes<?>) bean).getListWildNullable();\n                case -355160559:  // listWildPublic\n                    return ((MutableTypes<?>) bean).getListWildPublic();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -911478519:  // listWildNullable\n                    ((MutableTypes<T>) bean).setListWildNullable((List<?>) newValue);\n                    return;\n                case -355160559:  // listWildPublic\n                    ((MutableTypes<T>) bean).setListWildPublic((List<?>) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n        @Override\n        protected void validate(Bean bean) {\n            JodaBeanUtils.notNull(((MutableTypes<?>) bean).listWildPublic, \"listWildPublic\");\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/NoClone.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock person JavaBean, used for testing.\n */\n@BeanDefinition(cloneStyle = \"omit\")\npublic class NoClone\n        implements Bean {\n\n    @PropertyDefinition\n    private String dummyProperty;\n\n    /**\n     * Creates an instance.\n     */\n    public NoClone() {\n    }\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code NoClone}.\n     * @return the meta-bean, not null\n     */\n    public static NoClone.Meta meta() {\n        return NoClone.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(NoClone.Meta.INSTANCE);\n    }\n\n    @Override\n    public NoClone.Meta metaBean() {\n        return NoClone.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the dummyProperty.\n     * @return the value of the property\n     */\n    public String getDummyProperty() {\n        return dummyProperty;\n    }\n\n    /**\n     * Sets the dummyProperty.\n     * @param dummyProperty  the new value of the property\n     */\n    public void setDummyProperty(String dummyProperty) {\n        this.dummyProperty = dummyProperty;\n    }\n\n    /**\n     * Gets the the {@code dummyProperty} property.\n     * @return the property, not null\n     */\n    public final Property<String> dummyProperty() {\n        return metaBean().dummyProperty().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            NoClone other = (NoClone) obj;\n            return JodaBeanUtils.equal(this.getDummyProperty(), other.getDummyProperty());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getDummyProperty());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"NoClone{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"dummyProperty\").append('=').append(JodaBeanUtils.toString(getDummyProperty())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code NoClone}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code dummyProperty} property.\n         */\n        private final MetaProperty<String> dummyProperty = DirectMetaProperty.ofReadWrite(\n                this, \"dummyProperty\", NoClone.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"dummyProperty\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -184213859:  // dummyProperty\n                    return this.dummyProperty;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends NoClone> builder() {\n            return new DirectBeanBuilder<>(new NoClone());\n        }\n\n        @Override\n        public Class<? extends NoClone> beanType() {\n            return NoClone.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code dummyProperty} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> dummyProperty() {\n            return dummyProperty;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -184213859:  // dummyProperty\n                    return ((NoClone) bean).getDummyProperty();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -184213859:  // dummyProperty\n                    ((NoClone) bean).setDummyProperty((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/NoGenEquals.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock used for test equals and final class.\n * <p>\n * The {@code cacheHashCode} flag is a test to ensure it is ignored.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(cacheHashCode = true)\npublic final class NoGenEquals extends DirectBean {\n\n    /**\n     * The value.\n     */\n    @PropertyDefinition\n    private Object value;\n\n    @Override\n    public boolean equals(Object obj) {\n        // should block equals generation\n        return obj == this;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code NoGenEquals}.\n     * @return the meta-bean, not null\n     */\n    public static NoGenEquals.Meta meta() {\n        return NoGenEquals.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(NoGenEquals.Meta.INSTANCE);\n    }\n\n    @Override\n    public NoGenEquals.Meta metaBean() {\n        return NoGenEquals.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the value.\n     * @return the value of the property\n     */\n    public Object getValue() {\n        return value;\n    }\n\n    /**\n     * Sets the value.\n     * @param value  the new value of the property\n     */\n    public void setValue(Object value) {\n        this.value = value;\n    }\n\n    /**\n     * Gets the the {@code value} property.\n     * @return the property, not null\n     */\n    public Property<Object> value() {\n        return metaBean().value().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public NoGenEquals clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"NoGenEquals{\");\n        buf.append(\"value\").append('=').append(JodaBeanUtils.toString(getValue()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code NoGenEquals}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code value} property.\n         */\n        private final MetaProperty<Object> value = DirectMetaProperty.ofReadWrite(\n                this, \"value\", NoGenEquals.class, Object.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"value\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends NoGenEquals> builder() {\n            return new DirectBeanBuilder<>(new NoGenEquals());\n        }\n\n        @Override\n        public Class<? extends NoGenEquals> beanType() {\n            return NoGenEquals.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code value} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Object> value() {\n            return value;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return ((NoGenEquals) bean).getValue();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    ((NoGenEquals) bean).setValue((Object) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/NoGenToString.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock used for test toString generation.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class NoGenToString extends DirectBean {\n\n    /**\n     * The value.\n     */\n    @PropertyDefinition\n    private Object value;\n\n    @Override\n    public String toString() {\n        return \"NoGenToString\";\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code NoGenToString}.\n     * @return the meta-bean, not null\n     */\n    public static NoGenToString.Meta meta() {\n        return NoGenToString.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(NoGenToString.Meta.INSTANCE);\n    }\n\n    @Override\n    public NoGenToString.Meta metaBean() {\n        return NoGenToString.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the value.\n     * @return the value of the property\n     */\n    public Object getValue() {\n        return value;\n    }\n\n    /**\n     * Sets the value.\n     * @param value  the new value of the property\n     */\n    public void setValue(Object value) {\n        this.value = value;\n    }\n\n    /**\n     * Gets the the {@code value} property.\n     * @return the property, not null\n     */\n    public final Property<Object> value() {\n        return metaBean().value().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public NoGenToString clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            NoGenToString other = (NoGenToString) obj;\n            return JodaBeanUtils.equal(this.getValue(), other.getValue());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getValue());\n        return hash;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code NoGenToString}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code value} property.\n         */\n        private final MetaProperty<Object> value = DirectMetaProperty.ofReadWrite(\n                this, \"value\", NoGenToString.class, Object.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"value\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return this.value;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends NoGenToString> builder() {\n            return new DirectBeanBuilder<>(new NoGenToString());\n        }\n\n        @Override\n        public Class<? extends NoGenToString> beanType() {\n            return NoGenToString.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code value} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Object> value() {\n            return value;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    return ((NoGenToString) bean).getValue();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 111972721:  // value\n                    ((NoGenToString) bean).setValue((Object) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/NoProperties.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock used for testing an absence of properties.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class NoProperties extends DirectBean {\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code NoProperties}.\n     * @return the meta-bean, not null\n     */\n    public static NoProperties.Meta meta() {\n        return NoProperties.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(NoProperties.Meta.INSTANCE);\n    }\n\n    @Override\n    public NoProperties.Meta metaBean() {\n        return NoProperties.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public NoProperties clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(32);\n        buf.append(\"NoProperties{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code NoProperties}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null);\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        public BeanBuilder<? extends NoProperties> builder() {\n            return new DirectBeanBuilder<>(new NoProperties());\n        }\n\n        @Override\n        public Class<? extends NoProperties> beanType() {\n            return NoProperties.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/Pair.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock pair, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class Pair  extends  DirectBean {\n    // extra spaces in definition\n\n    /**\n     * The first value.\n     */\n    @PropertyDefinition\n    private Object first;\n    /**\n     * The second value.\n     */\n    @PropertyDefinition\n    private Object second;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code Pair}.\n     * @return the meta-bean, not null\n     */\n    public static Pair.Meta meta() {\n        return Pair.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(Pair.Meta.INSTANCE);\n    }\n\n    @Override\n    public Pair.Meta metaBean() {\n        return Pair.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the first value.\n     * @return the value of the property\n     */\n    public Object getFirst() {\n        return first;\n    }\n\n    /**\n     * Sets the first value.\n     * @param first  the new value of the property\n     */\n    public void setFirst(Object first) {\n        this.first = first;\n    }\n\n    /**\n     * Gets the the {@code first} property.\n     * @return the property, not null\n     */\n    public final Property<Object> first() {\n        return metaBean().first().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the second value.\n     * @return the value of the property\n     */\n    public Object getSecond() {\n        return second;\n    }\n\n    /**\n     * Sets the second value.\n     * @param second  the new value of the property\n     */\n    public void setSecond(Object second) {\n        this.second = second;\n    }\n\n    /**\n     * Gets the the {@code second} property.\n     * @return the property, not null\n     */\n    public final Property<Object> second() {\n        return metaBean().second().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public Pair clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            Pair other = (Pair) obj;\n            return JodaBeanUtils.equal(this.getFirst(), other.getFirst()) &&\n                    JodaBeanUtils.equal(this.getSecond(), other.getSecond());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getFirst());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getSecond());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"Pair{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"first\").append('=').append(JodaBeanUtils.toString(getFirst())).append(',').append(' ');\n        buf.append(\"second\").append('=').append(JodaBeanUtils.toString(getSecond())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code Pair}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code first} property.\n         */\n        private final MetaProperty<Object> first = DirectMetaProperty.ofReadWrite(\n                this, \"first\", Pair.class, Object.class);\n        /**\n         * The meta-property for the {@code second} property.\n         */\n        private final MetaProperty<Object> second = DirectMetaProperty.ofReadWrite(\n                this, \"second\", Pair.class, Object.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"first\",\n                \"second\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    return this.first;\n                case -906279820:  // second\n                    return this.second;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends Pair> builder() {\n            return new DirectBeanBuilder<>(new Pair());\n        }\n\n        @Override\n        public Class<? extends Pair> beanType() {\n            return Pair.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code first} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Object> first() {\n            return first;\n        }\n\n        /**\n         * The meta-property for the {@code second} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Object> second() {\n            return second;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    return ((Pair) bean).getFirst();\n                case -906279820:  // second\n                    return ((Pair) bean).getSecond();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    ((Pair) bean).setFirst((Object) newValue);\n                    return;\n                case -906279820:  // second\n                    ((Pair) bean).setSecond((Object) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/PairBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.impl.BasicImmutableBeanBuilder;\n\n/**\n * Mock builder, used for testing.\n */\npublic final class PairBuilder extends BasicImmutableBeanBuilder<PairManualTopLevelBuilder> {\n\n    private String first;\n    private String second;\n\n    PairBuilder() {\n        super(PairManualTopLevelBuilder.meta());\n    }\n\n    PairBuilder(PairManualTopLevelBuilder beanToCopy) {\n        super(PairManualTopLevelBuilder.meta());\n        this.first = beanToCopy.getFirst();\n        this.second = beanToCopy.getSecond();\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public Object get(String propertyName) {\n        switch (propertyName) {\n            case \"first\":\n                return first;\n            case \"second\":\n                return second;\n            default:\n                throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n        }\n    }\n\n    @Override\n    public PairBuilder set(String propertyName, Object newValue) {\n        switch (propertyName) {\n            case \"first\":\n                this.first = (String) newValue;\n                break;\n            case \"second\":\n                this.second = (String) newValue;\n                break;\n            default:\n                throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n        }\n        return this;\n    }\n\n    @Override\n    public PairBuilder set(MetaProperty<?> property, Object value) {\n        super.set(property, value);\n        return this;\n    }\n\n    @Override\n    public PairManualTopLevelBuilder build() {\n        return new PairManualTopLevelBuilder(first, second);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets the first value.\n     * @param first  the new value\n     * @return this, for chaining, not null\n     */\n    public PairBuilder first(String first) {\n        this.first = first;\n        return this;\n    }\n\n    /**\n     * Sets the second value.\n     * @param second  the new value\n     * @return this, for chaining, not null\n     */\n    public PairBuilder second(String second) {\n        this.second = second;\n        return this;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"PairManualBuilder.Builder{\");\n        buf.append(\"first\").append('=').append(JodaBeanUtils.toString(first)).append(',').append(' ');\n        buf.append(\"second\").append('=').append(JodaBeanUtils.toString(second));\n        buf.append('}');\n        return buf.toString();\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/PairDeserializer.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.ser.DefaultDeserializer;\n\n/**\n * Mock deserializer.\n */\npublic final class PairDeserializer extends DefaultDeserializer {\n\n    @Override\n    public MetaProperty<?> findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName) {\n        if (\"left\".equals(propertyName)) {\n            return metaBean.metaProperty(\"first\");\n        }\n        if (\"right\".equals(propertyName)) {\n            return metaBean.metaProperty(\"second\");\n        }\n        return super.findMetaProperty(beanType, metaBean, propertyName);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/PairManualInnerBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.BasicImmutableBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock pair, used for testing.\n */\n@BeanDefinition(builderName = \"Builder\")\npublic final class PairManualInnerBuilder implements ImmutableBean {\n\n    /**\n     * The first value.\n     */\n    @PropertyDefinition\n    private final String first;\n    /**\n     * The second value.\n     */\n    @PropertyDefinition\n    private final String second;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code PairManualInnerBuilder}.\n     * @return the meta-bean, not null\n     */\n    public static PairManualInnerBuilder.Meta meta() {\n        return PairManualInnerBuilder.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(PairManualInnerBuilder.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static Builder builder() {\n        return new Builder();\n    }\n\n    private PairManualInnerBuilder(\n            String first,\n            String second) {\n        this.first = first;\n        this.second = second;\n    }\n\n    @Override\n    public PairManualInnerBuilder.Meta metaBean() {\n        return PairManualInnerBuilder.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the first value.\n     * @return the value of the property\n     */\n    public String getFirst() {\n        return first;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the second value.\n     * @return the value of the property\n     */\n    public String getSecond() {\n        return second;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            PairManualInnerBuilder other = (PairManualInnerBuilder) obj;\n            return JodaBeanUtils.equal(this.first, other.first) &&\n                    JodaBeanUtils.equal(this.second, other.second);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(first);\n        hash = hash * 31 + JodaBeanUtils.hashCode(second);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"PairManualInnerBuilder{\");\n        buf.append(\"first\").append('=').append(JodaBeanUtils.toString(first)).append(',').append(' ');\n        buf.append(\"second\").append('=').append(JodaBeanUtils.toString(second));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code PairManualInnerBuilder}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code first} property.\n         */\n        private final MetaProperty<String> first = DirectMetaProperty.ofImmutable(\n                this, \"first\", PairManualInnerBuilder.class, String.class);\n        /**\n         * The meta-property for the {@code second} property.\n         */\n        private final MetaProperty<String> second = DirectMetaProperty.ofImmutable(\n                this, \"second\", PairManualInnerBuilder.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"first\",\n                \"second\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    return this.first;\n                case -906279820:  // second\n                    return this.second;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public Builder builder() {\n            return new Builder();\n        }\n\n        @Override\n        public Class<? extends PairManualInnerBuilder> beanType() {\n            return PairManualInnerBuilder.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code first} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> first() {\n            return first;\n        }\n\n        /**\n         * The meta-property for the {@code second} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> second() {\n            return second;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    return ((PairManualInnerBuilder) bean).getFirst();\n                case -906279820:  // second\n                    return ((PairManualInnerBuilder) bean).getSecond();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n\n    /**\n     * The bean-builder for {@code PairManualBuilder}.\n     */\n    public static final class Builder extends BasicImmutableBeanBuilder<PairManualInnerBuilder> {\n\n        private String first;\n        private String second;\n\n        private Builder() {\n            super(meta());\n        }\n\n        private Builder(PairManualInnerBuilder beanToCopy) {\n            super(meta());\n            this.first = beanToCopy.getFirst();\n            this.second = beanToCopy.getSecond();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName) {\n                case \"first\":\n                    return first;\n                case \"second\":\n                    return second;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName) {\n                case \"first\":\n                    this.first = (String) newValue;\n                    break;\n                case \"second\":\n                    this.second = (String) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public PairManualInnerBuilder build() {\n            return new PairManualInnerBuilder(first, second);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the first value.\n         * @param first  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder first(String first) {\n            this.first = first;\n            return this;\n        }\n\n        /**\n         * Sets the second value.\n         * @param second  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder second(String second) {\n            this.second = second;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(96);\n            buf.append(\"PairManualBuilder.Builder{\");\n            buf.append(\"first\").append('=').append(JodaBeanUtils.toString(first)).append(',').append(' ');\n            buf.append(\"second\").append('=').append(JodaBeanUtils.toString(second));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/PairManualTopLevelBuilder.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock pair, used for testing.\n */\n@BeanDefinition(builderName = \"PairBuilder\", constructorScope = \"package\")\npublic final class PairManualTopLevelBuilder implements ImmutableBean {\n\n    /**\n     * The first value.\n     */\n    @PropertyDefinition\n    private final String first;\n    /**\n     * The second value.\n     */\n    @PropertyDefinition\n    private final String second;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code PairManualTopLevelBuilder}.\n     * @return the meta-bean, not null\n     */\n    public static PairManualTopLevelBuilder.Meta meta() {\n        return PairManualTopLevelBuilder.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(PairManualTopLevelBuilder.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static PairBuilder builder() {\n        return new PairBuilder();\n    }\n\n    /**\n     * Creates an instance.\n     * @param first  the value of the property\n     * @param second  the value of the property\n     */\n    PairManualTopLevelBuilder(\n            String first,\n            String second) {\n        this.first = first;\n        this.second = second;\n    }\n\n    @Override\n    public PairManualTopLevelBuilder.Meta metaBean() {\n        return PairManualTopLevelBuilder.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the first value.\n     * @return the value of the property\n     */\n    public String getFirst() {\n        return first;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the second value.\n     * @return the value of the property\n     */\n    public String getSecond() {\n        return second;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public PairBuilder toBuilder() {\n        return new PairBuilder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            PairManualTopLevelBuilder other = (PairManualTopLevelBuilder) obj;\n            return JodaBeanUtils.equal(this.first, other.first) &&\n                    JodaBeanUtils.equal(this.second, other.second);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(first);\n        hash = hash * 31 + JodaBeanUtils.hashCode(second);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"PairManualTopLevelBuilder{\");\n        buf.append(\"first\").append('=').append(JodaBeanUtils.toString(first)).append(',').append(' ');\n        buf.append(\"second\").append('=').append(JodaBeanUtils.toString(second));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code PairManualTopLevelBuilder}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code first} property.\n         */\n        private final MetaProperty<String> first = DirectMetaProperty.ofImmutable(\n                this, \"first\", PairManualTopLevelBuilder.class, String.class);\n        /**\n         * The meta-property for the {@code second} property.\n         */\n        private final MetaProperty<String> second = DirectMetaProperty.ofImmutable(\n                this, \"second\", PairManualTopLevelBuilder.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"first\",\n                \"second\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    return this.first;\n                case -906279820:  // second\n                    return this.second;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public PairBuilder builder() {\n            return new PairBuilder();\n        }\n\n        @Override\n        public Class<? extends PairManualTopLevelBuilder> beanType() {\n            return PairManualTopLevelBuilder.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code first} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> first() {\n            return first;\n        }\n\n        /**\n         * The meta-property for the {@code second} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> second() {\n            return second;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    return ((PairManualTopLevelBuilder) bean).getFirst();\n                case -906279820:  // second\n                    return ((PairManualTopLevelBuilder) bean).getSecond();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/Person.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\nimport org.joda.beans.impl.flexi.FlexiBean;\n\n/**\n * Mock person JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\n@ClassAnnotation(Address.class)\npublic final class Person extends DirectBean implements IPerson,\n        Serializable {\n    // note that Serializable is on a new line\n\n    /** The forename. */\n    @PropertyDefinition(overrideGet = true)\n    private String forename;\n    /** The surname. */\n    @PropertyDefinition(overrideGet = true, overrideSet = true)\n    private String surname;\n    /** The number of cars. */\n    @PropertyDefinition\n    private transient int numberOfCars;\n    @PropertyDefinition\n    private final List<Address> addressList = new ArrayList<>();\n    @PropertyDefinition\n    private final Map<String, Address> otherAddressMap = new HashMap<>();\n    @PropertyDefinition\n    private final List<List<Address>> addressesList = new ArrayList<>();\n    @PropertyDefinition\n    private Address mainAddress;\n    @PropertyDefinition\n    @SimpleAnnotation\n    private final FlexiBean extensions = new FlexiBean();\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code Person}.\n     * @return the meta-bean, not null\n     */\n    public static Person.Meta meta() {\n        return Person.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(Person.Meta.INSTANCE);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    @Override\n    public Person.Meta metaBean() {\n        return Person.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the forename.\n     * @return the value of the property\n     */\n    @Override\n    public String getForename() {\n        return forename;\n    }\n\n    /**\n     * Sets the forename.\n     * @param forename  the new value of the property\n     */\n    public void setForename(String forename) {\n        this.forename = forename;\n    }\n\n    /**\n     * Gets the the {@code forename} property.\n     * @return the property, not null\n     */\n    public Property<String> forename() {\n        return metaBean().forename().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the surname.\n     * @return the value of the property\n     */\n    @Override\n    public String getSurname() {\n        return surname;\n    }\n\n    /**\n     * Sets the surname.\n     * @param surname  the new value of the property\n     */\n    @Override\n    public void setSurname(String surname) {\n        this.surname = surname;\n    }\n\n    /**\n     * Gets the the {@code surname} property.\n     * @return the property, not null\n     */\n    public Property<String> surname() {\n        return metaBean().surname().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number of cars.\n     * @return the value of the property\n     */\n    public int getNumberOfCars() {\n        return numberOfCars;\n    }\n\n    /**\n     * Sets the number of cars.\n     * @param numberOfCars  the new value of the property\n     */\n    public void setNumberOfCars(int numberOfCars) {\n        this.numberOfCars = numberOfCars;\n    }\n\n    /**\n     * Gets the the {@code numberOfCars} property.\n     * @return the property, not null\n     */\n    public Property<Integer> numberOfCars() {\n        return metaBean().numberOfCars().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the addressList.\n     * @return the value of the property, not null\n     */\n    public List<Address> getAddressList() {\n        return addressList;\n    }\n\n    /**\n     * Sets the addressList.\n     * @param addressList  the new value of the property, not null\n     */\n    public void setAddressList(List<Address> addressList) {\n        JodaBeanUtils.notNull(addressList, \"addressList\");\n        this.addressList.clear();\n        this.addressList.addAll(addressList);\n    }\n\n    /**\n     * Gets the the {@code addressList} property.\n     * @return the property, not null\n     */\n    public Property<List<Address>> addressList() {\n        return metaBean().addressList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the otherAddressMap.\n     * @return the value of the property, not null\n     */\n    public Map<String, Address> getOtherAddressMap() {\n        return otherAddressMap;\n    }\n\n    /**\n     * Sets the otherAddressMap.\n     * @param otherAddressMap  the new value of the property, not null\n     */\n    public void setOtherAddressMap(Map<String, Address> otherAddressMap) {\n        JodaBeanUtils.notNull(otherAddressMap, \"otherAddressMap\");\n        this.otherAddressMap.clear();\n        this.otherAddressMap.putAll(otherAddressMap);\n    }\n\n    /**\n     * Gets the the {@code otherAddressMap} property.\n     * @return the property, not null\n     */\n    public Property<Map<String, Address>> otherAddressMap() {\n        return metaBean().otherAddressMap().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the addressesList.\n     * @return the value of the property, not null\n     */\n    public List<List<Address>> getAddressesList() {\n        return addressesList;\n    }\n\n    /**\n     * Sets the addressesList.\n     * @param addressesList  the new value of the property, not null\n     */\n    public void setAddressesList(List<List<Address>> addressesList) {\n        JodaBeanUtils.notNull(addressesList, \"addressesList\");\n        this.addressesList.clear();\n        this.addressesList.addAll(addressesList);\n    }\n\n    /**\n     * Gets the the {@code addressesList} property.\n     * @return the property, not null\n     */\n    public Property<List<List<Address>>> addressesList() {\n        return metaBean().addressesList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the mainAddress.\n     * @return the value of the property\n     */\n    public Address getMainAddress() {\n        return mainAddress;\n    }\n\n    /**\n     * Sets the mainAddress.\n     * @param mainAddress  the new value of the property\n     */\n    public void setMainAddress(Address mainAddress) {\n        this.mainAddress = mainAddress;\n    }\n\n    /**\n     * Gets the the {@code mainAddress} property.\n     * @return the property, not null\n     */\n    public Property<Address> mainAddress() {\n        return metaBean().mainAddress().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the extensions.\n     * @return the value of the property, not null\n     */\n    public FlexiBean getExtensions() {\n        return extensions;\n    }\n\n    /**\n     * Sets the extensions.\n     * @param extensions  the new value of the property, not null\n     */\n    public void setExtensions(FlexiBean extensions) {\n        JodaBeanUtils.notNull(extensions, \"extensions\");\n        this.extensions.clear();\n        this.extensions.putAll(extensions);\n    }\n\n    /**\n     * Gets the the {@code extensions} property.\n     * @return the property, not null\n     */\n    public Property<FlexiBean> extensions() {\n        return metaBean().extensions().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public Person clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            Person other = (Person) obj;\n            return JodaBeanUtils.equal(this.getForename(), other.getForename()) &&\n                    JodaBeanUtils.equal(this.getSurname(), other.getSurname()) &&\n                    (this.getNumberOfCars() == other.getNumberOfCars()) &&\n                    JodaBeanUtils.equal(this.getAddressList(), other.getAddressList()) &&\n                    JodaBeanUtils.equal(this.getOtherAddressMap(), other.getOtherAddressMap()) &&\n                    JodaBeanUtils.equal(this.getAddressesList(), other.getAddressesList()) &&\n                    JodaBeanUtils.equal(this.getMainAddress(), other.getMainAddress()) &&\n                    JodaBeanUtils.equal(this.getExtensions(), other.getExtensions());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getForename());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getSurname());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNumberOfCars());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getAddressList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getOtherAddressMap());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getAddressesList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getMainAddress());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getExtensions());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(288);\n        buf.append(\"Person{\");\n        buf.append(\"forename\").append('=').append(JodaBeanUtils.toString(getForename())).append(',').append(' ');\n        buf.append(\"surname\").append('=').append(JodaBeanUtils.toString(getSurname())).append(',').append(' ');\n        buf.append(\"numberOfCars\").append('=').append(JodaBeanUtils.toString(getNumberOfCars())).append(',').append(' ');\n        buf.append(\"addressList\").append('=').append(JodaBeanUtils.toString(getAddressList())).append(',').append(' ');\n        buf.append(\"otherAddressMap\").append('=').append(JodaBeanUtils.toString(getOtherAddressMap())).append(',').append(' ');\n        buf.append(\"addressesList\").append('=').append(JodaBeanUtils.toString(getAddressesList())).append(',').append(' ');\n        buf.append(\"mainAddress\").append('=').append(JodaBeanUtils.toString(getMainAddress())).append(',').append(' ');\n        buf.append(\"extensions\").append('=').append(JodaBeanUtils.toString(getExtensions()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code Person}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code forename} property.\n         */\n        private final MetaProperty<String> forename = DirectMetaProperty.ofReadWrite(\n                this, \"forename\", Person.class, String.class);\n        /**\n         * The meta-property for the {@code surname} property.\n         */\n        private final MetaProperty<String> surname = DirectMetaProperty.ofReadWrite(\n                this, \"surname\", Person.class, String.class);\n        /**\n         * The meta-property for the {@code numberOfCars} property.\n         */\n        private final MetaProperty<Integer> numberOfCars = DirectMetaProperty.ofReadWrite(\n                this, \"numberOfCars\", Person.class, Integer.TYPE);\n        /**\n         * The meta-property for the {@code addressList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<Address>> addressList = DirectMetaProperty.ofReadWrite(\n                this, \"addressList\", Person.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code otherAddressMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Map<String, Address>> otherAddressMap = DirectMetaProperty.ofReadWrite(\n                this, \"otherAddressMap\", Person.class, (Class) Map.class);\n        /**\n         * The meta-property for the {@code addressesList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<List<Address>>> addressesList = DirectMetaProperty.ofReadWrite(\n                this, \"addressesList\", Person.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code mainAddress} property.\n         */\n        private final MetaProperty<Address> mainAddress = DirectMetaProperty.ofReadWrite(\n                this, \"mainAddress\", Person.class, Address.class);\n        /**\n         * The meta-property for the {@code extensions} property.\n         */\n        private final MetaProperty<FlexiBean> extensions = DirectMetaProperty.ofReadWrite(\n                this, \"extensions\", Person.class, FlexiBean.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"forename\",\n                \"surname\",\n                \"numberOfCars\",\n                \"addressList\",\n                \"otherAddressMap\",\n                \"addressesList\",\n                \"mainAddress\",\n                \"extensions\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return this.forename;\n                case -1852993317:  // surname\n                    return this.surname;\n                case 926656063:  // numberOfCars\n                    return this.numberOfCars;\n                case -1377524046:  // addressList\n                    return this.addressList;\n                case 1368089592:  // otherAddressMap\n                    return this.otherAddressMap;\n                case -226885792:  // addressesList\n                    return this.addressesList;\n                case -2032731141:  // mainAddress\n                    return this.mainAddress;\n                case -1809421292:  // extensions\n                    return this.extensions;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends Person> builder() {\n            return new DirectBeanBuilder<>(new Person());\n        }\n\n        @Override\n        public Class<? extends Person> beanType() {\n            return Person.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code forename} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> forename() {\n            return forename;\n        }\n\n        /**\n         * The meta-property for the {@code surname} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> surname() {\n            return surname;\n        }\n\n        /**\n         * The meta-property for the {@code numberOfCars} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Integer> numberOfCars() {\n            return numberOfCars;\n        }\n\n        /**\n         * The meta-property for the {@code addressList} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<List<Address>> addressList() {\n            return addressList;\n        }\n\n        /**\n         * The meta-property for the {@code otherAddressMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Map<String, Address>> otherAddressMap() {\n            return otherAddressMap;\n        }\n\n        /**\n         * The meta-property for the {@code addressesList} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<List<List<Address>>> addressesList() {\n            return addressesList;\n        }\n\n        /**\n         * The meta-property for the {@code mainAddress} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Address> mainAddress() {\n            return mainAddress;\n        }\n\n        /**\n         * The meta-property for the {@code extensions} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<FlexiBean> extensions() {\n            return extensions;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return ((Person) bean).getForename();\n                case -1852993317:  // surname\n                    return ((Person) bean).getSurname();\n                case 926656063:  // numberOfCars\n                    return ((Person) bean).getNumberOfCars();\n                case -1377524046:  // addressList\n                    return ((Person) bean).getAddressList();\n                case 1368089592:  // otherAddressMap\n                    return ((Person) bean).getOtherAddressMap();\n                case -226885792:  // addressesList\n                    return ((Person) bean).getAddressesList();\n                case -2032731141:  // mainAddress\n                    return ((Person) bean).getMainAddress();\n                case -1809421292:  // extensions\n                    return ((Person) bean).getExtensions();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    ((Person) bean).setForename((String) newValue);\n                    return;\n                case -1852993317:  // surname\n                    ((Person) bean).setSurname((String) newValue);\n                    return;\n                case 926656063:  // numberOfCars\n                    ((Person) bean).setNumberOfCars((Integer) newValue);\n                    return;\n                case -1377524046:  // addressList\n                    ((Person) bean).setAddressList((List<Address>) newValue);\n                    return;\n                case 1368089592:  // otherAddressMap\n                    ((Person) bean).setOtherAddressMap((Map<String, Address>) newValue);\n                    return;\n                case -226885792:  // addressesList\n                    ((Person) bean).setAddressesList((List<List<Address>>) newValue);\n                    return;\n                case -2032731141:  // mainAddress\n                    ((Person) bean).setMainAddress((Address) newValue);\n                    return;\n                case -1809421292:  // extensions\n                    ((Person) bean).setExtensions((FlexiBean) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n        @Override\n        protected void validate(Bean bean) {\n            JodaBeanUtils.notNull(((Person) bean).addressList, \"addressList\");\n            JodaBeanUtils.notNull(((Person) bean).otherAddressMap, \"otherAddressMap\");\n            JodaBeanUtils.notNull(((Person) bean).addressesList, \"addressesList\");\n            JodaBeanUtils.notNull(((Person) bean).extensions, \"extensions\");\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/PersonDocumentation.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class PersonDocumentation extends Documentation<Person> {\n\n    /** The name. */\n    @PropertyDefinition\n    private String name;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code PersonDocumentation}.\n     * @return the meta-bean, not null\n     */\n    public static PersonDocumentation.Meta meta() {\n        return PersonDocumentation.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(PersonDocumentation.Meta.INSTANCE);\n    }\n\n    @Override\n    public PersonDocumentation.Meta metaBean() {\n        return PersonDocumentation.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property\n     */\n    public String getName() {\n        return name;\n    }\n\n    /**\n     * Sets the name.\n     * @param name  the new value of the property\n     */\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    /**\n     * Gets the the {@code name} property.\n     * @return the property, not null\n     */\n    public final Property<String> name() {\n        return metaBean().name().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public PersonDocumentation clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            PersonDocumentation other = (PersonDocumentation) obj;\n            return JodaBeanUtils.equal(this.getName(), other.getName()) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        hash = hash * 31 + JodaBeanUtils.hashCode(getName());\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"PersonDocumentation{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"name\").append('=').append(JodaBeanUtils.toString(getName())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code PersonDocumentation}.\n     */\n    public static class Meta extends Documentation.Meta<Person> {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code name} property.\n         */\n        private final MetaProperty<String> name = DirectMetaProperty.ofReadWrite(\n                this, \"name\", PersonDocumentation.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"name\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends PersonDocumentation> builder() {\n            return new DirectBeanBuilder<>(new PersonDocumentation());\n        }\n\n        @Override\n        public Class<? extends PersonDocumentation> beanType() {\n            return PersonDocumentation.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code name} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> name() {\n            return name;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return ((PersonDocumentation) bean).getName();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    ((PersonDocumentation) bean).setName((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/PrimitiveBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class PrimitiveBean extends DirectBean {\n\n    @PropertyDefinition\n    private long valueLong;\n    @PropertyDefinition\n    private int valueInt;\n    @PropertyDefinition\n    private short valueShort;\n    @PropertyDefinition\n    private byte valueByte;\n    @PropertyDefinition\n    private double valueDouble;\n    @PropertyDefinition\n    private float valueFloat;\n    @PropertyDefinition\n    private char valueChar;\n    @PropertyDefinition\n    private boolean valueBoolean;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code PrimitiveBean}.\n     * @return the meta-bean, not null\n     */\n    public static PrimitiveBean.Meta meta() {\n        return PrimitiveBean.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(PrimitiveBean.Meta.INSTANCE);\n    }\n\n    @Override\n    public PrimitiveBean.Meta metaBean() {\n        return PrimitiveBean.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the valueLong.\n     * @return the value of the property\n     */\n    public long getValueLong() {\n        return valueLong;\n    }\n\n    /**\n     * Sets the valueLong.\n     * @param valueLong  the new value of the property\n     */\n    public void setValueLong(long valueLong) {\n        this.valueLong = valueLong;\n    }\n\n    /**\n     * Gets the the {@code valueLong} property.\n     * @return the property, not null\n     */\n    public final Property<Long> valueLong() {\n        return metaBean().valueLong().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the valueInt.\n     * @return the value of the property\n     */\n    public int getValueInt() {\n        return valueInt;\n    }\n\n    /**\n     * Sets the valueInt.\n     * @param valueInt  the new value of the property\n     */\n    public void setValueInt(int valueInt) {\n        this.valueInt = valueInt;\n    }\n\n    /**\n     * Gets the the {@code valueInt} property.\n     * @return the property, not null\n     */\n    public final Property<Integer> valueInt() {\n        return metaBean().valueInt().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the valueShort.\n     * @return the value of the property\n     */\n    public short getValueShort() {\n        return valueShort;\n    }\n\n    /**\n     * Sets the valueShort.\n     * @param valueShort  the new value of the property\n     */\n    public void setValueShort(short valueShort) {\n        this.valueShort = valueShort;\n    }\n\n    /**\n     * Gets the the {@code valueShort} property.\n     * @return the property, not null\n     */\n    public final Property<Short> valueShort() {\n        return metaBean().valueShort().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the valueByte.\n     * @return the value of the property\n     */\n    public byte getValueByte() {\n        return valueByte;\n    }\n\n    /**\n     * Sets the valueByte.\n     * @param valueByte  the new value of the property\n     */\n    public void setValueByte(byte valueByte) {\n        this.valueByte = valueByte;\n    }\n\n    /**\n     * Gets the the {@code valueByte} property.\n     * @return the property, not null\n     */\n    public final Property<Byte> valueByte() {\n        return metaBean().valueByte().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the valueDouble.\n     * @return the value of the property\n     */\n    public double getValueDouble() {\n        return valueDouble;\n    }\n\n    /**\n     * Sets the valueDouble.\n     * @param valueDouble  the new value of the property\n     */\n    public void setValueDouble(double valueDouble) {\n        this.valueDouble = valueDouble;\n    }\n\n    /**\n     * Gets the the {@code valueDouble} property.\n     * @return the property, not null\n     */\n    public final Property<Double> valueDouble() {\n        return metaBean().valueDouble().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the valueFloat.\n     * @return the value of the property\n     */\n    public float getValueFloat() {\n        return valueFloat;\n    }\n\n    /**\n     * Sets the valueFloat.\n     * @param valueFloat  the new value of the property\n     */\n    public void setValueFloat(float valueFloat) {\n        this.valueFloat = valueFloat;\n    }\n\n    /**\n     * Gets the the {@code valueFloat} property.\n     * @return the property, not null\n     */\n    public final Property<Float> valueFloat() {\n        return metaBean().valueFloat().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the valueChar.\n     * @return the value of the property\n     */\n    public char getValueChar() {\n        return valueChar;\n    }\n\n    /**\n     * Sets the valueChar.\n     * @param valueChar  the new value of the property\n     */\n    public void setValueChar(char valueChar) {\n        this.valueChar = valueChar;\n    }\n\n    /**\n     * Gets the the {@code valueChar} property.\n     * @return the property, not null\n     */\n    public final Property<Character> valueChar() {\n        return metaBean().valueChar().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the valueBoolean.\n     * @return the value of the property\n     */\n    public boolean isValueBoolean() {\n        return valueBoolean;\n    }\n\n    /**\n     * Sets the valueBoolean.\n     * @param valueBoolean  the new value of the property\n     */\n    public void setValueBoolean(boolean valueBoolean) {\n        this.valueBoolean = valueBoolean;\n    }\n\n    /**\n     * Gets the the {@code valueBoolean} property.\n     * @return the property, not null\n     */\n    public final Property<Boolean> valueBoolean() {\n        return metaBean().valueBoolean().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public PrimitiveBean clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            PrimitiveBean other = (PrimitiveBean) obj;\n            return (this.getValueLong() == other.getValueLong()) &&\n                    (this.getValueInt() == other.getValueInt()) &&\n                    (this.getValueShort() == other.getValueShort()) &&\n                    (this.getValueByte() == other.getValueByte()) &&\n                    JodaBeanUtils.equal(this.getValueDouble(), other.getValueDouble()) &&\n                    JodaBeanUtils.equal(this.getValueFloat(), other.getValueFloat()) &&\n                    (this.getValueChar() == other.getValueChar()) &&\n                    (this.isValueBoolean() == other.isValueBoolean());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getValueLong());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getValueInt());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getValueShort());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getValueByte());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getValueDouble());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getValueFloat());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getValueChar());\n        hash = hash * 31 + JodaBeanUtils.hashCode(isValueBoolean());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(288);\n        buf.append(\"PrimitiveBean{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"valueLong\").append('=').append(JodaBeanUtils.toString(getValueLong())).append(',').append(' ');\n        buf.append(\"valueInt\").append('=').append(JodaBeanUtils.toString(getValueInt())).append(',').append(' ');\n        buf.append(\"valueShort\").append('=').append(JodaBeanUtils.toString(getValueShort())).append(',').append(' ');\n        buf.append(\"valueByte\").append('=').append(JodaBeanUtils.toString(getValueByte())).append(',').append(' ');\n        buf.append(\"valueDouble\").append('=').append(JodaBeanUtils.toString(getValueDouble())).append(',').append(' ');\n        buf.append(\"valueFloat\").append('=').append(JodaBeanUtils.toString(getValueFloat())).append(',').append(' ');\n        buf.append(\"valueChar\").append('=').append(JodaBeanUtils.toString(getValueChar())).append(',').append(' ');\n        buf.append(\"valueBoolean\").append('=').append(JodaBeanUtils.toString(isValueBoolean())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code PrimitiveBean}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code valueLong} property.\n         */\n        private final MetaProperty<Long> valueLong = DirectMetaProperty.ofReadWrite(\n                this, \"valueLong\", PrimitiveBean.class, Long.TYPE);\n        /**\n         * The meta-property for the {@code valueInt} property.\n         */\n        private final MetaProperty<Integer> valueInt = DirectMetaProperty.ofReadWrite(\n                this, \"valueInt\", PrimitiveBean.class, Integer.TYPE);\n        /**\n         * The meta-property for the {@code valueShort} property.\n         */\n        private final MetaProperty<Short> valueShort = DirectMetaProperty.ofReadWrite(\n                this, \"valueShort\", PrimitiveBean.class, Short.TYPE);\n        /**\n         * The meta-property for the {@code valueByte} property.\n         */\n        private final MetaProperty<Byte> valueByte = DirectMetaProperty.ofReadWrite(\n                this, \"valueByte\", PrimitiveBean.class, Byte.TYPE);\n        /**\n         * The meta-property for the {@code valueDouble} property.\n         */\n        private final MetaProperty<Double> valueDouble = DirectMetaProperty.ofReadWrite(\n                this, \"valueDouble\", PrimitiveBean.class, Double.TYPE);\n        /**\n         * The meta-property for the {@code valueFloat} property.\n         */\n        private final MetaProperty<Float> valueFloat = DirectMetaProperty.ofReadWrite(\n                this, \"valueFloat\", PrimitiveBean.class, Float.TYPE);\n        /**\n         * The meta-property for the {@code valueChar} property.\n         */\n        private final MetaProperty<Character> valueChar = DirectMetaProperty.ofReadWrite(\n                this, \"valueChar\", PrimitiveBean.class, Character.TYPE);\n        /**\n         * The meta-property for the {@code valueBoolean} property.\n         */\n        private final MetaProperty<Boolean> valueBoolean = DirectMetaProperty.ofReadWrite(\n                this, \"valueBoolean\", PrimitiveBean.class, Boolean.TYPE);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"valueLong\",\n                \"valueInt\",\n                \"valueShort\",\n                \"valueByte\",\n                \"valueDouble\",\n                \"valueFloat\",\n                \"valueChar\",\n                \"valueBoolean\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -765940851:  // valueLong\n                    return this.valueLong;\n                case -1410184002:  // valueInt\n                    return this.valueInt;\n                case 2031894923:  // valueShort\n                    return this.valueShort;\n                case -766228967:  // valueByte\n                    return this.valueByte;\n                case -1858576222:  // valueDouble\n                    return this.valueDouble;\n                case 2020007787:  // valueFloat\n                    return this.valueFloat;\n                case -766216089:  // valueChar\n                    return this.valueChar;\n                case 733421943:  // valueBoolean\n                    return this.valueBoolean;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends PrimitiveBean> builder() {\n            return new DirectBeanBuilder<>(new PrimitiveBean());\n        }\n\n        @Override\n        public Class<? extends PrimitiveBean> beanType() {\n            return PrimitiveBean.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code valueLong} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Long> valueLong() {\n            return valueLong;\n        }\n\n        /**\n         * The meta-property for the {@code valueInt} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Integer> valueInt() {\n            return valueInt;\n        }\n\n        /**\n         * The meta-property for the {@code valueShort} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Short> valueShort() {\n            return valueShort;\n        }\n\n        /**\n         * The meta-property for the {@code valueByte} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Byte> valueByte() {\n            return valueByte;\n        }\n\n        /**\n         * The meta-property for the {@code valueDouble} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Double> valueDouble() {\n            return valueDouble;\n        }\n\n        /**\n         * The meta-property for the {@code valueFloat} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Float> valueFloat() {\n            return valueFloat;\n        }\n\n        /**\n         * The meta-property for the {@code valueChar} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Character> valueChar() {\n            return valueChar;\n        }\n\n        /**\n         * The meta-property for the {@code valueBoolean} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Boolean> valueBoolean() {\n            return valueBoolean;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -765940851:  // valueLong\n                    return ((PrimitiveBean) bean).getValueLong();\n                case -1410184002:  // valueInt\n                    return ((PrimitiveBean) bean).getValueInt();\n                case 2031894923:  // valueShort\n                    return ((PrimitiveBean) bean).getValueShort();\n                case -766228967:  // valueByte\n                    return ((PrimitiveBean) bean).getValueByte();\n                case -1858576222:  // valueDouble\n                    return ((PrimitiveBean) bean).getValueDouble();\n                case 2020007787:  // valueFloat\n                    return ((PrimitiveBean) bean).getValueFloat();\n                case -766216089:  // valueChar\n                    return ((PrimitiveBean) bean).getValueChar();\n                case 733421943:  // valueBoolean\n                    return ((PrimitiveBean) bean).isValueBoolean();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -765940851:  // valueLong\n                    ((PrimitiveBean) bean).setValueLong((Long) newValue);\n                    return;\n                case -1410184002:  // valueInt\n                    ((PrimitiveBean) bean).setValueInt((Integer) newValue);\n                    return;\n                case 2031894923:  // valueShort\n                    ((PrimitiveBean) bean).setValueShort((Short) newValue);\n                    return;\n                case -766228967:  // valueByte\n                    ((PrimitiveBean) bean).setValueByte((Byte) newValue);\n                    return;\n                case -1858576222:  // valueDouble\n                    ((PrimitiveBean) bean).setValueDouble((Double) newValue);\n                    return;\n                case 2020007787:  // valueFloat\n                    ((PrimitiveBean) bean).setValueFloat((Float) newValue);\n                    return;\n                case -766216089:  // valueChar\n                    ((PrimitiveBean) bean).setValueChar((Character) newValue);\n                    return;\n                case 733421943:  // valueBoolean\n                    ((PrimitiveBean) bean).setValueBoolean((Boolean) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/PropertyDefBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.collect.Lists;\n\n/**\n * Mock immutable person JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic final class PropertyDefBean implements Bean {\n\n    @PropertyDefinition(type = \"CharSequence\", set = \"$value.toString()\")\n    private String stringAsCharSequence;\n    @PropertyDefinition(type = \"Integer\")\n    private int intAsInteger;\n    @PropertyDefinition(type = \"Collection<>\", set = \"new ArrayList<>($value)\")\n    private List<Address> listCopyOfCollection = new ArrayList<>();\n    @PropertyDefinition\n    private final ArrayList<Address> arrayListSmart = new ArrayList<>();\n    @PropertyDefinition(type = \"\")\n    private final ArrayList<Address> arrayListExposed = new ArrayList<>();\n    @PropertyDefinition(type = \"Collection<>\")\n    private final ArrayList<Address> arrayListAsCollection = new ArrayList<>();\n    @PropertyDefinition\n    private final ArrayList<Address> arrayList = new ArrayList<>();\n    @PropertyDefinition(type = \"Iterable<>\", set = \"$field = Lists.newArrayList($value)\")\n    private List<Address> listAsIterable = new ArrayList<>();\n    @PropertyDefinition(type = \"Iterable\", set = \"Lists.newArrayList($value)\")\n    private List<Address> listAsIterableNoField = new ArrayList<>();\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code PropertyDefBean}.\n     * @return the meta-bean, not null\n     */\n    public static PropertyDefBean.Meta meta() {\n        return PropertyDefBean.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(PropertyDefBean.Meta.INSTANCE);\n    }\n\n    @Override\n    public PropertyDefBean.Meta metaBean() {\n        return PropertyDefBean.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the stringAsCharSequence.\n     * @return the value of the property\n     */\n    public CharSequence getStringAsCharSequence() {\n        return stringAsCharSequence;\n    }\n\n    /**\n     * Sets the stringAsCharSequence.\n     * @param stringAsCharSequence  the new value of the property\n     */\n    public void setStringAsCharSequence(CharSequence stringAsCharSequence) {\n        this.stringAsCharSequence = stringAsCharSequence.toString();\n    }\n\n    /**\n     * Gets the the {@code stringAsCharSequence} property.\n     * @return the property, not null\n     */\n    public Property<CharSequence> stringAsCharSequence() {\n        return metaBean().stringAsCharSequence().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the intAsInteger.\n     * @return the value of the property\n     */\n    public Integer getIntAsInteger() {\n        return intAsInteger;\n    }\n\n    /**\n     * Sets the intAsInteger.\n     * @param intAsInteger  the new value of the property\n     */\n    public void setIntAsInteger(Integer intAsInteger) {\n        this.intAsInteger = intAsInteger;\n    }\n\n    /**\n     * Gets the the {@code intAsInteger} property.\n     * @return the property, not null\n     */\n    public Property<Integer> intAsInteger() {\n        return metaBean().intAsInteger().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listCopyOfCollection.\n     * @return the value of the property\n     */\n    public Collection<Address> getListCopyOfCollection() {\n        return listCopyOfCollection;\n    }\n\n    /**\n     * Sets the listCopyOfCollection.\n     * @param listCopyOfCollection  the new value of the property\n     */\n    public void setListCopyOfCollection(Collection<Address> listCopyOfCollection) {\n        this.listCopyOfCollection = new ArrayList<>(listCopyOfCollection);\n    }\n\n    /**\n     * Gets the the {@code listCopyOfCollection} property.\n     * @return the property, not null\n     */\n    public Property<Collection<Address>> listCopyOfCollection() {\n        return metaBean().listCopyOfCollection().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the arrayListSmart.\n     * @return the value of the property, not null\n     */\n    public ArrayList<Address> getArrayListSmart() {\n        return arrayListSmart;\n    }\n\n    /**\n     * Sets the arrayListSmart.\n     * @param arrayListSmart  the new value of the property, not null\n     */\n    public void setArrayListSmart(ArrayList<Address> arrayListSmart) {\n        JodaBeanUtils.notNull(arrayListSmart, \"arrayListSmart\");\n        this.arrayListSmart.clear();\n        this.arrayListSmart.addAll(arrayListSmart);\n    }\n\n    /**\n     * Gets the the {@code arrayListSmart} property.\n     * @return the property, not null\n     */\n    public Property<ArrayList<Address>> arrayListSmart() {\n        return metaBean().arrayListSmart().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the arrayListExposed.\n     * @return the value of the property, not null\n     */\n    public ArrayList<Address> getArrayListExposed() {\n        return arrayListExposed;\n    }\n\n    /**\n     * Sets the arrayListExposed.\n     * @param arrayListExposed  the new value of the property, not null\n     */\n    public void setArrayListExposed(ArrayList<Address> arrayListExposed) {\n        JodaBeanUtils.notNull(arrayListExposed, \"arrayListExposed\");\n        this.arrayListExposed.clear();\n        this.arrayListExposed.addAll(arrayListExposed);\n    }\n\n    /**\n     * Gets the the {@code arrayListExposed} property.\n     * @return the property, not null\n     */\n    public Property<ArrayList<Address>> arrayListExposed() {\n        return metaBean().arrayListExposed().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the arrayListAsCollection.\n     * @return the value of the property, not null\n     */\n    public Collection<Address> getArrayListAsCollection() {\n        return arrayListAsCollection;\n    }\n\n    /**\n     * Sets the arrayListAsCollection.\n     * @param arrayListAsCollection  the new value of the property, not null\n     */\n    public void setArrayListAsCollection(Collection<Address> arrayListAsCollection) {\n        JodaBeanUtils.notNull(arrayListAsCollection, \"arrayListAsCollection\");\n        this.arrayListAsCollection.clear();\n        this.arrayListAsCollection.addAll(arrayListAsCollection);\n    }\n\n    /**\n     * Gets the the {@code arrayListAsCollection} property.\n     * @return the property, not null\n     */\n    public Property<Collection<Address>> arrayListAsCollection() {\n        return metaBean().arrayListAsCollection().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the arrayList.\n     * @return the value of the property, not null\n     */\n    public ArrayList<Address> getArrayList() {\n        return arrayList;\n    }\n\n    /**\n     * Sets the arrayList.\n     * @param arrayList  the new value of the property, not null\n     */\n    public void setArrayList(ArrayList<Address> arrayList) {\n        JodaBeanUtils.notNull(arrayList, \"arrayList\");\n        this.arrayList.clear();\n        this.arrayList.addAll(arrayList);\n    }\n\n    /**\n     * Gets the the {@code arrayList} property.\n     * @return the property, not null\n     */\n    public Property<ArrayList<Address>> arrayList() {\n        return metaBean().arrayList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listAsIterable.\n     * @return the value of the property\n     */\n    public Iterable<Address> getListAsIterable() {\n        return listAsIterable;\n    }\n\n    /**\n     * Sets the listAsIterable.\n     * @param listAsIterable  the new value of the property\n     */\n    public void setListAsIterable(Iterable<Address> listAsIterable) {\n        this.listAsIterable = Lists.newArrayList(listAsIterable);\n    }\n\n    /**\n     * Gets the the {@code listAsIterable} property.\n     * @return the property, not null\n     */\n    public Property<Iterable<Address>> listAsIterable() {\n        return metaBean().listAsIterable().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listAsIterableNoField.\n     * @return the value of the property\n     */\n    public Iterable<Address> getListAsIterableNoField() {\n        return listAsIterableNoField;\n    }\n\n    /**\n     * Sets the listAsIterableNoField.\n     * @param listAsIterableNoField  the new value of the property\n     */\n    public void setListAsIterableNoField(Iterable<Address> listAsIterableNoField) {\n        this.listAsIterableNoField = Lists.newArrayList(listAsIterableNoField);\n    }\n\n    /**\n     * Gets the the {@code listAsIterableNoField} property.\n     * @return the property, not null\n     */\n    public Property<Iterable<Address>> listAsIterableNoField() {\n        return metaBean().listAsIterableNoField().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public PropertyDefBean clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            PropertyDefBean other = (PropertyDefBean) obj;\n            return JodaBeanUtils.equal(this.getStringAsCharSequence(), other.getStringAsCharSequence()) &&\n                    JodaBeanUtils.equal(this.getIntAsInteger(), other.getIntAsInteger()) &&\n                    JodaBeanUtils.equal(this.getListCopyOfCollection(), other.getListCopyOfCollection()) &&\n                    JodaBeanUtils.equal(this.getArrayListSmart(), other.getArrayListSmart()) &&\n                    JodaBeanUtils.equal(this.getArrayListExposed(), other.getArrayListExposed()) &&\n                    JodaBeanUtils.equal(this.getArrayListAsCollection(), other.getArrayListAsCollection()) &&\n                    JodaBeanUtils.equal(this.getArrayList(), other.getArrayList()) &&\n                    JodaBeanUtils.equal(this.getListAsIterable(), other.getListAsIterable()) &&\n                    JodaBeanUtils.equal(this.getListAsIterableNoField(), other.getListAsIterableNoField());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getStringAsCharSequence());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getIntAsInteger());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getListCopyOfCollection());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getArrayListSmart());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getArrayListExposed());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getArrayListAsCollection());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getArrayList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getListAsIterable());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getListAsIterableNoField());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(320);\n        buf.append(\"PropertyDefBean{\");\n        buf.append(\"stringAsCharSequence\").append('=').append(JodaBeanUtils.toString(getStringAsCharSequence())).append(',').append(' ');\n        buf.append(\"intAsInteger\").append('=').append(JodaBeanUtils.toString(getIntAsInteger())).append(',').append(' ');\n        buf.append(\"listCopyOfCollection\").append('=').append(JodaBeanUtils.toString(getListCopyOfCollection())).append(',').append(' ');\n        buf.append(\"arrayListSmart\").append('=').append(JodaBeanUtils.toString(getArrayListSmart())).append(',').append(' ');\n        buf.append(\"arrayListExposed\").append('=').append(JodaBeanUtils.toString(getArrayListExposed())).append(',').append(' ');\n        buf.append(\"arrayListAsCollection\").append('=').append(JodaBeanUtils.toString(getArrayListAsCollection())).append(',').append(' ');\n        buf.append(\"arrayList\").append('=').append(JodaBeanUtils.toString(getArrayList())).append(',').append(' ');\n        buf.append(\"listAsIterable\").append('=').append(JodaBeanUtils.toString(getListAsIterable())).append(',').append(' ');\n        buf.append(\"listAsIterableNoField\").append('=').append(JodaBeanUtils.toString(getListAsIterableNoField()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code PropertyDefBean}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code stringAsCharSequence} property.\n         */\n        private final MetaProperty<CharSequence> stringAsCharSequence = DirectMetaProperty.ofReadWrite(\n                this, \"stringAsCharSequence\", PropertyDefBean.class, CharSequence.class);\n        /**\n         * The meta-property for the {@code intAsInteger} property.\n         */\n        private final MetaProperty<Integer> intAsInteger = DirectMetaProperty.ofReadWrite(\n                this, \"intAsInteger\", PropertyDefBean.class, Integer.class);\n        /**\n         * The meta-property for the {@code listCopyOfCollection} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Collection<Address>> listCopyOfCollection = DirectMetaProperty.ofReadWrite(\n                this, \"listCopyOfCollection\", PropertyDefBean.class, (Class) Collection.class);\n        /**\n         * The meta-property for the {@code arrayListSmart} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ArrayList<Address>> arrayListSmart = DirectMetaProperty.ofReadWrite(\n                this, \"arrayListSmart\", PropertyDefBean.class, (Class) ArrayList.class);\n        /**\n         * The meta-property for the {@code arrayListExposed} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ArrayList<Address>> arrayListExposed = DirectMetaProperty.ofReadWrite(\n                this, \"arrayListExposed\", PropertyDefBean.class, (Class) ArrayList.class);\n        /**\n         * The meta-property for the {@code arrayListAsCollection} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Collection<Address>> arrayListAsCollection = DirectMetaProperty.ofReadWrite(\n                this, \"arrayListAsCollection\", PropertyDefBean.class, (Class) Collection.class);\n        /**\n         * The meta-property for the {@code arrayList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ArrayList<Address>> arrayList = DirectMetaProperty.ofReadWrite(\n                this, \"arrayList\", PropertyDefBean.class, (Class) ArrayList.class);\n        /**\n         * The meta-property for the {@code listAsIterable} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Iterable<Address>> listAsIterable = DirectMetaProperty.ofReadWrite(\n                this, \"listAsIterable\", PropertyDefBean.class, (Class) Iterable.class);\n        /**\n         * The meta-property for the {@code listAsIterableNoField} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Iterable<Address>> listAsIterableNoField = DirectMetaProperty.ofReadWrite(\n                this, \"listAsIterableNoField\", PropertyDefBean.class, (Class) Iterable.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"stringAsCharSequence\",\n                \"intAsInteger\",\n                \"listCopyOfCollection\",\n                \"arrayListSmart\",\n                \"arrayListExposed\",\n                \"arrayListAsCollection\",\n                \"arrayList\",\n                \"listAsIterable\",\n                \"listAsIterableNoField\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -626353926:  // stringAsCharSequence\n                    return this.stringAsCharSequence;\n                case -86092419:  // intAsInteger\n                    return this.intAsInteger;\n                case 1005120680:  // listCopyOfCollection\n                    return this.listCopyOfCollection;\n                case 1202448754:  // arrayListSmart\n                    return this.arrayListSmart;\n                case 995586697:  // arrayListExposed\n                    return this.arrayListExposed;\n                case 1604480167:  // arrayListAsCollection\n                    return this.arrayListAsCollection;\n                case -1425161577:  // arrayList\n                    return this.arrayList;\n                case -176766462:  // listAsIterable\n                    return this.listAsIterable;\n                case 1831404375:  // listAsIterableNoField\n                    return this.listAsIterableNoField;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends PropertyDefBean> builder() {\n            return new DirectBeanBuilder<>(new PropertyDefBean());\n        }\n\n        @Override\n        public Class<? extends PropertyDefBean> beanType() {\n            return PropertyDefBean.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code stringAsCharSequence} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<CharSequence> stringAsCharSequence() {\n            return stringAsCharSequence;\n        }\n\n        /**\n         * The meta-property for the {@code intAsInteger} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Integer> intAsInteger() {\n            return intAsInteger;\n        }\n\n        /**\n         * The meta-property for the {@code listCopyOfCollection} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Collection<Address>> listCopyOfCollection() {\n            return listCopyOfCollection;\n        }\n\n        /**\n         * The meta-property for the {@code arrayListSmart} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ArrayList<Address>> arrayListSmart() {\n            return arrayListSmart;\n        }\n\n        /**\n         * The meta-property for the {@code arrayListExposed} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ArrayList<Address>> arrayListExposed() {\n            return arrayListExposed;\n        }\n\n        /**\n         * The meta-property for the {@code arrayListAsCollection} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Collection<Address>> arrayListAsCollection() {\n            return arrayListAsCollection;\n        }\n\n        /**\n         * The meta-property for the {@code arrayList} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ArrayList<Address>> arrayList() {\n            return arrayList;\n        }\n\n        /**\n         * The meta-property for the {@code listAsIterable} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Iterable<Address>> listAsIterable() {\n            return listAsIterable;\n        }\n\n        /**\n         * The meta-property for the {@code listAsIterableNoField} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Iterable<Address>> listAsIterableNoField() {\n            return listAsIterableNoField;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -626353926:  // stringAsCharSequence\n                    return ((PropertyDefBean) bean).getStringAsCharSequence();\n                case -86092419:  // intAsInteger\n                    return ((PropertyDefBean) bean).getIntAsInteger();\n                case 1005120680:  // listCopyOfCollection\n                    return ((PropertyDefBean) bean).getListCopyOfCollection();\n                case 1202448754:  // arrayListSmart\n                    return ((PropertyDefBean) bean).getArrayListSmart();\n                case 995586697:  // arrayListExposed\n                    return ((PropertyDefBean) bean).getArrayListExposed();\n                case 1604480167:  // arrayListAsCollection\n                    return ((PropertyDefBean) bean).getArrayListAsCollection();\n                case -1425161577:  // arrayList\n                    return ((PropertyDefBean) bean).getArrayList();\n                case -176766462:  // listAsIterable\n                    return ((PropertyDefBean) bean).getListAsIterable();\n                case 1831404375:  // listAsIterableNoField\n                    return ((PropertyDefBean) bean).getListAsIterableNoField();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -626353926:  // stringAsCharSequence\n                    ((PropertyDefBean) bean).setStringAsCharSequence((CharSequence) newValue);\n                    return;\n                case -86092419:  // intAsInteger\n                    ((PropertyDefBean) bean).setIntAsInteger((Integer) newValue);\n                    return;\n                case 1005120680:  // listCopyOfCollection\n                    ((PropertyDefBean) bean).setListCopyOfCollection((Collection<Address>) newValue);\n                    return;\n                case 1202448754:  // arrayListSmart\n                    ((PropertyDefBean) bean).setArrayListSmart((ArrayList<Address>) newValue);\n                    return;\n                case 995586697:  // arrayListExposed\n                    ((PropertyDefBean) bean).setArrayListExposed((ArrayList<Address>) newValue);\n                    return;\n                case 1604480167:  // arrayListAsCollection\n                    ((PropertyDefBean) bean).setArrayListAsCollection((Collection<Address>) newValue);\n                    return;\n                case -1425161577:  // arrayList\n                    ((PropertyDefBean) bean).setArrayList((ArrayList<Address>) newValue);\n                    return;\n                case -176766462:  // listAsIterable\n                    ((PropertyDefBean) bean).setListAsIterable((Iterable<Address>) newValue);\n                    return;\n                case 1831404375:  // listAsIterableNoField\n                    ((PropertyDefBean) bean).setListAsIterableNoField((Iterable<Address>) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n        @Override\n        protected void validate(Bean bean) {\n            JodaBeanUtils.notNull(((PropertyDefBean) bean).arrayListSmart, \"arrayListSmart\");\n            JodaBeanUtils.notNull(((PropertyDefBean) bean).arrayListExposed, \"arrayListExposed\");\n            JodaBeanUtils.notNull(((PropertyDefBean) bean).arrayListAsCollection, \"arrayListAsCollection\");\n            JodaBeanUtils.notNull(((PropertyDefBean) bean).arrayList, \"arrayList\");\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/RWOnlyBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.DerivedProperty;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock used for test equals.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class RWOnlyBean extends DirectBean {\n\n    /**\n     * The read only property.\n     */\n    @PropertyDefinition(set = \"\")\n    private Object ro = null;  // trailing comment\n    /**\n     * The write only property.\n     */\n    @PropertyDefinition(get = \"\")\n    private Object wo;  // trailing comment\n    /**\n     * The final read only property.\n     */\n    @PropertyDefinition\n    private final Object fin;\n    /**\n     * The private get/set property.\n     */\n    @PropertyDefinition(get = \"private\", set = \"private\")\n    private String priv;\n    /**\n     * The package-scoped get/set property.\n     */\n    @PropertyDefinition(get = \"package\", set = \"package\")\n    private String pkg;\n    /**\n     * The protected get/set property.\n     */\n    @PropertyDefinition(get = \"protected\", set = \"protected\")\n    private String prot;\n    /**\n     * The field-based get/set property.\n     */\n    @PropertyDefinition(get = \"field\", set = \"field\")\n    private String field;\n\n    public RWOnlyBean() {\n        fin = \"\";\n    }\n\n    /**\n     * A manual get property, no set.\n     */\n    @PropertyDefinition(get = \"manual\", set = \"\")\n    private String manualGet;\n\n    public String getManualGet() {\n        return \"goo\";\n    }\n\n    /**\n     * Gets the value of a derived property.\n     * \n     * @return derived\n     */\n    @DerivedProperty\n    public String getDerived() {\n        return \"drv\";\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code RWOnlyBean}.\n     * @return the meta-bean, not null\n     */\n    public static RWOnlyBean.Meta meta() {\n        return RWOnlyBean.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(RWOnlyBean.Meta.INSTANCE);\n    }\n\n    @Override\n    public RWOnlyBean.Meta metaBean() {\n        return RWOnlyBean.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the read only property.\n     * @return the value of the property\n     */\n    public Object getRo() {\n        return ro;\n    }\n\n    /**\n     * Gets the the {@code ro} property.\n     * @return the property, not null\n     */\n    public final Property<Object> ro() {\n        return metaBean().ro().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets the write only property.\n     * @param wo  the new value of the property\n     */\n    public void setWo(Object wo) {\n        this.wo = wo;\n    }\n\n    /**\n     * Gets the the {@code wo} property.\n     * @return the property, not null\n     */\n    public final Property<Object> wo() {\n        return metaBean().wo().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the final read only property.\n     * @return the value of the property\n     */\n    public Object getFin() {\n        return fin;\n    }\n\n    /**\n     * Gets the the {@code fin} property.\n     * @return the property, not null\n     */\n    public final Property<Object> fin() {\n        return metaBean().fin().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the private get/set property.\n     * @return the value of the property\n     */\n    private String getPriv() {\n        return priv;\n    }\n\n    /**\n     * Sets the private get/set property.\n     * @param priv  the new value of the property\n     */\n    private void setPriv(String priv) {\n        this.priv = priv;\n    }\n\n    /**\n     * Gets the the {@code priv} property.\n     * @return the property, not null\n     */\n    public final Property<String> priv() {\n        return metaBean().priv().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the package-scoped get/set property.\n     * @return the value of the property\n     */\n    String getPkg() {\n        return pkg;\n    }\n\n    /**\n     * Sets the package-scoped get/set property.\n     * @param pkg  the new value of the property\n     */\n    void setPkg(String pkg) {\n        this.pkg = pkg;\n    }\n\n    /**\n     * Gets the the {@code pkg} property.\n     * @return the property, not null\n     */\n    public final Property<String> pkg() {\n        return metaBean().pkg().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the protected get/set property.\n     * @return the value of the property\n     */\n    protected String getProt() {\n        return prot;\n    }\n\n    /**\n     * Sets the protected get/set property.\n     * @param prot  the new value of the property\n     */\n    protected void setProt(String prot) {\n        this.prot = prot;\n    }\n\n    /**\n     * Gets the the {@code prot} property.\n     * @return the property, not null\n     */\n    public final Property<String> prot() {\n        return metaBean().prot().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the the {@code field} property.\n     * @return the property, not null\n     */\n    public final Property<String> field() {\n        return metaBean().field().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the the {@code manualGet} property.\n     * @return the property, not null\n     */\n    public final Property<String> manualGet() {\n        return metaBean().manualGet().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the the {@code derived} property.\n     * \n     * @return the property, not null\n     */\n    public final Property<String> derived() {\n        return metaBean().derived().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public RWOnlyBean clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            RWOnlyBean other = (RWOnlyBean) obj;\n            return JodaBeanUtils.equal(this.getRo(), other.getRo()) &&\n                    JodaBeanUtils.equal(this.wo, other.wo) &&\n                    JodaBeanUtils.equal(this.getFin(), other.getFin()) &&\n                    JodaBeanUtils.equal(this.getPriv(), other.getPriv()) &&\n                    JodaBeanUtils.equal(this.getPkg(), other.getPkg()) &&\n                    JodaBeanUtils.equal(this.getProt(), other.getProt()) &&\n                    JodaBeanUtils.equal(this.field, other.field) &&\n                    JodaBeanUtils.equal(this.getManualGet(), other.getManualGet());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getRo());\n        hash = hash * 31 + JodaBeanUtils.hashCode(wo);\n        hash = hash * 31 + JodaBeanUtils.hashCode(getFin());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getPriv());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getPkg());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getProt());\n        hash = hash * 31 + JodaBeanUtils.hashCode(field);\n        hash = hash * 31 + JodaBeanUtils.hashCode(getManualGet());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(320);\n        buf.append(\"RWOnlyBean{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"ro\").append('=').append(JodaBeanUtils.toString(getRo())).append(',').append(' ');\n        buf.append(\"wo\").append('=').append(JodaBeanUtils.toString(wo)).append(',').append(' ');\n        buf.append(\"fin\").append('=').append(JodaBeanUtils.toString(getFin())).append(',').append(' ');\n        buf.append(\"priv\").append('=').append(JodaBeanUtils.toString(getPriv())).append(',').append(' ');\n        buf.append(\"pkg\").append('=').append(JodaBeanUtils.toString(getPkg())).append(',').append(' ');\n        buf.append(\"prot\").append('=').append(JodaBeanUtils.toString(getProt())).append(',').append(' ');\n        buf.append(\"field\").append('=').append(JodaBeanUtils.toString(field)).append(',').append(' ');\n        buf.append(\"manualGet\").append('=').append(JodaBeanUtils.toString(getManualGet())).append(',').append(' ');\n        buf.append(\"derived\").append('=').append(JodaBeanUtils.toString(getDerived())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code RWOnlyBean}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code ro} property.\n         */\n        private final MetaProperty<Object> ro = DirectMetaProperty.ofReadOnly(\n                this, \"ro\", RWOnlyBean.class, Object.class);\n        /**\n         * The meta-property for the {@code wo} property.\n         */\n        private final MetaProperty<Object> wo = DirectMetaProperty.ofWriteOnly(\n                this, \"wo\", RWOnlyBean.class, Object.class);\n        /**\n         * The meta-property for the {@code fin} property.\n         */\n        private final MetaProperty<Object> fin = DirectMetaProperty.ofReadOnly(\n                this, \"fin\", RWOnlyBean.class, Object.class);\n        /**\n         * The meta-property for the {@code priv} property.\n         */\n        private final MetaProperty<String> priv = DirectMetaProperty.ofReadWrite(\n                this, \"priv\", RWOnlyBean.class, String.class);\n        /**\n         * The meta-property for the {@code pkg} property.\n         */\n        private final MetaProperty<String> pkg = DirectMetaProperty.ofReadWrite(\n                this, \"pkg\", RWOnlyBean.class, String.class);\n        /**\n         * The meta-property for the {@code prot} property.\n         */\n        private final MetaProperty<String> prot = DirectMetaProperty.ofReadWrite(\n                this, \"prot\", RWOnlyBean.class, String.class);\n        /**\n         * The meta-property for the {@code field} property.\n         */\n        private final MetaProperty<String> field = DirectMetaProperty.ofReadWrite(\n                this, \"field\", RWOnlyBean.class, String.class);\n        /**\n         * The meta-property for the {@code manualGet} property.\n         */\n        private final MetaProperty<String> manualGet = DirectMetaProperty.ofReadOnly(\n                this, \"manualGet\", RWOnlyBean.class, String.class);\n        /**\n         * The meta-property for the {@code derived} property.\n         */\n        private final MetaProperty<String> derived = DirectMetaProperty.ofDerived(\n                this, \"derived\", RWOnlyBean.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"ro\",\n                \"wo\",\n                \"fin\",\n                \"priv\",\n                \"pkg\",\n                \"prot\",\n                \"field\",\n                \"manualGet\",\n                \"derived\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3645:  // ro\n                    return this.ro;\n                case 3800:  // wo\n                    return this.wo;\n                case 101387:  // fin\n                    return this.fin;\n                case 3449519:  // priv\n                    return this.priv;\n                case 111052:  // pkg\n                    return this.pkg;\n                case 3449703:  // prot\n                    return this.prot;\n                case 97427706:  // field\n                    return this.field;\n                case 93508016:  // manualGet\n                    return this.manualGet;\n                case 1556125213:  // derived\n                    return this.derived;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends RWOnlyBean> builder() {\n            return new DirectBeanBuilder<>(new RWOnlyBean());\n        }\n\n        @Override\n        public Class<? extends RWOnlyBean> beanType() {\n            return RWOnlyBean.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code ro} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Object> ro() {\n            return ro;\n        }\n\n        /**\n         * The meta-property for the {@code wo} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Object> wo() {\n            return wo;\n        }\n\n        /**\n         * The meta-property for the {@code fin} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Object> fin() {\n            return fin;\n        }\n\n        /**\n         * The meta-property for the {@code priv} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> priv() {\n            return priv;\n        }\n\n        /**\n         * The meta-property for the {@code pkg} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> pkg() {\n            return pkg;\n        }\n\n        /**\n         * The meta-property for the {@code prot} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> prot() {\n            return prot;\n        }\n\n        /**\n         * The meta-property for the {@code field} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> field() {\n            return field;\n        }\n\n        /**\n         * The meta-property for the {@code manualGet} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> manualGet() {\n            return manualGet;\n        }\n\n        /**\n         * The meta-property for the {@code derived} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> derived() {\n            return derived;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3645:  // ro\n                    return ((RWOnlyBean) bean).getRo();\n                case 3800:  // wo\n                    if (quiet) {\n                        return null;\n                    }\n                    throw new UnsupportedOperationException(\"Property cannot be read: wo\");\n                case 101387:  // fin\n                    return ((RWOnlyBean) bean).getFin();\n                case 3449519:  // priv\n                    return ((RWOnlyBean) bean).getPriv();\n                case 111052:  // pkg\n                    return ((RWOnlyBean) bean).getPkg();\n                case 3449703:  // prot\n                    return ((RWOnlyBean) bean).getProt();\n                case 97427706:  // field\n                    return ((RWOnlyBean) bean).field;\n                case 93508016:  // manualGet\n                    return ((RWOnlyBean) bean).getManualGet();\n                case 1556125213:  // derived\n                    return ((RWOnlyBean) bean).getDerived();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3645:  // ro\n                    if (quiet) {\n                        return;\n                    }\n                    throw new UnsupportedOperationException(\"Property cannot be written: ro\");\n                case 3800:  // wo\n                    ((RWOnlyBean) bean).setWo((Object) newValue);\n                    return;\n                case 101387:  // fin\n                    if (quiet) {\n                        return;\n                    }\n                    throw new UnsupportedOperationException(\"Property cannot be written: fin\");\n                case 3449519:  // priv\n                    ((RWOnlyBean) bean).setPriv((String) newValue);\n                    return;\n                case 111052:  // pkg\n                    ((RWOnlyBean) bean).setPkg((String) newValue);\n                    return;\n                case 3449703:  // prot\n                    ((RWOnlyBean) bean).setProt((String) newValue);\n                    return;\n                case 97427706:  // field\n                    ((RWOnlyBean) bean).field = (String) newValue;\n                    return;\n                case 93508016:  // manualGet\n                    if (quiet) {\n                        return;\n                    }\n                    throw new UnsupportedOperationException(\"Property cannot be written: manualGet\");\n                case 1556125213:  // derived\n                    if (quiet) {\n                        return;\n                    }\n                    throw new UnsupportedOperationException(\"Property cannot be written: derived\");\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/RecordStrIntPair.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport org.joda.beans.impl.RecordBean;\n\n/**\n * Mock, used for testing.\n * \n * @param first the first\n * @param second the second\n */\npublic record RecordStrIntPair(String first, int second) implements RecordBean<RecordStrIntPair> {\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ReflectiveMutable.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.TypedMetaBean;\nimport org.joda.beans.impl.reflection.ReflectiveMetaBean;\n\n/**\n * Mock reflective bean, used for testing.\n * \n * @author Stephen Colebourne\n */\npublic final class ReflectiveMutable implements Bean {\n\n    /**\n     * The number.\n     */\n    private int number;\n    /**\n     * The number.\n     */\n    private boolean flag;\n    /**\n     * The street.\n     */\n    private String street;\n    /**\n     * The city.\n     */\n    private String city;\n\n    /**\n     * The meta-bean.\n     */\n    public static final TypedMetaBean<ReflectiveMutable> META_BEAN =\n            ReflectiveMetaBean.of(ReflectiveMutable.class, \"number\", \"flag\", \"street\", \"city\");\n\n    @Override\n    public TypedMetaBean<ReflectiveMutable> metaBean() {\n        return META_BEAN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public int getNumber() {\n        return number;\n    }\n\n    /**\n     * Sets the number.\n     * @param number  the new value of the property\n     */\n    public void setNumber(int number) {\n        this.number = number;\n    }\n\n    /**\n     * Gets the number.\n     * @return the value of the property\n     */\n    public boolean isFlag() {\n        return flag;\n    }\n\n    /**\n     * Sets the number.\n     * @param flag  the new value of the property\n     */\n    public void setFlag(boolean flag) {\n        this.flag = flag;\n    }\n\n    /**\n     * Gets the street.\n     * @return the value of the property\n     */\n    public String getStreet() {\n        return street;\n    }\n\n    /**\n     * Sets the street.\n     * @param street  the new value of the property, not null\n     */\n    public void setStreet(String street) {\n        JodaBeanUtils.notNull(street, \"street\");\n        this.street = street;\n    }\n\n    /**\n     * Gets the city.\n     * @return the value of the property\n     */\n    public String getCity() {\n        return city;\n    }\n\n    /**\n     * Sets the city.\n     * @param city  the new value of the property, not null\n     */\n    public void setCity(String city) {\n        JodaBeanUtils.notNull(city, \"city\");\n        this.city = city;\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/Risk.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport org.joda.convert.FromStringFactory;\nimport org.joda.convert.ToString;\n\n/**\n * Mock extensible enum interface.\n * \n * @author Stephen Colebourne\n */\n@FromStringFactory(factory = RiskFactory.class)\npublic interface Risk {\n\n    int level();\n\n    @Override\n    @ToString\n    String toString();\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/RiskFactory.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport org.joda.convert.FromString;\n\n/**\n * Mock Joda-Convert factory.\n * \n * @author Stephen Colebourne\n */\npublic class RiskFactory {\n\n    @FromString\n    public static Risk risk(String str) {\n        return RiskLevel.valueOf(str);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/RiskLevel.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\n/**\n * Mock enum with subclasses.\n * \n * @author Stephen Colebourne\n */\npublic enum RiskLevel implements Risk {\n\n    LOW {\n        @Override\n        public int level() {\n            return 0;\n        }\n    },\n    MEDIUM {\n        @Override\n        public int level() {\n            return 0;\n        }\n    },\n    HIGH {\n        @Override\n        public int level() {\n            return 0;\n        }\n    };\n\n    @Override\n    public abstract int level();\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/RiskPerception.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\n/**\n * Mock enum.\n * \n * @author Stephen Colebourne\n */\npublic enum RiskPerception {\n\n    LOW,\n    MEDIUM ,\n    HIGH;\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/SimpleAnnotation.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Used to test annotation parsing.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.FIELD, ElementType.METHOD})\npublic @interface SimpleAnnotation {\n\n    String first() default \"\";\n\n    String second() default \"\";\n\n    String third() default \"\";\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/SimpleJson.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.io.Serializable;\nimport java.util.Arrays;\nimport java.util.EnumSet;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\nimport java.util.Set;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.collect.ImmutableList;\nimport com.google.common.collect.ImmutableMap;\n\n/**\n * Mock address JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(constructorScope = \"private\")\npublic final class SimpleJson implements ImmutableBean, Serializable {\n\n    @PropertyDefinition\n    private final char primitiveChar;\n    @PropertyDefinition\n    private final byte primitiveByte;\n    @PropertyDefinition\n    private final short primitiveShort;\n    @PropertyDefinition\n    private final int primitiveInt;\n    @PropertyDefinition\n    private final long primitiveLong;\n    @PropertyDefinition\n    private final float primitiveFloat;\n    @PropertyDefinition\n    private final double primitiveDouble;\n    @PropertyDefinition\n    private final double primitiveDoubleNaN;\n    @PropertyDefinition\n    private final double primitiveDoubleInf;\n    @PropertyDefinition\n    private final Number abstractNumber;\n    @PropertyDefinition\n    private final byte[] arrayByte;\n    @PropertyDefinition\n    private final String[][] array2d;\n    @PropertyDefinition\n    private final String string;\n    @PropertyDefinition\n    private final ImmKey bean;\n    @PropertyDefinition\n    private final Object object1;\n    @PropertyDefinition\n    private final Object object2;\n    @PropertyDefinition\n    private final Risk risk;\n    @PropertyDefinition\n    private final RiskLevel riskLevel;\n    @PropertyDefinition\n    private final EnumSet<RiskLevel> riskLevels;\n    @PropertyDefinition\n    private final ImmutableList<String> stringList;\n    @PropertyDefinition\n    private final ImmutableList<ImmKey> beanList;\n    @PropertyDefinition\n    private final ImmutableMap<String, String> stringMap;\n    @PropertyDefinition\n    private final ImmutableMap<Integer, String> intKeyMap;\n    @PropertyDefinition\n    private final ImmutableMap<String, ImmKey> beanMap;\n    @PropertyDefinition\n    private final ImmutableMap<String, List<String>> listInMap;\n    @PropertyDefinition\n    private final ImmutableMap<String, List<Integer>> listNumericInMap;\n    @PropertyDefinition\n    private final ImmutableMap<String, Object> objectInMap;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code SimpleJson}.\n     * @return the meta-bean, not null\n     */\n    public static SimpleJson.Meta meta() {\n        return SimpleJson.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(SimpleJson.Meta.INSTANCE);\n    }\n\n    /**\n     * The serialization version id.\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static SimpleJson.Builder builder() {\n        return new SimpleJson.Builder();\n    }\n\n    private SimpleJson(\n            char primitiveChar,\n            byte primitiveByte,\n            short primitiveShort,\n            int primitiveInt,\n            long primitiveLong,\n            float primitiveFloat,\n            double primitiveDouble,\n            double primitiveDoubleNaN,\n            double primitiveDoubleInf,\n            Number abstractNumber,\n            byte[] arrayByte,\n            String[][] array2d,\n            String string,\n            ImmKey bean,\n            Object object1,\n            Object object2,\n            Risk risk,\n            RiskLevel riskLevel,\n            Set<RiskLevel> riskLevels,\n            List<String> stringList,\n            List<ImmKey> beanList,\n            Map<String, String> stringMap,\n            Map<Integer, String> intKeyMap,\n            Map<String, ImmKey> beanMap,\n            Map<String, List<String>> listInMap,\n            Map<String, List<Integer>> listNumericInMap,\n            Map<String, Object> objectInMap) {\n        this.primitiveChar = primitiveChar;\n        this.primitiveByte = primitiveByte;\n        this.primitiveShort = primitiveShort;\n        this.primitiveInt = primitiveInt;\n        this.primitiveLong = primitiveLong;\n        this.primitiveFloat = primitiveFloat;\n        this.primitiveDouble = primitiveDouble;\n        this.primitiveDoubleNaN = primitiveDoubleNaN;\n        this.primitiveDoubleInf = primitiveDoubleInf;\n        this.abstractNumber = abstractNumber;\n        this.arrayByte = (arrayByte != null ? arrayByte.clone() : null);\n        this.array2d = (String[][]) JodaBeanUtils.cloneArray(array2d);\n        this.string = string;\n        this.bean = bean;\n        this.object1 = object1;\n        this.object2 = object2;\n        this.risk = risk;\n        this.riskLevel = riskLevel;\n        this.riskLevels = (riskLevels != null ? EnumSet.copyOf(riskLevels) : null);\n        this.stringList = (stringList != null ? ImmutableList.copyOf(stringList) : null);\n        this.beanList = (beanList != null ? ImmutableList.copyOf(beanList) : null);\n        this.stringMap = (stringMap != null ? ImmutableMap.copyOf(stringMap) : null);\n        this.intKeyMap = (intKeyMap != null ? ImmutableMap.copyOf(intKeyMap) : null);\n        this.beanMap = (beanMap != null ? ImmutableMap.copyOf(beanMap) : null);\n        this.listInMap = (listInMap != null ? ImmutableMap.copyOf(listInMap) : null);\n        this.listNumericInMap = (listNumericInMap != null ? ImmutableMap.copyOf(listNumericInMap) : null);\n        this.objectInMap = (objectInMap != null ? ImmutableMap.copyOf(objectInMap) : null);\n    }\n\n    @Override\n    public SimpleJson.Meta metaBean() {\n        return SimpleJson.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the primitiveChar.\n     * @return the value of the property\n     */\n    public char getPrimitiveChar() {\n        return primitiveChar;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the primitiveByte.\n     * @return the value of the property\n     */\n    public byte getPrimitiveByte() {\n        return primitiveByte;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the primitiveShort.\n     * @return the value of the property\n     */\n    public short getPrimitiveShort() {\n        return primitiveShort;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the primitiveInt.\n     * @return the value of the property\n     */\n    public int getPrimitiveInt() {\n        return primitiveInt;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the primitiveLong.\n     * @return the value of the property\n     */\n    public long getPrimitiveLong() {\n        return primitiveLong;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the primitiveFloat.\n     * @return the value of the property\n     */\n    public float getPrimitiveFloat() {\n        return primitiveFloat;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the primitiveDouble.\n     * @return the value of the property\n     */\n    public double getPrimitiveDouble() {\n        return primitiveDouble;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the primitiveDoubleNaN.\n     * @return the value of the property\n     */\n    public double getPrimitiveDoubleNaN() {\n        return primitiveDoubleNaN;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the primitiveDoubleInf.\n     * @return the value of the property\n     */\n    public double getPrimitiveDoubleInf() {\n        return primitiveDoubleInf;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the abstractNumber.\n     * @return the value of the property\n     */\n    public Number getAbstractNumber() {\n        return abstractNumber;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the arrayByte.\n     * @return the value of the property\n     */\n    public byte[] getArrayByte() {\n        return (arrayByte != null ? arrayByte.clone() : null);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the array2d.\n     * @return the value of the property\n     */\n    public String[][] getArray2d() {\n        return (String[][]) JodaBeanUtils.cloneArray(array2d);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the string.\n     * @return the value of the property\n     */\n    public String getString() {\n        return string;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the bean.\n     * @return the value of the property\n     */\n    public ImmKey getBean() {\n        return bean;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the object1.\n     * @return the value of the property\n     */\n    public Object getObject1() {\n        return object1;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the object2.\n     * @return the value of the property\n     */\n    public Object getObject2() {\n        return object2;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the risk.\n     * @return the value of the property\n     */\n    public Risk getRisk() {\n        return risk;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the riskLevel.\n     * @return the value of the property\n     */\n    public RiskLevel getRiskLevel() {\n        return riskLevel;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the riskLevels.\n     * @return the value of the property\n     */\n    public EnumSet<RiskLevel> getRiskLevels() {\n        return riskLevels;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the stringList.\n     * @return the value of the property\n     */\n    public ImmutableList<String> getStringList() {\n        return stringList;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the beanList.\n     * @return the value of the property\n     */\n    public ImmutableList<ImmKey> getBeanList() {\n        return beanList;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the stringMap.\n     * @return the value of the property\n     */\n    public ImmutableMap<String, String> getStringMap() {\n        return stringMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the intKeyMap.\n     * @return the value of the property\n     */\n    public ImmutableMap<Integer, String> getIntKeyMap() {\n        return intKeyMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the beanMap.\n     * @return the value of the property\n     */\n    public ImmutableMap<String, ImmKey> getBeanMap() {\n        return beanMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listInMap.\n     * @return the value of the property\n     */\n    public ImmutableMap<String, List<String>> getListInMap() {\n        return listInMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the listNumericInMap.\n     * @return the value of the property\n     */\n    public ImmutableMap<String, List<Integer>> getListNumericInMap() {\n        return listNumericInMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the objectInMap.\n     * @return the value of the property\n     */\n    public ImmutableMap<String, Object> getObjectInMap() {\n        return objectInMap;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            SimpleJson other = (SimpleJson) obj;\n            return (this.primitiveChar == other.primitiveChar) &&\n                    (this.primitiveByte == other.primitiveByte) &&\n                    (this.primitiveShort == other.primitiveShort) &&\n                    (this.primitiveInt == other.primitiveInt) &&\n                    (this.primitiveLong == other.primitiveLong) &&\n                    JodaBeanUtils.equal(this.primitiveFloat, other.primitiveFloat) &&\n                    JodaBeanUtils.equal(this.primitiveDouble, other.primitiveDouble) &&\n                    JodaBeanUtils.equal(this.primitiveDoubleNaN, other.primitiveDoubleNaN) &&\n                    JodaBeanUtils.equal(this.primitiveDoubleInf, other.primitiveDoubleInf) &&\n                    JodaBeanUtils.equal(this.abstractNumber, other.abstractNumber) &&\n                    JodaBeanUtils.equal(this.arrayByte, other.arrayByte) &&\n                    JodaBeanUtils.equal(this.array2d, other.array2d) &&\n                    JodaBeanUtils.equal(this.string, other.string) &&\n                    JodaBeanUtils.equal(this.bean, other.bean) &&\n                    JodaBeanUtils.equal(this.object1, other.object1) &&\n                    JodaBeanUtils.equal(this.object2, other.object2) &&\n                    JodaBeanUtils.equal(this.risk, other.risk) &&\n                    JodaBeanUtils.equal(this.riskLevel, other.riskLevel) &&\n                    JodaBeanUtils.equal(this.riskLevels, other.riskLevels) &&\n                    JodaBeanUtils.equal(this.stringList, other.stringList) &&\n                    JodaBeanUtils.equal(this.beanList, other.beanList) &&\n                    JodaBeanUtils.equal(this.stringMap, other.stringMap) &&\n                    JodaBeanUtils.equal(this.intKeyMap, other.intKeyMap) &&\n                    JodaBeanUtils.equal(this.beanMap, other.beanMap) &&\n                    JodaBeanUtils.equal(this.listInMap, other.listInMap) &&\n                    JodaBeanUtils.equal(this.listNumericInMap, other.listNumericInMap) &&\n                    JodaBeanUtils.equal(this.objectInMap, other.objectInMap);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(primitiveChar);\n        hash = hash * 31 + JodaBeanUtils.hashCode(primitiveByte);\n        hash = hash * 31 + JodaBeanUtils.hashCode(primitiveShort);\n        hash = hash * 31 + JodaBeanUtils.hashCode(primitiveInt);\n        hash = hash * 31 + JodaBeanUtils.hashCode(primitiveLong);\n        hash = hash * 31 + JodaBeanUtils.hashCode(primitiveFloat);\n        hash = hash * 31 + JodaBeanUtils.hashCode(primitiveDouble);\n        hash = hash * 31 + JodaBeanUtils.hashCode(primitiveDoubleNaN);\n        hash = hash * 31 + JodaBeanUtils.hashCode(primitiveDoubleInf);\n        hash = hash * 31 + JodaBeanUtils.hashCode(abstractNumber);\n        hash = hash * 31 + JodaBeanUtils.hashCode(arrayByte);\n        hash = hash * 31 + JodaBeanUtils.hashCode(array2d);\n        hash = hash * 31 + JodaBeanUtils.hashCode(string);\n        hash = hash * 31 + JodaBeanUtils.hashCode(bean);\n        hash = hash * 31 + JodaBeanUtils.hashCode(object1);\n        hash = hash * 31 + JodaBeanUtils.hashCode(object2);\n        hash = hash * 31 + JodaBeanUtils.hashCode(risk);\n        hash = hash * 31 + JodaBeanUtils.hashCode(riskLevel);\n        hash = hash * 31 + JodaBeanUtils.hashCode(riskLevels);\n        hash = hash * 31 + JodaBeanUtils.hashCode(stringList);\n        hash = hash * 31 + JodaBeanUtils.hashCode(beanList);\n        hash = hash * 31 + JodaBeanUtils.hashCode(stringMap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(intKeyMap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(beanMap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listInMap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(listNumericInMap);\n        hash = hash * 31 + JodaBeanUtils.hashCode(objectInMap);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(896);\n        buf.append(\"SimpleJson{\");\n        buf.append(\"primitiveChar\").append('=').append(JodaBeanUtils.toString(primitiveChar)).append(',').append(' ');\n        buf.append(\"primitiveByte\").append('=').append(JodaBeanUtils.toString(primitiveByte)).append(',').append(' ');\n        buf.append(\"primitiveShort\").append('=').append(JodaBeanUtils.toString(primitiveShort)).append(',').append(' ');\n        buf.append(\"primitiveInt\").append('=').append(JodaBeanUtils.toString(primitiveInt)).append(',').append(' ');\n        buf.append(\"primitiveLong\").append('=').append(JodaBeanUtils.toString(primitiveLong)).append(',').append(' ');\n        buf.append(\"primitiveFloat\").append('=').append(JodaBeanUtils.toString(primitiveFloat)).append(',').append(' ');\n        buf.append(\"primitiveDouble\").append('=').append(JodaBeanUtils.toString(primitiveDouble)).append(',').append(' ');\n        buf.append(\"primitiveDoubleNaN\").append('=').append(JodaBeanUtils.toString(primitiveDoubleNaN)).append(',').append(' ');\n        buf.append(\"primitiveDoubleInf\").append('=').append(JodaBeanUtils.toString(primitiveDoubleInf)).append(',').append(' ');\n        buf.append(\"abstractNumber\").append('=').append(JodaBeanUtils.toString(abstractNumber)).append(',').append(' ');\n        buf.append(\"arrayByte\").append('=').append(JodaBeanUtils.toString(arrayByte)).append(',').append(' ');\n        buf.append(\"array2d\").append('=').append(JodaBeanUtils.toString(array2d)).append(',').append(' ');\n        buf.append(\"string\").append('=').append(JodaBeanUtils.toString(string)).append(',').append(' ');\n        buf.append(\"bean\").append('=').append(JodaBeanUtils.toString(bean)).append(',').append(' ');\n        buf.append(\"object1\").append('=').append(JodaBeanUtils.toString(object1)).append(',').append(' ');\n        buf.append(\"object2\").append('=').append(JodaBeanUtils.toString(object2)).append(',').append(' ');\n        buf.append(\"risk\").append('=').append(JodaBeanUtils.toString(risk)).append(',').append(' ');\n        buf.append(\"riskLevel\").append('=').append(JodaBeanUtils.toString(riskLevel)).append(',').append(' ');\n        buf.append(\"riskLevels\").append('=').append(JodaBeanUtils.toString(riskLevels)).append(',').append(' ');\n        buf.append(\"stringList\").append('=').append(JodaBeanUtils.toString(stringList)).append(',').append(' ');\n        buf.append(\"beanList\").append('=').append(JodaBeanUtils.toString(beanList)).append(',').append(' ');\n        buf.append(\"stringMap\").append('=').append(JodaBeanUtils.toString(stringMap)).append(',').append(' ');\n        buf.append(\"intKeyMap\").append('=').append(JodaBeanUtils.toString(intKeyMap)).append(',').append(' ');\n        buf.append(\"beanMap\").append('=').append(JodaBeanUtils.toString(beanMap)).append(',').append(' ');\n        buf.append(\"listInMap\").append('=').append(JodaBeanUtils.toString(listInMap)).append(',').append(' ');\n        buf.append(\"listNumericInMap\").append('=').append(JodaBeanUtils.toString(listNumericInMap)).append(',').append(' ');\n        buf.append(\"objectInMap\").append('=').append(JodaBeanUtils.toString(objectInMap));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code SimpleJson}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code primitiveChar} property.\n         */\n        private final MetaProperty<Character> primitiveChar = DirectMetaProperty.ofImmutable(\n                this, \"primitiveChar\", SimpleJson.class, Character.TYPE);\n        /**\n         * The meta-property for the {@code primitiveByte} property.\n         */\n        private final MetaProperty<Byte> primitiveByte = DirectMetaProperty.ofImmutable(\n                this, \"primitiveByte\", SimpleJson.class, Byte.TYPE);\n        /**\n         * The meta-property for the {@code primitiveShort} property.\n         */\n        private final MetaProperty<Short> primitiveShort = DirectMetaProperty.ofImmutable(\n                this, \"primitiveShort\", SimpleJson.class, Short.TYPE);\n        /**\n         * The meta-property for the {@code primitiveInt} property.\n         */\n        private final MetaProperty<Integer> primitiveInt = DirectMetaProperty.ofImmutable(\n                this, \"primitiveInt\", SimpleJson.class, Integer.TYPE);\n        /**\n         * The meta-property for the {@code primitiveLong} property.\n         */\n        private final MetaProperty<Long> primitiveLong = DirectMetaProperty.ofImmutable(\n                this, \"primitiveLong\", SimpleJson.class, Long.TYPE);\n        /**\n         * The meta-property for the {@code primitiveFloat} property.\n         */\n        private final MetaProperty<Float> primitiveFloat = DirectMetaProperty.ofImmutable(\n                this, \"primitiveFloat\", SimpleJson.class, Float.TYPE);\n        /**\n         * The meta-property for the {@code primitiveDouble} property.\n         */\n        private final MetaProperty<Double> primitiveDouble = DirectMetaProperty.ofImmutable(\n                this, \"primitiveDouble\", SimpleJson.class, Double.TYPE);\n        /**\n         * The meta-property for the {@code primitiveDoubleNaN} property.\n         */\n        private final MetaProperty<Double> primitiveDoubleNaN = DirectMetaProperty.ofImmutable(\n                this, \"primitiveDoubleNaN\", SimpleJson.class, Double.TYPE);\n        /**\n         * The meta-property for the {@code primitiveDoubleInf} property.\n         */\n        private final MetaProperty<Double> primitiveDoubleInf = DirectMetaProperty.ofImmutable(\n                this, \"primitiveDoubleInf\", SimpleJson.class, Double.TYPE);\n        /**\n         * The meta-property for the {@code abstractNumber} property.\n         */\n        private final MetaProperty<Number> abstractNumber = DirectMetaProperty.ofImmutable(\n                this, \"abstractNumber\", SimpleJson.class, Number.class);\n        /**\n         * The meta-property for the {@code arrayByte} property.\n         */\n        private final MetaProperty<byte[]> arrayByte = DirectMetaProperty.ofImmutable(\n                this, \"arrayByte\", SimpleJson.class, byte[].class);\n        /**\n         * The meta-property for the {@code array2d} property.\n         */\n        private final MetaProperty<String[][]> array2d = DirectMetaProperty.ofImmutable(\n                this, \"array2d\", SimpleJson.class, String[][].class);\n        /**\n         * The meta-property for the {@code string} property.\n         */\n        private final MetaProperty<String> string = DirectMetaProperty.ofImmutable(\n                this, \"string\", SimpleJson.class, String.class);\n        /**\n         * The meta-property for the {@code bean} property.\n         */\n        private final MetaProperty<ImmKey> bean = DirectMetaProperty.ofImmutable(\n                this, \"bean\", SimpleJson.class, ImmKey.class);\n        /**\n         * The meta-property for the {@code object1} property.\n         */\n        private final MetaProperty<Object> object1 = DirectMetaProperty.ofImmutable(\n                this, \"object1\", SimpleJson.class, Object.class);\n        /**\n         * The meta-property for the {@code object2} property.\n         */\n        private final MetaProperty<Object> object2 = DirectMetaProperty.ofImmutable(\n                this, \"object2\", SimpleJson.class, Object.class);\n        /**\n         * The meta-property for the {@code risk} property.\n         */\n        private final MetaProperty<Risk> risk = DirectMetaProperty.ofImmutable(\n                this, \"risk\", SimpleJson.class, Risk.class);\n        /**\n         * The meta-property for the {@code riskLevel} property.\n         */\n        private final MetaProperty<RiskLevel> riskLevel = DirectMetaProperty.ofImmutable(\n                this, \"riskLevel\", SimpleJson.class, RiskLevel.class);\n        /**\n         * The meta-property for the {@code riskLevels} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<EnumSet<RiskLevel>> riskLevels = DirectMetaProperty.ofImmutable(\n                this, \"riskLevels\", SimpleJson.class, (Class) EnumSet.class);\n        /**\n         * The meta-property for the {@code stringList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableList<String>> stringList = DirectMetaProperty.ofImmutable(\n                this, \"stringList\", SimpleJson.class, (Class) ImmutableList.class);\n        /**\n         * The meta-property for the {@code beanList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableList<ImmKey>> beanList = DirectMetaProperty.ofImmutable(\n                this, \"beanList\", SimpleJson.class, (Class) ImmutableList.class);\n        /**\n         * The meta-property for the {@code stringMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<String, String>> stringMap = DirectMetaProperty.ofImmutable(\n                this, \"stringMap\", SimpleJson.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-property for the {@code intKeyMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<Integer, String>> intKeyMap = DirectMetaProperty.ofImmutable(\n                this, \"intKeyMap\", SimpleJson.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-property for the {@code beanMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<String, ImmKey>> beanMap = DirectMetaProperty.ofImmutable(\n                this, \"beanMap\", SimpleJson.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-property for the {@code listInMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<String, List<String>>> listInMap = DirectMetaProperty.ofImmutable(\n                this, \"listInMap\", SimpleJson.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-property for the {@code listNumericInMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<String, List<Integer>>> listNumericInMap = DirectMetaProperty.ofImmutable(\n                this, \"listNumericInMap\", SimpleJson.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-property for the {@code objectInMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<ImmutableMap<String, Object>> objectInMap = DirectMetaProperty.ofImmutable(\n                this, \"objectInMap\", SimpleJson.class, (Class) ImmutableMap.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"primitiveChar\",\n                \"primitiveByte\",\n                \"primitiveShort\",\n                \"primitiveInt\",\n                \"primitiveLong\",\n                \"primitiveFloat\",\n                \"primitiveDouble\",\n                \"primitiveDoubleNaN\",\n                \"primitiveDoubleInf\",\n                \"abstractNumber\",\n                \"arrayByte\",\n                \"array2d\",\n                \"string\",\n                \"bean\",\n                \"object1\",\n                \"object2\",\n                \"risk\",\n                \"riskLevel\",\n                \"riskLevels\",\n                \"stringList\",\n                \"beanList\",\n                \"stringMap\",\n                \"intKeyMap\",\n                \"beanMap\",\n                \"listInMap\",\n                \"listNumericInMap\",\n                \"objectInMap\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 1058293981:  // primitiveChar\n                    return this.primitiveChar;\n                case 1058281103:  // primitiveByte\n                    return this.primitiveByte;\n                case -1537835051:  // primitiveShort\n                    return this.primitiveShort;\n                case 1281070472:  // primitiveInt\n                    return this.primitiveInt;\n                case 1058569219:  // primitiveLong\n                    return this.primitiveLong;\n                case -1549722187:  // primitiveFloat\n                    return this.primitiveFloat;\n                case -851055720:  // primitiveDouble\n                    return this.primitiveDouble;\n                case -608928189:  // primitiveDoubleNaN\n                    return this.primitiveDoubleNaN;\n                case -608932567:  // primitiveDoubleInf\n                    return this.primitiveDoubleInf;\n                case 1986500107:  // abstractNumber\n                    return this.abstractNumber;\n                case -1425444095:  // arrayByte\n                    return this.arrayByte;\n                case -734443893:  // array2d\n                    return this.array2d;\n                case -891985903:  // string\n                    return this.string;\n                case 3019696:  // bean\n                    return this.bean;\n                case -1659648814:  // object1\n                    return this.object1;\n                case -1659648813:  // object2\n                    return this.object2;\n                case 3500751:  // risk\n                    return this.risk;\n                case 540453365:  // riskLevel\n                    return this.riskLevel;\n                case -425814754:  // riskLevels\n                    return this.riskLevels;\n                case -1573317553:  // stringList\n                    return this.stringList;\n                case 1321263214:  // beanList\n                    return this.beanList;\n                case -189298805:  // stringMap\n                    return this.stringMap;\n                case -253193396:  // intKeyMap\n                    return this.intKeyMap;\n                case -234472564:  // beanMap\n                    return this.beanMap;\n                case -1244601351:  // listInMap\n                    return this.listInMap;\n                case 391098024:  // listNumericInMap\n                    return this.listNumericInMap;\n                case -1297715720:  // objectInMap\n                    return this.objectInMap;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public SimpleJson.Builder builder() {\n            return new SimpleJson.Builder();\n        }\n\n        @Override\n        public Class<? extends SimpleJson> beanType() {\n            return SimpleJson.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code primitiveChar} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Character> primitiveChar() {\n            return primitiveChar;\n        }\n\n        /**\n         * The meta-property for the {@code primitiveByte} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Byte> primitiveByte() {\n            return primitiveByte;\n        }\n\n        /**\n         * The meta-property for the {@code primitiveShort} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Short> primitiveShort() {\n            return primitiveShort;\n        }\n\n        /**\n         * The meta-property for the {@code primitiveInt} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Integer> primitiveInt() {\n            return primitiveInt;\n        }\n\n        /**\n         * The meta-property for the {@code primitiveLong} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Long> primitiveLong() {\n            return primitiveLong;\n        }\n\n        /**\n         * The meta-property for the {@code primitiveFloat} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Float> primitiveFloat() {\n            return primitiveFloat;\n        }\n\n        /**\n         * The meta-property for the {@code primitiveDouble} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Double> primitiveDouble() {\n            return primitiveDouble;\n        }\n\n        /**\n         * The meta-property for the {@code primitiveDoubleNaN} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Double> primitiveDoubleNaN() {\n            return primitiveDoubleNaN;\n        }\n\n        /**\n         * The meta-property for the {@code primitiveDoubleInf} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Double> primitiveDoubleInf() {\n            return primitiveDoubleInf;\n        }\n\n        /**\n         * The meta-property for the {@code abstractNumber} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Number> abstractNumber() {\n            return abstractNumber;\n        }\n\n        /**\n         * The meta-property for the {@code arrayByte} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<byte[]> arrayByte() {\n            return arrayByte;\n        }\n\n        /**\n         * The meta-property for the {@code array2d} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String[][]> array2d() {\n            return array2d;\n        }\n\n        /**\n         * The meta-property for the {@code string} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> string() {\n            return string;\n        }\n\n        /**\n         * The meta-property for the {@code bean} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmKey> bean() {\n            return bean;\n        }\n\n        /**\n         * The meta-property for the {@code object1} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Object> object1() {\n            return object1;\n        }\n\n        /**\n         * The meta-property for the {@code object2} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Object> object2() {\n            return object2;\n        }\n\n        /**\n         * The meta-property for the {@code risk} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Risk> risk() {\n            return risk;\n        }\n\n        /**\n         * The meta-property for the {@code riskLevel} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<RiskLevel> riskLevel() {\n            return riskLevel;\n        }\n\n        /**\n         * The meta-property for the {@code riskLevels} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<EnumSet<RiskLevel>> riskLevels() {\n            return riskLevels;\n        }\n\n        /**\n         * The meta-property for the {@code stringList} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableList<String>> stringList() {\n            return stringList;\n        }\n\n        /**\n         * The meta-property for the {@code beanList} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableList<ImmKey>> beanList() {\n            return beanList;\n        }\n\n        /**\n         * The meta-property for the {@code stringMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<String, String>> stringMap() {\n            return stringMap;\n        }\n\n        /**\n         * The meta-property for the {@code intKeyMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<Integer, String>> intKeyMap() {\n            return intKeyMap;\n        }\n\n        /**\n         * The meta-property for the {@code beanMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<String, ImmKey>> beanMap() {\n            return beanMap;\n        }\n\n        /**\n         * The meta-property for the {@code listInMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<String, List<String>>> listInMap() {\n            return listInMap;\n        }\n\n        /**\n         * The meta-property for the {@code listNumericInMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<String, List<Integer>>> listNumericInMap() {\n            return listNumericInMap;\n        }\n\n        /**\n         * The meta-property for the {@code objectInMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<ImmutableMap<String, Object>> objectInMap() {\n            return objectInMap;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 1058293981:  // primitiveChar\n                    return ((SimpleJson) bean).getPrimitiveChar();\n                case 1058281103:  // primitiveByte\n                    return ((SimpleJson) bean).getPrimitiveByte();\n                case -1537835051:  // primitiveShort\n                    return ((SimpleJson) bean).getPrimitiveShort();\n                case 1281070472:  // primitiveInt\n                    return ((SimpleJson) bean).getPrimitiveInt();\n                case 1058569219:  // primitiveLong\n                    return ((SimpleJson) bean).getPrimitiveLong();\n                case -1549722187:  // primitiveFloat\n                    return ((SimpleJson) bean).getPrimitiveFloat();\n                case -851055720:  // primitiveDouble\n                    return ((SimpleJson) bean).getPrimitiveDouble();\n                case -608928189:  // primitiveDoubleNaN\n                    return ((SimpleJson) bean).getPrimitiveDoubleNaN();\n                case -608932567:  // primitiveDoubleInf\n                    return ((SimpleJson) bean).getPrimitiveDoubleInf();\n                case 1986500107:  // abstractNumber\n                    return ((SimpleJson) bean).getAbstractNumber();\n                case -1425444095:  // arrayByte\n                    return ((SimpleJson) bean).getArrayByte();\n                case -734443893:  // array2d\n                    return ((SimpleJson) bean).getArray2d();\n                case -891985903:  // string\n                    return ((SimpleJson) bean).getString();\n                case 3019696:  // bean\n                    return ((SimpleJson) bean).getBean();\n                case -1659648814:  // object1\n                    return ((SimpleJson) bean).getObject1();\n                case -1659648813:  // object2\n                    return ((SimpleJson) bean).getObject2();\n                case 3500751:  // risk\n                    return ((SimpleJson) bean).getRisk();\n                case 540453365:  // riskLevel\n                    return ((SimpleJson) bean).getRiskLevel();\n                case -425814754:  // riskLevels\n                    return ((SimpleJson) bean).getRiskLevels();\n                case -1573317553:  // stringList\n                    return ((SimpleJson) bean).getStringList();\n                case 1321263214:  // beanList\n                    return ((SimpleJson) bean).getBeanList();\n                case -189298805:  // stringMap\n                    return ((SimpleJson) bean).getStringMap();\n                case -253193396:  // intKeyMap\n                    return ((SimpleJson) bean).getIntKeyMap();\n                case -234472564:  // beanMap\n                    return ((SimpleJson) bean).getBeanMap();\n                case -1244601351:  // listInMap\n                    return ((SimpleJson) bean).getListInMap();\n                case 391098024:  // listNumericInMap\n                    return ((SimpleJson) bean).getListNumericInMap();\n                case -1297715720:  // objectInMap\n                    return ((SimpleJson) bean).getObjectInMap();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code SimpleJson}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<SimpleJson> {\n\n        private char primitiveChar;\n        private byte primitiveByte;\n        private short primitiveShort;\n        private int primitiveInt;\n        private long primitiveLong;\n        private float primitiveFloat;\n        private double primitiveDouble;\n        private double primitiveDoubleNaN;\n        private double primitiveDoubleInf;\n        private Number abstractNumber;\n        private byte[] arrayByte;\n        private String[][] array2d;\n        private String string;\n        private ImmKey bean;\n        private Object object1;\n        private Object object2;\n        private Risk risk;\n        private RiskLevel riskLevel;\n        private Set<RiskLevel> riskLevels;\n        private List<String> stringList;\n        private List<ImmKey> beanList;\n        private Map<String, String> stringMap;\n        private Map<Integer, String> intKeyMap;\n        private Map<String, ImmKey> beanMap;\n        private Map<String, List<String>> listInMap;\n        private Map<String, List<Integer>> listNumericInMap;\n        private Map<String, Object> objectInMap;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(SimpleJson beanToCopy) {\n            this.primitiveChar = beanToCopy.getPrimitiveChar();\n            this.primitiveByte = beanToCopy.getPrimitiveByte();\n            this.primitiveShort = beanToCopy.getPrimitiveShort();\n            this.primitiveInt = beanToCopy.getPrimitiveInt();\n            this.primitiveLong = beanToCopy.getPrimitiveLong();\n            this.primitiveFloat = beanToCopy.getPrimitiveFloat();\n            this.primitiveDouble = beanToCopy.getPrimitiveDouble();\n            this.primitiveDoubleNaN = beanToCopy.getPrimitiveDoubleNaN();\n            this.primitiveDoubleInf = beanToCopy.getPrimitiveDoubleInf();\n            this.abstractNumber = beanToCopy.getAbstractNumber();\n            this.arrayByte = (beanToCopy.getArrayByte() != null ? beanToCopy.getArrayByte().clone() : null);\n            this.array2d = (String[][]) JodaBeanUtils.cloneArray(beanToCopy.getArray2d());\n            this.string = beanToCopy.getString();\n            this.bean = beanToCopy.getBean();\n            this.object1 = beanToCopy.getObject1();\n            this.object2 = beanToCopy.getObject2();\n            this.risk = beanToCopy.getRisk();\n            this.riskLevel = beanToCopy.getRiskLevel();\n            this.riskLevels = (beanToCopy.getRiskLevels() != null ? new HashSet<>(beanToCopy.getRiskLevels()) : null);\n            this.stringList = beanToCopy.getStringList();\n            this.beanList = beanToCopy.getBeanList();\n            this.stringMap = beanToCopy.getStringMap();\n            this.intKeyMap = beanToCopy.getIntKeyMap();\n            this.beanMap = beanToCopy.getBeanMap();\n            this.listInMap = beanToCopy.getListInMap();\n            this.listNumericInMap = beanToCopy.getListNumericInMap();\n            this.objectInMap = beanToCopy.getObjectInMap();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 1058293981:  // primitiveChar\n                    return this.primitiveChar;\n                case 1058281103:  // primitiveByte\n                    return this.primitiveByte;\n                case -1537835051:  // primitiveShort\n                    return this.primitiveShort;\n                case 1281070472:  // primitiveInt\n                    return this.primitiveInt;\n                case 1058569219:  // primitiveLong\n                    return this.primitiveLong;\n                case -1549722187:  // primitiveFloat\n                    return this.primitiveFloat;\n                case -851055720:  // primitiveDouble\n                    return this.primitiveDouble;\n                case -608928189:  // primitiveDoubleNaN\n                    return this.primitiveDoubleNaN;\n                case -608932567:  // primitiveDoubleInf\n                    return this.primitiveDoubleInf;\n                case 1986500107:  // abstractNumber\n                    return this.abstractNumber;\n                case -1425444095:  // arrayByte\n                    return this.arrayByte;\n                case -734443893:  // array2d\n                    return this.array2d;\n                case -891985903:  // string\n                    return this.string;\n                case 3019696:  // bean\n                    return this.bean;\n                case -1659648814:  // object1\n                    return this.object1;\n                case -1659648813:  // object2\n                    return this.object2;\n                case 3500751:  // risk\n                    return this.risk;\n                case 540453365:  // riskLevel\n                    return this.riskLevel;\n                case -425814754:  // riskLevels\n                    return this.riskLevels;\n                case -1573317553:  // stringList\n                    return this.stringList;\n                case 1321263214:  // beanList\n                    return this.beanList;\n                case -189298805:  // stringMap\n                    return this.stringMap;\n                case -253193396:  // intKeyMap\n                    return this.intKeyMap;\n                case -234472564:  // beanMap\n                    return this.beanMap;\n                case -1244601351:  // listInMap\n                    return this.listInMap;\n                case 391098024:  // listNumericInMap\n                    return this.listNumericInMap;\n                case -1297715720:  // objectInMap\n                    return this.objectInMap;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 1058293981:  // primitiveChar\n                    this.primitiveChar = (Character) newValue;\n                    break;\n                case 1058281103:  // primitiveByte\n                    this.primitiveByte = (Byte) newValue;\n                    break;\n                case -1537835051:  // primitiveShort\n                    this.primitiveShort = (Short) newValue;\n                    break;\n                case 1281070472:  // primitiveInt\n                    this.primitiveInt = (Integer) newValue;\n                    break;\n                case 1058569219:  // primitiveLong\n                    this.primitiveLong = (Long) newValue;\n                    break;\n                case -1549722187:  // primitiveFloat\n                    this.primitiveFloat = (Float) newValue;\n                    break;\n                case -851055720:  // primitiveDouble\n                    this.primitiveDouble = (Double) newValue;\n                    break;\n                case -608928189:  // primitiveDoubleNaN\n                    this.primitiveDoubleNaN = (Double) newValue;\n                    break;\n                case -608932567:  // primitiveDoubleInf\n                    this.primitiveDoubleInf = (Double) newValue;\n                    break;\n                case 1986500107:  // abstractNumber\n                    this.abstractNumber = (Number) newValue;\n                    break;\n                case -1425444095:  // arrayByte\n                    this.arrayByte = (byte[]) newValue;\n                    break;\n                case -734443893:  // array2d\n                    this.array2d = (String[][]) newValue;\n                    break;\n                case -891985903:  // string\n                    this.string = (String) newValue;\n                    break;\n                case 3019696:  // bean\n                    this.bean = (ImmKey) newValue;\n                    break;\n                case -1659648814:  // object1\n                    this.object1 = (Object) newValue;\n                    break;\n                case -1659648813:  // object2\n                    this.object2 = (Object) newValue;\n                    break;\n                case 3500751:  // risk\n                    this.risk = (Risk) newValue;\n                    break;\n                case 540453365:  // riskLevel\n                    this.riskLevel = (RiskLevel) newValue;\n                    break;\n                case -425814754:  // riskLevels\n                    this.riskLevels = (Set<RiskLevel>) newValue;\n                    break;\n                case -1573317553:  // stringList\n                    this.stringList = (List<String>) newValue;\n                    break;\n                case 1321263214:  // beanList\n                    this.beanList = (List<ImmKey>) newValue;\n                    break;\n                case -189298805:  // stringMap\n                    this.stringMap = (Map<String, String>) newValue;\n                    break;\n                case -253193396:  // intKeyMap\n                    this.intKeyMap = (Map<Integer, String>) newValue;\n                    break;\n                case -234472564:  // beanMap\n                    this.beanMap = (Map<String, ImmKey>) newValue;\n                    break;\n                case -1244601351:  // listInMap\n                    this.listInMap = (Map<String, List<String>>) newValue;\n                    break;\n                case 391098024:  // listNumericInMap\n                    this.listNumericInMap = (Map<String, List<Integer>>) newValue;\n                    break;\n                case -1297715720:  // objectInMap\n                    this.objectInMap = (Map<String, Object>) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public SimpleJson build() {\n            return new SimpleJson(\n                    primitiveChar,\n                    primitiveByte,\n                    primitiveShort,\n                    primitiveInt,\n                    primitiveLong,\n                    primitiveFloat,\n                    primitiveDouble,\n                    primitiveDoubleNaN,\n                    primitiveDoubleInf,\n                    abstractNumber,\n                    arrayByte,\n                    array2d,\n                    string,\n                    bean,\n                    object1,\n                    object2,\n                    risk,\n                    riskLevel,\n                    riskLevels,\n                    stringList,\n                    beanList,\n                    stringMap,\n                    intKeyMap,\n                    beanMap,\n                    listInMap,\n                    listNumericInMap,\n                    objectInMap);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the primitiveChar.\n         * @param primitiveChar  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder primitiveChar(char primitiveChar) {\n            this.primitiveChar = primitiveChar;\n            return this;\n        }\n\n        /**\n         * Sets the primitiveByte.\n         * @param primitiveByte  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder primitiveByte(byte primitiveByte) {\n            this.primitiveByte = primitiveByte;\n            return this;\n        }\n\n        /**\n         * Sets the primitiveShort.\n         * @param primitiveShort  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder primitiveShort(short primitiveShort) {\n            this.primitiveShort = primitiveShort;\n            return this;\n        }\n\n        /**\n         * Sets the primitiveInt.\n         * @param primitiveInt  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder primitiveInt(int primitiveInt) {\n            this.primitiveInt = primitiveInt;\n            return this;\n        }\n\n        /**\n         * Sets the primitiveLong.\n         * @param primitiveLong  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder primitiveLong(long primitiveLong) {\n            this.primitiveLong = primitiveLong;\n            return this;\n        }\n\n        /**\n         * Sets the primitiveFloat.\n         * @param primitiveFloat  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder primitiveFloat(float primitiveFloat) {\n            this.primitiveFloat = primitiveFloat;\n            return this;\n        }\n\n        /**\n         * Sets the primitiveDouble.\n         * @param primitiveDouble  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder primitiveDouble(double primitiveDouble) {\n            this.primitiveDouble = primitiveDouble;\n            return this;\n        }\n\n        /**\n         * Sets the primitiveDoubleNaN.\n         * @param primitiveDoubleNaN  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder primitiveDoubleNaN(double primitiveDoubleNaN) {\n            this.primitiveDoubleNaN = primitiveDoubleNaN;\n            return this;\n        }\n\n        /**\n         * Sets the primitiveDoubleInf.\n         * @param primitiveDoubleInf  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder primitiveDoubleInf(double primitiveDoubleInf) {\n            this.primitiveDoubleInf = primitiveDoubleInf;\n            return this;\n        }\n\n        /**\n         * Sets the abstractNumber.\n         * @param abstractNumber  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder abstractNumber(Number abstractNumber) {\n            this.abstractNumber = abstractNumber;\n            return this;\n        }\n\n        /**\n         * Sets the arrayByte.\n         * @param arrayByte  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder arrayByte(byte[] arrayByte) {\n            this.arrayByte = arrayByte;\n            return this;\n        }\n\n        /**\n         * Sets the array2d.\n         * @param array2d  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder array2d(String[][] array2d) {\n            this.array2d = array2d;\n            return this;\n        }\n\n        /**\n         * Sets the string.\n         * @param string  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder string(String string) {\n            this.string = string;\n            return this;\n        }\n\n        /**\n         * Sets the bean.\n         * @param bean  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder bean(ImmKey bean) {\n            this.bean = bean;\n            return this;\n        }\n\n        /**\n         * Sets the object1.\n         * @param object1  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder object1(Object object1) {\n            this.object1 = object1;\n            return this;\n        }\n\n        /**\n         * Sets the object2.\n         * @param object2  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder object2(Object object2) {\n            this.object2 = object2;\n            return this;\n        }\n\n        /**\n         * Sets the risk.\n         * @param risk  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder risk(Risk risk) {\n            this.risk = risk;\n            return this;\n        }\n\n        /**\n         * Sets the riskLevel.\n         * @param riskLevel  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder riskLevel(RiskLevel riskLevel) {\n            this.riskLevel = riskLevel;\n            return this;\n        }\n\n        /**\n         * Sets the riskLevels.\n         * @param riskLevels  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder riskLevels(Set<RiskLevel> riskLevels) {\n            this.riskLevels = riskLevels;\n            return this;\n        }\n\n        /**\n         * Sets the {@code riskLevels} property in the builder\n         * from an array of objects.\n         * @param riskLevels  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder riskLevels(RiskLevel... riskLevels) {\n            return riskLevels(EnumSet.copyOf(Arrays.asList(riskLevels)));\n        }\n\n        /**\n         * Sets the stringList.\n         * @param stringList  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder stringList(List<String> stringList) {\n            this.stringList = stringList;\n            return this;\n        }\n\n        /**\n         * Sets the {@code stringList} property in the builder\n         * from an array of objects.\n         * @param stringList  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder stringList(String... stringList) {\n            return stringList(ImmutableList.copyOf(stringList));\n        }\n\n        /**\n         * Sets the beanList.\n         * @param beanList  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder beanList(List<ImmKey> beanList) {\n            this.beanList = beanList;\n            return this;\n        }\n\n        /**\n         * Sets the {@code beanList} property in the builder\n         * from an array of objects.\n         * @param beanList  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder beanList(ImmKey... beanList) {\n            return beanList(ImmutableList.copyOf(beanList));\n        }\n\n        /**\n         * Sets the stringMap.\n         * @param stringMap  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder stringMap(Map<String, String> stringMap) {\n            this.stringMap = stringMap;\n            return this;\n        }\n\n        /**\n         * Sets the intKeyMap.\n         * @param intKeyMap  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder intKeyMap(Map<Integer, String> intKeyMap) {\n            this.intKeyMap = intKeyMap;\n            return this;\n        }\n\n        /**\n         * Sets the beanMap.\n         * @param beanMap  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder beanMap(Map<String, ImmKey> beanMap) {\n            this.beanMap = beanMap;\n            return this;\n        }\n\n        /**\n         * Sets the listInMap.\n         * @param listInMap  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder listInMap(Map<String, List<String>> listInMap) {\n            this.listInMap = listInMap;\n            return this;\n        }\n\n        /**\n         * Sets the listNumericInMap.\n         * @param listNumericInMap  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder listNumericInMap(Map<String, List<Integer>> listNumericInMap) {\n            this.listNumericInMap = listNumericInMap;\n            return this;\n        }\n\n        /**\n         * Sets the objectInMap.\n         * @param objectInMap  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder objectInMap(Map<String, Object> objectInMap) {\n            this.objectInMap = objectInMap;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(896);\n            buf.append(\"SimpleJson.Builder{\");\n            buf.append(\"primitiveChar\").append('=').append(JodaBeanUtils.toString(primitiveChar)).append(',').append(' ');\n            buf.append(\"primitiveByte\").append('=').append(JodaBeanUtils.toString(primitiveByte)).append(',').append(' ');\n            buf.append(\"primitiveShort\").append('=').append(JodaBeanUtils.toString(primitiveShort)).append(',').append(' ');\n            buf.append(\"primitiveInt\").append('=').append(JodaBeanUtils.toString(primitiveInt)).append(',').append(' ');\n            buf.append(\"primitiveLong\").append('=').append(JodaBeanUtils.toString(primitiveLong)).append(',').append(' ');\n            buf.append(\"primitiveFloat\").append('=').append(JodaBeanUtils.toString(primitiveFloat)).append(',').append(' ');\n            buf.append(\"primitiveDouble\").append('=').append(JodaBeanUtils.toString(primitiveDouble)).append(',').append(' ');\n            buf.append(\"primitiveDoubleNaN\").append('=').append(JodaBeanUtils.toString(primitiveDoubleNaN)).append(',').append(' ');\n            buf.append(\"primitiveDoubleInf\").append('=').append(JodaBeanUtils.toString(primitiveDoubleInf)).append(',').append(' ');\n            buf.append(\"abstractNumber\").append('=').append(JodaBeanUtils.toString(abstractNumber)).append(',').append(' ');\n            buf.append(\"arrayByte\").append('=').append(JodaBeanUtils.toString(arrayByte)).append(',').append(' ');\n            buf.append(\"array2d\").append('=').append(JodaBeanUtils.toString(array2d)).append(',').append(' ');\n            buf.append(\"string\").append('=').append(JodaBeanUtils.toString(string)).append(',').append(' ');\n            buf.append(\"bean\").append('=').append(JodaBeanUtils.toString(bean)).append(',').append(' ');\n            buf.append(\"object1\").append('=').append(JodaBeanUtils.toString(object1)).append(',').append(' ');\n            buf.append(\"object2\").append('=').append(JodaBeanUtils.toString(object2)).append(',').append(' ');\n            buf.append(\"risk\").append('=').append(JodaBeanUtils.toString(risk)).append(',').append(' ');\n            buf.append(\"riskLevel\").append('=').append(JodaBeanUtils.toString(riskLevel)).append(',').append(' ');\n            buf.append(\"riskLevels\").append('=').append(JodaBeanUtils.toString(riskLevels)).append(',').append(' ');\n            buf.append(\"stringList\").append('=').append(JodaBeanUtils.toString(stringList)).append(',').append(' ');\n            buf.append(\"beanList\").append('=').append(JodaBeanUtils.toString(beanList)).append(',').append(' ');\n            buf.append(\"stringMap\").append('=').append(JodaBeanUtils.toString(stringMap)).append(',').append(' ');\n            buf.append(\"intKeyMap\").append('=').append(JodaBeanUtils.toString(intKeyMap)).append(',').append(' ');\n            buf.append(\"beanMap\").append('=').append(JodaBeanUtils.toString(beanMap)).append(',').append(' ');\n            buf.append(\"listInMap\").append('=').append(JodaBeanUtils.toString(listInMap)).append(',').append(' ');\n            buf.append(\"listNumericInMap\").append('=').append(JodaBeanUtils.toString(listNumericInMap)).append(',').append(' ');\n            buf.append(\"objectInMap\").append('=').append(JodaBeanUtils.toString(objectInMap));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/SimpleName.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock address JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class SimpleName\n        implements Bean {\n\n    /** The forename. */\n    @PropertyDefinition(alias = \"firstName\")\n    private String forename;\n    /** The  middle names. */\n    @PropertyDefinition\n    private String[] middleNames;\n    /** The surname. */\n    @PropertyDefinition(alias = \"givenName\")\n    private String surname;\n\n    /**\n     * Creates an instance.\n     */\n    public SimpleName() {\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code SimpleName}.\n     * @return the meta-bean, not null\n     */\n    public static SimpleName.Meta meta() {\n        return SimpleName.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(SimpleName.Meta.INSTANCE);\n    }\n\n    @Override\n    public SimpleName.Meta metaBean() {\n        return SimpleName.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the forename.\n     * @return the value of the property\n     */\n    public String getForename() {\n        return forename;\n    }\n\n    /**\n     * Sets the forename.\n     * @param forename  the new value of the property\n     */\n    public void setForename(String forename) {\n        this.forename = forename;\n    }\n\n    /**\n     * Gets the the {@code forename} property.\n     * @return the property, not null\n     */\n    public final Property<String> forename() {\n        return metaBean().forename().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the  middle names.\n     * @return the value of the property\n     */\n    public String[] getMiddleNames() {\n        return middleNames;\n    }\n\n    /**\n     * Sets the  middle names.\n     * @param middleNames  the new value of the property\n     */\n    public void setMiddleNames(String[] middleNames) {\n        this.middleNames = middleNames;\n    }\n\n    /**\n     * Gets the the {@code middleNames} property.\n     * @return the property, not null\n     */\n    public final Property<String[]> middleNames() {\n        return metaBean().middleNames().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the surname.\n     * @return the value of the property\n     */\n    public String getSurname() {\n        return surname;\n    }\n\n    /**\n     * Sets the surname.\n     * @param surname  the new value of the property\n     */\n    public void setSurname(String surname) {\n        this.surname = surname;\n    }\n\n    /**\n     * Gets the the {@code surname} property.\n     * @return the property, not null\n     */\n    public final Property<String> surname() {\n        return metaBean().surname().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public SimpleName clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            SimpleName other = (SimpleName) obj;\n            return JodaBeanUtils.equal(this.getForename(), other.getForename()) &&\n                    JodaBeanUtils.equal(this.getMiddleNames(), other.getMiddleNames()) &&\n                    JodaBeanUtils.equal(this.getSurname(), other.getSurname());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getForename());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getMiddleNames());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getSurname());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(128);\n        buf.append(\"SimpleName{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"forename\").append('=').append(JodaBeanUtils.toString(getForename())).append(',').append(' ');\n        buf.append(\"middleNames\").append('=').append(JodaBeanUtils.toString(getMiddleNames())).append(',').append(' ');\n        buf.append(\"surname\").append('=').append(JodaBeanUtils.toString(getSurname())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code SimpleName}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code forename} property.\n         */\n        private final MetaProperty<String> forename = DirectMetaProperty.ofReadWrite(\n                this, \"forename\", SimpleName.class, String.class);\n        /**\n         * The meta-property for the {@code middleNames} property.\n         */\n        private final MetaProperty<String[]> middleNames = DirectMetaProperty.ofReadWrite(\n                this, \"middleNames\", SimpleName.class, String[].class);\n        /**\n         * The meta-property for the {@code surname} property.\n         */\n        private final MetaProperty<String> surname = DirectMetaProperty.ofReadWrite(\n                this, \"surname\", SimpleName.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"forename\",\n                \"middleNames\",\n                \"surname\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                case 132835675:  // firstName (alias)\n                    return this.forename;\n                case 404996787:  // middleNames\n                    return this.middleNames;\n                case -1852993317:  // surname\n                case 1469046696:  // givenName (alias)\n                    return this.surname;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends SimpleName> builder() {\n            return new DirectBeanBuilder<>(new SimpleName());\n        }\n\n        @Override\n        public Class<? extends SimpleName> beanType() {\n            return SimpleName.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code forename} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> forename() {\n            return forename;\n        }\n\n        /**\n         * The meta-property for the {@code middleNames} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String[]> middleNames() {\n            return middleNames;\n        }\n\n        /**\n         * The meta-property for the {@code surname} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> surname() {\n            return surname;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                case 132835675:  // firstName (alias)\n                    return ((SimpleName) bean).getForename();\n                case 404996787:  // middleNames\n                    return ((SimpleName) bean).getMiddleNames();\n                case -1852993317:  // surname\n                case 1469046696:  // givenName (alias)\n                    return ((SimpleName) bean).getSurname();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                case 132835675:  // firstName (alias)\n                    ((SimpleName) bean).setForename((String) newValue);\n                    return;\n                case 404996787:  // middleNames\n                    ((SimpleName) bean).setMiddleNames((String[]) newValue);\n                    return;\n                case -1852993317:  // surname\n                case 1469046696:  // givenName (alias)\n                    ((SimpleName) bean).setSurname((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/SimplePerson.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\nimport org.joda.beans.impl.flexi.FlexiBean;\n\n/**\n * Mock person JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic final class SimplePerson implements Cloneable, Bean {\n\n    /** The forename. */\n    @PropertyDefinition\n    private String forename;\n    /** The surname. */\n    @PropertyDefinition\n    private String surname;\n    /** The number of cars. */\n    @PropertyDefinition\n    private transient int numberOfCars;\n    @PropertyDefinition\n    private final List<Address> addressList = new ArrayList<>();\n    @PropertyDefinition\n    private final Map<String, Address> otherAddressMap = new HashMap<>();\n    @PropertyDefinition\n    private final List<List<Address>> addressesList = new ArrayList<>();\n    @PropertyDefinition\n    private Address mainAddress;\n    @Deprecated\n    @PropertyDefinition\n    private final FlexiBean propDefAnnotationSecondDeprecated = new FlexiBean();\n    @SimpleAnnotation(first = \"additionalAttributes\")\n    @PropertyDefinition(get = \"manual\")\n    private Map<String, String> propDefAnnotationSecondManual;\n\n    public Map<String, String> getPropDefAnnotationSecondManual() {\n        return this.propDefAnnotationSecondManual;\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code SimplePerson}.\n     * @return the meta-bean, not null\n     */\n    public static SimplePerson.Meta meta() {\n        return SimplePerson.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(SimplePerson.Meta.INSTANCE);\n    }\n\n    @Override\n    public SimplePerson.Meta metaBean() {\n        return SimplePerson.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the forename.\n     * @return the value of the property\n     */\n    public String getForename() {\n        return forename;\n    }\n\n    /**\n     * Sets the forename.\n     * @param forename  the new value of the property\n     */\n    public void setForename(String forename) {\n        this.forename = forename;\n    }\n\n    /**\n     * Gets the the {@code forename} property.\n     * @return the property, not null\n     */\n    public Property<String> forename() {\n        return metaBean().forename().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the surname.\n     * @return the value of the property\n     */\n    public String getSurname() {\n        return surname;\n    }\n\n    /**\n     * Sets the surname.\n     * @param surname  the new value of the property\n     */\n    public void setSurname(String surname) {\n        this.surname = surname;\n    }\n\n    /**\n     * Gets the the {@code surname} property.\n     * @return the property, not null\n     */\n    public Property<String> surname() {\n        return metaBean().surname().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number of cars.\n     * @return the value of the property\n     */\n    public int getNumberOfCars() {\n        return numberOfCars;\n    }\n\n    /**\n     * Sets the number of cars.\n     * @param numberOfCars  the new value of the property\n     */\n    public void setNumberOfCars(int numberOfCars) {\n        this.numberOfCars = numberOfCars;\n    }\n\n    /**\n     * Gets the the {@code numberOfCars} property.\n     * @return the property, not null\n     */\n    public Property<Integer> numberOfCars() {\n        return metaBean().numberOfCars().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the addressList.\n     * @return the value of the property, not null\n     */\n    public List<Address> getAddressList() {\n        return addressList;\n    }\n\n    /**\n     * Sets the addressList.\n     * @param addressList  the new value of the property, not null\n     */\n    public void setAddressList(List<Address> addressList) {\n        JodaBeanUtils.notNull(addressList, \"addressList\");\n        this.addressList.clear();\n        this.addressList.addAll(addressList);\n    }\n\n    /**\n     * Gets the the {@code addressList} property.\n     * @return the property, not null\n     */\n    public Property<List<Address>> addressList() {\n        return metaBean().addressList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the otherAddressMap.\n     * @return the value of the property, not null\n     */\n    public Map<String, Address> getOtherAddressMap() {\n        return otherAddressMap;\n    }\n\n    /**\n     * Sets the otherAddressMap.\n     * @param otherAddressMap  the new value of the property, not null\n     */\n    public void setOtherAddressMap(Map<String, Address> otherAddressMap) {\n        JodaBeanUtils.notNull(otherAddressMap, \"otherAddressMap\");\n        this.otherAddressMap.clear();\n        this.otherAddressMap.putAll(otherAddressMap);\n    }\n\n    /**\n     * Gets the the {@code otherAddressMap} property.\n     * @return the property, not null\n     */\n    public Property<Map<String, Address>> otherAddressMap() {\n        return metaBean().otherAddressMap().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the addressesList.\n     * @return the value of the property, not null\n     */\n    public List<List<Address>> getAddressesList() {\n        return addressesList;\n    }\n\n    /**\n     * Sets the addressesList.\n     * @param addressesList  the new value of the property, not null\n     */\n    public void setAddressesList(List<List<Address>> addressesList) {\n        JodaBeanUtils.notNull(addressesList, \"addressesList\");\n        this.addressesList.clear();\n        this.addressesList.addAll(addressesList);\n    }\n\n    /**\n     * Gets the the {@code addressesList} property.\n     * @return the property, not null\n     */\n    public Property<List<List<Address>>> addressesList() {\n        return metaBean().addressesList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the mainAddress.\n     * @return the value of the property\n     */\n    public Address getMainAddress() {\n        return mainAddress;\n    }\n\n    /**\n     * Sets the mainAddress.\n     * @param mainAddress  the new value of the property\n     */\n    public void setMainAddress(Address mainAddress) {\n        this.mainAddress = mainAddress;\n    }\n\n    /**\n     * Gets the the {@code mainAddress} property.\n     * @return the property, not null\n     */\n    public Property<Address> mainAddress() {\n        return metaBean().mainAddress().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the propDefAnnotationSecondDeprecated.\n     * @return the value of the property, not null\n     * @deprecated Deprecated\n     */\n    @Deprecated\n    public FlexiBean getPropDefAnnotationSecondDeprecated() {\n        return propDefAnnotationSecondDeprecated;\n    }\n\n    /**\n     * Sets the propDefAnnotationSecondDeprecated.\n     * @param propDefAnnotationSecondDeprecated  the new value of the property, not null\n     * @deprecated Deprecated\n     */\n    @Deprecated\n    public void setPropDefAnnotationSecondDeprecated(FlexiBean propDefAnnotationSecondDeprecated) {\n        JodaBeanUtils.notNull(propDefAnnotationSecondDeprecated, \"propDefAnnotationSecondDeprecated\");\n        this.propDefAnnotationSecondDeprecated.clear();\n        this.propDefAnnotationSecondDeprecated.putAll(propDefAnnotationSecondDeprecated);\n    }\n\n    /**\n     * Gets the the {@code propDefAnnotationSecondDeprecated} property.\n     * @return the property, not null\n     * @deprecated Deprecated\n     */\n    @Deprecated\n    public Property<FlexiBean> propDefAnnotationSecondDeprecated() {\n        return metaBean().propDefAnnotationSecondDeprecated().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Sets the propDefAnnotationSecondManual.\n     * @param propDefAnnotationSecondManual  the new value of the property\n     */\n    public void setPropDefAnnotationSecondManual(Map<String, String> propDefAnnotationSecondManual) {\n        this.propDefAnnotationSecondManual = propDefAnnotationSecondManual;\n    }\n\n    /**\n     * Gets the the {@code propDefAnnotationSecondManual} property.\n     * @return the property, not null\n     */\n    public Property<Map<String, String>> propDefAnnotationSecondManual() {\n        return metaBean().propDefAnnotationSecondManual().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public SimplePerson clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            SimplePerson other = (SimplePerson) obj;\n            return JodaBeanUtils.equal(this.getForename(), other.getForename()) &&\n                    JodaBeanUtils.equal(this.getSurname(), other.getSurname()) &&\n                    (this.getNumberOfCars() == other.getNumberOfCars()) &&\n                    JodaBeanUtils.equal(this.getAddressList(), other.getAddressList()) &&\n                    JodaBeanUtils.equal(this.getOtherAddressMap(), other.getOtherAddressMap()) &&\n                    JodaBeanUtils.equal(this.getAddressesList(), other.getAddressesList()) &&\n                    JodaBeanUtils.equal(this.getMainAddress(), other.getMainAddress()) &&\n                    JodaBeanUtils.equal(this.getPropDefAnnotationSecondDeprecated(), other.getPropDefAnnotationSecondDeprecated()) &&\n                    JodaBeanUtils.equal(this.getPropDefAnnotationSecondManual(), other.getPropDefAnnotationSecondManual());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getForename());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getSurname());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNumberOfCars());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getAddressList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getOtherAddressMap());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getAddressesList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getMainAddress());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getPropDefAnnotationSecondDeprecated());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getPropDefAnnotationSecondManual());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(320);\n        buf.append(\"SimplePerson{\");\n        buf.append(\"forename\").append('=').append(JodaBeanUtils.toString(getForename())).append(',').append(' ');\n        buf.append(\"surname\").append('=').append(JodaBeanUtils.toString(getSurname())).append(',').append(' ');\n        buf.append(\"numberOfCars\").append('=').append(JodaBeanUtils.toString(getNumberOfCars())).append(',').append(' ');\n        buf.append(\"addressList\").append('=').append(JodaBeanUtils.toString(getAddressList())).append(',').append(' ');\n        buf.append(\"otherAddressMap\").append('=').append(JodaBeanUtils.toString(getOtherAddressMap())).append(',').append(' ');\n        buf.append(\"addressesList\").append('=').append(JodaBeanUtils.toString(getAddressesList())).append(',').append(' ');\n        buf.append(\"mainAddress\").append('=').append(JodaBeanUtils.toString(getMainAddress())).append(',').append(' ');\n        buf.append(\"propDefAnnotationSecondDeprecated\").append('=').append(JodaBeanUtils.toString(getPropDefAnnotationSecondDeprecated())).append(',').append(' ');\n        buf.append(\"propDefAnnotationSecondManual\").append('=').append(JodaBeanUtils.toString(getPropDefAnnotationSecondManual()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code SimplePerson}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code forename} property.\n         */\n        private final MetaProperty<String> forename = DirectMetaProperty.ofReadWrite(\n                this, \"forename\", SimplePerson.class, String.class);\n        /**\n         * The meta-property for the {@code surname} property.\n         */\n        private final MetaProperty<String> surname = DirectMetaProperty.ofReadWrite(\n                this, \"surname\", SimplePerson.class, String.class);\n        /**\n         * The meta-property for the {@code numberOfCars} property.\n         */\n        private final MetaProperty<Integer> numberOfCars = DirectMetaProperty.ofReadWrite(\n                this, \"numberOfCars\", SimplePerson.class, Integer.TYPE);\n        /**\n         * The meta-property for the {@code addressList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<Address>> addressList = DirectMetaProperty.ofReadWrite(\n                this, \"addressList\", SimplePerson.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code otherAddressMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Map<String, Address>> otherAddressMap = DirectMetaProperty.ofReadWrite(\n                this, \"otherAddressMap\", SimplePerson.class, (Class) Map.class);\n        /**\n         * The meta-property for the {@code addressesList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<List<Address>>> addressesList = DirectMetaProperty.ofReadWrite(\n                this, \"addressesList\", SimplePerson.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code mainAddress} property.\n         */\n        private final MetaProperty<Address> mainAddress = DirectMetaProperty.ofReadWrite(\n                this, \"mainAddress\", SimplePerson.class, Address.class);\n        /**\n         * The meta-property for the {@code propDefAnnotationSecondDeprecated} property.\n         */\n        private final MetaProperty<FlexiBean> propDefAnnotationSecondDeprecated = DirectMetaProperty.ofReadWrite(\n                this, \"propDefAnnotationSecondDeprecated\", SimplePerson.class, FlexiBean.class);\n        /**\n         * The meta-property for the {@code propDefAnnotationSecondManual} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Map<String, String>> propDefAnnotationSecondManual = DirectMetaProperty.ofReadWrite(\n                this, \"propDefAnnotationSecondManual\", SimplePerson.class, (Class) Map.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"forename\",\n                \"surname\",\n                \"numberOfCars\",\n                \"addressList\",\n                \"otherAddressMap\",\n                \"addressesList\",\n                \"mainAddress\",\n                \"propDefAnnotationSecondDeprecated\",\n                \"propDefAnnotationSecondManual\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return this.forename;\n                case -1852993317:  // surname\n                    return this.surname;\n                case 926656063:  // numberOfCars\n                    return this.numberOfCars;\n                case -1377524046:  // addressList\n                    return this.addressList;\n                case 1368089592:  // otherAddressMap\n                    return this.otherAddressMap;\n                case -226885792:  // addressesList\n                    return this.addressesList;\n                case -2032731141:  // mainAddress\n                    return this.mainAddress;\n                case 1897330136:  // propDefAnnotationSecondDeprecated\n                    return this.propDefAnnotationSecondDeprecated;\n                case 1276990059:  // propDefAnnotationSecondManual\n                    return this.propDefAnnotationSecondManual;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends SimplePerson> builder() {\n            return new DirectBeanBuilder<>(new SimplePerson());\n        }\n\n        @Override\n        public Class<? extends SimplePerson> beanType() {\n            return SimplePerson.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code forename} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> forename() {\n            return forename;\n        }\n\n        /**\n         * The meta-property for the {@code surname} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> surname() {\n            return surname;\n        }\n\n        /**\n         * The meta-property for the {@code numberOfCars} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Integer> numberOfCars() {\n            return numberOfCars;\n        }\n\n        /**\n         * The meta-property for the {@code addressList} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<List<Address>> addressList() {\n            return addressList;\n        }\n\n        /**\n         * The meta-property for the {@code otherAddressMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Map<String, Address>> otherAddressMap() {\n            return otherAddressMap;\n        }\n\n        /**\n         * The meta-property for the {@code addressesList} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<List<List<Address>>> addressesList() {\n            return addressesList;\n        }\n\n        /**\n         * The meta-property for the {@code mainAddress} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Address> mainAddress() {\n            return mainAddress;\n        }\n\n        /**\n         * The meta-property for the {@code propDefAnnotationSecondDeprecated} property.\n         * @return the meta-property, not null\n         * @deprecated Deprecated\n         */\n        @Deprecated\n        public MetaProperty<FlexiBean> propDefAnnotationSecondDeprecated() {\n            return propDefAnnotationSecondDeprecated;\n        }\n\n        /**\n         * The meta-property for the {@code propDefAnnotationSecondManual} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Map<String, String>> propDefAnnotationSecondManual() {\n            return propDefAnnotationSecondManual;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return ((SimplePerson) bean).getForename();\n                case -1852993317:  // surname\n                    return ((SimplePerson) bean).getSurname();\n                case 926656063:  // numberOfCars\n                    return ((SimplePerson) bean).getNumberOfCars();\n                case -1377524046:  // addressList\n                    return ((SimplePerson) bean).getAddressList();\n                case 1368089592:  // otherAddressMap\n                    return ((SimplePerson) bean).getOtherAddressMap();\n                case -226885792:  // addressesList\n                    return ((SimplePerson) bean).getAddressesList();\n                case -2032731141:  // mainAddress\n                    return ((SimplePerson) bean).getMainAddress();\n                case 1897330136:  // propDefAnnotationSecondDeprecated\n                    return ((SimplePerson) bean).getPropDefAnnotationSecondDeprecated();\n                case 1276990059:  // propDefAnnotationSecondManual\n                    return ((SimplePerson) bean).getPropDefAnnotationSecondManual();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    ((SimplePerson) bean).setForename((String) newValue);\n                    return;\n                case -1852993317:  // surname\n                    ((SimplePerson) bean).setSurname((String) newValue);\n                    return;\n                case 926656063:  // numberOfCars\n                    ((SimplePerson) bean).setNumberOfCars((Integer) newValue);\n                    return;\n                case -1377524046:  // addressList\n                    ((SimplePerson) bean).setAddressList((List<Address>) newValue);\n                    return;\n                case 1368089592:  // otherAddressMap\n                    ((SimplePerson) bean).setOtherAddressMap((Map<String, Address>) newValue);\n                    return;\n                case -226885792:  // addressesList\n                    ((SimplePerson) bean).setAddressesList((List<List<Address>>) newValue);\n                    return;\n                case -2032731141:  // mainAddress\n                    ((SimplePerson) bean).setMainAddress((Address) newValue);\n                    return;\n                case 1897330136:  // propDefAnnotationSecondDeprecated\n                    ((SimplePerson) bean).setPropDefAnnotationSecondDeprecated((FlexiBean) newValue);\n                    return;\n                case 1276990059:  // propDefAnnotationSecondManual\n                    ((SimplePerson) bean).setPropDefAnnotationSecondManual((Map<String, String>) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n        @Override\n        protected void validate(Bean bean) {\n            JodaBeanUtils.notNull(((SimplePerson) bean).addressList, \"addressList\");\n            JodaBeanUtils.notNull(((SimplePerson) bean).otherAddressMap, \"otherAddressMap\");\n            JodaBeanUtils.notNull(((SimplePerson) bean).addressesList, \"addressesList\");\n            JodaBeanUtils.notNull(((SimplePerson) bean).propDefAnnotationSecondDeprecated, \"propDefAnnotationSecondDeprecated\");\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/SimplePersonWithBuilderFinal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.collect.ImmutableList;\nimport com.google.common.collect.ImmutableMap;\n\n/**\n * Mock person JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(builderScope = \"public\")\npublic final class SimplePersonWithBuilderFinal implements Cloneable, Bean {\n\n    /** The forename. */\n    @PropertyDefinition\n    private String forename;\n    /** The surname. */\n    @PropertyDefinition(validate = \"notNull\")\n    private final String surname;\n    /** The number of cars. */\n    @PropertyDefinition\n    private transient int numberOfCars;\n    @PropertyDefinition\n    private final List<Address> addressList = new ArrayList<>();\n    @PropertyDefinition(validate = \"notNull\")\n    private final Map<String, Address> otherAddressMap = new HashMap<>();\n    @PropertyDefinition(validate = \"notNull\")\n    private final List<List<Address>> addressesList = new ArrayList<>();\n    @PropertyDefinition\n    private Address mainAddress;\n    @PropertyDefinition\n    private String[] tags;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code SimplePersonWithBuilderFinal}.\n     * @return the meta-bean, not null\n     */\n    public static SimplePersonWithBuilderFinal.Meta meta() {\n        return SimplePersonWithBuilderFinal.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(SimplePersonWithBuilderFinal.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static SimplePersonWithBuilderFinal.Builder builder() {\n        return new SimplePersonWithBuilderFinal.Builder();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    private SimplePersonWithBuilderFinal(SimplePersonWithBuilderFinal.Builder builder) {\n        JodaBeanUtils.notNull(builder.surname, \"surname\");\n        JodaBeanUtils.notNull(builder.addressList, \"addressList\");\n        JodaBeanUtils.notNull(builder.otherAddressMap, \"otherAddressMap\");\n        JodaBeanUtils.notNull(builder.addressesList, \"addressesList\");\n        this.forename = builder.forename;\n        this.surname = builder.surname;\n        this.numberOfCars = builder.numberOfCars;\n        this.addressList.addAll(builder.addressList);\n        this.otherAddressMap.putAll(builder.otherAddressMap);\n        this.addressesList.addAll(builder.addressesList);\n        this.mainAddress = builder.mainAddress;\n        this.tags = builder.tags;\n    }\n\n    @Override\n    public SimplePersonWithBuilderFinal.Meta metaBean() {\n        return SimplePersonWithBuilderFinal.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the forename.\n     * @return the value of the property\n     */\n    public String getForename() {\n        return forename;\n    }\n\n    /**\n     * Sets the forename.\n     * @param forename  the new value of the property\n     */\n    public void setForename(String forename) {\n        this.forename = forename;\n    }\n\n    /**\n     * Gets the the {@code forename} property.\n     * @return the property, not null\n     */\n    public Property<String> forename() {\n        return metaBean().forename().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the surname.\n     * @return the value of the property, not null\n     */\n    public String getSurname() {\n        return surname;\n    }\n\n    /**\n     * Gets the the {@code surname} property.\n     * @return the property, not null\n     */\n    public Property<String> surname() {\n        return metaBean().surname().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number of cars.\n     * @return the value of the property\n     */\n    public int getNumberOfCars() {\n        return numberOfCars;\n    }\n\n    /**\n     * Sets the number of cars.\n     * @param numberOfCars  the new value of the property\n     */\n    public void setNumberOfCars(int numberOfCars) {\n        this.numberOfCars = numberOfCars;\n    }\n\n    /**\n     * Gets the the {@code numberOfCars} property.\n     * @return the property, not null\n     */\n    public Property<Integer> numberOfCars() {\n        return metaBean().numberOfCars().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the addressList.\n     * @return the value of the property, not null\n     */\n    public List<Address> getAddressList() {\n        return addressList;\n    }\n\n    /**\n     * Sets the addressList.\n     * @param addressList  the new value of the property, not null\n     */\n    public void setAddressList(List<Address> addressList) {\n        JodaBeanUtils.notNull(addressList, \"addressList\");\n        this.addressList.clear();\n        this.addressList.addAll(addressList);\n    }\n\n    /**\n     * Gets the the {@code addressList} property.\n     * @return the property, not null\n     */\n    public Property<List<Address>> addressList() {\n        return metaBean().addressList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the otherAddressMap.\n     * @return the value of the property, not null\n     */\n    public Map<String, Address> getOtherAddressMap() {\n        return otherAddressMap;\n    }\n\n    /**\n     * Sets the otherAddressMap.\n     * @param otherAddressMap  the new value of the property, not null\n     */\n    public void setOtherAddressMap(Map<String, Address> otherAddressMap) {\n        JodaBeanUtils.notNull(otherAddressMap, \"otherAddressMap\");\n        this.otherAddressMap.clear();\n        this.otherAddressMap.putAll(otherAddressMap);\n    }\n\n    /**\n     * Gets the the {@code otherAddressMap} property.\n     * @return the property, not null\n     */\n    public Property<Map<String, Address>> otherAddressMap() {\n        return metaBean().otherAddressMap().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the addressesList.\n     * @return the value of the property, not null\n     */\n    public List<List<Address>> getAddressesList() {\n        return addressesList;\n    }\n\n    /**\n     * Sets the addressesList.\n     * @param addressesList  the new value of the property, not null\n     */\n    public void setAddressesList(List<List<Address>> addressesList) {\n        JodaBeanUtils.notNull(addressesList, \"addressesList\");\n        this.addressesList.clear();\n        this.addressesList.addAll(addressesList);\n    }\n\n    /**\n     * Gets the the {@code addressesList} property.\n     * @return the property, not null\n     */\n    public Property<List<List<Address>>> addressesList() {\n        return metaBean().addressesList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the mainAddress.\n     * @return the value of the property\n     */\n    public Address getMainAddress() {\n        return mainAddress;\n    }\n\n    /**\n     * Sets the mainAddress.\n     * @param mainAddress  the new value of the property\n     */\n    public void setMainAddress(Address mainAddress) {\n        this.mainAddress = mainAddress;\n    }\n\n    /**\n     * Gets the the {@code mainAddress} property.\n     * @return the property, not null\n     */\n    public Property<Address> mainAddress() {\n        return metaBean().mainAddress().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the tags.\n     * @return the value of the property\n     */\n    public String[] getTags() {\n        return tags;\n    }\n\n    /**\n     * Sets the tags.\n     * @param tags  the new value of the property\n     */\n    public void setTags(String[] tags) {\n        this.tags = tags;\n    }\n\n    /**\n     * Gets the the {@code tags} property.\n     * @return the property, not null\n     */\n    public Property<String[]> tags() {\n        return metaBean().tags().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public SimplePersonWithBuilderFinal clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            SimplePersonWithBuilderFinal other = (SimplePersonWithBuilderFinal) obj;\n            return JodaBeanUtils.equal(this.getForename(), other.getForename()) &&\n                    JodaBeanUtils.equal(this.getSurname(), other.getSurname()) &&\n                    (this.getNumberOfCars() == other.getNumberOfCars()) &&\n                    JodaBeanUtils.equal(this.getAddressList(), other.getAddressList()) &&\n                    JodaBeanUtils.equal(this.getOtherAddressMap(), other.getOtherAddressMap()) &&\n                    JodaBeanUtils.equal(this.getAddressesList(), other.getAddressesList()) &&\n                    JodaBeanUtils.equal(this.getMainAddress(), other.getMainAddress()) &&\n                    JodaBeanUtils.equal(this.getTags(), other.getTags());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getForename());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getSurname());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNumberOfCars());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getAddressList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getOtherAddressMap());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getAddressesList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getMainAddress());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getTags());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(288);\n        buf.append(\"SimplePersonWithBuilderFinal{\");\n        buf.append(\"forename\").append('=').append(JodaBeanUtils.toString(getForename())).append(',').append(' ');\n        buf.append(\"surname\").append('=').append(JodaBeanUtils.toString(getSurname())).append(',').append(' ');\n        buf.append(\"numberOfCars\").append('=').append(JodaBeanUtils.toString(getNumberOfCars())).append(',').append(' ');\n        buf.append(\"addressList\").append('=').append(JodaBeanUtils.toString(getAddressList())).append(',').append(' ');\n        buf.append(\"otherAddressMap\").append('=').append(JodaBeanUtils.toString(getOtherAddressMap())).append(',').append(' ');\n        buf.append(\"addressesList\").append('=').append(JodaBeanUtils.toString(getAddressesList())).append(',').append(' ');\n        buf.append(\"mainAddress\").append('=').append(JodaBeanUtils.toString(getMainAddress())).append(',').append(' ');\n        buf.append(\"tags\").append('=').append(JodaBeanUtils.toString(getTags()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code SimplePersonWithBuilderFinal}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code forename} property.\n         */\n        private final MetaProperty<String> forename = DirectMetaProperty.ofReadWrite(\n                this, \"forename\", SimplePersonWithBuilderFinal.class, String.class);\n        /**\n         * The meta-property for the {@code surname} property.\n         */\n        private final MetaProperty<String> surname = DirectMetaProperty.ofReadOnlyBuildable(\n                this, \"surname\", SimplePersonWithBuilderFinal.class, String.class);\n        /**\n         * The meta-property for the {@code numberOfCars} property.\n         */\n        private final MetaProperty<Integer> numberOfCars = DirectMetaProperty.ofReadWrite(\n                this, \"numberOfCars\", SimplePersonWithBuilderFinal.class, Integer.TYPE);\n        /**\n         * The meta-property for the {@code addressList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<Address>> addressList = DirectMetaProperty.ofReadWrite(\n                this, \"addressList\", SimplePersonWithBuilderFinal.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code otherAddressMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Map<String, Address>> otherAddressMap = DirectMetaProperty.ofReadWrite(\n                this, \"otherAddressMap\", SimplePersonWithBuilderFinal.class, (Class) Map.class);\n        /**\n         * The meta-property for the {@code addressesList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<List<Address>>> addressesList = DirectMetaProperty.ofReadWrite(\n                this, \"addressesList\", SimplePersonWithBuilderFinal.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code mainAddress} property.\n         */\n        private final MetaProperty<Address> mainAddress = DirectMetaProperty.ofReadWrite(\n                this, \"mainAddress\", SimplePersonWithBuilderFinal.class, Address.class);\n        /**\n         * The meta-property for the {@code tags} property.\n         */\n        private final MetaProperty<String[]> tags = DirectMetaProperty.ofReadWrite(\n                this, \"tags\", SimplePersonWithBuilderFinal.class, String[].class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"forename\",\n                \"surname\",\n                \"numberOfCars\",\n                \"addressList\",\n                \"otherAddressMap\",\n                \"addressesList\",\n                \"mainAddress\",\n                \"tags\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return this.forename;\n                case -1852993317:  // surname\n                    return this.surname;\n                case 926656063:  // numberOfCars\n                    return this.numberOfCars;\n                case -1377524046:  // addressList\n                    return this.addressList;\n                case 1368089592:  // otherAddressMap\n                    return this.otherAddressMap;\n                case -226885792:  // addressesList\n                    return this.addressesList;\n                case -2032731141:  // mainAddress\n                    return this.mainAddress;\n                case 3552281:  // tags\n                    return this.tags;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public SimplePersonWithBuilderFinal.Builder builder() {\n            return new SimplePersonWithBuilderFinal.Builder();\n        }\n\n        @Override\n        public Class<? extends SimplePersonWithBuilderFinal> beanType() {\n            return SimplePersonWithBuilderFinal.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code forename} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> forename() {\n            return forename;\n        }\n\n        /**\n         * The meta-property for the {@code surname} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> surname() {\n            return surname;\n        }\n\n        /**\n         * The meta-property for the {@code numberOfCars} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Integer> numberOfCars() {\n            return numberOfCars;\n        }\n\n        /**\n         * The meta-property for the {@code addressList} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<List<Address>> addressList() {\n            return addressList;\n        }\n\n        /**\n         * The meta-property for the {@code otherAddressMap} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Map<String, Address>> otherAddressMap() {\n            return otherAddressMap;\n        }\n\n        /**\n         * The meta-property for the {@code addressesList} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<List<List<Address>>> addressesList() {\n            return addressesList;\n        }\n\n        /**\n         * The meta-property for the {@code mainAddress} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Address> mainAddress() {\n            return mainAddress;\n        }\n\n        /**\n         * The meta-property for the {@code tags} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String[]> tags() {\n            return tags;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return ((SimplePersonWithBuilderFinal) bean).getForename();\n                case -1852993317:  // surname\n                    return ((SimplePersonWithBuilderFinal) bean).getSurname();\n                case 926656063:  // numberOfCars\n                    return ((SimplePersonWithBuilderFinal) bean).getNumberOfCars();\n                case -1377524046:  // addressList\n                    return ((SimplePersonWithBuilderFinal) bean).getAddressList();\n                case 1368089592:  // otherAddressMap\n                    return ((SimplePersonWithBuilderFinal) bean).getOtherAddressMap();\n                case -226885792:  // addressesList\n                    return ((SimplePersonWithBuilderFinal) bean).getAddressesList();\n                case -2032731141:  // mainAddress\n                    return ((SimplePersonWithBuilderFinal) bean).getMainAddress();\n                case 3552281:  // tags\n                    return ((SimplePersonWithBuilderFinal) bean).getTags();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    ((SimplePersonWithBuilderFinal) bean).setForename((String) newValue);\n                    return;\n                case -1852993317:  // surname\n                    if (quiet) {\n                        return;\n                    }\n                    throw new UnsupportedOperationException(\"Property cannot be written: surname\");\n                case 926656063:  // numberOfCars\n                    ((SimplePersonWithBuilderFinal) bean).setNumberOfCars((Integer) newValue);\n                    return;\n                case -1377524046:  // addressList\n                    ((SimplePersonWithBuilderFinal) bean).setAddressList((List<Address>) newValue);\n                    return;\n                case 1368089592:  // otherAddressMap\n                    ((SimplePersonWithBuilderFinal) bean).setOtherAddressMap((Map<String, Address>) newValue);\n                    return;\n                case -226885792:  // addressesList\n                    ((SimplePersonWithBuilderFinal) bean).setAddressesList((List<List<Address>>) newValue);\n                    return;\n                case -2032731141:  // mainAddress\n                    ((SimplePersonWithBuilderFinal) bean).setMainAddress((Address) newValue);\n                    return;\n                case 3552281:  // tags\n                    ((SimplePersonWithBuilderFinal) bean).setTags((String[]) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n        @Override\n        protected void validate(Bean bean) {\n            JodaBeanUtils.notNull(((SimplePersonWithBuilderFinal) bean).surname, \"surname\");\n            JodaBeanUtils.notNull(((SimplePersonWithBuilderFinal) bean).addressList, \"addressList\");\n            JodaBeanUtils.notNull(((SimplePersonWithBuilderFinal) bean).otherAddressMap, \"otherAddressMap\");\n            JodaBeanUtils.notNull(((SimplePersonWithBuilderFinal) bean).addressesList, \"addressesList\");\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code SimplePersonWithBuilderFinal}.\n     */\n    public static final class Builder extends DirectFieldsBeanBuilder<SimplePersonWithBuilderFinal> {\n\n        private String forename;\n        private String surname;\n        private int numberOfCars;\n        private List<Address> addressList = ImmutableList.of();\n        private Map<String, Address> otherAddressMap = ImmutableMap.of();\n        private List<List<Address>> addressesList = ImmutableList.of();\n        private Address mainAddress;\n        private String[] tags;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(SimplePersonWithBuilderFinal beanToCopy) {\n            this.forename = beanToCopy.getForename();\n            this.surname = beanToCopy.getSurname();\n            this.numberOfCars = beanToCopy.getNumberOfCars();\n            this.addressList = ImmutableList.copyOf(beanToCopy.getAddressList());\n            this.otherAddressMap = ImmutableMap.copyOf(beanToCopy.getOtherAddressMap());\n            this.addressesList = ImmutableList.copyOf(beanToCopy.getAddressesList());\n            this.mainAddress = beanToCopy.getMainAddress();\n            this.tags = (beanToCopy.getTags() != null ? beanToCopy.getTags().clone() : null);\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return this.forename;\n                case -1852993317:  // surname\n                    return this.surname;\n                case 926656063:  // numberOfCars\n                    return this.numberOfCars;\n                case -1377524046:  // addressList\n                    return this.addressList;\n                case 1368089592:  // otherAddressMap\n                    return this.otherAddressMap;\n                case -226885792:  // addressesList\n                    return this.addressesList;\n                case -2032731141:  // mainAddress\n                    return this.mainAddress;\n                case 3552281:  // tags\n                    return this.tags;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    this.forename = (String) newValue;\n                    break;\n                case -1852993317:  // surname\n                    this.surname = (String) newValue;\n                    break;\n                case 926656063:  // numberOfCars\n                    this.numberOfCars = (Integer) newValue;\n                    break;\n                case -1377524046:  // addressList\n                    this.addressList = (List<Address>) newValue;\n                    break;\n                case 1368089592:  // otherAddressMap\n                    this.otherAddressMap = (Map<String, Address>) newValue;\n                    break;\n                case -226885792:  // addressesList\n                    this.addressesList = (List<List<Address>>) newValue;\n                    break;\n                case -2032731141:  // mainAddress\n                    this.mainAddress = (Address) newValue;\n                    break;\n                case 3552281:  // tags\n                    this.tags = (String[]) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public SimplePersonWithBuilderFinal build() {\n            return new SimplePersonWithBuilderFinal(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the forename.\n         * @param forename  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder forename(String forename) {\n            this.forename = forename;\n            return this;\n        }\n\n        /**\n         * Sets the surname.\n         * @param surname  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder surname(String surname) {\n            JodaBeanUtils.notNull(surname, \"surname\");\n            this.surname = surname;\n            return this;\n        }\n\n        /**\n         * Sets the number of cars.\n         * @param numberOfCars  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder numberOfCars(int numberOfCars) {\n            this.numberOfCars = numberOfCars;\n            return this;\n        }\n\n        /**\n         * Sets the addressList.\n         * @param addressList  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder addressList(List<Address> addressList) {\n            JodaBeanUtils.notNull(addressList, \"addressList\");\n            this.addressList = addressList;\n            return this;\n        }\n\n        /**\n         * Sets the {@code addressList} property in the builder\n         * from an array of objects.\n         * @param addressList  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder addressList(Address... addressList) {\n            return addressList(ImmutableList.copyOf(addressList));\n        }\n\n        /**\n         * Sets the otherAddressMap.\n         * @param otherAddressMap  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder otherAddressMap(Map<String, Address> otherAddressMap) {\n            JodaBeanUtils.notNull(otherAddressMap, \"otherAddressMap\");\n            this.otherAddressMap = otherAddressMap;\n            return this;\n        }\n\n        /**\n         * Sets the addressesList.\n         * @param addressesList  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder addressesList(List<List<Address>> addressesList) {\n            JodaBeanUtils.notNull(addressesList, \"addressesList\");\n            this.addressesList = addressesList;\n            return this;\n        }\n\n        /**\n         * Sets the {@code addressesList} property in the builder\n         * from an array of objects.\n         * @param addressesList  the new value, not null\n         * @return this, for chaining, not null\n         */\n        @SafeVarargs\n        public final Builder addressesList(List<Address>... addressesList) {\n            return addressesList(ImmutableList.copyOf(addressesList));\n        }\n\n        /**\n         * Sets the mainAddress.\n         * @param mainAddress  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder mainAddress(Address mainAddress) {\n            this.mainAddress = mainAddress;\n            return this;\n        }\n\n        /**\n         * Sets the tags.\n         * @param tags  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder tags(String... tags) {\n            this.tags = tags;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(288);\n            buf.append(\"SimplePersonWithBuilderFinal.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        protected void toString(StringBuilder buf) {\n            buf.append(\"forename\").append('=').append(JodaBeanUtils.toString(forename)).append(',').append(' ');\n            buf.append(\"surname\").append('=').append(JodaBeanUtils.toString(surname)).append(',').append(' ');\n            buf.append(\"numberOfCars\").append('=').append(JodaBeanUtils.toString(numberOfCars)).append(',').append(' ');\n            buf.append(\"addressList\").append('=').append(JodaBeanUtils.toString(addressList)).append(',').append(' ');\n            buf.append(\"otherAddressMap\").append('=').append(JodaBeanUtils.toString(otherAddressMap)).append(',').append(' ');\n            buf.append(\"addressesList\").append('=').append(JodaBeanUtils.toString(addressesList)).append(',').append(' ');\n            buf.append(\"mainAddress\").append('=').append(JodaBeanUtils.toString(mainAddress)).append(',').append(' ');\n            buf.append(\"tags\").append('=').append(JodaBeanUtils.toString(tags)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/SimplePersonWithBuilderNonFinal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\nimport com.google.common.collect.ImmutableList;\nimport com.google.common.collect.ImmutableMap;\n\n/**\n * Mock person JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(builderScope = \"public\")\npublic class SimplePersonWithBuilderNonFinal implements Cloneable, Bean {\n\n    /** The forename. */\n    @PropertyDefinition\n    private String forename;\n    /** The surname. */\n    @PropertyDefinition(validate = \"notNull\")\n    private final String surname;\n    /** The number of cars. */\n    @PropertyDefinition\n    private transient int numberOfCars;\n    @PropertyDefinition\n    private final List<Address> addressList = new ArrayList<>();\n    @PropertyDefinition(validate = \"notNull\")\n    private final Map<String, Address> otherAddressMap = new HashMap<>();\n    @PropertyDefinition(validate = \"notNull\")\n    private final List<List<Address>> addressesList = new ArrayList<>();\n    @PropertyDefinition\n    private Address mainAddress;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code SimplePersonWithBuilderNonFinal}.\n     * @return the meta-bean, not null\n     */\n    public static SimplePersonWithBuilderNonFinal.Meta meta() {\n        return SimplePersonWithBuilderNonFinal.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(SimplePersonWithBuilderNonFinal.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static SimplePersonWithBuilderNonFinal.Builder builder() {\n        return new SimplePersonWithBuilderNonFinal.Builder();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    protected SimplePersonWithBuilderNonFinal(SimplePersonWithBuilderNonFinal.Builder builder) {\n        JodaBeanUtils.notNull(builder.surname, \"surname\");\n        JodaBeanUtils.notNull(builder.addressList, \"addressList\");\n        JodaBeanUtils.notNull(builder.otherAddressMap, \"otherAddressMap\");\n        JodaBeanUtils.notNull(builder.addressesList, \"addressesList\");\n        this.forename = builder.forename;\n        this.surname = builder.surname;\n        this.numberOfCars = builder.numberOfCars;\n        this.addressList.addAll(builder.addressList);\n        this.otherAddressMap.putAll(builder.otherAddressMap);\n        this.addressesList.addAll(builder.addressesList);\n        this.mainAddress = builder.mainAddress;\n    }\n\n    @Override\n    public SimplePersonWithBuilderNonFinal.Meta metaBean() {\n        return SimplePersonWithBuilderNonFinal.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the forename.\n     * @return the value of the property\n     */\n    public String getForename() {\n        return forename;\n    }\n\n    /**\n     * Sets the forename.\n     * @param forename  the new value of the property\n     */\n    public void setForename(String forename) {\n        this.forename = forename;\n    }\n\n    /**\n     * Gets the the {@code forename} property.\n     * @return the property, not null\n     */\n    public final Property<String> forename() {\n        return metaBean().forename().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the surname.\n     * @return the value of the property, not null\n     */\n    public String getSurname() {\n        return surname;\n    }\n\n    /**\n     * Gets the the {@code surname} property.\n     * @return the property, not null\n     */\n    public final Property<String> surname() {\n        return metaBean().surname().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number of cars.\n     * @return the value of the property\n     */\n    public int getNumberOfCars() {\n        return numberOfCars;\n    }\n\n    /**\n     * Sets the number of cars.\n     * @param numberOfCars  the new value of the property\n     */\n    public void setNumberOfCars(int numberOfCars) {\n        this.numberOfCars = numberOfCars;\n    }\n\n    /**\n     * Gets the the {@code numberOfCars} property.\n     * @return the property, not null\n     */\n    public final Property<Integer> numberOfCars() {\n        return metaBean().numberOfCars().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the addressList.\n     * @return the value of the property, not null\n     */\n    public List<Address> getAddressList() {\n        return addressList;\n    }\n\n    /**\n     * Sets the addressList.\n     * @param addressList  the new value of the property, not null\n     */\n    public void setAddressList(List<Address> addressList) {\n        JodaBeanUtils.notNull(addressList, \"addressList\");\n        this.addressList.clear();\n        this.addressList.addAll(addressList);\n    }\n\n    /**\n     * Gets the the {@code addressList} property.\n     * @return the property, not null\n     */\n    public final Property<List<Address>> addressList() {\n        return metaBean().addressList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the otherAddressMap.\n     * @return the value of the property, not null\n     */\n    public Map<String, Address> getOtherAddressMap() {\n        return otherAddressMap;\n    }\n\n    /**\n     * Sets the otherAddressMap.\n     * @param otherAddressMap  the new value of the property, not null\n     */\n    public void setOtherAddressMap(Map<String, Address> otherAddressMap) {\n        JodaBeanUtils.notNull(otherAddressMap, \"otherAddressMap\");\n        this.otherAddressMap.clear();\n        this.otherAddressMap.putAll(otherAddressMap);\n    }\n\n    /**\n     * Gets the the {@code otherAddressMap} property.\n     * @return the property, not null\n     */\n    public final Property<Map<String, Address>> otherAddressMap() {\n        return metaBean().otherAddressMap().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the addressesList.\n     * @return the value of the property, not null\n     */\n    public List<List<Address>> getAddressesList() {\n        return addressesList;\n    }\n\n    /**\n     * Sets the addressesList.\n     * @param addressesList  the new value of the property, not null\n     */\n    public void setAddressesList(List<List<Address>> addressesList) {\n        JodaBeanUtils.notNull(addressesList, \"addressesList\");\n        this.addressesList.clear();\n        this.addressesList.addAll(addressesList);\n    }\n\n    /**\n     * Gets the the {@code addressesList} property.\n     * @return the property, not null\n     */\n    public final Property<List<List<Address>>> addressesList() {\n        return metaBean().addressesList().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the mainAddress.\n     * @return the value of the property\n     */\n    public Address getMainAddress() {\n        return mainAddress;\n    }\n\n    /**\n     * Sets the mainAddress.\n     * @param mainAddress  the new value of the property\n     */\n    public void setMainAddress(Address mainAddress) {\n        this.mainAddress = mainAddress;\n    }\n\n    /**\n     * Gets the the {@code mainAddress} property.\n     * @return the property, not null\n     */\n    public final Property<Address> mainAddress() {\n        return metaBean().mainAddress().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public SimplePersonWithBuilderNonFinal clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            SimplePersonWithBuilderNonFinal other = (SimplePersonWithBuilderNonFinal) obj;\n            return JodaBeanUtils.equal(this.getForename(), other.getForename()) &&\n                    JodaBeanUtils.equal(this.getSurname(), other.getSurname()) &&\n                    (this.getNumberOfCars() == other.getNumberOfCars()) &&\n                    JodaBeanUtils.equal(this.getAddressList(), other.getAddressList()) &&\n                    JodaBeanUtils.equal(this.getOtherAddressMap(), other.getOtherAddressMap()) &&\n                    JodaBeanUtils.equal(this.getAddressesList(), other.getAddressesList()) &&\n                    JodaBeanUtils.equal(this.getMainAddress(), other.getMainAddress());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getForename());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getSurname());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNumberOfCars());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getAddressList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getOtherAddressMap());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getAddressesList());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getMainAddress());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(256);\n        buf.append(\"SimplePersonWithBuilderNonFinal{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"forename\").append('=').append(JodaBeanUtils.toString(getForename())).append(',').append(' ');\n        buf.append(\"surname\").append('=').append(JodaBeanUtils.toString(getSurname())).append(',').append(' ');\n        buf.append(\"numberOfCars\").append('=').append(JodaBeanUtils.toString(getNumberOfCars())).append(',').append(' ');\n        buf.append(\"addressList\").append('=').append(JodaBeanUtils.toString(getAddressList())).append(',').append(' ');\n        buf.append(\"otherAddressMap\").append('=').append(JodaBeanUtils.toString(getOtherAddressMap())).append(',').append(' ');\n        buf.append(\"addressesList\").append('=').append(JodaBeanUtils.toString(getAddressesList())).append(',').append(' ');\n        buf.append(\"mainAddress\").append('=').append(JodaBeanUtils.toString(getMainAddress())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code SimplePersonWithBuilderNonFinal}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code forename} property.\n         */\n        private final MetaProperty<String> forename = DirectMetaProperty.ofReadWrite(\n                this, \"forename\", SimplePersonWithBuilderNonFinal.class, String.class);\n        /**\n         * The meta-property for the {@code surname} property.\n         */\n        private final MetaProperty<String> surname = DirectMetaProperty.ofReadOnlyBuildable(\n                this, \"surname\", SimplePersonWithBuilderNonFinal.class, String.class);\n        /**\n         * The meta-property for the {@code numberOfCars} property.\n         */\n        private final MetaProperty<Integer> numberOfCars = DirectMetaProperty.ofReadWrite(\n                this, \"numberOfCars\", SimplePersonWithBuilderNonFinal.class, Integer.TYPE);\n        /**\n         * The meta-property for the {@code addressList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<Address>> addressList = DirectMetaProperty.ofReadWrite(\n                this, \"addressList\", SimplePersonWithBuilderNonFinal.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code otherAddressMap} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Map<String, Address>> otherAddressMap = DirectMetaProperty.ofReadWrite(\n                this, \"otherAddressMap\", SimplePersonWithBuilderNonFinal.class, (Class) Map.class);\n        /**\n         * The meta-property for the {@code addressesList} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<List<List<Address>>> addressesList = DirectMetaProperty.ofReadWrite(\n                this, \"addressesList\", SimplePersonWithBuilderNonFinal.class, (Class) List.class);\n        /**\n         * The meta-property for the {@code mainAddress} property.\n         */\n        private final MetaProperty<Address> mainAddress = DirectMetaProperty.ofReadWrite(\n                this, \"mainAddress\", SimplePersonWithBuilderNonFinal.class, Address.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"forename\",\n                \"surname\",\n                \"numberOfCars\",\n                \"addressList\",\n                \"otherAddressMap\",\n                \"addressesList\",\n                \"mainAddress\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return this.forename;\n                case -1852993317:  // surname\n                    return this.surname;\n                case 926656063:  // numberOfCars\n                    return this.numberOfCars;\n                case -1377524046:  // addressList\n                    return this.addressList;\n                case 1368089592:  // otherAddressMap\n                    return this.otherAddressMap;\n                case -226885792:  // addressesList\n                    return this.addressesList;\n                case -2032731141:  // mainAddress\n                    return this.mainAddress;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public SimplePersonWithBuilderNonFinal.Builder builder() {\n            return new SimplePersonWithBuilderNonFinal.Builder();\n        }\n\n        @Override\n        public Class<? extends SimplePersonWithBuilderNonFinal> beanType() {\n            return SimplePersonWithBuilderNonFinal.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code forename} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> forename() {\n            return forename;\n        }\n\n        /**\n         * The meta-property for the {@code surname} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> surname() {\n            return surname;\n        }\n\n        /**\n         * The meta-property for the {@code numberOfCars} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Integer> numberOfCars() {\n            return numberOfCars;\n        }\n\n        /**\n         * The meta-property for the {@code addressList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<Address>> addressList() {\n            return addressList;\n        }\n\n        /**\n         * The meta-property for the {@code otherAddressMap} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Map<String, Address>> otherAddressMap() {\n            return otherAddressMap;\n        }\n\n        /**\n         * The meta-property for the {@code addressesList} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<List<List<Address>>> addressesList() {\n            return addressesList;\n        }\n\n        /**\n         * The meta-property for the {@code mainAddress} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Address> mainAddress() {\n            return mainAddress;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return ((SimplePersonWithBuilderNonFinal) bean).getForename();\n                case -1852993317:  // surname\n                    return ((SimplePersonWithBuilderNonFinal) bean).getSurname();\n                case 926656063:  // numberOfCars\n                    return ((SimplePersonWithBuilderNonFinal) bean).getNumberOfCars();\n                case -1377524046:  // addressList\n                    return ((SimplePersonWithBuilderNonFinal) bean).getAddressList();\n                case 1368089592:  // otherAddressMap\n                    return ((SimplePersonWithBuilderNonFinal) bean).getOtherAddressMap();\n                case -226885792:  // addressesList\n                    return ((SimplePersonWithBuilderNonFinal) bean).getAddressesList();\n                case -2032731141:  // mainAddress\n                    return ((SimplePersonWithBuilderNonFinal) bean).getMainAddress();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    ((SimplePersonWithBuilderNonFinal) bean).setForename((String) newValue);\n                    return;\n                case -1852993317:  // surname\n                    if (quiet) {\n                        return;\n                    }\n                    throw new UnsupportedOperationException(\"Property cannot be written: surname\");\n                case 926656063:  // numberOfCars\n                    ((SimplePersonWithBuilderNonFinal) bean).setNumberOfCars((Integer) newValue);\n                    return;\n                case -1377524046:  // addressList\n                    ((SimplePersonWithBuilderNonFinal) bean).setAddressList((List<Address>) newValue);\n                    return;\n                case 1368089592:  // otherAddressMap\n                    ((SimplePersonWithBuilderNonFinal) bean).setOtherAddressMap((Map<String, Address>) newValue);\n                    return;\n                case -226885792:  // addressesList\n                    ((SimplePersonWithBuilderNonFinal) bean).setAddressesList((List<List<Address>>) newValue);\n                    return;\n                case -2032731141:  // mainAddress\n                    ((SimplePersonWithBuilderNonFinal) bean).setMainAddress((Address) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n        @Override\n        protected void validate(Bean bean) {\n            JodaBeanUtils.notNull(((SimplePersonWithBuilderNonFinal) bean).surname, \"surname\");\n            JodaBeanUtils.notNull(((SimplePersonWithBuilderNonFinal) bean).addressList, \"addressList\");\n            JodaBeanUtils.notNull(((SimplePersonWithBuilderNonFinal) bean).otherAddressMap, \"otherAddressMap\");\n            JodaBeanUtils.notNull(((SimplePersonWithBuilderNonFinal) bean).addressesList, \"addressesList\");\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code SimplePersonWithBuilderNonFinal}.\n     */\n    public static class Builder extends DirectFieldsBeanBuilder<SimplePersonWithBuilderNonFinal> {\n\n        private String forename;\n        private String surname;\n        private int numberOfCars;\n        private List<Address> addressList = ImmutableList.of();\n        private Map<String, Address> otherAddressMap = ImmutableMap.of();\n        private List<List<Address>> addressesList = ImmutableList.of();\n        private Address mainAddress;\n\n        /**\n         * Restricted constructor.\n         */\n        protected Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        protected Builder(SimplePersonWithBuilderNonFinal beanToCopy) {\n            this.forename = beanToCopy.getForename();\n            this.surname = beanToCopy.getSurname();\n            this.numberOfCars = beanToCopy.getNumberOfCars();\n            this.addressList = ImmutableList.copyOf(beanToCopy.getAddressList());\n            this.otherAddressMap = ImmutableMap.copyOf(beanToCopy.getOtherAddressMap());\n            this.addressesList = ImmutableList.copyOf(beanToCopy.getAddressesList());\n            this.mainAddress = beanToCopy.getMainAddress();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    return this.forename;\n                case -1852993317:  // surname\n                    return this.surname;\n                case 926656063:  // numberOfCars\n                    return this.numberOfCars;\n                case -1377524046:  // addressList\n                    return this.addressList;\n                case 1368089592:  // otherAddressMap\n                    return this.otherAddressMap;\n                case -226885792:  // addressesList\n                    return this.addressesList;\n                case -2032731141:  // mainAddress\n                    return this.mainAddress;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 467061063:  // forename\n                    this.forename = (String) newValue;\n                    break;\n                case -1852993317:  // surname\n                    this.surname = (String) newValue;\n                    break;\n                case 926656063:  // numberOfCars\n                    this.numberOfCars = (Integer) newValue;\n                    break;\n                case -1377524046:  // addressList\n                    this.addressList = (List<Address>) newValue;\n                    break;\n                case 1368089592:  // otherAddressMap\n                    this.otherAddressMap = (Map<String, Address>) newValue;\n                    break;\n                case -226885792:  // addressesList\n                    this.addressesList = (List<List<Address>>) newValue;\n                    break;\n                case -2032731141:  // mainAddress\n                    this.mainAddress = (Address) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public SimplePersonWithBuilderNonFinal build() {\n            return new SimplePersonWithBuilderNonFinal(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the forename.\n         * @param forename  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder forename(String forename) {\n            this.forename = forename;\n            return this;\n        }\n\n        /**\n         * Sets the surname.\n         * @param surname  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder surname(String surname) {\n            JodaBeanUtils.notNull(surname, \"surname\");\n            this.surname = surname;\n            return this;\n        }\n\n        /**\n         * Sets the number of cars.\n         * @param numberOfCars  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder numberOfCars(int numberOfCars) {\n            this.numberOfCars = numberOfCars;\n            return this;\n        }\n\n        /**\n         * Sets the addressList.\n         * @param addressList  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder addressList(List<Address> addressList) {\n            JodaBeanUtils.notNull(addressList, \"addressList\");\n            this.addressList = addressList;\n            return this;\n        }\n\n        /**\n         * Sets the {@code addressList} property in the builder\n         * from an array of objects.\n         * @param addressList  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder addressList(Address... addressList) {\n            return addressList(ImmutableList.copyOf(addressList));\n        }\n\n        /**\n         * Sets the otherAddressMap.\n         * @param otherAddressMap  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder otherAddressMap(Map<String, Address> otherAddressMap) {\n            JodaBeanUtils.notNull(otherAddressMap, \"otherAddressMap\");\n            this.otherAddressMap = otherAddressMap;\n            return this;\n        }\n\n        /**\n         * Sets the addressesList.\n         * @param addressesList  the new value, not null\n         * @return this, for chaining, not null\n         */\n        public Builder addressesList(List<List<Address>> addressesList) {\n            JodaBeanUtils.notNull(addressesList, \"addressesList\");\n            this.addressesList = addressesList;\n            return this;\n        }\n\n        /**\n         * Sets the {@code addressesList} property in the builder\n         * from an array of objects.\n         * @param addressesList  the new value, not null\n         * @return this, for chaining, not null\n         */\n        @SafeVarargs\n        public final Builder addressesList(List<Address>... addressesList) {\n            return addressesList(ImmutableList.copyOf(addressesList));\n        }\n\n        /**\n         * Sets the mainAddress.\n         * @param mainAddress  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder mainAddress(Address mainAddress) {\n            this.mainAddress = mainAddress;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(256);\n            buf.append(\"SimplePersonWithBuilderNonFinal.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        protected void toString(StringBuilder buf) {\n            buf.append(\"forename\").append('=').append(JodaBeanUtils.toString(forename)).append(',').append(' ');\n            buf.append(\"surname\").append('=').append(JodaBeanUtils.toString(surname)).append(',').append(' ');\n            buf.append(\"numberOfCars\").append('=').append(JodaBeanUtils.toString(numberOfCars)).append(',').append(' ');\n            buf.append(\"addressList\").append('=').append(JodaBeanUtils.toString(addressList)).append(',').append(' ');\n            buf.append(\"otherAddressMap\").append('=').append(JodaBeanUtils.toString(otherAddressMap)).append(',').append(' ');\n            buf.append(\"addressesList\").append('=').append(JodaBeanUtils.toString(addressesList)).append(',').append(' ');\n            buf.append(\"mainAddress\").append('=').append(JodaBeanUtils.toString(mainAddress)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/SimpleSubPersonWithBuilderFinal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock person JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(builderScope = \"public\")\npublic final class SimpleSubPersonWithBuilderFinal extends SimplePersonWithBuilderNonFinal {\n\n    /** The middle name. */\n    @PropertyDefinition\n    private String middleName;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code SimpleSubPersonWithBuilderFinal}.\n     * @return the meta-bean, not null\n     */\n    public static SimpleSubPersonWithBuilderFinal.Meta meta() {\n        return SimpleSubPersonWithBuilderFinal.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(SimpleSubPersonWithBuilderFinal.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static SimpleSubPersonWithBuilderFinal.Builder builder() {\n        return new SimpleSubPersonWithBuilderFinal.Builder();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    private SimpleSubPersonWithBuilderFinal(SimpleSubPersonWithBuilderFinal.Builder builder) {\n        super(builder);\n        this.middleName = builder.middleName;\n    }\n\n    @Override\n    public SimpleSubPersonWithBuilderFinal.Meta metaBean() {\n        return SimpleSubPersonWithBuilderFinal.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the middle name.\n     * @return the value of the property\n     */\n    public String getMiddleName() {\n        return middleName;\n    }\n\n    /**\n     * Sets the middle name.\n     * @param middleName  the new value of the property\n     */\n    public void setMiddleName(String middleName) {\n        this.middleName = middleName;\n    }\n\n    /**\n     * Gets the the {@code middleName} property.\n     * @return the property, not null\n     */\n    public Property<String> middleName() {\n        return metaBean().middleName().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    @Override\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public SimpleSubPersonWithBuilderFinal clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            SimpleSubPersonWithBuilderFinal other = (SimpleSubPersonWithBuilderFinal) obj;\n            return JodaBeanUtils.equal(this.getMiddleName(), other.getMiddleName()) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        hash = hash * 31 + JodaBeanUtils.hashCode(getMiddleName());\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"SimpleSubPersonWithBuilderFinal{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"middleName\").append('=').append(JodaBeanUtils.toString(getMiddleName())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code SimpleSubPersonWithBuilderFinal}.\n     */\n    public static final class Meta extends SimplePersonWithBuilderNonFinal.Meta {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code middleName} property.\n         */\n        private final MetaProperty<String> middleName = DirectMetaProperty.ofReadWrite(\n                this, \"middleName\", SimpleSubPersonWithBuilderFinal.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"middleName\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    return this.middleName;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public SimpleSubPersonWithBuilderFinal.Builder builder() {\n            return new SimpleSubPersonWithBuilderFinal.Builder();\n        }\n\n        @Override\n        public Class<? extends SimpleSubPersonWithBuilderFinal> beanType() {\n            return SimpleSubPersonWithBuilderFinal.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code middleName} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> middleName() {\n            return middleName;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    return ((SimpleSubPersonWithBuilderFinal) bean).getMiddleName();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    ((SimpleSubPersonWithBuilderFinal) bean).setMiddleName((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code SimpleSubPersonWithBuilderFinal}.\n     */\n    public static final class Builder extends SimplePersonWithBuilderNonFinal.Builder {\n\n        private String middleName;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(SimpleSubPersonWithBuilderFinal beanToCopy) {\n            super(beanToCopy);\n            this.middleName = beanToCopy.getMiddleName();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    return this.middleName;\n                default:\n                    return super.get(propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    this.middleName = (String) newValue;\n                    break;\n                default:\n                    super.set(propertyName, newValue);\n                    break;\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public SimpleSubPersonWithBuilderFinal build() {\n            return new SimpleSubPersonWithBuilderFinal(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the middle name.\n         * @param middleName  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder middleName(String middleName) {\n            this.middleName = middleName;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"SimpleSubPersonWithBuilderFinal.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        @Override\n        protected void toString(StringBuilder buf) {\n            super.toString(buf);\n            buf.append(\"middleName\").append('=').append(JodaBeanUtils.toString(middleName)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/SimpleSubPersonWithBuilderNonFinal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock person JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(builderScope = \"public\")\npublic class SimpleSubPersonWithBuilderNonFinal extends SimplePersonWithBuilderNonFinal {\n\n    /** The middle name. */\n    @PropertyDefinition\n    private String middleName;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code SimpleSubPersonWithBuilderNonFinal}.\n     * @return the meta-bean, not null\n     */\n    public static SimpleSubPersonWithBuilderNonFinal.Meta meta() {\n        return SimpleSubPersonWithBuilderNonFinal.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(SimpleSubPersonWithBuilderNonFinal.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @return the builder, not null\n     */\n    public static SimpleSubPersonWithBuilderNonFinal.Builder builder() {\n        return new SimpleSubPersonWithBuilderNonFinal.Builder();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    protected SimpleSubPersonWithBuilderNonFinal(SimpleSubPersonWithBuilderNonFinal.Builder builder) {\n        super(builder);\n        this.middleName = builder.middleName;\n    }\n\n    @Override\n    public SimpleSubPersonWithBuilderNonFinal.Meta metaBean() {\n        return SimpleSubPersonWithBuilderNonFinal.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the middle name.\n     * @return the value of the property\n     */\n    public String getMiddleName() {\n        return middleName;\n    }\n\n    /**\n     * Sets the middle name.\n     * @param middleName  the new value of the property\n     */\n    public void setMiddleName(String middleName) {\n        this.middleName = middleName;\n    }\n\n    /**\n     * Gets the the {@code middleName} property.\n     * @return the property, not null\n     */\n    public final Property<String> middleName() {\n        return metaBean().middleName().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    @Override\n    public Builder toBuilder() {\n        return new Builder(this);\n    }\n\n    @Override\n    public SimpleSubPersonWithBuilderNonFinal clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            SimpleSubPersonWithBuilderNonFinal other = (SimpleSubPersonWithBuilderNonFinal) obj;\n            return JodaBeanUtils.equal(this.getMiddleName(), other.getMiddleName()) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        hash = hash * 31 + JodaBeanUtils.hashCode(getMiddleName());\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"SimpleSubPersonWithBuilderNonFinal{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"middleName\").append('=').append(JodaBeanUtils.toString(getMiddleName())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code SimpleSubPersonWithBuilderNonFinal}.\n     */\n    public static class Meta extends SimplePersonWithBuilderNonFinal.Meta {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code middleName} property.\n         */\n        private final MetaProperty<String> middleName = DirectMetaProperty.ofReadWrite(\n                this, \"middleName\", SimpleSubPersonWithBuilderNonFinal.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"middleName\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    return this.middleName;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public SimpleSubPersonWithBuilderNonFinal.Builder builder() {\n            return new SimpleSubPersonWithBuilderNonFinal.Builder();\n        }\n\n        @Override\n        public Class<? extends SimpleSubPersonWithBuilderNonFinal> beanType() {\n            return SimpleSubPersonWithBuilderNonFinal.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code middleName} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> middleName() {\n            return middleName;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    return ((SimpleSubPersonWithBuilderNonFinal) bean).getMiddleName();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    ((SimpleSubPersonWithBuilderNonFinal) bean).setMiddleName((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code SimpleSubPersonWithBuilderNonFinal}.\n     */\n    public static class Builder extends SimplePersonWithBuilderNonFinal.Builder {\n\n        private String middleName;\n\n        /**\n         * Restricted constructor.\n         */\n        protected Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        protected Builder(SimpleSubPersonWithBuilderNonFinal beanToCopy) {\n            super(beanToCopy);\n            this.middleName = beanToCopy.getMiddleName();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    return this.middleName;\n                default:\n                    return super.get(propertyName);\n            }\n        }\n\n        @Override\n        public Builder set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case -818219584:  // middleName\n                    this.middleName = (String) newValue;\n                    break;\n                default:\n                    super.set(propertyName, newValue);\n                    break;\n            }\n            return this;\n        }\n\n        @Override\n        public Builder set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public SimpleSubPersonWithBuilderNonFinal build() {\n            return new SimpleSubPersonWithBuilderNonFinal(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the middle name.\n         * @param middleName  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder middleName(String middleName) {\n            this.middleName = middleName;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"SimpleSubPersonWithBuilderNonFinal.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        @Override\n        protected void toString(StringBuilder buf) {\n            super.toString(buf);\n            buf.append(\"middleName\").append('=').append(JodaBeanUtils.toString(middleName)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/SubDecimal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\n\n/**\n * Mock, used for testing.\n */\npublic class SubDecimal extends BigDecimal {\n\n    private static final long serialVersionUID = 1L;\n\n    public SubDecimal(BigInteger val) {\n        super(val);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/SubPerson.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock sub person, a generic sub-class of a non-generic superclass.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(metaScope = \"public\")\npublic class SubPerson<T> extends DirectBean {\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code SubPerson}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static SubPerson.Meta meta() {\n        return SubPerson.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code SubPerson}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R> SubPerson.Meta<R> metaSubPerson(Class<R> cls) {\n        return SubPerson.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(SubPerson.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public SubPerson.Meta<T> metaBean() {\n        return SubPerson.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public SubPerson<T> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(32);\n        buf.append(\"SubPerson{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code SubPerson}.\n     * @param <T>  the type\n     */\n    public static class Meta<T> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null);\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        public BeanBuilder<? extends SubPerson<T>> builder() {\n            return new DirectBeanBuilder<>(new SubPerson<T>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends SubPerson<T>> beanType() {\n            return (Class) SubPerson.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/SubValidateBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock used for subclass validation.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class SubValidateBean extends ValidateBean {\n\n    /**\n     * The sub non-null value.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private String sub;\n\n    public SubValidateBean() {\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code SubValidateBean}.\n     * @return the meta-bean, not null\n     */\n    public static SubValidateBean.Meta meta() {\n        return SubValidateBean.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(SubValidateBean.Meta.INSTANCE);\n    }\n\n    @Override\n    public SubValidateBean.Meta metaBean() {\n        return SubValidateBean.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the sub non-null value.\n     * @return the value of the property, not null\n     */\n    public String getSub() {\n        return sub;\n    }\n\n    /**\n     * Sets the sub non-null value.\n     * @param sub  the new value of the property, not null\n     */\n    public void setSub(String sub) {\n        JodaBeanUtils.notNull(sub, \"sub\");\n        this.sub = sub;\n    }\n\n    /**\n     * Gets the the {@code sub} property.\n     * @return the property, not null\n     */\n    public final Property<String> sub() {\n        return metaBean().sub().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public SubValidateBean clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            SubValidateBean other = (SubValidateBean) obj;\n            return JodaBeanUtils.equal(this.getSub(), other.getSub()) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        hash = hash * 31 + JodaBeanUtils.hashCode(getSub());\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"SubValidateBean{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"sub\").append('=').append(JodaBeanUtils.toString(getSub())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code SubValidateBean}.\n     */\n    public static class Meta extends ValidateBean.Meta {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code sub} property.\n         */\n        private final MetaProperty<String> sub = DirectMetaProperty.ofReadWrite(\n                this, \"sub\", SubValidateBean.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"sub\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 114240:  // sub\n                    return this.sub;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends SubValidateBean> builder() {\n            return new DirectBeanBuilder<>(new SubValidateBean());\n        }\n\n        @Override\n        public Class<? extends SubValidateBean> beanType() {\n            return SubValidateBean.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code sub} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> sub() {\n            return sub;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 114240:  // sub\n                    return ((SubValidateBean) bean).getSub();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 114240:  // sub\n                    ((SubValidateBean) bean).setSub((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n        @Override\n        protected void validate(Bean bean) {\n            JodaBeanUtils.notNull(((SubValidateBean) bean).sub, \"sub\");\n            super.validate(bean);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/SubWrapper.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class SubWrapper extends Wrapper<CompanyAddress> {\n\n    /** The name. */\n    @PropertyDefinition\n    private String name;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code SubWrapper}.\n     * @return the meta-bean, not null\n     */\n    public static SubWrapper.Meta meta() {\n        return SubWrapper.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(SubWrapper.Meta.INSTANCE);\n    }\n\n    @Override\n    public SubWrapper.Meta metaBean() {\n        return SubWrapper.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property\n     */\n    public String getName() {\n        return name;\n    }\n\n    /**\n     * Sets the name.\n     * @param name  the new value of the property\n     */\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    /**\n     * Gets the the {@code name} property.\n     * @return the property, not null\n     */\n    public final Property<String> name() {\n        return metaBean().name().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public SubWrapper clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            SubWrapper other = (SubWrapper) obj;\n            return JodaBeanUtils.equal(this.getName(), other.getName()) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        hash = hash * 31 + JodaBeanUtils.hashCode(getName());\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"SubWrapper{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"name\").append('=').append(JodaBeanUtils.toString(getName())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code SubWrapper}.\n     */\n    public static class Meta extends Wrapper.Meta<CompanyAddress> {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code name} property.\n         */\n        private final MetaProperty<String> name = DirectMetaProperty.ofReadWrite(\n                this, \"name\", SubWrapper.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"name\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends SubWrapper> builder() {\n            return new DirectBeanBuilder<>(new SubWrapper());\n        }\n\n        @Override\n        public Class<? extends SubWrapper> beanType() {\n            return SubWrapper.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code name} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> name() {\n            return name;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return ((SubWrapper) bean).getName();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    ((SubWrapper) bean).setName((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/TestRWOnlyBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatExceptionOfType;\n\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test RWOnlyBean.\n */\npublic class TestRWOnlyBean extends RWOnlyBean {\n\n    @Test\n    public void test_ro() {\n        assertThat(getRo()).isNull();\n        assertThat(ro().get()).isNull();\n    }\n\n    @Test\n    public void test_wo1() {\n        setWo(\"woo\");\n        assertThatExceptionOfType(UnsupportedOperationException.class)\n                .isThrownBy(() -> property(\"wo\").get());\n    }\n\n    @Test\n    public void test_wo2() {\n        setWo(\"woo\");\n        assertThatExceptionOfType(UnsupportedOperationException.class)\n                .isThrownBy(() -> wo().get());\n    }\n\n    @Test\n    public void test_manualGet() {\n        assertThat(getManualGet()).isEqualTo(\"goo\");\n        assertThat(manualGet().get()).isEqualTo(\"goo\");\n    }\n\n    @Test\n    public void test_derived() {\n        assertThat(getDerived()).isEqualTo(\"drv\");\n        assertThat(derived().get()).isEqualTo(\"drv\");\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/TupleFinal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock tuple, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(builderScope = \"package\", metaScope = \"package\")\npublic final class TupleFinal<X, Y, Z> implements Bean {\n\n    /**\n     * The first value.\n     */\n    @PropertyDefinition\n    private X first;\n    /**\n     * The second value.\n     */\n    @PropertyDefinition\n    private Y second;\n    /**\n     * The third value.\n     */\n    @PropertyDefinition\n    private Z third;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code TupleFinal}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static TupleFinal.Meta meta() {\n        return TupleFinal.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code TupleFinal}.\n     * @param <R>  the first generic type\n     * @param <S>  the second generic type\n     * @param <T>  the second generic type\n     * @param cls1  the first generic type\n     * @param cls2  the second generic type\n     * @param cls3  the third generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R, S, T> TupleFinal.Meta<R, S, T> metaTupleFinal(Class<R> cls1, Class<S> cls2, Class<T> cls3) {\n        return TupleFinal.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(TupleFinal.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @param <X>  the type\n     * @param <Y>  the type\n     * @param <Z>  the type\n     * @return the builder, not null\n     */\n    static <X, Y, Z> TupleFinal.Builder<X, Y, Z> builder() {\n        return new TupleFinal.Builder<>();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    private TupleFinal(TupleFinal.Builder<X, Y, Z> builder) {\n        this.first = builder.first;\n        this.second = builder.second;\n        this.third = builder.third;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public TupleFinal.Meta<X, Y, Z> metaBean() {\n        return TupleFinal.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the first value.\n     * @return the value of the property\n     */\n    public X getFirst() {\n        return first;\n    }\n\n    /**\n     * Sets the first value.\n     * @param first  the new value of the property\n     */\n    public void setFirst(X first) {\n        this.first = first;\n    }\n\n    /**\n     * Gets the the {@code first} property.\n     * @return the property, not null\n     */\n    public Property<X> first() {\n        return metaBean().first().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the second value.\n     * @return the value of the property\n     */\n    public Y getSecond() {\n        return second;\n    }\n\n    /**\n     * Sets the second value.\n     * @param second  the new value of the property\n     */\n    public void setSecond(Y second) {\n        this.second = second;\n    }\n\n    /**\n     * Gets the the {@code second} property.\n     * @return the property, not null\n     */\n    public Property<Y> second() {\n        return metaBean().second().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the third value.\n     * @return the value of the property\n     */\n    public Z getThird() {\n        return third;\n    }\n\n    /**\n     * Sets the third value.\n     * @param third  the new value of the property\n     */\n    public void setThird(Z third) {\n        this.third = third;\n    }\n\n    /**\n     * Gets the the {@code third} property.\n     * @return the property, not null\n     */\n    public Property<Z> third() {\n        return metaBean().third().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    Builder<X, Y, Z> toBuilder() {\n        return new Builder<>(this);\n    }\n\n    @Override\n    public TupleFinal<X, Y, Z> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            TupleFinal<?, ?, ?> other = (TupleFinal<?, ?, ?>) obj;\n            return JodaBeanUtils.equal(this.getFirst(), other.getFirst()) &&\n                    JodaBeanUtils.equal(this.getSecond(), other.getSecond()) &&\n                    JodaBeanUtils.equal(this.getThird(), other.getThird());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getFirst());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getSecond());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getThird());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(128);\n        buf.append(\"TupleFinal{\");\n        buf.append(\"first\").append('=').append(JodaBeanUtils.toString(getFirst())).append(',').append(' ');\n        buf.append(\"second\").append('=').append(JodaBeanUtils.toString(getSecond())).append(',').append(' ');\n        buf.append(\"third\").append('=').append(JodaBeanUtils.toString(getThird()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code TupleFinal}.\n     * @param <X>  the type\n     * @param <Y>  the type\n     * @param <Z>  the type\n     */\n    static final class Meta<X, Y, Z> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code first} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<X> first = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"first\", TupleFinal.class, Object.class);\n        /**\n         * The meta-property for the {@code second} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Y> second = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"second\", TupleFinal.class, Object.class);\n        /**\n         * The meta-property for the {@code third} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Z> third = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"third\", TupleFinal.class, Object.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"first\",\n                \"second\",\n                \"third\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    return this.first;\n                case -906279820:  // second\n                    return this.second;\n                case 110331239:  // third\n                    return this.third;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public TupleFinal.Builder<X, Y, Z> builder() {\n            return new TupleFinal.Builder<>();\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends TupleFinal<X, Y, Z>> beanType() {\n            return (Class) TupleFinal.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code first} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<X> first() {\n            return first;\n        }\n\n        /**\n         * The meta-property for the {@code second} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Y> second() {\n            return second;\n        }\n\n        /**\n         * The meta-property for the {@code third} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Z> third() {\n            return third;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    return ((TupleFinal<?, ?, ?>) bean).getFirst();\n                case -906279820:  // second\n                    return ((TupleFinal<?, ?, ?>) bean).getSecond();\n                case 110331239:  // third\n                    return ((TupleFinal<?, ?, ?>) bean).getThird();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    ((TupleFinal<X, Y, Z>) bean).setFirst((X) newValue);\n                    return;\n                case -906279820:  // second\n                    ((TupleFinal<X, Y, Z>) bean).setSecond((Y) newValue);\n                    return;\n                case 110331239:  // third\n                    ((TupleFinal<X, Y, Z>) bean).setThird((Z) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code TupleFinal}.\n     * @param <X>  the type\n     * @param <Y>  the type\n     * @param <Z>  the type\n     */\n    static final class Builder<X, Y, Z> extends DirectFieldsBeanBuilder<TupleFinal<X, Y, Z>> {\n\n        private X first;\n        private Y second;\n        private Z third;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(TupleFinal<X, Y, Z> beanToCopy) {\n            this.first = beanToCopy.getFirst();\n            this.second = beanToCopy.getSecond();\n            this.third = beanToCopy.getThird();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    return this.first;\n                case -906279820:  // second\n                    return this.second;\n                case 110331239:  // third\n                    return this.third;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder<X, Y, Z> set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    this.first = (X) newValue;\n                    break;\n                case -906279820:  // second\n                    this.second = (Y) newValue;\n                    break;\n                case 110331239:  // third\n                    this.third = (Z) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder<X, Y, Z> set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public TupleFinal<X, Y, Z> build() {\n            return new TupleFinal<>(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the first value.\n         * @param first  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder<X, Y, Z> first(X first) {\n            this.first = first;\n            return this;\n        }\n\n        /**\n         * Sets the second value.\n         * @param second  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder<X, Y, Z> second(Y second) {\n            this.second = second;\n            return this;\n        }\n\n        /**\n         * Sets the third value.\n         * @param third  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder<X, Y, Z> third(Z third) {\n            this.third = third;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(128);\n            buf.append(\"TupleFinal.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        protected void toString(StringBuilder buf) {\n            buf.append(\"first\").append('=').append(JodaBeanUtils.toString(first)).append(',').append(' ');\n            buf.append(\"second\").append('=').append(JodaBeanUtils.toString(second)).append(',').append(' ');\n            buf.append(\"third\").append('=').append(JodaBeanUtils.toString(third)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/TupleImmutable.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock tuple, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition(metaScope = \"package\")\npublic final class TupleImmutable<X, Y, Z extends Address> implements ImmutableBean {\n\n    /**\n     * The first value.\n     */\n    @PropertyDefinition\n    private final X first;\n    /**\n     * The second value.\n     */\n    @PropertyDefinition\n    private final Y second;\n    /**\n     * The third value.\n     */\n    @PropertyDefinition\n    private final Z third;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code TupleImmutable}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static TupleImmutable.Meta meta() {\n        return TupleImmutable.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code TupleImmutable}.\n     * @param <R>  the first generic type\n     * @param <S>  the second generic type\n     * @param <T>  the second generic type\n     * @param cls1  the first generic type\n     * @param cls2  the second generic type\n     * @param cls3  the third generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R, S, T extends Address> TupleImmutable.Meta<R, S, T> metaTupleImmutable(Class<R> cls1, Class<S> cls2, Class<T> cls3) {\n        return TupleImmutable.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(TupleImmutable.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @param <X>  the type\n     * @param <Y>  the type\n     * @param <Z>  the type\n     * @return the builder, not null\n     */\n    public static <X, Y, Z extends Address> TupleImmutable.Builder<X, Y, Z> builder() {\n        return new TupleImmutable.Builder<>();\n    }\n\n    private TupleImmutable(\n            X first,\n            Y second,\n            Z third) {\n        this.first = first;\n        this.second = second;\n        this.third = third;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public TupleImmutable.Meta<X, Y, Z> metaBean() {\n        return TupleImmutable.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the first value.\n     * @return the value of the property\n     */\n    public X getFirst() {\n        return first;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the second value.\n     * @return the value of the property\n     */\n    public Y getSecond() {\n        return second;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the third value.\n     * @return the value of the property\n     */\n    public Z getThird() {\n        return third;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder<X, Y, Z> toBuilder() {\n        return new Builder<>(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            TupleImmutable<?, ?, ?> other = (TupleImmutable<?, ?, ?>) obj;\n            return JodaBeanUtils.equal(this.first, other.first) &&\n                    JodaBeanUtils.equal(this.second, other.second) &&\n                    JodaBeanUtils.equal(this.third, other.third);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(first);\n        hash = hash * 31 + JodaBeanUtils.hashCode(second);\n        hash = hash * 31 + JodaBeanUtils.hashCode(third);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(128);\n        buf.append(\"TupleImmutable{\");\n        buf.append(\"first\").append('=').append(JodaBeanUtils.toString(first)).append(',').append(' ');\n        buf.append(\"second\").append('=').append(JodaBeanUtils.toString(second)).append(',').append(' ');\n        buf.append(\"third\").append('=').append(JodaBeanUtils.toString(third));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code TupleImmutable}.\n     * @param <X>  the type\n     * @param <Y>  the type\n     * @param <Z>  the type\n     */\n    static final class Meta<X, Y, Z extends Address> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code first} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<X> first = (DirectMetaProperty) DirectMetaProperty.ofImmutable(\n                this, \"first\", TupleImmutable.class, Object.class);\n        /**\n         * The meta-property for the {@code second} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Y> second = (DirectMetaProperty) DirectMetaProperty.ofImmutable(\n                this, \"second\", TupleImmutable.class, Object.class);\n        /**\n         * The meta-property for the {@code third} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Z> third = (DirectMetaProperty) DirectMetaProperty.ofImmutable(\n                this, \"third\", TupleImmutable.class, Object.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"first\",\n                \"second\",\n                \"third\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    return this.first;\n                case -906279820:  // second\n                    return this.second;\n                case 110331239:  // third\n                    return this.third;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public TupleImmutable.Builder<X, Y, Z> builder() {\n            return new TupleImmutable.Builder<>();\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends TupleImmutable<X, Y, Z>> beanType() {\n            return (Class) TupleImmutable.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code first} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<X> first() {\n            return first;\n        }\n\n        /**\n         * The meta-property for the {@code second} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Y> second() {\n            return second;\n        }\n\n        /**\n         * The meta-property for the {@code third} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Z> third() {\n            return third;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    return ((TupleImmutable<?, ?, ?>) bean).getFirst();\n                case -906279820:  // second\n                    return ((TupleImmutable<?, ?, ?>) bean).getSecond();\n                case 110331239:  // third\n                    return ((TupleImmutable<?, ?, ?>) bean).getThird();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code TupleImmutable}.\n     * @param <X>  the type\n     * @param <Y>  the type\n     * @param <Z>  the type\n     */\n    public static final class Builder<X, Y, Z extends Address> extends DirectFieldsBeanBuilder<TupleImmutable<X, Y, Z>> {\n\n        private X first;\n        private Y second;\n        private Z third;\n\n        /**\n         * Restricted constructor.\n         */\n        private Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        private Builder(TupleImmutable<X, Y, Z> beanToCopy) {\n            this.first = beanToCopy.getFirst();\n            this.second = beanToCopy.getSecond();\n            this.third = beanToCopy.getThird();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    return this.first;\n                case -906279820:  // second\n                    return this.second;\n                case 110331239:  // third\n                    return this.third;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder<X, Y, Z> set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    this.first = (X) newValue;\n                    break;\n                case -906279820:  // second\n                    this.second = (Y) newValue;\n                    break;\n                case 110331239:  // third\n                    this.third = (Z) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder<X, Y, Z> set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public TupleImmutable<X, Y, Z> build() {\n            return new TupleImmutable<>(\n                    first,\n                    second,\n                    third);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the first value.\n         * @param first  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder<X, Y, Z> first(X first) {\n            this.first = first;\n            return this;\n        }\n\n        /**\n         * Sets the second value.\n         * @param second  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder<X, Y, Z> second(Y second) {\n            this.second = second;\n            return this;\n        }\n\n        /**\n         * Sets the third value.\n         * @param third  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder<X, Y, Z> third(Z third) {\n            this.third = third;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(128);\n            buf.append(\"TupleImmutable.Builder{\");\n            buf.append(\"first\").append('=').append(JodaBeanUtils.toString(first)).append(',').append(' ');\n            buf.append(\"second\").append('=').append(JodaBeanUtils.toString(second)).append(',').append(' ');\n            buf.append(\"third\").append('=').append(JodaBeanUtils.toString(third));\n            buf.append('}');\n            return buf.toString();\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/TupleNonFinal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock tuple, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class TupleNonFinal<X, Y, Z> extends DirectBean {\n\n    /**\n     * The first value.\n     */\n    @PropertyDefinition\n    private X first;\n    /**\n     * The second value.\n     */\n    @PropertyDefinition\n    private Y second;\n    /**\n     * The third value.\n     */\n    @PropertyDefinition\n    private Z third;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code TupleNonFinal}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static TupleNonFinal.Meta meta() {\n        return TupleNonFinal.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code TupleNonFinal}.\n     * @param <R>  the first generic type\n     * @param <S>  the second generic type\n     * @param <T>  the second generic type\n     * @param cls1  the first generic type\n     * @param cls2  the second generic type\n     * @param cls3  the third generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R, S, T> TupleNonFinal.Meta<R, S, T> metaTupleNonFinal(Class<R> cls1, Class<S> cls2, Class<T> cls3) {\n        return TupleNonFinal.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(TupleNonFinal.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public TupleNonFinal.Meta<X, Y, Z> metaBean() {\n        return TupleNonFinal.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the first value.\n     * @return the value of the property\n     */\n    public X getFirst() {\n        return first;\n    }\n\n    /**\n     * Sets the first value.\n     * @param first  the new value of the property\n     */\n    public void setFirst(X first) {\n        this.first = first;\n    }\n\n    /**\n     * Gets the the {@code first} property.\n     * @return the property, not null\n     */\n    public final Property<X> first() {\n        return metaBean().first().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the second value.\n     * @return the value of the property\n     */\n    public Y getSecond() {\n        return second;\n    }\n\n    /**\n     * Sets the second value.\n     * @param second  the new value of the property\n     */\n    public void setSecond(Y second) {\n        this.second = second;\n    }\n\n    /**\n     * Gets the the {@code second} property.\n     * @return the property, not null\n     */\n    public final Property<Y> second() {\n        return metaBean().second().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the third value.\n     * @return the value of the property\n     */\n    public Z getThird() {\n        return third;\n    }\n\n    /**\n     * Sets the third value.\n     * @param third  the new value of the property\n     */\n    public void setThird(Z third) {\n        this.third = third;\n    }\n\n    /**\n     * Gets the the {@code third} property.\n     * @return the property, not null\n     */\n    public final Property<Z> third() {\n        return metaBean().third().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public TupleNonFinal<X, Y, Z> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            TupleNonFinal<?, ?, ?> other = (TupleNonFinal<?, ?, ?>) obj;\n            return JodaBeanUtils.equal(this.getFirst(), other.getFirst()) &&\n                    JodaBeanUtils.equal(this.getSecond(), other.getSecond()) &&\n                    JodaBeanUtils.equal(this.getThird(), other.getThird());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getFirst());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getSecond());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getThird());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(128);\n        buf.append(\"TupleNonFinal{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"first\").append('=').append(JodaBeanUtils.toString(getFirst())).append(',').append(' ');\n        buf.append(\"second\").append('=').append(JodaBeanUtils.toString(getSecond())).append(',').append(' ');\n        buf.append(\"third\").append('=').append(JodaBeanUtils.toString(getThird())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code TupleNonFinal}.\n     * @param <X>  the type\n     * @param <Y>  the type\n     * @param <Z>  the type\n     */\n    public static class Meta<X, Y, Z> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code first} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<X> first = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"first\", TupleNonFinal.class, Object.class);\n        /**\n         * The meta-property for the {@code second} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Y> second = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"second\", TupleNonFinal.class, Object.class);\n        /**\n         * The meta-property for the {@code third} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<Z> third = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"third\", TupleNonFinal.class, Object.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"first\",\n                \"second\",\n                \"third\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    return this.first;\n                case -906279820:  // second\n                    return this.second;\n                case 110331239:  // third\n                    return this.third;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends TupleNonFinal<X, Y, Z>> builder() {\n            return new DirectBeanBuilder<>(new TupleNonFinal<X, Y, Z>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends TupleNonFinal<X, Y, Z>> beanType() {\n            return (Class) TupleNonFinal.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code first} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<X> first() {\n            return first;\n        }\n\n        /**\n         * The meta-property for the {@code second} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Y> second() {\n            return second;\n        }\n\n        /**\n         * The meta-property for the {@code third} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<Z> third() {\n            return third;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    return ((TupleNonFinal<?, ?, ?>) bean).getFirst();\n                case -906279820:  // second\n                    return ((TupleNonFinal<?, ?, ?>) bean).getSecond();\n                case 110331239:  // third\n                    return ((TupleNonFinal<?, ?, ?>) bean).getThird();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    ((TupleNonFinal<X, Y, Z>) bean).setFirst((X) newValue);\n                    return;\n                case -906279820:  // second\n                    ((TupleNonFinal<X, Y, Z>) bean).setSecond((Y) newValue);\n                    return;\n                case 110331239:  // third\n                    ((TupleNonFinal<X, Y, Z>) bean).setThird((Z) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/TupleSub.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock tuple, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic final class TupleSub<X extends Number, Y extends Number, Z> extends TupleNonFinal<X, Y, Z> {\n\n    @PropertyDefinition\n    private String name;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code TupleSub}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static TupleSub.Meta meta() {\n        return TupleSub.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code TupleSub}.\n     * @param <R>  the first generic type\n     * @param <S>  the second generic type\n     * @param <T>  the second generic type\n     * @param cls1  the first generic type\n     * @param cls2  the second generic type\n     * @param cls3  the third generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Number, S extends Number, T> TupleSub.Meta<R, S, T> metaTupleSub(Class<R> cls1, Class<S> cls2, Class<T> cls3) {\n        return TupleSub.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(TupleSub.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public TupleSub.Meta<X, Y, Z> metaBean() {\n        return TupleSub.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the name.\n     * @return the value of the property\n     */\n    public String getName() {\n        return name;\n    }\n\n    /**\n     * Sets the name.\n     * @param name  the new value of the property\n     */\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    /**\n     * Gets the the {@code name} property.\n     * @return the property, not null\n     */\n    public Property<String> name() {\n        return metaBean().name().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public TupleSub<X, Y, Z> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            TupleSub<?, ?, ?> other = (TupleSub<?, ?, ?>) obj;\n            return JodaBeanUtils.equal(this.getName(), other.getName()) &&\n                    super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        hash = hash * 31 + JodaBeanUtils.hashCode(getName());\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"TupleSub{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n        buf.append(\"name\").append('=').append(JodaBeanUtils.toString(getName())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code TupleSub}.\n     * @param <X>  the type\n     * @param <Y>  the type\n     * @param <Z>  the type\n     */\n    public static final class Meta<X extends Number, Y extends Number, Z> extends TupleNonFinal.Meta<X, Y, Z> {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code name} property.\n         */\n        private final MetaProperty<String> name = DirectMetaProperty.ofReadWrite(\n                this, \"name\", TupleSub.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap(),\n                \"name\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return this.name;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends TupleSub<X, Y, Z>> builder() {\n            return new DirectBeanBuilder<>(new TupleSub<X, Y, Z>());\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends TupleSub<X, Y, Z>> beanType() {\n            return (Class) TupleSub.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code name} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> name() {\n            return name;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    return ((TupleSub<?, ?, ?>) bean).getName();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3373707:  // name\n                    ((TupleSub<X, Y, Z>) bean).setName((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/TweakedPair.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock pair, used for testing.\n * This class adds no extra properties.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class TweakedPair extends Pair {\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code TweakedPair}.\n     * @return the meta-bean, not null\n     */\n    public static TweakedPair.Meta meta() {\n        return TweakedPair.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(TweakedPair.Meta.INSTANCE);\n    }\n\n    @Override\n    public TweakedPair.Meta metaBean() {\n        return TweakedPair.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public TweakedPair clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            return super.equals(obj);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 7;\n        return hash ^ super.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(32);\n        buf.append(\"TweakedPair{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    @Override\n    protected void toString(StringBuilder buf) {\n        super.toString(buf);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code TweakedPair}.\n     */\n    public static class Meta extends Pair.Meta {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, (DirectMetaPropertyMap) super.metaPropertyMap());\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        public BeanBuilder<? extends TweakedPair> builder() {\n            return new DirectBeanBuilder<>(new TweakedPair());\n        }\n\n        @Override\n        public Class<? extends TweakedPair> beanType() {\n            return TweakedPair.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/UserAccount.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Date;\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * A user account class, used to demonstrate usage of Joda-Beans.\n */\n@BeanDefinition\npublic final class UserAccount implements Bean {\n\n    /**\n     * The user identifier.\n     */\n    @PropertyDefinition(validate = \"notEmpty\")\n    private String userId;\n    /**\n     * The email address.\n     */\n    @PropertyDefinition(validate = \"notEmpty\")\n    private String emailAddress;\n    /**\n     * The number of logins.\n     */\n    @PropertyDefinition\n    private int numberLogins;\n    /**\n     * The last login instant.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private Date lastLogin;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code UserAccount}.\n     * @return the meta-bean, not null\n     */\n    public static UserAccount.Meta meta() {\n        return UserAccount.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(UserAccount.Meta.INSTANCE);\n    }\n\n    @Override\n    public UserAccount.Meta metaBean() {\n        return UserAccount.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the user identifier.\n     * @return the value of the property, not empty\n     */\n    public String getUserId() {\n        return userId;\n    }\n\n    /**\n     * Sets the user identifier.\n     * @param userId  the new value of the property, not empty\n     */\n    public void setUserId(String userId) {\n        JodaBeanUtils.notEmpty(userId, \"userId\");\n        this.userId = userId;\n    }\n\n    /**\n     * Gets the the {@code userId} property.\n     * @return the property, not null\n     */\n    public Property<String> userId() {\n        return metaBean().userId().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the email address.\n     * @return the value of the property, not empty\n     */\n    public String getEmailAddress() {\n        return emailAddress;\n    }\n\n    /**\n     * Sets the email address.\n     * @param emailAddress  the new value of the property, not empty\n     */\n    public void setEmailAddress(String emailAddress) {\n        JodaBeanUtils.notEmpty(emailAddress, \"emailAddress\");\n        this.emailAddress = emailAddress;\n    }\n\n    /**\n     * Gets the the {@code emailAddress} property.\n     * @return the property, not null\n     */\n    public Property<String> emailAddress() {\n        return metaBean().emailAddress().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the number of logins.\n     * @return the value of the property\n     */\n    public int getNumberLogins() {\n        return numberLogins;\n    }\n\n    /**\n     * Sets the number of logins.\n     * @param numberLogins  the new value of the property\n     */\n    public void setNumberLogins(int numberLogins) {\n        this.numberLogins = numberLogins;\n    }\n\n    /**\n     * Gets the the {@code numberLogins} property.\n     * @return the property, not null\n     */\n    public Property<Integer> numberLogins() {\n        return metaBean().numberLogins().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the last login instant.\n     * @return the value of the property, not null\n     */\n    public Date getLastLogin() {\n        return lastLogin;\n    }\n\n    /**\n     * Sets the last login instant.\n     * @param lastLogin  the new value of the property, not null\n     */\n    public void setLastLogin(Date lastLogin) {\n        JodaBeanUtils.notNull(lastLogin, \"lastLogin\");\n        this.lastLogin = lastLogin;\n    }\n\n    /**\n     * Gets the the {@code lastLogin} property.\n     * @return the property, not null\n     */\n    public Property<Date> lastLogin() {\n        return metaBean().lastLogin().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public UserAccount clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            UserAccount other = (UserAccount) obj;\n            return JodaBeanUtils.equal(this.getUserId(), other.getUserId()) &&\n                    JodaBeanUtils.equal(this.getEmailAddress(), other.getEmailAddress()) &&\n                    (this.getNumberLogins() == other.getNumberLogins()) &&\n                    JodaBeanUtils.equal(this.getLastLogin(), other.getLastLogin());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getUserId());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getEmailAddress());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getNumberLogins());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getLastLogin());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(160);\n        buf.append(\"UserAccount{\");\n        buf.append(\"userId\").append('=').append(JodaBeanUtils.toString(getUserId())).append(',').append(' ');\n        buf.append(\"emailAddress\").append('=').append(JodaBeanUtils.toString(getEmailAddress())).append(',').append(' ');\n        buf.append(\"numberLogins\").append('=').append(JodaBeanUtils.toString(getNumberLogins())).append(',').append(' ');\n        buf.append(\"lastLogin\").append('=').append(JodaBeanUtils.toString(getLastLogin()));\n        buf.append('}');\n        return buf.toString();\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code UserAccount}.\n     */\n    public static final class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code userId} property.\n         */\n        private final MetaProperty<String> userId = DirectMetaProperty.ofReadWrite(\n                this, \"userId\", UserAccount.class, String.class);\n        /**\n         * The meta-property for the {@code emailAddress} property.\n         */\n        private final MetaProperty<String> emailAddress = DirectMetaProperty.ofReadWrite(\n                this, \"emailAddress\", UserAccount.class, String.class);\n        /**\n         * The meta-property for the {@code numberLogins} property.\n         */\n        private final MetaProperty<Integer> numberLogins = DirectMetaProperty.ofReadWrite(\n                this, \"numberLogins\", UserAccount.class, Integer.TYPE);\n        /**\n         * The meta-property for the {@code lastLogin} property.\n         */\n        private final MetaProperty<Date> lastLogin = DirectMetaProperty.ofReadWrite(\n                this, \"lastLogin\", UserAccount.class, Date.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"userId\",\n                \"emailAddress\",\n                \"numberLogins\",\n                \"lastLogin\");\n\n        /**\n         * Restricted constructor.\n         */\n        private Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case -836030906:  // userId\n                    return this.userId;\n                case -1070931784:  // emailAddress\n                    return this.emailAddress;\n                case 850160339:  // numberLogins\n                    return this.numberLogins;\n                case 1995610739:  // lastLogin\n                    return this.lastLogin;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends UserAccount> builder() {\n            return new DirectBeanBuilder<>(new UserAccount());\n        }\n\n        @Override\n        public Class<? extends UserAccount> beanType() {\n            return UserAccount.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code userId} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> userId() {\n            return userId;\n        }\n\n        /**\n         * The meta-property for the {@code emailAddress} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<String> emailAddress() {\n            return emailAddress;\n        }\n\n        /**\n         * The meta-property for the {@code numberLogins} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Integer> numberLogins() {\n            return numberLogins;\n        }\n\n        /**\n         * The meta-property for the {@code lastLogin} property.\n         * @return the meta-property, not null\n         */\n        public MetaProperty<Date> lastLogin() {\n            return lastLogin;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -836030906:  // userId\n                    return ((UserAccount) bean).getUserId();\n                case -1070931784:  // emailAddress\n                    return ((UserAccount) bean).getEmailAddress();\n                case 850160339:  // numberLogins\n                    return ((UserAccount) bean).getNumberLogins();\n                case 1995610739:  // lastLogin\n                    return ((UserAccount) bean).getLastLogin();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case -836030906:  // userId\n                    ((UserAccount) bean).setUserId((String) newValue);\n                    return;\n                case -1070931784:  // emailAddress\n                    ((UserAccount) bean).setEmailAddress((String) newValue);\n                    return;\n                case 850160339:  // numberLogins\n                    ((UserAccount) bean).setNumberLogins((Integer) newValue);\n                    return;\n                case 1995610739:  // lastLogin\n                    ((UserAccount) bean).setLastLogin((Date) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n        @Override\n        protected void validate(Bean bean) {\n            JodaBeanUtils.notEmpty(((UserAccount) bean).userId, \"userId\");\n            JodaBeanUtils.notEmpty(((UserAccount) bean).emailAddress, \"emailAddress\");\n            JodaBeanUtils.notNull(((UserAccount) bean).lastLogin, \"lastLogin\");\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ValidateBean.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock used for test equals.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class ValidateBean extends DirectBean {\n\n    /**\n     * The non-null value.\n     */\n    @PropertyDefinition(validate = \"notNull\")\n    private String first;\n    /**\n     * The non-empty value.\n     */\n    @PropertyDefinition(validate = \"notEmpty\")\n    private String second;\n    /**\n     * The static checked value.\n     */\n    @PropertyDefinition(validate = \"ValidateBeanCheck.checkInTest\")\n    private String third;\n    /**\n     * The locally checked value.\n     */\n    @PropertyDefinition(validate = \"checkInBean\")\n    private String fourth;\n    /**\n     * The non-blank value.\n     */\n    @PropertyDefinition(validate = \"notBlank\")\n    private String fifth;\n\n    public ValidateBean() {\n    }\n\n    private static void checkInBean(String value, String propertyName) {\n        if (\"D\".equals(value) == false) {\n            throw new IllegalArgumentException(propertyName);\n        }\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code ValidateBean}.\n     * @return the meta-bean, not null\n     */\n    public static ValidateBean.Meta meta() {\n        return ValidateBean.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(ValidateBean.Meta.INSTANCE);\n    }\n\n    @Override\n    public ValidateBean.Meta metaBean() {\n        return ValidateBean.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the non-null value.\n     * @return the value of the property, not null\n     */\n    public String getFirst() {\n        return first;\n    }\n\n    /**\n     * Sets the non-null value.\n     * @param first  the new value of the property, not null\n     */\n    public void setFirst(String first) {\n        JodaBeanUtils.notNull(first, \"first\");\n        this.first = first;\n    }\n\n    /**\n     * Gets the the {@code first} property.\n     * @return the property, not null\n     */\n    public final Property<String> first() {\n        return metaBean().first().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the non-empty value.\n     * @return the value of the property, not empty\n     */\n    public String getSecond() {\n        return second;\n    }\n\n    /**\n     * Sets the non-empty value.\n     * @param second  the new value of the property, not empty\n     */\n    public void setSecond(String second) {\n        JodaBeanUtils.notEmpty(second, \"second\");\n        this.second = second;\n    }\n\n    /**\n     * Gets the the {@code second} property.\n     * @return the property, not null\n     */\n    public final Property<String> second() {\n        return metaBean().second().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the static checked value.\n     * @return the value of the property\n     */\n    public String getThird() {\n        return third;\n    }\n\n    /**\n     * Sets the static checked value.\n     * @param third  the new value of the property\n     */\n    public void setThird(String third) {\n        ValidateBeanCheck.checkInTest(third, \"third\");\n        this.third = third;\n    }\n\n    /**\n     * Gets the the {@code third} property.\n     * @return the property, not null\n     */\n    public final Property<String> third() {\n        return metaBean().third().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the locally checked value.\n     * @return the value of the property\n     */\n    public String getFourth() {\n        return fourth;\n    }\n\n    /**\n     * Sets the locally checked value.\n     * @param fourth  the new value of the property\n     */\n    public void setFourth(String fourth) {\n        checkInBean(fourth, \"fourth\");\n        this.fourth = fourth;\n    }\n\n    /**\n     * Gets the the {@code fourth} property.\n     * @return the property, not null\n     */\n    public final Property<String> fourth() {\n        return metaBean().fourth().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the non-blank value.\n     * @return the value of the property, not blank\n     */\n    public String getFifth() {\n        return fifth;\n    }\n\n    /**\n     * Sets the non-blank value.\n     * @param fifth  the new value of the property, not blank\n     */\n    public void setFifth(String fifth) {\n        JodaBeanUtils.notBlank(fifth, \"fifth\");\n        this.fifth = fifth;\n    }\n\n    /**\n     * Gets the the {@code fifth} property.\n     * @return the property, not null\n     */\n    public final Property<String> fifth() {\n        return metaBean().fifth().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public ValidateBean clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            ValidateBean other = (ValidateBean) obj;\n            return JodaBeanUtils.equal(this.getFirst(), other.getFirst()) &&\n                    JodaBeanUtils.equal(this.getSecond(), other.getSecond()) &&\n                    JodaBeanUtils.equal(this.getThird(), other.getThird()) &&\n                    JodaBeanUtils.equal(this.getFourth(), other.getFourth()) &&\n                    JodaBeanUtils.equal(this.getFifth(), other.getFifth());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getFirst());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getSecond());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getThird());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getFourth());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getFifth());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(192);\n        buf.append(\"ValidateBean{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"first\").append('=').append(JodaBeanUtils.toString(getFirst())).append(',').append(' ');\n        buf.append(\"second\").append('=').append(JodaBeanUtils.toString(getSecond())).append(',').append(' ');\n        buf.append(\"third\").append('=').append(JodaBeanUtils.toString(getThird())).append(',').append(' ');\n        buf.append(\"fourth\").append('=').append(JodaBeanUtils.toString(getFourth())).append(',').append(' ');\n        buf.append(\"fifth\").append('=').append(JodaBeanUtils.toString(getFifth())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code ValidateBean}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code first} property.\n         */\n        private final MetaProperty<String> first = DirectMetaProperty.ofReadWrite(\n                this, \"first\", ValidateBean.class, String.class);\n        /**\n         * The meta-property for the {@code second} property.\n         */\n        private final MetaProperty<String> second = DirectMetaProperty.ofReadWrite(\n                this, \"second\", ValidateBean.class, String.class);\n        /**\n         * The meta-property for the {@code third} property.\n         */\n        private final MetaProperty<String> third = DirectMetaProperty.ofReadWrite(\n                this, \"third\", ValidateBean.class, String.class);\n        /**\n         * The meta-property for the {@code fourth} property.\n         */\n        private final MetaProperty<String> fourth = DirectMetaProperty.ofReadWrite(\n                this, \"fourth\", ValidateBean.class, String.class);\n        /**\n         * The meta-property for the {@code fifth} property.\n         */\n        private final MetaProperty<String> fifth = DirectMetaProperty.ofReadWrite(\n                this, \"fifth\", ValidateBean.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"first\",\n                \"second\",\n                \"third\",\n                \"fourth\",\n                \"fifth\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    return this.first;\n                case -906279820:  // second\n                    return this.second;\n                case 110331239:  // third\n                    return this.third;\n                case -1268684262:  // fourth\n                    return this.fourth;\n                case 97428919:  // fifth\n                    return this.fifth;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends ValidateBean> builder() {\n            return new DirectBeanBuilder<>(new ValidateBean());\n        }\n\n        @Override\n        public Class<? extends ValidateBean> beanType() {\n            return ValidateBean.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code first} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> first() {\n            return first;\n        }\n\n        /**\n         * The meta-property for the {@code second} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> second() {\n            return second;\n        }\n\n        /**\n         * The meta-property for the {@code third} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> third() {\n            return third;\n        }\n\n        /**\n         * The meta-property for the {@code fourth} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> fourth() {\n            return fourth;\n        }\n\n        /**\n         * The meta-property for the {@code fifth} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> fifth() {\n            return fifth;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    return ((ValidateBean) bean).getFirst();\n                case -906279820:  // second\n                    return ((ValidateBean) bean).getSecond();\n                case 110331239:  // third\n                    return ((ValidateBean) bean).getThird();\n                case -1268684262:  // fourth\n                    return ((ValidateBean) bean).getFourth();\n                case 97428919:  // fifth\n                    return ((ValidateBean) bean).getFifth();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 97440432:  // first\n                    ((ValidateBean) bean).setFirst((String) newValue);\n                    return;\n                case -906279820:  // second\n                    ((ValidateBean) bean).setSecond((String) newValue);\n                    return;\n                case 110331239:  // third\n                    ((ValidateBean) bean).setThird((String) newValue);\n                    return;\n                case -1268684262:  // fourth\n                    ((ValidateBean) bean).setFourth((String) newValue);\n                    return;\n                case 97428919:  // fifth\n                    ((ValidateBean) bean).setFifth((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n        @Override\n        protected void validate(Bean bean) {\n            JodaBeanUtils.notNull(((ValidateBean) bean).first, \"first\");\n            JodaBeanUtils.notEmpty(((ValidateBean) bean).second, \"second\");\n            ValidateBeanCheck.checkInTest(((ValidateBean) bean).third, \"third\");\n            checkInBean(((ValidateBean) bean).fourth, \"fourth\");\n            JodaBeanUtils.notBlank(((ValidateBean) bean).fifth, \"fifth\");\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/ValidateBeanCheck.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport org.joda.beans.gen.PropertyDefinition;\n\n/**\n * Class to prove that {@link PropertyDefinition#validate()} works with an external class.\n */\nclass ValidateBeanCheck {\n\n    static void checkInTest(Object value, String name) {\n        if (\"C\".equals(value)) {\n            return;\n        }\n        throw new IllegalArgumentException(name);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/WeirdFormat.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class WeirdFormat\n        implements Bean {\n\n    @PropertyDefinition\n    private String forename1=\"\";\n    @PropertyDefinition\n    private String forename2 =\"\";\n    @PropertyDefinition\n    private String forename3= \"\";\n    @PropertyDefinition\n    private String forename4 = \"\";\n    @PropertyDefinition\n    private String forename5=\"=\";\n\n    /**\n     * Creates an instance.\n     */\n    public WeirdFormat() {\n    }\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code WeirdFormat}.\n     * @return the meta-bean, not null\n     */\n    public static WeirdFormat.Meta meta() {\n        return WeirdFormat.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(WeirdFormat.Meta.INSTANCE);\n    }\n\n    @Override\n    public WeirdFormat.Meta metaBean() {\n        return WeirdFormat.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the forename1.\n     * @return the value of the property\n     */\n    public String getForename1() {\n        return forename1;\n    }\n\n    /**\n     * Sets the forename1.\n     * @param forename1  the new value of the property\n     */\n    public void setForename1(String forename1) {\n        this.forename1 = forename1;\n    }\n\n    /**\n     * Gets the the {@code forename1} property.\n     * @return the property, not null\n     */\n    public final Property<String> forename1() {\n        return metaBean().forename1().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the forename2.\n     * @return the value of the property\n     */\n    public String getForename2() {\n        return forename2;\n    }\n\n    /**\n     * Sets the forename2.\n     * @param forename2  the new value of the property\n     */\n    public void setForename2(String forename2) {\n        this.forename2 = forename2;\n    }\n\n    /**\n     * Gets the the {@code forename2} property.\n     * @return the property, not null\n     */\n    public final Property<String> forename2() {\n        return metaBean().forename2().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the forename3.\n     * @return the value of the property\n     */\n    public String getForename3() {\n        return forename3;\n    }\n\n    /**\n     * Sets the forename3.\n     * @param forename3  the new value of the property\n     */\n    public void setForename3(String forename3) {\n        this.forename3 = forename3;\n    }\n\n    /**\n     * Gets the the {@code forename3} property.\n     * @return the property, not null\n     */\n    public final Property<String> forename3() {\n        return metaBean().forename3().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the forename4.\n     * @return the value of the property\n     */\n    public String getForename4() {\n        return forename4;\n    }\n\n    /**\n     * Sets the forename4.\n     * @param forename4  the new value of the property\n     */\n    public void setForename4(String forename4) {\n        this.forename4 = forename4;\n    }\n\n    /**\n     * Gets the the {@code forename4} property.\n     * @return the property, not null\n     */\n    public final Property<String> forename4() {\n        return metaBean().forename4().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the forename5.\n     * @return the value of the property\n     */\n    public String getForename5() {\n        return forename5;\n    }\n\n    /**\n     * Sets the forename5.\n     * @param forename5  the new value of the property\n     */\n    public void setForename5(String forename5) {\n        this.forename5 = forename5;\n    }\n\n    /**\n     * Gets the the {@code forename5} property.\n     * @return the property, not null\n     */\n    public final Property<String> forename5() {\n        return metaBean().forename5().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public WeirdFormat clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            WeirdFormat other = (WeirdFormat) obj;\n            return JodaBeanUtils.equal(this.getForename1(), other.getForename1()) &&\n                    JodaBeanUtils.equal(this.getForename2(), other.getForename2()) &&\n                    JodaBeanUtils.equal(this.getForename3(), other.getForename3()) &&\n                    JodaBeanUtils.equal(this.getForename4(), other.getForename4()) &&\n                    JodaBeanUtils.equal(this.getForename5(), other.getForename5());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getForename1());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getForename2());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getForename3());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getForename4());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getForename5());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(192);\n        buf.append(\"WeirdFormat{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"forename1\").append('=').append(JodaBeanUtils.toString(getForename1())).append(',').append(' ');\n        buf.append(\"forename2\").append('=').append(JodaBeanUtils.toString(getForename2())).append(',').append(' ');\n        buf.append(\"forename3\").append('=').append(JodaBeanUtils.toString(getForename3())).append(',').append(' ');\n        buf.append(\"forename4\").append('=').append(JodaBeanUtils.toString(getForename4())).append(',').append(' ');\n        buf.append(\"forename5\").append('=').append(JodaBeanUtils.toString(getForename5())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code WeirdFormat}.\n     */\n    public static class Meta extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code forename1} property.\n         */\n        private final MetaProperty<String> forename1 = DirectMetaProperty.ofReadWrite(\n                this, \"forename1\", WeirdFormat.class, String.class);\n        /**\n         * The meta-property for the {@code forename2} property.\n         */\n        private final MetaProperty<String> forename2 = DirectMetaProperty.ofReadWrite(\n                this, \"forename2\", WeirdFormat.class, String.class);\n        /**\n         * The meta-property for the {@code forename3} property.\n         */\n        private final MetaProperty<String> forename3 = DirectMetaProperty.ofReadWrite(\n                this, \"forename3\", WeirdFormat.class, String.class);\n        /**\n         * The meta-property for the {@code forename4} property.\n         */\n        private final MetaProperty<String> forename4 = DirectMetaProperty.ofReadWrite(\n                this, \"forename4\", WeirdFormat.class, String.class);\n        /**\n         * The meta-property for the {@code forename5} property.\n         */\n        private final MetaProperty<String> forename5 = DirectMetaProperty.ofReadWrite(\n                this, \"forename5\", WeirdFormat.class, String.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"forename1\",\n                \"forename2\",\n                \"forename3\",\n                \"forename4\",\n                \"forename5\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 1593991114:  // forename1\n                    return this.forename1;\n                case 1593991115:  // forename2\n                    return this.forename2;\n                case 1593991116:  // forename3\n                    return this.forename3;\n                case 1593991117:  // forename4\n                    return this.forename4;\n                case 1593991118:  // forename5\n                    return this.forename5;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public BeanBuilder<? extends WeirdFormat> builder() {\n            return new DirectBeanBuilder<>(new WeirdFormat());\n        }\n\n        @Override\n        public Class<? extends WeirdFormat> beanType() {\n            return WeirdFormat.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code forename1} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> forename1() {\n            return forename1;\n        }\n\n        /**\n         * The meta-property for the {@code forename2} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> forename2() {\n            return forename2;\n        }\n\n        /**\n         * The meta-property for the {@code forename3} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> forename3() {\n            return forename3;\n        }\n\n        /**\n         * The meta-property for the {@code forename4} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> forename4() {\n            return forename4;\n        }\n\n        /**\n         * The meta-property for the {@code forename5} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> forename5() {\n            return forename5;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 1593991114:  // forename1\n                    return ((WeirdFormat) bean).getForename1();\n                case 1593991115:  // forename2\n                    return ((WeirdFormat) bean).getForename2();\n                case 1593991116:  // forename3\n                    return ((WeirdFormat) bean).getForename3();\n                case 1593991117:  // forename4\n                    return ((WeirdFormat) bean).getForename4();\n                case 1593991118:  // forename5\n                    return ((WeirdFormat) bean).getForename5();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 1593991114:  // forename1\n                    ((WeirdFormat) bean).setForename1((String) newValue);\n                    return;\n                case 1593991115:  // forename2\n                    ((WeirdFormat) bean).setForename2((String) newValue);\n                    return;\n                case 1593991116:  // forename3\n                    ((WeirdFormat) bean).setForename3((String) newValue);\n                    return;\n                case 1593991117:  // forename4\n                    ((WeirdFormat) bean).setForename4((String) newValue);\n                    return;\n                case 1593991118:  // forename5\n                    ((WeirdFormat) bean).setForename5((String) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/Wrapper.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.Property;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectBean;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic abstract class Wrapper<T extends Address> extends DirectBean {\n\n    /** The type. */\n    @PropertyDefinition\n    private String type;\n    /** The surname. */\n    @PropertyDefinition\n    private T content;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code Wrapper}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static Wrapper.Meta meta() {\n        return Wrapper.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code Wrapper}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends Address> Wrapper.Meta<R> metaWrapper(Class<R> cls) {\n        return Wrapper.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(Wrapper.Meta.INSTANCE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public Wrapper.Meta<T> metaBean() {\n        return Wrapper.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the type.\n     * @return the value of the property\n     */\n    public String getType() {\n        return type;\n    }\n\n    /**\n     * Sets the type.\n     * @param type  the new value of the property\n     */\n    public void setType(String type) {\n        this.type = type;\n    }\n\n    /**\n     * Gets the the {@code type} property.\n     * @return the property, not null\n     */\n    public final Property<String> type() {\n        return metaBean().type().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the surname.\n     * @return the value of the property\n     */\n    public T getContent() {\n        return content;\n    }\n\n    /**\n     * Sets the surname.\n     * @param content  the new value of the property\n     */\n    public void setContent(T content) {\n        this.content = content;\n    }\n\n    /**\n     * Gets the the {@code content} property.\n     * @return the property, not null\n     */\n    public final Property<T> content() {\n        return metaBean().content().createProperty(this);\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public Wrapper<T> clone() {\n        return JodaBeanUtils.cloneAlways(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            Wrapper<?> other = (Wrapper<?>) obj;\n            return JodaBeanUtils.equal(this.getType(), other.getType()) &&\n                    JodaBeanUtils.equal(this.getContent(), other.getContent());\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(getType());\n        hash = hash * 31 + JodaBeanUtils.hashCode(getContent());\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(96);\n        buf.append(\"Wrapper{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"type\").append('=').append(JodaBeanUtils.toString(getType())).append(',').append(' ');\n        buf.append(\"content\").append('=').append(JodaBeanUtils.toString(getContent())).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code Wrapper}.\n     * @param <T>  the type\n     */\n    public static class Meta<T extends Address> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code type} property.\n         */\n        private final MetaProperty<String> type = DirectMetaProperty.ofReadWrite(\n                this, \"type\", Wrapper.class, String.class);\n        /**\n         * The meta-property for the {@code content} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T> content = (DirectMetaProperty) DirectMetaProperty.ofReadWrite(\n                this, \"content\", Wrapper.class, Object.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"type\",\n                \"content\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3575610:  // type\n                    return this.type;\n                case 951530617:  // content\n                    return this.content;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public boolean isBuildable() {\n            return false;\n        }\n\n        @Override\n        public BeanBuilder<? extends Wrapper<T>> builder() {\n            throw new UnsupportedOperationException(\"Wrapper is an abstract class\");\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends Wrapper<T>> beanType() {\n            return (Class) Wrapper.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code type} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<String> type() {\n            return type;\n        }\n\n        /**\n         * The meta-property for the {@code content} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T> content() {\n            return content;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3575610:  // type\n                    return ((Wrapper<?>) bean).getType();\n                case 951530617:  // content\n                    return ((Wrapper<?>) bean).getContent();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3575610:  // type\n                    ((Wrapper<T>) bean).setType((String) newValue);\n                    return;\n                case 951530617:  // content\n                    ((Wrapper<T>) bean).setContent((T) newValue);\n                    return;\n            }\n            super.propertySet(bean, propertyName, newValue, quiet);\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/sample/WrapperToDoubleGenerics.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.sample;\n\nimport java.util.Map;\nimport java.util.NoSuchElementException;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.JodaBeanUtils;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.gen.BeanDefinition;\nimport org.joda.beans.gen.PropertyDefinition;\nimport org.joda.beans.impl.direct.DirectFieldsBeanBuilder;\nimport org.joda.beans.impl.direct.DirectMetaBean;\nimport org.joda.beans.impl.direct.DirectMetaProperty;\nimport org.joda.beans.impl.direct.DirectMetaPropertyMap;\n\n/**\n * Mock JavaBean, used for testing.\n * \n * @author Stephen Colebourne\n */\n@BeanDefinition\npublic class WrapperToDoubleGenerics<T extends DoubleGenericsSimpleSuper<String, ?>>\n        implements ImmutableBean {\n\n    /**\n     * The type T value.\n     **/\n    @PropertyDefinition\n    private final T base;\n\n    //------------------------- AUTOGENERATED START -------------------------\n    /**\n     * The meta-bean for {@code WrapperToDoubleGenerics}.\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"rawtypes\")\n    public static WrapperToDoubleGenerics.Meta meta() {\n        return WrapperToDoubleGenerics.Meta.INSTANCE;\n    }\n\n    /**\n     * The meta-bean for {@code WrapperToDoubleGenerics}.\n     * @param <R>  the bean's generic type\n     * @param cls  the bean's generic type\n     * @return the meta-bean, not null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <R extends DoubleGenericsSimpleSuper<String, ?>> WrapperToDoubleGenerics.Meta<R> metaWrapperToDoubleGenerics(Class<R> cls) {\n        return WrapperToDoubleGenerics.Meta.INSTANCE;\n    }\n\n    static {\n        MetaBean.register(WrapperToDoubleGenerics.Meta.INSTANCE);\n    }\n\n    /**\n     * Returns a builder used to create an instance of the bean.\n     * @param <T>  the type\n     * @return the builder, not null\n     */\n    public static <T extends DoubleGenericsSimpleSuper<String, ?>> WrapperToDoubleGenerics.Builder<T> builder() {\n        return new WrapperToDoubleGenerics.Builder<>();\n    }\n\n    /**\n     * Restricted constructor.\n     * @param builder  the builder to copy from, not null\n     */\n    protected WrapperToDoubleGenerics(WrapperToDoubleGenerics.Builder<T> builder) {\n        this.base = builder.base;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public WrapperToDoubleGenerics.Meta<T> metaBean() {\n        return WrapperToDoubleGenerics.Meta.INSTANCE;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Gets the base.\n     * @return the value of the property\n     */\n    public T getBase() {\n        return base;\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * Returns a builder that allows this bean to be mutated.\n     * @return the mutable builder, not null\n     */\n    public Builder<T> toBuilder() {\n        return new Builder<>(this);\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == this) {\n            return true;\n        }\n        if (obj != null && obj.getClass() == this.getClass()) {\n            WrapperToDoubleGenerics<?> other = (WrapperToDoubleGenerics<?>) obj;\n            return JodaBeanUtils.equal(this.base, other.base);\n        }\n        return false;\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = getClass().hashCode();\n        hash = hash * 31 + JodaBeanUtils.hashCode(base);\n        return hash;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder buf = new StringBuilder(64);\n        buf.append(\"WrapperToDoubleGenerics{\");\n        int len = buf.length();\n        toString(buf);\n        if (buf.length() > len) {\n            buf.setLength(buf.length() - 2);\n        }\n        buf.append('}');\n        return buf.toString();\n    }\n\n    protected void toString(StringBuilder buf) {\n        buf.append(\"base\").append('=').append(JodaBeanUtils.toString(base)).append(',').append(' ');\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The meta-bean for {@code WrapperToDoubleGenerics}.\n     * @param <T>  the type\n     */\n    public static class Meta<T extends DoubleGenericsSimpleSuper<String, ?>> extends DirectMetaBean {\n        /**\n         * The singleton instance of the meta-bean.\n         */\n        @SuppressWarnings(\"rawtypes\")\n        static final Meta INSTANCE = new Meta();\n\n        /**\n         * The meta-property for the {@code base} property.\n         */\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        private final MetaProperty<T> base = (DirectMetaProperty) DirectMetaProperty.ofImmutable(\n                this, \"base\", WrapperToDoubleGenerics.class, Object.class);\n        /**\n         * The meta-properties.\n         */\n        private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(\n                this, null,\n                \"base\");\n\n        /**\n         * Restricted constructor.\n         */\n        protected Meta() {\n        }\n\n        @Override\n        protected MetaProperty<?> metaPropertyGet(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3016401:  // base\n                    return this.base;\n            }\n            return super.metaPropertyGet(propertyName);\n        }\n\n        @Override\n        public WrapperToDoubleGenerics.Builder<T> builder() {\n            return new WrapperToDoubleGenerics.Builder<>();\n        }\n\n        @SuppressWarnings({\"unchecked\", \"rawtypes\" })\n        @Override\n        public Class<? extends WrapperToDoubleGenerics<T>> beanType() {\n            return (Class) WrapperToDoubleGenerics.class;\n        }\n\n        @Override\n        public Map<String, MetaProperty<?>> metaPropertyMap() {\n            return metaPropertyMap$;\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * The meta-property for the {@code base} property.\n         * @return the meta-property, not null\n         */\n        public final MetaProperty<T> base() {\n            return base;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {\n            switch (propertyName.hashCode()) {\n                case 3016401:  // base\n                    return ((WrapperToDoubleGenerics<?>) bean).getBase();\n            }\n            return super.propertyGet(bean, propertyName, quiet);\n        }\n\n        @Override\n        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {\n            metaProperty(propertyName);\n            if (quiet) {\n                return;\n            }\n            throw new UnsupportedOperationException(\"Property cannot be written: \" + propertyName);\n        }\n\n    }\n\n    //-----------------------------------------------------------------------\n    /**\n     * The bean-builder for {@code WrapperToDoubleGenerics}.\n     * @param <T>  the type\n     */\n    public static class Builder<T extends DoubleGenericsSimpleSuper<String, ?>> extends DirectFieldsBeanBuilder<WrapperToDoubleGenerics<T>> {\n\n        private T base;\n\n        /**\n         * Restricted constructor.\n         */\n        protected Builder() {\n        }\n\n        /**\n         * Restricted copy constructor.\n         * @param beanToCopy  the bean to copy from, not null\n         */\n        protected Builder(WrapperToDoubleGenerics<T> beanToCopy) {\n            this.base = beanToCopy.getBase();\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public Object get(String propertyName) {\n            switch (propertyName.hashCode()) {\n                case 3016401:  // base\n                    return this.base;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Builder<T> set(String propertyName, Object newValue) {\n            switch (propertyName.hashCode()) {\n                case 3016401:  // base\n                    this.base = (T) newValue;\n                    break;\n                default:\n                    throw new NoSuchElementException(\"Unknown property: \" + propertyName);\n            }\n            return this;\n        }\n\n        @Override\n        public Builder<T> set(MetaProperty<?> property, Object value) {\n            super.set(property, value);\n            return this;\n        }\n\n        @Override\n        public WrapperToDoubleGenerics<T> build() {\n            return new WrapperToDoubleGenerics<>(this);\n        }\n\n        //-----------------------------------------------------------------------\n        /**\n         * Sets the base.\n         * @param base  the new value\n         * @return this, for chaining, not null\n         */\n        public Builder<T> base(T base) {\n            this.base = base;\n            return this;\n        }\n\n        //-----------------------------------------------------------------------\n        @Override\n        public String toString() {\n            StringBuilder buf = new StringBuilder(64);\n            buf.append(\"WrapperToDoubleGenerics.Builder{\");\n            int len = buf.length();\n            toString(buf);\n            if (buf.length() > len) {\n                buf.setLength(buf.length() - 2);\n            }\n            buf.append('}');\n            return buf.toString();\n        }\n\n        protected void toString(StringBuilder buf) {\n            buf.append(\"base\").append('=').append(JodaBeanUtils.toString(base)).append(',').append(' ');\n        }\n\n    }\n\n    //-------------------------- AUTOGENERATED END --------------------------\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/AtomicReference.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\n/**\n * Mock class with a silly name.\n */\nclass AtomicReference {\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/BigDecimal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\n/**\n * Mock class with a silly name.\n */\nclass BigDecimal {\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/Normal.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\n/**\n * Mock class with a silly name.\n */\nclass Normal {\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/SerTestHelper.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Currency;\nimport java.util.EnumSet;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Locale;\nimport java.util.Map;\nimport java.util.TimeZone;\nimport java.util.TreeSet;\n\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.Company;\nimport org.joda.beans.sample.CompanyAddress;\nimport org.joda.beans.sample.INamedKey;\nimport org.joda.beans.sample.ImmAddress;\nimport org.joda.beans.sample.ImmGeneric;\nimport org.joda.beans.sample.ImmGenericArray;\nimport org.joda.beans.sample.ImmGenericCollections;\nimport org.joda.beans.sample.ImmGuava;\nimport org.joda.beans.sample.ImmJodaConvertBean;\nimport org.joda.beans.sample.ImmJodaConvertWrapper;\nimport org.joda.beans.sample.ImmKey;\nimport org.joda.beans.sample.ImmKeyHolder;\nimport org.joda.beans.sample.ImmKeyList;\nimport org.joda.beans.sample.ImmNamedKey;\nimport org.joda.beans.sample.ImmOptional;\nimport org.joda.beans.sample.ImmPair;\nimport org.joda.beans.sample.ImmPerson;\nimport org.joda.beans.sample.ImmTreeNode;\nimport org.joda.beans.sample.JodaConvertInterface;\nimport org.joda.beans.sample.Person;\nimport org.joda.beans.sample.PrimitiveBean;\nimport org.joda.beans.sample.RiskLevel;\nimport org.joda.beans.sample.RiskPerception;\nimport org.joda.beans.sample.SimpleJson;\nimport org.joda.collect.grid.DenseGrid;\nimport org.joda.collect.grid.SparseGrid;\n\nimport com.google.common.base.Optional;\nimport com.google.common.collect.HashBasedTable;\nimport com.google.common.collect.ImmutableBiMap;\nimport com.google.common.collect.ImmutableList;\nimport com.google.common.collect.ImmutableListMultimap;\nimport com.google.common.collect.ImmutableMap;\nimport com.google.common.collect.ImmutableMultiset;\nimport com.google.common.collect.ImmutableSet;\nimport com.google.common.collect.ImmutableSetMultimap;\nimport com.google.common.collect.ImmutableSortedMap;\nimport com.google.common.collect.ImmutableSortedSet;\nimport com.google.common.collect.ImmutableTable;\n\n/**\n * Test helper.\n */\npublic class SerTestHelper {\n\n    public static ImmGeneric<List<Integer>> testBigIntegerList() {\n        var intList = new ArrayList<Integer>(200000);\n        for (int i = 0; i < 200000; i++) {\n            intList.add(i * 2);\n        }\n        return ImmGeneric.of(intList);\n    }\n    \n    public static ImmGenericArray<ImmAddress> testBigAddressArray() {\n        var quarterSize = 250;\n        var addressArray = new ImmAddress[quarterSize * 4];\n        for (int i = 0; i < quarterSize; i++) {\n            addressArray[i] = testImmAddress(true, \"Etienne #\" + i, i);\n        }\n        System.arraycopy(addressArray, 0, addressArray, quarterSize, quarterSize);\n        System.arraycopy(addressArray, 0, addressArray, quarterSize * 2, quarterSize);\n        System.arraycopy(addressArray, 0, addressArray, quarterSize * 3, quarterSize);\n        return ImmGenericArray.of(addressArray);\n    }\n    \n    public static Address testAddress() {\n        return testAddress(\"Etienne\", 251);\n    }\n\n    private static Address testAddress(String name, int number) {\n        Person person = new Person();\n        person.setForename(name);\n        person.setSurname(\"Colebourne\");\n        person.getExtensions().set(\"interests\", \"joda\");\n        person.getExtensions().set(\"conferenceCount\", 21);\n        person.getExtensions().set(\"quality\", 'B');\n        person.getExtensions().set(\"company\", new Company(\"OpenGamma\"));\n        Address address = new Address();\n        address.setOwner(person);\n        address.setNumber(number);\n        address.setStreet(\"Big Road\");\n        address.setCity(\"London & Capital of the World <!>\");\n        CompanyAddress workAddress = new CompanyAddress();\n        workAddress.setCompanyName(\"OpenGamma\");\n        workAddress.setNumber(185);\n        workAddress.setStreet(\"Park Street\");\n        workAddress.setCity(\"London\");\n        Address homeAddress = new Address();\n        homeAddress.setNumber(65432);\n        homeAddress.setStreet(\"Big Road\");\n        homeAddress.setCity(\"Bigton\");\n        person.setMainAddress(workAddress);\n        person.getOtherAddressMap().put(\"home\", homeAddress);\n        person.getOtherAddressMap().put(\"work\", workAddress);\n        person.getOtherAddressMap().put(\"other\", null);\n        person.getAddressList().add(homeAddress);\n        person.getAddressList().add(null);\n        person.getAddressList().add(workAddress);\n        person.getAddressesList().add(ImmutableList.of(homeAddress, workAddress));\n        return address;\n    }\n\n    public static ImmAddress testImmAddress(boolean isImmutable) {\n        return testImmAddress(isImmutable, \"Etienne\", 185);\n    }\n    \n    private static ImmAddress testImmAddress(boolean isImmutable, String name, int number) {\n        Map<String, List<String>> map = new HashMap<>();\n        map.put(\"A\", Arrays.asList(\"B\", \"b\"));\n        Map<String, List<Integer>> map2 = new HashMap<>();\n        map2.put(\"A\", Arrays.asList(3, 2, 1));\n        Map<String, List<List<Integer>>> map3 = new HashMap<>();\n        map3.put(\"A\", Arrays.asList(Arrays.asList(3, 2, 1)));\n        Map<ImmPerson, Map<String, ImmPerson>> map4 = new HashMap<>();\n        Map<String, List<List<Object>>> map5 = new HashMap<>();\n        PrimitiveBean primitives = new PrimitiveBean();\n        primitives.setValueLong(1L);\n        primitives.setValueInt(2);\n        primitives.setValueShort((short) 3);\n        primitives.setValueByte((byte) 4);\n        primitives.setValueDouble(5.0d);\n        primitives.setValueFloat(6.0f);\n        primitives.setValueChar('7');\n        primitives.setValueBoolean(true);\n        List<Object> objects1 = Arrays.<Object>asList(Currency.getInstance(\"GBP\"), TimeZone.getTimeZone(\"Europe/London\"));\n        List<Object> objects2 = isImmutable ?\n                Arrays.<Object>asList(Locale.CANADA_FRENCH, Long.valueOf(2)) :\n                Arrays.<Object>asList(Locale.CANADA_FRENCH, Long.valueOf(2), primitives);\n        map5.put(\"A\", Arrays.asList(objects1));\n        map5.put(\"B\", Arrays.asList(objects2));\n        Map<String, Object> map6 = new HashMap<>();\n        map6.put(\"A\", \"Abba\");\n        map6.put(\"B\", ImmutableSet.of(\"a\", \"b\"));\n        map6.put(\"C\", ImmutableSet.copyOf(objects2));\n        map6.put(\"D\", ImmutableMap.of(\"d\", 1, \"e\", 2));\n        ImmPerson person = ImmPerson.builder()\n                .forename(name)\n                .middleNames(\"K\", \"T\")\n                .surname(\"Colebourne\")\n                .addressList(isImmutable ? null : Arrays.asList(new Address()))\n                .codeCounts(ImmutableMultiset.of(\"A\", \"A\", \"B\"))\n                .build();\n        ImmPerson child = ImmPerson.builder()\n                .forename(\"Etiennette\")\n                .surname(\"Colebourne\")\n                .build();\n        ImmPerson child2 = ImmPerson.builder()\n                .forename(\"Kylie\")\n                .surname(\"Colebourne\")\n                .build();\n        ImmAddress childAddress = ImmAddress.builder()\n                .owner(child)\n                .number(185)\n                .street(\"Park Street\")\n                .city(\"London\")\n                .risk(RiskLevel.LOW)\n                .riskLevel(RiskLevel.HIGH)\n                .riskLevels(EnumSet.of(RiskLevel.LOW, RiskLevel.MEDIUM))\n                .object1(RiskLevel.MEDIUM)\n                .object2(RiskPerception.LOW)\n                .data(new byte[] {64, 65, 66})\n                .build();\n        map4.put(child, ImmutableMap.of(\"sibling\", child2));\n        HashBasedTable<Integer, Integer, ImmPerson> table = HashBasedTable.create();\n        table.put(1, 1, person);\n        table.put(1, 2, child);\n        table.put(2, 1, child2);\n        SparseGrid<ImmPerson> sparseGrid = SparseGrid.create(5, 5);\n        sparseGrid.put(1, 1, child2);\n        DenseGrid<ImmPerson> denseGrid = DenseGrid.create(2, 3);\n        denseGrid.put(0, 0, child);\n        denseGrid.put(1, 1, child2);\n        ImmAddress address = ImmAddress.builder()\n                .owner(person)\n                .number(number)\n                .street(\"Park Street\")\n                .city(\"London & Capital of the World <!>\\n\")\n                .abstractNumber(Short.valueOf((short) 89))\n                .array2d(new String[][] {{\"a\"}, {}, {\"b\", \"c\"}})\n                .object1(ImmutableList.of(\"a\", \"b\", \"c\"))\n                .object2(ImmutableMap.of(\"d\", 1, Currency.getInstance(\"GBP\"), 2))\n                .serializable(ImmutableList.of(\"a\", \"b\", \"c\"))\n                .objectInMap(map6)\n                .listInMap(map)\n                .listNumericInMap(map2)\n                .listInListInMap(map3)\n                .objectListInListInMap(map5)\n                .mapInMap(map4)\n                .simpleTable(ImmutableTable.<Integer, Integer, String>builder()\n                        .put(1, 1, \"Hello\")\n                        .put(1, 2, \"There\")\n                        .build())\n                .compoundTable(table)\n                .sparseGrid(sparseGrid)\n                .denseGrid(denseGrid)\n                .beanBeanMap(ImmutableMap.of(child, childAddress))\n                .doubleVector(new double[] {1.1, 2.2, 3.3})\n                .matrix(new double[][] {{1.1, 2.2}, {3.2}})\n                .build();\n        return address;\n    }\n\n    public static ImmOptional testImmOptional() {\n        ImmOptional optional = ImmOptional.builder()\n                .optString(Optional.of(\"A\"))\n                .build();\n        return optional;\n    }\n\n    public static ImmGuava<String> testCollections(boolean extended) {\n        ImmutableList<String> list = ImmutableList.of(\"A\", \"B\");\n        ImmutableSet<String> set = ImmutableSet.of(\"A\", \"B\");\n        ImmutableSortedSet<String> sortedSet = ImmutableSortedSet.of(\"A\", \"B\");\n        ImmutableMap<String, String> map = ImmutableMap.of(\"A\", \"AA\", \"B\", \"BB\");\n        ImmutableSortedMap<String, String> sortedMap = ImmutableSortedMap.of(\"A\", \"AA\", \"B\", \"BB\");\n        ImmutableBiMap<String, String> bimap = ImmutableBiMap.of(\"A\", \"AA\", \"B\", \"BB\");\n        ImmutableMultiset<String> multiset = ImmutableMultiset.of(\"A\", \"B\", \"C\", \"B\", \"C\", \"C\");\n        ImmutableListMultimap<String, String> listMultimap = ImmutableListMultimap.of(\"A\", \"B\", \"A\", \"C\", \"B\", \"D\");\n        ImmutableSetMultimap<String, String> setMultimap = ImmutableSetMultimap.of(\"A\", \"B\", \"A\", \"C\", \"B\", \"D\");\n        ImmutableTable<String, Integer, String> table = ImmutableTable.<String, Integer, String>builder()\n                .put(\"A\", 1, \"B\")\n                .put(\"A\", 2, \"C\")\n                .put(\"B\", 3, \"D\")\n                .build();\n        var builder = ImmGuava.<String>builder()\n                .list(list)\n                .listInterface(list)\n                .set(set)\n                .setInterface(set)\n                .sortedSet(sortedSet)\n                .sortedSetInterface(sortedSet)\n                .map(map)\n                .mapInterface(map)\n                .sortedMap(sortedMap)\n                .sortedMapInterface(sortedMap)\n                .biMap(bimap)\n                .biMapInterface(bimap)\n                .multiset(multiset);\n        if (extended) {\n            // ImmutableMultimap.copyOf always creates a ListMultimap, even though deserialization sends a SetMultimap\n            // so must be .multimapInterface(listMultimap)  not .multimapInterface(setMultimap)  \n            builder.multimap(listMultimap)\n                    .multimapInterface(listMultimap)\n                    .listMultimap(listMultimap)\n                    .listMultimapInterface(listMultimap)\n                    .setMultimap(setMultimap)\n                    .setMultimapInterface(setMultimap)\n                    .table(table);\n        }\n        return builder.build();\n    }\n\n    public static ImmGenericCollections<JodaConvertInterface> testGenericInterfaces() {\n        return ImmGenericCollections.<JodaConvertInterface>builder()\n                .map(ImmutableMap.of(\n                        \"First\", JodaConvertInterface.of(\"First\"),\n                        \"Second\", JodaConvertInterface.of(\"Second\")))\n                .build();\n    }\n\n    public static ImmGenericCollections<Object> testGenericInterfacesCollections() {\n        return ImmGenericCollections.builder()\n                .map(ImmutableMap.of(\n                        \"First\", Arrays.asList(\"A\", \"B\"),\n                        \"First1\", ImmutableList.of(\"A\", \"B\"),\n                        \"Third1\", new TreeSet<>(ImmutableList.of(\"A\", \"B\")),\n                        \"Third\", new HashSet<>(Arrays.asList(\"A\", \"B\")),\n                        \"Second\", testCollections(true)))\n                .build();\n    }\n\n    public static ImmKeyList testIntermediateInterfaces() {\n        // second serialized as JodaConvertInterface, non-bean\n        // third and fourth are serialized as an intermediate Joda-Convert interface INamedKey\n        // (Root interface) IKey -> (Joda-Convert interface) INamedKey -> (Concrete Bean) ImmNamedKey \n        return ImmKeyList.builder()\n                .keys(\n                        ImmKey.builder().name(\"First\").build(),\n                        JodaConvertInterface.of(\"Second\"),\n                        INamedKey.of(\"Third\"),\n                        ImmNamedKey.of(\"Fourth\"))\n                .build();\n    }\n\n    public static ImmGenericCollections<Map<ImmJodaConvertBean, String>> testGenericNestedCollections() {\n        return ImmGenericCollections.<Map<ImmJodaConvertBean, String>>builder()\n                .map(ImmutableMap.of(\n                        \"Key\",\n                        ImmutableMap.of(\n                                new ImmJodaConvertBean(\"Hello:8\"), \"Done\",\n                                new ImmJodaConvertBean(\"Hello:10\"), \"Done2\")))\n                .build();\n    }\n\n    public static ImmGenericArray<ImmGeneric<?>> testGenericArrayWithNulls() {\n        return ImmGenericArray.of(new ImmGeneric<?>[] {\n                ImmGeneric.<String>builder()\n                        .value(\"Help\")\n                        .build(),\n                ImmGeneric.<ImmJodaConvertWrapper>builder()\n                        .value(ImmJodaConvertWrapper.of(null, \"null\"))\n                        .build(),\n                ImmGeneric.<ImmJodaConvertWrapper>builder()\n                        .value(ImmJodaConvertWrapper.of(new ImmJodaConvertBean(\"Bean:5\"), \"null\"))\n                        .build()\n        });\n    }\n\n    public static ImmTreeNode testTree() {\n        ImmutableList<ImmTreeNode> childList = ImmutableList.of(\n                ImmTreeNode.builder().name(\"First child\").build(),\n                ImmTreeNode.builder().name(\"Second child\").build(),\n                ImmTreeNode.builder().name(\"Third child\").build());\n        return ImmTreeNode.of(\n                \"Root Node\",\n                ImmTreeNode.builder().name(\"First child\").build(),\n                ImmTreeNode.builder().name(\"Second child\").build(),\n                ImmTreeNode.builder().name(\"Third child\").build(),\n                ImmutableList.of(\n                        ImmTreeNode.builder().name(\"First child\").build(),\n                        ImmTreeNode.builder().name(\"Third child\").build(),\n                        ImmTreeNode.builder()\n                                .name(\"Fourth child\")\n                                .child3(ImmTreeNode.builder().name(\"Third child\")\n                                        .childList(childList)\n                                        .build())\n                                .childList(childList)\n                                .build()));\n    }\n\n    public static ImmKeyHolder testImmKeyHolder() {\n        return ImmKeyHolder.builder()\n                .value(ImmKey.builder().name(\"foo\").build())\n                .build();\n    }\n\n    public static SimpleJson testSimpleJson() {\n        Map<String, List<String>> map = new HashMap<>();\n        map.put(\"A\", Arrays.asList(\"B\", \"b\"));\n        Map<String, List<Integer>> map2 = new HashMap<>();\n        map2.put(\"A\", Arrays.asList(3, 2, 1));\n        ImmKey key1 = ImmKey.builder().name(\"Cat\").build();\n        ImmKey key2 = ImmKey.builder().name(\"Dog\").build();\n        SimpleJson result = SimpleJson.builder()\n                .primitiveChar('a')\n                .primitiveByte((byte) 23)\n                .primitiveShort((short) 12)\n                .primitiveInt(9)\n                .primitiveLong(6)\n                .primitiveFloat(3.4f)\n                .primitiveDouble(2.3d)\n                .primitiveDoubleNaN(Double.NaN)\n                .primitiveDoubleInf(Double.POSITIVE_INFINITY)\n                .abstractNumber(Integer.valueOf(29))\n                .arrayByte(new byte[] {64, 65, 66})\n                .array2d(new String[][] {{\"a\"}, {}, {\"b\", \"c\"}})\n                .string(\"ABBA\")\n                .bean(key1)\n                .object1(ImmutableList.of(\"a\", \"b\", \"c\"))\n                .object2(ImmutableMap.of(\"d\", 1, \"12\", \"2\"))\n                .risk(RiskLevel.LOW)\n                .riskLevel(RiskLevel.HIGH)\n                .riskLevels(EnumSet.of(RiskLevel.LOW, RiskLevel.MEDIUM))\n                .stringList(ImmutableList.of(\"a\", \"b\", \"c\"))\n                .beanList(ImmutableList.of(key1, key2))\n                .stringMap(ImmutableMap.of(\"a\", \"A\", \"b\", \"B\"))\n                .intKeyMap(ImmutableMap.of(1, \"A\", 2, \"B\"))\n                .beanMap(ImmutableMap.of(\"a\", key1, \"b\", key2))\n                .listInMap(map)\n                .listNumericInMap(map2)\n                .objectInMap(ImmutableMap.of(\"a\", (long) Integer.MAX_VALUE + 1))\n                .build();\n        return result;\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/TestJodaBeanBinFormat.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport org.joda.beans.ser.bin.JodaBeanBinFormat;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test {@link JodaBeanBinFormat}.\n */\nclass TestJodaBeanBinFormat {\n\n    @Test\n    void test() {\n        assertThat(JodaBeanBinFormat.STANDARD.version()).isEqualTo(1);\n        assertThat(JodaBeanBinFormat.REFERENCING.version()).isEqualTo(2);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/TestLinkedByteArrayOutputStream.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport java.util.Arrays;\n\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test {@link LinkedByteArrayOutputStream}.\n */\nclass TestLinkedByteArrayOutputStream {\n\n    @Test\n    void test_empty() {\n        try (var test = new LinkedByteArrayOutputStream()) {\n            assertThat(test).hasToString(\"\");\n            assertThat(test.toByteArray()).isEqualTo(new byte[0]);\n            assertThat(test.size()).isEqualTo(0);\n        }\n    }\n\n    @Test\n    void test_writeByte() {\n        try (var test = new LinkedByteArrayOutputStream()) {\n            test.write(33);\n            assertThat(test).hasToString(\"21\");\n            assertThat(test.toByteArray()).isEqualTo(new byte[] {33});\n            assertThat(test.size()).isEqualTo(1);\n        }\n    }\n\n    @Test\n    void test_writeByte_growCapacity() {\n        try (var test = new LinkedByteArrayOutputStream()) {\n            test.write(new byte[1024]);\n            test.write(33);\n            assertThat(test.toString()).hasSize(2050).endsWith(\"0021\");\n            assertThat(test.toByteArray()).hasSize(1025).endsWith(new byte[] {33});\n        }\n    }\n\n    @Test\n    void test_writeByteArray_empty() {\n        try (var test = new LinkedByteArrayOutputStream()) {\n            test.write(new byte[0]);\n            assertThat(test).hasToString(\"\");\n            assertThat(test.toByteArray()).isEqualTo(new byte[0]);\n            assertThat(test.size()).isEqualTo(0);\n        }\n    }\n\n    @Test\n    void test_writeByteArray_normal() {\n        try (var test = new LinkedByteArrayOutputStream()) {\n            var bytes = new byte[] {33, 34, 35, 36, 37};\n            test.write(bytes, 1, 3);\n            assertThat(test).hasToString(\"222324\");\n            assertThat(test.toByteArray()).isEqualTo(new byte[] {34, 35, 36});\n            assertThat(test.size()).isEqualTo(3);\n        }\n    }\n\n    @Test\n    void test_writeByteArray_growCapacityExact() {\n        try (var test = new LinkedByteArrayOutputStream()) {\n            var bytes = new byte[] {33, 34, 35, 36, 37};\n            test.write(new byte[1024]);\n            test.write(bytes, 1, 4);\n            assertThat(test.toString()).hasSize(2056).endsWith(\"22232425\");\n            assertThat(test.toByteArray()).hasSize(1028).endsWith(new byte[] {34, 35, 36, 37});\n            assertThat(test.size()).isEqualTo(1028);\n            assertThat(test.toByteArray()).isEqualTo(test.toByteArray());\n        }\n    }\n\n    @Test\n    void test_writeByteArray_growCapacitySplit() {\n        try (var test = new LinkedByteArrayOutputStream()) {\n            var bytes = new byte[] {33, 34, 35, 36, 37};\n            test.write(new byte[1022]);\n            test.write(bytes, 0, 3);\n            assertThat(test.toString()).hasSize(2050).endsWith(\"212223\");\n            assertThat(test.toByteArray()).hasSize(1025).endsWith(new byte[] {33, 34, 35});\n            assertThat(test.size()).isEqualTo(1025);\n            assertThat(test.toByteArray()).isEqualTo(test.toByteArray());\n        }\n    }\n\n    @Test\n    void test_writeByteArray_large() {\n        try (var test = new LinkedByteArrayOutputStream()) {\n            var bytes = new byte[2048];\n            Arrays.fill(bytes, (byte) 33);\n            test.write(new byte[1022]);\n            test.write(bytes);\n            test.write(34);\n            assertThat(test.toString()).hasSize((1022 + 2048 + 1) * 2).endsWith(\"212122\");\n            assertThat(test.toByteArray()).hasSize(1022 + 2048 + 1).endsWith(new byte[] {33, 33, 34});\n            assertThat(test.size()).isEqualTo(1022 + 2048 + 1);\n            assertThat(test.toByteArray()).isEqualTo(test.toByteArray());\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/TestSerDeserializerProvider.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.sample.ImmKey;\nimport org.joda.beans.sample.Pair;\nimport org.joda.beans.sample.Person;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test {@link SerDeserializerProvider}.\n */\nclass TestSerDeserializerProvider {\n\n    private static final SerDeserializer DESER = new SerDeserializer() {\n\n        @Override\n        public void setValue(BeanBuilder<?> builder, MetaProperty<?> metaProp, Object value) {\n        }\n\n        @Override\n        public MetaProperty<?> findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName) {\n            return null;\n        }\n\n        @Override\n        public MetaBean findMetaBean(Class<?> beanType) {\n            return null;\n        }\n\n        @Override\n        public BeanBuilder<?> createBuilder(Class<?> beanType, MetaBean metaBean) {\n            return null;\n        }\n\n        @Override\n        public Object build(Class<?> beanType, BeanBuilder<?> builder) {\n            return null;\n        }\n    };\n\n    private static final SerDeserializerProvider PROVIDER = new SerDeserializerProvider() {\n\n        @Override\n        public SerDeserializer findDeserializer(Class<?> beanType) {\n            return DESER;\n        }\n    };\n\n    @Test\n    void test_provider() {\n        SerDeserializers deser = new SerDeserializers(PROVIDER);\n        assertThat(deser.findDeserializer(Person.class)).isSameAs(DESER);\n    }\n\n    @Test\n    void test_classpathImmKey() {\n        assertThat(SerDeserializers.INSTANCE.getDeserializers()).containsKey(ImmKey.class);\n        assertThat(SerDeserializers.LENIENT.getDeserializers()).containsKey(ImmKey.class);\n        assertThat(new SerDeserializers(PROVIDER).getDeserializers()).containsKey(ImmKey.class);\n\n        assertThat(SerDeserializers.INSTANCE.findDeserializer(ImmKey.class).findMetaProperty(ImmKey.class, ImmKey.meta(), \"key\"))\n                .isEqualTo(ImmKey.meta().name());\n        assertThat(SerDeserializers.LENIENT.findDeserializer(ImmKey.class).findMetaProperty(ImmKey.class, ImmKey.meta(), \"wibble\"))\n                .isNull();\n    }\n\n    @Test\n    void test_classpathPair() {\n        assertThat(SerDeserializers.INSTANCE.getDeserializers()).containsKey(Pair.class);\n        assertThat(SerDeserializers.LENIENT.getDeserializers()).containsKey(Pair.class);\n        assertThat(new SerDeserializers(PROVIDER).getDeserializers()).containsKey(Pair.class);\n\n        assertThat(SerDeserializers.INSTANCE.findDeserializer(Pair.class).findMetaProperty(Pair.class, Pair.meta(), \"left\"))\n                .isEqualTo(Pair.meta().first());\n        assertThat(SerDeserializers.LENIENT.findDeserializer(Pair.class).findMetaProperty(Pair.class, ImmKey.meta(), \"wibble\"))\n                .isNull();\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/TestSerTypeMapper.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatExceptionOfType;\n\nimport java.io.File;\nimport java.util.BitSet;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.concurrent.atomic.AtomicIntegerArray;\nimport java.util.concurrent.atomic.AtomicReference;\n\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test {@link SerTypeMapper}.\n */\nclass TestSerTypeMapper {\n\n    private static final JodaBeanSer SETTINGS = JodaBeanSer.PRETTY;\n    private static final JodaBeanSer SETTINGS_NO_SHORT = JodaBeanSer.PRETTY.withShortTypes(false);\n\n    @Test\n    void test_encodeType() {\n        Map<Class<?>, String> cache = new HashMap<>();\n        // base package type\n        assertThat(SerTypeMapper.encodeType(BitSet.class, SETTINGS, \"java.util.\", cache)).isEqualTo(\"BitSet\");\n        assertThat(cache.get(BitSet.class)).isEqualTo(\"BitSet\");\n        // basic type\n        assertThat(SerTypeMapper.encodeType(File.class, SETTINGS, \"java.util.\", cache)).isEqualTo(\"File\");\n        assertThat(cache).doesNotContainKey(File.class);\n        // user type\n        assertThat(SerTypeMapper.encodeType(AtomicReference.class, SETTINGS, \"java.util.\", cache))\n                .isEqualTo(\"java.util.concurrent.atomic.AtomicReference\");\n        assertThat(cache.get(AtomicReference.class)).isEqualTo(\"AtomicReference\");\n        // user type - second occurrence\n        assertThat(SerTypeMapper.encodeType(AtomicReference.class, SETTINGS, \"java.util.\", cache)).isEqualTo(\"AtomicReference\");\n        assertThat(cache.get(AtomicReference.class)).isEqualTo(\"AtomicReference\");\n        // user type - already cached name\n        assertThat(SerTypeMapper.encodeType(org.joda.beans.ser.AtomicReference.class, SETTINGS, \"java.util.\", cache))\n                .isEqualTo(\"org.joda.beans.ser.AtomicReference\");\n        assertThat(cache.get(org.joda.beans.ser.AtomicReference.class)).isEqualTo(\"org.joda.beans.ser.AtomicReference\");\n        // user type\n        assertThat(SerTypeMapper.encodeType(AtomicIntegerArray.class, SETTINGS, \"java.util.\", cache))\n                .isEqualTo(\"java.util.concurrent.atomic.AtomicIntegerArray\");\n        assertThat(cache.get(AtomicIntegerArray.class)).isEqualTo(\"AtomicIntegerArray\");\n        // user type - second occurrence\n        assertThat(SerTypeMapper.encodeType(AtomicIntegerArray.class, SETTINGS, \"java.util.\", cache)).isEqualTo(\"AtomicIntegerArray\");\n        assertThat(cache.get(AtomicIntegerArray.class)).isEqualTo(\"AtomicIntegerArray\");\n        // user type - silly name\n        assertThat(SerTypeMapper.encodeType(BigDecimal.class, SETTINGS, \"java.util.\", cache)).isEqualTo(\"org.joda.beans.ser.BigDecimal\");\n        assertThat(cache.get(BigDecimal.class)).isEqualTo(\"org.joda.beans.ser.BigDecimal\");\n        // user type - silly name\n        assertThat(SerTypeMapper.encodeType(lowerCase.class, SETTINGS, \"java.util.\", cache)).isEqualTo(\"org.joda.beans.ser.lowerCase\");\n        assertThat(cache.get(lowerCase.class)).isEqualTo(\"org.joda.beans.ser.lowerCase\");\n    }\n\n    @Test\n    void test_encodeType_sillyNames() {\n        Map<Class<?>, String> cache = new HashMap<>();\n        // user type - silly name\n        assertThat(SerTypeMapper.encodeType(BigDecimal.class, SETTINGS, \"org.joda.beans.ser.\", cache))\n                .isEqualTo(\"org.joda.beans.ser.BigDecimal\");\n        assertThat(cache.get(BigDecimal.class)).isEqualTo(\"org.joda.beans.ser.BigDecimal\");\n        // user type - silly name\n        assertThat(SerTypeMapper.encodeType(lowerCase.class, SETTINGS, \"org.joda.beans.ser.\", cache))\n                .isEqualTo(\"org.joda.beans.ser.lowerCase\");\n        assertThat(cache.get(lowerCase.class)).isEqualTo(\"org.joda.beans.ser.lowerCase\");\n    }\n\n    @Test\n    void test_encodeType_noCache() {\n        // user type\n        assertThat(SerTypeMapper.encodeType(AtomicIntegerArray.class, SETTINGS, \"java.util.\", null))\n                .isEqualTo(\"java.util.concurrent.atomic.AtomicIntegerArray\");\n        // user type - second occurrence\n        assertThat(SerTypeMapper.encodeType(AtomicIntegerArray.class, SETTINGS, \"java.util.\", null))\n                .isEqualTo(\"java.util.concurrent.atomic.AtomicIntegerArray\");\n        // user type - normal\n        assertThat(SerTypeMapper.encodeType(Normal.class, SETTINGS, \"org.joda.beans.ser.\", null)).isEqualTo(\"Normal\");\n        // user type - silly name\n        assertThat(SerTypeMapper.encodeType(BigDecimal.class, SETTINGS, \"org.joda.beans.ser.\", null))\n                .isEqualTo(\"org.joda.beans.ser.BigDecimal\");\n        // user type - silly name\n        assertThat(SerTypeMapper.encodeType(lowerCase.class, SETTINGS, \"org.joda.beans.ser.\", null))\n                .isEqualTo(\"org.joda.beans.ser.lowerCase\");\n    }\n\n    @Test\n    void test_encodeType_noBasePackage() {\n        Map<Class<?>, String> cache = new HashMap<>();\n        // basic type\n        assertThat(SerTypeMapper.encodeType(File.class, SETTINGS, null, cache)).isEqualTo(\"File\");\n        assertThat(cache).doesNotContainKey(File.class);\n        // user type\n        assertThat(SerTypeMapper.encodeType(AtomicReference.class, SETTINGS, null, cache))\n                .isEqualTo(\"java.util.concurrent.atomic.AtomicReference\");\n        assertThat(cache.get(AtomicReference.class)).isEqualTo(\"AtomicReference\");\n        // user type - second occurrence\n        assertThat(SerTypeMapper.encodeType(AtomicReference.class, SETTINGS, null, cache)).isEqualTo(\"AtomicReference\");\n        assertThat(cache.get(AtomicReference.class)).isEqualTo(\"AtomicReference\");\n    }\n\n    @Test\n    void test_encodeType_noShortTypes() {\n        Map<Class<?>, String> cache = new HashMap<>();\n        // base package type\n        assertThat(SerTypeMapper.encodeType(BitSet.class, SETTINGS_NO_SHORT, \"java.util.\", cache)).isEqualTo(\"java.util.BitSet\");\n        // basic type\n        assertThat(SerTypeMapper.encodeType(File.class, SETTINGS_NO_SHORT, \"java.util.\", cache)).isEqualTo(\"File\");\n        // user type\n        assertThat(SerTypeMapper.encodeType(AtomicReference.class, SETTINGS_NO_SHORT, \"java.util.\", cache))\n                .isEqualTo(\"java.util.concurrent.atomic.AtomicReference\");\n        // user type - second occurrence\n        assertThat(SerTypeMapper.encodeType(AtomicReference.class, SETTINGS_NO_SHORT, \"java.util.\", cache))\n                .isEqualTo(\"java.util.concurrent.atomic.AtomicReference\");\n        assertThat(cache).isEmpty();\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_decodeType() throws Exception {\n        Map<String, Class<?>> cache = new HashMap<>();\n        // base package type\n        assertThat(SerTypeMapper.decodeType(\"BitSet\", SETTINGS, \"java.util.\", cache)).isEqualTo(BitSet.class);\n        assertThat(cache.get(\"BitSet\")).isEqualTo(BitSet.class);\n        // basic type\n        assertThat(SerTypeMapper.decodeType(\"File\", SETTINGS, \"java.util.\", cache)).isEqualTo(File.class);\n        assertThat(cache).doesNotContainKey(\"File\");\n        // user type\n        assertThat(SerTypeMapper.decodeType(\"java.util.concurrent.atomic.AtomicReference\", SETTINGS, \"java.util.\", cache))\n                .isEqualTo(AtomicReference.class);\n        assertThat(cache.get(\"java.util.concurrent.atomic.AtomicReference\")).isEqualTo(AtomicReference.class);\n        assertThat(cache.get(\"AtomicReference\")).isEqualTo(AtomicReference.class);\n        // user type\n        assertThat(SerTypeMapper.decodeType(\"AtomicReference\", SETTINGS, \"java.util.\", cache)).isEqualTo(AtomicReference.class);\n        assertThat(cache.get(\"java.util.concurrent.atomic.AtomicReference\")).isEqualTo(AtomicReference.class);\n        assertThat(cache.get(\"AtomicReference\")).isEqualTo(AtomicReference.class);\n        // user type\n        assertThat(SerTypeMapper.decodeType(\"java.util.concurrent.atomic.AtomicIntegerArray\", SETTINGS, \"java.util.\", cache))\n                .isEqualTo(AtomicIntegerArray.class);\n        assertThat(cache.get(\"java.util.concurrent.atomic.AtomicIntegerArray\")).isEqualTo(AtomicIntegerArray.class);\n        assertThat(cache.get(\"AtomicIntegerArray\")).isEqualTo(AtomicIntegerArray.class);\n        // user type\n        assertThat(SerTypeMapper.decodeType(\"AtomicIntegerArray\", SETTINGS, \"java.util.\", cache)).isEqualTo(AtomicIntegerArray.class);\n        assertThat(cache.get(\"java.util.concurrent.atomic.AtomicIntegerArray\")).isEqualTo(AtomicIntegerArray.class);\n        assertThat(cache.get(\"AtomicIntegerArray\")).isEqualTo(AtomicIntegerArray.class);\n    }\n\n    @Test\n    void test_decodeType_noCache() throws Exception {\n        // base package type\n        assertThat(SerTypeMapper.decodeType(\"BitSet\", SETTINGS, \"java.util.\", null)).isEqualTo(BitSet.class);\n        // basic type\n        assertThat(SerTypeMapper.decodeType(\"File\", SETTINGS, \"java.util.\", null)).isEqualTo(File.class);\n        // user type\n        assertThat(SerTypeMapper.decodeType(\"java.util.concurrent.atomic.AtomicReference\", SETTINGS, \"java.util.\", null))\n                .isEqualTo(AtomicReference.class);\n    }\n\n    @Test\n    void test_decodeType_noBasePackage() throws Exception {\n        Map<String, Class<?>> cache = new HashMap<>();\n        // basic type\n        assertThat(SerTypeMapper.decodeType(\"File\", SETTINGS, null, cache)).isEqualTo(File.class);\n        // user type\n        assertThat(SerTypeMapper.decodeType(\"java.util.concurrent.atomic.AtomicReference\", SETTINGS, null, cache))\n                .isEqualTo(AtomicReference.class);\n    }\n\n    @Test\n    void test_decodeType_emptyClassName() throws Exception {\n        Map<String, Class<?>> cache = new HashMap<>();\n        assertThatExceptionOfType(ClassNotFoundException.class)\n                .isThrownBy(() -> SerTypeMapper.decodeType(\"\", SETTINGS, \"java.util.\", cache));\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/TestSerializeSmartReader.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;\n\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.impl.flexi.FlexiBean;\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.ImmAddress;\nimport org.joda.beans.sample.ImmEmpty;\nimport org.joda.beans.sample.ImmGuava;\nimport org.joda.beans.sample.ImmOptional;\nimport org.joda.beans.sample.SimpleJson;\nimport org.joda.beans.test.BeanAssert;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.params.ParameterizedTest;\nimport org.junit.jupiter.params.provider.MethodSource;\n\nimport com.google.common.primitives.Bytes;\n\n/**\n * Test smart reader.\n */\nclass TestSerializeSmartReader {\n\n    @Test\n    void test_binary_address() throws IOException {\n        Address bean = SerTestHelper.testAddress();\n        byte[] bytes = JodaBeanSer.PRETTY.binWriter().write(bean);\n        Bean roundtrip = JodaBeanSer.PRETTY.smartReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, roundtrip);\n    }\n\n    @Test\n    void test_binary_immAddress() throws IOException {\n        ImmAddress bean = SerTestHelper.testImmAddress(false);\n        byte[] bytes = JodaBeanSer.PRETTY.binWriter().write(bean);\n        Bean roundtrip = JodaBeanSer.PRETTY.smartReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, roundtrip);\n    }\n\n    @Test\n    void test_binary_optional() throws IOException {\n        ImmOptional bean = SerTestHelper.testImmOptional();\n        byte[] bytes = JodaBeanSer.PRETTY.binWriter().write(bean);\n        Bean roundtrip = JodaBeanSer.PRETTY.smartReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, roundtrip);\n    }\n\n    @Test\n    void test_binary_collections() throws IOException {\n        ImmGuava<String> bean = SerTestHelper.testCollections(true);\n        byte[] bytes = JodaBeanSer.PRETTY.binWriter().write(bean);\n        Bean roundtrip = JodaBeanSer.PRETTY.smartReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, roundtrip);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_binaryReferencing_optional() throws IOException {\n        ImmOptional bean = SerTestHelper.testImmOptional();\n        byte[] bytes = JodaBeanSer.PRETTY.binWriterReferencing().write(bean);\n        Bean roundtrip = JodaBeanSer.PRETTY.smartReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, roundtrip);\n    }\n\n    @Test\n    void test_binaryReferencing_collections() throws IOException {\n        ImmGuava<String> bean = SerTestHelper.testCollections(true);\n        byte[] bytes = JodaBeanSer.PRETTY.binWriterReferencing().write(bean);\n        Bean roundtrip = JodaBeanSer.PRETTY.smartReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, roundtrip);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_json_address() throws IOException {\n        Address bean = SerTestHelper.testAddress();\n        String json = JodaBeanSer.PRETTY.jsonWriter().write(bean);\n        assertCharsets(JodaBeanSer.PRETTY, json, bean, Address.class);\n    }\n\n    @Test\n    void test_json_immAddress() throws IOException {\n        ImmAddress bean = SerTestHelper.testImmAddress(false);\n        String json = JodaBeanSer.PRETTY.jsonWriter().write(bean);\n        assertCharsets(JodaBeanSer.PRETTY, json, bean, ImmAddress.class);\n    }\n\n    @Test\n    void test_json_optional() throws IOException {\n        ImmOptional bean = SerTestHelper.testImmOptional();\n        String json = JodaBeanSer.PRETTY.jsonWriter().write(bean);\n        assertCharsets(JodaBeanSer.PRETTY, json, bean, ImmOptional.class);\n    }\n\n    @Test\n    void test_json_collections() throws IOException {\n        ImmGuava<String> bean = SerTestHelper.testCollections(true);\n        String json = JodaBeanSer.PRETTY.jsonWriter().write(bean);\n        assertCharsets(JodaBeanSer.PRETTY, json, bean, ImmGuava.class);\n    }\n\n    @Test\n    void test_json_minimal() throws IOException {\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(new byte[] {'{', '}'})).isTrue();\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(new byte[] {'{', '\\n', ' ', '}'})).isTrue();\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_simpleJson_empty() throws IOException {\n        ImmEmpty bean = ImmEmpty.builder().build();\n        String json = JodaBeanSer.PRETTY.simpleJsonWriter().write(bean);\n        assertCharsets(JodaBeanSer.PRETTY, json, bean, ImmEmpty.class);\n    }\n\n    @Test\n    void test_simpleJson_basic() throws IOException {\n        SimpleJson bean = SerTestHelper.testSimpleJson();\n        String json = JodaBeanSer.PRETTY.simpleJsonWriter().write(bean);\n        assertCharsets(JodaBeanSer.PRETTY, json, bean, SimpleJson.class);\n    }\n\n    @Test\n    void test_simpleJson_optional() throws IOException {\n        ImmOptional bean = SerTestHelper.testImmOptional();\n        String json = JodaBeanSer.PRETTY.simpleJsonWriter().write(bean);\n        assertCharsets(JodaBeanSer.PRETTY, json, bean, ImmOptional.class);\n    }\n\n    @Test\n    void test_simpleJson_collections() throws IOException {\n        ImmGuava<String> bean = SerTestHelper.testCollections(true);\n        String json = JodaBeanSer.PRETTY.simpleJsonWriter().write(bean);\n        assertCharsets(JodaBeanSer.PRETTY, json, bean, ImmGuava.class);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_xml_address() throws IOException {\n        Address bean = SerTestHelper.testAddress();\n        String xml = JodaBeanSer.PRETTY.xmlWriter().write(bean);\n        assertCharsets(JodaBeanSer.PRETTY, xml, bean, Address.class);\n    }\n\n    @Test\n    void test_xml_immAddress() throws IOException {\n        ImmAddress bean = SerTestHelper.testImmAddress(false);\n        String xml = JodaBeanSer.PRETTY.xmlWriter().write(bean);\n        assertCharsets(JodaBeanSer.PRETTY, xml, bean, ImmAddress.class);\n    }\n\n    @Test\n    void test_xml_optional() throws IOException {\n        ImmOptional bean = SerTestHelper.testImmOptional();\n        String xml = JodaBeanSer.PRETTY.xmlWriter().write(bean);\n        assertCharsets(JodaBeanSer.PRETTY, xml, bean, ImmOptional.class);\n    }\n\n    @Test\n    void test_xml_collections() throws IOException {\n        ImmGuava<String> bean = SerTestHelper.testCollections(true);\n        String xml = JodaBeanSer.PRETTY.xmlWriter().write(bean);\n        assertCharsets(JodaBeanSer.PRETTY, xml, bean, ImmGuava.class);\n    }\n\n    @Test\n    void test_xml_minimal() throws IOException {\n        byte[] bytes = \"<bean></bean>\".getBytes(StandardCharsets.UTF_8);\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(bytes)).isTrue();\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(bytes)).isTrue();\n    }\n\n    //-----------------------------------------------------------------------\n    private static <T extends Bean> void assertCharsets(JodaBeanSer settings, String text, T bean, Class<T> type) {\n        byte[] json8Bytes = text.getBytes(StandardCharsets.UTF_8);\n        assertThat(settings.smartReader().isKnownFormat(json8Bytes)).isTrue();\n        T smart = settings.smartReader().read(json8Bytes, type);\n        BeanAssert.assertBeanEquals(bean, smart);\n\n        byte[] utf8Bytes = Bytes.concat(new byte[] {(byte) 0xef, (byte) 0xbb, (byte) 0xbf}, json8Bytes);\n        assertThat(settings.smartReader().isKnownFormat(utf8Bytes)).isTrue();\n        T smart8 = settings.smartReader().read(utf8Bytes, type);\n        BeanAssert.assertBeanEquals(bean, smart8);\n    }\n\n    //-----------------------------------------------------------------------\n    static Object[][] data_badFormat() {\n        return new Object[][] {\n                {\"xml\"},\n                {\"<beax\"},\n                {\"{,}\"},\n                {\"{  \\t\\r\\n \"},\n                {\"{1,2}\"},\n                {\"{\\\"a\\\",6}\"},\n                {\"{\\\"a\\\":[}}\"},\n                {\"\"},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_badFormat\")\n    void test_badFormat(String text) throws IOException {\n        byte[] bytes = text.getBytes(StandardCharsets.UTF_8);\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.smartReader().read(bytes, FlexiBean.class));\n    }\n\n    static Object[][] data_unknownFormat() {\n        return new Object[][] {\n                {\"xml\"},\n                {\"<beax\"},\n                {\"{,}\"},\n                {\"{  \\t\\r\\n \"},\n                {\"{1,2}\"},\n                {\"\"},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_unknownFormat\")\n    void test_isKnownFormat_false(String text) throws IOException {\n        byte[] bytes = text.getBytes(StandardCharsets.UTF_8);\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(bytes)).isFalse();\n    }\n\n    @Test\n    void test_isKnownFormat_utf8_wrong() throws IOException {\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(\n                new byte[] {(byte) 0xef, (byte) 0xbb, (byte) 0xbf, '?'})).isFalse();\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(\n                new byte[] {(byte) 0xef, (byte) 0xbb, (byte) 0xb0, '<'})).isFalse();\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(\n                new byte[] {(byte) 0xef, (byte) 0xb0, (byte) 0xbf, '<'})).isFalse();\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(\n                new byte[] {(byte) 0xe0, (byte) 0xbb, (byte) 0xbf, '<'})).isFalse();\n    }\n\n    @Test\n    void test_isKnownFormat_utf16le_wrong() throws IOException {\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(\n                new byte[] {(byte) 0xff, (byte) 0xfe, '?', (byte) 0x00})).isFalse();\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(\n                new byte[] {(byte) 0xff, (byte) 0xfe, '<', (byte) 0x01})).isFalse();\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(\n                new byte[] {(byte) 0xff, (byte) 0xf0, '<', (byte) 0x00})).isFalse();\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(\n                new byte[] {(byte) 0xf0, (byte) 0xfe, '<', (byte) 0x00})).isFalse();\n    }\n\n    @Test\n    void test_isKnownFormat_utf16be_wrong() throws IOException {\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(\n                new byte[] {(byte) 0xfe, (byte) 0xff, (byte) 0x00, '?'})).isFalse();\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(\n                new byte[] {(byte) 0xfe, (byte) 0xff, (byte) 0x01, '<'})).isFalse();\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(\n                new byte[] {(byte) 0xfe, (byte) 0xf0, (byte) 0x00, '<'})).isFalse();\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(\n                new byte[] {(byte) 0xf0, (byte) 0xff, (byte) 0x00, '<'})).isFalse();\n    }\n\n    @Test\n    void test_isKnownFormat_binary_false() throws IOException {\n        byte[] bytes = new byte[] {(byte) 0x92, (byte) 0x00};\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(bytes)).isFalse();\n    }\n\n    @Test\n    void test_isKnownFormat_binaryRef_false() throws IOException {\n        byte[] bytes = new byte[] {(byte) 0x94, (byte) 0x00};\n        assertThat(JodaBeanSer.COMPACT.smartReader().isKnownFormat(bytes)).isFalse();\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/bin/TestBinPerformance.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport java.io.IOException;\nimport java.time.Duration;\nimport java.util.Set;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.ImmAddress;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerTestHelper;\nimport org.junit.jupiter.api.Disabled;\nimport org.junit.jupiter.api.Test;\n\nimport com.google.common.base.Stopwatch;\n\n/**\n * Test bean round-trip using Binary.\n */\n@Disabled(\"Performance test - run manually when needed\")\nclass TestBinPerformance {\n\n    private static final int REPEAT_OUTER = 4;\n    private static final int REPEAT_INNER = 20;\n    private static final JodaBeanSer SER = JodaBeanSer.PRETTY.withBeanValueClasses(Set.of(ImmAddress.class));\n\n    @Test\n    void testPerformance() throws IOException {\n//        var bean = SerTestHelper.testImmAddress(true);  // REPEAT_INNER = 2000\n//        var bean = SerTestHelper.testBigIntegerList();  //  REPEAT_INNER = 20\n        var bean = SerTestHelper.testBigAddressArray();  //  REPEAT_INNER = 20\n        invokeNew(bean);\n        invokeRef(bean);\n        invokeStd(bean);\n        invokeNew(bean);\n        invokeRef(bean);\n        invokeStd(bean);\n        System.out.println(\"---\");\n        invokeNew(bean);\n        invokeRef(bean);\n        invokeStd(bean);\n    }\n\n    private void invokeNew(Bean bean) throws IOException {\n        byte[] bytes = write(JodaBeanBinFormat.PACKED, bean, \"PAK\");\n//        System.out.println(new BeanPackVisualizer(bytes).visualizeData());\n        read(bytes, \"PAK\");\n    }\n\n    private void invokeRef(Bean bean) {\n        byte[] bytes = write(JodaBeanBinFormat.REFERENCING, bean, \"REF\");\n        read(bytes, \"REF\");\n    }\n\n    private void invokeStd(Bean bean) {\n        byte[] bytes = write(JodaBeanBinFormat.STANDARD, bean, \"STD\");\n        read(bytes, \"STD\");\n    }\n\n    //-----------------------------------------------------------------------\n    private byte[] write(JodaBeanBinFormat format, Bean bean, String type) {\n        byte[] bytes = null;\n        var total = Duration.ZERO;\n        for (int i = 0; i < REPEAT_OUTER; i++) {\n            Stopwatch watch = Stopwatch.createStarted();\n            for (int j = 0; j < REPEAT_INNER; j++) {\n                bytes = new JodaBeanBinWriter(SER, format).write(bean);\n                if (bytes.length < 100) {\n                    System.out.println();\n                }\n            }\n            watch.stop();\n            total = total.plus(watch.elapsed());\n        }\n        System.out.println(type + \"-WRITE: \" + calcMillis(total) + \" ms, \" + bytes.length + \" bytes\");\n        return bytes;\n    }\n\n    private void read(byte[] bytes, String type) {\n        Stopwatch watch = Stopwatch.createStarted();\n        for (int i = 0; i < REPEAT_OUTER * REPEAT_INNER; i++) {\n            var bean = new JodaBeanBinReader(SER).read(bytes);\n            if (bean instanceof Address) {\n                System.out.println();\n            }\n        }\n        watch.stop();\n        System.out.println(type + \"-READ: \" + calcMillis(watch.elapsed()) + \" ms\");\n    }\n\n    private double calcMillis(Duration total) {\n        return (total.dividedBy(REPEAT_OUTER).toNanos() / 1000) / 1000d;\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/bin/TestSerializePackedBin.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport static java.lang.System.lineSeparator;\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatNoException;\nimport static org.assertj.core.api.Assertions.assertThatRuntimeException;\nimport static org.assertj.core.api.Assertions.offset;\nimport static org.joda.beans.ser.bin.BeanPack.BIN_16;\nimport static org.joda.beans.ser.bin.BeanPack.BIN_8;\nimport static org.joda.beans.ser.bin.BeanPack.BYTE_8;\nimport static org.joda.beans.ser.bin.BeanPack.CHAR_16;\nimport static org.joda.beans.ser.bin.BeanPack.DATE;\nimport static org.joda.beans.ser.bin.BeanPack.DATE_PACKED;\nimport static org.joda.beans.ser.bin.BeanPack.DOUBLE_64;\nimport static org.joda.beans.ser.bin.BeanPack.DOUBLE_ARRAY_16;\nimport static org.joda.beans.ser.bin.BeanPack.DOUBLE_ARRAY_8;\nimport static org.joda.beans.ser.bin.BeanPack.DOUBLE_INT_8;\nimport static org.joda.beans.ser.bin.BeanPack.DURATION;\nimport static org.joda.beans.ser.bin.BeanPack.FLOAT_32;\nimport static org.joda.beans.ser.bin.BeanPack.INSTANT;\nimport static org.joda.beans.ser.bin.BeanPack.INT_16;\nimport static org.joda.beans.ser.bin.BeanPack.INT_32;\nimport static org.joda.beans.ser.bin.BeanPack.LONG_16;\nimport static org.joda.beans.ser.bin.BeanPack.LONG_32;\nimport static org.joda.beans.ser.bin.BeanPack.LONG_64;\nimport static org.joda.beans.ser.bin.BeanPack.LONG_8;\nimport static org.joda.beans.ser.bin.BeanPack.MIN_FIX_STR;\nimport static org.joda.beans.ser.bin.BeanPack.SHORT_16;\nimport static org.joda.beans.ser.bin.BeanPack.STR_8;\nimport static org.joda.beans.ser.bin.BeanPack.TIME;\nimport static org.joda.beans.ser.bin.BeanPack.TYPE_CODE_GRID;\nimport static org.joda.beans.ser.bin.BeanPack.UTF_8;\nimport static org.joda.beans.ser.bin.JodaBeanBinFormat.PACKED;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.DataOutputStream;\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\nimport java.time.Duration;\nimport java.time.Instant;\nimport java.time.LocalDate;\nimport java.time.LocalTime;\nimport java.util.Optional;\nimport java.util.Set;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.impl.flexi.FlexiBean;\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.Company;\nimport org.joda.beans.sample.ImmAddress;\nimport org.joda.beans.sample.ImmArrays;\nimport org.joda.beans.sample.ImmDefault;\nimport org.joda.beans.sample.ImmDoubleFloat;\nimport org.joda.beans.sample.ImmGuava;\nimport org.joda.beans.sample.ImmKey;\nimport org.joda.beans.sample.ImmKeyList;\nimport org.joda.beans.sample.ImmNamedKey;\nimport org.joda.beans.sample.ImmOptional;\nimport org.joda.beans.sample.ImmPerson;\nimport org.joda.beans.sample.JodaConvertBean;\nimport org.joda.beans.sample.JodaConvertWrapper;\nimport org.joda.beans.sample.Pair;\nimport org.joda.beans.sample.Person;\nimport org.joda.beans.sample.PrimitiveBean;\nimport org.joda.beans.sample.RiskLevel;\nimport org.joda.beans.sample.TupleFinal;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerDeserializers;\nimport org.joda.beans.ser.SerTestHelper;\nimport org.joda.beans.test.BeanAssert;\nimport org.joda.collect.grid.DenseGrid;\nimport org.joda.collect.grid.SparseGrid;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.function.ThrowingConsumer;\n\nimport com.google.common.io.Resources;\n\n/**\n * Test property roundtrip using binary.\n */\nclass TestSerializePackedBin {\n\n    @Test\n    void test_writeAddress() throws IOException {\n        var bean = SerTestHelper.testAddress();\n\n        var bytes = JodaBeanSer.PRETTY.binWriter(PACKED).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n        assertEqualsSerialization(bytes, \"/org/joda/beans/ser/Address1.packbinstr\");\n\n        var parsed = (Address) JodaBeanSer.PRETTY.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeImmAddress() throws IOException {\n        var bean = SerTestHelper.testImmAddress(false);\n        var bytes = JodaBeanSer.PRETTY.binWriter(PACKED).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n        assertEqualsSerialization(bytes, \"/org/joda/beans/ser/ImmAddress1.packbinstr\");\n\n        var parsed = (ImmAddress) JodaBeanSer.PRETTY.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeImmAddressCached() throws IOException {\n        var bean = SerTestHelper.testImmAddress(false);\n        var bytes = JodaBeanSer.PRETTY.withBeanValueClasses(Set.of(ImmPerson.class)).binWriter(PACKED).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n        assertEqualsSerialization(bytes, \"/org/joda/beans/ser/ImmAddressCached1.packbinstr\");\n\n        var parsed = (ImmAddress) JodaBeanSer.PRETTY.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeImmOptional() throws IOException {\n        var bean = SerTestHelper.testImmOptional();\n        var bytes = JodaBeanSer.PRETTY.withIncludeDerived(true).binWriter(PACKED).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n        assertEqualsSerialization(bytes, \"/org/joda/beans/ser/ImmOptional1.packbinstr\");\n\n        var parsed = (ImmOptional) JodaBeanSer.PRETTY.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeImmArrays() throws IOException {\n        var bean = ImmArrays.of(\n                new int[] {1, 3, 2},\n                new long[] {1, 4, 3},\n                new double[] {1.1, 2.2, 3.3},\n                new boolean[] {true, false},\n                new int[][] {{1, 2}, {2}, {}},\n                new boolean[][] {{true, false}, {false}, {}});\n        var bytes = JodaBeanSer.PRETTY.binWriter(PACKED).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n        assertEqualsSerialization(bytes, \"/org/joda/beans/ser/ImmArrays1.packbinstr\");\n\n        var parsed = JodaBeanSer.PRETTY.binReader().read(bytes, ImmArrays.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeCollections() throws IOException {\n        var bean = SerTestHelper.testCollections(true);\n        var bytes = JodaBeanSer.PRETTY.binWriter(PACKED).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n        assertEqualsSerialization(bytes, \"/org/joda/beans/ser/Collections1.packbinstr\");\n\n        @SuppressWarnings(\"unchecked\")\n        var parsed = (ImmGuava<String>) JodaBeanSer.PRETTY.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    private static void assertEqualsSerialization(byte[] actualBytes, String expectedResource) throws IOException {\n        var url = TestSerializePackedBin.class.getResource(expectedResource);\n        var expected = Resources.asCharSource(url, StandardCharsets.UTF_8).read();\n        var actual = JodaBeanBinReader.visualize(actualBytes);\n        assertThat(actual.trim().replace(lineSeparator(), \"\\n\")).isEqualTo(expected.trim().replace(lineSeparator(), \"\\n\"));\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_writeJodaConvertInterface() {\n        var bean = SerTestHelper.testGenericInterfaces();\n\n        var bytes = JodaBeanSer.COMPACT.binWriter(PACKED).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeIntermediateInterface() {\n        var bean = SerTestHelper.testIntermediateInterfaces();\n\n        var bytes = JodaBeanSer.COMPACT.binWriter(PACKED).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, ImmKeyList.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeJodaConvert() {\n        // immutable bean that is serialized as joda convert\n        var bean = ImmNamedKey.of(\"name\");\n\n        var bytes = JodaBeanSer.COMPACT.binWriter(PACKED).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n\n        var parsed = (ImmNamedKey) JodaBeanSer.COMPACT.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_readWrite_primitives() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(6);\n        out.writeString(\"tru\");\n        out.writeBoolean(true);\n        out.writeString(\"fal\");\n        out.writeBoolean(false);\n        out.writeString(\"byt\");\n        out.writeByte((byte) 1);\n        out.writeString(\"sht\");\n        out.writeShort((short) 2);\n        out.writeString(\"flt\");\n        out.writeFloat(1.2f);\n        out.writeString(\"dbl\");\n        out.writeDouble(1.8d);\n        var expected = baos.toByteArray();\n\n        var bean = new FlexiBean();\n        bean.set(\"tru\", Boolean.TRUE);\n        bean.set(\"fal\", Boolean.FALSE);\n        bean.set(\"byt\", Byte.valueOf((byte) 1));\n        bean.set(\"sht\", Short.valueOf((short) 2));\n        bean.set(\"flt\", Float.valueOf(1.2f));\n        bean.set(\"dbl\", Double.valueOf(1.8d));\n        var bytes = JodaBeanSer.COMPACT.binWriter(PACKED).write(bean, false);\n        assertThat(bytes).isEqualTo(expected);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_primitiveTypeChanged() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(2);\n        out.writeString(\"a\");\n        out.writeInt(6);\n        out.writeString(\"b\");\n        out.writeLong(5);\n        var bytes = baos.toByteArray();\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, ImmDoubleFloat.class);\n        assertThat(parsed.getA()).isCloseTo(6, offset(1e-10));\n        assertThat(parsed.getB()).isCloseTo(5, offset(1e-10));\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_readWrite_booleanAsObject() throws Throwable {\n        assertValueSerializesAsObject(Boolean.TRUE, BeanPack.TRUE, out -> {});\n        assertValueSerializesAsObject(Boolean.FALSE, BeanPack.FALSE, out -> {});\n    }\n\n    @Test\n    void test_readWrite_charAsObject() throws Throwable {\n        assertValueSerializesAsObject(Character.MAX_VALUE, CHAR_16, out -> out.writeChar(Character.MAX_VALUE));\n        assertValueSerializesAsObject(Character.MIN_VALUE, CHAR_16, out -> out.writeChar(Character.MIN_VALUE));\n    }\n\n    @Test\n    void test_readWrite_byteAsObject() throws Throwable {\n        assertValueSerializesAsObject(Byte.MAX_VALUE, BYTE_8, out -> out.writeByte(Byte.MAX_VALUE));\n        assertValueSerializesAsObject(Byte.MIN_VALUE, BYTE_8, out -> out.writeByte(Byte.MIN_VALUE));\n    }\n\n    @Test\n    void test_readWrite_shortAsObject() throws Throwable {\n        assertValueSerializesAsObject(Short.MAX_VALUE, SHORT_16, out -> out.writeShort(Short.MAX_VALUE));\n        assertValueSerializesAsObject(Short.MIN_VALUE, SHORT_16, out -> out.writeShort(Short.MIN_VALUE));\n    }\n\n    @Test\n    void test_readWrite_intAsObject() throws Throwable {\n        assertValueSerializesAsObject(127, 127, out -> {});\n        assertValueSerializesAsObject(0, 0, out -> {});\n        assertValueSerializesAsObject(-16, -16, out -> {});\n        assertValueSerializesAsObject(-17, INT_16, out -> out.writeShort(-17));\n        assertValueSerializesAsObject(-128, INT_16, out -> out.writeShort(-128));\n        assertValueSerializesAsObject((int) Short.MAX_VALUE, INT_16, out -> out.writeShort(Short.MAX_VALUE));\n        assertValueSerializesAsObject((int) Short.MIN_VALUE, INT_16, out -> out.writeShort(Short.MIN_VALUE));\n        assertValueSerializesAsObject(Integer.MAX_VALUE, INT_32, out -> out.writeInt(Integer.MAX_VALUE));\n        assertValueSerializesAsObject(Integer.MIN_VALUE, INT_32, out -> out.writeInt(Integer.MIN_VALUE));\n    }\n\n    @Test\n    void test_readWrite_longAsObject() throws Throwable {\n        assertValueSerializesAsObject(127L, LONG_8, out -> out.writeByte(127));\n        assertValueSerializesAsObject(0L, LONG_8, out -> out.writeByte(0));\n        assertValueSerializesAsObject(-128L, LONG_8, out -> out.writeByte(-128));\n        assertValueSerializesAsObject((long) Short.MAX_VALUE, LONG_16, out -> out.writeShort(Short.MAX_VALUE));\n        assertValueSerializesAsObject((long) Short.MIN_VALUE, LONG_16, out -> out.writeShort(Short.MIN_VALUE));\n        assertValueSerializesAsObject((long) Integer.MAX_VALUE, LONG_32, out -> out.writeInt(Integer.MAX_VALUE));\n        assertValueSerializesAsObject((long) Integer.MIN_VALUE, LONG_32, out -> out.writeInt(Integer.MIN_VALUE));\n        assertValueSerializesAsObject(Long.MAX_VALUE, LONG_64, out -> out.writeLong(Long.MAX_VALUE));\n        assertValueSerializesAsObject(Long.MIN_VALUE, LONG_64, out -> out.writeLong(Long.MIN_VALUE));\n    }\n\n    @Test\n    void test_readWrite_floatAsObject() throws Throwable {\n        assertValueSerializesAsObject(Float.MAX_VALUE, FLOAT_32, out -> out.writeFloat(Float.MAX_VALUE));\n        assertValueSerializesAsObject(Float.MIN_VALUE, FLOAT_32, out -> out.writeFloat(Float.MIN_VALUE));\n        assertValueSerializesAsObject(Float.NaN, FLOAT_32, out -> out.writeFloat(Float.NaN));\n        assertValueSerializesAsObject(Float.POSITIVE_INFINITY, FLOAT_32, out -> out.writeFloat(Float.POSITIVE_INFINITY));\n        assertValueSerializesAsObject(Float.NEGATIVE_INFINITY, FLOAT_32, out -> out.writeFloat(Float.NEGATIVE_INFINITY));\n    }\n\n    @Test\n    void test_readWrite_doubleAsObject() throws Throwable {\n        assertValueSerializesAsObject(0d, DOUBLE_INT_8, out -> out.writeByte(0));\n        assertValueSerializesAsObject((double) 127, DOUBLE_INT_8, out -> out.writeByte(127));\n        assertValueSerializesAsObject((double) -1, DOUBLE_INT_8, out -> out.writeByte(-1));\n        assertValueSerializesAsObject((double) -128, DOUBLE_INT_8, out -> out.writeByte(-128));\n\n        assertValueSerializesAsObject(-0d, DOUBLE_64, out -> out.writeDouble(-0f));\n        assertValueSerializesAsObject(1.1d, DOUBLE_64, out -> out.writeDouble(1.1d));\n        assertValueSerializesAsObject(Double.MAX_VALUE, DOUBLE_64, out -> out.writeDouble(Double.MAX_VALUE));\n        assertValueSerializesAsObject(Double.MIN_VALUE, DOUBLE_64, out -> out.writeDouble(Double.MIN_VALUE));\n        assertValueSerializesAsObject(Double.NaN, DOUBLE_64, out -> out.writeDouble(Double.NaN));\n        assertValueSerializesAsObject(Double.POSITIVE_INFINITY, DOUBLE_64, out -> out.writeDouble(Double.POSITIVE_INFINITY));\n        assertValueSerializesAsObject(Double.NEGATIVE_INFINITY, DOUBLE_64, out -> out.writeDouble(Double.NEGATIVE_INFINITY));\n    }\n\n    @Test\n    void test_readWrite_dateAsObject() throws Throwable {\n        assertValueSerializesAsObject(LocalDate.of(2024, 6, 1), DATE_PACKED, out -> out.writeShort((short) ((24 * 12 + 5 << 5) + 1)));\n        assertValueSerializesAsObject(LocalDate.of(2000, 1, 1), DATE_PACKED, out -> out.writeShort((short) ((0 * 12 + 0 << 5) + 1)));\n        assertValueSerializesAsObject(LocalDate.of(2169, 12, 31), DATE_PACKED, out -> out.writeShort((short) ((169 * 12 + 11 << 5) + 31)));\n        assertValueSerializesAsObject(LocalDate.of(2170, 1, 1), DATE, out -> {\n            out.writeByte((byte) 0);\n            out.writeInt((2170 << 9) + (1 << 5) + 1);\n        });\n        assertValueSerializesAsObject(LocalDate.of(1999, 12, 31), DATE, out -> {\n            out.writeByte((byte) 0);\n            out.writeInt((1999 << 9) + (12 << 5) + 31);\n        });\n        assertValueSerializesAsObject(LocalDate.MAX, DATE, out -> {\n            out.writeByte((byte) (999999999 >> 23));\n            out.writeInt((999999999 << 9) + (12 << 5) + 31);\n        });\n        assertValueSerializesAsObject(LocalDate.MIN, DATE, out -> {\n            out.writeByte((byte) (-999999999 >> 23));\n            out.writeInt((-999999999 << 9) + (1 << 5) + 1);\n        });\n    }\n\n    @Test\n    void test_readWrite_timeAsObject() throws Throwable {\n        assertValueSerializesAsObject(LocalTime.MAX, TIME, out -> {\n            out.writeShort((short) (LocalTime.MAX.toNanoOfDay() >> 32));\n            out.writeInt((int) LocalTime.MAX.toNanoOfDay());\n        });\n        assertValueSerializesAsObject(LocalTime.MIN, TIME, out -> {\n            out.writeShort((byte) 0);\n            out.writeInt(0);\n        });\n    }\n\n    @Test\n    void test_readWrite_instantAsObject() throws Throwable {\n        assertValueSerializesAsObject(Instant.MAX, INSTANT, out -> {\n            out.writeLong(Instant.MAX.getEpochSecond());\n            out.writeInt(Instant.MAX.getNano());\n        });\n        assertValueSerializesAsObject(Instant.EPOCH, INSTANT, out -> {\n            out.writeLong(Instant.EPOCH.getEpochSecond());\n            out.writeInt(Instant.EPOCH.getNano());\n        });\n        assertValueSerializesAsObject(Instant.MIN, INSTANT, out -> {\n            out.writeLong(Instant.MIN.getEpochSecond());\n            out.writeInt(Instant.MIN.getNano());\n        });\n    }\n\n    @Test\n    void test_readWrite_durationAsObject() throws Throwable {\n        assertValueSerializesAsObject(Duration.ofSeconds(Long.MAX_VALUE, 999_999_999), DURATION, out -> {\n            out.writeLong(Long.MAX_VALUE);\n            out.writeInt(999_999_999);\n        });\n        assertValueSerializesAsObject(Duration.ofSeconds(Long.MIN_VALUE), DURATION, out -> {\n            out.writeLong(Long.MIN_VALUE);\n            out.writeInt(0);\n        });\n    }\n\n    @Test\n    void test_readWrite_stringAsObject() throws Throwable {\n        assertValueSerializesAsObject(\"\", MIN_FIX_STR + 0, out -> {});\n        assertValueSerializesAsObject(\"A\", MIN_FIX_STR + 1, out -> out.write(\"A\".getBytes(UTF_8)));\n        assertValueSerializesAsObject(\"A\".repeat(12), MIN_FIX_STR + 12, out -> out.write(\"A\".repeat(12).getBytes(UTF_8)));\n        assertValueSerializesAsObject(\"A\".repeat(40), MIN_FIX_STR + 40, out -> out.write(\"A\".repeat(40).getBytes(UTF_8)));\n        assertValueSerializesAsObject(\"A\".repeat(41), STR_8, out -> {\n            out.writeByte(41);\n            out.write(\"A\".repeat(41).getBytes(UTF_8));\n        });\n        assertValueSerializesAsObject(\"A\".repeat(255), STR_8, out -> {\n            out.writeByte(255);\n            out.write(\"A\".repeat(255).getBytes(UTF_8));\n        });\n    }\n\n    @Test\n    void test_readWrite_byteArrayAsObject() throws Throwable {\n        assertValueSerializesAsObject(new byte[] {}, BIN_8, out -> out.writeByte(0));\n        assertValueSerializesAsObject(new byte[] {5}, BIN_8, out -> {\n            out.writeByte(1);\n            out.writeByte(5);\n        });\n        assertValueSerializesAsObject(new byte[255], BIN_8, out -> {\n            out.writeByte(255);\n            out.write(new byte[255]);\n        });\n        assertValueSerializesAsObject(new byte[256], BIN_16, out -> {\n            out.writeShort(256);\n            out.write(new byte[256]);\n        });\n    }\n\n    @Test\n    void test_readWrite_doubleArrayAsObject() throws Throwable {\n        assertValueSerializesAsObject(new double[] {}, DOUBLE_ARRAY_8, out -> out.writeByte(0));\n        assertValueSerializesAsObject(new double[] {5.23d}, DOUBLE_ARRAY_8, out -> {\n            out.writeByte(1);\n            out.writeDouble(5.23d);\n        });\n        assertValueSerializesAsObject(new double[255], DOUBLE_ARRAY_8, out -> {\n            out.writeByte(255);\n            out.write(new byte[255 * 8]);\n        });\n        assertValueSerializesAsObject(new double[256], DOUBLE_ARRAY_16, out -> {\n            out.writeShort(256);\n            out.write(new byte[256 * 8]);\n        });\n    }\n\n    private static void assertValueSerializesAsObject(Object value, int typeByte, ThrowingConsumer<DataOutputStream> fn) throws Throwable {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(1);\n        out.writeString(\"value\");\n        baos.write(typeByte);\n        fn.accept(new DataOutputStream(baos));\n        var expected = baos.toByteArray();\n\n        var bean = new FlexiBean();\n        bean.set(\"value\", value);\n        var bytes = JodaBeanSer.COMPACT.binWriter(PACKED).write(bean, false);\n        assertThat(bytes).isEqualTo(expected);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_readWrite_optionalAsObject() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(2);\n        out.writeString(\"present\");\n        out.writeTypeReference(BeanPack.TYPE_CODE_OPTIONAL);\n        out.writeArrayHeader(1);\n        out.writeInt(6);\n        out.writeString(\"empty\");\n        out.writeTypeReference(BeanPack.TYPE_CODE_OPTIONAL);\n        out.writeArrayHeader(0);\n        var expected = baos.toByteArray();\n\n        var bean = new FlexiBean();\n        bean.set(\"present\", Optional.of(6));\n        bean.set(\"empty\", Optional.empty());\n        var bytes = JodaBeanSer.COMPACT.binWriter(PACKED).write(bean, false);\n        assertThat(bytes).isEqualTo(expected);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_stringArrayAsObject() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(1);\n        out.writeString(\"value\");\n        out.writeTypeReference(BeanPack.TYPE_CODE_STRING_ARRAY);\n        out.writeArrayHeader(2);\n        out.writeString(\"A\");\n        out.writeString(\"B\");\n        var expected = baos.toByteArray();\n\n        var bean = new FlexiBean();\n        bean.set(\"value\", new String[] {\"A\", \"B\"});\n        var bytes = JodaBeanSer.COMPACT.binWriter(PACKED).write(bean, false);\n        assertThat(bytes).isEqualTo(expected);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_objectArrayAsObject() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(1);\n        out.writeString(\"value\");\n        out.writeTypeReference(BeanPack.TYPE_CODE_OBJECT_ARRAY);\n        out.writeArrayHeader(2);\n        out.writeString(\"A\");\n        out.writeInt(6);\n        var expected = baos.toByteArray();\n\n        var bean = new FlexiBean();\n        bean.set(\"value\", new Object[] {\"A\", 6});\n        var bytes = JodaBeanSer.COMPACT.binWriter(PACKED).write(bean, false);\n        assertThat(bytes).isEqualTo(expected);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_intArrayAsObject() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(1);\n        out.writeString(\"value\");\n        out.writeTypeName(\"int[]\");\n        out.writeArrayHeader(2);\n        out.writeInt(4);\n        out.writeInt(6);\n        var expected = baos.toByteArray();\n\n        var bean = new FlexiBean();\n        bean.set(\"value\", new int[] {4, 6});\n        var bytes = JodaBeanSer.COMPACT.binWriter(PACKED).write(bean, false);\n        assertThat(bytes).isEqualTo(expected);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_readWrite_beanValueClass() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(3);\n        out.writeString(\"value1\");\n        out.writeValueDefinitionHeader();\n        out.writeTypeName(ImmKey.class.getName());\n        out.writeBeanDefinitionHeader(1);\n        out.writeString(\"name\");\n        out.writeString(\"A\");\n        out.writeString(\"value2\");\n        out.writeValueDefinitionHeader();\n        out.writeTypeReference(0);\n        out.writeArrayHeader(1);\n        out.writeString(\"B\");\n        out.writeString(\"value3\");\n        out.writeValueReference(2);\n        var expected = baos.toByteArray();\n\n        var bean = new FlexiBean();\n        bean.set(\"value1\", ImmKey.builder().name(\"A\").build());\n        bean.set(\"value2\", ImmKey.builder().name(\"B\").build());\n        bean.set(\"value3\", ImmKey.builder().name(\"A\").build());\n        var bytes = JodaBeanSer.COMPACT.withBeanValueClasses(Set.of(ImmKey.class)).binWriter(PACKED).write(bean, false);\n        assertThat(bytes).isEqualTo(expected);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n        assertThat(parsed.get(\"value1\")).isSameAs(parsed.get(\"value3\"));\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_readWrite_sparseGridAsObject() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(1);\n        out.writeString(\"value\");\n        out.writeTypeReference(TYPE_CODE_GRID);\n        out.writeArrayHeader(3);\n        out.writeInt(4);\n        out.writeInt(2);\n        out.writeArrayHeader(6);\n        out.writeInt(0);\n        out.writeInt(1);\n        out.writeString(\"A\");\n        out.writeInt(1);\n        out.writeInt(0);\n        out.writeString(\"B\");\n        var expected = baos.toByteArray();\n\n        var grid = SparseGrid.create(4, 2);\n        grid.put(0, 1, \"A\");\n        grid.put(1, 0, \"B\");\n        var bean = new FlexiBean();\n        bean.set(\"value\", grid);\n        var bytes = JodaBeanSer.COMPACT.binWriter(PACKED).write(bean, false);\n        assertThat(bytes).isEqualTo(expected);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_denseGridAsObject() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(1);\n        out.writeString(\"value\");\n        out.writeTypeReference(TYPE_CODE_GRID);\n        out.writeArrayHeader(3);\n        out.writeInt(-2);\n        out.writeInt(2);\n        out.writeArrayHeader(4);\n        out.writeNull();\n        out.writeString(\"A\");\n        out.writeString(\"B\");\n        out.writeNull();\n        var expected = baos.toByteArray();\n\n        var grid = DenseGrid.create(2, 2);\n        grid.put(0, 1, \"A\");\n        grid.put(1, 0, \"B\");\n        var bean = new FlexiBean();\n        bean.set(\"value\", grid);\n        var bytes = JodaBeanSer.COMPACT.binWriter(PACKED).write(bean, false);\n        assertThat(bytes).isEqualTo(expected);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_read_typeConvertToDouble() throws Throwable {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(126);\n        assertIntegralConvert(bean, \"valueDouble\", out -> out.writeLong(126));\n        assertIntegralConvert(bean, \"valueDouble\", out -> out.writeInt(126));\n        assertIntegralConvert(bean, \"valueDouble\", out -> out.writeShort((short) 126));\n        assertIntegralConvert(bean, \"valueDouble\", out -> out.writeByte((byte) 126));\n    }\n\n    @Test\n    void test_read_typeConvertToFloat() throws Throwable {\n        var bean = new PrimitiveBean();\n        bean.setValueFloat(126);\n        assertIntegralConvert(bean, \"valueFloat\", out -> out.writeLong(126));\n        assertIntegralConvert(bean, \"valueFloat\", out -> out.writeInt(126));\n        assertIntegralConvert(bean, \"valueFloat\", out -> out.writeShort((short) 126));\n        assertIntegralConvert(bean, \"valueFloat\", out -> out.writeByte((byte) 126));\n    }\n\n    @Test\n    void test_read_typeConvertToLong() throws Throwable {\n        var bean = new PrimitiveBean();\n        bean.setValueLong(126);\n        assertIntegralConvert(bean, \"valueLong\", out -> out.writeLong(126));\n        assertIntegralConvert(bean, \"valueLong\", out -> out.writeInt(126));\n        assertIntegralConvert(bean, \"valueLong\", out -> out.writeShort((short) 126));\n        assertIntegralConvert(bean, \"valueLong\", out -> out.writeByte((byte) 126));\n    }\n\n    @Test\n    void test_read_typeConvertToInt() throws Throwable {\n        var bean = new PrimitiveBean();\n        bean.setValueInt(126);\n        assertIntegralConvert(bean, \"valueInt\", out -> out.writeLong(126));\n        assertIntegralConvert(bean, \"valueInt\", out -> out.writeInt(126));\n        assertIntegralConvert(bean, \"valueInt\", out -> out.writeShort((short) 126));\n        assertIntegralConvert(bean, \"valueInt\", out -> out.writeByte((byte) 126));\n        assertIntegralConvertBad(\"valueInt\", out -> out.writeLong(((long) Integer.MAX_VALUE) + 1));\n        assertIntegralConvertBad(\"valueInt\", out -> out.writeLong(((long) Integer.MIN_VALUE) - 1));\n    }\n\n    @Test\n    void test_read_typeConvertToShort() throws Throwable {\n        var bean = new PrimitiveBean();\n        bean.setValueShort((short) 126);\n        assertIntegralConvert(bean, \"valueShort\", out -> out.writeLong(126));\n        assertIntegralConvert(bean, \"valueShort\", out -> out.writeInt(126));\n        assertIntegralConvert(bean, \"valueShort\", out -> out.writeShort((short) 126));\n        assertIntegralConvert(bean, \"valueShort\", out -> out.writeByte((byte) 126));\n        assertIntegralConvertBad(\"valueShort\", out -> out.writeInt(Short.MAX_VALUE + 1));\n        assertIntegralConvertBad(\"valueShort\", out -> out.writeInt(Short.MIN_VALUE - 1));\n        assertIntegralConvertBad(\"valueShort\", out -> out.writeLong(((long) Short.MAX_VALUE) + 1));\n        assertIntegralConvertBad(\"valueShort\", out -> out.writeLong(((long) Short.MIN_VALUE) - 1));\n    }\n\n    @Test\n    void test_read_typeConvertToByte() throws Throwable {\n        var bean = new PrimitiveBean();\n        bean.setValueByte((byte) 126);\n        assertIntegralConvert(bean, \"valueByte\", out -> out.writeLong(126));\n        assertIntegralConvert(bean, \"valueByte\", out -> out.writeInt(126));\n        assertIntegralConvert(bean, \"valueByte\", out -> out.writeShort((short) 126));\n        assertIntegralConvert(bean, \"valueByte\", out -> out.writeByte((byte) 126));\n        assertIntegralConvertBad(\"valueByte\", out -> out.writeLong(128));\n        assertIntegralConvertBad(\"valueByte\", out -> out.writeLong(-129));\n        assertIntegralConvertBad(\"valueByte\", out -> out.writeInt(128));\n        assertIntegralConvertBad(\"valueByte\", out -> out.writeInt(-129));\n        assertIntegralConvertBad(\"valueByte\", out -> out.writeShort((short) 128));\n        assertIntegralConvertBad(\"valueByte\", out -> out.writeShort((short) -129));\n    }\n\n    private static void assertIntegralConvert(PrimitiveBean bean, String fieldName, ThrowingConsumer<BeanPackOutput> outFn)\n            throws Throwable {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(1);\n        out.writeString(fieldName);\n        outFn.accept(out);\n        BeanAssert.assertBeanEquals(bean, JodaBeanSer.COMPACT.binReader().read(baos.toByteArray(), PrimitiveBean.class));\n    }\n\n    private static void assertIntegralConvertBad(String fieldName, ThrowingConsumer<BeanPackOutput> outFn) throws Throwable {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(1);\n        out.writeString(fieldName);\n        outFn.accept(out);\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(baos.toByteArray(), PrimitiveBean.class));\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_read_beanProperty_typeDefinitionInRemovedSubTree_explicitPropertyType() throws Throwable {\n        var bean = new Pair();\n        bean.setFirst(RiskLevel.HIGH);\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(2);\n        // property 'Pair#removed' of type TupleFinal\n        out.writeString(\"removed\");\n        out.writeTypeName(TupleFinal.class.getName());  // removed property defined with explicit type\n        out.writeMapHeader(1);\n        out.writeString(\"first\");\n        out.writeTypeName(RiskLevel.class.getName());\n        out.writeString(\"LOW\");\n        // property 'Pair#first' of type RiskLevel\n        out.writeString(\"first\");\n        out.writeValueDefinitionHeader();\n        out.writeTypeReference(1);\n        out.writeString(RiskLevel.HIGH.name());\n        var ser = JodaBeanSer.COMPACT.withDeserializers(SerDeserializers.LENIENT);\n        BeanAssert.assertBeanEquals(bean, ser.binReader().read(baos.toByteArray(), Pair.class));\n    }\n\n    @Test\n    void test_read_beanProperty_typeDefinitionInRemovedSubTree_inferredPropertyTypeForBeanInMapFormat() throws Throwable {\n        var bean = new Pair();\n        bean.setFirst(RiskLevel.HIGH);\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(2);\n        // property 'Pair#removed' where the removed property was used to infer the type\n        out.writeString(\"removed\");\n        out.writeMapHeader(1);\n        out.writeString(\"first\");\n        out.writeTypeName(RiskLevel.class.getName());\n        out.writeString(\"LOW\");\n        // property 'Pair#first' of type RiskLevel\n        out.writeString(\"first\");\n        out.writeValueDefinitionHeader();\n        out.writeTypeReference(0);\n        out.writeString(RiskLevel.HIGH.name());\n        var ser = JodaBeanSer.COMPACT.withDeserializers(SerDeserializers.LENIENT);\n        BeanAssert.assertBeanEquals(bean, ser.binReader().read(baos.toByteArray(), Pair.class));\n    }\n\n    @Test\n    void test_read_beanProperty_typeDefinitionInRemovedSubTree_inferredPropertyTypeForBeanInArrayFormat() throws Throwable {\n        var bean = new Pair();\n        bean.setFirst(RiskLevel.HIGH);\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(2);\n        // property 'Pair#removed' where the removed property was used to infer the type\n        out.writeString(\"removed\");\n        out.writeArrayHeader(1);  // note that in reality there would have been a bean definition somewhere\n        out.writeTypeName(RiskLevel.class.getName());\n        out.writeString(\"LOW\");\n        // property 'Pair#first' of type RiskLevel\n        out.writeString(\"first\");\n        out.writeValueDefinitionHeader();\n        out.writeTypeReference(0);\n        out.writeString(RiskLevel.HIGH.name());\n        var ser = JodaBeanSer.COMPACT.withDeserializers(SerDeserializers.LENIENT);\n        BeanAssert.assertBeanEquals(bean, ser.binReader().read(baos.toByteArray(), Pair.class));\n    }\n\n    @Test\n    void test_read_beanProperty_typeDefinitionInRemovedSubTree_typeNoLongerExistsButIsNotReferenced() throws Throwable {\n        var bean = new Pair();\n        bean.setFirst(RiskLevel.HIGH);\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(2);\n        // property 'Pair#removed' where the removed property was used to infer the type\n        out.writeString(\"removed\");\n        out.writeArrayHeader(1);  // note that in reality there would have been a bean definition somewhere\n        out.writeTypeName(\"my.BadType\");\n        out.writeString(\"LOW\");\n        // property 'Pair#first' of type RiskLevel\n        out.writeString(\"first\");\n        out.writeValueDefinitionHeader();\n        out.writeTypeName(RiskLevel.class.getName());\n        out.writeString(RiskLevel.HIGH.name());\n        var ser = JodaBeanSer.COMPACT.withDeserializers(SerDeserializers.LENIENT);\n        BeanAssert.assertBeanEquals(bean, ser.binReader().read(baos.toByteArray(), Pair.class));\n    }\n\n    @Test\n    void test_read_beanProperty_beanAndValueDefinitionInRemovedSubTree() throws Throwable {\n        var bean = new Pair();\n        var subPair = new Pair();\n        bean.setFirst(subPair);\n        subPair.setFirst(2.5d);\n        subPair.setSecond(1.5d);\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(2);\n        // property 'Pair#removed'\n        out.writeString(\"removed\");\n        out.writeTypeName(Pair.class.getName());\n        out.writeBeanDefinitionHeader(2);\n        out.writeString(\"first\");\n        out.writeString(\"second\");\n        out.writeValueDefinitionHeader();\n        out.writeDouble(1.5d);\n        out.writeValueDefinitionHeader();\n        out.writeDouble(2.5d);\n        // property 'Pair#first' of type Pair\n        out.writeString(\"first\");\n        out.writeTypeReference(0);\n        out.writeArrayHeader(2);\n        out.writeValueReference(4);\n        out.writeValueReference(3);\n        var ser = JodaBeanSer.COMPACT.withDeserializers(SerDeserializers.LENIENT);\n        BeanAssert.assertBeanEquals(bean, ser.binReader().read(baos.toByteArray(), Pair.class));\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_read_arrayMultidimensional() throws Throwable {\n        var bean = new Pair();\n        bean.setFirst(new String[][] {{\"1\", \"2\"}, {\"3\"}});\n        bean.setSecond(new Number[][][] {{{1}, {2.5}}, {{3}}});\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(2);\n        // property 'Pair#first'\n        out.writeString(\"first\");\n        out.writeTypeName(\"String[][]\");\n        out.writeArrayHeader(2);\n        out.writeArrayHeader(2);\n        out.writeString(\"1\");\n        out.writeString(\"2\");\n        out.writeArrayHeader(1);\n        out.writeString(\"3\");\n        // property 'Pair#second'\n        out.writeString(\"second\");\n        out.writeTypeName(\"java.lang.Number[][][]\");\n        out.writeArrayHeader(2);\n        out.writeArrayHeader(2);\n        out.writeArrayHeader(1);\n        out.writeInt(1);\n        out.writeArrayHeader(1);\n        out.writeDouble(2.5d);\n        out.writeArrayHeader(1);\n        out.writeArrayHeader(1);\n        out.writeInt(3);\n        var ser = JodaBeanSer.COMPACT.withDeserializers(SerDeserializers.LENIENT);\n        BeanAssert.assertBeanEquals(bean, ser.binReader().read(baos.toByteArray(), Pair.class));\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_read_optionalTypeToDefaulted() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeString(\"\");\n        out.writeMapHeader(0);\n        var bytes = baos.toByteArray();\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, ImmDefault.class);\n        assertThat(parsed.getValue()).isEqualTo(\"Defaulted\");\n    }\n\n    @Test\n    void test_readWriteJodaConvertWrapper() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(2);\n        out.writeString(\"bean\");\n        out.writeValueDefinitionHeader();\n        out.writeTypeName(JodaConvertBean.class.getName());\n        out.writeString(\"Hello:9\");\n        out.writeString(\"description\");\n        out.writeString(\"Weird\");\n        var expected = baos.toByteArray();\n\n        var wrapper = new JodaConvertWrapper();\n        var bean = new JodaConvertBean(\"Hello:9\");\n        wrapper.setBean(bean);\n        wrapper.setDescription(\"Weird\");\n        var bytes = JodaBeanSer.COMPACT.binWriter(PACKED).write(wrapper, false);\n        assertThat(bytes).isEqualTo(expected);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, JodaConvertWrapper.class);\n        BeanAssert.assertBeanEquals(wrapper, parsed);\n    }\n\n    @Test\n    void test_readWriteJodaConvertBean() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(2);\n        out.writeString(\"base\");\n        out.writeString(\"Hello\");\n        out.writeString(\"extra\");\n        out.writeInt(9);\n        var expected = baos.toByteArray();\n\n        var bean = new JodaConvertBean(\"Hello:9\");\n        var bytes = JodaBeanSer.COMPACT.binWriter(PACKED).write(bean, false);\n        assertThat(bytes).isEqualTo(expected);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, JodaConvertBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_read_JodaConvertWrapper_beanNotJodaConvertAndNoDefinition() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(2);\n        out.writeString(\"bean\");\n        out.writeMapHeader(2);\n        out.writeString(\"base\");\n        out.writeString(\"Hello\");\n        out.writeString(\"extra\");\n        out.writeInt(9);\n        out.writeString(\"description\");\n        out.writeString(\"Weird\");\n        var bytes = baos.toByteArray();\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, JodaConvertWrapper.class);\n        var wrapper = new JodaConvertWrapper();\n        var bean = new JodaConvertBean(\"Hello:9\");\n        wrapper.setBean(bean);\n        wrapper.setDescription(\"Weird\");\n        BeanAssert.assertBeanEquals(wrapper, parsed);\n    }\n\n    @Test\n    void test_read_JodaConvertWrapper_beanJodaConvert() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(2);\n        out.writeString(\"bean\");\n        out.writeString(\"Hello:9\");\n        out.writeString(\"description\");\n        out.writeString(\"Weird\");\n        var bytes = baos.toByteArray();\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, JodaConvertWrapper.class);\n        var wrapper = new JodaConvertWrapper();\n        var bean = new JodaConvertBean(\"Hello:9\");\n        wrapper.setBean(bean);\n        wrapper.setDescription(\"Weird\");\n        BeanAssert.assertBeanEquals(wrapper, parsed);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_read_invalidFormat_sizeOneArrayAtRoot() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(1);\n        out.writeInt(3);\n        var bytes = baos.toByteArray();\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class));\n    }\n\n    @Test\n    void test_read_wrongVersion() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(0);\n        out.writeNull();\n        out.writeMapHeader(0);\n        var bytes = baos.toByteArray();\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class));\n    }\n\n    @Test\n    void test_read_rootTypeNotSpecified_FlexiBean() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(0);\n        var bytes = baos.toByteArray();\n        assertThatNoException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class));\n    }\n\n    @Test\n    void test_read_rootTypeNotSpecified_Bean() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeMapHeader(0);\n        var bytes = baos.toByteArray();\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, Bean.class));\n    }\n\n    @Test\n    void test_read_rootTypeValid_Bean() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeTypeName(FlexiBean.class.getName());\n        out.writeMapHeader(0);\n        var bytes = baos.toByteArray();\n        assertThatNoException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, Bean.class));\n    }\n\n    @Test\n    void test_read_rootTypeInvalid_Bean() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeTypeName(String.class.getName());\n        out.writeMapHeader(0);\n        var bytes = baos.toByteArray();\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, Bean.class));\n    }\n\n    @Test\n    void test_read_rootTypeInvalid_incompatible() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        var out = new BeanPackOutput(baos);\n        out.writeArrayHeader(3);\n        out.writeInt(3);\n        out.writeNull();\n        out.writeTypeName(Company.class.getName());\n        var bytes = baos.toByteArray();\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class));\n    }\n\n    @Test\n    void test_write_nullKeyInMap() {\n        var address = new Address();\n        var bean = new Person();\n        bean.getOtherAddressMap().put(null, address);\n        var bytes = JodaBeanSer.COMPACT.binWriter(PACKED).write(bean);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes);\n        assertThat(parsed).isEqualTo(bean);\n    }\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/bin/TestSerializeReferencingBin.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport static java.lang.System.lineSeparator;\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;\nimport static org.assertj.core.api.Assertions.assertThatRuntimeException;\nimport static org.assertj.core.api.Assertions.offset;\nimport static org.joda.beans.ser.bin.JodaBeanBinFormat.REFERENCING;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.DataOutputStream;\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\nimport java.util.Map;\n\nimport org.joda.beans.ImmutableBean;\nimport org.joda.beans.sample.Company;\nimport org.joda.beans.sample.ImmAddress;\nimport org.joda.beans.sample.ImmArrays;\nimport org.joda.beans.sample.ImmDefault;\nimport org.joda.beans.sample.ImmDoubleFloat;\nimport org.joda.beans.sample.ImmGeneric;\nimport org.joda.beans.sample.ImmGenericArray;\nimport org.joda.beans.sample.ImmGenericCollections;\nimport org.joda.beans.sample.ImmGuava;\nimport org.joda.beans.sample.ImmJodaConvertBean;\nimport org.joda.beans.sample.ImmJodaConvertWrapper;\nimport org.joda.beans.sample.ImmKeyHolder;\nimport org.joda.beans.sample.ImmKeyList;\nimport org.joda.beans.sample.ImmNamedKey;\nimport org.joda.beans.sample.ImmOptional;\nimport org.joda.beans.sample.ImmTreeNode;\nimport org.joda.beans.sample.JodaConvertInterface;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerTestHelper;\nimport org.joda.beans.test.BeanAssert;\nimport org.junit.jupiter.api.Test;\n\nimport com.google.common.io.Resources;\n\n/**\n * Test property roundtrip using referencing binary.\n */\nclass TestSerializeReferencingBin {\n\n    @Test\n    void test_writeImmAddress() throws IOException {\n        var bean = SerTestHelper.testImmAddress(true);\n        var bytes = JodaBeanSer.PRETTY.binWriter(REFERENCING).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n        assertEqualsSerialization(bytes, \"/org/joda/beans/ser/ImmAddress1.refbinstr\");\n\n        var parsed = (ImmAddress) JodaBeanSer.PRETTY.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeImmOptional() throws IOException {\n        // derived properties are not supported\n        var bean = SerTestHelper.testImmOptional();\n        var bytes = JodaBeanSer.COMPACT.binWriter(REFERENCING).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n        assertEqualsSerialization(bytes, \"/org/joda/beans/ser/ImmOptional1.refbinstr\");\n\n        var parsed = (ImmOptional) JodaBeanSer.COMPACT.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeImmArrays() throws IOException {\n        var bean = ImmArrays.of(\n                new int[] {1, 3, 2},\n                new long[] {1, 4, 3},\n                new double[] {1.1, 2.2, 3.3},\n                new boolean[] {true, false},\n                new int[][] {{1, 2}, {2}, {}},\n                new boolean[][] {{true, false}, {false}, {}});\n        var bytes = JodaBeanSer.PRETTY.binWriter(REFERENCING).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n        assertEqualsSerialization(bytes, \"/org/joda/beans/ser/ImmArrays1.refbinstr\");\n\n        var parsed = JodaBeanSer.PRETTY.binReader().read(bytes, ImmArrays.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeCollections() throws IOException {\n        var bean = SerTestHelper.testCollections(true);\n        var bytes = JodaBeanSer.COMPACT.binWriter(REFERENCING).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n        assertEqualsSerialization(bytes, \"/org/joda/beans/ser/Collections1.refbinstr\");\n\n        @SuppressWarnings(\"unchecked\")\n        var parsed = (ImmGuava<String>) JodaBeanSer.COMPACT.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    private void assertEqualsSerialization(byte[] actualBytes, String expectedResource) throws IOException {\n        var url = TestSerializeReferencingBin.class.getResource(expectedResource);\n        var expected = Resources.asCharSource(url, StandardCharsets.UTF_8).read();\n        var actual = new MsgPackVisualizer(actualBytes).visualizeData();\n        assertThat(actual.trim().replace(lineSeparator(), \"\\n\")).isEqualTo(expected.trim().replace(lineSeparator(), \"\\n\"));\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_writeJodaConvertInterface() {\n        var bean = SerTestHelper.testGenericInterfaces();\n\n        var bytes = JodaBeanSer.COMPACT.binWriter(REFERENCING).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n\n        @SuppressWarnings(\"unchecked\")\n        var parsed = (ImmGenericCollections<JodaConvertInterface>) JodaBeanSer.COMPACT.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeJodaConvertInterfaceCollections() {\n        var bean = SerTestHelper.testGenericInterfacesCollections();\n\n        var bytes = JodaBeanSer.COMPACT.binWriterReferencing().write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(parsed, bean);\n    }\n\n    @Test\n    void test_writeIntermediateInterface() {\n        var bean = SerTestHelper.testIntermediateInterfaces();\n\n        var bytes = JodaBeanSer.COMPACT.binWriter(REFERENCING).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, ImmKeyList.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeJodaConvert() {\n        // immutable bean that is serialized as joda convert\n        var bean = ImmNamedKey.of(\"name\");\n\n        var bytes = JodaBeanSer.COMPACT.binWriter(REFERENCING).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n\n        var parsed = (ImmNamedKey) JodaBeanSer.COMPACT.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeGenericCollections() {\n        var bean = SerTestHelper.testGenericNestedCollections();\n        var bytes = JodaBeanSer.COMPACT.binWriter(REFERENCING).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n\n        @SuppressWarnings(\"unchecked\")\n        var parsed = (ImmGenericCollections<Map<ImmJodaConvertBean, String>>) JodaBeanSer.COMPACT.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeFirstInstanceOfBeanHasNullProperties() {\n        var bean = SerTestHelper.testGenericArrayWithNulls();\n        var bytes = JodaBeanSer.COMPACT.binWriter(REFERENCING).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n\n        @SuppressWarnings(\"unchecked\")\n        var parsed = (ImmGenericArray<ImmGeneric<?>>) JodaBeanSer.COMPACT.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeTree() {\n        var bean = SerTestHelper.testTree();\n        var bytes = JodaBeanSer.COMPACT.binWriter(REFERENCING).write(bean);\n        var regularBytes = JodaBeanSer.COMPACT.binWriter().write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n\n        var parsed = (ImmTreeNode) JodaBeanSer.COMPACT.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n        assertThat((double) bytes.length).isLessThan(regularBytes.length / 2d);\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_read_deserializerReferencesUnseenClass() {\n        var immKeyHolder = SerTestHelper.testImmKeyHolder();\n        var bytes = JodaBeanSer.COMPACT.binWriter(REFERENCING).write(immKeyHolder);\n        var bean = (ImmKeyHolder) JodaBeanSer.COMPACT.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, immKeyHolder);\n    }\n\n    @Test\n    void test_read_primitiveTypeChanged() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 4);\n            out.writeByte(2); // version\n            out.writeByte(0); // refs\n\n            //classes\n            out.writeByte(MsgPack.MIN_FIX_MAP + 1);\n            out.writeByte(MsgPack.STR_8);\n            out.writeByte(ImmDoubleFloat.class.getName().length());\n            out.writeBytes(ImmDoubleFloat.class.getName());\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(MsgPack.MIN_FIX_STR + 1);\n            out.writeBytes(\"a\");\n            out.writeByte(MsgPack.MIN_FIX_STR + 1);\n            out.writeBytes(\"b\");\n\n            // Data\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 3);\n            out.writeByte(MsgPack.FIX_EXT_1);\n            out.writeByte(MsgPack.JODA_TYPE_BEAN);\n            out.writeByte(0); // First class\n\n            out.writeByte(6); // a\n            out.writeByte(5); // b\n        }\n        var bytes = baos.toByteArray();\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, ImmDoubleFloat.class);\n        assertThat(parsed.getA()).isCloseTo(6, offset(1e-10));\n        assertThat(parsed.getB()).isCloseTo(5, offset(1e-10));\n    }\n\n    @Test\n    void test_read_optionalTypeToDefaulted() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 4);\n            out.writeByte(2); // version\n            out.writeByte(0); // refs\n\n            //classes\n            out.writeByte(MsgPack.MIN_FIX_MAP + 1);\n            out.writeByte(MsgPack.STR_8);\n            out.writeByte(ImmDefault.class.getName().length());\n            out.writeBytes(ImmDefault.class.getName());\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 1);\n            out.writeByte(MsgPack.MIN_FIX_STR + 5);\n            out.writeBytes(\"value\");\n\n            // Data\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(MsgPack.FIX_EXT_1);\n            out.writeByte(MsgPack.JODA_TYPE_BEAN);\n            out.writeByte(0);\n            out.writeByte(MsgPack.NIL); // value not set\n        }\n        var bytes = baos.toByteArray();\n\n        ImmDefault parsed = JodaBeanSer.COMPACT.binReader().read(bytes, ImmDefault.class);\n        assertThat(parsed.getValue()).isEqualTo(\"Defaulted\");\n    }\n\n    @Test\n    void test_read_wrongVersion() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 4);\n            out.writeByte(-1);\n        }\n        var bytes = baos.toByteArray();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, ImmDoubleFloat.class));\n    }\n\n    @Test\n    void test_read_wrongVersionTooHigh() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 4);\n            out.writeByte(3);\n        }\n        var bytes = baos.toByteArray();\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, ImmDoubleFloat.class));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_readWriteJodaConvertWrapper() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 4);\n            out.writeByte(2);\n            out.writeByte(0);\n\n            out.writeByte(MsgPack.MIN_FIX_MAP + 1);\n\n            out.writeByte(MsgPack.STR_8);\n            out.writeByte(ImmJodaConvertWrapper.class.getName().length());\n            out.writeBytes(ImmJodaConvertWrapper.class.getName());\n            out.write(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(MsgPack.MIN_FIX_STR + 4);\n            out.writeBytes(\"bean\");\n            out.writeByte(MsgPack.MIN_FIX_STR + 11);\n            out.writeBytes(\"description\");\n\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 3);\n            out.writeByte(MsgPack.FIX_EXT_1);\n            out.writeByte(MsgPack.JODA_TYPE_BEAN);\n            out.writeByte(0);\n\n            out.writeByte(MsgPack.MIN_FIX_STR + 7);\n            out.writeBytes(\"Hello:9\");\n\n            out.writeByte(MsgPack.MIN_FIX_STR + 5);\n            out.writeBytes(\"Weird\");\n        }\n        var expected = baos.toByteArray();\n\n        var bean = new ImmJodaConvertBean(\"Hello:9\");\n        var wrapper = ImmJodaConvertWrapper.of(bean, \"Weird\");\n        var bytes = JodaBeanSer.COMPACT.binWriter(REFERENCING).write(wrapper);\n        assertThat(bytes).isEqualTo(expected);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, ImmJodaConvertWrapper.class);\n        BeanAssert.assertBeanEquals(wrapper, parsed);\n    }\n\n    @Test\n    void test_readWriteJodaConvertBean() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 4);\n            out.writeByte(2);\n            out.writeByte(0);\n            out.writeByte(MsgPack.MIN_FIX_MAP + 1);\n            out.writeByte(MsgPack.STR_8);\n            out.writeByte(ImmJodaConvertBean.class.getName().length());\n            out.writeBytes(ImmJodaConvertBean.class.getName());\n            out.write(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(MsgPack.MIN_FIX_STR + 4);\n            out.writeBytes(\"base\");\n            out.writeByte(MsgPack.MIN_FIX_STR + 5);\n            out.writeBytes(\"extra\");\n\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 3);\n            out.writeByte(MsgPack.FIX_EXT_1);\n            out.writeByte(MsgPack.JODA_TYPE_BEAN);\n            out.writeByte(0);\n            out.writeByte(MsgPack.MIN_FIX_STR + 5);\n            out.writeBytes(\"Hello\");\n            out.writeByte(9);\n        }\n        var expected = baos.toByteArray();\n\n        var bean = new ImmJodaConvertBean(\"Hello:9\");\n        var bytes = JodaBeanSer.COMPACT.binWriter(REFERENCING).write(bean);\n\n        assertThat(bytes).isEqualTo(expected);\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, ImmJodaConvertBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_read_nonStandard_JodaConvertWrapper_expanded() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 4);\n            out.writeByte(2);\n            out.writeByte(0);\n\n            out.writeByte(MsgPack.MIN_FIX_MAP + 2);\n            out.writeByte(MsgPack.STR_8);\n            out.writeByte(ImmJodaConvertWrapper.class.getName().length());\n            out.writeBytes(ImmJodaConvertWrapper.class.getName());\n            out.write(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(MsgPack.MIN_FIX_STR + 4);\n            out.writeBytes(\"bean\");\n            out.writeByte(MsgPack.MIN_FIX_STR + 11);\n            out.writeBytes(\"description\");\n\n            out.writeByte(MsgPack.STR_8);\n            out.writeByte(ImmJodaConvertBean.class.getName().length());\n            out.writeBytes(ImmJodaConvertBean.class.getName());\n            out.write(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(MsgPack.MIN_FIX_STR + 4);\n            out.writeBytes(\"base\");\n            out.writeByte(MsgPack.MIN_FIX_STR + 5);\n            out.writeBytes(\"extra\");\n\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 3);\n            out.writeByte(MsgPack.FIX_EXT_1);\n            out.writeByte(MsgPack.JODA_TYPE_BEAN);\n            out.writeByte(0);\n\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 3);\n            out.writeByte(MsgPack.FIX_EXT_1);\n            out.writeByte(MsgPack.JODA_TYPE_BEAN);\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_STR + 5);\n            out.writeBytes(\"Hello\");\n            out.writeByte(9);\n\n            out.writeByte(MsgPack.MIN_FIX_STR + 5);\n            out.writeBytes(\"Weird\");\n        }\n        var bytes = baos.toByteArray();\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, ImmJodaConvertWrapper.class);\n        var bean = new ImmJodaConvertBean(\"Hello:9\");\n        var wrapper = ImmJodaConvertWrapper.of(bean, \"Weird\");\n        BeanAssert.assertBeanEquals(wrapper, parsed);\n    }\n\n    @Test\n    void test_read_nonStandard_JodaConvertBean_flattened() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 4);\n            out.writeByte(2);\n            out.writeByte(0);\n            out.writeByte(MsgPack.MIN_FIX_MAP);\n            out.writeByte(MsgPack.MIN_FIX_STR + 7);\n            out.writeBytes(\"Hello:9\");\n        }\n        var bytes = baos.toByteArray();\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, ImmJodaConvertBean.class);\n        var bean = new ImmJodaConvertBean(\"Hello:9\");\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_read_invalidFormat_sizeOneArrayAtRoot() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 1);\n            out.writeByte(2);\n        }\n        var bytes = baos.toByteArray();\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, ImmJodaConvertBean.class));\n    }\n\n    @Test\n    void test_read_rootTypeNotSpecified_Bean() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_MAP);\n        }\n        var bytes = baos.toByteArray();\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, ImmutableBean.class));\n    }\n\n    @Test\n    void test_read_rootTypeInvalid_Bean() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_MAP + 1);\n            out.writeByte(MsgPack.EXT_8);\n            out.writeByte(String.class.getName().length());\n            out.writeByte(MsgPack.JODA_TYPE_BEAN);\n            out.write(String.class.getName().getBytes(MsgPack.UTF_8));\n            out.writeByte(MsgPack.NIL);\n        }\n        var bytes = baos.toByteArray();\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, ImmutableBean.class));\n    }\n\n    @Test\n    void test_read_rootTypeInvalid_incompatible() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 4);\n            out.writeByte(2);\n            out.writeByte(0);\n            out.writeByte(MsgPack.MIN_FIX_MAP + 1);\n            out.writeByte(MsgPack.STR_8);\n            out.writeByte(Company.class.getName().length());\n            out.write(Company.class.getName().getBytes(MsgPack.UTF_8));\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 1);\n            out.writeByte(MsgPack.STR_8);\n            var companyName = \"companyName\".getBytes(MsgPack.UTF_8);\n            out.write(companyName.length);\n            out.write(companyName);\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 1);\n            out.write(MsgPack.NIL);\n        }\n        var bytes = baos.toByteArray();\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, ImmJodaConvertBean.class));\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/bin/TestSerializeStandardBin.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.bin;\n\nimport static java.lang.System.lineSeparator;\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatRuntimeException;\nimport static org.assertj.core.api.Assertions.offset;\nimport static org.joda.beans.ser.bin.JodaBeanBinFormat.STANDARD;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.DataOutputStream;\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.impl.flexi.FlexiBean;\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.Company;\nimport org.joda.beans.sample.ImmAddress;\nimport org.joda.beans.sample.ImmArrays;\nimport org.joda.beans.sample.ImmDefault;\nimport org.joda.beans.sample.ImmDoubleFloat;\nimport org.joda.beans.sample.ImmGuava;\nimport org.joda.beans.sample.ImmKeyList;\nimport org.joda.beans.sample.ImmNamedKey;\nimport org.joda.beans.sample.ImmOptional;\nimport org.joda.beans.sample.JodaConvertBean;\nimport org.joda.beans.sample.JodaConvertWrapper;\nimport org.joda.beans.sample.Person;\nimport org.joda.beans.sample.SimpleJson;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerTestHelper;\nimport org.joda.beans.test.BeanAssert;\nimport org.junit.jupiter.api.Test;\n\nimport com.google.common.collect.ImmutableList;\nimport com.google.common.io.Resources;\n\n/**\n * Test property roundtrip using binary.\n */\nclass TestSerializeStandardBin {\n\n    @Test\n    void test_writeAddress() throws IOException {\n        var bean = SerTestHelper.testAddress();\n\n        var bytes = JodaBeanSer.PRETTY.binWriter(STANDARD).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n        assertEqualsSerialization(bytes, \"/org/joda/beans/ser/Address2.binstr\");\n\n        var parsed = (Address) JodaBeanSer.PRETTY.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeImmAddress() throws IOException {\n        var bean = SerTestHelper.testImmAddress(false);\n        var bytes = JodaBeanSer.PRETTY.binWriter(STANDARD).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n        assertEqualsSerialization(bytes, \"/org/joda/beans/ser/ImmAddress2.binstr\");\n\n        var parsed = (ImmAddress) JodaBeanSer.PRETTY.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n\n        // old format in /org/joda/beans/ser/ImmAddress1 is indirectly tested in test_readOldStringArrayWithMetaFormat()\n    }\n\n    @Test\n    void test_writeImmOptional() throws IOException {\n        var bean = SerTestHelper.testImmOptional();\n        var bytes = JodaBeanSer.PRETTY.withIncludeDerived(true).binWriter(STANDARD).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n        assertEqualsSerialization(bytes, \"/org/joda/beans/ser/ImmOptional2.binstr\");\n\n        var parsed = (ImmOptional) JodaBeanSer.PRETTY.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeImmArrays() throws IOException {\n        var bean = ImmArrays.of(\n                new int[] {1, 3, 2},\n                new long[] {1, 4, 3},\n                new double[] {1.1, 2.2, 3.3},\n                new boolean[] {true, false},\n                new int[][] {{1, 2}, {2}, {}},\n                new boolean[][] {{true, false}, {false}, {}});\n        var bytes = JodaBeanSer.PRETTY.binWriter(STANDARD).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n        assertEqualsSerialization(bytes, \"/org/joda/beans/ser/ImmArrays2.binstr\");\n\n        var parsed = JodaBeanSer.PRETTY.binReader().read(bytes, ImmArrays.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n\n        // old format in /org/joda/beans/ser/ImmArrays1 is indirectly tested in test_readOldPrimitiveArrayFormat()\n    }\n\n    @Test\n    void test_writeCollections() throws IOException {\n        var bean = SerTestHelper.testCollections(true);\n        var bytes = JodaBeanSer.PRETTY.binWriter(STANDARD).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n        assertEqualsSerialization(bytes, \"/org/joda/beans/ser/Collections2.binstr\");\n\n        @SuppressWarnings(\"unchecked\")\n        var parsed = (ImmGuava<String>) JodaBeanSer.PRETTY.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n\n        // old format in /org/joda/beans/ser/Collections1 is indirectly tested in test_readOldListWithMetaFormat()\n    }\n\n    private void assertEqualsSerialization(byte[] actualBytes, String expectedResource) throws IOException {\n        var url = TestSerializeStandardBin.class.getResource(expectedResource);\n        var expected = Resources.asCharSource(url, StandardCharsets.UTF_8).read();\n        var actual = new MsgPackVisualizer(actualBytes).visualizeData();\n        assertThat(actual.trim().replace(lineSeparator(), \"\\n\")).isEqualTo(expected.trim().replace(lineSeparator(), \"\\n\"));\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_writeJodaConvertInterface() {\n        var bean = SerTestHelper.testGenericInterfaces();\n\n        var bytes = JodaBeanSer.COMPACT.binWriter(STANDARD).write(bean);\n//        System.out.println(JodaBeanBinReader.visualize(bytes));\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeIntermediateInterface() {\n        var bean = SerTestHelper.testIntermediateInterfaces();\n\n        var bytes = JodaBeanSer.COMPACT.binWriter(STANDARD).write(bean);\n        //        System.out.println(JodaBeanBinReader.visualize(bytes));\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, ImmKeyList.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeJodaConvert() {\n        // immutable bean that is serialized as joda convert\n        var bean = ImmNamedKey.of(\"name\");\n\n        var bytes = JodaBeanSer.COMPACT.binWriter(STANDARD).write(bean);\n        //        System.out.println(JodaBeanBinReader.visualize(bytes));\n\n        var parsed = (ImmNamedKey) JodaBeanSer.COMPACT.binReader().read(bytes);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_readWrite_primitives() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_MAP + 6);\n            out.writeByte(MsgPack.MIN_FIX_STR + 3);\n            out.writeBytes(\"tru\");\n            out.writeByte(MsgPack.TRUE);\n            out.writeByte(MsgPack.MIN_FIX_STR + 3);\n            out.writeBytes(\"fal\");\n            out.writeByte(MsgPack.FALSE);\n            out.writeByte(MsgPack.MIN_FIX_STR + 3);\n            out.writeBytes(\"byt\");\n            out.writeByte(MsgPack.MIN_FIX_MAP + 1);\n            out.writeByte(MsgPack.EXT_8);\n            out.writeByte(4);\n            out.writeByte(MsgPack.JODA_TYPE_DATA);\n            out.writeBytes(\"Byte\");\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_STR + 3);\n            out.writeBytes(\"sht\");\n            out.writeByte(MsgPack.MIN_FIX_MAP + 1);\n            out.writeByte(MsgPack.EXT_8);\n            out.writeByte(5);\n            out.writeByte(MsgPack.JODA_TYPE_DATA);\n            out.writeBytes(\"Short\");\n            out.writeByte(2);\n            out.writeByte(MsgPack.MIN_FIX_STR + 3);\n            out.writeBytes(\"flt\");\n            out.writeByte(MsgPack.FLOAT_32);\n            out.writeFloat(1.2f);\n            out.writeByte(MsgPack.MIN_FIX_STR + 3);\n            out.writeBytes(\"dbl\");\n            out.writeByte(MsgPack.FLOAT_64);\n            out.writeDouble(1.8d);\n        }\n        var expected = baos.toByteArray();\n\n        FlexiBean bean = new FlexiBean();\n        bean.set(\"tru\", Boolean.TRUE);\n        bean.set(\"fal\", Boolean.FALSE);\n        bean.set(\"byt\", Byte.valueOf((byte) 1));\n        bean.set(\"sht\", Short.valueOf((short) 2));\n        bean.set(\"flt\", Float.valueOf(1.2f));\n        bean.set(\"dbl\", Double.valueOf(1.8d));\n        var bytes = JodaBeanSer.COMPACT.binWriter(STANDARD).write(bean, false);\n        assertThat(bytes).isEqualTo(expected);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_primitiveTypeChanged() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_MAP + 2);\n            out.writeByte(MsgPack.MIN_FIX_STR + 1);\n            out.writeBytes(\"a\");\n            out.writeByte(6);\n            out.writeByte(MsgPack.MIN_FIX_STR + 1);\n            out.writeBytes(\"b\");\n            out.writeByte(5);\n        }\n        var bytes = baos.toByteArray();\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, ImmDoubleFloat.class);\n        assertThat(parsed.getA()).isCloseTo(6, offset(1e-10));\n        assertThat(parsed.getB()).isCloseTo(5, offset(1e-10));\n    }\n\n    @Test\n    void test_read_optionalTypeToDefaulted() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_MAP);\n        }\n        var bytes = baos.toByteArray();\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, ImmDefault.class);\n        assertThat(parsed.getValue()).isEqualTo(\"Defaulted\");\n    }\n\n    @Test\n    void test_readWriteJodaConvertWrapper() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_MAP + 2);\n            out.writeByte(MsgPack.MIN_FIX_STR + 4);\n            out.writeBytes(\"bean\");\n            out.writeByte(MsgPack.MIN_FIX_STR + 7);\n            out.writeBytes(\"Hello:9\");\n            out.writeByte(MsgPack.MIN_FIX_STR + 11);\n            out.writeBytes(\"description\");\n            out.writeByte(MsgPack.MIN_FIX_STR + 5);\n            out.writeBytes(\"Weird\");\n        }\n        var expected = baos.toByteArray();\n\n        var wrapper = new JodaConvertWrapper();\n        var bean = new JodaConvertBean(\"Hello:9\");\n        wrapper.setBean(bean);\n        wrapper.setDescription(\"Weird\");\n        var bytes = JodaBeanSer.COMPACT.binWriter(STANDARD).write(wrapper, false);\n        assertThat(bytes).isEqualTo(expected);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, JodaConvertWrapper.class);\n        BeanAssert.assertBeanEquals(wrapper, parsed);\n    }\n\n    @Test\n    void test_readWriteJodaConvertBean() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_MAP + 2);\n            out.writeByte(MsgPack.MIN_FIX_STR + 4);\n            out.writeBytes(\"base\");\n            out.writeByte(MsgPack.MIN_FIX_STR + 5);\n            out.writeBytes(\"Hello\");\n            out.writeByte(MsgPack.MIN_FIX_STR + 5);\n            out.writeBytes(\"extra\");\n            out.writeByte(9);\n        }\n        var expected = baos.toByteArray();\n\n        var bean = new JodaConvertBean(\"Hello:9\");\n        var bytes = JodaBeanSer.COMPACT.binWriter(STANDARD).write(bean, false);\n        assertThat(bytes).isEqualTo(expected);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, JodaConvertBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_readOldPrimitiveArrayFormat() throws IOException {\n        // test format written by v2.12 can still be read\n        var baos = new ByteArrayOutputStream();\n        var out = new MsgPackOutput(baos);\n        out.writeArrayHeader(2);\n        out.writeInt(1);\n        out.writeMapHeader(2);\n        out.writeString(\"intArray\");\n        out.writeString(\"1,3,2\");\n        out.writeString(\"intArray2d\");\n        out.writeArrayHeader(3);\n        out.writeString(\"1,2\");\n        out.writeString(\"2\");\n        out.writeString(\"\");\n        var bytes = baos.toByteArray();\n\n        var expected = ImmArrays.builder()\n                .intArray(1, 3, 2)\n                .intArray2d(new int[][] {{1, 2}, {2}, {}})\n                .build();\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, ImmArrays.class);\n        BeanAssert.assertBeanEquals(expected, parsed);\n    }\n\n    @Test\n    void test_readOldStringArrayWithMetaFormat() throws IOException {\n        // test format written by v2.12 can still be read\n        var baos = new ByteArrayOutputStream();\n        var out = new MsgPackOutput(baos);\n        out.writeArrayHeader(2);\n        out.writeInt(1);\n        out.writeMapHeader(1);\n        out.writeString(\"array2d\");\n        out.writeMapHeader(1);\n        out.writeExtensionString(MsgPack.JODA_TYPE_META, \"String[][]\");\n        out.writeArrayHeader(3);\n        out.writeMapHeader(1);\n        out.writeExtensionString(MsgPack.JODA_TYPE_META, \"String[]\");\n        out.writeArrayHeader(1);\n        out.writeString(\"a\");\n        out.writeMapHeader(1);\n        out.writeExtensionString(MsgPack.JODA_TYPE_META, \"String[]\");\n        out.writeArrayHeader(0);\n        out.writeMapHeader(1);\n        out.writeExtensionString(MsgPack.JODA_TYPE_META, \"String[]\");\n        out.writeArrayHeader(2);\n        out.writeString(\"b\");\n        out.writeString(\"c\");\n        var bytes = baos.toByteArray();\n\n        var expected = SimpleJson.builder()\n                .array2d(new String[][] {{\"a\"}, {}, {\"b\", \"c\"}})\n                .build();\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, SimpleJson.class);\n        BeanAssert.assertBeanEquals(expected, parsed);\n    }\n\n    @Test\n    <T extends Comparable<T>> void test_readOldListWithMetaFormat() throws IOException {\n        // test format written by v2.12 can still be read (meta caused by List<Comparable> declaration)\n        var baos = new ByteArrayOutputStream();\n        var out = new MsgPackOutput(baos);\n        out.writeArrayHeader(2);\n        out.writeInt(1);\n        out.writeMapHeader(1);\n        out.writeString(\"list\");\n        out.writeArrayHeader(2);\n        out.writeMapHeader(1);\n        out.writeExtensionString(MsgPack.JODA_TYPE_DATA, \"String\");\n        out.writeString(\"A\");\n        out.writeMapHeader(1);\n        out.writeExtensionString(MsgPack.JODA_TYPE_DATA, \"String\");\n        out.writeString(\"B\");\n        var bytes = baos.toByteArray();\n\n        @SuppressWarnings(\"unchecked\")\n        var list = (ImmutableList<T>) ImmutableList.of(\"A\", \"B\");\n        var expected = ImmGuava.<T>builder()\n                .list(list)\n                .build();\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, ImmGuava.class);\n        BeanAssert.assertBeanEquals(expected, parsed);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_read_nonStandard_JodaConvertWrapper_expanded() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_MAP + 2);\n            out.writeByte(MsgPack.MIN_FIX_STR + 4);\n            out.writeBytes(\"bean\");\n            out.writeByte(MsgPack.MIN_FIX_MAP + 2);\n            out.writeByte(MsgPack.MIN_FIX_STR + 4);\n            out.writeBytes(\"base\");\n            out.writeByte(MsgPack.MIN_FIX_STR + 5);\n            out.writeBytes(\"Hello\");\n            out.writeByte(MsgPack.MIN_FIX_STR + 5);\n            out.writeBytes(\"extra\");\n            out.writeByte(9);\n            out.writeByte(MsgPack.MIN_FIX_STR + 11);\n            out.writeBytes(\"description\");\n            out.writeByte(MsgPack.MIN_FIX_STR + 5);\n            out.writeBytes(\"Weird\");\n        }\n        var bytes = baos.toByteArray();\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, JodaConvertWrapper.class);\n        var wrapper = new JodaConvertWrapper();\n        var bean = new JodaConvertBean(\"Hello:9\");\n        wrapper.setBean(bean);\n        wrapper.setDescription(\"Weird\");\n        BeanAssert.assertBeanEquals(wrapper, parsed);\n    }\n\n    @Test\n    void test_read_nonStandard_JodaConvertBean_flattened() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_STR + 7);\n            out.writeBytes(\"Hello:9\");\n            out.writeByte(9);\n        }\n        var bytes = baos.toByteArray();\n\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes, JodaConvertBean.class);\n        var bean = new JodaConvertBean(\"Hello:9\");\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_read_invalidFormat_sizeOneArrayAtRoot() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 1);\n            out.writeByte(1);\n        }\n        var bytes = baos.toByteArray();\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class));\n    }\n\n    @Test\n    void test_read_wrongVersion() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(-1);\n            out.writeByte(MsgPack.MIN_FIX_MAP + 0);\n        }\n        var bytes = baos.toByteArray();\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class));\n    }\n\n    @Test\n    void test_read_rootTypeNotSpecified_FlexiBean() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_MAP + 0);\n        }\n        var bytes = baos.toByteArray();\n        JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class);\n    }\n\n    @Test\n    void test_read_rootTypeNotSpecified_Bean() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_MAP + 0);\n        }\n        var bytes = baos.toByteArray();\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, Bean.class));\n    }\n\n    @Test\n    void test_read_rootTypeValid_Bean() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_MAP + 1);\n            out.writeByte(MsgPack.EXT_8);\n            out.writeByte(FlexiBean.class.getName().length());\n            out.writeByte(MsgPack.JODA_TYPE_BEAN);\n            out.write(FlexiBean.class.getName().getBytes(MsgPack.UTF_8));\n            out.writeByte(MsgPack.NIL);\n        }\n        var bytes = baos.toByteArray();\n        JodaBeanSer.COMPACT.binReader().read(bytes, Bean.class);\n    }\n\n    @Test\n    void test_read_rootTypeInvalid_Bean() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_MAP + 1);\n            out.writeByte(MsgPack.EXT_8);\n            out.writeByte(String.class.getName().length());\n            out.writeByte(MsgPack.JODA_TYPE_BEAN);\n            out.write(String.class.getName().getBytes(MsgPack.UTF_8));\n            out.writeByte(MsgPack.NIL);\n        }\n        var bytes = baos.toByteArray();\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, Bean.class));\n    }\n\n    @Test\n    void test_read_rootTypeInvalid_incompatible() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_MAP + 1);\n            out.writeByte(MsgPack.EXT_8);\n            out.writeByte(Company.class.getName().length());\n            out.writeByte(MsgPack.JODA_TYPE_BEAN);\n            out.write(Company.class.getName().getBytes(MsgPack.UTF_8));\n            out.writeByte(MsgPack.NIL);\n        }\n        var bytes = baos.toByteArray();\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, FlexiBean.class));\n    }\n\n    @Test\n    void test_read_invalidFormat_noNilValueAfterType() throws IOException {\n        var baos = new ByteArrayOutputStream();\n        try (var out = new DataOutputStream(baos)) {\n            out.writeByte(MsgPack.MIN_FIX_ARRAY + 2);\n            out.writeByte(1);\n            out.writeByte(MsgPack.MIN_FIX_MAP + 1);\n            out.writeByte(MsgPack.EXT_8);\n            out.writeByte(FlexiBean.class.getName().length());\n            out.writeByte(MsgPack.JODA_TYPE_BEAN);\n            out.write(FlexiBean.class.getName().getBytes(MsgPack.UTF_8));\n            out.writeByte(MsgPack.TRUE);  // should be NIL\n        }\n        var bytes = baos.toByteArray();\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read(bytes, Bean.class));\n    }\n\n    @Test\n    void test_read_byteArray_nullByteArray() {\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.binReader().read((byte[]) null, Company.class));\n    }\n\n    @Test\n    void test_write_nullKeyInMap() {\n        var address = new Address();\n        var bean = new Person();\n        bean.getOtherAddressMap().put(null, address);\n        var bytes = JodaBeanSer.COMPACT.binWriter(STANDARD).write(bean);\n        var parsed = JodaBeanSer.COMPACT.binReader().read(bytes);\n        assertThat(parsed).isEqualTo(bean);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/json/TestJsonInput.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.json;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;\nimport static org.assertj.core.api.Assertions.offset;\n\nimport java.io.IOException;\nimport java.io.StringReader;\n\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.params.ParameterizedTest;\nimport org.junit.jupiter.params.provider.MethodSource;\n\n/**\n * Test {@link JsonInput}.\n */\nclass TestJsonInput {\n\n    //-----------------------------------------------------------------------\n    static Object[][] data_string() {\n        return new Object[][] {\n                {\"\", \"\"},\n                {\"normal text\", \"normal text\"},\n                {\"\\\\\\\"\", \"\\\"\"},\n                {\"\\\\\\\\\", \"\\\\\"},\n                {\"a\\\\\\\\b\", \"a\\\\b\"},\n                {\"a\\\\\\\"b\", \"a\\\"b\"},\n                {\"a\\\\\\\\\\\\\\\"b\", \"a\\\\\\\"b\"},\n                {\"a\\\\nb\", \"a\\nb\"},\n                {\"a\\\\fb\", \"a\\fb\"},\n                {\"a\\\\/b\", \"a/b\"},\n                {\"foo\\\\r\\\\nbar\", \"foo\\r\\nbar\"},\n                {\"foo\\\\tbar\", \"foo\\tbar\"},\n                {\"foo\\\\u2028bar\\\\u2029\\u2030\", \"foo\\u2028bar\\u2029\\u2030\"},\n                {\"foo\\\\u0000bar\", \"foo\\u0000bar\"},\n                {\"foo\\\\u001bbar\", \"foo\\u001bbar\"},\n                {\"\\\\u0001\\\\b\\\\u000f\\\\u0010\\\\u001f\", \"\\u0001\\u0008\\u000f\\u0010\\u001f\"},\n                {\"\\\\u000a\\\\u000A\\\\u0010\\\\u001e\\\\u001E\", \"\\n\\n\\u0010\\u001e\\u001e\"},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_string\")\n    void test_parseString(String text, String expected) throws IOException {\n        var input = new JsonInput(new StringReader(text + '\"'));\n        assertThat(input.parseString()).isEqualTo(expected);\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_string\")\n    void test_parseString_endOfFile(String text, String expected) throws IOException {\n        var input = new JsonInput(new StringReader(text));\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> input.parseString());\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_string\")\n    void test_acceptString(String text, String expected) throws IOException {\n        var input = new JsonInput(new StringReader('\"' + text + '\"'));\n        assertThat(input.acceptString()).isEqualTo(expected);\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_string\")\n    void test_acceptString_whitespace(String text, String expected) throws IOException {\n        var input = new JsonInput(new StringReader(\" \\t\\r\\n \\\"\" + text + '\"'));\n        assertThat(input.acceptString()).isEqualTo(expected);\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_string\")\n    void test_acceptString_pushback(String text, String expected) throws IOException {\n        var input = new JsonInput(new StringReader(text + '\"'));\n        input.pushBack('\"');\n        assertThat(input.acceptString()).isEqualTo(expected);\n    }\n\n    static Object[][] data_stringBad() {\n        return new Object[][] {\n                {\"\\\\x\"},\n                {\"\\\\u1\"},\n                {\"\\\\u01\"},\n                {\"\\\\u001\"},\n                {\"\\\\u000g\"},\n                {\"\\\\urubbish\"},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_stringBad\")\n    void test_parseString_bad(String text) throws IOException {\n        var input = new JsonInput(new StringReader(text + '\"'));\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> input.parseString());\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_stringBad\")\n    void test_acceptString_bad(String text) throws IOException {\n        var input = new JsonInput(new StringReader('\"' + text + '\"'));\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> input.acceptString());\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_stringBad\")\n    void test_acceptString_bad_whitespace(String text) throws IOException {\n        var input = new JsonInput(new StringReader(\" \\t\\r\\n \\\"\" + text + '\"'));\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> input.acceptString());\n    }\n\n    //-----------------------------------------------------------------------\n    @ParameterizedTest\n    @MethodSource(\"data_string\")\n    void test_parseObjectKey(String text, String expected) throws IOException {\n        var input = new JsonInput(new StringReader(text + \"\\\":\"));\n        assertThat(input.parseObjectKey()).isEqualTo(expected);\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_string\")\n    void test_parseObjectKey_whitspace(String text, String expected) throws IOException {\n        var input = new JsonInput(new StringReader(text + \"\\\" \\t\\n\\r:\"));\n        assertThat(input.parseObjectKey()).isEqualTo(expected);\n    }\n\n    //-----------------------------------------------------------------------\n    @ParameterizedTest\n    @MethodSource(\"data_string\")\n    void test_acceptObjectKey(String text, String expected) throws IOException {\n        var input = new JsonInput(new StringReader(text + \"\\\":\"));\n        assertThat(input.acceptObjectKey(JsonEvent.STRING)).isEqualTo(expected);\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_string\")\n    void test_acceptObjectKey_whitspace(String text, String expected) throws IOException {\n        var input = new JsonInput(new StringReader(text + \"\\\" \\t\\n\\r:\"));\n        assertThat(input.acceptObjectKey(JsonEvent.STRING)).isEqualTo(expected);\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_string\")\n    void test_acceptObjectKey_notString(String text, String expected) throws IOException {\n        var input = new JsonInput(new StringReader(text + \"\\\":\"));\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> input.acceptObjectKey(JsonEvent.OBJECT));\n    }\n\n    @Test\n    void test_acceptObjectKey_pushBack() throws IOException {\n        var input = new JsonInput(new StringReader(\":\"));\n        input.pushBackObjectKey(\"key\");\n        assertThat(input.acceptObjectKey(JsonEvent.STRING)).isEqualTo(\"key\");\n    }\n\n    //-----------------------------------------------------------------------\n    static Object[][] data_numberIntegral() {\n        return new Object[][] {\n                {\"0\", 0L},\n                {\"1\", 1L},\n                {\"9\", 9L},\n                {\"10\", 10L},\n                {\"19\", 19L},\n                {\"123456789\", 123456789L},\n                {\"1234567890123456789\", 1234567890123456789L},\n                {\"-0\", 0L},\n                {\"-1\", -1L},\n                {\"-9\", -9L},\n                {\"-10\", -10L},\n                {\"-19\", -19L},\n                {\"-123456789\", -123456789L},\n                {\"-1234567890123456789\", -1234567890123456789L},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_numberIntegral\")\n    void test_parseNumberIntegral(String text, long expected) throws IOException {\n        var input = new JsonInput(new StringReader(text + '}'));\n        assertThat(input.readEvent()).isEqualTo(JsonEvent.NUMBER_INTEGRAL);\n        assertThat(input.parseNumberIntegral()).isEqualTo(expected);\n        assertThat(input.readEvent()).isEqualTo(JsonEvent.OBJECT_END);\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_numberIntegral\")\n    void test_parseNumberIntegral_endOfFile(String text, long expected) throws IOException {\n        var input = new JsonInput(new StringReader(text));\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> input.readEvent());\n    }\n\n    //-----------------------------------------------------------------------\n    static Object[][] data_numberFloating() {\n        return new Object[][] {\n                {\"0.0\", 0d},\n                {\"1.0\", 1d},\n                {\"9.0\", 9d},\n                {\"10.0\", 10d},\n                {\"19.0\", 19d},\n                {\"123456789.0\", 123456789d},\n                {\"1234567890123456789.0\", 1234567890123456789d},\n                {\"-0.0\", 0d},\n                {\"-1.0\", -1d},\n                {\"-9.0\", -9d},\n                {\"-10.0\", -10d},\n                {\"-19.0\", -19d},\n                {\"-123456789.0\", -123456789d},\n                {\"-1234567890123456789.0\", -1234567890123456789d},\n                {\"0.0001\", 0.0001d},\n                {\"1.12345678\", 1.12345678d},\n                {\"9.0e2\", 9.0e2d},\n                {\"9e2\", 9e2d},\n                {\"123.456e20\", 123.456e20d},\n                {\"123.456e+20\", 123.456e+20d},\n                {\"123.456e-20\", 123.456e-20d},\n                {\"9.0E2\", 9.0e2d},\n                {\"9E2\", 9e2d},\n                {\"123.456E20\", 123.456e20d},\n                {\"123.456E+20\", 123.456e+20d},\n                {\"123.456E-20\", 123.456e-20d},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_numberFloating\")\n    void test_parseNumberFloating(String text, double expected) throws IOException {\n        var input = new JsonInput(new StringReader(text + '}'));\n        assertThat(input.readEvent()).isEqualTo(JsonEvent.NUMBER_FLOATING);\n        assertThat(input.parseNumberFloating()).isCloseTo(expected, offset(0.00001d));\n        assertThat(input.readEvent()).isEqualTo(JsonEvent.OBJECT_END);\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_numberFloating\")\n    void test_parseNumberFloating_endOfFile(String text, double expected) throws IOException {\n        var input = new JsonInput(new StringReader(text));\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> input.readEvent());\n    }\n\n    //-----------------------------------------------------------------------\n    static Object[][] data_numberBad() {\n        return new Object[][] {\n                {\"-\"},\n                {\"x\"},\n                {\"e\"},\n                {\"E\"},\n                {\"1e\"},\n                {\"2E\"},\n                {\"1+\"},\n                {\"1-\"},\n                {\"1.\"},\n                {\"00\"},\n                {\"001\"},\n                {\"00.0\"},\n                {\"1.1e3E4\"},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_numberBad\")\n    void test_parseNumberFloating_bad(String text) throws IOException {\n        var input = new JsonInput(new StringReader(text + '}'));\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> input.readEvent());\n    }\n\n    //-----------------------------------------------------------------------\n    static Object[][] data_event() {\n        return new Object[][] {\n                {\"null\", JsonEvent.NULL},\n                {\"true\", JsonEvent.TRUE},\n                {\"false\", JsonEvent.FALSE},\n                {\"{\", JsonEvent.OBJECT},\n                {\"}\", JsonEvent.OBJECT_END},\n                {\"[\", JsonEvent.ARRAY},\n                {\"]\", JsonEvent.ARRAY_END},\n                {\"\\\"\", JsonEvent.STRING},\n                {\"-1}\", JsonEvent.NUMBER_INTEGRAL},\n                {\"1}\", JsonEvent.NUMBER_INTEGRAL},\n                {\"1.0}\", JsonEvent.NUMBER_FLOATING},\n                {\"-1.2}\", JsonEvent.NUMBER_FLOATING},\n                {\":\", JsonEvent.COLON},\n                {\",\", JsonEvent.COMMA},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_event\")\n    void test_readEvent(String text, JsonEvent expected) throws IOException {\n        var input = new JsonInput(new StringReader(text));\n        assertThat(input.readEvent()).isEqualTo(expected);\n    }\n\n    static Object[][] data_eventBad() {\n        return new Object[][] {\n                {\"nul\"},\n                {\"nulx\"},\n                {\"nx\"},\n                {\"tru\"},\n                {\"trux\"},\n                {\"tx\"},\n                {\"fals\"},\n                {\"fx\"},\n                {\"x\"},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_eventBad\")\n    void test_readEvent_bad(String text) throws IOException {\n        var input = new JsonInput(new StringReader(text));\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> input.readEvent());\n    }\n\n    //-----------------------------------------------------------------------\n    static Object[][] data_skip() {\n        return new Object[][] {\n                {\"null\"},\n                {\"true\"},\n                {\"false\"},\n                {\"\\\"\\\"\"},\n                {\"\\\"text\\\"\"},\n                {\"-1\"},\n                {\"1\"},\n                {\"1.0\"},\n                {\"-1.2\"},\n                {\"{}\"},\n                {\"{\\\"a\\\":2}\"},\n                {\"{\\\"a\\\":2,\\\"b\\\":{\\\"aa\\\":[1,2,3]}}\"},\n                {\"[]\"},\n                {\"[1,2,3]\"},\n                {\"[1,[\\\"\\\"],{\\\"a\\\":2}]\"},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_skip\")\n    void test_skip(String text) throws IOException {\n        var input = new JsonInput(new StringReader(text + ','));\n        input.skipData();\n        assertThat(input.readEvent()).isEqualTo(JsonEvent.COMMA);\n    }\n\n    @Test\n    void test_skip_bad() throws IOException {\n        var input = new JsonInput(new StringReader(\",\"));\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> input.skipData());\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/json/TestJsonOutput.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.json;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport java.io.IOException;\n\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.params.ParameterizedTest;\nimport org.junit.jupiter.params.provider.MethodSource;\n\n/**\n * Test {@link JsonOutput}.\n */\nclass TestJsonOutput {\n\n    private StringBuilder buf;\n    private JsonOutput outputCompact;\n    private JsonOutput outputPretty;\n\n    @BeforeEach\n    void setUp() {\n        buf = new StringBuilder();\n        outputCompact = new JsonOutput(buf);\n        outputPretty = new JsonOutput(buf, JodaBeanJsonNumberFormat.STRING, \" \", \"\\n\");\n    }\n\n    //-----------------------------------------------------------------------\n    static Object[][] data_string() {\n        return new Object[][] {\n                {\"\", \"\"},\n                {\"\\\"\", \"\\\\\\\"\"},\n                {\"\\\\\", \"\\\\\\\\\"},\n                {\"a\\\\b\", \"a\\\\\\\\b\"},\n                {\"a\\\"b\", \"a\\\\\\\"b\"},\n                {\"a\\\\\\\"b\", \"a\\\\\\\\\\\\\\\"b\"},\n                {\"a\\nb\", \"a\\\\nb\"},\n                {\"foo\\r\\nbar\", \"foo\\\\r\\\\nbar\"},\n                {\"foo\\tbar\", \"foo\\\\tbar\"},\n                {\"foo\\u2028bar\\u2029\\u2030\", \"foo\\\\u2028bar\\\\u2029\\u2030\"},\n                {\"foo\\u0000bar\", \"foo\\\\u0000bar\"},\n                {\"foo\\u001bbar\", \"foo\\\\u001bbar\"},\n                {\"\\u0001\\u0008\\u000f\\u0010\\u001f\", \"\\\\u0001\\\\b\\\\u000f\\\\u0010\\\\u001f\"},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_string\")\n    void test_writeString(String input, String expected) throws IOException {\n        outputCompact.writeString(input);\n        assertThat(buf.toString()).isEqualTo('\"' + expected + '\"');\n    }\n\n    //-----------------------------------------------------------------------\n    static Object[][] data_int() {\n        return new Object[][] {\n                {0, \"0\"},\n                {1, \"1\"},\n                {2, \"2\"},\n                {1234567, \"1234567\"},\n                {-1, \"-1\"},\n                {-1234567, \"-1234567\"},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_int\")\n    void test_writeInt(int input, String expected) throws IOException {\n        outputCompact.writeInt(input);\n        assertThat(buf.toString()).isEqualTo(expected);\n    }\n\n    static Object[][] data_long() {\n        return new Object[][] {\n                {0, \"0\"},\n                {1, \"1\"},\n                {2, \"2\"},\n                {1234567, \"1234567\"},\n                {-1, \"-1\"},\n                {-1234567, \"-1234567\"},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_long\")\n    void test_writeLong(long input, String expected) throws IOException {\n        outputCompact.writeLong(input);\n        assertThat(buf.toString()).isEqualTo(expected);\n    }\n\n    static Object[][] data_double() {\n        return new Object[][] {\n                {0d, \"0.0\"},\n                {1d, \"1.0\"},\n                {2d, \"2.0\"},\n                {1234567d, \"1234567.0\"},\n                {-1d, \"-1.0\"},\n                {-1234567d, \"-1234567.0\"},\n                {0.000001d, \"1.0E-6\"},\n                {0.1234d, \"0.1234\"},\n                {Double.NaN, \"\\\"NaN\\\"\"},\n                {Double.POSITIVE_INFINITY, \"\\\"Infinity\\\"\"},\n                {Double.NEGATIVE_INFINITY, \"\\\"-Infinity\\\"\"},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_double\")\n    void test_writeDouble(double input, String expected) throws IOException {\n        outputCompact.writeDouble(input);\n        assertThat(buf.toString()).isEqualTo(expected);\n    }\n\n    static Object[][] data_float() {\n        return new Object[][] {\n                {0f, \"0.0\"},\n                {1f, \"1.0\"},\n                {2f, \"2.0\"},\n                {1234567f, \"1234567.0\"},\n                {-1f, \"-1.0\"},\n                {-1234567f, \"-1234567.0\"},\n                {0.000001f, \"1.0E-6\"},\n                {0.1234f, \"0.1234\"},\n                {Float.NaN, \"\\\"NaN\\\"\"},\n                {Float.POSITIVE_INFINITY, \"\\\"Infinity\\\"\"},\n                {Float.NEGATIVE_INFINITY, \"\\\"-Infinity\\\"\"},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_float\")\n    void test_writeFloat(float input, String expected) throws IOException {\n        outputCompact.writeFloat(input);\n        assertThat(buf.toString()).isEqualTo(expected);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_writeNull() throws IOException {\n        outputCompact.writeNull();\n        assertThat(buf.toString()).isEqualTo(\"null\");\n    }\n\n    @Test\n    void test_writeBoolean_true() throws IOException {\n        outputCompact.writeBoolean(true);\n        assertThat(buf.toString()).isEqualTo(\"true\");\n    }\n\n    @Test\n    void test_writeBoolean_false() throws IOException {\n        outputCompact.writeBoolean(false);\n        assertThat(buf.toString()).isEqualTo(\"false\");\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_write_array0() throws IOException {\n        outputCompact.writeArrayStart();\n        outputCompact.writeArrayEnd();\n        assertThat(buf.toString()).isEqualTo(\"[]\");\n    }\n\n    @Test\n    void test_write_array1() throws IOException {\n        outputCompact.writeArrayStart();\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeString(\"a\");\n        outputCompact.writeArrayEnd();\n        assertThat(buf.toString()).isEqualTo(\"[\\\"a\\\"]\");\n    }\n\n    @Test\n    void test_write_array2() throws IOException {\n        outputCompact.writeArrayStart();\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeString(\"a\");\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeString(\"b\");\n        outputCompact.writeArrayEnd();\n        assertThat(buf.toString()).isEqualTo(\"[\\\"a\\\",\\\"b\\\"]\");\n    }\n\n    @Test\n    void test_write_array3() throws IOException {\n        outputCompact.writeArrayStart();\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeString(\"a\");\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeString(\"b\");\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeString(\"c\");\n        outputCompact.writeArrayEnd();\n        assertThat(buf.toString()).isEqualTo(\"[\\\"a\\\",\\\"b\\\",\\\"c\\\"]\");\n    }\n\n    @Test\n    void test_write_arrayDeep0() throws IOException {\n        outputCompact.writeArrayStart();\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeString(\"a\");\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeArrayStart();\n        outputCompact.writeArrayEnd();\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeString(\"c\");\n        outputCompact.writeArrayEnd();\n        assertThat(buf.toString()).isEqualTo(\"[\\\"a\\\",[],\\\"c\\\"]\");\n    }\n\n    @Test\n    void test_write_arrayDeep1() throws IOException {\n        outputCompact.writeArrayStart();\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeString(\"a\");\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeArrayStart();\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeString(\"b1\");\n        outputCompact.writeArrayEnd();\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeString(\"c\");\n        outputCompact.writeArrayEnd();\n        assertThat(buf.toString()).isEqualTo(\"[\\\"a\\\",[\\\"b1\\\"],\\\"c\\\"]\");\n    }\n\n    @Test\n    void test_write_arrayDeep2() throws IOException {\n        outputCompact.writeArrayStart();\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeString(\"a\");\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeArrayStart();\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeString(\"b1\");\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeString(\"b2\");\n        outputCompact.writeArrayEnd();\n        outputCompact.writeArrayItemStart();\n        outputCompact.writeString(\"c\");\n        outputCompact.writeArrayEnd();\n        assertThat(buf.toString()).isEqualTo(\"[\\\"a\\\",[\\\"b1\\\",\\\"b2\\\"],\\\"c\\\"]\");\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_write_object0() throws IOException {\n        outputCompact.writeObjectStart();\n        outputCompact.writeObjectEnd();\n        assertThat(buf.toString()).isEqualTo(\"{}\");\n    }\n\n    @Test\n    void test_write_object1() throws IOException {\n        outputCompact.writeObjectStart();\n        outputCompact.writeObjectKey(\"a\");\n        outputCompact.writeString(\"aa\");\n        outputCompact.writeObjectEnd();\n        assertThat(buf.toString()).isEqualTo(\"{\\\"a\\\":\\\"aa\\\"}\");\n    }\n\n    @Test\n    void test_write_object2() throws IOException {\n        outputCompact.writeObjectStart();\n        outputCompact.writeObjectKey(\"a\");\n        outputCompact.writeString(\"aa\");\n        outputCompact.writeObjectKey(\"b\");\n        outputCompact.writeString(\"bb\");\n        outputCompact.writeObjectEnd();\n        assertThat(buf.toString()).isEqualTo(\"{\\\"a\\\":\\\"aa\\\",\\\"b\\\":\\\"bb\\\"}\");\n    }\n\n    @Test\n    void test_write_object3() throws IOException {\n        outputCompact.writeObjectStart();\n        outputCompact.writeObjectKeyValue(\"a\", \"aa\");\n        outputCompact.writeObjectKeyValue(\"b\", \"bb\");\n        outputCompact.writeObjectKeyValue(\"c\", \"cc\");\n        outputCompact.writeObjectEnd();\n        assertThat(buf.toString()).isEqualTo(\"{\\\"a\\\":\\\"aa\\\",\\\"b\\\":\\\"bb\\\",\\\"c\\\":\\\"cc\\\"}\");\n    }\n\n    @Test\n    void test_write_objectDeep0() throws IOException {\n        outputCompact.writeObjectStart();\n        outputCompact.writeObjectKeyValue(\"a\", \"aa\");\n        outputCompact.writeObjectKey(\"b\");\n        outputCompact.writeObjectStart();\n        outputCompact.writeObjectEnd();\n        outputCompact.writeObjectKeyValue(\"c\", \"cc\");\n        outputCompact.writeObjectEnd();\n        assertThat(buf.toString()).isEqualTo(\"{\\\"a\\\":\\\"aa\\\",\\\"b\\\":{},\\\"c\\\":\\\"cc\\\"}\");\n    }\n\n    @Test\n    void test_write_objectDeep1() throws IOException {\n        outputCompact.writeObjectStart();\n        outputCompact.writeObjectKeyValue(\"a\", \"aa\");\n        outputCompact.writeObjectKey(\"b\");\n        outputCompact.writeObjectStart();\n        outputCompact.writeObjectKeyValue(\"bb\", \"bbb\");\n        outputCompact.writeObjectEnd();\n        outputCompact.writeObjectKeyValue(\"c\", \"cc\");\n        outputCompact.writeObjectEnd();\n        assertThat(buf.toString()).isEqualTo(\"{\\\"a\\\":\\\"aa\\\",\\\"b\\\":{\\\"bb\\\":\\\"bbb\\\"},\\\"c\\\":\\\"cc\\\"}\");\n    }\n\n    @Test\n    void test_write_objectDeep2() throws IOException {\n        outputCompact.writeObjectStart();\n        outputCompact.writeObjectKeyValue(\"a\", \"aa\");\n        outputCompact.writeObjectKey(\"b\");\n        outputCompact.writeObjectStart();\n        outputCompact.writeObjectKeyValue(\"bb1\", \"bbb1\");\n        outputCompact.writeObjectKeyValue(\"bb2\", \"bbb2\");\n        outputCompact.writeObjectEnd();\n        outputCompact.writeObjectKeyValue(\"c\", \"cc\");\n        outputCompact.writeObjectEnd();\n        assertThat(buf.toString()).isEqualTo(\"{\\\"a\\\":\\\"aa\\\",\\\"b\\\":{\\\"bb1\\\":\\\"bbb1\\\",\\\"bb2\\\":\\\"bbb2\\\"},\\\"c\\\":\\\"cc\\\"}\");\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_write_array0_pretty() throws IOException {\n        outputPretty.writeArrayStart();\n        outputPretty.writeArrayEnd();\n        assertThat(buf.toString()).isEqualTo(\"[]\");\n    }\n\n    @Test\n    void test_write_array1_pretty() throws IOException {\n        outputPretty.writeArrayStart();\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeString(\"a\");\n        outputPretty.writeArrayEnd();\n        assertThat(buf.toString()).isEqualTo(\"[\\\"a\\\"]\");\n    }\n\n    @Test\n    void test_write_array2_pretty() throws IOException {\n        outputPretty.writeArrayStart();\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeString(\"a\");\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeString(\"b\");\n        outputPretty.writeArrayEnd();\n        assertThat(buf.toString()).isEqualTo(\"[\\\"a\\\", \\\"b\\\"]\");\n    }\n\n    @Test\n    void test_write_array3_pretty() throws IOException {\n        outputPretty.writeArrayStart();\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeString(\"a\");\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeString(\"b\");\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeString(\"c\");\n        outputPretty.writeArrayEnd();\n        assertThat(buf.toString()).isEqualTo(\"[\\\"a\\\", \\\"b\\\", \\\"c\\\"]\");\n    }\n\n    @Test\n    void test_write_arrayDeep0_pretty() throws IOException {\n        outputPretty.writeArrayStart();\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeString(\"a\");\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeArrayStart();\n        outputPretty.writeArrayEnd();\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeString(\"c\");\n        outputPretty.writeArrayEnd();\n        assertThat(buf.toString()).isEqualTo(\"[\\\"a\\\", [], \\\"c\\\"]\");\n    }\n\n    @Test\n    void test_write_arrayDeep1_pretty() throws IOException {\n        outputPretty.writeArrayStart();\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeString(\"a\");\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeArrayStart();\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeString(\"b1\");\n        outputPretty.writeArrayEnd();\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeString(\"c\");\n        outputPretty.writeArrayEnd();\n        assertThat(buf.toString()).isEqualTo(\"[\\\"a\\\", [\\\"b1\\\"], \\\"c\\\"]\");\n    }\n\n    @Test\n    void test_write_arrayDeep2_pretty() throws IOException {\n        outputPretty.writeArrayStart();\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeString(\"a\");\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeArrayStart();\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeString(\"b1\");\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeString(\"b2\");\n        outputPretty.writeArrayEnd();\n        outputPretty.writeArrayItemStart();\n        outputPretty.writeString(\"c\");\n        outputPretty.writeArrayEnd();\n        assertThat(buf.toString()).isEqualTo(\"[\\\"a\\\", [\\\"b1\\\", \\\"b2\\\"], \\\"c\\\"]\");\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_write_object0_pretty() throws IOException {\n        outputPretty.writeObjectStart();\n        outputPretty.writeObjectEnd();\n        assertThat(buf.toString()).isEqualTo(\"{}\");\n    }\n\n    @Test\n    void test_write_object1_pretty() throws IOException {\n        outputPretty.writeObjectStart();\n        outputPretty.writeObjectKey(\"a\");\n        outputPretty.writeString(\"aa\");\n        outputPretty.writeObjectEnd();\n        assertThat(buf.toString()).isEqualTo(\"{\\n \\\"a\\\": \\\"aa\\\"\\n}\");\n    }\n\n    @Test\n    void test_write_object2_pretty() throws IOException {\n        outputPretty.writeObjectStart();\n        outputPretty.writeObjectKey(\"a\");\n        outputPretty.writeString(\"aa\");\n        outputPretty.writeObjectKey(\"b\");\n        outputPretty.writeString(\"bb\");\n        outputPretty.writeObjectEnd();\n        assertThat(buf.toString()).isEqualTo(\"{\\n \\\"a\\\": \\\"aa\\\",\\n \\\"b\\\": \\\"bb\\\"\\n}\");\n    }\n\n    @Test\n    void test_write_object3_pretty() throws IOException {\n        outputPretty.writeObjectStart();\n        outputPretty.writeObjectKeyValue(\"a\", \"aa\");\n        outputPretty.writeObjectKeyValue(\"b\", \"bb\");\n        outputPretty.writeObjectKeyValue(\"c\", \"cc\");\n        outputPretty.writeObjectEnd();\n        assertThat(buf.toString()).isEqualTo(\"{\\n \\\"a\\\": \\\"aa\\\",\\n \\\"b\\\": \\\"bb\\\",\\n \\\"c\\\": \\\"cc\\\"\\n}\");\n    }\n\n    @Test\n    void test_write_objectDeep0_pretty() throws IOException {\n        outputPretty.writeObjectStart();\n        outputPretty.writeObjectKeyValue(\"a\", \"aa\");\n        outputPretty.writeObjectKey(\"b\");\n        outputPretty.writeObjectStart();\n        outputPretty.writeObjectEnd();\n        outputPretty.writeObjectKeyValue(\"c\", \"cc\");\n        outputPretty.writeObjectEnd();\n        assertThat(buf.toString()).isEqualTo(\"{\\n \\\"a\\\": \\\"aa\\\",\\n \\\"b\\\": {},\\n \\\"c\\\": \\\"cc\\\"\\n}\");\n    }\n\n    @Test\n    void test_write_objectDeep1_pretty() throws IOException {\n        outputPretty.writeObjectStart();\n        outputPretty.writeObjectKeyValue(\"a\", \"aa\");\n        outputPretty.writeObjectKey(\"b\");\n        outputPretty.writeObjectStart();\n        outputPretty.writeObjectKeyValue(\"bb\", \"bbb\");\n        outputPretty.writeObjectEnd();\n        outputPretty.writeObjectKeyValue(\"c\", \"cc\");\n        outputPretty.writeObjectEnd();\n        assertThat(buf.toString()).isEqualTo(\"{\\n \\\"a\\\": \\\"aa\\\",\\n \\\"b\\\": {\\n  \\\"bb\\\": \\\"bbb\\\"\\n },\\n \\\"c\\\": \\\"cc\\\"\\n}\");\n    }\n\n    @Test\n    void test_write_objectDeep2_pretty() throws IOException {\n        outputPretty.writeObjectStart();\n        outputPretty.writeObjectKeyValue(\"a\", \"aa\");\n        outputPretty.writeObjectKey(\"b\");\n        outputPretty.writeObjectStart();\n        outputPretty.writeObjectKeyValue(\"bb1\", \"bbb1\");\n        outputPretty.writeObjectKeyValue(\"bb2\", \"bbb2\");\n        outputPretty.writeObjectEnd();\n        outputPretty.writeObjectKeyValue(\"c\", \"cc\");\n        outputPretty.writeObjectEnd();\n        assertThat(buf.toString()).isEqualTo(\"\"\"\n                {\n                 \"a\": \"aa\",\n                 \"b\": {\n                  \"bb1\": \"bbb1\",\n                  \"bb2\": \"bbb2\"\n                 },\n                 \"c\": \"cc\"\n                }\\\n                \"\"\");\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/json/TestJsonPerformance.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.json;\n\nimport java.io.IOException;\nimport java.time.Duration;\n\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerTestHelper;\nimport org.junit.jupiter.api.Disabled;\nimport org.junit.jupiter.api.Test;\n\nimport com.google.common.base.Stopwatch;\n\n/**\n * Test bean round-trip using JSON.\n */\n@Disabled(\"Performance test - run manually when needed\")\nclass TestJsonPerformance {\n\n    private static final int REPEAT_OUTER = 20;\n    private static final int REPEAT_INNER = 5000;\n\n    @Test\n    void testPerformance() throws IOException {\n        var address = SerTestHelper.testAddress();\n        invokeNew(address);\n        invokeOld(address);\n        invokeNew(address);\n        invokeOld(address);\n        invokeNew(address);\n        invokeOld(address);\n        System.out.println(\"---\");\n        invokeNew(address);\n        invokeOld(address);\n    }\n\n    private void invokeNew(Address address) {\n        String json;\n        var total = Duration.ZERO;\n        for (int i = 0; i < REPEAT_OUTER; i++) {\n            Stopwatch watch = Stopwatch.createStarted();\n            for (int j = 0; j < REPEAT_INNER; j++) {\n                json = new JodaBeanJsonWriter(JodaBeanSer.PRETTY).write(address);\n                if (json.length() < 1000) {\n                    System.out.println();\n                }\n            }\n            watch.stop();\n            total = total.plus(watch.elapsed());\n        }\n        System.out.println(\"NEW-AVG-J: \" + ((total.dividedBy(REPEAT_OUTER).toNanos() / 1000) / 1000d) + \" ms\");\n    }\n\n    private void invokeOld(Address address) {\n        String json;\n        var total = Duration.ZERO;\n        for (int i = 0; i < REPEAT_OUTER; i++) {\n            Stopwatch watch = Stopwatch.createStarted();\n            for (int j = 0; j < REPEAT_INNER; j++) {\n                json = new JodaBeanSimpleJsonWriter(JodaBeanSer.PRETTY).write(address);\n                if (json.length() < 1000) {\n                    System.out.println();\n                }\n            }\n            watch.stop();\n            total = total.plus(watch.elapsed());\n        }\n        System.out.println(\"OLD-AVG-J: \" + ((total.dividedBy(REPEAT_OUTER).toNanos() / 1000) / 1000d) + \" ms\");\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/json/TestSerializeJson.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.json;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;\nimport static org.assertj.core.api.Assertions.offset;\n\nimport java.io.IOException;\nimport java.io.Reader;\nimport java.io.StringReader;\nimport java.nio.charset.StandardCharsets;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.impl.flexi.FlexiBean;\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.ImmAddress;\nimport org.joda.beans.sample.ImmArrays;\nimport org.joda.beans.sample.ImmDoubleFloat;\nimport org.joda.beans.sample.ImmEmpty;\nimport org.joda.beans.sample.ImmGuava;\nimport org.joda.beans.sample.ImmKey;\nimport org.joda.beans.sample.ImmMappedKey;\nimport org.joda.beans.sample.ImmOptional;\nimport org.joda.beans.sample.ImmPerson;\nimport org.joda.beans.sample.JodaConvertBean;\nimport org.joda.beans.sample.JodaConvertWrapper;\nimport org.joda.beans.sample.Person;\nimport org.joda.beans.sample.PrimitiveBean;\nimport org.joda.beans.sample.SimplePerson;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerDeserializers;\nimport org.joda.beans.ser.SerTestHelper;\nimport org.joda.beans.test.BeanAssert;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.params.ParameterizedTest;\nimport org.junit.jupiter.params.provider.MethodSource;\n\nimport com.google.common.collect.ImmutableMap;\nimport com.google.common.io.Resources;\n\n/**\n * Test property roundtrip using JSON.\n */\nclass TestSerializeJson {\n\n    @Test\n    void test_writeAddress() throws IOException {\n        var bean = SerTestHelper.testAddress();\n        var json = JodaBeanSer.PRETTY.jsonWriter().write(bean);\n//        System.out.println(json);\n        assertEqualsSerialization(json, \"/org/joda/beans/ser/Address2.json\");\n\n        var parsed = (Address) JodaBeanSer.PRETTY.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeImmAddress() throws IOException {\n        var bean = SerTestHelper.testImmAddress(false);\n        var json = JodaBeanSer.PRETTY.jsonWriter().write(bean);\n//        System.out.println(json);\n        assertEqualsSerialization(json, \"/org/joda/beans/ser/ImmAddress2.json\");\n\n        var parsed = (ImmAddress) JodaBeanSer.PRETTY.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n\n        var oldParsed = loadAndParse(\"/org/joda/beans/ser/ImmAddress1.json\", ImmAddress.class);\n        BeanAssert.assertBeanEquals(bean, oldParsed);\n    }\n\n    @Test\n    void test_writeImmOptional() throws IOException {\n        var bean = SerTestHelper.testImmOptional();\n        var json = JodaBeanSer.PRETTY.withIncludeDerived(true).jsonWriter().write(bean);\n//        System.out.println(json);\n        assertEqualsSerialization(json, \"/org/joda/beans/ser/ImmOptional2.json\");\n\n        var parsed = (ImmOptional) JodaBeanSer.PRETTY.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeImmArrays() throws IOException {\n        var bean = ImmArrays.of(\n                new int[] {1, 3, 2},\n                new long[] {1, 4, 3},\n                new double[] {1.1, 2.2, 3.3},\n                new boolean[] {true, false},\n                new int[][] {{1, 2}, {2}, {}},\n                new boolean[][] {{true, false}, {false}, {}});\n        var json = JodaBeanSer.PRETTY.jsonWriter().write(bean);\n//        System.out.println(json);\n        assertEqualsSerialization(json, \"/org/joda/beans/ser/ImmArrays2.json\");\n\n        var parsed = JodaBeanSer.PRETTY.simpleJsonReader().read(json, ImmArrays.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n\n        var oldParsed = loadAndParse(\"/org/joda/beans/ser/ImmArrays1.json\", ImmArrays.class);\n        BeanAssert.assertBeanEquals(bean, oldParsed);\n    }\n\n    @Test\n    void test_writeCollections() throws IOException {\n        var bean = SerTestHelper.testCollections(true);\n        var json = JodaBeanSer.PRETTY.jsonWriter().write(bean);\n//        System.out.println(json);\n        assertEqualsSerialization(json, \"/org/joda/beans/ser/Collections2.json\");\n\n        var parsed = JodaBeanSer.PRETTY.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n\n        var oldParsed = loadAndParse(\"/org/joda/beans/ser/Collections1.json\", ImmGuava.class);\n        BeanAssert.assertBeanEquals(bean, oldParsed);\n    }\n\n    @Test\n    void test_writeJodaConvertInterface() {\n        var bean = SerTestHelper.testGenericInterfaces();\n\n        var json = JodaBeanSer.PRETTY.jsonWriter().write(bean);\n//        System.out.println(json);\n\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    private void assertEqualsSerialization(String json, String expectedResource) throws IOException {\n        var url = TestSerializeJson.class.getResource(expectedResource);\n        var expected = Resources.asCharSource(url, StandardCharsets.UTF_8).read();\n        assertThat(json.trim().replace(System.lineSeparator(), \"\\n\"))\n                .isEqualTo(expected.trim().replace(System.lineSeparator(), \"\\n\"));\n    }\n\n    private <T> T loadAndParse(String expectedResource, Class<T> type) throws IOException {\n        var url = TestSerializeJson.class.getResource(expectedResource);\n        var text = Resources.asCharSource(url, StandardCharsets.UTF_8).read();\n        return JodaBeanSer.PRETTY.simpleJsonReader().read(text, type);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_readWriteBeanEmptyChild_pretty() {\n        var bean = new FlexiBean();\n        bean.set(\"element\", \"Test\");\n        bean.set(\"child\", ImmEmpty.builder().build());\n        var json = JodaBeanSer.PRETTY.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\n                \"{\\n \\\"@bean\\\": \\\"org.joda.beans.impl.flexi.FlexiBean\\\",\\n\" +\n                        \" \\\"element\\\": \\\"Test\\\",\\n \\\"child\\\": {\\n  \\\"@bean\\\": \\\"org.joda.beans.sample.ImmEmpty\\\"\\n }\\n}\\n\");\n        var parsed = JodaBeanSer.PRETTY.jsonReader().read(json, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWriteBeanEmptyChild_compact() {\n        var bean = new FlexiBean();\n        bean.set(\"element\", \"Test\");\n        bean.set(\"child\", ImmEmpty.builder().build());\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\n                \"{\\\"@bean\\\":\\\"org.joda.beans.impl.flexi.FlexiBean\\\",\" +\n                        \"\\\"element\\\":\\\"Test\\\",\\\"child\\\":{\\\"@bean\\\":\\\"org.joda.beans.sample.ImmEmpty\\\"}}\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_primitiveTypeChanged() throws IOException {\n        var json = \"{\\\"a\\\":6,\\\"b\\\":5}\";\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json, ImmDoubleFloat.class);\n        assertThat(parsed.getA()).isCloseTo(6, offset(1e-10));\n        assertThat(parsed.getB()).isCloseTo(5, offset(1e-10));\n    }\n\n    @Test\n    void test_readWriteJodaConvertWrapper() {\n        var wrapper = new JodaConvertWrapper();\n        var bean = new JodaConvertBean(\"Hello:9\");\n        wrapper.setBean(bean);\n        wrapper.setDescription(\"Weird\");\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(wrapper);\n        assertThat(json).isEqualTo(\n                \"{\\\"@bean\\\":\\\"org.joda.beans.sample.JodaConvertWrapper\\\",\\\"bean\\\":\\\"Hello:9\\\",\\\"description\\\":\\\"Weird\\\"}\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(wrapper, parsed);\n    }\n\n    @Test\n    void test_readWriteJodaConvertBean() {\n        var bean = new JodaConvertBean(\"Hello:9\");\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\" +\n                \"{\\\"@bean\\\":\\\"org.joda.beans.sample.JodaConvertBean\\\",\\\"base\\\":\\\"Hello\\\",\\\"extra\\\":9}\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_readWrite_objectArrayAsObject() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", new Object[] {\"1\", 2, 3L, 4d, 5f});\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"@bean\":\"org.joda.beans.impl.flexi.FlexiBean\",\"data\":{\"@meta\":\"Object[]\",\\\n                \"value\":[\"1\",2,{\"@type\":\"Long\",\"value\":3},4.0,{\"@type\":\"Float\",\"value\":5.0}]}}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(new StringReader(json));\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_stringArrayAsObject() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", new String[] {\"1\", \"2\"});\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"@bean\":\"org.joda.beans.impl.flexi.FlexiBean\",\"data\":{\"@meta\":\"String[]\",\"value\":[\"1\",\"2\"]}}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(new StringReader(json));\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_numberArrayAsObject() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", new Number[] {1, 2.3, 4L});\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"@bean\":\"org.joda.beans.impl.flexi.FlexiBean\",\"data\":{\"@meta\":\"java.lang.Number[]\",\"value\":[1,2.3,{\"@type\":\"Long\",\"value\":4}]}}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(new StringReader(json));\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_longArrayAsObject() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", new long[] {1L, 2L, 3L});\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"@bean\":\"org.joda.beans.impl.flexi.FlexiBean\",\"data\":{\"@meta\":\"long[]\",\"value\":[1,2,3]}}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(new StringReader(json));\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_intArrayAsObject() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", new int[] {1, 2, 3});\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"@bean\":\"org.joda.beans.impl.flexi.FlexiBean\",\"data\":{\"@meta\":\"int[]\",\"value\":[1,2,3]}}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(new StringReader(json));\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_readWrite_booleanObject_true() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", Boolean.TRUE);\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\n                \"{\\\"@bean\\\":\\\"org.joda.beans.impl.flexi.FlexiBean\\\",\\\"data\\\":true}\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(new StringReader(json));\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_boolean_false() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", Boolean.FALSE);\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\n                \"{\\\"@bean\\\":\\\"org.joda.beans.impl.flexi.FlexiBean\\\",\\\"data\\\":false}\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(new StringReader(json));\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_longObject() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", (long) 6);\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\n                \"{\\\"@bean\\\":\\\"org.joda.beans.impl.flexi.FlexiBean\\\",\\\"data\\\":{\\\"@type\\\":\\\"Long\\\",\\\"value\\\":6}}\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_shortObject() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", (short) 6);\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\n                \"{\\\"@bean\\\":\\\"org.joda.beans.impl.flexi.FlexiBean\\\",\\\"data\\\":{\\\"@type\\\":\\\"Short\\\",\\\"value\\\":6}}\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_byteObject() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", (byte) 6);\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\n                \"{\\\"@bean\\\":\\\"org.joda.beans.impl.flexi.FlexiBean\\\",\\\"data\\\":{\\\"@type\\\":\\\"Byte\\\",\\\"value\\\":6}}\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_floatObject() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", (float) 6);\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\n                \"{\\\"@bean\\\":\\\"org.joda.beans.impl.flexi.FlexiBean\\\",\\\"data\\\":{\\\"@type\\\":\\\"Float\\\",\\\"value\\\":6.0}}\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_floatObject_NaN() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", Float.NaN);\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\n                \"{\\\"@bean\\\":\\\"org.joda.beans.impl.flexi.FlexiBean\\\",\\\"data\\\":{\\\"@type\\\":\\\"Float\\\",\\\"value\\\":\\\"NaN\\\"}}\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_float_NaN_asNull() {\n        var bean = new PrimitiveBean();\n        bean.setValueFloat(Float.NaN);\n        var json = \"{\\\"@bean\\\":\\\"org.joda.beans.sample.PrimitiveBean\\\",\\\"valueFloat\\\":null}\";\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_float_fromInteger() {\n        var bean = new PrimitiveBean();\n        bean.setValueFloat(6f);\n        var json = \"{\\\"@bean\\\":\\\"org.joda.beans.sample.PrimitiveBean\\\",\\\"valueFloat\\\":6}\";\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_float_fromIntegerTooBig() {\n        var json = \"{\\\"@bean\\\":\\\"org.joda.beans.sample.PrimitiveBean\\\",\\\"valueFloat\\\":123456789123456789}\";\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.jsonReader().read(json));\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_readWrite_doubleObject() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", (double) 6);\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"@bean\":\"org.joda.beans.impl.flexi.FlexiBean\",\"data\":6.0}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_doubleObject_NaN() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", Double.NaN);\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"@bean\":\"org.joda.beans.impl.flexi.FlexiBean\",\"data\":{\"@type\":\"Double\",\"value\":\"NaN\"}}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_doubleObject_PositiveInfinity() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", Double.POSITIVE_INFINITY);\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"@bean\":\"org.joda.beans.impl.flexi.FlexiBean\",\"data\":{\"@type\":\"Double\",\"value\":\"Infinity\"}}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_doubleObject_NegativeInfinity() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", Double.NEGATIVE_INFINITY);\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"@bean\":\"org.joda.beans.impl.flexi.FlexiBean\",\"data\":{\"@type\":\"Double\",\"value\":\"-Infinity\"}}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_double_NaN() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.NaN);\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"@bean\":\"org.joda.beans.sample.PrimitiveBean\",\"valueLong\":0,\"valueInt\":0,\"valueShort\":0,\"valueByte\":0,\\\n                \"valueDouble\":\"NaN\",\"valueFloat\":0.0,\"valueChar\":\"\\\\u0000\",\"valueBoolean\":false}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_double_NaN_null() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.NaN);\n        var json = JodaBeanSer.COMPACT.withJsonNumberFormat(JodaBeanJsonNumberFormat.NAN_AS_NULL).jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"@bean\":\"org.joda.beans.sample.PrimitiveBean\",\"valueLong\":0,\"valueInt\":0,\"valueShort\":0,\"valueByte\":0,\\\n                \"valueDouble\":null,\"valueFloat\":0.0,\"valueChar\":\"\\\\u0000\",\"valueBoolean\":false}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_double_NaN_literal() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.NaN);\n        var json = JodaBeanSer.COMPACT.withJsonNumberFormat(JodaBeanJsonNumberFormat.LITERAL).jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"@bean\":\"org.joda.beans.sample.PrimitiveBean\",\"valueLong\":0,\"valueInt\":0,\"valueShort\":0,\"valueByte\":0,\\\n                \"valueDouble\":NaN,\"valueFloat\":0.0,\"valueChar\":\"\\\\u0000\",\"valueBoolean\":false}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_double_PositiveInfinity_string() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.POSITIVE_INFINITY);\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"@bean\":\"org.joda.beans.sample.PrimitiveBean\",\"valueLong\":0,\"valueInt\":0,\"valueShort\":0,\"valueByte\":0,\\\n                \"valueDouble\":\"Infinity\",\"valueFloat\":0.0,\"valueChar\":\"\\\\u0000\",\"valueBoolean\":false}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_double_PositiveInfinity_literal() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.POSITIVE_INFINITY);\n        var json = JodaBeanSer.COMPACT.withJsonNumberFormat(JodaBeanJsonNumberFormat.LITERAL).jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"@bean\":\"org.joda.beans.sample.PrimitiveBean\",\"valueLong\":0,\"valueInt\":0,\"valueShort\":0,\"valueByte\":0,\\\n                \"valueDouble\":Infinity,\"valueFloat\":0.0,\"valueChar\":\"\\\\u0000\",\"valueBoolean\":false}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_double_PositiveInfinity_string() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.POSITIVE_INFINITY);\n        var json = \"\"\"\n                {\"@bean\":\"org.joda.beans.sample.PrimitiveBean\",\"valueLong\":0,\"valueInt\":0,\"valueShort\":0,\"valueByte\":0,\\\n                \"valueDouble\":+Infinity,\"valueFloat\":0.0,\"valueChar\":\"\\\\u0000\",\"valueBoolean\":false}\"\"\";\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_double_NegativeInfinity_string() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.NEGATIVE_INFINITY);\n        var json = JodaBeanSer.COMPACT.jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"@bean\":\"org.joda.beans.sample.PrimitiveBean\",\"valueLong\":0,\"valueInt\":0,\"valueShort\":0,\"valueByte\":0,\\\n                \"valueDouble\":\"-Infinity\",\"valueFloat\":0.0,\"valueChar\":\"\\\\u0000\",\"valueBoolean\":false}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_double_NegativeInfinity_literal() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.NEGATIVE_INFINITY);\n        var json = JodaBeanSer.COMPACT.withJsonNumberFormat(JodaBeanJsonNumberFormat.LITERAL).jsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"@bean\":\"org.joda.beans.sample.PrimitiveBean\",\"valueLong\":0,\"valueInt\":0,\"valueShort\":0,\"valueByte\":0,\\\n                \"valueDouble\":-Infinity,\"valueFloat\":0.0,\"valueChar\":\"\\\\u0000\",\"valueBoolean\":false}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_doubleObject_alternateFormat() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", (double) 6);\n        var json = \"\"\"\n                {\"@bean\":\"org.joda.beans.impl.flexi.FlexiBean\",\"data\":{\"@type\":\"Double\",\"value\":6.0}}\"\"\";\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_doubleObject_integer_flexiWithTypeAnnotation() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", Double.valueOf(6));\n        var json = \"\"\"\n                {\"@bean\":\"org.joda.beans.impl.flexi.FlexiBean\",\"data\":{\"@type\":\"Double\",\"value\":6}}\"\"\";\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_double_NaN_asNull_alternateFormat() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.NaN);\n        var json = \"\"\"\n                {\"@bean\":\"org.joda.beans.sample.PrimitiveBean\",\"valueDouble\":null}\"\"\";\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_double_fromInteger() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(6d);\n        var json = \"\"\"\n                {\"@bean\":\"org.joda.beans.sample.PrimitiveBean\",\"valueDouble\":6}\"\"\";\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_double_fromIntegerTooBig() {\n        var json = \"\"\"\n                {\"@bean\":\"org.joda.beans.sample.PrimitiveBean\",\"data\":{\"@type\":\"Double\",\"value\":123456789123456789}}\"\"\";\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.jsonReader().read(json));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_read_nonStandard_JodaConvertWrapper_expanded() {\n        var json = \"{\\\"@bean\\\":\\\"org.joda.beans.sample.JodaConvertWrapper\\\",\" +\n                \"\\\"bean\\\":{\\\"base\\\":\\\"Hello\\\",\\\"extra\\\":9},\\\"description\\\":\\\"Weird\\\"}\";\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        var wrapper = new JodaConvertWrapper();\n        var bean = new JodaConvertBean(\"Hello:9\");\n        wrapper.setBean(bean);\n        wrapper.setDescription(\"Weird\");\n        BeanAssert.assertBeanEquals(wrapper, parsed);\n    }\n\n    @Test\n    void test_read_nonStandard_JodaConvertBean_flattened() {\n        var json = \"{\\\"@type\\\":\\\"org.joda.beans.sample.JodaConvertBean\\\",\\\"value\\\":\\\"Hello:9\\\"}\";\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json);\n        var bean = new JodaConvertBean(\"Hello:9\");\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWriteInterfaceKeyMap() {\n        var key1 = ImmKey.builder().name(\"Alpha\").build();\n        var person1 = ImmPerson.builder().forename(\"Bob\").surname(\"Builder\").build();\n        var key2 = ImmKey.builder().name(\"Beta\").build();\n        var person2 = ImmPerson.builder().forename(\"Dana\").surname(\"Dash\").build();\n        var mapped = ImmMappedKey.builder().data(ImmutableMap.of(key1, person1, key2, person2)).build();\n        var json = JodaBeanSer.PRETTY.jsonWriter().write(mapped);\n\n        var bean = (ImmMappedKey) JodaBeanSer.PRETTY.jsonReader().read(json);\n        BeanAssert.assertBeanEquals(bean, mapped);\n    }\n\n    @Test\n    void test_read_badTypeInMap() {\n        var json = \"{\\\"@bean\\\":\\\"org.joda.beans.impl.flexi.FlexiBean\\\",\\\"element\\\":{\" +\n                \"\\\"@meta\\\": \\\"Map\\\",\" +\n                \"\\\"value\\\": [[\\\"work\\\", {\\\"@type\\\": \\\"com.foo.UnknownEnum\\\",\\\"value\\\": \\\"BIGWIG\\\"}]]}}\";\n        var parsed = JodaBeanSer.COMPACT.withDeserializers(SerDeserializers.LENIENT).jsonReader().read(json, FlexiBean.class);\n        var bean = new FlexiBean();\n        bean.set(\"element\", ImmutableMap.of(\"work\", \"BIGWIG\"));  // converted to a string\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_ignoreProperty() {\n        var xml = \"{\\\"name\\\":\\\"foo\\\",\\\"wibble\\\":\\\"ignored\\\"}\";\n        var parsed = JodaBeanSer.COMPACT.withDeserializers(SerDeserializers.LENIENT).jsonReader().read(xml, ImmKey.class);\n        var bean = ImmKey.builder().name(\"foo\").build();\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_read_noTypeAttributeAtRoot() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.jsonReader().read(\"{}\"));\n    }\n\n    @Test\n    void test_read_noTypeAttributeAtRootButTypeSpecified() {\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(\"{}\", FlexiBean.class);\n        BeanAssert.assertBeanEquals(new FlexiBean(), parsed);\n    }\n\n    @Test\n    void test_read_rootTypeAttributeNotBean() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.jsonReader().read(\"{\\\"@bean\\\":\\\"java.lang.Integer\\\"}\", Bean.class));\n    }\n\n    @Test\n    void test_read_rootTypeInvalid() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.jsonReader()\n                        .read(\"{\\\"@bean\\\":\\\"org.joda.beans.impl.flexi.FlexiBean\\\"}\", SimplePerson.class));\n    }\n\n    @Test\n    void test_read_rootTypeArgumentInvalid() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.jsonReader().read(\"{}\", Integer.class));\n    }\n\n    @Test\n    void test_write_nullKeyInMap() {\n        var address = new Address();\n        var bean = new Person();\n        bean.getOtherAddressMap().put(null, address);\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.jsonWriter().write(bean));\n    }\n\n    //-----------------------------------------------------------------------\n    static Object[][] data_badFormat() {\n        return new Object[][] {\n                {\"{,}\"},\n                {\"{1,2}\"},\n                {\"{\\\"a\\\",6}\"},\n                {\"{\\\"a\\\":[}}\"},\n                {\"{\\\"a\\\":{\\\"@type\\\":\\\"Integer\\\",\\\"notvalue\\\":6}}\"},\n                {\"{\\\"a\\\":{\\\"@type\\\":\\\"Integer\\\",\\\"value\\\":[]}}\"},\n                {\"{\\\"a\\\":{\\\"@type\\\":\\\"Integer\\\",\\\"value\\\":\" + (((long) Integer.MAX_VALUE) + 1) + \"}}\"},\n                {\"{\\\"a\\\":{\\\"@type\\\":\\\"Integer\\\",\\\"value\\\":\" + (((long) Integer.MIN_VALUE) - 1) + \"}}\"},\n                {\"{\\\"a\\\":{\\\"@type\\\":\\\"Short\\\",\\\"value\\\":\" + ((Short.MAX_VALUE) + 1) + \"}}\"},\n                {\"{\\\"a\\\":{\\\"@type\\\":\\\"Short\\\",\\\"value\\\":\" + ((Short.MIN_VALUE) - 1) + \"}}\"},\n                {\"{\\\"a\\\":{\\\"@type\\\":\\\"Byte\\\",\\\"value\\\":128}}\"},\n                {\"{\\\"a\\\":{\\\"@type\\\":\\\"Byte\\\",\\\"value\\\":-129}}\"},\n                {\"{\\\"a\\\":{\\\"@meta\\\":\\\"List\\\",\\\"notvalue\\\":[]}}\"},\n                {\"{\\\"a\\\":{\\\"@meta\\\":\\\"List\\\",\\\"value\\\":{}}}\"},\n                {\"{\\\"a\\\":{\\\"@meta\\\":\\\"Map\\\",\\\"value\\\":6}}\"},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_badFormat\")\n    void test_badFormat(String text) throws IOException {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.jsonReader().read(text, FlexiBean.class));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_writer_nullSettings() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanJsonWriter(null));\n    }\n\n    @Test\n    void test_writer_write1_nullBean() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanJsonWriter(JodaBeanSer.PRETTY).write(null));\n    }\n\n    @Test\n    void test_writer_write2_nullBean() throws IOException {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanJsonWriter(JodaBeanSer.PRETTY).write(null, new StringBuilder()));\n    }\n\n    @Test\n    void test_writer_write2_nullAppendable() throws IOException {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanJsonWriter(JodaBeanSer.PRETTY).write(new FlexiBean(), null));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_reader_nullSettings() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanJsonReader(null));\n    }\n\n    @Test\n    void test_reader_readReader_null() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanJsonReader(JodaBeanSer.PRETTY).read((Reader) null));\n    }\n\n    @Test\n    void test_reader_readString_null() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanJsonReader(JodaBeanSer.PRETTY).read((String) null));\n    }\n\n    @Test\n    void test_reader_readReaderType_nullReader() throws IOException {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanJsonReader(JodaBeanSer.PRETTY).read((Reader) null, Bean.class));\n    }\n\n    @Test\n    void test_reader_readReaderType_nullType() throws IOException {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanJsonReader(JodaBeanSer.PRETTY).read(new StringReader(\"\"), null));\n    }\n\n    @Test\n    void test_reader_readStringType_nullString() throws IOException {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanJsonReader(JodaBeanSer.PRETTY).read((String) null, Bean.class));\n    }\n\n    @Test\n    void test_reader_readStringType_nullType() throws IOException {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanJsonReader(JodaBeanSer.PRETTY).read(\"\", null));\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/json/TestSerializeJsonSimple.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.json;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;\nimport static org.assertj.core.api.Assertions.assertThatNoException;\nimport static org.assertj.core.api.Assertions.offset;\n\nimport java.io.IOException;\nimport java.io.Reader;\nimport java.io.StringReader;\nimport java.nio.charset.StandardCharsets;\nimport java.util.HashMap;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.impl.flexi.FlexiBean;\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.ImmAddress;\nimport org.joda.beans.sample.ImmArrays;\nimport org.joda.beans.sample.ImmDoubleFloat;\nimport org.joda.beans.sample.ImmGuava;\nimport org.joda.beans.sample.ImmOptional;\nimport org.joda.beans.sample.Person;\nimport org.joda.beans.sample.PrimitiveBean;\nimport org.joda.beans.sample.SimpleJson;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerDeserializers;\nimport org.joda.beans.ser.SerTestHelper;\nimport org.joda.beans.test.BeanAssert;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.params.ParameterizedTest;\nimport org.junit.jupiter.params.provider.MethodSource;\n\nimport com.google.common.io.Resources;\n\n/**\n * Test property roundtrip using JSON.\n */\nclass TestSerializeJsonSimple {\n\n    @Test\n    void test_writeSimpleJson() throws IOException {\n        var bean = SerTestHelper.testSimpleJson();\n        var json = JodaBeanSer.PRETTY.withJsonNumberFormat(JodaBeanJsonNumberFormat.COMPATIBLE_V2).simpleJsonWriter().write(bean);\n//        System.out.println(json);\n        assertEqualsSerialization(json, \"/org/joda/beans/ser/SimpleJson2.simplejson\");\n\n        var parsed = JodaBeanSer.PRETTY.simpleJsonReader().read(json, SimpleJson.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeImmOptional() throws IOException {\n        var bean = SerTestHelper.testImmOptional();\n        var json = JodaBeanSer.PRETTY.withIncludeDerived(true).simpleJsonWriter().write(bean);\n//        System.out.println(json);\n        assertEqualsSerialization(json, \"/org/joda/beans/ser/ImmOptional2.simplejson\");\n\n        var parsed = JodaBeanSer.PRETTY.simpleJsonReader().read(json, ImmOptional.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeImmArrays() throws IOException {\n        var bean = ImmArrays.of(\n                new int[] {1, 3, 2},\n                new long[] {1, 4, 3},\n                new double[] {1.1, 2.2, 3.3},\n                new boolean[] {true, false},\n                new int[][] {{1, 2}, {2}, {}},\n                new boolean[][] {{true, false}, {false}, {}});\n        var json = JodaBeanSer.PRETTY.simpleJsonWriter().write(bean);\n//        System.out.println(json);\n        assertEqualsSerialization(json, \"/org/joda/beans/ser/ImmArrays2.simplejson\");\n\n        var parsed = JodaBeanSer.PRETTY.simpleJsonReader().read(json, ImmArrays.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n\n        var oldParsed = loadAndParse(\"/org/joda/beans/ser/ImmArrays1.simplejson\", ImmArrays.class);\n        BeanAssert.assertBeanEquals(bean, oldParsed);\n    }\n\n    @Test\n    void test_writeAddress() throws IOException {\n        var bean = SerTestHelper.testAddress();\n        var json = JodaBeanSer.PRETTY.simpleJsonWriter().write(bean);\n//        System.out.println(json);\n        assertEqualsSerialization(json, \"/org/joda/beans/ser/Address2.simplejson\");\n        // no round trip with simple JSON, but check that it parses\n        assertThatNoException()\n                .isThrownBy(() -> JodaBeanSer.PRETTY.withDeserializers(SerDeserializers.LENIENT)\n                        .simpleJsonReader().read(json, Address.class));\n    }\n\n    @Test\n    void test_writeImmAddress() throws IOException {\n        var bean = SerTestHelper.testImmAddress(false).toBuilder()\n                .mapInMap(new HashMap<>())\n                .beanBeanMap(new HashMap<>())\n                .build();\n        var json = JodaBeanSer.PRETTY.simpleJsonWriter().write(bean);\n//        System.out.println(json);\n        assertEqualsSerialization(json, \"/org/joda/beans/ser/ImmAddress2.simplejson\");\n        // no round trip with simple JSON, but check that it parses\n        assertThatNoException()\n                .isThrownBy(() -> loadAndParse(\"/org/joda/beans/ser/ImmAddress2.simplejson\", ImmAddress.class));\n        assertThatNoException()\n                .isThrownBy(() -> loadAndParse(\"/org/joda/beans/ser/ImmAddress1.simplejson\", ImmAddress.class));\n    }\n\n    @Test\n    void test_writeCollections() throws IOException {\n        var bean = SerTestHelper.testCollections(false);\n        var json = JodaBeanSer.PRETTY.simpleJsonWriter().write(bean);\n//        System.out.println(json);\n        assertEqualsSerialization(json, \"/org/joda/beans/ser/Collections2.simplejson\");\n\n        var parsed = JodaBeanSer.PRETTY.simpleJsonReader().read(json, ImmGuava.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    private void assertEqualsSerialization(String json, String expectedResource) throws IOException {\n        var url = TestSerializeJson.class.getResource(expectedResource);\n        var expected = Resources.asCharSource(url, StandardCharsets.UTF_8).read();\n        assertThat(json.trim().replace(System.lineSeparator(), \"\\n\"))\n                .isEqualTo(expected.trim().replace(System.lineSeparator(), \"\\n\"));\n    }\n\n    private <T> T loadAndParse(String expectedResource, Class<T> type) throws IOException {\n        var url = TestSerializeJson.class.getResource(expectedResource);\n        var text = Resources.asCharSource(url, StandardCharsets.UTF_8).read();\n        return JodaBeanSer.PRETTY.simpleJsonReader().read(text, type);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_readWriteBeanEmptyChild_pretty() {\n        var bean = new FlexiBean();\n        bean.set(\"element\", \"Test\");\n        bean.set(\"child\", new HashMap<String, String>());\n        var json = JodaBeanSer.PRETTY.simpleJsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"{\\n \\\"element\\\": \\\"Test\\\",\\n \\\"child\\\": {}\\n}\\n\");\n        var parsed = JodaBeanSer.PRETTY.simpleJsonReader().read(json, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWriteBeanEmptyChild_compact() {\n        var bean = new FlexiBean();\n        bean.set(\"element\", \"Test\");\n        bean.set(\"child\", new HashMap<String, String>());\n        var json = JodaBeanSer.COMPACT.simpleJsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"{\\\"element\\\":\\\"Test\\\",\\\"child\\\":{}}\");\n        var parsed = JodaBeanSer.COMPACT.simpleJsonReader().read(json, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_primitiveTypeChanged() throws IOException {\n        var json = \"{\\\"a\\\":6,\\\"b\\\":5}\";\n        var parsed = JodaBeanSer.COMPACT.simpleJsonReader().read(json, ImmDoubleFloat.class);\n        assertThat(parsed.getA()).isCloseTo(6, offset(1e-10));\n        assertThat(parsed.getB()).isCloseTo(5, offset(1e-10));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_readWrite_boolean_true() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", Boolean.TRUE);\n        var json = JodaBeanSer.COMPACT.simpleJsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"{\\\"data\\\":true}\");\n        var parsed = JodaBeanSer.COMPACT.simpleJsonReader().read(new StringReader(json), FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_boolean_false() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", Boolean.FALSE);\n        var json = JodaBeanSer.COMPACT.simpleJsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"{\\\"data\\\":false}\");\n        var parsed = JodaBeanSer.COMPACT.simpleJsonReader().read(new StringReader(json), FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-------------------------------------------------------------------------\n    @Test\n    void test_write_doubleObject() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", (double) 6);\n        var json = JodaBeanSer.COMPACT.simpleJsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"data\":6.0}\"\"\");\n    }\n\n    @Test\n    void test_write_doubleObject_NaN() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", Double.NaN);\n        var json = JodaBeanSer.COMPACT.simpleJsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"data\":\"NaN\"}\"\"\");\n    }\n\n    @Test\n    void test_write_doubleObject_NaN_compatible() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", Double.NaN);\n        var json = JodaBeanSer.COMPACT.withJsonNumberFormat(JodaBeanJsonNumberFormat.COMPATIBLE_V2).simpleJsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"data\":null}\"\"\");\n    }\n\n    @Test\n    void test_write_doubleObject_PositiveInfinity() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", Double.POSITIVE_INFINITY);\n        var json = JodaBeanSer.COMPACT.simpleJsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"data\":\"Infinity\"}\"\"\");\n    }\n\n    @Test\n    void test_write_doubleObject_NegativeInfinity() {\n        var bean = new FlexiBean();\n        bean.set(\"data\", Double.NEGATIVE_INFINITY);\n        var json = JodaBeanSer.COMPACT.simpleJsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"data\":\"-Infinity\"}\"\"\");\n    }\n\n    @Test\n    void test_readWrite_double_NaN() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.NaN);\n        var json = JodaBeanSer.COMPACT.simpleJsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"valueLong\":0,\"valueInt\":0,\"valueShort\":0,\"valueByte\":0,\\\n                \"valueDouble\":\"NaN\",\"valueFloat\":0.0,\"valueChar\":\"\\\\u0000\",\"valueBoolean\":false}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json, PrimitiveBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_double_NaN_compatible() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.NaN);\n        var json = JodaBeanSer.COMPACT.withJsonNumberFormat(JodaBeanJsonNumberFormat.COMPATIBLE_V2).simpleJsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"valueLong\":0,\"valueInt\":0,\"valueShort\":0,\"valueByte\":0,\\\n                \"valueDouble\":null,\"valueFloat\":0.0,\"valueChar\":\"\\\\u0000\",\"valueBoolean\":false}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json, PrimitiveBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_double_NaN_literal() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.NaN);\n        var json = JodaBeanSer.COMPACT.withJsonNumberFormat(JodaBeanJsonNumberFormat.LITERAL).simpleJsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"valueLong\":0,\"valueInt\":0,\"valueShort\":0,\"valueByte\":0,\\\n                \"valueDouble\":NaN,\"valueFloat\":0.0,\"valueChar\":\"\\\\u0000\",\"valueBoolean\":false}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json, PrimitiveBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_double_PositiveInfinity_string() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.POSITIVE_INFINITY);\n        var json = JodaBeanSer.COMPACT.simpleJsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"valueLong\":0,\"valueInt\":0,\"valueShort\":0,\"valueByte\":0,\\\n                \"valueDouble\":\"Infinity\",\"valueFloat\":0.0,\"valueChar\":\"\\\\u0000\",\"valueBoolean\":false}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json, PrimitiveBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_double_PositiveInfinity_literal() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.POSITIVE_INFINITY);\n        var json = JodaBeanSer.COMPACT.withJsonNumberFormat(JodaBeanJsonNumberFormat.LITERAL).simpleJsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"valueLong\":0,\"valueInt\":0,\"valueShort\":0,\"valueByte\":0,\\\n                \"valueDouble\":Infinity,\"valueFloat\":0.0,\"valueChar\":\"\\\\u0000\",\"valueBoolean\":false}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json, PrimitiveBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_double_PositiveInfinity_literal() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.POSITIVE_INFINITY);\n        var json = \"\"\"\n                {\"valueLong\":0,\"valueInt\":0,\"valueShort\":0,\"valueByte\":0,\\\n                \"valueDouble\":+Infinity,\"valueFloat\":0.0,\"valueChar\":\"\\\\u0000\",\"valueBoolean\":false}\"\"\";\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json, PrimitiveBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_double_NegativeInfinity_string() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.NEGATIVE_INFINITY);\n        var json = JodaBeanSer.COMPACT.simpleJsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"valueLong\":0,\"valueInt\":0,\"valueShort\":0,\"valueByte\":0,\\\n                \"valueDouble\":\"-Infinity\",\"valueFloat\":0.0,\"valueChar\":\"\\\\u0000\",\"valueBoolean\":false}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json, PrimitiveBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_double_NegativeInfinity_literal() {\n        var bean = new PrimitiveBean();\n        bean.setValueDouble(Double.NEGATIVE_INFINITY);\n        var json = JodaBeanSer.COMPACT.withJsonNumberFormat(JodaBeanJsonNumberFormat.LITERAL).simpleJsonWriter().write(bean);\n        assertThat(json).isEqualTo(\"\"\"\n                {\"valueLong\":0,\"valueInt\":0,\"valueShort\":0,\"valueByte\":0,\\\n                \"valueDouble\":-Infinity,\"valueFloat\":0.0,\"valueChar\":\"\\\\u0000\",\"valueBoolean\":false}\"\"\");\n        var parsed = JodaBeanSer.COMPACT.jsonReader().read(json, PrimitiveBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_read_emptyFlexiBean() {\n        var parsed = JodaBeanSer.COMPACT.simpleJsonReader().read(\"{}\", FlexiBean.class);\n        BeanAssert.assertBeanEquals(new FlexiBean(), parsed);\n    }\n\n    @Test\n    void test_read_rootTypeArgumentIncorrect() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.simpleJsonReader().read(\"{}\", Integer.class));\n    }\n\n    @Test\n    void test_write_nullKeyInMap() {\n        var address = new Address();\n        var bean = new Person();\n        bean.getOtherAddressMap().put(null, address);\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.simpleJsonWriter().write(bean));\n    }\n\n    //-----------------------------------------------------------------------\n    static Object[][] data_badFormat() {\n        return new Object[][] {\n                {\"{,}\"},\n                {\"{1,2}\"},\n                {\"{\\\"a\\\",6}\"},\n                {\"{\\\"a\\\":[}}\"},\n        };\n    }\n\n    @ParameterizedTest\n    @MethodSource(\"data_badFormat\")\n    void test_badFormat(String text) throws IOException {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.simpleJsonReader().read(text, FlexiBean.class));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_writer_nullSettings() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanSimpleJsonWriter(null));\n    }\n\n    @Test\n    void test_writer_write1_nullBean() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanSimpleJsonWriter(JodaBeanSer.PRETTY).write(null));\n    }\n\n    @Test\n    void test_writer_write2_nullBean() throws IOException {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanSimpleJsonWriter(JodaBeanSer.PRETTY).write(null, new StringBuilder()));\n    }\n\n    @Test\n    void test_writer_write2_nullAppendable() throws IOException {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanSimpleJsonWriter(JodaBeanSer.PRETTY).write(new FlexiBean(), null));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_reader_nullSettings() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanSimpleJsonReader(null));\n    }\n\n    @Test\n    void test_reader_readReader_null() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanSimpleJsonReader(JodaBeanSer.PRETTY).read((Reader) null, FlexiBean.class));\n    }\n\n    @Test\n    void test_reader_readString_null() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanSimpleJsonReader(JodaBeanSer.PRETTY).read((String) null, FlexiBean.class));\n    }\n\n    @Test\n    void test_reader_readReaderType_nullReader() throws IOException {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanSimpleJsonReader(JodaBeanSer.PRETTY).read((Reader) null, Bean.class));\n    }\n\n    @Test\n    void test_reader_readReaderType_nullType() throws IOException {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanSimpleJsonReader(JodaBeanSer.PRETTY).read(new StringReader(\"\"), null));\n    }\n\n    @Test\n    void test_reader_readStringType_nullString() throws IOException {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanSimpleJsonReader(JodaBeanSer.PRETTY).read((String) null, Bean.class));\n    }\n\n    @Test\n    void test_reader_readStringType_nullType() throws IOException {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanSimpleJsonReader(JodaBeanSer.PRETTY).read(\"\", null));\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/lowerCase.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser;\n\n/**\n * Mock class with a silly name.\n */\nclass lowerCase {\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/map/TestSerializeSimpleMap.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.map;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;\nimport static org.assertj.core.api.Assertions.entry;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.joda.beans.impl.flexi.FlexiBean;\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.ImmGuava;\nimport org.joda.beans.sample.ImmOptional;\nimport org.joda.beans.sample.Person;\nimport org.joda.beans.sample.SimpleJson;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerTestHelper;\nimport org.joda.beans.test.BeanAssert;\nimport org.junit.jupiter.api.Test;\n\nimport com.google.common.collect.ImmutableMap;\n\n/**\n * Test property roundtrip using a map-structure.\n */\nclass TestSerializeSimpleMap {\n\n    @Test\n    void test_writeSimpleJson() {\n        SimpleJson bean = SerTestHelper.testSimpleJson();\n        Map<String, Object> map = JodaBeanSer.PRETTY.simpleMapWriter().write(bean);\n//        System.out.println(map);\n\n        SimpleJson parsed = JodaBeanSer.PRETTY.simpleMapReader().read(map, SimpleJson.class);\n//        System.out.println(bean);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeImmOptional() {\n        ImmOptional bean = SerTestHelper.testImmOptional();\n        Map<String, Object> map = JodaBeanSer.PRETTY.withIncludeDerived(true).simpleMapWriter().write(bean);\n//        System.out.println(map);\n\n        ImmOptional parsed = JodaBeanSer.PRETTY.simpleMapReader().read(map, ImmOptional.class);\n//        System.out.println(bean);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeCollections() {\n        ImmGuava<String> bean = SerTestHelper.testCollections(false);\n        Map<String, Object> map = JodaBeanSer.PRETTY.simpleMapWriter().write(bean);\n//        System.out.println(map);\n\n        @SuppressWarnings(\"unchecked\")\n        ImmGuava<String> parsed = JodaBeanSer.PRETTY.simpleMapReader().read(map, ImmGuava.class);\n//        System.out.println(bean);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_readWriteBeanEmptyChild() {\n        FlexiBean bean = new FlexiBean();\n        bean.set(\"element\", \"Test\");\n        bean.set(\"child\", new HashMap<String, String>());\n        Map<String, Object> map = JodaBeanSer.PRETTY.simpleMapWriter().write(bean);\n        assertThat(map).containsOnly(entry(\"element\", \"Test\"), entry(\"child\", ImmutableMap.of()));\n        FlexiBean parsed = JodaBeanSer.PRETTY.simpleMapReader().read(map, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_readWrite_boolean_true() {\n        FlexiBean bean = new FlexiBean();\n        bean.set(\"data\", Boolean.TRUE);\n        Map<String, Object> map = JodaBeanSer.COMPACT.simpleMapWriter().write(bean);\n        assertThat(map).containsOnly(entry(\"data\", Boolean.TRUE));\n        FlexiBean parsed = JodaBeanSer.COMPACT.simpleMapReader().read(map, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWrite_boolean_false() {\n        FlexiBean bean = new FlexiBean();\n        bean.set(\"data\", Boolean.FALSE);\n        Map<String, Object> map = JodaBeanSer.COMPACT.simpleMapWriter().write(bean);\n        assertThat(map).containsOnly(entry(\"data\", Boolean.FALSE));\n        FlexiBean parsed = JodaBeanSer.COMPACT.simpleMapReader().read(map, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_read_emptyFlexiBean() {\n        FlexiBean parsed = JodaBeanSer.COMPACT.simpleMapReader().read(new HashMap<>(), FlexiBean.class);\n        BeanAssert.assertBeanEquals(new FlexiBean(), parsed);\n    }\n\n    @Test\n    void test_read_rootTypeArgumentIncorrect() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.simpleMapReader().read(new HashMap<>(), Integer.class));\n    }\n\n    @Test\n    void test_write_nullKeyInMap() {\n        Address address = new Address();\n        Person bean = new Person();\n        bean.getOtherAddressMap().put(null, address);\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.simpleMapWriter().write(bean));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_writer_nullSettings() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanSimpleMapWriter(null));\n    }\n\n    @Test\n    void test_writer_write_nullBean() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanSimpleMapWriter(JodaBeanSer.PRETTY).write(null));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_reader_nullSettings() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanSimpleMapReader(null));\n    }\n\n    @Test\n    void test_reader_read_nullBean() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanSimpleMapReader(JodaBeanSer.PRETTY).read(null, FlexiBean.class));\n    }\n\n    @Test\n    void test_reader_read_nullType() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> new JodaBeanSimpleMapReader(JodaBeanSer.PRETTY).read(new HashMap<>(), null));\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/xml/MockRenameDeserializer.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.xml;\n\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.ser.DefaultDeserializer;\nimport org.joda.beans.ser.SerDeserializer;\n\n/**\n * Mock deserializer that handles a renamed property.\n */\nclass MockRenameDeserializer extends DefaultDeserializer {\n\n    /**\n     * Singleton.\n     */\n    static final SerDeserializer INSTANCE = new MockRenameDeserializer();\n\n    /**\n     * Creates an instance.\n     */\n    protected MockRenameDeserializer() {\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MetaProperty<?> findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName) {\n        if (\"firstName\".equals(propertyName)) {\n            return metaBean.metaProperty(\"forename\");\n        }\n        return super.findMetaProperty(beanType, metaBean, propertyName);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/xml/MockSemanticChangeDeserializer.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.xml;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.impl.BufferingBeanBuilder;\nimport org.joda.beans.sample.SimplePerson;\nimport org.joda.beans.ser.DefaultDeserializer;\nimport org.joda.beans.ser.SerDeserializer;\n\n/**\n * Mock deserializer that handles a semantic change.\n */\nclass MockSemanticChangeDeserializer extends DefaultDeserializer {\n\n    /**\n     * Singleton.\n     */\n    static final SerDeserializer INSTANCE = new MockSemanticChangeDeserializer();\n\n    /**\n     * Creates an instance.\n     */\n    protected MockSemanticChangeDeserializer() {\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public BeanBuilder<?> createBuilder(Class<?> beanType, MetaBean metaBean) {\n        return BufferingBeanBuilder.of(metaBean);\n    }\n\n    @Override\n    public Object build(Class<?> beanType, BeanBuilder<?> builder) {\n        BufferingBeanBuilder<?> bld = (BufferingBeanBuilder<?>) builder;\n        if (\"Stephen\".equals(bld.getBuffer().get(SimplePerson.meta().forename())) &&\n                \"Colebourne\".equals(bld.getBuffer().get(SimplePerson.meta().surname()))) {\n            bld.set(SimplePerson.meta().forename(), \"Steve\");\n        }\n        return bld.build();\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/xml/MockTypeChangeDeserializer.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.xml;\n\nimport org.joda.beans.BeanBuilder;\nimport org.joda.beans.MetaBean;\nimport org.joda.beans.MetaProperty;\nimport org.joda.beans.impl.StandaloneMetaProperty;\nimport org.joda.beans.sample.SimplePerson;\nimport org.joda.beans.ser.DefaultDeserializer;\nimport org.joda.beans.ser.SerDeserializer;\n\n/**\n * Mock deserializer that handles a renamed property.\n */\nclass MockTypeChangeDeserializer extends DefaultDeserializer {\n\n    /**\n     * Singleton.\n     */\n    static final SerDeserializer INSTANCE = new MockTypeChangeDeserializer();\n\n    /**\n     * The number of cars String property.\n     */\n    private MetaProperty<String> NUMBER_OF_CARS_STRING = StandaloneMetaProperty.of(\"numberOfCars\", SimplePerson.meta(), String.class);\n\n    /**\n     * Creates an instance.\n     */\n    protected MockTypeChangeDeserializer() {\n    }\n\n    //-----------------------------------------------------------------------\n    @Override\n    public MetaProperty<?> findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName) {\n        if (\"numberOfCars\".equals(propertyName)) {\n            return NUMBER_OF_CARS_STRING;\n        }\n        return super.findMetaProperty(beanType, metaBean, propertyName);\n    }\n\n    @Override\n    public void setValue(BeanBuilder<?> builder, MetaProperty<?> metaProp, Object value) {\n        Object valueToSet = value;\n        if (metaProp == NUMBER_OF_CARS_STRING && value != null) {\n            String oldValue = value.toString();\n            if (oldValue.equals(\"None\")) {\n                valueToSet = 0;\n            } else if (oldValue.equals(\"One\")) {\n                valueToSet = 1;\n            } else if (oldValue.equals(\"Two\")) {\n                valueToSet = 2;\n            } else if (oldValue.equals(\"Lots\")) {\n                valueToSet = 3;\n            }\n        }\n        super.setValue(builder, metaProp, valueToSet);\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/xml/TestDeserializeXml.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.xml;\n\nimport static org.assertj.core.api.Assertions.assertThatRuntimeException;\n\nimport org.joda.beans.impl.flexi.FlexiBean;\nimport org.joda.beans.sample.SimplePerson;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerDeserializers;\nimport org.joda.beans.test.BeanAssert;\nimport org.joda.convert.RenameHandler;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test deserialization using XML.\n */\nclass TestDeserializeXml {\n\n    @Test\n    void test_read_renamedType() {\n        String xml = \"<bean type=\\\"org.jodabeans.FlexibleBean\\\"><surname>Smith</surname></bean>\";\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.xmlReader().read(xml, FlexiBean.class));\n        RenameHandler.INSTANCE.renamedType(\"org.jodabeans.FlexibleBean\", FlexiBean.class);\n        FlexiBean parsed = JodaBeanSer.COMPACT.xmlReader().read(xml, FlexiBean.class);\n        FlexiBean expected = new FlexiBean();\n        expected.set(\"surname\", \"Smith\");\n        BeanAssert.assertBeanEquals(expected, parsed);\n    }\n\n    @Test\n    void test_read_renamedTypeLower() {\n        String xml = \"<bean>\" +\n                \"<extra type=\\\"org.jodabeans.SPerson\\\"><surname>Smith</surname></extra>\" +\n                \"<person type=\\\"SPerson\\\"><surname>Jones</surname></person>\" +\n                \"</bean>\";\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.xmlReader().read(xml, FlexiBean.class));\n        RenameHandler.INSTANCE.renamedType(\"org.jodabeans.SPerson\", SimplePerson.class);\n        FlexiBean parsed = JodaBeanSer.COMPACT.xmlReader().read(xml, FlexiBean.class);\n        FlexiBean expected = new FlexiBean();\n        SimplePerson person1 = new SimplePerson();\n        person1.setSurname(\"Smith\");\n        SimplePerson person2 = new SimplePerson();\n        person2.setSurname(\"Jones\");\n        expected.set(\"extra\", person1);\n        expected.set(\"person\", person2);\n        BeanAssert.assertBeanEquals(expected, parsed);\n    }\n\n    @Test\n    void test_read_withSemanticChangeDeserializer() {\n        SerDeserializers desers = new SerDeserializers();\n        desers.register(SimplePerson.class, MockSemanticChangeDeserializer.INSTANCE);\n        String xml = \"<bean>\" +\n                \"<person1 type=\\\"org.joda.beans.sample.SimplePerson\\\"><forename>John</forename><surname>Smith</surname></person1>\" +\n                \"<person2 type=\\\"org.joda.beans.sample.SimplePerson\\\"><forename>Stephen</forename><surname>Colebourne</surname></person2>\" +\n                \"</bean>\";\n        FlexiBean parsed = JodaBeanSer.COMPACT.withDeserializers(desers).xmlReader().read(xml, FlexiBean.class);\n        FlexiBean expected = new FlexiBean();\n        SimplePerson person1 = new SimplePerson();\n        person1.setForename(\"John\");\n        person1.setSurname(\"Smith\");\n        SimplePerson person2 = new SimplePerson();\n        person2.setForename(\"Steve\");  // changed\n        person2.setSurname(\"Colebourne\");\n        expected.set(\"person1\", person1);\n        expected.set(\"person2\", person2);\n        BeanAssert.assertBeanEquals(expected, parsed);\n    }\n\n    @Test\n    void test_read_withRenameDeserializer() {\n        SerDeserializers desers = new SerDeserializers();\n        desers.register(SimplePerson.class, MockRenameDeserializer.INSTANCE);\n        String xml = \"<bean>\" +\n                \"<person1 type=\\\"org.joda.beans.sample.SimplePerson\\\"><firstName>John</firstName><surname>Smith</surname></person1>\" +\n                \"<person2 type=\\\"org.joda.beans.sample.SimplePerson\\\"><firstName>Stephen</firstName><surname>Colebourne</surname></person2>\" +\n                \"</bean>\";\n        FlexiBean parsed = JodaBeanSer.COMPACT.withDeserializers(desers).xmlReader().read(xml, FlexiBean.class);\n        FlexiBean expected = new FlexiBean();\n        SimplePerson person1 = new SimplePerson();\n        person1.setForename(\"John\");\n        person1.setSurname(\"Smith\");\n        SimplePerson person2 = new SimplePerson();\n        person2.setForename(\"Stephen\");\n        person2.setSurname(\"Colebourne\");\n        expected.set(\"person1\", person1);\n        expected.set(\"person2\", person2);\n        BeanAssert.assertBeanEquals(expected, parsed);\n    }\n\n    @Test\n    void test_read_withTypeChangeDeserializer() {\n        SerDeserializers desers = new SerDeserializers();\n        desers.register(SimplePerson.class, MockTypeChangeDeserializer.INSTANCE);\n        String xml = \"<bean>\" +\n                \"<person1 type=\\\"org.joda.beans.sample.SimplePerson\\\"><numberOfCars>None</numberOfCars><surname>Smith</surname></person1>\" +\n                \"<person2 type=\\\"org.joda.beans.sample.SimplePerson\\\"><numberOfCars>Two</numberOfCars><surname>Colebourne</surname></person2>\" +\n                \"</bean>\";\n        FlexiBean parsed = JodaBeanSer.COMPACT.withDeserializers(desers).xmlReader().read(xml, FlexiBean.class);\n        FlexiBean expected = new FlexiBean();\n        SimplePerson person1 = new SimplePerson();\n        person1.setNumberOfCars(0);\n        person1.setSurname(\"Smith\");\n        SimplePerson person2 = new SimplePerson();\n        person2.setNumberOfCars(2);\n        person2.setSurname(\"Colebourne\");\n        expected.set(\"person1\", person1);\n        expected.set(\"person2\", person2);\n        BeanAssert.assertBeanEquals(expected, parsed);\n    }\n\n    @Test\n    void test_read_withBadEntity() {\n        SerDeserializers desers = new SerDeserializers();\n        desers.register(SimplePerson.class, MockTypeChangeDeserializer.INSTANCE);\n        String xml = \"<?xml version=\\\"1.0\\\" encoding =\\\"UTF-8\\\"?>\" +\n                \"<!DOCTYPE foobar[<!ENTITY x100 \\\"foobar\\\">\";\n        for (int i = 99; i > 0; i--) {\n            xml += \"<!ENTITY  x\" + i + \" \\\"&x\" + (i + 1) + \";&x\" + (i + 1) + \";\\\">\";\n        }\n        xml += \"]><bean>\" +\n                \"<person1 type=\\\"org.joda.beans.sample.SimplePerson\\\"><numberOfCars>None</numberOfCars><surname>Smith &x1;</surname></person1>\" +\n                \"<person2 type=\\\"org.joda.beans.sample.SimplePerson\\\"><numberOfCars>Two</numberOfCars><surname>Colebourne</surname></person2>\" +\n                \"</bean>\";\n        String finalXml = xml;\n        assertThatRuntimeException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.withDeserializers(desers).xmlReader().read(finalXml, FlexiBean.class));\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/ser/xml/TestSerializeXml.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.ser.xml;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;\nimport static org.assertj.core.api.Assertions.offset;\n\nimport java.io.CharArrayWriter;\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\n\nimport org.joda.beans.Bean;\nimport org.joda.beans.impl.flexi.FlexiBean;\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.ImmAddress;\nimport org.joda.beans.sample.ImmDoubleFloat;\nimport org.joda.beans.sample.ImmEmpty;\nimport org.joda.beans.sample.ImmGenericCollections;\nimport org.joda.beans.sample.ImmKey;\nimport org.joda.beans.sample.ImmMappedKey;\nimport org.joda.beans.sample.ImmOptional;\nimport org.joda.beans.sample.ImmPerson;\nimport org.joda.beans.sample.JodaConvertBean;\nimport org.joda.beans.sample.JodaConvertInterface;\nimport org.joda.beans.sample.JodaConvertWrapper;\nimport org.joda.beans.sample.Person;\nimport org.joda.beans.sample.SimpleName;\nimport org.joda.beans.sample.SimplePerson;\nimport org.joda.beans.ser.JodaBeanSer;\nimport org.joda.beans.ser.SerDeserializers;\nimport org.joda.beans.ser.SerTestHelper;\nimport org.joda.beans.test.BeanAssert;\nimport org.junit.jupiter.api.Test;\n\nimport com.google.common.collect.ImmutableMap;\nimport com.google.common.io.Resources;\n\n/**\n * Test property roundtrip using XML.\n */\nclass TestSerializeXml {\n\n    @Test\n    void test_writeAddress() throws IOException {\n        var bean = SerTestHelper.testAddress();\n        var xml = JodaBeanSer.PRETTY.xmlWriter().write(bean);\n//        System.out.println(xml);\n        assertEqualsSerialization(xml, \"/org/joda/beans/ser/Address.xml\");\n\n        var parsed = (Address) JodaBeanSer.PRETTY.xmlReader().read(xml);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeToAppendable() throws IOException {\n        var bean = SerTestHelper.testAddress();\n        var output = new CharArrayWriter();\n        JodaBeanSer.PRETTY.xmlWriter().write(bean, output);\n        var xml = output.toString();\n\n        var parsed = (Address) JodaBeanSer.PRETTY.xmlReader().read(xml);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeImmAddress() throws IOException {\n        var bean = SerTestHelper.testImmAddress(false);\n        var xml = JodaBeanSer.PRETTY.xmlWriter().write(bean);\n//        System.out.println(xml);\n        assertEqualsSerialization(xml, \"/org/joda/beans/ser/ImmAddress.xml\");\n\n        xml = xml.replace(\"185\", \"18<!-- comment -->5\");\n\n        var parsed = (ImmAddress) JodaBeanSer.PRETTY.xmlReader().read(xml);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeImmOptional() throws IOException {\n        var bean = SerTestHelper.testImmOptional();\n        var xml = JodaBeanSer.PRETTY.withIncludeDerived(true).xmlWriter().write(bean);\n//        System.out.println(xml);\n        assertEqualsSerialization(xml, \"/org/joda/beans/ser/ImmOptional.xml\");\n\n        var parsed = (ImmOptional) JodaBeanSer.PRETTY.xmlReader().read(xml);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeCollections() throws IOException {\n        var bean = SerTestHelper.testCollections(true);\n        var xml = JodaBeanSer.PRETTY.xmlWriter().write(bean);\n//        System.out.println(xml);\n        assertEqualsSerialization(xml, \"/org/joda/beans/ser/Collections.xml\");\n\n        var parsed = JodaBeanSer.PRETTY.xmlReader().read(xml);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_writeJodaConvertInterface() {\n        var bean = SerTestHelper.testGenericInterfaces();\n\n        var xml = JodaBeanSer.PRETTY.xmlWriter().write(bean);\n//        System.out.println(xml);\n\n        @SuppressWarnings(\"unchecked\")\n        var parsed = (ImmGenericCollections<JodaConvertInterface>) JodaBeanSer.COMPACT.xmlReader().read(xml);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    private void assertEqualsSerialization(String xml, String expectedResource) throws IOException {\n        var url = TestSerializeXml.class.getResource(expectedResource);\n        var expected = Resources.asCharSource(url, StandardCharsets.UTF_8).read();\n        assertThat(xml.trim().replace(System.lineSeparator(), \"\\n\"))\n                .isEqualTo(expected.trim().replace(System.lineSeparator(), \"\\n\"));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_readWriteBeanEmptyChild_pretty() {\n        var bean = new FlexiBean();\n        bean.set(\"element\", \"Test\");\n        bean.set(\"child\", ImmEmpty.builder().build());\n        var xml = JodaBeanSer.PRETTY.xmlWriter().write(bean);\n        assertThat(xml)\n                .isEqualTo(\"\"\"\n                    <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n                    <bean type=\"org.joda.beans.impl.flexi.FlexiBean\">\n                     <element>Test</element>\n                     <child type=\"org.joda.beans.sample.ImmEmpty\"/>\n                    </bean>\n                    \"\"\");\n        var parsed = JodaBeanSer.PRETTY.xmlReader().read(xml, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWriteBeanEmptyChild_compact() {\n        var bean = new FlexiBean();\n        bean.set(\"element\", \"Test\");\n        bean.set(\"child\", ImmEmpty.builder().build());\n        var xml = JodaBeanSer.COMPACT.xmlWriter().write(bean);\n        assertThat(xml)\n                .isEqualTo(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\" +\n                        \"<bean type=\\\"org.joda.beans.impl.flexi.FlexiBean\\\">\" +\n                        \"<element>Test</element><child type=\\\"org.joda.beans.sample.ImmEmpty\\\"/></bean>\");\n        var parsed = JodaBeanSer.COMPACT.xmlReader().read(xml, FlexiBean.class);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWriteJodaConvertWrapper() {\n        var wrapper = new JodaConvertWrapper();\n        var bean = new JodaConvertBean(\"Hello:9\");\n        wrapper.setBean(bean);\n        wrapper.setDescription(\"Weird\");\n        var xml = JodaBeanSer.COMPACT.xmlWriter().write(wrapper);\n        assertThat(xml)\n                .isEqualTo(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\" +\n                        \"<bean type=\\\"org.joda.beans.sample.JodaConvertWrapper\\\">\" +\n                        \"<bean>Hello:9</bean><description>Weird</description></bean>\");\n        var parsed = JodaBeanSer.COMPACT.xmlReader().read(xml);\n        BeanAssert.assertBeanEquals(wrapper, parsed);\n    }\n\n    @Test\n    void test_readWriteJodaConvertBean() {\n        var bean = new JodaConvertBean(\"Hello:9\");\n        var xml = JodaBeanSer.COMPACT.xmlWriter().write(bean);\n        assertThat(xml)\n                .isEqualTo(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\" +\n                        \"<bean type=\\\"org.joda.beans.sample.JodaConvertBean\\\">\" +\n                        \"<base>Hello</base><extra>9</extra></bean>\");\n        var parsed = JodaBeanSer.COMPACT.xmlReader().read(xml);\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_primitiveTypeChanged() throws IOException {\n        var xml = \"<bean><a>6</a><b>5</b></bean>\";\n        var parsed = JodaBeanSer.COMPACT.xmlReader().read(xml, ImmDoubleFloat.class);\n        assertThat(parsed.getA()).isCloseTo(6, offset(1e-10));\n        assertThat(parsed.getB()).isCloseTo(5, offset(1e-10));\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_read_nonStandard_JodaConvertWrapper_expanded() {\n        var xml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\" +\n                \"<bean type=\\\"org.joda.beans.sample.JodaConvertWrapper\\\">\" +\n                \"<bean><base>Hello</base><extra>9</extra></bean><description>Weird</description></bean>\";\n        var parsed = JodaBeanSer.COMPACT.xmlReader().read(xml);\n        var wrapper = new JodaConvertWrapper();\n        var bean = new JodaConvertBean(\"Hello:9\");\n        wrapper.setBean(bean);\n        wrapper.setDescription(\"Weird\");\n        BeanAssert.assertBeanEquals(wrapper, parsed);\n    }\n\n    @Test\n    void test_read_nonStandard_JodaConvertBean_flattened() {\n        var xml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\" +\n                \"<bean type=\\\"org.joda.beans.sample.JodaConvertBean\\\">Hello:9</bean>\";\n        var parsed = JodaBeanSer.COMPACT.xmlReader().read(xml);\n        var bean = new JodaConvertBean(\"Hello:9\");\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_nonStandard_withCommentBeanRoot() {\n        var xml = \"<bean><!-- comment --><element>Test</element></bean>\";\n        var parsed = JodaBeanSer.COMPACT.xmlReader().read(xml, FlexiBean.class);\n        var bean = new FlexiBean();\n        bean.set(\"element\", \"Test\");\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_nonStandard_withCommentInProperty() {\n        var xml = \"<bean><element><!-- comment -->Test</element></bean>\";\n        var parsed = JodaBeanSer.COMPACT.xmlReader().read(xml, FlexiBean.class);\n        var bean = new FlexiBean();\n        bean.set(\"element\", \"Test\");\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_read_aliased() {\n        var xml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\" +\n                \"<bean type=\\\"org.joda.beans.sample.SimpleName\\\">\" +\n                \"<firstName>A</firstName><givenName>B</givenName></bean>\";\n        var parsed = JodaBeanSer.COMPACT.xmlReader().read(xml);\n        var bean = new SimpleName();\n        bean.setForename(\"A\");\n        bean.setSurname(\"B\");\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_readWriteInterfaceKeyMap() {\n        var key1 = ImmKey.builder().name(\"Alpha\").build();\n        var person1 = ImmPerson.builder().forename(\"Bob\").surname(\"Builder\").build();\n        var key2 = ImmKey.builder().name(\"Beta\").build();\n        var person2 = ImmPerson.builder().forename(\"Dana\").surname(\"Dash\").build();\n        var mapped = ImmMappedKey.builder().data(ImmutableMap.of(key1, person1, key2, person2)).build();\n        var xml = JodaBeanSer.PRETTY.xmlWriter().write(mapped);\n\n        var bean = (ImmMappedKey) JodaBeanSer.PRETTY.xmlReader().read(xml);\n        BeanAssert.assertBeanEquals(bean, mapped);\n    }\n\n    @Test\n    void test_read_badTypeInMap() {\n        var xml = \"<bean><element metatype=\\\"Map\\\"><entry><item>work</item>\" +\n                \"<item type=\\\"com.foo.UnknownEnum\\\">BIGWIG</item></entry></element></bean>\";\n        var parsed = JodaBeanSer.COMPACT.withDeserializers(SerDeserializers.LENIENT).xmlReader().read(xml, FlexiBean.class);\n        var bean = new FlexiBean();\n        bean.set(\"element\", ImmutableMap.of(\"work\", \"BIGWIG\"));  // converted to a string\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    @Test\n    void test_read_ignoreProperty() {\n        var xml = \"<bean><name>foo</name><wibble>ignored</wibble></bean>\";\n        var parsed = JodaBeanSer.COMPACT.withDeserializers(SerDeserializers.LENIENT).xmlReader().read(xml, ImmKey.class);\n        var bean = ImmKey.builder().name(\"foo\").build();\n        BeanAssert.assertBeanEquals(bean, parsed);\n    }\n\n    //-----------------------------------------------------------------------\n    @Test\n    void test_read_noBeanElementAtRoot() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.xmlReader().read(\"<foo></foo>\", Bean.class));\n    }\n\n    @Test\n    void test_read_noTypeAttributeAtRoot() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.xmlReader().read(\"<bean></bean>\", Bean.class));\n    }\n\n    @Test\n    void test_read_noTypeAttributeAtRootButTypeSpecified() {\n        FlexiBean parsed = JodaBeanSer.COMPACT.xmlReader().read(\"<bean></bean>\", FlexiBean.class);\n        BeanAssert.assertBeanEquals(new FlexiBean(), parsed);\n    }\n\n    @Test\n    void test_read_rootTypeAttributeNotBean() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.xmlReader()\n                        .read(\"<bean type=\\\"java.lang.Integer\\\"></bean>\", Bean.class));\n    }\n\n    @Test\n    void test_read_rootTypeInvalid() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.xmlReader()\n                        .read(\"<bean type=\\\"org.joda.beans.impl.flexi.FlexiBean\\\"></bean>\", SimplePerson.class));\n    }\n\n    @Test\n    void test_read_rootTypeArgumentInvalid() {\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.xmlReader().read(\"<bean></bean>\", Integer.class));\n    }\n\n    @Test\n    void test_write_nullKeyInMap() {\n        var address = new Address();\n        var bean = new Person();\n        bean.getOtherAddressMap().put(null, address);\n        assertThatIllegalArgumentException()\n                .isThrownBy(() -> JodaBeanSer.COMPACT.xmlWriter().write(bean));\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/org/joda/beans/test/TestBeanAssert.java",
    "content": "/*\r\n *  Copyright 2001-present Stephen Colebourne\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n *  you may not use this file except in compliance with the License.\r\n *  You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n *  See the License for the specific language governing permissions and\r\n *  limitations under the License.\r\n */\r\npackage org.joda.beans.test;\r\n\r\nimport static org.assertj.core.api.Assertions.assertThatExceptionOfType;\r\nimport static org.assertj.core.api.Assertions.assertThatNoException;\r\n\r\nimport org.joda.beans.sample.Address;\r\nimport org.joda.beans.sample.ImmTolerance;\r\nimport org.joda.beans.sample.Person;\r\nimport org.junit.jupiter.api.BeforeEach;\r\nimport org.junit.jupiter.api.Test;\r\n\r\n/**\r\n * Test {@link BeanAssert}.\r\n */\r\nclass TestBeanAssert {\r\n\r\n    private Person person1;\r\n    private Person person2;\r\n\r\n    @BeforeEach\r\n    void setUp() {\r\n        person1 = new Person();\r\n        person1.setForename(\"Vince\");\r\n        person1.setSurname(\"Cable\");\r\n        person1.setNumberOfCars(1);\r\n        person1.getAddressList().add(new Address());\r\n        person1.getAddressList().get(0).setNumber(12);\r\n        person1.getAddressList().get(0).setStreet(\"Play Street\");\r\n        person1.getAddressList().get(0).setCity(\"Toytown\");\r\n        person1.getAddressList().get(0).setOwner(new Person());\r\n        person1.getAddressList().get(0).getOwner().setForename(\"Nick\");\r\n        person1.getAddressList().get(0).getOwner().setSurname(\"Clegg\");\r\n        person1.setMainAddress(new Address());\r\n        person1.getMainAddress().setStreet(\"Party Road\");\r\n        person1.getMainAddress().setCity(\"Gamesville\");\r\n        person1.getMainAddress().setOwner(new Person());\r\n        person1.getMainAddress().getOwner().setForename(\"Simon\");\r\n        person1.getMainAddress().getOwner().setForename(\"Hughes\");\r\n        person1.getOtherAddressMap().put(\"Home\", new Address());\r\n        person1.getOtherAddressMap().get(\"Home\").setNumber(999);\r\n        person1.getOtherAddressMap().get(\"Home\").setStreet(\"Upper Lane\");\r\n        person1.getOtherAddressMap().get(\"Home\").setCity(\"Skyton\");\r\n\r\n        person2 = new Person();\r\n        person2.setForename(\"Vince\");\r\n        person2.setSurname(\"Cable\");\r\n        person2.setNumberOfCars(1);\r\n        person2.getAddressList().add(new Address());\r\n        person2.getAddressList().get(0).setNumber(12);\r\n        person2.getAddressList().get(0).setStreet(\"Play Street\");\r\n        person2.getAddressList().get(0).setCity(\"Toytown\");\r\n        person2.getAddressList().get(0).setOwner(new Person());\r\n        person2.getAddressList().get(0).getOwner().setForename(\"Nick\");\r\n        person2.getAddressList().get(0).getOwner().setSurname(\"Clegg\");\r\n        person2.setMainAddress(new Address());\r\n        person2.getMainAddress().setStreet(\"Party Road\");\r\n        person2.getMainAddress().setCity(\"Gamesville\");\r\n        person2.getMainAddress().setOwner(new Person());\r\n        person2.getMainAddress().getOwner().setForename(\"Simon\");\r\n        person2.getMainAddress().getOwner().setForename(\"Hughes\");\r\n        person2.getOtherAddressMap().put(\"Home\", new Address());\r\n        person2.getOtherAddressMap().get(\"Home\").setNumber(999);\r\n        person2.getOtherAddressMap().get(\"Home\").setStreet(\"Upper Lane\");\r\n        person2.getOtherAddressMap().get(\"Home\").setCity(\"Skyton\");\r\n    }\r\n\r\n    @Test\r\n    void test_same() {\r\n        BeanAssert.assertBeanEquals(person1, person1);\r\n    }\r\n\r\n    @Test\r\n    void test_equal() {\r\n        BeanAssert.assertBeanEquals(person1, person2);\r\n    }\r\n\r\n    @Test\r\n    void test_bean_oneField() {\r\n        person2.setForename(\"Bug1\");\r\n        assertThatExceptionOfType(BeanComparisonError.class)\r\n                .isThrownBy(() -> BeanAssert.assertBeanEquals(person1, person2))\r\n                .withMessage(\"\"\"\r\n                    Bean did not equal expected. Differences:\r\n                    .forename: Content differs, expected String <Vince> but was <Bug1>\"\"\");\r\n    }\r\n\r\n    @Test\r\n    void test_bean_twoFields() {\r\n        person2.setForename(\"Bug1\");\r\n        person2.setSurname(\"Bug2\");\r\n        assertThatExceptionOfType(BeanComparisonError.class)\r\n                .isThrownBy(() -> BeanAssert.assertBeanEquals(person1, person2))\r\n                .withMessage(\"\"\"\r\n                    Bean did not equal expected. Differences:\r\n                    .forename: Content differs, expected String <Vince> but was <Bug1>\r\n                    .surname: Content differs, expected String <Cable> but was <Bug2>\"\"\");\r\n    }\r\n\r\n    @Test\r\n    void test_bean_bug_embedded() {\r\n        person2.getAddressList().get(0).setNumber(234);\r\n        person2.getMainAddress().setCity(\"Bug3\");\r\n        assertThatExceptionOfType(BeanComparisonError.class)\r\n                .isThrownBy(() -> BeanAssert.assertBeanEquals(person1, person2))\r\n                .withMessage(\"\"\"\r\n                    Bean did not equal expected. Differences:\r\n                    .addressList[0].number: Content differs, expected Integer <12> but was <234>\r\n                    .mainAddress.city: Content differs, expected String <Gamesville> but was <Bug3>\"\"\");\r\n    }\r\n\r\n    @Test\r\n    void test_bean_sizes() {\r\n        Address address = new Address();\r\n        address.setCity(\"Nowhere\");\r\n        person2.getOtherAddressMap().put(\"Bug\", address);\r\n        person2.getAddressList().clear();\r\n        assertThatExceptionOfType(BeanComparisonError.class)\r\n                .isThrownBy(() -> BeanAssert.assertBeanEquals(person1, person2))\r\n                .withMessage(\"\"\"\r\n                    Bean did not equal expected. Differences:\r\n                    .addressList: List size differs, expected 1 but was 0\r\n                    .otherAddressMap: Map size differs, expected 1 but was 2\"\"\");\r\n    }\r\n\r\n    @Test\r\n    void test_bean_map() {\r\n        person2.getOtherAddressMap().get(\"Home\").setCity(\"Bug\");\r\n        person2.getOtherAddressMap().get(\"Home\").setOwner(new Person());\r\n        assertThatExceptionOfType(BeanComparisonError.class)\r\n                .isThrownBy(() -> BeanAssert.assertBeanEquals(person1, person2))\r\n                .withMessage(\"\"\"\r\n                    Bean did not equal expected. Differences:\r\n                    .otherAddressMap[Home].city: Content differs, expected String <Skyton> but was <Bug>\r\n                    .otherAddressMap[Home].owner: Expected null, but was \\\r\n                    Person <Person{forename=null, surname=null, numberOfCars=0, addre...>\"\"\");\r\n    }\r\n\r\n    @Test\r\n    void test_beanFullDetail_twoFields() {\r\n        person2.setForename(\"Bug1\");\r\n        person2.setSurname(\"Bug2\");\r\n        assertThatExceptionOfType(BeanComparisonError.class)\r\n                .isThrownBy(() -> BeanAssert.assertBeanEqualsFullDetail(person1, person2))\r\n                .withMessage(\"\"\"\r\n                    Bean did not equal expected. Differences:\r\n                    .forename: Content differs, expected String <Vince> but was <Bug1>\r\n                    .surname: Content differs, expected String <Cable> but was <Bug2>\"\"\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_bean_oneField_double() {\r\n        ImmTolerance t1 = ImmTolerance.builder().value(0.015d).build();\r\n        ImmTolerance t2 = ImmTolerance.builder().value(0.016d).build();\r\n        assertThatExceptionOfType(BeanComparisonError.class)\r\n                .isThrownBy(() -> BeanAssert.assertBeanEquals(t1, t2))\r\n                .withMessage(\"\"\"\r\n                    Bean did not equal expected. Differences:\r\n                    .value: Content differs, expected Double <0.015> but was <0.016>\"\"\");\r\n    }\r\n\r\n    @Test\r\n    void test_bean_oneField_double_withinToleranceUp() {\r\n        ImmTolerance t1 = ImmTolerance.builder().value(0.015d).build();\r\n        ImmTolerance t2 = ImmTolerance.builder().value(0.0151d).build();\r\n        assertThatNoException().isThrownBy(() -> BeanAssert.assertBeanEquals(t1, t2, 0.0002d));\r\n    }\r\n\r\n    @Test\r\n    void test_bean_oneField_double_withinToleranceDown() {\r\n        ImmTolerance t1 = ImmTolerance.builder().value(0.015d).build();\r\n        ImmTolerance t2 = ImmTolerance.builder().value(0.0149d).build();\r\n        assertThatNoException().isThrownBy(() -> BeanAssert.assertBeanEquals(t1, t2, 0.0002d));\r\n    }\r\n\r\n    @Test\r\n    void test_bean_oneField_double_notInTolerance() {\r\n        ImmTolerance t1 = ImmTolerance.builder().value(0.015d).build();\r\n        ImmTolerance t2 = ImmTolerance.builder().value(0.0153d).build();\r\n        assertThatExceptionOfType(BeanComparisonError.class)\r\n                .isThrownBy(() -> BeanAssert.assertBeanEquals(t1, t2, 0.0002d))\r\n                .withMessage(\"\"\"\r\n                    Bean did not equal expected. Differences:\r\n                    .value: Double values differ by more than allowed tolerance, expected Double <0.015> but was <0.0153>\"\"\");\r\n    }\r\n\r\n    //-----------------------------------------------------------------------\r\n    @Test\r\n    void test_bean_oneField_doubleArray() {\r\n        ImmTolerance t1 = ImmTolerance.builder().array(new double[] {0.015d, 0.015d}).build();\r\n        ImmTolerance t2 = ImmTolerance.builder().array(new double[] {0.015d, 0.016d}).build();\r\n        assertThatExceptionOfType(BeanComparisonError.class)\r\n                .isThrownBy(() -> BeanAssert.assertBeanEquals(t1, t2))\r\n                .withMessage(\"\"\"\r\n                    Bean did not equal expected. Differences:\r\n                    .array: Content differs, expected \\\r\n                    double[] <[0.015, 0.015]> but was <[0.015, 0.016]>\"\"\");\r\n    }\r\n\r\n    @Test\r\n    void test_bean_oneField_doubleArray_withinToleranceUp() {\r\n        ImmTolerance t1 = ImmTolerance.builder().array(new double[] {0.015d, 0.015d}).build();\r\n        ImmTolerance t2 = ImmTolerance.builder().array(new double[] {0.015d, 0.0151d}).build();\r\n        assertThatNoException().isThrownBy(() -> BeanAssert.assertBeanEquals(t1, t2, 0.0002d));\r\n    }\r\n\r\n    @Test\r\n    void test_bean_oneField_doubleArray_withinToleranceDown() {\r\n        ImmTolerance t1 = ImmTolerance.builder().array(new double[] {0.015d, 0.015d}).build();\r\n        ImmTolerance t2 = ImmTolerance.builder().array(new double[] {0.015d, 0.0149d}).build();\r\n        assertThatNoException().isThrownBy(() -> BeanAssert.assertBeanEquals(t1, t2, 0.0002d));\r\n    }\r\n\r\n    @Test\r\n    void test_bean_oneField_doubleArray_notInTolerance() {\r\n        ImmTolerance t1 = ImmTolerance.builder().array(new double[] {0.015d, 0.015d}).build();\r\n        ImmTolerance t2 = ImmTolerance.builder().array(new double[] {0.015d, 0.0153d}).build();\r\n        assertThatExceptionOfType(BeanComparisonError.class)\r\n                .isThrownBy(() -> BeanAssert.assertBeanEquals(t1, t2, 0.0002d))\r\n                .withMessage(\"\"\"\r\n                    Bean did not equal expected. Differences:\r\n                    .array: Double arrays differ by \\\r\n                    more than allowed tolerance, expected double[] <[0.015, 0.015]> but was <[0.015, 0.0153]>\"\"\");\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/test/java/org/joda/beans/test/TestCoverage.java",
    "content": "/*\n *  Copyright 2001-present Stephen Colebourne\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage org.joda.beans.test;\n\nimport static org.assertj.core.api.Assertions.assertThatNoException;\n\nimport org.joda.beans.sample.Address;\nimport org.joda.beans.sample.MutableBaseBean;\nimport org.joda.beans.sample.MutableDerivedBean;\nimport org.joda.beans.sample.Person;\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Test;\n\n/**\n * Test code coverage helper.\n */\nclass TestCoverage {\n\n    private Person person;\n    private MutableBaseBean mutableBase;\n    private MutableDerivedBean mutableDerived;\n\n    @BeforeEach\n    void setUp() {\n        person = new Person();\n        person.setForename(\"Vince\");\n        person.setSurname(\"Cable\");\n        person.setNumberOfCars(1);\n        person.getAddressList().add(new Address());\n        person.getAddressList().get(0).setNumber(12);\n        person.getAddressList().get(0).setStreet(\"Play Street\");\n        person.getAddressList().get(0).setCity(\"Toytown\");\n        person.getAddressList().get(0).setOwner(new Person());\n        person.getAddressList().get(0).getOwner().setForename(\"Nick\");\n        person.getAddressList().get(0).getOwner().setSurname(\"Clegg\");\n        person.setMainAddress(new Address());\n        person.getMainAddress().setStreet(\"Party Road\");\n        person.getMainAddress().setCity(\"Gamesville\");\n        person.getMainAddress().setOwner(new Person());\n        person.getMainAddress().getOwner().setForename(\"Simon\");\n        person.getMainAddress().getOwner().setForename(\"Hughes\");\n        person.getOtherAddressMap().put(\"Home\", new Address());\n        person.getOtherAddressMap().get(\"Home\").setNumber(999);\n        person.getOtherAddressMap().get(\"Home\").setStreet(\"Upper Lane\");\n        person.getOtherAddressMap().get(\"Home\").setCity(\"Skyton\");\n\n        mutableBase = MutableBaseBean.builder()\n                .baseBeanString(\"HopeNotHate\")\n                .build();\n\n        mutableDerived = (MutableDerivedBean) MutableDerivedBean.builder()\n                .baseBeanString(\"HopeNotHate\")\n                .build();\n    }\n\n    @Test\n    void test_coveragePerson() {\n        assertThatNoException().isThrownBy(() -> JodaBeanTests.coverMutableBean(person));\n    }\n\n    @Test\n    void test_coverageMutableBase() {\n        assertThatNoException().isThrownBy(() -> JodaBeanTests.coverMutableBean(mutableBase));\n    }\n\n    @Test\n    void test_coverageMutableDerived() {\n        assertThatNoException().isThrownBy(() -> JodaBeanTests.coverMutableBean(mutableDerived));\n    }\n\n}\n"
  },
  {
    "path": "src/test/resources/META-INF/org/joda/beans/JodaBeans.ini",
    "content": "# Test\n[deserializers]\norg.joda.beans.sample.ImmKey\norg.joda.beans.sample.ImmKeyHolder\norg.joda.beans.sample.Pair = org.joda.beans.sample.PairDeserializer\n"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/Address.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<bean type=\"org.joda.beans.sample.Address\">\n <number>251</number>\n <street>Big Road</street>\n <city>London &amp; Capital of the World &lt;!&gt;</city>\n <owner>\n  <forename>Etienne</forename>\n  <surname>Colebourne</surname>\n  <numberOfCars>0</numberOfCars>\n  <addressList>\n   <item>\n    <number>65432</number>\n    <street>Big Road</street>\n    <city>Bigton</city>\n   </item>\n   <item null=\"true\"/>\n   <item type=\"CompanyAddress\">\n    <number>185</number>\n    <street>Park Street</street>\n    <city>London</city>\n    <companyName>OpenGamma</companyName>\n   </item>\n  </addressList>\n  <otherAddressMap>\n   <entry key=\"other\" null=\"true\"/>\n   <entry key=\"work\" type=\"CompanyAddress\">\n    <number>185</number>\n    <street>Park Street</street>\n    <city>London</city>\n    <companyName>OpenGamma</companyName>\n   </entry>\n   <entry key=\"home\">\n    <number>65432</number>\n    <street>Big Road</street>\n    <city>Bigton</city>\n   </entry>\n  </otherAddressMap>\n  <addressesList>\n   <item>\n    <item>\n     <number>65432</number>\n     <street>Big Road</street>\n     <city>Bigton</city>\n    </item>\n    <item type=\"CompanyAddress\">\n     <number>185</number>\n     <street>Park Street</street>\n     <city>London</city>\n     <companyName>OpenGamma</companyName>\n    </item>\n   </item>\n  </addressesList>\n  <mainAddress type=\"CompanyAddress\">\n   <number>185</number>\n   <street>Park Street</street>\n   <city>London</city>\n   <companyName>OpenGamma</companyName>\n  </mainAddress>\n  <extensions>\n   <interests>joda</interests>\n   <conferenceCount type=\"Integer\">21</conferenceCount>\n   <quality type=\"Character\">B</quality>\n   <company type=\"Company\">\n    <companyName>OpenGamma</companyName>\n   </company>\n  </extensions>\n </owner>\n</bean>"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/Address1.packbinstr",
    "content": "arr (3)\n- int 3\n- str 'org.joda.beans.sample.'\n- @type Address\n  bean (4)\n  - str 'number'\n  - str 'street'\n  - str 'city'\n  - str 'owner'\n  - int 251\n  - str 'Big Road'\n  - str 'London & Capital of the World <!>'\n  - @type Person\n    bean (8)\n    - str 'forename'\n    - str 'surname'\n    - str 'numberOfCars'\n    - str 'addressList'\n    - str 'otherAddressMap'\n    - str 'addressesList'\n    - str 'mainAddress'\n    - str 'extensions'\n    - str 'Etienne'\n    - str 'Colebourne'\n    - int 0\n    - arr (3)\n      - arr (4)\n        - int 65432\n        - ref 5 'Big Road'\n        - str 'Bigton'\n        - null\n      - null\n      - @type CompanyAddress\n        bean (5)\n        - ref 1 'number'\n        - ref 2 'street'\n        - ref 3 'city'\n        - ref 4 'owner'\n        - str 'companyName'\n        - int 185\n        - str 'Park Street'\n        - str 'London'\n        - null\n        - str 'OpenGamma'\n    - map (3)\n      = str 'other'\n        null\n      = str 'work'\n        @typeref 2 CompanyAddress\n        arr (5)\n        - int 185\n        - ref 19 'Park Street'\n        - ref 20 'London'\n        - null\n        - ref 21 'OpenGamma'\n      = str 'home'\n        arr (4)\n        - int 65432\n        - ref 5 'Big Road'\n        - ref 17 'Bigton'\n        - null\n    - arr (1)\n      - arr (2)\n        - arr (4)\n          - int 65432\n          - ref 5 'Big Road'\n          - ref 17 'Bigton'\n          - null\n        - @typeref 2 CompanyAddress\n          arr (5)\n          - int 185\n          - ref 19 'Park Street'\n          - ref 20 'London'\n          - null\n          - ref 21 'OpenGamma'\n    - @typeref 2 CompanyAddress\n      arr (5)\n      - int 185\n      - ref 19 'Park Street'\n      - ref 20 'London'\n      - null\n      - ref 21 'OpenGamma'\n    - map (4)\n      = str 'interests'\n        str 'joda'\n      = str 'conferenceCount'\n        int 21\n      = str 'quality'\n        chr B\n      = str 'company'\n        @type Company\n        bean (1)\n        - ref 18 'companyName'\n        - ref 21 'OpenGamma'"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/Address2.binstr",
    "content": "arr (2)\n- int 1\n- map (5)\n  = ext type=32 'org.joda.beans.sample.Address' (bean)\n    nil\n  = str 'number'\n    int 251\n  = str 'street'\n    str 'Big Road'\n  = str 'city'\n    str 'London & Capital of the World <!>'\n  = str 'owner'\n    map (8)\n    = str 'forename'\n      str 'Etienne'\n    = str 'surname'\n      str 'Colebourne'\n    = str 'numberOfCars'\n      int 0\n    = str 'addressList'\n      arr (3)\n      - map (3)\n        = str 'number'\n          int 65432\n        = str 'street'\n          str 'Big Road'\n        = str 'city'\n          str 'Bigton'\n      - nil\n      - map (5)\n        = ext type=32 'CompanyAddress' (bean)\n          nil\n        = str 'number'\n          int 185\n        = str 'street'\n          str 'Park Street'\n        = str 'city'\n          str 'London'\n        = str 'companyName'\n          str 'OpenGamma'\n    = str 'otherAddressMap'\n      map (3)\n      = str 'other'\n        nil\n      = str 'work'\n        map (5)\n        = ext type=32 'CompanyAddress' (bean)\n          nil\n        = str 'number'\n          int 185\n        = str 'street'\n          str 'Park Street'\n        = str 'city'\n          str 'London'\n        = str 'companyName'\n          str 'OpenGamma'\n      = str 'home'\n        map (3)\n        = str 'number'\n          int 65432\n        = str 'street'\n          str 'Big Road'\n        = str 'city'\n          str 'Bigton'\n    = str 'addressesList'\n      arr (1)\n      - arr (2)\n        - map (3)\n          = str 'number'\n            int 65432\n          = str 'street'\n            str 'Big Road'\n          = str 'city'\n            str 'Bigton'\n        - map (5)\n          = ext type=32 'CompanyAddress' (bean)\n            nil\n          = str 'number'\n            int 185\n          = str 'street'\n            str 'Park Street'\n          = str 'city'\n            str 'London'\n          = str 'companyName'\n            str 'OpenGamma'\n    = str 'mainAddress'\n      map (5)\n      = ext type=32 'CompanyAddress' (bean)\n        nil\n      = str 'number'\n        int 185\n      = str 'street'\n        str 'Park Street'\n      = str 'city'\n        str 'London'\n      = str 'companyName'\n        str 'OpenGamma'\n    = str 'extensions'\n      map (4)\n      = str 'interests'\n        str 'joda'\n      = str 'conferenceCount'\n        int 21\n      = str 'quality'\n        map (1)\n        = ext type=33 'Character' (data)\n          str 'B'\n      = str 'company'\n        map (2)\n        = ext type=32 'Company' (bean)\n          nil\n        = str 'companyName'\n          str 'OpenGamma'"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/Address2.json",
    "content": "{\n \"@bean\": \"org.joda.beans.sample.Address\",\n \"number\": 251,\n \"street\": \"Big Road\",\n \"city\": \"London & Capital of the World <!>\",\n \"owner\": {\n  \"forename\": \"Etienne\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 0,\n  \"addressList\": [{\n   \"number\": 65432,\n   \"street\": \"Big Road\",\n   \"city\": \"Bigton\"\n  }, null, {\n   \"@bean\": \"CompanyAddress\",\n   \"number\": 185,\n   \"street\": \"Park Street\",\n   \"city\": \"London\",\n   \"companyName\": \"OpenGamma\"\n  }],\n  \"otherAddressMap\": {\n   \"other\": null,\n   \"work\": {\n    \"@bean\": \"CompanyAddress\",\n    \"number\": 185,\n    \"street\": \"Park Street\",\n    \"city\": \"London\",\n    \"companyName\": \"OpenGamma\"\n   },\n   \"home\": {\n    \"number\": 65432,\n    \"street\": \"Big Road\",\n    \"city\": \"Bigton\"\n   }\n  },\n  \"addressesList\": [[{\n   \"number\": 65432,\n   \"street\": \"Big Road\",\n   \"city\": \"Bigton\"\n  }, {\n   \"@bean\": \"CompanyAddress\",\n   \"number\": 185,\n   \"street\": \"Park Street\",\n   \"city\": \"London\",\n   \"companyName\": \"OpenGamma\"\n  }]],\n  \"mainAddress\": {\n   \"@bean\": \"CompanyAddress\",\n   \"number\": 185,\n   \"street\": \"Park Street\",\n   \"city\": \"London\",\n   \"companyName\": \"OpenGamma\"\n  },\n  \"extensions\": {\n   \"interests\": \"joda\",\n   \"conferenceCount\": 21,\n   \"quality\": {\n    \"@type\": \"Character\",\n    \"value\": \"B\"\n   },\n   \"company\": {\n    \"@bean\": \"Company\",\n    \"companyName\": \"OpenGamma\"\n   }\n  }\n }\n}\n"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/Address2.simplejson",
    "content": "{\n \"number\": 251,\n \"street\": \"Big Road\",\n \"city\": \"London & Capital of the World <!>\",\n \"owner\": {\n  \"forename\": \"Etienne\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 0,\n  \"addressList\": [{\n   \"number\": 65432,\n   \"street\": \"Big Road\",\n   \"city\": \"Bigton\"\n  }, null, {\n   \"number\": 185,\n   \"street\": \"Park Street\",\n   \"city\": \"London\",\n   \"companyName\": \"OpenGamma\"\n  }],\n  \"otherAddressMap\": {\n   \"other\": null,\n   \"work\": {\n    \"number\": 185,\n    \"street\": \"Park Street\",\n    \"city\": \"London\",\n    \"companyName\": \"OpenGamma\"\n   },\n   \"home\": {\n    \"number\": 65432,\n    \"street\": \"Big Road\",\n    \"city\": \"Bigton\"\n   }\n  },\n  \"addressesList\": [[{\n   \"number\": 65432,\n   \"street\": \"Big Road\",\n   \"city\": \"Bigton\"\n  }, {\n   \"number\": 185,\n   \"street\": \"Park Street\",\n   \"city\": \"London\",\n   \"companyName\": \"OpenGamma\"\n  }]],\n  \"mainAddress\": {\n   \"number\": 185,\n   \"street\": \"Park Street\",\n   \"city\": \"London\",\n   \"companyName\": \"OpenGamma\"\n  },\n  \"extensions\": {\n   \"interests\": \"joda\",\n   \"conferenceCount\": 21,\n   \"quality\": \"B\",\n   \"company\": {\n    \"companyName\": \"OpenGamma\"\n   }\n  }\n }\n}\n"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/Collections.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<bean type=\"org.joda.beans.sample.ImmGuava\">\n <collection metatype=\"List\"/>\n <list>\n  <item type=\"String\">A</item>\n  <item type=\"String\">B</item>\n </list>\n <set>\n  <item type=\"String\">A</item>\n  <item type=\"String\">B</item>\n </set>\n <sortedSet>\n  <item type=\"String\">A</item>\n  <item type=\"String\">B</item>\n </sortedSet>\n <map>\n  <entry>\n   <item>A</item>\n   <item>AA</item>\n  </entry>\n  <entry>\n   <item>B</item>\n   <item>BB</item>\n  </entry>\n </map>\n <sortedMap>\n  <entry>\n   <item>A</item>\n   <item>AA</item>\n  </entry>\n  <entry>\n   <item>B</item>\n   <item>BB</item>\n  </entry>\n </sortedMap>\n <biMap>\n  <entry>\n   <item>A</item>\n   <item>AA</item>\n  </entry>\n  <entry>\n   <item>B</item>\n   <item>BB</item>\n  </entry>\n </biMap>\n <multimap metatype=\"ListMultimap\">\n  <entry>\n   <item>A</item>\n   <item>B</item>\n  </entry>\n  <entry>\n   <item>A</item>\n   <item>C</item>\n  </entry>\n  <entry>\n   <item>B</item>\n   <item>D</item>\n  </entry>\n </multimap>\n <listMultimap>\n  <entry>\n   <item>A</item>\n   <item>B</item>\n  </entry>\n  <entry>\n   <item>A</item>\n   <item>C</item>\n  </entry>\n  <entry>\n   <item>B</item>\n   <item>D</item>\n  </entry>\n </listMultimap>\n <setMultimap>\n  <entry>\n   <item>A</item>\n   <item>B</item>\n  </entry>\n  <entry>\n   <item>A</item>\n   <item>C</item>\n  </entry>\n  <entry>\n   <item>B</item>\n   <item>D</item>\n  </entry>\n </setMultimap>\n <multiset>\n  <item type=\"String\">A</item>\n  <item count=\"2\" type=\"String\">B</item>\n  <item count=\"3\" type=\"String\">C</item>\n </multiset>\n <sortedMultiset/>\n <collectionInterface metatype=\"List\"/>\n <listInterface>\n  <item type=\"String\">A</item>\n  <item type=\"String\">B</item>\n </listInterface>\n <setInterface>\n  <item type=\"String\">A</item>\n  <item type=\"String\">B</item>\n </setInterface>\n <sortedSetInterface>\n  <item type=\"String\">A</item>\n  <item type=\"String\">B</item>\n </sortedSetInterface>\n <mapInterface>\n  <entry>\n   <item>A</item>\n   <item>AA</item>\n  </entry>\n  <entry>\n   <item>B</item>\n   <item>BB</item>\n  </entry>\n </mapInterface>\n <sortedMapInterface>\n  <entry>\n   <item>A</item>\n   <item>AA</item>\n  </entry>\n  <entry>\n   <item>B</item>\n   <item>BB</item>\n  </entry>\n </sortedMapInterface>\n <biMapInterface>\n  <entry>\n   <item>A</item>\n   <item>AA</item>\n  </entry>\n  <entry>\n   <item>B</item>\n   <item>BB</item>\n  </entry>\n </biMapInterface>\n <multimapInterface metatype=\"ListMultimap\">\n  <entry>\n   <item>A</item>\n   <item>B</item>\n  </entry>\n  <entry>\n   <item>A</item>\n   <item>C</item>\n  </entry>\n  <entry>\n   <item>B</item>\n   <item>D</item>\n  </entry>\n </multimapInterface>\n <listMultimapInterface>\n  <entry>\n   <item>A</item>\n   <item>B</item>\n  </entry>\n  <entry>\n   <item>A</item>\n   <item>C</item>\n  </entry>\n  <entry>\n   <item>B</item>\n   <item>D</item>\n  </entry>\n </listMultimapInterface>\n <setMultimapInterface>\n  <entry>\n   <item>A</item>\n   <item>B</item>\n  </entry>\n  <entry>\n   <item>A</item>\n   <item>C</item>\n  </entry>\n  <entry>\n   <item>B</item>\n   <item>D</item>\n  </entry>\n </setMultimapInterface>\n <multisetInterface/>\n <sortedMultisetInterface/>\n <listWildExtendsT/>\n <listWildExtendsNumber/>\n <listWildExtendsComparable/>\n <setWildExtendsT/>\n <setWildExtendsNumber/>\n <setWildExtendsComparable/>\n <listWildBuilder1/>\n <listWildBuilder2/>\n <mapWildBuilder1/>\n <mapWildKey/>\n <table>\n  <item row=\"A\" col=\"1\">B</item>\n  <item row=\"A\" col=\"2\">C</item>\n  <item row=\"B\" col=\"3\">D</item>\n </table>\n</bean>"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/Collections1.binstr",
    "content": "arr (2)\n- int 1\n- map (35)\n  = ext type=32 'org.joda.beans.sample.ImmGuava' (bean)\n    nil\n  = str 'collection'\n    map (1)\n    = ext type=34 'List' (meta)\n      arr (0)\n  = str 'list'\n    arr (2)\n    - map (1)\n      = ext type=33 'String' (data)\n        str 'A'\n    - map (1)\n      = ext type=33 'String' (data)\n        str 'B'\n  = str 'set'\n    arr (2)\n    - map (1)\n      = ext type=33 'String' (data)\n        str 'A'\n    - map (1)\n      = ext type=33 'String' (data)\n        str 'B'\n  = str 'sortedSet'\n    arr (2)\n    - map (1)\n      = ext type=33 'String' (data)\n        str 'A'\n    - map (1)\n      = ext type=33 'String' (data)\n        str 'B'\n  = str 'map'\n    map (2)\n    = map (1)\n      = ext type=33 'String' (data)\n        str 'A'\n      str 'AA'\n    = map (1)\n      = ext type=33 'String' (data)\n        str 'B'\n      str 'BB'\n  = str 'sortedMap'\n    map (2)\n    = map (1)\n      = ext type=33 'String' (data)\n        str 'A'\n      str 'AA'\n    = map (1)\n      = ext type=33 'String' (data)\n        str 'B'\n      str 'BB'\n  = str 'biMap'\n    map (2)\n    = map (1)\n      = ext type=33 'String' (data)\n        str 'A'\n      str 'AA'\n    = map (1)\n      = ext type=33 'String' (data)\n        str 'B'\n      str 'BB'\n  = str 'multimap'\n    map (1)\n    = ext type=34 'ListMultimap' (meta)\n      map (0)\n  = str 'listMultimap'\n    map (0)\n  = str 'setMultimap'\n    map (0)\n  = str 'multiset'\n    map (3)\n    = map (1)\n      = ext type=33 'String' (data)\n        str 'A'\n      int 1\n    = map (1)\n      = ext type=33 'String' (data)\n        str 'B'\n      int 2\n    = map (1)\n      = ext type=33 'String' (data)\n        str 'C'\n      int 3\n  = str 'sortedMultiset'\n    map (0)\n  = str 'collectionInterface'\n    map (1)\n    = ext type=34 'List' (meta)\n      arr (0)\n  = str 'listInterface'\n    arr (2)\n    - map (1)\n      = ext type=33 'String' (data)\n        str 'A'\n    - map (1)\n      = ext type=33 'String' (data)\n        str 'B'\n  = str 'setInterface'\n    arr (2)\n    - map (1)\n      = ext type=33 'String' (data)\n        str 'A'\n    - map (1)\n      = ext type=33 'String' (data)\n        str 'B'\n  = str 'sortedSetInterface'\n    arr (2)\n    - map (1)\n      = ext type=33 'String' (data)\n        str 'A'\n    - map (1)\n      = ext type=33 'String' (data)\n        str 'B'\n  = str 'mapInterface'\n    map (2)\n    = map (1)\n      = ext type=33 'String' (data)\n        str 'A'\n      str 'AA'\n    = map (1)\n      = ext type=33 'String' (data)\n        str 'B'\n      str 'BB'\n  = str 'sortedMapInterface'\n    map (2)\n    = map (1)\n      = ext type=33 'String' (data)\n        str 'A'\n      str 'AA'\n    = map (1)\n      = ext type=33 'String' (data)\n        str 'B'\n      str 'BB'\n  = str 'biMapInterface'\n    map (2)\n    = map (1)\n      = ext type=33 'String' (data)\n        str 'A'\n      str 'AA'\n    = map (1)\n      = ext type=33 'String' (data)\n        str 'B'\n      str 'BB'\n  = str 'multimapInterface'\n    map (1)\n    = ext type=34 'ListMultimap' (meta)\n      map (0)\n  = str 'listMultimapInterface'\n    map (0)\n  = str 'setMultimapInterface'\n    map (0)\n  = str 'multisetInterface'\n    map (0)\n  = str 'sortedMultisetInterface'\n    map (0)\n  = str 'listWildExtendsT'\n    arr (0)\n  = str 'listWildExtendsNumber'\n    arr (0)\n  = str 'listWildExtendsComparable'\n    arr (0)\n  = str 'setWildExtendsT'\n    arr (0)\n  = str 'setWildExtendsNumber'\n    arr (0)\n  = str 'setWildExtendsComparable'\n    arr (0)\n  = str 'listWildBuilder1'\n    arr (0)\n  = str 'listWildBuilder2'\n    arr (0)\n  = str 'mapWildBuilder1'\n    map (0)\n  = str 'mapWildKey'\n    map (0)"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/Collections1.json",
    "content": "{\n \"@bean\": \"org.joda.beans.sample.ImmGuava\",\n \"collection\": {\n  \"@meta\": \"List\",\n  \"value\": []\n },\n \"list\": [{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, {\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }],\n \"set\": [{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, {\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }],\n \"sortedSet\": [{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, {\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }],\n \"map\": [[{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, \"AA\"], [{\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }, \"BB\"]],\n \"sortedMap\": [[{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, \"AA\"], [{\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }, \"BB\"]],\n \"biMap\": [[{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, \"AA\"], [{\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }, \"BB\"]],\n \"multimap\": {\n  \"@meta\": \"ListMultimap\",\n  \"value\": [[{\n   \"@type\": \"String\",\n   \"value\": \"A\"\n  }, \"B\"], [{\n   \"@type\": \"String\",\n   \"value\": \"A\"\n  }, \"C\"], [{\n   \"@type\": \"String\",\n   \"value\": \"B\"\n  }, \"D\"]]\n },\n \"listMultimap\": [[{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, \"B\"], [{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, \"C\"], [{\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }, \"D\"]],\n \"setMultimap\": [[{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, \"B\"], [{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, \"C\"], [{\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }, \"D\"]],\n \"multiset\": [[{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, 1], [{\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }, 2], [{\n  \"@type\": \"String\",\n  \"value\": \"C\"\n }, 3]],\n \"sortedMultiset\": [],\n \"collectionInterface\": {\n  \"@meta\": \"List\",\n  \"value\": []\n },\n \"listInterface\": [{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, {\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }],\n \"setInterface\": [{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, {\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }],\n \"sortedSetInterface\": [{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, {\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }],\n \"mapInterface\": [[{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, \"AA\"], [{\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }, \"BB\"]],\n \"sortedMapInterface\": [[{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, \"AA\"], [{\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }, \"BB\"]],\n \"biMapInterface\": [[{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, \"AA\"], [{\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }, \"BB\"]],\n \"multimapInterface\": {\n  \"@meta\": \"ListMultimap\",\n  \"value\": [[{\n   \"@type\": \"String\",\n   \"value\": \"A\"\n  }, \"B\"], [{\n   \"@type\": \"String\",\n   \"value\": \"A\"\n  }, \"C\"], [{\n   \"@type\": \"String\",\n   \"value\": \"B\"\n  }, \"D\"]]\n },\n \"listMultimapInterface\": [[{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, \"B\"], [{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, \"C\"], [{\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }, \"D\"]],\n \"setMultimapInterface\": [[{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, \"B\"], [{\n  \"@type\": \"String\",\n  \"value\": \"A\"\n }, \"C\"], [{\n  \"@type\": \"String\",\n  \"value\": \"B\"\n }, \"D\"]],\n \"multisetInterface\": [],\n \"sortedMultisetInterface\": [],\n \"listWildExtendsT\": [],\n \"listWildExtendsNumber\": [],\n \"listWildExtendsComparable\": [],\n \"setWildExtendsT\": [],\n \"setWildExtendsNumber\": [],\n \"setWildExtendsComparable\": [],\n \"listWildBuilder1\": [],\n \"listWildBuilder2\": [],\n \"mapWildBuilder1\": {},\n \"mapWildKey\": [],\n \"table\": [[\"A\", 1, \"B\"], [\"A\", 2, \"C\"], [\"B\", 3, \"D\"]]\n}"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/Collections1.packbinstr",
    "content": "arr (3)\n- int 3\n- str 'org.joda.beans.sample.'\n- @type ImmGuava\n  bean (35)\n  - str 'collection'\n  - str 'list'\n  - str 'set'\n  - str 'sortedSet'\n  - str 'map'\n  - str 'sortedMap'\n  - str 'biMap'\n  - str 'multimap'\n  - str 'listMultimap'\n  - str 'setMultimap'\n  - str 'multiset'\n  - str 'sortedMultiset'\n  - str 'collectionInterface'\n  - str 'listInterface'\n  - str 'setInterface'\n  - str 'sortedSetInterface'\n  - str 'mapInterface'\n  - str 'sortedMapInterface'\n  - str 'biMapInterface'\n  - str 'multimapInterface'\n  - str 'listMultimapInterface'\n  - str 'setMultimapInterface'\n  - str 'multisetInterface'\n  - str 'sortedMultisetInterface'\n  - str 'listWildExtendsT'\n  - str 'listWildExtendsNumber'\n  - str 'listWildExtendsComparable'\n  - str 'setWildExtendsT'\n  - str 'setWildExtendsNumber'\n  - str 'setWildExtendsComparable'\n  - str 'listWildBuilder1'\n  - str 'listWildBuilder2'\n  - str 'mapWildBuilder1'\n  - str 'mapWildKey'\n  - str 'table'\n  - arr (0)\n  - arr (2)\n    - str 'A'\n    - str 'B'\n  - arr (2)\n    - str 'A'\n    - str 'B'\n  - arr (2)\n    - str 'A'\n    - str 'B'\n  - map (2)\n    = str 'A'\n      str 'AA'\n    = str 'B'\n      str 'BB'\n  - map (2)\n    = str 'A'\n      str 'AA'\n    = str 'B'\n      str 'BB'\n  - map (2)\n    = str 'A'\n      str 'AA'\n    = str 'B'\n      str 'BB'\n  - map (2)\n    = str 'A'\n      arr (2)\n      - str 'B'\n      - str 'C'\n    = str 'B'\n      arr (1)\n      - str 'D'\n  - map (2)\n    = str 'A'\n      arr (2)\n      - str 'B'\n      - str 'C'\n    = str 'B'\n      arr (1)\n      - str 'D'\n  - map (2)\n    = str 'A'\n      arr (2)\n      - str 'B'\n      - str 'C'\n    = str 'B'\n      arr (1)\n      - str 'D'\n  - map (3)\n    = str 'A'\n      int 1\n    = str 'B'\n      int 2\n    = str 'C'\n      int 3\n  - map (0)\n  - arr (0)\n  - arr (2)\n    - str 'A'\n    - str 'B'\n  - arr (2)\n    - str 'A'\n    - str 'B'\n  - arr (2)\n    - str 'A'\n    - str 'B'\n  - map (2)\n    = str 'A'\n      str 'AA'\n    = str 'B'\n      str 'BB'\n  - map (2)\n    = str 'A'\n      str 'AA'\n    = str 'B'\n      str 'BB'\n  - map (2)\n    = str 'A'\n      str 'AA'\n    = str 'B'\n      str 'BB'\n  - map (2)\n    = str 'A'\n      arr (2)\n      - str 'B'\n      - str 'C'\n    = str 'B'\n      arr (1)\n      - str 'D'\n  - map (2)\n    = str 'A'\n      arr (2)\n      - str 'B'\n      - str 'C'\n    = str 'B'\n      arr (1)\n      - str 'D'\n  - map (2)\n    = str 'A'\n      arr (2)\n      - str 'B'\n      - str 'C'\n    = str 'B'\n      arr (1)\n      - str 'D'\n  - map (0)\n  - map (0)\n  - arr (0)\n  - arr (0)\n  - arr (0)\n  - arr (0)\n  - arr (0)\n  - arr (0)\n  - arr (0)\n  - arr (0)\n  - map (0)\n  - map (0)\n  - map (2)\n    = str 'A'\n      map (2)\n      = int 1\n        str 'B'\n      = int 2\n        str 'C'\n    = str 'B'\n      map (1)\n      = int 3\n        str 'D'"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/Collections1.refbinstr",
    "content": "arr (4)\n- int 2\n- int 8\n- map (2)\n  = str 'String'\n    arr (0)\n  = str 'org.joda.beans.sample.ImmGuava'\n    arr (35)\n    - str 'collection'\n    - str 'list'\n    - str 'set'\n    - str 'sortedSet'\n    - str 'map'\n    - str 'sortedMap'\n    - str 'biMap'\n    - str 'multimap'\n    - str 'listMultimap'\n    - str 'setMultimap'\n    - str 'multiset'\n    - str 'sortedMultiset'\n    - str 'collectionInterface'\n    - str 'listInterface'\n    - str 'setInterface'\n    - str 'sortedSetInterface'\n    - str 'mapInterface'\n    - str 'sortedMapInterface'\n    - str 'biMapInterface'\n    - str 'multimapInterface'\n    - str 'listMultimapInterface'\n    - str 'setMultimapInterface'\n    - str 'multisetInterface'\n    - str 'sortedMultisetInterface'\n    - str 'listWildExtendsT'\n    - str 'listWildExtendsNumber'\n    - str 'listWildExtendsComparable'\n    - str 'setWildExtendsT'\n    - str 'setWildExtendsNumber'\n    - str 'setWildExtendsComparable'\n    - str 'listWildBuilder1'\n    - str 'listWildBuilder2'\n    - str 'mapWildBuilder1'\n    - str 'mapWildKey'\n    - str 'table'\n- arr (36)\n  - ext type=32 '1' (bean)\n  - map (1)\n    = map (1)\n      = ext type=35 '6' (refkey)\n        ext type=34 'List' (meta)\n      arr (0)\n  - arr (2)\n    - map (1)\n      = ext type=33 '0' (data)\n        map (1)\n        = ext type=35 '0' (refkey)\n          str 'A'\n    - map (1)\n      = ext type=33 '0' (data)\n        map (1)\n        = ext type=35 '1' (refkey)\n          str 'B'\n  - arr (2)\n    - ext type=36 '0' (ref)\n    - ext type=36 '1' (ref)\n  - arr (2)\n    - ext type=36 '0' (ref)\n    - ext type=36 '1' (ref)\n  - map (2)\n    = ext type=36 '0' (ref)\n      map (1)\n      = ext type=35 '4' (refkey)\n        str 'AA'\n    = ext type=36 '1' (ref)\n      map (1)\n      = ext type=35 '5' (refkey)\n        str 'BB'\n  - map (2)\n    = ext type=36 '0' (ref)\n      ext type=36 '4' (ref)\n    = ext type=36 '1' (ref)\n      ext type=36 '5' (ref)\n  - map (2)\n    = ext type=36 '0' (ref)\n      ext type=36 '4' (ref)\n    = ext type=36 '1' (ref)\n      ext type=36 '5' (ref)\n  - map (1)\n    = map (1)\n      = ext type=35 '7' (refkey)\n        ext type=34 'ListMultimap' (meta)\n      map (3)\n      = ext type=36 '0' (ref)\n        ext type=36 '1' (ref)\n      = ext type=36 '0' (ref)\n        map (1)\n        = ext type=35 '2' (refkey)\n          str 'C'\n      = ext type=36 '1' (ref)\n        map (1)\n        = ext type=35 '3' (refkey)\n          str 'D'\n  - map (3)\n    = ext type=36 '0' (ref)\n      ext type=36 '1' (ref)\n    = ext type=36 '0' (ref)\n      ext type=36 '2' (ref)\n    = ext type=36 '1' (ref)\n      ext type=36 '3' (ref)\n  - map (3)\n    = ext type=36 '0' (ref)\n      ext type=36 '1' (ref)\n    = ext type=36 '0' (ref)\n      ext type=36 '2' (ref)\n    = ext type=36 '1' (ref)\n      ext type=36 '3' (ref)\n  - map (3)\n    = ext type=36 '0' (ref)\n      int 1\n    = ext type=36 '1' (ref)\n      int 2\n    = ext type=36 '2' (ref)\n      int 3\n  - map (0)\n  - map (1)\n    = ext type=34 '6' (meta)\n      arr (0)\n  - arr (2)\n    - ext type=36 '0' (ref)\n    - ext type=36 '1' (ref)\n  - arr (2)\n    - ext type=36 '0' (ref)\n    - ext type=36 '1' (ref)\n  - arr (2)\n    - ext type=36 '0' (ref)\n    - ext type=36 '1' (ref)\n  - map (2)\n    = ext type=36 '0' (ref)\n      ext type=36 '4' (ref)\n    = ext type=36 '1' (ref)\n      ext type=36 '5' (ref)\n  - map (2)\n    = ext type=36 '0' (ref)\n      ext type=36 '4' (ref)\n    = ext type=36 '1' (ref)\n      ext type=36 '5' (ref)\n  - map (2)\n    = ext type=36 '0' (ref)\n      ext type=36 '4' (ref)\n    = ext type=36 '1' (ref)\n      ext type=36 '5' (ref)\n  - map (1)\n    = ext type=34 '7' (meta)\n      map (3)\n      = ext type=36 '0' (ref)\n        ext type=36 '1' (ref)\n      = ext type=36 '0' (ref)\n        ext type=36 '2' (ref)\n      = ext type=36 '1' (ref)\n        ext type=36 '3' (ref)\n  - map (3)\n    = ext type=36 '0' (ref)\n      ext type=36 '1' (ref)\n    = ext type=36 '0' (ref)\n      ext type=36 '2' (ref)\n    = ext type=36 '1' (ref)\n      ext type=36 '3' (ref)\n  - map (3)\n    = ext type=36 '0' (ref)\n      ext type=36 '1' (ref)\n    = ext type=36 '0' (ref)\n      ext type=36 '2' (ref)\n    = ext type=36 '1' (ref)\n      ext type=36 '3' (ref)\n  - map (0)\n  - map (0)\n  - arr (0)\n  - arr (0)\n  - arr (0)\n  - arr (0)\n  - arr (0)\n  - arr (0)\n  - arr (0)\n  - arr (0)\n  - map (0)\n  - map (0)\n  - arr (3)\n    - arr (3)\n      - ext type=36 '0' (ref)\n      - int 1\n      - ext type=36 '1' (ref)\n    - arr (3)\n      - ext type=36 '0' (ref)\n      - int 2\n      - ext type=36 '2' (ref)\n    - arr (3)\n      - ext type=36 '1' (ref)\n      - int 3\n      - ext type=36 '3' (ref)"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/Collections2.binstr",
    "content": "arr (2)\n- int 1\n- map (36)\n  = ext type=32 'org.joda.beans.sample.ImmGuava' (bean)\n    nil\n  = str 'collection'\n    map (1)\n    = ext type=34 'List' (meta)\n      arr (0)\n  = str 'list'\n    arr (2)\n    - str 'A'\n    - str 'B'\n  = str 'set'\n    arr (2)\n    - str 'A'\n    - str 'B'\n  = str 'sortedSet'\n    arr (2)\n    - str 'A'\n    - str 'B'\n  = str 'map'\n    map (2)\n    = str 'A'\n      str 'AA'\n    = str 'B'\n      str 'BB'\n  = str 'sortedMap'\n    map (2)\n    = str 'A'\n      str 'AA'\n    = str 'B'\n      str 'BB'\n  = str 'biMap'\n    map (2)\n    = str 'A'\n      str 'AA'\n    = str 'B'\n      str 'BB'\n  = str 'multimap'\n    map (1)\n    = ext type=34 'ListMultimap' (meta)\n      map (3)\n      = str 'A'\n        str 'B'\n      = str 'A'\n        str 'C'\n      = str 'B'\n        str 'D'\n  = str 'listMultimap'\n    map (3)\n    = str 'A'\n      str 'B'\n    = str 'A'\n      str 'C'\n    = str 'B'\n      str 'D'\n  = str 'setMultimap'\n    map (3)\n    = str 'A'\n      str 'B'\n    = str 'A'\n      str 'C'\n    = str 'B'\n      str 'D'\n  = str 'multiset'\n    map (3)\n    = str 'A'\n      int 1\n    = str 'B'\n      int 2\n    = str 'C'\n      int 3\n  = str 'sortedMultiset'\n    map (0)\n  = str 'collectionInterface'\n    map (1)\n    = ext type=34 'List' (meta)\n      arr (0)\n  = str 'listInterface'\n    arr (2)\n    - str 'A'\n    - str 'B'\n  = str 'setInterface'\n    arr (2)\n    - str 'A'\n    - str 'B'\n  = str 'sortedSetInterface'\n    arr (2)\n    - str 'A'\n    - str 'B'\n  = str 'mapInterface'\n    map (2)\n    = str 'A'\n      str 'AA'\n    = str 'B'\n      str 'BB'\n  = str 'sortedMapInterface'\n    map (2)\n    = str 'A'\n      str 'AA'\n    = str 'B'\n      str 'BB'\n  = str 'biMapInterface'\n    map (2)\n    = str 'A'\n      str 'AA'\n    = str 'B'\n      str 'BB'\n  = str 'multimapInterface'\n    map (1)\n    = ext type=34 'ListMultimap' (meta)\n      map (3)\n      = str 'A'\n        str 'B'\n      = str 'A'\n        str 'C'\n      = str 'B'\n        str 'D'\n  = str 'listMultimapInterface'\n    map (3)\n    = str 'A'\n      str 'B'\n    = str 'A'\n      str 'C'\n    = str 'B'\n      str 'D'\n  = str 'setMultimapInterface'\n    map (3)\n    = str 'A'\n      str 'B'\n    = str 'A'\n      str 'C'\n    = str 'B'\n      str 'D'\n  = str 'multisetInterface'\n    map (0)\n  = str 'sortedMultisetInterface'\n    map (0)\n  = str 'listWildExtendsT'\n    arr (0)\n  = str 'listWildExtendsNumber'\n    arr (0)\n  = str 'listWildExtendsComparable'\n    arr (0)\n  = str 'setWildExtendsT'\n    arr (0)\n  = str 'setWildExtendsNumber'\n    arr (0)\n  = str 'setWildExtendsComparable'\n    arr (0)\n  = str 'listWildBuilder1'\n    arr (0)\n  = str 'listWildBuilder2'\n    arr (0)\n  = str 'mapWildBuilder1'\n    map (0)\n  = str 'mapWildKey'\n    map (0)\n  = str 'table'\n    arr (3)\n    - arr (3)\n      - str 'A'\n      - int 1\n      - str 'B'\n    - arr (3)\n      - str 'A'\n      - int 2\n      - str 'C'\n    - arr (3)\n      - str 'B'\n      - int 3\n      - str 'D'"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/Collections2.json",
    "content": "{\n \"@bean\": \"org.joda.beans.sample.ImmGuava\",\n \"collection\": {\n  \"@meta\": \"List\",\n  \"value\": []\n },\n \"list\": [\"A\", \"B\"],\n \"set\": [\"A\", \"B\"],\n \"sortedSet\": [\"A\", \"B\"],\n \"map\": [[\"A\", \"AA\"], [\"B\", \"BB\"]],\n \"sortedMap\": [[\"A\", \"AA\"], [\"B\", \"BB\"]],\n \"biMap\": [[\"A\", \"AA\"], [\"B\", \"BB\"]],\n \"multimap\": {\n  \"@meta\": \"ListMultimap\",\n  \"value\": [[\"A\", \"B\"], [\"A\", \"C\"], [\"B\", \"D\"]]\n },\n \"listMultimap\": [[\"A\", \"B\"], [\"A\", \"C\"], [\"B\", \"D\"]],\n \"setMultimap\": [[\"A\", \"B\"], [\"A\", \"C\"], [\"B\", \"D\"]],\n \"multiset\": [[\"A\", 1], [\"B\", 2], [\"C\", 3]],\n \"sortedMultiset\": [],\n \"collectionInterface\": {\n  \"@meta\": \"List\",\n  \"value\": []\n },\n \"listInterface\": [\"A\", \"B\"],\n \"setInterface\": [\"A\", \"B\"],\n \"sortedSetInterface\": [\"A\", \"B\"],\n \"mapInterface\": [[\"A\", \"AA\"], [\"B\", \"BB\"]],\n \"sortedMapInterface\": [[\"A\", \"AA\"], [\"B\", \"BB\"]],\n \"biMapInterface\": [[\"A\", \"AA\"], [\"B\", \"BB\"]],\n \"multimapInterface\": {\n  \"@meta\": \"ListMultimap\",\n  \"value\": [[\"A\", \"B\"], [\"A\", \"C\"], [\"B\", \"D\"]]\n },\n \"listMultimapInterface\": [[\"A\", \"B\"], [\"A\", \"C\"], [\"B\", \"D\"]],\n \"setMultimapInterface\": [[\"A\", \"B\"], [\"A\", \"C\"], [\"B\", \"D\"]],\n \"multisetInterface\": [],\n \"sortedMultisetInterface\": [],\n \"listWildExtendsT\": [],\n \"listWildExtendsNumber\": [],\n \"listWildExtendsComparable\": [],\n \"setWildExtendsT\": [],\n \"setWildExtendsNumber\": [],\n \"setWildExtendsComparable\": [],\n \"listWildBuilder1\": [],\n \"listWildBuilder2\": [],\n \"mapWildBuilder1\": {},\n \"mapWildKey\": [],\n \"table\": [[\"A\", 1, \"B\"], [\"A\", 2, \"C\"], [\"B\", 3, \"D\"]]\n}"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/Collections2.simplejson",
    "content": "{\n \"collection\": [],\n \"list\": [\"A\", \"B\"],\n \"set\": [\"A\", \"B\"],\n \"sortedSet\": [\"A\", \"B\"],\n \"map\": {\n  \"A\": \"AA\",\n  \"B\": \"BB\"\n },\n \"sortedMap\": {\n  \"A\": \"AA\",\n  \"B\": \"BB\"\n },\n \"biMap\": {\n  \"A\": \"AA\",\n  \"B\": \"BB\"\n },\n \"multimap\": {},\n \"listMultimap\": {},\n \"setMultimap\": {},\n \"multiset\": [[\"A\", 1], [\"B\", 2], [\"C\", 3]],\n \"sortedMultiset\": [],\n \"collectionInterface\": [],\n \"listInterface\": [\"A\", \"B\"],\n \"setInterface\": [\"A\", \"B\"],\n \"sortedSetInterface\": [\"A\", \"B\"],\n \"mapInterface\": {\n  \"A\": \"AA\",\n  \"B\": \"BB\"\n },\n \"sortedMapInterface\": {\n  \"A\": \"AA\",\n  \"B\": \"BB\"\n },\n \"biMapInterface\": {\n  \"A\": \"AA\",\n  \"B\": \"BB\"\n },\n \"multimapInterface\": {},\n \"listMultimapInterface\": {},\n \"setMultimapInterface\": {},\n \"multisetInterface\": [],\n \"sortedMultisetInterface\": [],\n \"listWildExtendsT\": [],\n \"listWildExtendsNumber\": [],\n \"listWildExtendsComparable\": [],\n \"setWildExtendsT\": [],\n \"setWildExtendsNumber\": [],\n \"setWildExtendsComparable\": [],\n \"listWildBuilder1\": [],\n \"listWildBuilder2\": [],\n \"mapWildBuilder1\": {},\n \"mapWildKey\": {},\n \"table\": []\n}\n\n"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmAddress.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<bean type=\"org.joda.beans.sample.ImmAddress\">\n <number>185</number>\n <street>Park Street</street>\n <city>London &amp; Capital of the World &lt;!&gt;\n</city>\n <abstractNumber type=\"Short\">89</abstractNumber>\n <array2d metatype=\"String[][]\">\n  <item metatype=\"String[]\">\n   <item>a</item>\n  </item>\n  <item metatype=\"String[]\"/>\n  <item metatype=\"String[]\">\n   <item>b</item>\n   <item>c</item>\n  </item>\n </array2d>\n <owner>\n  <forename>Etienne</forename>\n  <surname>Colebourne</surname>\n  <numberOfCars>1</numberOfCars>\n  <middleNames>\n   <item>K</item>\n   <item>T</item>\n  </middleNames>\n  <addressList>\n   <item>\n    <number>0</number>\n   </item>\n  </addressList>\n  <codeCounts>\n   <item count=\"2\">A</item>\n   <item>B</item>\n  </codeCounts>\n </owner>\n <object1 metatype=\"List\">\n  <item>a</item>\n  <item>b</item>\n  <item>c</item>\n </object1>\n <object2 metatype=\"Map\">\n  <entry>\n   <item>d</item>\n   <item type=\"Integer\">1</item>\n  </entry>\n  <entry>\n   <item type=\"java.util.Currency\">GBP</item>\n   <item type=\"Integer\">2</item>\n  </entry>\n </object2>\n <serializable metatype=\"List\">\n  <item>a</item>\n  <item>b</item>\n  <item>c</item>\n </serializable>\n <objectInMap>\n  <entry key=\"A\">Abba</entry>\n  <entry key=\"B\" metatype=\"Set\">\n   <item>a</item>\n   <item>b</item>\n  </entry>\n  <entry key=\"C\" metatype=\"Set\">\n   <item type=\"Locale\">fr_CA</item>\n   <item type=\"Long\">2</item>\n   <item type=\"PrimitiveBean\">\n    <valueLong>1</valueLong>\n    <valueInt>2</valueInt>\n    <valueShort>3</valueShort>\n    <valueByte>4</valueByte>\n    <valueDouble>5.0</valueDouble>\n    <valueFloat>6.0</valueFloat>\n    <valueChar>7</valueChar>\n    <valueBoolean>true</valueBoolean>\n   </item>\n  </entry>\n  <entry key=\"D\" metatype=\"Map\">\n   <entry>\n    <item>d</item>\n    <item type=\"Integer\">1</item>\n   </entry>\n   <entry>\n    <item>e</item>\n    <item type=\"Integer\">2</item>\n   </entry>\n  </entry>\n </objectInMap>\n <listInMap>\n  <entry key=\"A\">\n   <item>B</item>\n   <item>b</item>\n  </entry>\n </listInMap>\n <listNumericInMap>\n  <entry key=\"A\">\n   <item>3</item>\n   <item>2</item>\n   <item>1</item>\n  </entry>\n </listNumericInMap>\n <listInListInMap>\n  <entry key=\"A\">\n   <item metatype=\"List\">\n    <item type=\"Integer\">3</item>\n    <item type=\"Integer\">2</item>\n    <item type=\"Integer\">1</item>\n   </item>\n  </entry>\n </listInListInMap>\n <objectListInListInMap>\n  <entry key=\"A\">\n   <item metatype=\"List\">\n    <item type=\"Currency\">GBP</item>\n    <item type=\"java.util.TimeZone\">Europe/London</item>\n   </item>\n  </entry>\n  <entry key=\"B\">\n   <item metatype=\"List\">\n    <item type=\"Locale\">fr_CA</item>\n    <item type=\"Long\">2</item>\n    <item type=\"PrimitiveBean\">\n     <valueLong>1</valueLong>\n     <valueInt>2</valueInt>\n     <valueShort>3</valueShort>\n     <valueByte>4</valueByte>\n     <valueDouble>5.0</valueDouble>\n     <valueFloat>6.0</valueFloat>\n     <valueChar>7</valueChar>\n     <valueBoolean>true</valueBoolean>\n    </item>\n   </item>\n  </entry>\n </objectListInListInMap>\n <mapInMap>\n  <entry>\n   <item>\n    <forename>Etiennette</forename>\n    <surname>Colebourne</surname>\n    <numberOfCars>1</numberOfCars>\n    <middleNames/>\n   </item>\n   <item>\n    <entry key=\"sibling\">\n     <forename>Kylie</forename>\n     <surname>Colebourne</surname>\n     <numberOfCars>1</numberOfCars>\n     <middleNames/>\n    </entry>\n   </item>\n  </entry>\n </mapInMap>\n <simpleTable>\n  <item row=\"1\" col=\"1\">Hello</item>\n  <item row=\"1\" col=\"2\">There</item>\n </simpleTable>\n <compoundTable>\n  <item row=\"1\" col=\"1\">\n   <forename>Etienne</forename>\n   <surname>Colebourne</surname>\n   <numberOfCars>1</numberOfCars>\n   <middleNames>\n    <item>K</item>\n    <item>T</item>\n   </middleNames>\n   <addressList>\n    <item>\n     <number>0</number>\n    </item>\n   </addressList>\n   <codeCounts>\n    <item count=\"2\">A</item>\n    <item>B</item>\n   </codeCounts>\n  </item>\n  <item row=\"1\" col=\"2\">\n   <forename>Etiennette</forename>\n   <surname>Colebourne</surname>\n   <numberOfCars>1</numberOfCars>\n   <middleNames/>\n  </item>\n  <item row=\"2\" col=\"1\">\n   <forename>Kylie</forename>\n   <surname>Colebourne</surname>\n   <numberOfCars>1</numberOfCars>\n   <middleNames/>\n  </item>\n </compoundTable>\n <sparseGrid rows=\"5\" cols=\"5\">\n  <item row=\"1\" col=\"1\">\n   <forename>Kylie</forename>\n   <surname>Colebourne</surname>\n   <numberOfCars>1</numberOfCars>\n   <middleNames/>\n  </item>\n </sparseGrid>\n <denseGrid rows=\"2\" cols=\"3\">\n  <item row=\"0\" col=\"0\">\n   <forename>Etiennette</forename>\n   <surname>Colebourne</surname>\n   <numberOfCars>1</numberOfCars>\n   <middleNames/>\n  </item>\n  <item row=\"1\" col=\"1\">\n   <forename>Kylie</forename>\n   <surname>Colebourne</surname>\n   <numberOfCars>1</numberOfCars>\n   <middleNames/>\n  </item>\n </denseGrid>\n <beanBeanMap>\n  <entry>\n   <item>\n    <forename>Etiennette</forename>\n    <surname>Colebourne</surname>\n    <numberOfCars>1</numberOfCars>\n    <middleNames/>\n   </item>\n   <item>\n    <number>185</number>\n    <street>Park Street</street>\n    <city>London</city>\n    <data>QEFC</data>\n    <owner>\n     <forename>Etiennette</forename>\n     <surname>Colebourne</surname>\n     <numberOfCars>1</numberOfCars>\n     <middleNames/>\n    </owner>\n    <object1 type=\"Risk\">MEDIUM</object1>\n    <object2 type=\"RiskPerception\">LOW</object2>\n    <risk>LOW</risk>\n    <riskLevel>HIGH</riskLevel>\n    <riskLevels>\n     <item>LOW</item>\n     <item>MEDIUM</item>\n    </riskLevels>\n    <objectInMap/>\n    <listInMap/>\n    <listNumericInMap/>\n    <listInListInMap/>\n    <objectListInListInMap/>\n    <mapInMap/>\n    <beanBeanMap/>\n   </item>\n  </entry>\n </beanBeanMap>\n <doubleVector>1.1,2.2,3.3</doubleVector>\n <matrix metatype=\"double[][]\">\n  <item>1.1,2.2</item>\n  <item>3.2</item>\n </matrix>\n</bean>"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmAddress1.binstr",
    "content": "arr (2)\n- int 1\n- map (23)\n  = ext type=32 'org.joda.beans.sample.ImmAddress' (bean)\n    nil\n  = str 'number'\n    int 185\n  = str 'street'\n    str 'Park Street'\n  = str 'city'\n    str 'London & Capital of the World <!>\n'\n  = str 'abstractNumber'\n    map (1)\n    = ext type=33 'Short' (data)\n      int 89\n  = str 'array2d'\n    map (1)\n    = ext type=34 'String[][]' (meta)\n      arr (3)\n      - map (1)\n        = ext type=34 'String[]' (meta)\n          arr (1)\n          - str 'a'\n      - map (1)\n        = ext type=34 'String[]' (meta)\n          arr (0)\n      - map (1)\n        = ext type=34 'String[]' (meta)\n          arr (2)\n          - str 'b'\n          - str 'c'\n  = str 'owner'\n    map (6)\n    = str 'forename'\n      str 'Etienne'\n    = str 'surname'\n      str 'Colebourne'\n    = str 'numberOfCars'\n      int 1\n    = str 'middleNames'\n      arr (2)\n      - str 'K'\n      - str 'T'\n    = str 'addressList'\n      arr (1)\n      - map (1)\n        = str 'number'\n          int 0\n    = str 'codeCounts'\n      map (2)\n      = str 'A'\n        int 2\n      = str 'B'\n        int 1\n  = str 'object1'\n    map (1)\n    = ext type=34 'List' (meta)\n      arr (3)\n      - str 'a'\n      - str 'b'\n      - str 'c'\n  = str 'object2'\n    map (1)\n    = ext type=34 'Map' (meta)\n      map (2)\n      = str 'd'\n        int 1\n      = map (1)\n        = ext type=33 'java.util.Currency' (data)\n          str 'GBP'\n        int 2\n  = str 'serializable'\n    map (1)\n    = ext type=34 'List' (meta)\n      arr (3)\n      - str 'a'\n      - str 'b'\n      - str 'c'\n  = str 'objectInMap'\n    map (4)\n    = str 'A'\n      str 'Abba'\n    = str 'B'\n      map (1)\n      = ext type=34 'Set' (meta)\n        arr (2)\n        - str 'a'\n        - str 'b'\n    = str 'C'\n      map (1)\n      = ext type=34 'Set' (meta)\n        arr (3)\n        - map (1)\n          = ext type=33 'Locale' (data)\n            str 'fr_CA'\n        - map (1)\n          = ext type=33 'Long' (data)\n            int 2\n        - map (9)\n          = ext type=32 'PrimitiveBean' (bean)\n            nil\n          = str 'valueLong'\n            int 1\n          = str 'valueInt'\n            int 2\n          = str 'valueShort'\n            int 3\n          = str 'valueByte'\n            int 4\n          = str 'valueDouble'\n            dbl 5.0\n          = str 'valueFloat'\n            flt 6.0\n          = str 'valueChar'\n            str '7'\n          = str 'valueBoolean'\n            true\n    = str 'D'\n      map (1)\n      = ext type=34 'Map' (meta)\n        map (2)\n        = str 'd'\n          int 1\n        = str 'e'\n          int 2\n  = str 'listInMap'\n    map (1)\n    = str 'A'\n      arr (2)\n      - str 'B'\n      - str 'b'\n  = str 'listNumericInMap'\n    map (1)\n    = str 'A'\n      arr (3)\n      - int 3\n      - int 2\n      - int 1\n  = str 'listInListInMap'\n    map (1)\n    = str 'A'\n      arr (1)\n      - map (1)\n        = ext type=34 'List' (meta)\n          arr (3)\n          - int 3\n          - int 2\n          - int 1\n  = str 'objectListInListInMap'\n    map (2)\n    = str 'A'\n      arr (1)\n      - map (1)\n        = ext type=34 'List' (meta)\n          arr (2)\n          - map (1)\n            = ext type=33 'Currency' (data)\n              str 'GBP'\n          - map (1)\n            = ext type=33 'java.util.TimeZone' (data)\n              str 'Europe/London'\n    = str 'B'\n      arr (1)\n      - map (1)\n        = ext type=34 'List' (meta)\n          arr (3)\n          - map (1)\n            = ext type=33 'Locale' (data)\n              str 'fr_CA'\n          - map (1)\n            = ext type=33 'Long' (data)\n              int 2\n          - map (9)\n            = ext type=32 'PrimitiveBean' (bean)\n              nil\n            = str 'valueLong'\n              int 1\n            = str 'valueInt'\n              int 2\n            = str 'valueShort'\n              int 3\n            = str 'valueByte'\n              int 4\n            = str 'valueDouble'\n              dbl 5.0\n            = str 'valueFloat'\n              flt 6.0\n            = str 'valueChar'\n              str '7'\n            = str 'valueBoolean'\n              true\n  = str 'mapInMap'\n    map (1)\n    = map (4)\n      = str 'forename'\n        str 'Etiennette'\n      = str 'surname'\n        str 'Colebourne'\n      = str 'numberOfCars'\n        int 1\n      = str 'middleNames'\n        arr (0)\n      map (1)\n      = str 'sibling'\n        map (4)\n        = str 'forename'\n          str 'Kylie'\n        = str 'surname'\n          str 'Colebourne'\n        = str 'numberOfCars'\n          int 1\n        = str 'middleNames'\n          arr (0)\n  = str 'simpleTable'\n    arr (2)\n    - arr (3)\n      - int 1\n      - int 1\n      - str 'Hello'\n    - arr (3)\n      - int 1\n      - int 2\n      - str 'There'\n  = str 'compoundTable'\n    arr (3)\n    - arr (3)\n      - int 1\n      - int 1\n      - map (6)\n        = str 'forename'\n          str 'Etienne'\n        = str 'surname'\n          str 'Colebourne'\n        = str 'numberOfCars'\n          int 1\n        = str 'middleNames'\n          arr (2)\n          - str 'K'\n          - str 'T'\n        = str 'addressList'\n          arr (1)\n          - map (1)\n            = str 'number'\n              int 0\n        = str 'codeCounts'\n          map (2)\n          = str 'A'\n            int 2\n          = str 'B'\n            int 1\n    - arr (3)\n      - int 1\n      - int 2\n      - map (4)\n        = str 'forename'\n          str 'Etiennette'\n        = str 'surname'\n          str 'Colebourne'\n        = str 'numberOfCars'\n          int 1\n        = str 'middleNames'\n          arr (0)\n    - arr (3)\n      - int 2\n      - int 1\n      - map (4)\n        = str 'forename'\n          str 'Kylie'\n        = str 'surname'\n          str 'Colebourne'\n        = str 'numberOfCars'\n          int 1\n        = str 'middleNames'\n          arr (0)\n  = str 'sparseGrid'\n    arr (3)\n    - int 5\n    - int 5\n    - arr (3)\n      - int 1\n      - int 1\n      - map (4)\n        = str 'forename'\n          str 'Kylie'\n        = str 'surname'\n          str 'Colebourne'\n        = str 'numberOfCars'\n          int 1\n        = str 'middleNames'\n          arr (0)\n  = str 'denseGrid'\n    arr (8)\n    - int 2\n    - int 3\n    - map (4)\n      = str 'forename'\n        str 'Etiennette'\n      = str 'surname'\n        str 'Colebourne'\n      = str 'numberOfCars'\n        int 1\n      = str 'middleNames'\n        arr (0)\n    - nil\n    - nil\n    - nil\n    - map (4)\n      = str 'forename'\n        str 'Kylie'\n      = str 'surname'\n        str 'Colebourne'\n      = str 'numberOfCars'\n        int 1\n      = str 'middleNames'\n        arr (0)\n    - nil\n  = str 'beanBeanMap'\n    map (1)\n    = map (4)\n      = str 'forename'\n        str 'Etiennette'\n      = str 'surname'\n        str 'Colebourne'\n      = str 'numberOfCars'\n        int 1\n      = str 'middleNames'\n        arr (0)\n      map (17)\n      = str 'number'\n        int 185\n      = str 'street'\n        str 'Park Street'\n      = str 'city'\n        str 'London'\n      = str 'data'\n        bin '404142'\n      = str 'owner'\n        map (4)\n        = str 'forename'\n          str 'Etiennette'\n        = str 'surname'\n          str 'Colebourne'\n        = str 'numberOfCars'\n          int 1\n        = str 'middleNames'\n          arr (0)\n      = str 'object1'\n        map (1)\n        = ext type=33 'Risk' (data)\n          str 'MEDIUM'\n      = str 'object2'\n        map (1)\n        = ext type=33 'RiskPerception' (data)\n          str 'LOW'\n      = str 'risk'\n        str 'LOW'\n      = str 'riskLevel'\n        str 'HIGH'\n      = str 'riskLevels'\n        arr (2)\n        - str 'LOW'\n        - str 'MEDIUM'\n      = str 'objectInMap'\n        map (0)\n      = str 'listInMap'\n        map (0)\n      = str 'listNumericInMap'\n        map (0)\n      = str 'listInListInMap'\n        map (0)\n      = str 'objectListInListInMap'\n        map (0)\n      = str 'mapInMap'\n        map (0)\n      = str 'beanBeanMap'\n        map (0)\n  = str 'doubleVector'\n    str '1.1,2.2,3.3'\n  = str 'matrix'\n    map (1)\n    = ext type=34 'double[][]' (meta)\n      arr (2)\n      - str '1.1,2.2'\n      - str '3.2'"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmAddress1.json",
    "content": "{\n \"@bean\": \"org.joda.beans.sample.ImmAddress\",\n \"number\": 185,\n \"street\": \"Park Street\",\n \"city\": \"London & Capital of the World <!>\\n\",\n \"abstractNumber\": {\n  \"@type\": \"Short\",\n  \"value\": 89\n },\n \"array2d\": {\n  \"@meta\": \"String[][]\",\n  \"value\": [{\n   \"@meta\": \"String[]\",\n   \"value\": [\"a\"]\n  }, {\n   \"@meta\": \"String[]\",\n   \"value\": []\n  }, {\n   \"@meta\": \"String[]\",\n   \"value\": [\"b\", \"c\"]\n  }]\n },\n \"owner\": {\n  \"forename\": \"Etienne\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": [\"K\", \"T\"],\n  \"addressList\": [{\n   \"number\": 0\n  }],\n  \"codeCounts\": [[\"A\", 2], [\"B\", 1]]\n },\n \"object1\": {\n  \"@meta\": \"List\",\n  \"value\": [\"a\", \"b\", \"c\"]\n },\n \"object2\": {\n  \"@meta\": \"Map\",\n  \"value\": [[\"d\", 1], [{\n   \"@type\": \"java.util.Currency\",\n   \"value\": \"GBP\"\n  }, 2]]\n },\n \"serializable\": {\n  \"@meta\": \"List\",\n  \"value\": [\"a\", \"b\", \"c\"]\n },\n \"objectInMap\": {\n  \"A\": \"Abba\",\n  \"B\": {\n   \"@meta\": \"Set\",\n   \"value\": [\"a\", \"b\"]\n  },\n  \"C\": {\n   \"@meta\": \"Set\",\n   \"value\": [{\n    \"@type\": \"Locale\",\n    \"value\": \"fr_CA\"\n   }, {\n    \"@type\": \"Long\",\n    \"value\": 2\n   }, {\n    \"@bean\": \"PrimitiveBean\",\n    \"valueLong\": 1,\n    \"valueInt\": 2,\n    \"valueShort\": 3,\n    \"valueByte\": 4,\n    \"valueDouble\": 5.0,\n    \"valueFloat\": 6.0,\n    \"valueChar\": \"7\",\n    \"valueBoolean\": true\n   }]\n  },\n  \"D\": {\n   \"@meta\": \"Map\",\n   \"value\": [[\"d\", 1], [\"e\", 2]]\n  }\n },\n \"listInMap\": {\n  \"A\": [\"B\", \"b\"]\n },\n \"listNumericInMap\": {\n  \"A\": [3, 2, 1]\n },\n \"listInListInMap\": {\n  \"A\": [{\n   \"@meta\": \"List\",\n   \"value\": [3, 2, 1]\n  }]\n },\n \"objectListInListInMap\": {\n  \"A\": [{\n   \"@meta\": \"List\",\n   \"value\": [{\n    \"@type\": \"Currency\",\n    \"value\": \"GBP\"\n   }, {\n    \"@type\": \"java.util.TimeZone\",\n    \"value\": \"Europe/London\"\n   }]\n  }],\n  \"B\": [{\n   \"@meta\": \"List\",\n   \"value\": [{\n    \"@type\": \"Locale\",\n    \"value\": \"fr_CA\"\n   }, {\n    \"@type\": \"Long\",\n    \"value\": 2\n   }, {\n    \"@bean\": \"PrimitiveBean\",\n    \"valueLong\": 1,\n    \"valueInt\": 2,\n    \"valueShort\": 3,\n    \"valueByte\": 4,\n    \"valueDouble\": 5.0,\n    \"valueFloat\": 6.0,\n    \"valueChar\": \"7\",\n    \"valueBoolean\": true\n   }]\n  }]\n },\n \"mapInMap\": [[{\n  \"forename\": \"Etiennette\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }, {\n  \"sibling\": {\n   \"forename\": \"Kylie\",\n   \"surname\": \"Colebourne\",\n   \"numberOfCars\": 1,\n   \"middleNames\": []\n  }\n }]],\n \"simpleTable\": [[1, 1, \"Hello\"], [1, 2, \"There\"]],\n \"compoundTable\": [[1, 1, {\n  \"forename\": \"Etienne\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": [\"K\", \"T\"],\n  \"addressList\": [{\n   \"number\": 0\n  }],\n  \"codeCounts\": [[\"A\", 2], [\"B\", 1]]\n }], [1, 2, {\n  \"forename\": \"Etiennette\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }], [2, 1, {\n  \"forename\": \"Kylie\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }]],\n \"sparseGrid\": [5, 5, [1, 1, {\n  \"forename\": \"Kylie\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }]],\n \"denseGrid\": [2, 3, [0, 0, {\n  \"forename\": \"Etiennette\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }], [1, 1, {\n  \"forename\": \"Kylie\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }]],\n \"beanBeanMap\": [[{\n  \"forename\": \"Etiennette\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }, {\n  \"number\": 185,\n  \"street\": \"Park Street\",\n  \"city\": \"London\",\n  \"data\": \"QEFC\",\n  \"owner\": {\n   \"forename\": \"Etiennette\",\n   \"surname\": \"Colebourne\",\n   \"numberOfCars\": 1,\n   \"middleNames\": []\n  },\n  \"object1\": {\n   \"@type\": \"Risk\",\n   \"value\": \"MEDIUM\"\n  },\n  \"object2\": {\n   \"@type\": \"RiskPerception\",\n   \"value\": \"LOW\"\n  },\n  \"risk\": \"LOW\",\n  \"riskLevel\": \"HIGH\",\n  \"riskLevels\": [\"LOW\", \"MEDIUM\"],\n  \"objectInMap\": {},\n  \"listInMap\": {},\n  \"listNumericInMap\": {},\n  \"listInListInMap\": {},\n  \"objectListInListInMap\": {},\n  \"mapInMap\": [],\n  \"beanBeanMap\": []\n }]],\n \"doubleVector\": \"1.1,2.2,3.3\",\n \"matrix\": {\n  \"@meta\": \"double[][]\",\n  \"value\": [\"1.1,2.2\", \"3.2\"]\n }\n}\n"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmAddress1.packbinstr",
    "content": "arr (3)\n- int 3\n- str 'org.joda.beans.sample.'\n- @type ImmAddress\n  bean (26)\n  - str 'number'\n  - str 'street'\n  - str 'city'\n  - str 'abstractNumber'\n  - str 'data'\n  - str 'array2d'\n  - str 'owner'\n  - str 'object1'\n  - str 'object2'\n  - str 'risk'\n  - str 'riskLevel'\n  - str 'riskLevels'\n  - str 'serializable'\n  - str 'objectInMap'\n  - str 'listInMap'\n  - str 'listNumericInMap'\n  - str 'listInListInMap'\n  - str 'objectListInListInMap'\n  - str 'mapInMap'\n  - str 'simpleTable'\n  - str 'compoundTable'\n  - str 'sparseGrid'\n  - str 'denseGrid'\n  - str 'beanBeanMap'\n  - str 'doubleVector'\n  - str 'matrix'\n  - int 185\n  - str 'Park Street'\n  - str 'London & Capital of the World <!>\n'\n  - sht 89\n  - null\n  - arr (3)\n    - arr (1)\n      - str 'a'\n    - arr (0)\n    - arr (2)\n      - str 'b'\n      - str 'c'\n  - @type ImmPerson\n    bean (10)\n    - str 'forename'\n    - str 'surname'\n    - str 'numberOfCars'\n    - str 'dateOfBirth'\n    - str 'middleNames'\n    - str 'addressList'\n    - str 'otherAddressMap'\n    - str 'addressesList'\n    - str 'mainAddress'\n    - str 'codeCounts'\n    - str 'Etienne'\n    - str 'Colebourne'\n    - int 1\n    - null\n    - arr (2)\n      - str 'K'\n      - str 'T'\n    - arr (1)\n      - @type Address\n        bean (4)\n        - ref 1 'number'\n        - ref 2 'street'\n        - ref 3 'city'\n        - ref 7 'owner'\n        - int 0\n        - null\n        - null\n        - null\n    - null\n    - null\n    - null\n    - map (2)\n      = str 'A'\n        int 2\n      = str 'B'\n        int 1\n  - @typeref List\n    arr (3)\n    - str 'a'\n    - str 'b'\n    - str 'c'\n  - @typeref Map\n    map (2)\n    = str 'd'\n      int 1\n    = @value \n      @type java.util.Currency\n      str 'GBP'\n      int 2\n  - null\n  - null\n  - null\n  - @typeref List\n    arr (3)\n    - str 'a'\n    - str 'b'\n    - str 'c'\n  - map (4)\n    = str 'A'\n      str 'Abba'\n    = str 'B'\n      @typeref Set\n      arr (2)\n      - str 'a'\n      - str 'b'\n    = str 'C'\n      @typeref Set\n      arr (3)\n      - @value \n        @type Locale\n        str 'fr_CA'\n      - lng 2\n      - @type PrimitiveBean\n        bean (8)\n        - str 'valueLong'\n        - str 'valueInt'\n        - str 'valueShort'\n        - str 'valueByte'\n        - str 'valueDouble'\n        - str 'valueFloat'\n        - str 'valueChar'\n        - str 'valueBoolean'\n        - lng 1\n        - int 2\n        - sht 3\n        - byt 4\n        - dbl 5.0\n        - flt 6.0\n        - chr 7\n        - true\n    = str 'D'\n      @typeref Map\n      map (2)\n      = str 'd'\n        int 1\n      = str 'e'\n        int 2\n  - map (1)\n    = str 'A'\n      arr (2)\n      - str 'B'\n      - str 'b'\n  - map (1)\n    = str 'A'\n      arr (3)\n      - int 3\n      - int 2\n      - int 1\n  - map (1)\n    = str 'A'\n      arr (1)\n      - arr (3)\n        - int 3\n        - int 2\n        - int 1\n  - map (2)\n    = str 'A'\n      arr (1)\n      - arr (2)\n        - ref 42 'GBP'\n        - @value \n          @type java.util.TimeZone\n          str 'Europe/London'\n    = str 'B'\n      arr (1)\n      - arr (3)\n        - ref 45 'fr_CA'\n        - lng 2\n        - @typeref 5 PrimitiveBean\n          arr (8)\n          - lng 1\n          - int 2\n          - sht 3\n          - byt 4\n          - dbl 5.0\n          - flt 6.0\n          - chr 7\n          - true\n  - map (1)\n    = arr (10)\n      - str 'Etiennette'\n      - ref 40 'Colebourne'\n      - int 1\n      - null\n      - arr (0)\n      - null\n      - null\n      - null\n      - null\n      - null\n      map (1)\n      = str 'sibling'\n        arr (10)\n        - str 'Kylie'\n        - ref 40 'Colebourne'\n        - int 1\n        - null\n        - arr (0)\n        - null\n        - null\n        - null\n        - null\n        - null\n  - map (1)\n    = int 1\n      map (2)\n      = int 1\n        str 'Hello'\n      = int 2\n        str 'There'\n  - map (2)\n    = int 1\n      map (2)\n      = int 1\n        arr (10)\n        - ref 39 'Etienne'\n        - ref 40 'Colebourne'\n        - int 1\n        - null\n        - arr (2)\n          - str 'K'\n          - str 'T'\n        - arr (1)\n          - arr (4)\n            - int 0\n            - null\n            - null\n            - null\n        - null\n        - null\n        - null\n        - map (2)\n          = str 'A'\n            int 2\n          = str 'B'\n            int 1\n      = int 2\n        arr (10)\n        - ref 56 'Etiennette'\n        - ref 40 'Colebourne'\n        - int 1\n        - null\n        - arr (0)\n        - null\n        - null\n        - null\n        - null\n        - null\n    = int 2\n      map (1)\n      = int 1\n        arr (10)\n        - ref 58 'Kylie'\n        - ref 40 'Colebourne'\n        - int 1\n        - null\n        - arr (0)\n        - null\n        - null\n        - null\n        - null\n        - null\n  - arr (3)\n    - int 5\n    - int 5\n    - arr (3)\n      - int 1\n      - int 1\n      - arr (10)\n        - ref 58 'Kylie'\n        - ref 40 'Colebourne'\n        - int 1\n        - null\n        - arr (0)\n        - null\n        - null\n        - null\n        - null\n        - null\n  - arr (3)\n    - int 2\n    - int 3\n    - arr (6)\n      - int 0\n      - int 0\n      - arr (10)\n        - ref 56 'Etiennette'\n        - ref 40 'Colebourne'\n        - int 1\n        - null\n        - arr (0)\n        - null\n        - null\n        - null\n        - null\n        - null\n      - int 1\n      - int 1\n      - arr (10)\n        - ref 58 'Kylie'\n        - ref 40 'Colebourne'\n        - int 1\n        - null\n        - arr (0)\n        - null\n        - null\n        - null\n        - null\n        - null\n  - map (1)\n    = arr (10)\n      - ref 56 'Etiennette'\n      - ref 40 'Colebourne'\n      - int 1\n      - null\n      - arr (0)\n      - null\n      - null\n      - null\n      - null\n      - null\n      arr (26)\n      - int 185\n      - ref 27 'Park Street'\n      - str 'London'\n      - null\n      - bin '404142'\n      - null\n      - arr (10)\n        - ref 56 'Etiennette'\n        - ref 40 'Colebourne'\n        - int 1\n        - null\n        - arr (0)\n        - null\n        - null\n        - null\n        - null\n        - null\n      - @value \n        @type Risk\n        str 'MEDIUM'\n      - @value \n        @type RiskPerception\n        str 'LOW'\n      - @value \n        @typeref 7 Risk\n        ref 64 'LOW'\n      - @value \n        @typeref 7 Risk\n        str 'HIGH'\n      - arr (2)\n        - ref 66 'LOW'\n        - ref 63 'MEDIUM'\n      - null\n      - map (0)\n      - map (0)\n      - map (0)\n      - map (0)\n      - map (0)\n      - map (0)\n      - null\n      - null\n      - null\n      - null\n      - map (0)\n      - null\n      - null\n  - dbl [1.1,2.2,3.3]\n  - arr (2)\n    - dbl [1.1,2.2]\n    - dbl [3.2]"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmAddress1.refbinstr",
    "content": "arr (4)\n- int 2\n- int 17\n- map (11)\n  = str 'String'\n    arr (0)\n  = str 'org.joda.beans.sample.ImmAddress'\n    arr (26)\n    - str 'number'\n    - str 'street'\n    - str 'city'\n    - str 'abstractNumber'\n    - str 'data'\n    - str 'array2d'\n    - str 'owner'\n    - str 'object1'\n    - str 'object2'\n    - str 'risk'\n    - str 'riskLevel'\n    - str 'riskLevels'\n    - str 'serializable'\n    - str 'objectInMap'\n    - str 'listInMap'\n    - str 'listNumericInMap'\n    - str 'listInListInMap'\n    - str 'objectListInListInMap'\n    - str 'mapInMap'\n    - str 'simpleTable'\n    - str 'compoundTable'\n    - str 'sparseGrid'\n    - str 'denseGrid'\n    - str 'beanBeanMap'\n    - str 'doubleVector'\n    - str 'matrix'\n  = str 'Short'\n    arr (0)\n  = str 'org.joda.beans.sample.ImmPerson'\n    arr (10)\n    - str 'forename'\n    - str 'surname'\n    - str 'numberOfCars'\n    - str 'dateOfBirth'\n    - str 'middleNames'\n    - str 'addressList'\n    - str 'otherAddressMap'\n    - str 'addressesList'\n    - str 'mainAddress'\n    - str 'codeCounts'\n  = str 'java.util.Currency'\n    arr (0)\n  = str 'Integer'\n    arr (0)\n  = str 'Locale'\n    arr (0)\n  = str 'Long'\n    arr (0)\n  = str 'java.util.TimeZone'\n    arr (0)\n  = str 'org.joda.beans.sample.Risk'\n    arr (0)\n  = str 'org.joda.beans.sample.RiskPerception'\n    arr (0)\n- arr (27)\n  - ext type=32 '1' (bean)\n  - int 185\n  - map (1)\n    = ext type=35 '8' (refkey)\n      str 'Park Street'\n  - str 'London & Capital of the World <!>\n'\n  - map (1)\n    = ext type=33 '2' (data)\n      int 89\n  - nil\n  - map (1)\n    = ext type=34 'String[][]' (meta)\n      arr (3)\n      - map (1)\n        = ext type=34 'String[]' (meta)\n          arr (1)\n          - map (1)\n            = ext type=35 '3' (refkey)\n              str 'a'\n      - map (1)\n        = ext type=34 'String[]' (meta)\n          arr (0)\n      - map (1)\n        = ext type=34 'String[]' (meta)\n          arr (2)\n          - map (1)\n            = ext type=35 '1' (refkey)\n              str 'b'\n          - map (1)\n            = ext type=35 '6' (refkey)\n              str 'c'\n  - map (1)\n    = ext type=35 '9' (refkey)\n      arr (10)\n      - str 'Etienne'\n      - map (1)\n        = ext type=35 '7' (refkey)\n          str 'Colebourne'\n      - int 1\n      - nil\n      - arr (2)\n        - str 'K'\n        - str 'T'\n      - nil\n      - nil\n      - nil\n      - nil\n      - map (2)\n        = map (1)\n          = ext type=35 '0' (refkey)\n            str 'A'\n          int 2\n        = map (1)\n          = ext type=35 '4' (refkey)\n            str 'B'\n          int 1\n  - map (1)\n    = map (1)\n      = ext type=35 '10' (refkey)\n        ext type=34 'List' (meta)\n      arr (3)\n      - ext type=36 '3' (ref)\n      - ext type=36 '1' (ref)\n      - ext type=36 '6' (ref)\n  - map (1)\n    = ext type=34 'Map' (meta)\n      map (2)\n      = map (1)\n        = ext type=35 '11' (refkey)\n          str 'd'\n        int 1\n      = map (1)\n        = ext type=33 '4' (data)\n          map (1)\n          = ext type=35 '12' (refkey)\n            str 'GBP'\n        int 2\n  - nil\n  - nil\n  - nil\n  - map (1)\n    = ext type=34 '10' (meta)\n      arr (3)\n      - ext type=36 '3' (ref)\n      - ext type=36 '1' (ref)\n      - ext type=36 '6' (ref)\n  - map (4)\n    = ext type=36 '0' (ref)\n      str 'Abba'\n    = ext type=36 '4' (ref)\n      map (1)\n      = ext type=34 'Set' (meta)\n        arr (2)\n        - ext type=36 '3' (ref)\n        - ext type=36 '1' (ref)\n    = str 'C'\n      map (1)\n      = ext type=34 'Set' (meta)\n        arr (2)\n        - map (1)\n          = ext type=33 '6' (data)\n            map (1)\n            = ext type=35 '13' (refkey)\n              str 'fr_CA'\n        - map (1)\n          = ext type=33 '7' (data)\n            int 2\n    = str 'D'\n      map (1)\n      = ext type=34 'Map' (meta)\n        map (2)\n        = ext type=36 '11' (ref)\n          int 1\n        = str 'e'\n          int 2\n  - map (1)\n    = ext type=36 '0' (ref)\n      arr (2)\n      - ext type=36 '4' (ref)\n      - ext type=36 '1' (ref)\n  - map (1)\n    = ext type=36 '0' (ref)\n      arr (3)\n      - int 3\n      - int 2\n      - int 1\n  - map (1)\n    = ext type=36 '0' (ref)\n      arr (1)\n      - map (1)\n        = ext type=34 '10' (meta)\n          arr (3)\n          - int 3\n          - int 2\n          - int 1\n  - map (2)\n    = ext type=36 '0' (ref)\n      arr (1)\n      - map (1)\n        = ext type=34 '10' (meta)\n          arr (2)\n          - ext type=36 '12' (ref)\n          - map (1)\n            = ext type=33 '8' (data)\n              str 'Europe/London'\n    = ext type=36 '4' (ref)\n      arr (1)\n      - map (1)\n        = ext type=34 '10' (meta)\n          arr (2)\n          - ext type=36 '13' (ref)\n          - map (1)\n            = ext type=33 '7' (data)\n              int 2\n  - map (1)\n    = map (1)\n      = ext type=35 '2' (refkey)\n        arr (10)\n        - str 'Etiennette'\n        - ext type=36 '7' (ref)\n        - int 1\n        - nil\n        - arr (0)\n        - nil\n        - nil\n        - nil\n        - nil\n        - nil\n      map (1)\n      = str 'sibling'\n        map (1)\n        = ext type=35 '5' (refkey)\n          arr (10)\n          - str 'Kylie'\n          - ext type=36 '7' (ref)\n          - int 1\n          - nil\n          - arr (0)\n          - nil\n          - nil\n          - nil\n          - nil\n          - nil\n  - arr (2)\n    - arr (3)\n      - int 1\n      - int 1\n      - str 'Hello'\n    - arr (3)\n      - int 1\n      - int 2\n      - str 'There'\n  - arr (3)\n    - arr (3)\n      - int 1\n      - int 1\n      - ext type=36 '9' (ref)\n    - arr (3)\n      - int 1\n      - int 2\n      - ext type=36 '2' (ref)\n    - arr (3)\n      - int 2\n      - int 1\n      - ext type=36 '5' (ref)\n  - arr (3)\n    - int 5\n    - int 5\n    - arr (3)\n      - int 1\n      - int 1\n      - ext type=36 '5' (ref)\n  - arr (8)\n    - int 2\n    - int 3\n    - ext type=36 '2' (ref)\n    - nil\n    - nil\n    - nil\n    - ext type=36 '5' (ref)\n    - nil\n  - map (1)\n    = ext type=36 '2' (ref)\n      arr (26)\n      - int 185\n      - ext type=36 '8' (ref)\n      - str 'London'\n      - nil\n      - bin '404142'\n      - nil\n      - ext type=36 '2' (ref)\n      - map (1)\n        = ext type=33 '9' (data)\n          map (1)\n          = ext type=35 '15' (refkey)\n            str 'MEDIUM'\n      - map (1)\n        = ext type=33 '10' (data)\n          str 'LOW'\n      - map (1)\n        = ext type=35 '16' (refkey)\n          str 'LOW'\n      - str 'HIGH'\n      - arr (2)\n        - ext type=36 '16' (ref)\n        - ext type=36 '15' (ref)\n      - nil\n      - map (0)\n      - map (0)\n      - map (0)\n      - map (0)\n      - map (0)\n      - map (0)\n      - nil\n      - nil\n      - nil\n      - nil\n      - map (0)\n      - nil\n      - nil\n  - str '1.1,2.2,3.3'\n  - map (1)\n    = ext type=34 'double[][]' (meta)\n      arr (2)\n      - str '1.1,2.2'\n      - str '3.2'"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmAddress1.simplejson",
    "content": "{\n \"number\": 185,\n \"street\": \"Park Street\",\n \"city\": \"London & Capital of the World <!>\\n\",\n \"abstractNumber\": 89,\n \"array2d\": [[\"a\"], [], [\"b\", \"c\"]],\n \"owner\": {\n  \"forename\": \"Etienne\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": [\"K\", \"T\"],\n  \"addressList\": [{\n   \"number\": 0\n  }],\n  \"codeCounts\": [[\"A\", 2], [\"B\", 1]]\n },\n \"object1\": [\"a\", \"b\", \"c\"],\n \"object2\": {\n  \"d\": 1,\n  \"GBP\": 2\n },\n \"serializable\": [\"a\", \"b\", \"c\"],\n \"objectInMap\": {\n  \"A\": \"Abba\",\n  \"B\": [\"a\", \"b\"],\n  \"C\": [\"fr_CA\", 2, {\n   \"valueLong\": 1,\n   \"valueInt\": 2,\n   \"valueShort\": 3,\n   \"valueByte\": 4,\n   \"valueDouble\": 5.0,\n   \"valueFloat\": 6.0,\n   \"valueChar\": \"7\",\n   \"valueBoolean\": true\n  }],\n  \"D\": {\n   \"d\": 1,\n   \"e\": 2\n  }\n },\n \"listInMap\": {\n  \"A\": [\"B\", \"b\"]\n },\n \"listNumericInMap\": {\n  \"A\": [3, 2, 1]\n },\n \"listInListInMap\": {\n  \"A\": [[3, 2, 1]]\n },\n \"objectListInListInMap\": {\n  \"A\": [[\"GBP\", \"Europe/London\"]],\n  \"B\": [[\"fr_CA\", 2, {\n   \"valueLong\": 1,\n   \"valueInt\": 2,\n   \"valueShort\": 3,\n   \"valueByte\": 4,\n   \"valueDouble\": 5.0,\n   \"valueFloat\": 6.0,\n   \"valueChar\": \"7\",\n   \"valueBoolean\": true\n  }]]\n },\n \"mapInMap\": {},\n \"simpleTable\": [[1, 1, \"Hello\"], [1, 2, \"There\"]],\n \"compoundTable\": [[1, 1, {\n  \"forename\": \"Etienne\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": [\"K\", \"T\"],\n  \"addressList\": [{\n   \"number\": 0\n  }],\n  \"codeCounts\": [[\"A\", 2], [\"B\", 1]]\n }], [1, 2, {\n  \"forename\": \"Etiennette\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }], [2, 1, {\n  \"forename\": \"Kylie\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }]],\n \"sparseGrid\": [5, 5, [1, 1, {\n  \"forename\": \"Kylie\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }]],\n \"denseGrid\": [2, 3, [0, 0, {\n  \"forename\": \"Etiennette\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }], [1, 1, {\n  \"forename\": \"Kylie\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }]],\n \"beanBeanMap\": {},\n \"doubleVector\": [1.1, 2.2, 3.3],\n \"matrix\": [\"1.1,2.2\", \"3.2\"]\n}"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmAddress2.binstr",
    "content": "arr (2)\n- int 1\n- map (23)\n  = ext type=32 'org.joda.beans.sample.ImmAddress' (bean)\n    nil\n  = str 'number'\n    int 185\n  = str 'street'\n    str 'Park Street'\n  = str 'city'\n    str 'London & Capital of the World <!>\n'\n  = str 'abstractNumber'\n    map (1)\n    = ext type=33 'Short' (data)\n      int 89\n  = str 'array2d'\n    arr (3)\n    - arr (1)\n      - str 'a'\n    - arr (0)\n    - arr (2)\n      - str 'b'\n      - str 'c'\n  = str 'owner'\n    map (6)\n    = str 'forename'\n      str 'Etienne'\n    = str 'surname'\n      str 'Colebourne'\n    = str 'numberOfCars'\n      int 1\n    = str 'middleNames'\n      arr (2)\n      - str 'K'\n      - str 'T'\n    = str 'addressList'\n      arr (1)\n      - map (1)\n        = str 'number'\n          int 0\n    = str 'codeCounts'\n      map (2)\n      = str 'A'\n        int 2\n      = str 'B'\n        int 1\n  = str 'object1'\n    map (1)\n    = ext type=34 'List' (meta)\n      arr (3)\n      - str 'a'\n      - str 'b'\n      - str 'c'\n  = str 'object2'\n    map (1)\n    = ext type=34 'Map' (meta)\n      map (2)\n      = str 'd'\n        int 1\n      = map (1)\n        = ext type=33 'java.util.Currency' (data)\n          str 'GBP'\n        int 2\n  = str 'serializable'\n    map (1)\n    = ext type=34 'List' (meta)\n      arr (3)\n      - str 'a'\n      - str 'b'\n      - str 'c'\n  = str 'objectInMap'\n    map (4)\n    = str 'A'\n      str 'Abba'\n    = str 'B'\n      map (1)\n      = ext type=34 'Set' (meta)\n        arr (2)\n        - str 'a'\n        - str 'b'\n    = str 'C'\n      map (1)\n      = ext type=34 'Set' (meta)\n        arr (3)\n        - map (1)\n          = ext type=33 'Locale' (data)\n            str 'fr_CA'\n        - map (1)\n          = ext type=33 'Long' (data)\n            int 2\n        - map (9)\n          = ext type=32 'PrimitiveBean' (bean)\n            nil\n          = str 'valueLong'\n            int 1\n          = str 'valueInt'\n            int 2\n          = str 'valueShort'\n            int 3\n          = str 'valueByte'\n            int 4\n          = str 'valueDouble'\n            dbl 5.0\n          = str 'valueFloat'\n            flt 6.0\n          = str 'valueChar'\n            str '7'\n          = str 'valueBoolean'\n            true\n    = str 'D'\n      map (1)\n      = ext type=34 'Map' (meta)\n        map (2)\n        = str 'd'\n          int 1\n        = str 'e'\n          int 2\n  = str 'listInMap'\n    map (1)\n    = str 'A'\n      arr (2)\n      - str 'B'\n      - str 'b'\n  = str 'listNumericInMap'\n    map (1)\n    = str 'A'\n      arr (3)\n      - int 3\n      - int 2\n      - int 1\n  = str 'listInListInMap'\n    map (1)\n    = str 'A'\n      arr (1)\n      - map (1)\n        = ext type=34 'List' (meta)\n          arr (3)\n          - int 3\n          - int 2\n          - int 1\n  = str 'objectListInListInMap'\n    map (2)\n    = str 'A'\n      arr (1)\n      - map (1)\n        = ext type=34 'List' (meta)\n          arr (2)\n          - map (1)\n            = ext type=33 'Currency' (data)\n              str 'GBP'\n          - map (1)\n            = ext type=33 'java.util.TimeZone' (data)\n              str 'Europe/London'\n    = str 'B'\n      arr (1)\n      - map (1)\n        = ext type=34 'List' (meta)\n          arr (3)\n          - map (1)\n            = ext type=33 'Locale' (data)\n              str 'fr_CA'\n          - map (1)\n            = ext type=33 'Long' (data)\n              int 2\n          - map (9)\n            = ext type=32 'PrimitiveBean' (bean)\n              nil\n            = str 'valueLong'\n              int 1\n            = str 'valueInt'\n              int 2\n            = str 'valueShort'\n              int 3\n            = str 'valueByte'\n              int 4\n            = str 'valueDouble'\n              dbl 5.0\n            = str 'valueFloat'\n              flt 6.0\n            = str 'valueChar'\n              str '7'\n            = str 'valueBoolean'\n              true\n  = str 'mapInMap'\n    map (1)\n    = map (4)\n      = str 'forename'\n        str 'Etiennette'\n      = str 'surname'\n        str 'Colebourne'\n      = str 'numberOfCars'\n        int 1\n      = str 'middleNames'\n        arr (0)\n      map (1)\n      = str 'sibling'\n        map (4)\n        = str 'forename'\n          str 'Kylie'\n        = str 'surname'\n          str 'Colebourne'\n        = str 'numberOfCars'\n          int 1\n        = str 'middleNames'\n          arr (0)\n  = str 'simpleTable'\n    arr (2)\n    - arr (3)\n      - int 1\n      - int 1\n      - str 'Hello'\n    - arr (3)\n      - int 1\n      - int 2\n      - str 'There'\n  = str 'compoundTable'\n    arr (3)\n    - arr (3)\n      - int 1\n      - int 1\n      - map (6)\n        = str 'forename'\n          str 'Etienne'\n        = str 'surname'\n          str 'Colebourne'\n        = str 'numberOfCars'\n          int 1\n        = str 'middleNames'\n          arr (2)\n          - str 'K'\n          - str 'T'\n        = str 'addressList'\n          arr (1)\n          - map (1)\n            = str 'number'\n              int 0\n        = str 'codeCounts'\n          map (2)\n          = str 'A'\n            int 2\n          = str 'B'\n            int 1\n    - arr (3)\n      - int 1\n      - int 2\n      - map (4)\n        = str 'forename'\n          str 'Etiennette'\n        = str 'surname'\n          str 'Colebourne'\n        = str 'numberOfCars'\n          int 1\n        = str 'middleNames'\n          arr (0)\n    - arr (3)\n      - int 2\n      - int 1\n      - map (4)\n        = str 'forename'\n          str 'Kylie'\n        = str 'surname'\n          str 'Colebourne'\n        = str 'numberOfCars'\n          int 1\n        = str 'middleNames'\n          arr (0)\n  = str 'sparseGrid'\n    arr (3)\n    - int 5\n    - int 5\n    - arr (3)\n      - int 1\n      - int 1\n      - map (4)\n        = str 'forename'\n          str 'Kylie'\n        = str 'surname'\n          str 'Colebourne'\n        = str 'numberOfCars'\n          int 1\n        = str 'middleNames'\n          arr (0)\n  = str 'denseGrid'\n    arr (8)\n    - int 2\n    - int 3\n    - map (4)\n      = str 'forename'\n        str 'Etiennette'\n      = str 'surname'\n        str 'Colebourne'\n      = str 'numberOfCars'\n        int 1\n      = str 'middleNames'\n        arr (0)\n    - nil\n    - nil\n    - nil\n    - map (4)\n      = str 'forename'\n        str 'Kylie'\n      = str 'surname'\n        str 'Colebourne'\n      = str 'numberOfCars'\n        int 1\n      = str 'middleNames'\n        arr (0)\n    - nil\n  = str 'beanBeanMap'\n    map (1)\n    = map (4)\n      = str 'forename'\n        str 'Etiennette'\n      = str 'surname'\n        str 'Colebourne'\n      = str 'numberOfCars'\n        int 1\n      = str 'middleNames'\n        arr (0)\n      map (17)\n      = str 'number'\n        int 185\n      = str 'street'\n        str 'Park Street'\n      = str 'city'\n        str 'London'\n      = str 'data'\n        bin '404142'\n      = str 'owner'\n        map (4)\n        = str 'forename'\n          str 'Etiennette'\n        = str 'surname'\n          str 'Colebourne'\n        = str 'numberOfCars'\n          int 1\n        = str 'middleNames'\n          arr (0)\n      = str 'object1'\n        map (1)\n        = ext type=33 'Risk' (data)\n          str 'MEDIUM'\n      = str 'object2'\n        map (1)\n        = ext type=33 'RiskPerception' (data)\n          str 'LOW'\n      = str 'risk'\n        str 'LOW'\n      = str 'riskLevel'\n        str 'HIGH'\n      = str 'riskLevels'\n        arr (2)\n        - str 'LOW'\n        - str 'MEDIUM'\n      = str 'objectInMap'\n        map (0)\n      = str 'listInMap'\n        map (0)\n      = str 'listNumericInMap'\n        map (0)\n      = str 'listInListInMap'\n        map (0)\n      = str 'objectListInListInMap'\n        map (0)\n      = str 'mapInMap'\n        map (0)\n      = str 'beanBeanMap'\n        map (0)\n  = str 'doubleVector'\n    arr (3)\n    - dbl 1.1\n    - dbl 2.2\n    - dbl 3.3\n  = str 'matrix'\n    arr (2)\n    - arr (2)\n      - dbl 1.1\n      - dbl 2.2\n    - arr (1)\n      - dbl 3.2"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmAddress2.json",
    "content": "{\n \"@bean\": \"org.joda.beans.sample.ImmAddress\",\n \"number\": 185,\n \"street\": \"Park Street\",\n \"city\": \"London & Capital of the World <!>\\n\",\n \"abstractNumber\": {\n  \"@type\": \"Short\",\n  \"value\": 89\n },\n \"array2d\": [[\"a\"], [], [\"b\", \"c\"]],\n \"owner\": {\n  \"forename\": \"Etienne\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": [\"K\", \"T\"],\n  \"addressList\": [{\n   \"number\": 0\n  }],\n  \"codeCounts\": [[\"A\", 2], [\"B\", 1]]\n },\n \"object1\": {\n  \"@meta\": \"List\",\n  \"value\": [\"a\", \"b\", \"c\"]\n },\n \"object2\": {\n  \"@meta\": \"Map\",\n  \"value\": [[\"d\", 1], [{\n   \"@type\": \"java.util.Currency\",\n   \"value\": \"GBP\"\n  }, 2]]\n },\n \"serializable\": {\n  \"@meta\": \"List\",\n  \"value\": [\"a\", \"b\", \"c\"]\n },\n \"objectInMap\": {\n  \"A\": \"Abba\",\n  \"B\": {\n   \"@meta\": \"Set\",\n   \"value\": [\"a\", \"b\"]\n  },\n  \"C\": {\n   \"@meta\": \"Set\",\n   \"value\": [{\n    \"@type\": \"Locale\",\n    \"value\": \"fr_CA\"\n   }, {\n    \"@type\": \"Long\",\n    \"value\": 2\n   }, {\n    \"@bean\": \"PrimitiveBean\",\n    \"valueLong\": 1,\n    \"valueInt\": 2,\n    \"valueShort\": 3,\n    \"valueByte\": 4,\n    \"valueDouble\": 5.0,\n    \"valueFloat\": 6.0,\n    \"valueChar\": \"7\",\n    \"valueBoolean\": true\n   }]\n  },\n  \"D\": {\n   \"@meta\": \"Map\",\n   \"value\": [[\"d\", 1], [\"e\", 2]]\n  }\n },\n \"listInMap\": {\n  \"A\": [\"B\", \"b\"]\n },\n \"listNumericInMap\": {\n  \"A\": [3, 2, 1]\n },\n \"listInListInMap\": {\n  \"A\": [{\n   \"@meta\": \"List\",\n   \"value\": [3, 2, 1]\n  }]\n },\n \"objectListInListInMap\": {\n  \"A\": [{\n   \"@meta\": \"List\",\n   \"value\": [{\n    \"@type\": \"Currency\",\n    \"value\": \"GBP\"\n   }, {\n    \"@type\": \"java.util.TimeZone\",\n    \"value\": \"Europe/London\"\n   }]\n  }],\n  \"B\": [{\n   \"@meta\": \"List\",\n   \"value\": [{\n    \"@type\": \"Locale\",\n    \"value\": \"fr_CA\"\n   }, {\n    \"@type\": \"Long\",\n    \"value\": 2\n   }, {\n    \"@bean\": \"PrimitiveBean\",\n    \"valueLong\": 1,\n    \"valueInt\": 2,\n    \"valueShort\": 3,\n    \"valueByte\": 4,\n    \"valueDouble\": 5.0,\n    \"valueFloat\": 6.0,\n    \"valueChar\": \"7\",\n    \"valueBoolean\": true\n   }]\n  }]\n },\n \"mapInMap\": [[{\n  \"forename\": \"Etiennette\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }, {\n  \"sibling\": {\n   \"forename\": \"Kylie\",\n   \"surname\": \"Colebourne\",\n   \"numberOfCars\": 1,\n   \"middleNames\": []\n  }\n }]],\n \"simpleTable\": [[1, 1, \"Hello\"], [1, 2, \"There\"]],\n \"compoundTable\": [[1, 1, {\n  \"forename\": \"Etienne\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": [\"K\", \"T\"],\n  \"addressList\": [{\n   \"number\": 0\n  }],\n  \"codeCounts\": [[\"A\", 2], [\"B\", 1]]\n }], [1, 2, {\n  \"forename\": \"Etiennette\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }], [2, 1, {\n  \"forename\": \"Kylie\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }]],\n \"sparseGrid\": [5, 5, [1, 1, {\n  \"forename\": \"Kylie\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }]],\n \"denseGrid\": [2, 3, [0, 0, {\n  \"forename\": \"Etiennette\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }], [1, 1, {\n  \"forename\": \"Kylie\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }]],\n \"beanBeanMap\": [[{\n  \"forename\": \"Etiennette\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }, {\n  \"number\": 185,\n  \"street\": \"Park Street\",\n  \"city\": \"London\",\n  \"data\": \"QEFC\",\n  \"owner\": {\n   \"forename\": \"Etiennette\",\n   \"surname\": \"Colebourne\",\n   \"numberOfCars\": 1,\n   \"middleNames\": []\n  },\n  \"object1\": {\n   \"@type\": \"Risk\",\n   \"value\": \"MEDIUM\"\n  },\n  \"object2\": {\n   \"@type\": \"RiskPerception\",\n   \"value\": \"LOW\"\n  },\n  \"risk\": \"LOW\",\n  \"riskLevel\": \"HIGH\",\n  \"riskLevels\": [\"LOW\", \"MEDIUM\"],\n  \"objectInMap\": {},\n  \"listInMap\": {},\n  \"listNumericInMap\": {},\n  \"listInListInMap\": {},\n  \"objectListInListInMap\": {},\n  \"mapInMap\": [],\n  \"beanBeanMap\": []\n }]],\n \"doubleVector\": [1.1, 2.2, 3.3],\n \"matrix\": [[1.1, 2.2], [3.2]]\n}\n"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmAddress2.simplejson",
    "content": "{\n \"number\": 185,\n \"street\": \"Park Street\",\n \"city\": \"London & Capital of the World <!>\\n\",\n \"abstractNumber\": 89,\n \"array2d\": [[\"a\"], [], [\"b\", \"c\"]],\n \"owner\": {\n  \"forename\": \"Etienne\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": [\"K\", \"T\"],\n  \"addressList\": [{\n   \"number\": 0\n  }],\n  \"codeCounts\": [[\"A\", 2], [\"B\", 1]]\n },\n \"object1\": [\"a\", \"b\", \"c\"],\n \"object2\": {\n  \"d\": 1,\n  \"GBP\": 2\n },\n \"serializable\": [\"a\", \"b\", \"c\"],\n \"objectInMap\": {\n  \"A\": \"Abba\",\n  \"B\": [\"a\", \"b\"],\n  \"C\": [\"fr_CA\", 2, {\n   \"valueLong\": 1,\n   \"valueInt\": 2,\n   \"valueShort\": 3,\n   \"valueByte\": 4,\n   \"valueDouble\": 5.0,\n   \"valueFloat\": 6.0,\n   \"valueChar\": \"7\",\n   \"valueBoolean\": true\n  }],\n  \"D\": {\n   \"d\": 1,\n   \"e\": 2\n  }\n },\n \"listInMap\": {\n  \"A\": [\"B\", \"b\"]\n },\n \"listNumericInMap\": {\n  \"A\": [3, 2, 1]\n },\n \"listInListInMap\": {\n  \"A\": [[3, 2, 1]]\n },\n \"objectListInListInMap\": {\n  \"A\": [[\"GBP\", \"Europe/London\"]],\n  \"B\": [[\"fr_CA\", 2, {\n   \"valueLong\": 1,\n   \"valueInt\": 2,\n   \"valueShort\": 3,\n   \"valueByte\": 4,\n   \"valueDouble\": 5.0,\n   \"valueFloat\": 6.0,\n   \"valueChar\": \"7\",\n   \"valueBoolean\": true\n  }]]\n },\n \"mapInMap\": {},\n \"simpleTable\": [[1, 1, \"Hello\"], [1, 2, \"There\"]],\n \"compoundTable\": [[1, 1, {\n  \"forename\": \"Etienne\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": [\"K\", \"T\"],\n  \"addressList\": [{\n   \"number\": 0\n  }],\n  \"codeCounts\": [[\"A\", 2], [\"B\", 1]]\n }], [1, 2, {\n  \"forename\": \"Etiennette\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }], [2, 1, {\n  \"forename\": \"Kylie\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }]],\n \"sparseGrid\": [5, 5, [1, 1, {\n  \"forename\": \"Kylie\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }]],\n \"denseGrid\": [2, 3, [0, 0, {\n  \"forename\": \"Etiennette\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }], [1, 1, {\n  \"forename\": \"Kylie\",\n  \"surname\": \"Colebourne\",\n  \"numberOfCars\": 1,\n  \"middleNames\": []\n }]],\n \"beanBeanMap\": {},\n \"doubleVector\": [1.1, 2.2, 3.3],\n \"matrix\": [[1.1, 2.2], [3.2]]\n}"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmAddressCached1.packbinstr",
    "content": "arr (3)\n- int 3\n- str 'org.joda.beans.sample.'\n- @type ImmAddress\n  bean (26)\n  - str 'number'\n  - str 'street'\n  - str 'city'\n  - str 'abstractNumber'\n  - str 'data'\n  - str 'array2d'\n  - str 'owner'\n  - str 'object1'\n  - str 'object2'\n  - str 'risk'\n  - str 'riskLevel'\n  - str 'riskLevels'\n  - str 'serializable'\n  - str 'objectInMap'\n  - str 'listInMap'\n  - str 'listNumericInMap'\n  - str 'listInListInMap'\n  - str 'objectListInListInMap'\n  - str 'mapInMap'\n  - str 'simpleTable'\n  - str 'compoundTable'\n  - str 'sparseGrid'\n  - str 'denseGrid'\n  - str 'beanBeanMap'\n  - str 'doubleVector'\n  - str 'matrix'\n  - int 185\n  - str 'Park Street'\n  - str 'London & Capital of the World <!>\n'\n  - sht 89\n  - null\n  - arr (3)\n    - arr (1)\n      - str 'a'\n    - arr (0)\n    - arr (2)\n      - str 'b'\n      - str 'c'\n  - @value \n    @type ImmPerson\n    bean (10)\n    - str 'forename'\n    - str 'surname'\n    - str 'numberOfCars'\n    - str 'dateOfBirth'\n    - str 'middleNames'\n    - str 'addressList'\n    - str 'otherAddressMap'\n    - str 'addressesList'\n    - str 'mainAddress'\n    - str 'codeCounts'\n    - str 'Etienne'\n    - str 'Colebourne'\n    - int 1\n    - null\n    - arr (2)\n      - str 'K'\n      - str 'T'\n    - arr (1)\n      - @type Address\n        bean (4)\n        - ref 1 'number'\n        - ref 2 'street'\n        - ref 3 'city'\n        - ref 7 'owner'\n        - int 0\n        - null\n        - null\n        - null\n    - null\n    - null\n    - null\n    - map (2)\n      = str 'A'\n        int 2\n      = str 'B'\n        int 1\n  - @typeref List\n    arr (3)\n    - str 'a'\n    - str 'b'\n    - str 'c'\n  - @typeref Map\n    map (2)\n    = str 'd'\n      int 1\n    = @value \n      @type java.util.Currency\n      str 'GBP'\n      int 2\n  - null\n  - null\n  - null\n  - @typeref List\n    arr (3)\n    - str 'a'\n    - str 'b'\n    - str 'c'\n  - map (4)\n    = str 'A'\n      str 'Abba'\n    = str 'B'\n      @typeref Set\n      arr (2)\n      - str 'a'\n      - str 'b'\n    = str 'C'\n      @typeref Set\n      arr (3)\n      - @value \n        @type Locale\n        str 'fr_CA'\n      - lng 2\n      - @type PrimitiveBean\n        bean (8)\n        - str 'valueLong'\n        - str 'valueInt'\n        - str 'valueShort'\n        - str 'valueByte'\n        - str 'valueDouble'\n        - str 'valueFloat'\n        - str 'valueChar'\n        - str 'valueBoolean'\n        - lng 1\n        - int 2\n        - sht 3\n        - byt 4\n        - dbl 5.0\n        - flt 6.0\n        - chr 7\n        - true\n    = str 'D'\n      @typeref Map\n      map (2)\n      = str 'd'\n        int 1\n      = str 'e'\n        int 2\n  - map (1)\n    = str 'A'\n      arr (2)\n      - str 'B'\n      - str 'b'\n  - map (1)\n    = str 'A'\n      arr (3)\n      - int 3\n      - int 2\n      - int 1\n  - map (1)\n    = str 'A'\n      arr (1)\n      - arr (3)\n        - int 3\n        - int 2\n        - int 1\n  - map (2)\n    = str 'A'\n      arr (1)\n      - arr (2)\n        - ref 43 'GBP'\n        - @value \n          @type java.util.TimeZone\n          str 'Europe/London'\n    = str 'B'\n      arr (1)\n      - arr (3)\n        - ref 46 'fr_CA'\n        - lng 2\n        - @typeref 5 PrimitiveBean\n          arr (8)\n          - lng 1\n          - int 2\n          - sht 3\n          - byt 4\n          - dbl 5.0\n          - flt 6.0\n          - chr 7\n          - true\n  - map (1)\n    = @value \n      @typeref 1 ImmPerson\n      arr (10)\n      - str 'Etiennette'\n      - ref 40 'Colebourne'\n      - int 1\n      - null\n      - arr (0)\n      - null\n      - null\n      - null\n      - null\n      - null\n      map (1)\n      = str 'sibling'\n        @value \n        @typeref 1 ImmPerson\n        arr (10)\n        - str 'Kylie'\n        - ref 40 'Colebourne'\n        - int 1\n        - null\n        - arr (0)\n        - null\n        - null\n        - null\n        - null\n        - null\n  - map (1)\n    = int 1\n      map (2)\n      = int 1\n        str 'Hello'\n      = int 2\n        str 'There'\n  - map (2)\n    = int 1\n      map (2)\n      = int 1\n        ref 41 '<bean>'\n      = int 2\n        ref 58 '<bean>'\n    = int 2\n      map (1)\n      = int 1\n        ref 61 '<bean>'\n  - arr (3)\n    - int 5\n    - int 5\n    - arr (3)\n      - int 1\n      - int 1\n      - ref 61 '<bean>'\n  - arr (3)\n    - int 2\n    - int 3\n    - arr (6)\n      - int 0\n      - int 0\n      - ref 58 '<bean>'\n      - int 1\n      - int 1\n      - ref 61 '<bean>'\n  - map (1)\n    = ref 58 '<bean>'\n      arr (26)\n      - int 185\n      - ref 27 'Park Street'\n      - str 'London'\n      - null\n      - bin '404142'\n      - null\n      - ref 58 '<bean>'\n      - @value \n        @type Risk\n        str 'MEDIUM'\n      - @value \n        @type RiskPerception\n        str 'LOW'\n      - @value \n        @typeref 7 Risk\n        ref 67 'LOW'\n      - @value \n        @typeref 7 Risk\n        str 'HIGH'\n      - arr (2)\n        - ref 69 'LOW'\n        - ref 66 'MEDIUM'\n      - null\n      - map (0)\n      - map (0)\n      - map (0)\n      - map (0)\n      - map (0)\n      - map (0)\n      - null\n      - null\n      - null\n      - null\n      - map (0)\n      - null\n      - null\n  - dbl [1.1,2.2,3.3]\n  - arr (2)\n    - dbl [1.1,2.2]\n    - dbl [3.2]"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmArrays1.binstr",
    "content": "arr (2)\n- int 1\n- map (7)\n  = ext type=32 'org.joda.beans.sample.ImmArrays' (bean)\n    nil\n  = str 'intArray'\n    str '1,3,2'\n  = str 'longArray'\n    str '1,4,3'\n  = str 'doubleArray'\n    str '1.1,2.2,3.3'\n  = str 'booleanArray'\n    str 'TF'\n  = str 'intArray2d'\n    map (1)\n    = ext type=34 'int[][]' (meta)\n      arr (3)\n      - str '1,2'\n      - str '2'\n      - str ''\n  = str 'booleanArray2d'\n    map (1)\n    = ext type=34 'boolean[][]' (meta)\n      arr (3)\n      - str 'TF'\n      - str 'F'\n      - str ''"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmArrays1.json",
    "content": "{\n \"@bean\": \"org.joda.beans.sample.ImmArrays\",\n \"intArray\": \"1,3,2\",\n \"longArray\": \"1,4,3\",\n \"doubleArray\": \"1.1,2.2,3.3\",\n \"booleanArray\": \"TF\",\n \"intArray2d\": {\n  \"@meta\": \"int[][]\",\n  \"value\": [\"1,2\", \"2\", \"\"]\n },\n \"booleanArray2d\": {\n  \"@meta\": \"boolean[][]\",\n  \"value\": [\"TF\", \"F\", \"\"]\n }\n}"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmArrays1.packbinstr",
    "content": "arr (3)\n- int 3\n- str 'org.joda.beans.sample.'\n- @type ImmArrays\n  bean (6)\n  - str 'intArray'\n  - str 'longArray'\n  - str 'doubleArray'\n  - str 'booleanArray'\n  - str 'intArray2d'\n  - str 'booleanArray2d'\n  - arr (3)\n    - int 1\n    - int 3\n    - int 2\n  - arr (3)\n    - lng 1\n    - lng 4\n    - lng 3\n  - dbl [1.1,2.2,3.3]\n  - arr (2)\n    - true\n    - false\n  - arr (3)\n    - arr (2)\n      - int 1\n      - int 2\n    - arr (1)\n      - int 2\n    - arr (0)\n  - arr (3)\n    - arr (2)\n      - true\n      - false\n    - arr (1)\n      - false\n    - arr (0)"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmArrays1.refbinstr",
    "content": "arr (4)\n- int 2\n- int 0\n- map (1)\n  = str 'org.joda.beans.sample.ImmArrays'\n    arr (6)\n    - str 'intArray'\n    - str 'longArray'\n    - str 'doubleArray'\n    - str 'booleanArray'\n    - str 'intArray2d'\n    - str 'booleanArray2d'\n- arr (7)\n  - ext type=32 '0' (bean)\n  - str '1,3,2'\n  - str '1,4,3'\n  - str '1.1,2.2,3.3'\n  - str 'TF'\n  - map (1)\n    = ext type=34 'int[][]' (meta)\n      arr (3)\n      - str '1,2'\n      - str '2'\n      - str ''\n  - map (1)\n    = ext type=34 'boolean[][]' (meta)\n      arr (3)\n      - str 'TF'\n      - str 'F'\n      - str ''"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmArrays1.simplejson",
    "content": "{\n \"intArray\": [1, 3, 2],\n \"longArray\": [1, 4, 3],\n \"doubleArray\": [1.1, 2.2, 3.3],\n \"booleanArray\": [true, false],\n \"intArray2d\": [\"1,2\", \"2\", \"\"],\n \"booleanArray2d\": [\"TF\", \"F\", \"\"]\n}\n"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmArrays2.binstr",
    "content": "arr (2)\n- int 1\n- map (7)\n  = ext type=32 'org.joda.beans.sample.ImmArrays' (bean)\n    nil\n  = str 'intArray'\n    arr (3)\n    - int 1\n    - int 3\n    - int 2\n  = str 'longArray'\n    arr (3)\n    - int 1\n    - int 4\n    - int 3\n  = str 'doubleArray'\n    arr (3)\n    - dbl 1.1\n    - dbl 2.2\n    - dbl 3.3\n  = str 'booleanArray'\n    arr (2)\n    - true\n    - false\n  = str 'intArray2d'\n    arr (3)\n    - arr (2)\n      - int 1\n      - int 2\n    - arr (1)\n      - int 2\n    - arr (0)\n  = str 'booleanArray2d'\n    arr (3)\n    - arr (2)\n      - true\n      - false\n    - arr (1)\n      - false\n    - arr (0)"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmArrays2.json",
    "content": "{\n \"@bean\": \"org.joda.beans.sample.ImmArrays\",\n \"intArray\": [1, 3, 2],\n \"longArray\": [1, 4, 3],\n \"doubleArray\": [1.1, 2.2, 3.3],\n \"booleanArray\": [true, false],\n \"intArray2d\": [[1, 2], [2], []],\n \"booleanArray2d\": [[true, false], [false], []]\n}\n"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmArrays2.simplejson",
    "content": "{\n \"intArray\": [1, 3, 2],\n \"longArray\": [1, 4, 3],\n \"doubleArray\": [1.1, 2.2, 3.3],\n \"booleanArray\": [true, false],\n \"intArray2d\": [[1, 2], [2], []],\n \"booleanArray2d\": [[true, false], [false], []]\n}\n"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmOptional.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<bean type=\"org.joda.beans.sample.ImmOptional\">\n <optString>A</optString>\n <twelve>12</twelve>\n</bean>"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmOptional1.packbinstr",
    "content": "arr (3)\n- int 3\n- str 'org.joda.beans.sample.'\n- @type ImmOptional\n  bean (7)\n  - str 'optString'\n  - str 'optStringEmpty'\n  - str 'optStringGetter'\n  - str 'optLongGetter'\n  - str 'optIntGetter'\n  - str 'optDoubleGetter'\n  - str 'twelve'\n  - arr (1)\n    - str 'A'\n  - arr (0)\n  - null\n  - null\n  - null\n  - null\n  - int 12"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmOptional1.refbinstr",
    "content": "arr (4)\n- int 2\n- int 0\n- map (1)\n  = str 'org.joda.beans.sample.ImmOptional'\n    arr (6)\n    - str 'optString'\n    - str 'optStringEmpty'\n    - str 'optStringGetter'\n    - str 'optLongGetter'\n    - str 'optIntGetter'\n    - str 'optDoubleGetter'\n- arr (7)\n  - ext type=32 '0' (bean)\n  - str 'A'\n  - nil\n  - nil\n  - nil\n  - nil\n  - nil"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmOptional2.binstr",
    "content": "arr (2)\n- int 1\n- map (3)\n  = ext type=32 'org.joda.beans.sample.ImmOptional' (bean)\n    nil\n  = str 'optString'\n    str 'A'\n  = str 'twelve'\n    int 12"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmOptional2.json",
    "content": "{\n \"@bean\": \"org.joda.beans.sample.ImmOptional\",\n \"optString\": \"A\",\n \"twelve\": 12\n}\n"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/ImmOptional2.simplejson",
    "content": "{\n \"optString\": \"A\",\n \"twelve\": 12\n}\n"
  },
  {
    "path": "src/test/resources/org/joda/beans/ser/SimpleJson2.simplejson",
    "content": "{\n \"primitiveChar\": \"a\",\n \"primitiveByte\": 23,\n \"primitiveShort\": 12,\n \"primitiveInt\": 9,\n \"primitiveLong\": 6,\n \"primitiveFloat\": 3.4,\n \"primitiveDouble\": 2.3,\n \"primitiveDoubleNaN\": null,\n \"primitiveDoubleInf\": \"Infinity\",\n \"abstractNumber\": 29,\n \"arrayByte\": \"QEFC\",\n \"array2d\": [[\"a\"], [], [\"b\", \"c\"]],\n \"string\": \"ABBA\",\n \"bean\": {\n  \"name\": \"Cat\"\n },\n \"object1\": [\"a\", \"b\", \"c\"],\n \"object2\": {\n  \"d\": 1,\n  \"12\": \"2\"\n },\n \"risk\": \"LOW\",\n \"riskLevel\": \"HIGH\",\n \"riskLevels\": [\"LOW\", \"MEDIUM\"],\n \"stringList\": [\"a\", \"b\", \"c\"],\n \"beanList\": [{\n  \"name\": \"Cat\"\n }, {\n  \"name\": \"Dog\"\n }],\n \"stringMap\": {\n  \"a\": \"A\",\n  \"b\": \"B\"\n },\n \"intKeyMap\": {\n  \"1\": \"A\",\n  \"2\": \"B\"\n },\n \"beanMap\": {\n  \"a\": {\n   \"name\": \"Cat\"\n  },\n  \"b\": {\n   \"name\": \"Dog\"\n  }\n },\n \"listInMap\": {\n  \"A\": [\"B\", \"b\"]\n },\n \"listNumericInMap\": {\n  \"A\": [3, 2, 1]\n },\n \"objectInMap\": {\n  \"a\": 2147483648\n }\n}\n"
  }
]