Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java, adds map builders [breaking] #347

Merged
merged 62 commits into from
Jan 5, 2024
Merged

Conversation

spacether
Copy link
Contributor

@spacether spacether commented Dec 31, 2023

Java,

  • Adds builders for map payloads
  • Builders contain type constrained property assignment, done via setter interfaces that the builders use
  • Builders ensure that required properties are set before build() may be called by using sequential builders; n! (where n is the number of required properties) builders created
  • If keys are not valid method names, then enum code is used to name the method with a set prefix, CodegenKey.camelCase value is used for method name
  • The last invoked builder allows setting of optional properties and additional properties
  • MapMaker
    • renamed to MapUtils because method throwIfKeyKnown added to it
    • moved into the validation package because it is used by FrozenMap
  • code samples now include both map and list builders if they exist
  • checker framework updated to 3.35.0 to fix a bug where var types were not taken from the right assignment side

Note: the MapBuilder cannot be used in v303 type object tests because the input keys may not be in required to optional to addProps order

Breaking Change

  • Java CodegenKey class updated
  • camelCase -> pascalCase (because these were actually PascalCase and are used in class names)
  • camelCase added and used with java generator for setter method names
    • keys with this property are used by map builders when setting properties with invalid names
  • anchorPiece -> kebabCase (used in documentation anchors)
  • Some generator methods updated to mention pascalCase rather than camelCase

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    mvn clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/python*.
    For Windows users, please run the script in Git BASH.

@spacether spacether marked this pull request as draft December 31, 2023 02:54
@spacether spacether changed the title Java, adds map builder Java, adds map builders Dec 31, 2023
@spacether spacether marked this pull request as ready for review January 5, 2024 04:27
@spacether spacether merged commit ad77012 into master Jan 5, 2024
5 checks passed
@spacether spacether deleted the feat_adds_java_map_builder branch January 5, 2024 04:27
@spacether spacether mentioned this pull request Jan 5, 2024
@spacether spacether changed the title Java, adds map builders Java, adds map builders [breaking] Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant