Reputation: 39
I'm working on a code to put objects to S3. I've a wrapper method that logs the call details and request/ response information. While i try to use the wrapper for s3.putObject/ s3.headObject calls, its failing with below error
Reference to 'headObject' is ambiguous, both 'headObject(HeadObjectRequest)' and 'headObject(Consumer<Builder>)' match
The code snippet is,
wrapper.apply(
PutObjectRequest.builder()
.bucket("bucket")
.key("bucket_key")
.build(),
RequestBody.fromString(input_string),
s3Client::putObject);
As both the methods have two arguments, I'm using BiFunction to pass the input parameter and method reference. There are other methods in my application that uses Function to call methods that only have single argument and they are working perfectly fine.
Is there a way to get BiFunction working for method references with more than one argument?
I tried specifying the datatypes explicitly as well but with no luck.
(Function<PutObjectRequest, RequestBody>) s3Client::putObject
Upvotes: 0
Views: 36