Polishing

This commit is contained in:
Juergen Hoeller 2024-10-21 18:13:42 +02:00
parent 09fe0adb40
commit e235e661d8
3 changed files with 3 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2022 the original author or authors. * Copyright 2002-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -85,17 +85,14 @@ public interface ThrowingBiFunction<T, U, R> extends BiFunction<T, U, R> {
*/ */
default ThrowingBiFunction<T, U, R> throwing(BiFunction<String, Exception, RuntimeException> exceptionWrapper) { default ThrowingBiFunction<T, U, R> throwing(BiFunction<String, Exception, RuntimeException> exceptionWrapper) {
return new ThrowingBiFunction<>() { return new ThrowingBiFunction<>() {
@Override @Override
public R applyWithException(T t, U u) throws Exception { public R applyWithException(T t, U u) throws Exception {
return ThrowingBiFunction.this.applyWithException(t, u); return ThrowingBiFunction.this.applyWithException(t, u);
} }
@Override @Override
public R apply(T t, U u) { public R apply(T t, U u) {
return apply(t, u, exceptionWrapper); return apply(t, u, exceptionWrapper);
} }
}; };
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2022 the original author or authors. * Copyright 2002-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -77,17 +77,14 @@ public interface ThrowingConsumer<T> extends Consumer<T> {
*/ */
default ThrowingConsumer<T> throwing(BiFunction<String, Exception, RuntimeException> exceptionWrapper) { default ThrowingConsumer<T> throwing(BiFunction<String, Exception, RuntimeException> exceptionWrapper) {
return new ThrowingConsumer<>() { return new ThrowingConsumer<>() {
@Override @Override
public void acceptWithException(T t) throws Exception { public void acceptWithException(T t) throws Exception {
ThrowingConsumer.this.acceptWithException(t); ThrowingConsumer.this.acceptWithException(t);
} }
@Override @Override
public void accept(T t) { public void accept(T t) {
accept(t, exceptionWrapper); accept(t, exceptionWrapper);
} }
}; };
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2022 the original author or authors. * Copyright 2002-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -80,17 +80,14 @@ public interface ThrowingFunction<T, R> extends Function<T, R> {
*/ */
default ThrowingFunction<T, R> throwing(BiFunction<String, Exception, RuntimeException> exceptionWrapper) { default ThrowingFunction<T, R> throwing(BiFunction<String, Exception, RuntimeException> exceptionWrapper) {
return new ThrowingFunction<>() { return new ThrowingFunction<>() {
@Override @Override
public R applyWithException(T t) throws Exception { public R applyWithException(T t) throws Exception {
return ThrowingFunction.this.applyWithException(t); return ThrowingFunction.this.applyWithException(t);
} }
@Override @Override
public R apply(T t) { public R apply(T t) {
return apply(t, exceptionWrapper); return apply(t, exceptionWrapper);
} }
}; };
} }