mirror of
https://gitee.com/san-bing/JChargePointProtocol
synced 2026-05-07 11:29:53 +08:00
cleanup code
This commit is contained in:
@@ -11,14 +11,12 @@ import java.util.function.Function;
|
|||||||
|
|
||||||
public class Validator {
|
public class Validator {
|
||||||
|
|
||||||
|
|
||||||
public static void validateString(String val, String errorMessage) {
|
public static void validateString(String val, String errorMessage) {
|
||||||
if (val == null || val.isEmpty()) {
|
if (val == null || val.isEmpty()) {
|
||||||
throw new IncorrectParameterException(errorMessage);
|
throw new IncorrectParameterException(errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void validateString(String val, Function<String, String> errorMessageFunction) {
|
public static void validateString(String val, Function<String, String> errorMessageFunction) {
|
||||||
if (val == null || val.isEmpty()) {
|
if (val == null || val.isEmpty()) {
|
||||||
throw new IncorrectParameterException(errorMessageFunction.apply(val));
|
throw new IncorrectParameterException(errorMessageFunction.apply(val));
|
||||||
@@ -31,13 +29,6 @@ public class Validator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static void validateId(UUID id, String errorMessage) {
|
|
||||||
if (id == null) {
|
|
||||||
throw new IncorrectParameterException(errorMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void validateId(UUID id, Function<UUID, String> errorMessageFunction) {
|
public static void validateId(UUID id, Function<UUID, String> errorMessageFunction) {
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
throw new IncorrectParameterException(errorMessageFunction.apply(id));
|
throw new IncorrectParameterException(errorMessageFunction.apply(id));
|
||||||
|
|||||||
Reference in New Issue
Block a user