1 /*******************************************************************************
\r
2 * Copyright (c) 2016 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * Semantum Oy - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.db.function;
\r
14 import java.util.Objects;
\r
16 import org.simantics.db.exception.DatabaseException;
\r
19 * Represents an operation that accepts two input arguments and returns no
\r
20 * result and can throw database exceptions. This is the two-arity
\r
21 * specialization of {@link DbConsumer}. Unlike most other functional interfaces,
\r
22 * {@code BiDbConsumer} is expected to operate via side-effects.
\r
25 * the type of the first argument to the operation
\r
27 * the type of the second argument to the operation
\r
30 * @since 1.22.1 & 1.24.0
\r
32 @FunctionalInterface
\r
33 public interface DbBiConsumer<T, U> {
\r
36 * Performs this operation on the given arguments.
\r
38 * @param t the first input argument
\r
39 * @param u the second input argument
\r
41 void accept(T t, U u) throws DatabaseException;
\r
44 * Returns a composed {@code BiConsumer} that performs, in sequence, this
\r
45 * operation followed by the {@code after} operation. If performing either
\r
46 * operation throws an exception, it is relayed to the caller of the
\r
47 * composed operation. If performing this operation throws an exception,
\r
48 * the {@code after} operation will not be performed.
\r
50 * @param after the operation to perform after this operation
\r
51 * @return a composed {@code BiConsumer} that performs in sequence this
\r
52 * operation followed by the {@code after} operation
\r
53 * @throws NullPointerException if {@code after} is null
\r
55 default DbBiConsumer<T, U> andThen(DbBiConsumer<? super T, ? super U> after) {
\r
56 Objects.requireNonNull(after);
\r