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

Getter Setter wrong names #840

Closed
radlik01 opened this issue Mar 8, 2018 · 2 comments
Closed

Getter Setter wrong names #840

radlik01 opened this issue Mar 8, 2018 · 2 comments

Comments

@radlik01
Copy link

radlik01 commented Mar 8, 2018

In the latest.integration gradle plugin we are facing the issue with the getter/setter names generation.

in case of json like
{ "id": "http://some.site.somewhere/entry-schema#", "$schema": "http://json-schema.org/draft-04/schema#", "description": "schema for risks data", "type": "object", "javaInterfaces": ["java.io.Serializable", "Cloneable"], "required": ["ris_id"], "properties": { "v_item_hidden": { "type": "boolean", "default": "false" }, .... } }

the generated getter/setter for v_item_hidden is getvItemHidden() instead of getVItemHidden().

@joelittlejohn
Copy link
Owner

joelittlejohn commented Mar 8, 2018

Hi. I assume you are using the default propertyWordDelimiters, and so the Java name for this field is vItemHidden. Is that right?

The Java Bean convention (that defines how getters and setters should be named) dictates that a getter called getVItemHidden relates to a Java field named VItemHidden. If you have a field named vItemHidden then the correct name for the getter is getvItemHidden.

This relates to changes made in #756. It's one of the breaking changes that have forced the latest jsonschema2pojo release to move from 0.x to 1.x. There's more information about this particular quirk of the Java Bean spec here:

If you have some other tool or library that expects the gett for vItemHidden to be getVItemHidden then that library or tool has a bug.

@radlik01
Copy link
Author

radlik01 commented Mar 9, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants