静态方法不需要 final
parent
9582cc7187
commit
b870684fea
|
@ -103,49 +103,49 @@ public abstract class PlusoneJdbcDaoSupport {
|
|||
return Numbers.sum(i);
|
||||
}
|
||||
|
||||
protected static final <T> void assertResultEquals(T result, T expectedValue) {
|
||||
protected static <T> void assertResultEquals(T result, T expectedValue) {
|
||||
if (!Objects.equals(result, expectedValue)) {
|
||||
throw new DataOperationResultException();
|
||||
}
|
||||
}
|
||||
|
||||
protected static final <T> void assertResultEquals(T result, T expectedValue, Function<T, String> errMsg) {
|
||||
protected static <T> void assertResultEquals(T result, T expectedValue, Function<T, String> errMsg) {
|
||||
if (!Objects.equals(result, expectedValue)) {
|
||||
throw new DataOperationResultException(errMsg.apply(result));
|
||||
}
|
||||
}
|
||||
|
||||
protected static final <T> void assertResultEquals(T result, T expectedValue, String msgTemplate, Object... args) {
|
||||
protected static <T> void assertResultEquals(T result, T expectedValue, String msgTemplate, Object... args) {
|
||||
if (!Objects.equals(result, expectedValue)) {
|
||||
throw new DataOperationResultException(String.format(msgTemplate, args));
|
||||
}
|
||||
}
|
||||
|
||||
protected static final <T, E extends Throwable> void assertResultEqualsOrThrow(T result, T expectedValue,
|
||||
protected static <T, E extends Throwable> void assertResultEqualsOrThrow(T result, T expectedValue,
|
||||
Function<T, E> e) throws E {
|
||||
if (!Objects.equals(result, expectedValue)) {
|
||||
throw e.apply(result);
|
||||
}
|
||||
}
|
||||
|
||||
protected static final void assertUpdateOneRow(int result) {
|
||||
protected static void assertUpdateOneRow(int result) {
|
||||
assertResultEquals(result, 1);
|
||||
}
|
||||
|
||||
protected static final void assertUpdateOneRow(int result, Function<Integer, String> errMsg) {
|
||||
protected static void assertUpdateOneRow(int result, Function<Integer, String> errMsg) {
|
||||
assertResultEquals(result, 1, errMsg);
|
||||
}
|
||||
|
||||
protected static final void assertUpdateOneRow(int result, String msgTemplate, Object... args) {
|
||||
protected static void assertUpdateOneRow(int result, String msgTemplate, Object... args) {
|
||||
assertResultEquals(result, 1, msgTemplate, args);
|
||||
}
|
||||
|
||||
protected static final <E extends Throwable> void assertUpdateOneRowOrThrow(int result, Function<Integer, E> e)
|
||||
protected static <E extends Throwable> void assertUpdateOneRowOrThrow(int result, Function<Integer, E> e)
|
||||
throws E {
|
||||
assertResultEqualsOrThrow(result, 1, e);
|
||||
}
|
||||
|
||||
protected static final <T> SqlParameterSource[] buildSqlParameterSourceArray(
|
||||
protected static <T> SqlParameterSource[] buildSqlParameterSourceArray(
|
||||
T[] c,
|
||||
@Nonnull Function<T, SqlParameterSource> paramSourceBuilder) {
|
||||
if (c == null || c.length == 0) {
|
||||
|
@ -154,7 +154,7 @@ public abstract class PlusoneJdbcDaoSupport {
|
|||
return buildSqlParameterSourceArray(Arrays.stream(c), paramSourceBuilder);
|
||||
}
|
||||
|
||||
protected static final <T> SqlParameterSource[] buildSqlParameterSourceArray(
|
||||
protected static <T> SqlParameterSource[] buildSqlParameterSourceArray(
|
||||
Collection<T> c,
|
||||
@Nonnull Function<T, SqlParameterSource> paramSourceBuilder) {
|
||||
if (CollectionUtils.isEmpty(c)) {
|
||||
|
@ -163,7 +163,7 @@ public abstract class PlusoneJdbcDaoSupport {
|
|||
return buildSqlParameterSourceArray(c.stream(), paramSourceBuilder);
|
||||
}
|
||||
|
||||
protected static final <T> SqlParameterSource[] buildSqlParameterSourceArray(
|
||||
protected static <T> SqlParameterSource[] buildSqlParameterSourceArray(
|
||||
Stream<T> stream,
|
||||
@Nonnull Function<T, SqlParameterSource> paramSourceBuilder) {
|
||||
Objects.requireNonNull(stream);
|
||||
|
|
Loading…
Reference in New Issue