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

Core: Generate Builder for UpdateTableRequest #7838

Closed
wants to merge 1 commit into from

Conversation

nastra
Copy link
Contributor

@nastra nastra commented Jun 14, 2023

I've mainly opened this PR as a discussion point to have an alternative to writing manual builders for classes that we can't or don't want to switch to @Value.Immutable.

The Immutables lib can also be used to generate a Builder without having to annotate a class with @Value.Immutable. It's worth mentioning that this is mainly for use cases where we don't require additional processing logic in the builders.


@Value.Style(newBuilder = "newBuilder")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without this, one would instantiate the Builder via new UpdateTableRequestBuilder(), which is probably fine as well. We could also add

public static UpdateTableRequestBuilder builder() {
    return new UpdateTableRequestBuilder();
}

to UpdateTableRequest

public UpdateTableRequest(List<UpdateRequirement> requirements, List<MetadataUpdate> updates) {
this.requirements = requirements;
this.updates = updates;
}

@Constructor
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will generate a Builder class from the constructor params and we're indicating in the constructor that TableIdentifier can be null.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the constructor needs to be non-private (we could also change it to protected to be more strict and force usage via the generated builder

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.

None yet

1 participant