buckelieg.jdbc.fn.TryTriConsumer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jdbc-fn Show documentation
Show all versions of jdbc-fn Show documentation
Functional style programming with plain JDBC
The newest version!
/*
* Copyright 2024- Anatoly Kutyakov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package buckelieg.jdbc.fn;
import javax.annotation.Nonnull;
import static java.util.Objects.requireNonNull;
/**
* Represents an operation that accepts three input arguments and returns no
* result. This is the three-arity specialization of {@link TryConsumer}.
* Unlike most other functional interfaces, {@code TryTriConsumer} is expected
* to operate via side effects.
*
* @param first argument type
* @param second argument type
* @param third argument type
* @param exception type
*/
@FunctionalInterface
public interface TryTriConsumer {
/**
* A NO OPeration constant
*/
TryTriConsumer, ?, ?, ? extends Throwable> NOOP = (input1, input2, input3) -> {};
/**
* A type-checked NO OPeration
*
* @param first argument type
* @param second argument type
* @param third argument type
* @param exception type
* @return a type-checked {@linkplain #NOOP} constant
*/
@Nonnull
@SuppressWarnings("unchecked")
static TryTriConsumer NOOP() {
return (TryTriConsumer) NOOP;
}
/**
* A three-argument function which returns no results and might throw an Exception
*
* @param input1 first argument
* @param input2 second argument
* @param input3 third argument
* @throws E an arbitrary exception
*/
void accept(I1 input1, I2 input2, I3 input3) throws E;
/**
* Returns reference of lambda expression
*
* @param triConsumer a triConsumer function
* @param first argument type
* @param second argument type
* @param third argument type
* @param exception type
* @return lambda as {@link TryTriConsumer} reference
* @throws NullPointerException if tryBiConsumer
is null
*/
static TryTriConsumer of(TryTriConsumer triConsumer) {
return requireNonNull(triConsumer, "Consumer must be provided");
}
}