Apply PMD and Checkstyle updates

This commit is contained in:
Paul Campbell 2018-03-13 18:29:41 +00:00
parent e427f14b70
commit 3a1e51aa9f
6 changed files with 14 additions and 2 deletions

View file

@ -38,7 +38,10 @@ public interface Condition {
* @return the Condition * @return the Condition
*/ */
static Condition where(final boolean clause) { static Condition where(final boolean clause) {
return clause ? TrueCondition.TRUE : FalseCondition.FALSE; if (clause) {
return TrueCondition.TRUE;
}
return FalseCondition.FALSE;
} }
/** /**

View file

@ -38,6 +38,7 @@ final class FalseCondition implements Condition {
} }
@Override @Override
@SuppressWarnings("PMD.ShortMethodName")
public Condition or(final Supplier<Boolean> secondClause) { public Condition or(final Supplier<Boolean> secondClause) {
return Condition.where(secondClause.get()); return Condition.where(secondClause.get());
} }

View file

@ -46,6 +46,7 @@ class FalseValueClause<T> implements Value.ValueClause<T> {
} }
@Override @Override
@SuppressWarnings("PMD.ShortMethodName")
public Value.ValueClause<T> or(final Supplier<Boolean> clause) { public Value.ValueClause<T> or(final Supplier<Boolean> clause) {
return Value.where(clause.get()); return Value.where(clause.get());
} }

View file

@ -38,6 +38,7 @@ final class TrueCondition implements Condition {
} }
@Override @Override
@SuppressWarnings("PMD.ShortMethodName")
public Condition or(final Supplier<Boolean> secondClause) { public Condition or(final Supplier<Boolean> secondClause) {
return TRUE; return TRUE;
} }

View file

@ -48,6 +48,7 @@ class TrueValueClause<T> implements Value.ValueClause<T> {
} }
@Override @Override
@SuppressWarnings("PMD.ShortMethodName")
public Value.ValueClause<T> or(final Supplier<Boolean> clause) { public Value.ValueClause<T> or(final Supplier<Boolean> clause) {
return this; return this;
} }
@ -60,6 +61,7 @@ class TrueValueClause<T> implements Value.ValueClause<T> {
@RequiredArgsConstructor @RequiredArgsConstructor
private static final class TrueValueSupplier<T> implements ValueSupplier<T> { private static final class TrueValueSupplier<T> implements ValueSupplier<T> {
@SuppressWarnings("PMD.BeanMembersShouldSerialize")
private final Supplier<T> valueSupplier; private final Supplier<T> valueSupplier;
@Override @Override

View file

@ -41,6 +41,7 @@ public interface Value {
* *
* @return the value from either the trueSupplier or the falseSupplier * @return the value from either the trueSupplier or the falseSupplier
*/ */
@SuppressWarnings("PMD.LawOfDemeter")
static <T> T where( static <T> T where(
final boolean clause, final boolean clause,
final Supplier<T> trueSupplier, final Supplier<T> trueSupplier,
@ -75,7 +76,10 @@ public interface Value {
* @return a true or false value clause * @return a true or false value clause
*/ */
static <T> ValueClause<T> where(final boolean clause) { static <T> ValueClause<T> where(final boolean clause) {
return (ValueClause<T>) (clause ? TrueValueClause.TRUE : FalseValueClause.FALSE); if (clause) {
return TrueValueClause.TRUE;
}
return FalseValueClause.FALSE;
} }
/** /**