Left/Right: don't use @Getter
for final fields
QA tools want these fields to be static, for which lombok creates static getter methods, which then don't match the specification from the `Either` interface.
This commit is contained in:
parent
d001a3cb3b
commit
a1a7ad65c2
2 changed files with 20 additions and 12 deletions
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
package net.kemitix.mon.experimental.either;
|
package net.kemitix.mon.experimental.either;
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
@ -37,13 +36,18 @@ import java.util.function.Function;
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
class Left<L, R> implements Either<L, R> {
|
class Left<L, R> implements Either<L, R> {
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final boolean left = true;
|
|
||||||
@Getter
|
|
||||||
private final boolean right = false;
|
|
||||||
|
|
||||||
private final L value;
|
private final L value;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLeft() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRight() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void match(final Consumer<L> onLeft, final Consumer<R> onRight) {
|
public void match(final Consumer<L> onLeft, final Consumer<R> onRight) {
|
||||||
onLeft.accept(value);
|
onLeft.accept(value);
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
package net.kemitix.mon.experimental.either;
|
package net.kemitix.mon.experimental.either;
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
@ -37,13 +36,18 @@ import java.util.function.Function;
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
class Right<L, R> implements Either<L, R> {
|
class Right<L, R> implements Either<L, R> {
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final boolean left = false;
|
|
||||||
@Getter
|
|
||||||
private final boolean right = true;
|
|
||||||
|
|
||||||
private final R value;
|
private final R value;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLeft() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRight() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void match(final Consumer<L> onLeft, final Consumer<R> onRight) {
|
public void match(final Consumer<L> onLeft, final Consumer<R> onRight) {
|
||||||
onRight.accept(value);
|
onRight.accept(value);
|
||||||
|
|
Loading…
Reference in a new issue