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
(pl.edu.icm.unity.base.i18n.I18nMessage message) extractVariables
(pl.edu.icm.unity.base.i18n.I18nMessage message) static void
validateMessage
(pl.edu.icm.unity.base.msg_template.MessageTemplateDefinition consumer, pl.edu.icm.unity.base.i18n.I18nMessage message) Validates a singleMessageTemplate.Message
static void
validateText
(pl.edu.icm.unity.base.msg_template.MessageTemplateDefinition consumer, String text, boolean checkMandatory)
-
Constructor Details
-
MessageTemplateValidator
public MessageTemplateValidator()
-
-
Method Details
-
validateMessage
public static void validateMessage(pl.edu.icm.unity.base.msg_template.MessageTemplateDefinition consumer, pl.edu.icm.unity.base.i18n.I18nMessage message) throws MessageTemplateValidator.IllegalVariablesException, MessageTemplateValidator.MandatoryVariablesException Validates a singleMessageTemplate.Message
- Parameters:
consumer
-message
-- Throws:
MessageTemplateValidator.MandatoryVariablesException
pl.edu.icm.unity.base.exceptions.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.msg_template.MessageTemplateDefinition consumer, String text, boolean checkMandatory) throws MessageTemplateValidator.IllegalVariablesException, MessageTemplateValidator.MandatoryVariablesException
-