|
@@ -181,45 +181,6 @@ public class VerifyProcessor {
|
|
|
private static boolean notBlank(String value) {
|
|
|
return null != value && !value.trim().isEmpty();
|
|
|
}
|
|
|
- /**
|
|
|
- * verify the int value is greater than zero.
|
|
|
- *
|
|
|
- * @param value any int value.
|
|
|
- * @return if return {@code true}, the value is greater than zero, otherwise no.
|
|
|
- */
|
|
|
- private static boolean gt0(int value) {
|
|
|
- return value > 0;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * verify the int value is less than zero.
|
|
|
- *
|
|
|
- * @param value any int value.
|
|
|
- * @return if return {@code true}, the value is less than zero, otherwise no
|
|
|
- */
|
|
|
- private static boolean lt0(int value) {
|
|
|
- return value < 0;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * verify the int value is greater than zero or equal to zero.
|
|
|
- *
|
|
|
- * @param value any int value.
|
|
|
- * @return if return {@code true}, the value is greater than zero or equal to zero, otherwise no
|
|
|
- */
|
|
|
- private static boolean gte0(int value) {
|
|
|
- return value >= 0;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * verify the int value is less than zero or equal to zero.
|
|
|
- *
|
|
|
- * @param value any int value.
|
|
|
- * @return if return {@code true}, the value is less than zero or equal to zero, otherwise no
|
|
|
- */
|
|
|
- private static boolean lte0(int value) {
|
|
|
- return value <= 0;
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* verify the value is instance of the Number.
|
|
@@ -733,9 +694,9 @@ public class VerifyProcessor {
|
|
|
final boolean inclusive = annotation.inclusive();
|
|
|
//inclusive ? comparisonResult <= 0 : comparisonResult < 0;
|
|
|
if (inclusive) {
|
|
|
- return lte0(compare);
|
|
|
+ return compare <= 0;
|
|
|
} else {
|
|
|
- return lt0(compare);
|
|
|
+ return compare < 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -782,9 +743,9 @@ public class VerifyProcessor {
|
|
|
final boolean inclusive = annotation.inclusive();
|
|
|
//inclusive ? comparisonResult >= 0 : comparisonResult > 0;
|
|
|
if (inclusive) {
|
|
|
- return gte0(compare);
|
|
|
+ return compare >= 0;
|
|
|
} else {
|
|
|
- return gt0(compare);
|
|
|
+ return compare > 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -809,7 +770,7 @@ public class VerifyProcessor {
|
|
|
return false;
|
|
|
}
|
|
|
// length > 0
|
|
|
- return gt0(length);
|
|
|
+ return length > 0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -838,11 +799,11 @@ public class VerifyProcessor {
|
|
|
if (Objects.isNull(value)) {
|
|
|
return false;
|
|
|
}
|
|
|
- if (lt0(min)) {
|
|
|
+ if (min < 0) {
|
|
|
setIllegalArgMessage("The min (%s) parameter of @Size cannot be negative.", min);
|
|
|
return false;
|
|
|
}
|
|
|
- if (lt0(max)) {
|
|
|
+ if (max < 0) {
|
|
|
setIllegalArgMessage("The max (%s) parameter of @Size cannot be negative.", max);
|
|
|
return false;
|
|
|
}
|
|
@@ -891,11 +852,11 @@ public class VerifyProcessor {
|
|
|
setIllegalArgMessage("The @Digits only supports Number & CharSequence.");
|
|
|
return false;
|
|
|
}
|
|
|
- if (lt0(maxInteger)) {
|
|
|
+ if (maxInteger < 0) {
|
|
|
setIllegalArgMessage("The length of the integer '%s' part of @Digits cannot be negative.", maxInteger);
|
|
|
return false;
|
|
|
}
|
|
|
- if (lt0(maxFraction)) {
|
|
|
+ if (maxFraction < 0) {
|
|
|
setIllegalArgMessage("The length of the fraction '%s' part of @Digits cannot be negative.", maxFraction);
|
|
|
return false;
|
|
|
}
|
|
@@ -972,7 +933,7 @@ public class VerifyProcessor {
|
|
|
// cannot split email string at @ as it can be a part of quoted local part of email.
|
|
|
// so we need to split at a position of last @ present in the string:
|
|
|
int splitPosition = val.lastIndexOf('@');
|
|
|
- if (lt0(splitPosition)) {
|
|
|
+ if (splitPosition < 0) {
|
|
|
return false;
|
|
|
}
|
|
|
String localPart = val.substring(0, splitPosition);
|
|
@@ -1110,7 +1071,7 @@ public class VerifyProcessor {
|
|
|
compare = val.compareTo(BigDecimal.valueOf(max));
|
|
|
}
|
|
|
//compare <= 0
|
|
|
- return lte0(compare);
|
|
|
+ return compare <= 0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1150,7 +1111,7 @@ public class VerifyProcessor {
|
|
|
compare = val.compareTo(BigDecimal.valueOf(min));
|
|
|
}
|
|
|
//compare >= 0
|
|
|
- return gte0(compare);
|
|
|
+ return compare >= 0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1173,7 +1134,7 @@ public class VerifyProcessor {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- return lt0(signum((Number) value, GREATER_THAN));
|
|
|
+ return signum((Number) value, GREATER_THAN) < 0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1194,7 +1155,7 @@ public class VerifyProcessor {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- return lte0(signum((Number) value, GREATER_THAN));
|
|
|
+ return signum((Number) value, GREATER_THAN) <= 0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1215,7 +1176,7 @@ public class VerifyProcessor {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- return gt0(signum((Number) value, LESS_THAN));
|
|
|
+ return signum((Number) value, LESS_THAN) > 0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1236,7 +1197,7 @@ public class VerifyProcessor {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- return gte0(signum((Number) value, LESS_THAN));
|
|
|
+ return signum((Number) value, LESS_THAN) >= 0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1320,7 +1281,7 @@ public class VerifyProcessor {
|
|
|
return false;
|
|
|
}
|
|
|
//compare > 0
|
|
|
- return gt0(compare);
|
|
|
+ return compare > 0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1350,7 +1311,7 @@ public class VerifyProcessor {
|
|
|
return false;
|
|
|
}
|
|
|
//compare >= 0
|
|
|
- return gte0(compare);
|
|
|
+ return compare >= 0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1380,7 +1341,7 @@ public class VerifyProcessor {
|
|
|
return false;
|
|
|
}
|
|
|
//compare < 0
|
|
|
- return lt0(compare);
|
|
|
+ return compare < 0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1410,7 +1371,7 @@ public class VerifyProcessor {
|
|
|
return false;
|
|
|
}
|
|
|
//compare <= 0
|
|
|
- return lte0(compare);
|
|
|
+ return compare <= 0;
|
|
|
}
|
|
|
|
|
|
/**
|