Value: use lombok to replace constructor
This commit is contained in:
parent
09ae3b0257
commit
07f4af3425
1 changed files with 3 additions and 4 deletions
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
package net.kemitix.conditional;
|
package net.kemitix.conditional;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -158,14 +160,11 @@ public interface Value {
|
||||||
/**
|
/**
|
||||||
* An intermediate result of the {@link Value} where the clause has evaluated to true.
|
* An intermediate result of the {@link Value} where the clause has evaluated to true.
|
||||||
*/
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
private class TrueValueSupplier implements ValueSupplier<T> {
|
private class TrueValueSupplier implements ValueSupplier<T> {
|
||||||
|
|
||||||
private final Supplier<T> valueSupplier;
|
private final Supplier<T> valueSupplier;
|
||||||
|
|
||||||
TrueValueSupplier(final Supplier<T> valueSupplier) {
|
|
||||||
this.valueSupplier = valueSupplier;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T otherwise(final Supplier<T> falseSupplier) {
|
public T otherwise(final Supplier<T> falseSupplier) {
|
||||||
return valueSupplier.get();
|
return valueSupplier.get();
|
||||||
|
|
Loading…
Reference in a new issue