Skip to content

Commit d8ef1f7

Browse files
authored
Add arg builder support to putObject api (minio#972)
1 parent 7a5cae1 commit d8ef1f7

26 files changed

+1831
-1572
lines changed

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

+10-10
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,31 @@
2121
import java.nio.file.Paths;
2222

2323
public class DownloadObjectArgs extends ObjectReadArgs {
24-
private String fileName;
24+
private String filename;
2525

26-
public String fileName() {
27-
return fileName;
26+
public String filename() {
27+
return filename;
2828
}
2929

3030
public static Builder builder() {
3131
return new Builder();
3232
}
3333

3434
public static final class Builder extends ObjectReadArgs.Builder<Builder, DownloadObjectArgs> {
35-
public Builder fileName(String fileName) {
36-
validateFileName(fileName);
37-
operations.add(args -> args.fileName = fileName);
35+
public Builder filename(String filename) {
36+
validateFileName(filename);
37+
operations.add(args -> args.filename = filename);
3838
return this;
3939
}
4040

41-
private void validateFileName(String fileName) {
42-
validateNotEmptyString(fileName, "filename");
41+
private void validateFileName(String filename) {
42+
validateNotEmptyString(filename, "filename");
4343

44-
Path filePath = Paths.get(fileName);
44+
Path filePath = Paths.get(filename);
4545
boolean fileExists = Files.exists(filePath);
4646

4747
if (fileExists && !Files.isRegularFile(filePath)) {
48-
throw new IllegalArgumentException(fileName + ": not a regular file");
48+
throw new IllegalArgumentException(filename + ": not a regular file");
4949
}
5050
}
5151
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2020 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 okhttp3.Headers;
20+
21+
/** Generic response class of any APIs. */
22+
public abstract class GenericResponse {
23+
private Headers headers;
24+
25+
protected void setHeaders(Headers headers) {
26+
this.headers = headers;
27+
}
28+
29+
public Headers headers() {
30+
return headers;
31+
}
32+
}

0 commit comments

Comments
 (0)