Skip to content

Commit ce4eed8

Browse files
committed
Replace varargs by method overloading
1 parent dd858f3 commit ce4eed8

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

src/main/java/software/amazon/payloadoffloading/PayloadStore.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,28 @@ public interface PayloadStore {
1111
* Stores payload in a store that has higher payload size limit than that is supported by original payload store.
1212
*
1313
* @param payload
14-
* @param optional an array of optional parameters. optional[0] should be a custom s3Key.
1514
* @return a pointer that must be used to retrieve the original payload later.
1615
* @throws SdkClientException If any internal errors are encountered on the client side while
1716
* attempting to make the request or handle the response. For example
1817
* if a network connection is not available.
1918
* @throws S3Exception If an error response is returned by actual PayloadStore indicating
2019
* either a problem with the data in the request, or a server side issue.
2120
*/
22-
String storeOriginalPayload(String payload, String... optional);
21+
String storeOriginalPayload(String payload);
22+
23+
/**
24+
* Stores payload in a store that has higher payload size limit than that is supported by original payload store.
25+
*
26+
* @param payload
27+
* @param s3Key
28+
* @return a pointer that must be used to retrieve the original payload later.
29+
* @throws SdkClientException If any internal errors are encountered on the client side while
30+
* attempting to make the request or handle the response. For example
31+
* if a network connection is not available.
32+
* @throws S3Exception If an error response is returned by actual PayloadStore indicating
33+
* either a problem with the data in the request, or a server side issue.
34+
*/
35+
String storeOriginalPayload(String payload, String s3Key);
2336

2437
/**
2538
* Retrieves the original payload using the given payloadPointer. The pointer must

src/main/java/software/amazon/payloadoffloading/S3BackedPayloadStore.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ public S3BackedPayloadStore(S3Dao s3Dao, String s3BucketName) {
2020
}
2121

2222
@Override
23-
public String storeOriginalPayload(String payload, String... optional) {
24-
String s3Key = optional.length > 0 ? optional[0] : UUID.randomUUID().toString();
23+
public String storeOriginalPayload(String payload) {
24+
String s3Key = UUID.randomUUID().toString();
25+
return storeOriginalPayload(payload, s3Key);
26+
}
2527

28+
@Override
29+
public String storeOriginalPayload(String payload, String s3Key) {
2630
s3Dao.storeTextInS3(s3BucketName, s3Key, payload);
2731
LOG.info("S3 object created, Bucket name: " + s3BucketName + ", Object key: " + s3Key + ".");
2832

0 commit comments

Comments
 (0)