Browse Source

Polishing

pull/33850/head
Juergen Hoeller 1 year ago
parent
commit
e235e661d8
  1. 5
      spring-core/src/main/java/org/springframework/util/function/ThrowingBiFunction.java
  2. 5
      spring-core/src/main/java/org/springframework/util/function/ThrowingConsumer.java
  3. 5
      spring-core/src/main/java/org/springframework/util/function/ThrowingFunction.java

5
spring-core/src/main/java/org/springframework/util/function/ThrowingBiFunction.java

@ -1,5 +1,5 @@ @@ -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");
* 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> { @@ -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) {
return new ThrowingBiFunction<>() {
@Override
public R applyWithException(T t, U u) throws Exception {
return ThrowingBiFunction.this.applyWithException(t, u);
}
@Override
public R apply(T t, U u) {
return apply(t, u, exceptionWrapper);
}
};
}

5
spring-core/src/main/java/org/springframework/util/function/ThrowingConsumer.java

@ -1,5 +1,5 @@ @@ -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");
* you may not use this file except in compliance with the License.
@ -77,17 +77,14 @@ public interface ThrowingConsumer<T> extends Consumer<T> { @@ -77,17 +77,14 @@ public interface ThrowingConsumer<T> extends Consumer<T> {
*/
default ThrowingConsumer<T> throwing(BiFunction<String, Exception, RuntimeException> exceptionWrapper) {
return new ThrowingConsumer<>() {
@Override
public void acceptWithException(T t) throws Exception {
ThrowingConsumer.this.acceptWithException(t);
}
@Override
public void accept(T t) {
accept(t, exceptionWrapper);
}
};
}

5
spring-core/src/main/java/org/springframework/util/function/ThrowingFunction.java

@ -1,5 +1,5 @@ @@ -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");
* 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> { @@ -80,17 +80,14 @@ public interface ThrowingFunction<T, R> extends Function<T, R> {
*/
default ThrowingFunction<T, R> throwing(BiFunction<String, Exception, RuntimeException> exceptionWrapper) {
return new ThrowingFunction<>() {
@Override
public R applyWithException(T t) throws Exception {
return ThrowingFunction.this.applyWithException(t);
}
@Override
public R apply(T t) {
return apply(t, exceptionWrapper);
}
};
}

Loading…
Cancel
Save