Class ParameterUtils
java.lang.Object
dev.sympho.modular_commands.utils.ParameterUtils
Utility functions for Parameter interfaces.
- Since:
- 1.0
- Version:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionValidates a parameter.static @MatchesRegex("(?Us)^.{1,100}+$") StringvalidateDescription(@MatchesRegex("(?Us)^.{1,100}+$") String description) Validates the description of a parameter.static @MatchesRegex("(?U)^[-_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") StringvalidateName(@MatchesRegex("(?U)^[-_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") String name) Validates the name of a parameter.
-
Method Details
-
validateName
@Pure @StaticallyExecutable public static @MatchesRegex("(?U)^[-_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") String validateName(@MatchesRegex("(?U)^[-_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") String name) throws IllegalArgumentException Validates the name of a parameter.- Parameters:
name- The name to validate.- Returns:
- The validated name.
- Throws:
IllegalArgumentException- if the name is not valid.
-
validateDescription
@Pure @StaticallyExecutable public static @MatchesRegex("(?Us)^.{1,100}+$") String validateDescription(@MatchesRegex("(?Us)^.{1,100}+$") String description) throws IllegalArgumentException Validates the description of a parameter.- Parameters:
description- The description to validate.- Returns:
- The validated description.
- Throws:
IllegalArgumentException- if the description is not valid.
-
validate
@Pure public static <T extends @NonNull Object> Parameter<T> validate(Parameter<T> parameter) throws IllegalArgumentException Validates a parameter.- Type Parameters:
T- The argument type.- Parameters:
parameter- The parameter to validate.- Returns:
- The validated parameter.
- Throws:
IllegalArgumentException- if the parameter is not valid.
-