-
Notifications
You must be signed in to change notification settings - Fork 3k
Core: Generate Builder for UpdateTableRequest #7838
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ | |
|
|
||
| import java.util.List; | ||
| import java.util.Set; | ||
| import javax.annotation.Nullable; | ||
| import org.apache.iceberg.MetadataUpdate; | ||
| import org.apache.iceberg.SnapshotRef; | ||
| import org.apache.iceberg.TableMetadata; | ||
|
|
@@ -31,7 +32,10 @@ | |
| import org.apache.iceberg.relocated.com.google.common.collect.Lists; | ||
| import org.apache.iceberg.relocated.com.google.common.collect.Sets; | ||
| import org.apache.iceberg.rest.RESTRequest; | ||
| import org.immutables.builder.Builder.Constructor; | ||
| import org.immutables.value.Value; | ||
|
|
||
| @Value.Style(newBuilder = "newBuilder") | ||
| public class UpdateTableRequest implements RESTRequest { | ||
|
|
||
| private TableIdentifier identifier; | ||
|
|
@@ -42,13 +46,19 @@ public UpdateTableRequest() { | |
| // needed for Jackson deserialization | ||
| } | ||
|
|
||
| /** | ||
| * @deprecated will be removed in 1.5.0; use {@link UpdateTableRequestBuilder#newBuilder()} | ||
| * instead. | ||
| */ | ||
| @Deprecated | ||
| public UpdateTableRequest(List<UpdateRequirement> requirements, List<MetadataUpdate> updates) { | ||
| this.requirements = requirements; | ||
| this.updates = updates; | ||
| } | ||
|
|
||
| @Constructor | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| UpdateTableRequest( | ||
| TableIdentifier identifier, | ||
| @Nullable TableIdentifier identifier, | ||
| List<UpdateRequirement> requirements, | ||
| List<MetadataUpdate> updates) { | ||
| this(requirements, updates); | ||
|
|
@@ -73,6 +83,7 @@ public TableIdentifier identifier() { | |
| @Override | ||
| public String toString() { | ||
| return MoreObjects.toStringHelper(this) | ||
| .add("identifier", identifier) | ||
| .add("requirements", requirements) | ||
| .add("updates", updates) | ||
| .toString(); | ||
|
|
||
There was a problem hiding this comment.
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 addto
UpdateTableRequest