Package me.hsgamer.hscore.common
Class Validate
java.lang.Object
me.hsgamer.hscore.common.Validate
Methods to validate
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull Optional<BigDecimal>Convert to numberstatic booleanisClassLoaded(@NotNull String className) Check if the class is loadedstatic booleanisConstructorLoaded(@NotNull String className, @NotNull Class<?>... params) Check if the constructor is loadedstatic booleanisMethodLoaded(@NotNull String className, @NotNull String methodName, @NotNull Class<?>... params) Check if the method is loadedstatic booleanisNullOrEmpty(@Nullable String string) Check if it's null or emptystatic booleanisNullOrEmpty(@Nullable Collection<?> list) Check if it's null or emptystatic booleanisValidBase64(String string) Check if the string is a valid Base64 stringstatic booleanisValidInteger(@NotNull String input) Check if the string is a valid numberstatic booleanisValidPositiveNumber(@NotNull String input) Check if it's a positive numberstatic booleanisValidURL(String string) Check if the string is a valid URLstatic booleanisValidUUID(String string) Check if the string is a validUUID
-
Method Details
-
getNumber
Convert to number- Parameters:
input- the string- Returns:
- the number
-
isValidPositiveNumber
Check if it's a positive number- Parameters:
input- the string- Returns:
- whether it's positive
-
isValidInteger
Check if the string is a valid number- Parameters:
input- the string- Returns:
- whether it's valid
-
isClassLoaded
Check if the class is loaded- Parameters:
className- the class path- Returns:
- whether it's loaded
-
isMethodLoaded
public static boolean isMethodLoaded(@NotNull @NotNull String className, @NotNull @NotNull String methodName, @NotNull @NotNull Class<?>... params) Check if the method is loaded- Parameters:
className- the class pathmethodName- the method's nameparams- the type of parameters- Returns:
- whether it's loaded
-
isConstructorLoaded
public static boolean isConstructorLoaded(@NotNull @NotNull String className, @NotNull @NotNull Class<?>... params) Check if the constructor is loaded- Parameters:
className- the class pathparams- the type of parameters- Returns:
- whether it's loaded
-
isNullOrEmpty
Check if it's null or empty- Parameters:
list- the list- Returns:
- whether it's null or empty
-
isNullOrEmpty
Check if it's null or empty- Parameters:
string- the string- Returns:
- whether it's null or empty
-
isValidURL
Check if the string is a valid URL- Parameters:
string- the input string- Returns:
- true if it is
-
isValidUUID
Check if the string is a validUUID- Parameters:
string- the input string- Returns:
- true if it is
-
isValidBase64
Check if the string is a valid Base64 string- Parameters:
string- the input string- Returns:
- true if it is
-