Skip to content

[JAXRS-CXF] Enhancement: generate builder-style methods in models #4386

@MatanRubin

Description

@MatanRubin

Currently, JAXRS-CXF codegen generates getters and setters for model members.
The Java code generator has the nice feature of generating builder-style methods as well.
The suggestion is to generate builder style methods in JAXRS-CXF as well.

Making this change would allow us to get rid of cummbersome code like this:

MyResponse response = new MyResponse();
reponse.setName("Mickey");
response.setLastName("Mouse");
response.setAge(89);
return response;

For this:

return new MyResponse().name("Mickey").lastName("Mouse").age(89);

Swagger-codegen version: 2.2.1

I can contribute this fix myself, but wanted to make sure first that it's something we want.
@wing328, let me know if you want me to work on this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions