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

Models: using default methods for builder methods? #236

Closed
jmini opened this issue Jul 12, 2018 · 4 comments
Closed

Models: using default methods for builder methods? #236

jmini opened this issue Jul 12, 2018 · 4 comments

Comments

@jmini
Copy link
Contributor

jmini commented Jul 12, 2018

In the org.eclipse.microprofile.openapi.models package and sub-packages, the builder-pattern is used:

    T getXyzAbcd();

    void setXyzAbcd(T xyzAbcd);

    U ayzAbcd(T xyzAbcd);

The ayzAbcd(T) method is just a builder method.

Could this method be a default method?

    default U XyzAbcd(T xyzAbcd) {
        setXyzAbcd(xyzAbcd);
        return this;
    }

In my opinion it would ease the work of people who wants to create an implementation of the model interfaces.

Or is there a reason to not do this?

@arthurdm
Copy link
Member

We agreed with this in today's hangout. This issue will be used to drive the proposed work of adding the default impls for these simple builder methods.

jmini added a commit to jmini/microprofile-open-api that referenced this issue Jul 17, 2018
Issue eclipse#236

Signed-off-by: Jeremie Bresson <dev@jmini.fr>
@jmini
Copy link
Contributor Author

jmini commented Jul 17, 2018

I have created an example in #242 for the Operation class. Before I extend this pattern to all builders methods, I want to be sure that this is the idea we have discussed here.

jmini added a commit to jmini/microprofile-open-api that referenced this issue Jul 19, 2018
Issue eclipse#236

Signed-off-by: Jeremie Bresson <dev@jmini.fr>
jmini added a commit to jmini/microprofile-open-api that referenced this issue Jul 23, 2018
Issue eclipse#236
Signed-off-by: Jeremie Bresson <dev@jmini.fr>
@jmini
Copy link
Contributor Author

jmini commented Jul 24, 2018

This issue will be used to drive the proposed work of adding the default impls for these simple builder methods.

Have you other changes than the one in #242 in mind?

@arthurdm
Copy link
Member

that was all. thanks again @jmini!

Azquelt pushed a commit to Azquelt/microprofile-open-api that referenced this issue Mar 17, 2022
….org.jboss.resteasy-4.4.2.Final

Bump version.org.jboss.resteasy from 4.4.1.Final to 4.4.2.Final
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

2 participants