Adding an option to configure an entity/dto class name suffix.
Some naming conventions force you to have the entity's class suffixed by 'Entity' and the DTO's class without suffix.
For example, a 'foo' entity will produce :
FooEntity for the entity class name ;Foo for the DTO class name ;Other classes name don't change (FooService, FooRepository, etc).
The default configuration would be an empty string for the entity suffix and 'DTO' for the dto suffix to reflect the current behaviour.
This configuration would be "application-wide" (no prompt on entity generation) and saved in the .yo-rc.json.
I have done almost all the job to see the feasibility of this feature (just took me about 1 hour for the simple case - without relationships). 馃挭
I can make a PR as soon as all the work is done (unless a jHipster core member says it's not a good idea).
None.
I'm ok if below conditions are satisfied
OK, just to give you a quick status :
--domain-suffix and --dto-suffix flags with app generationI have added two functions inside the entity-server generator : asDomain(string) and asDto(string) to add the appropriate suffix. These functions are used inside the templates. Thanks to that, it will be super easy to change the behaviour for generating the class & variables names (add a prefix, get the suffix from another config key or something else).
For example, the entity class declaration looks like this now :
public class <%= asDomain(entityClass) %> implements Serializable { ... }
And a field declaration :
private <%= asDomain(entityClass) %> <%= asDomain(entityInstance) %>;
I'll do the PR very soon.
Any feedback is welcome 馃槈
PR submitted : #8649
PR for jhipster-core : https://github.com/jhipster/jhipster-core/pull/274
closing as PR merged. @mselerin next time please add the fix or close keyword on PR description to autoclose ticket
closing as PR merged. @mselerin next time please add the fix or close keyword on PR description to autoclose ticket
Didn't see that the PR was merged... But, sure thing for next time !
Most helpful comment
I'm ok if below conditions are satisfied