Class MessageTemplate0
java.lang.Object
dk.cloudcreate.essentials.shared.messages.AbstractMessageTemplate
dk.cloudcreate.essentials.shared.messages.MessageTemplate0
- All Implemented Interfaces:
MessageTemplate
Represents a
Example defining a
MessageTemplate accepting 0 parameters.Example defining a
MessageTemplate0's:
// Has key: "ESSENTIALS"
MessageTemplate0 ROOT = MessageTemplates.root("ESSENTIALS");
// Has key: "ESSENTIALS.VALIDATION"
MessageTemplate0 VALIDATION = ROOT.subKey("VALIDATION");
Example creating a Message from a MessageTemplate0:
MessageTemplate0 VALIDATION = ROOT.subKey("VALIDATION");
Message msg = VALIDATION.create();
-
Field Summary
Fields inherited from class dk.cloudcreate.essentials.shared.messages.AbstractMessageTemplate
defaultMessage, key -
Constructor Summary
ConstructorsConstructorDescriptionMessageTemplate0(String messageKey) MessageTemplate0(String messageKey, String defaultMessage) -
Method Summary
Modifier and TypeMethodDescriptioncreate()<PARAM_1> MessageTemplate1<PARAM_1>Create aMessageTemplateswith 1 parameter Example:<PARAM_1,PARAM_2>
MessageTemplate2<PARAM_1,PARAM_2> Create aMessageTemplateswith 2 parameters Example:<PARAM_1,PARAM_2, PARAM_3>
MessageTemplate3<PARAM_1,PARAM_2, PARAM_3> Create aMessageTemplateswith 3 parameters Example:<PARAM_1,PARAM_2, PARAM_3, PARAM_4>
MessageTemplate4<PARAM_1,PARAM_2, PARAM_3, PARAM_4> Create aMessageTemplateswith 4 parameters Example:Create a sub key which concatenates thisMessageTemplate'sAbstractMessageTemplate.getKey()with the providedmessageKey
Example:Create aMessageTemplatewith a key that is a concatenation of thisMessageTemplate'sAbstractMessageTemplate.getKey()and the providedmessageKey
Example:Methods inherited from class dk.cloudcreate.essentials.shared.messages.AbstractMessageTemplate
equals, getDefaultMessage, getKey, hashCode, toString
-
Constructor Details
-
MessageTemplate0
-
MessageTemplate0
-
-
Method Details
-
create
Create aMessagebased on thisMessageTemplate
Example creating aMessagefrom aMessageTemplate0:MessageTemplate0 VALIDATION = ROOT.subKey("VALIDATION"); Message msg = VALIDATION.create();- Returns:
- the new
Message
-
subKey
Create a sub key which concatenates thisMessageTemplate'sAbstractMessageTemplate.getKey()with the providedmessageKey
Example:MessageTemplate0 ROOT = MessageTemplates.root("ESSENTIALS"); // SubKey has key: "ESSENTIALS.VALIDATION" MessageTemplate0 VALIDATION = ROOT.subKey("VALIDATION");- Parameters:
messageKey- the message key- Returns:
- a new
MessageTemplatewithAbstractMessageTemplate.getKey(): this.getKey() + "." + messageKey
-
subKey
Create aMessageTemplatewith a key that is a concatenation of thisMessageTemplate'sAbstractMessageTemplate.getKey()and the providedmessageKey
Example:MessageTemplate0 ROOT = MessageTemplates.root("ESSENTIALS"); // SubKey has key: "ESSENTIALS.VALIDATION" MessageTemplate0 VALIDATION = ROOT.subKey("VALIDATION");- Parameters:
messageKey- the message keydefaultMessage- the default message- Returns:
- a new
MessageTemplatewithAbstractMessageTemplate.getKey(): this.getKey() + "." + messageKey and the provided defaultMessage
-
key1
Create aMessageTemplateswith 1 parameter Example:MessageTemplate0 ROOT = MessageTemplates.root("ESSENTIALS"); // Has key: "ESSENTIALS.ACCOUNT_NOT_ACTIVATED" MessageTemplate1<String> ACCOUNT_NOT_ACTIVATED = ROOT.key1("ACCOUNT_NOT_ACTIVATED", "Account {0} is not activated");- Type Parameters:
PARAM_1- the type for the parameter with index 0- Parameters:
messageKey- the message keydefaultMessage- the default message- Returns:
- a new
MessageTemplatewithAbstractMessageTemplate.getKey(): this.getKey() + "." + messageKey and the provided defaultMessage
-
key2
public <PARAM_1,PARAM_2> MessageTemplate2<PARAM_1,PARAM_2> key2(String messageKey, String defaultMessage) Create aMessageTemplateswith 2 parameters Example:MessageTemplate0 ROOT = MessageTemplates.root("ESSENTIALS"); // Has key: "ESSENTIALS.AMOUNT_TOO_HIGH" MessageTemplate2<BigDecimal, BigDecimal> AMOUNT_TOO_HIGH = ROOT.key2("AMOUNT_TOO_HIGH", "Amount {0} is higher than {1}");- Type Parameters:
PARAM_1- the type for the parameter with index 0PARAM_2- the type for the parameter with index 1- Parameters:
messageKey- the message keydefaultMessage- the default message- Returns:
- a new
MessageTemplatewithAbstractMessageTemplate.getKey(): this.getKey() + "." + messageKey and the provided defaultMessage
-
key3
public <PARAM_1,PARAM_2, MessageTemplate3<PARAM_1,PARAM_3> PARAM_2, key3PARAM_3> (String messageKey, String defaultMessage) Create aMessageTemplateswith 3 parameters Example:MessageTemplate0 ROOT = MessageTemplates.root("ESSENTIALS"); // Has key: "ESSENTIALS.ACCOUNT_OVERDRAWN" MessageTemplate3<String, BigDecimal, BigDecimal> ACCOUNT_OVERDRAWN = ROOT.key3("ACCOUNT_OVERDRAWN", "Account {0} is overdrawn by {1}. Fee {2}");- Type Parameters:
PARAM_1- the type for the parameter with index 0PARAM_2- the type for the parameter with index 1PARAM_3- the type for the parameter with index 2- Parameters:
messageKey- the message keydefaultMessage- the default message- Returns:
- a new
MessageTemplatewithAbstractMessageTemplate.getKey(): this.getKey() + "." + messageKey and the provided defaultMessage
-
key4
public <PARAM_1,PARAM_2, MessageTemplate4<PARAM_1,PARAM_3, PARAM_4> PARAM_2, key4PARAM_3, PARAM_4> (String messageKey, String defaultMessage) Create aMessageTemplateswith 4 parameters Example:MessageTemplate0 ROOT = MessageTemplates.root("ESSENTIALS"); // Has key: "ESSENTIALS.ACCOUNT_OVERDRAWN" MessageTemplate4<String, BigDecimal, BigDecimal, LocalDate> ACCOUNT_OVERDRAWN = ROOT.key4("ACCOUNT_OVERDRAWN", "Account {0} is overdrawn by {1}. Fee of {2} will be debited on the {3}");- Type Parameters:
PARAM_1- the type for the parameter with index 0PARAM_2- the type for the parameter with index 1PARAM_3- the type for the parameter with index 2PARAM_3- the type for the parameter with index 3- Parameters:
messageKey- the message keydefaultMessage- the default message- Returns:
- a new
MessageTemplatewithAbstractMessageTemplate.getKey(): this.getKey() + "." + messageKey and the provided defaultMessage
-