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