Class MessageTemplateValidator
java.lang.Object
pl.edu.icm.unity.engine.api.msgtemplate.MessageTemplateValidator
Helper: checks if given message or text has only variables supported by a template consumer.
- Author:
- P. Piernik
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionextractCustomVariables
(I18nMessage message) extractVariables
(I18nMessage message) static void
validateMessage
(pl.edu.icm.unity.base.msgtemplates.MessageTemplateDefinition consumer, I18nMessage message) Validates a singleMessageTemplate.Message
static void
validateText
(pl.edu.icm.unity.base.msgtemplates.MessageTemplateDefinition consumer, String text, boolean checkMandatory)
-
Constructor Details
-
MessageTemplateValidator
public MessageTemplateValidator()
-
-
Method Details
-
validateMessage
public static void validateMessage(pl.edu.icm.unity.base.msgtemplates.MessageTemplateDefinition consumer, I18nMessage message) throws MessageTemplateValidator.IllegalVariablesException, MessageTemplateValidator.MandatoryVariablesException Validates a singleMessageTemplate.Message
- Parameters:
consumer
-message
-- Throws:
MessageTemplateValidator.MandatoryVariablesException
WrongArgumentException
MessageTemplateValidator.IllegalVariablesException
-
extractVariables
- Returns:
- all variables used in message template (union over all language variants)
-
extractCustomVariables
- Returns:
- all non-built-in variables used in message template (union over all language variants)
-
validateText
public static void validateText(pl.edu.icm.unity.base.msgtemplates.MessageTemplateDefinition consumer, String text, boolean checkMandatory) throws MessageTemplateValidator.IllegalVariablesException, MessageTemplateValidator.MandatoryVariablesException
-