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

Option for generating CamelCase names #39

Closed
joelittlejohn opened this issue Jun 23, 2013 · 5 comments
Closed

Option for generating CamelCase names #39

joelittlejohn opened this issue Jun 23, 2013 · 5 comments

Comments

@joelittlejohn
Copy link
Owner

Original author: winson.q...@gmail.com (January 25, 2012 19:35:34)

There is currently no way to ask jsonschema2pojo to generate the camel case names. This will be great feature.

We should also be abl to specify this as the default on higher level (like the class level) so we don't have to do that for every property.

Original issue: http://code.google.com/p/jsonschema2pojo/issues/detail?id=39

@joelittlejohn
Copy link
Owner Author

From joelittl...@gmail.com on January 25, 2012 19:58:43
winson, out of interest, how are you using jsonschema2pojo? Maven, Ant, CLI or embedded?

@joelittlejohn
Copy link
Owner Author

From winson.q...@gmail.com on January 25, 2012 20:41:53
I use ant to drive jsonschema2pojo to generate the POJO.

@joelittlejohn
Copy link
Owner Author

From joelittl...@gmail.com on January 31, 2012 00:05:06
Fixed with a new property:

propertyWordDelimiters

(present on the Maven plugin, Ant task and CLI).

This allows users to specify some characters that should be considered as word delimiters when creating Java bean property names. The words between the delimiters will then become camel case. For example, if I set

propertyWordDelimiters="-_"

i.e. hyphens and underscores, then this JSON property:

"my-json-property_one_two_three"

Will be mapped to this Java bean property:

myJsonPropertyOneTwoThree

This feature will arrive in 0.2.2.

Note: Maven properties are currently trimmed and so a space char at the beginning or end of the list of delimiters will be ignored (see http://jira.codehaus.org/browse/MODELLO-256). As a workaround, surround your space char with other separator chars, e.g:

_ -

or

@djarnis73
Copy link
Contributor

djarnis73 commented Sep 13, 2016

I'm in the process of converting a maven project to gradle and got bitten by the fact that that gradle plugin does not have a default value for this setting. Is that an oversight or by choice?

When adding the property like:

jsonSchema2Pojo {
    propertyWordDelimiters = "- _"
}

The generated code was the same as with the maven plugin. If I can figure out how to set a default value in the gradle plugin I can submit a PR.

@thachhoang
Copy link
Collaborator

@djarnis73 There's an open ticket for this bug: #162.

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

No branches or pull requests

3 participants