Class MessageTemplateValidator
- java.lang.Object
-
- pl.edu.icm.unity.engine.api.msgtemplate.MessageTemplateValidator
-
public class MessageTemplateValidator extends Object
Helper: checks if given message or text has only variables supported by a template consumer.- Author:
- P. Piernik
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MessageTemplateValidator.IllegalVariablesException
static class
MessageTemplateValidator.MandatoryVariablesException
-
Constructor Summary
Constructors Constructor Description MessageTemplateValidator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Set<String>
extractCustomVariables(I18nMessage message)
static Set<String>
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)
-
-
-
Method Detail
-
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
public static Set<String> extractVariables(I18nMessage message)
- Returns:
- all variables used in message template (union over all language variants)
-
extractCustomVariables
public static Set<String> extractCustomVariables(I18nMessage message)
- 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
-
-