Skip to content

Unify the API of hand-written Builders #1233

@armiol

Description

@armiol

The framework uses the Builder pattern to create complex Java objects such as Delivery.

However, the naming of getters and setters varies from time to time. We need to review the code throughout the repository and unify the naming approach.

The proposal is as follows.

FooBar.Builder builder = FooBar.newBuilder();
builder
    .setTheExpectation(myExpectation);     // setter naming

// Check whether the value has been set.
if(builder.hasTheExpectation()) {    

    // Throws NPE if not set.
    TheExpectation justSet = builder.getTheExpectation(); 
}

We could then automate the Builder testing using Java reflection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions