Skip to content

Commit 6535383

Browse files
committed
Refactor messages by subclasses
merge SelectObjectContentRequest merge ListVersionsResult Remove unused CompleteMultipartUploadOutput.java merge ListMultipartUploadsResult merge NotificationRecords merge SseConfiguration merge DeleteRequest, DeleteResult merge RestoreRequest merge NotificationConfiguration merge LifecycleConfiguration merge ReplicationConfiguration merge Filter merge ObjectLockConfiguration merge ListAllMyBucketsResult merge Item merge ListObjectsResult Move common fields for ListPartsResult and GetObjectAttributesOutput Signed-off-by: Bala.FA <[email protected]>
1 parent 5e7e074 commit 6535383

File tree

222 files changed

+10047
-9410
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+10047
-9410
lines changed

adminapi/src/main/java/io/minio/admin/MinioAdminClient.java

+53-55
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2025 MinIO, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.minio;
18+
19+
import java.util.Objects;
20+
21+
/**
22+
* Argument class of {@link MinioAsyncClient#abortMultipartUpload} and {@link
23+
* MinioClient#abortMultipartUpload}.
24+
*/
25+
public class AbortMultipartUploadArgs extends ObjectArgs {
26+
private String uploadId;
27+
28+
public String uploadId() {
29+
return uploadId;
30+
}
31+
32+
public static Builder builder() {
33+
return new Builder();
34+
}
35+
36+
/** Argument builder of {@link AbortMultipartUploadArgs}. */
37+
public static final class Builder extends ObjectArgs.Builder<Builder, AbortMultipartUploadArgs> {
38+
@Override
39+
protected void validate(AbortMultipartUploadArgs args) {
40+
super.validate(args);
41+
Utils.validateNotEmptyString(args.uploadId, "upload ID");
42+
}
43+
44+
public Builder uploadId(String uploadId) {
45+
Utils.validateNotEmptyString(uploadId, "upload ID");
46+
operations.add(args -> args.uploadId = uploadId);
47+
return this;
48+
}
49+
}
50+
51+
@Override
52+
public boolean equals(Object o) {
53+
if (this == o) return true;
54+
if (!(o instanceof AbortMultipartUploadArgs)) return false;
55+
if (!super.equals(o)) return false;
56+
AbortMultipartUploadArgs that = (AbortMultipartUploadArgs) o;
57+
return Objects.equals(uploadId, that.uploadId);
58+
}
59+
60+
@Override
61+
public int hashCode() {
62+
return Objects.hash(super.hashCode(), uploadId);
63+
}
64+
}

api/src/main/java/io/minio/BaseArgs.java

+4-45
Original file line numberDiff line numberDiff line change
@@ -60,75 +60,34 @@ public abstract static class Builder<B extends Builder<B, A>, A extends BaseArgs
6060

6161
protected abstract void validate(A args);
6262

63-
protected void validateNotNull(Object arg, String argName) {
64-
if (arg == null) {
65-
throw new IllegalArgumentException(argName + " must not be null.");
66-
}
67-
}
68-
69-
protected void validateNotEmptyString(String arg, String argName) {
70-
validateNotNull(arg, argName);
71-
if (arg.isEmpty()) {
72-
throw new IllegalArgumentException(argName + " must be a non-empty string.");
73-
}
74-
}
75-
76-
protected void validateNullOrNotEmptyString(String arg, String argName) {
77-
if (arg != null && arg.isEmpty()) {
78-
throw new IllegalArgumentException(argName + " must be a non-empty string.");
79-
}
80-
}
81-
82-
protected void validateNullOrPositive(Number arg, String argName) {
83-
if (arg != null && arg.longValue() < 0) {
84-
throw new IllegalArgumentException(argName + " cannot be non-negative.");
85-
}
86-
}
87-
8863
public Builder() {
8964
this.operations = new ArrayList<>();
9065
}
9166

92-
protected Multimap<String, String> copyMultimap(Multimap<String, String> multimap) {
93-
Multimap<String, String> multimapCopy = HashMultimap.create();
94-
if (multimap != null) {
95-
multimapCopy.putAll(multimap);
96-
}
97-
return Multimaps.unmodifiableMultimap(multimapCopy);
98-
}
99-
100-
protected Multimap<String, String> toMultimap(Map<String, String> map) {
101-
Multimap<String, String> multimap = HashMultimap.create();
102-
if (map != null) {
103-
multimap.putAll(Multimaps.forMap(map));
104-
}
105-
return Multimaps.unmodifiableMultimap(multimap);
106-
}
107-
10867
@SuppressWarnings("unchecked") // Its safe to type cast to B as B extends this class.
10968
public B extraHeaders(Multimap<String, String> headers) {
110-
final Multimap<String, String> extraHeaders = copyMultimap(headers);
69+
final Multimap<String, String> extraHeaders = Utils.newMultimap(headers);
11170
operations.add(args -> args.extraHeaders = extraHeaders);
11271
return (B) this;
11372
}
11473

11574
@SuppressWarnings("unchecked") // Its safe to type cast to B as B extends this class.
11675
public B extraQueryParams(Multimap<String, String> queryParams) {
117-
final Multimap<String, String> extraQueryParams = copyMultimap(queryParams);
76+
final Multimap<String, String> extraQueryParams = Utils.newMultimap(queryParams);
11877
operations.add(args -> args.extraQueryParams = extraQueryParams);
11978
return (B) this;
12079
}
12180

12281
@SuppressWarnings("unchecked") // Its safe to type cast to B as B extends this class.
12382
public B extraHeaders(Map<String, String> headers) {
124-
final Multimap<String, String> extraHeaders = toMultimap(headers);
83+
final Multimap<String, String> extraHeaders = Utils.newMultimap(headers);
12584
operations.add(args -> args.extraHeaders = extraHeaders);
12685
return (B) this;
12786
}
12887

12988
@SuppressWarnings("unchecked") // Its safe to type cast to B as B extends this class.
13089
public B extraQueryParams(Map<String, String> queryParams) {
131-
final Multimap<String, String> extraQueryParams = toMultimap(queryParams);
90+
final Multimap<String, String> extraQueryParams = Utils.newMultimap(queryParams);
13291
operations.add(args -> args.extraQueryParams = extraQueryParams);
13392
return (B) this;
13493
}

0 commit comments

Comments
 (0)