Class Validator.Context
java.lang.Object
io.github.kaktushose.jdac.dispatching.validation.Validator.Context
- Enclosing interface:
Validator<T, A extends Annotation>
This context provides access to the
InvocationContext of this interaction and
has some utility methods useful for error messages.-
Constructor Summary
ConstructorsConstructorDescriptionContext(InvocationContext<?> invocationContext, ErrorMessageFactory errorMessageFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidUsed to fail a validation and cancel theInvocationContextnet.dv8tion.jda.api.utils.messages.MessageCreateDatafailMessage(String content, Entry... placeholder) This method returns a formatted, optionally resolved (and localized), error message based onErrorMessageFactory.getConstraintFailedMessage(ErrorMessageFactory.ErrorContext, String).
-
Constructor Details
-
Context
- Parameters:
invocationContext- the interactionsInvocationContexterrorMessageFactory- theErrorMessageFactoryto be used to construct the cancel message
-
-
Method Details
-
invocationContext
- Returns:
- the
InvocationContextof this interaction
-
failMessage
public net.dv8tion.jda.api.utils.messages.MessageCreateData failMessage(String content, Entry... placeholder) This method returns a formatted, optionally resolved (and localized), error message based onErrorMessageFactory.getConstraintFailedMessage(ErrorMessageFactory.ErrorContext, String).- Parameters:
content- the message or localization keyplaceholder- the variables used for localization- See Also:
-
fail
Used to fail a validation and cancel theInvocationContext- Parameters:
failMessage- the message or localization keyplaceholder- the variables used for localization- See Also:
-