Skip to content

[JAXRS-CXF] [issue #4386] add builder-style methods to model classes#4468

Merged
wing328 merged 2 commits intoswagger-api:masterfrom
MatanRubin:builder-methods-pr
Jan 31, 2017
Merged

[JAXRS-CXF] [issue #4386] add builder-style methods to model classes#4468
wing328 merged 2 commits intoswagger-api:masterfrom
MatanRubin:builder-methods-pr

Conversation

@MatanRubin
Copy link
Copy Markdown
Contributor

Before this change, model classes had only a default constructor and setter methods, resulting in code like this:

myModel = MyModel();
myModel.setFirstField(firstField);
myModel.setSecondField(secondField);
return myModel;

this change adds builder style methods, such that the above code can be written more compactly:

return MyModel().firstField(firstField).secondField(secondField);

this is consistent with other JAVA generators in swagger-codegen.

@MatanRubin
Copy link
Copy Markdown
Contributor Author

@wing328, I'm not really sure why the checks failed. Can you help me understand?

@MatanRubin MatanRubin changed the title [issue #4386] add builder-style methods to model classes [JAXRS-CXF] [issue #4386] add builder-style methods to model classes Dec 28, 2016
@wing328 wing328 added this to the v2.2.2 milestone Jan 3, 2017
@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Jan 6, 2017

@MatanRubin the CI failure with Appveyor can be ignore. Other CI test results look good after I restarted the jobs.

@MatanRubin
Copy link
Copy Markdown
Contributor Author

@wing328, ok, cool. Thanks for the update.

@MatanRubin
Copy link
Copy Markdown
Contributor Author

Hi @wing328, is there anything else I need to do for this one to be merged in?

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Jan 29, 2017

@MatanRubin I don't think so. I will perform another set of tests after the AU Open Final. Last time I encountered some issues testing the change but probably due to issues with my machine.

…el classes

before this change, model classes had only a default constructor and
setter methods, resulting in code like this:

    myModel = MyModel();
    myModel.setFirstField(firstField);
    myModel.setSecondField(secondField);
    return myModel;

this change adds builder style methods, such that the above code can be
written more compactly:

    return MyModel().firstField(firstField).secondField(secondField);

this is consistent with other JAVA generators in swagger-codegen.
@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Jan 31, 2017

@MatanRubin thanks for doing another push to resolve the CI failure. I'm performing some tests right now...

@wing328 wing328 merged commit 8042f5c into swagger-api:master Jan 31, 2017
@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Jan 31, 2017

@MatanRubin thanks for the PR, which has been merged into master.

If there's one minor enhancement I can suggest, it would be adding a doc string to the builder-style methods so that the help text will be displayed in the IDE.

davidgri pushed a commit to davidgri/swagger-codegen that referenced this pull request May 11, 2017
…el classes (swagger-api#4468)

* [JAXRS-CXF] [issue swagger-api#4386] add builder-style methods to model classes

before this change, model classes had only a default constructor and
setter methods, resulting in code like this:

    myModel = MyModel();
    myModel.setFirstField(firstField);
    myModel.setSecondField(secondField);
    return myModel;

this change adds builder style methods, such that the above code can be
written more compactly:

    return MyModel().firstField(firstField).secondField(secondField);

this is consistent with other JAVA generators in swagger-codegen.

* update jaxrs-cxf sample code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants