Class MessageTemplate0
- java.lang.Object
-
- dk.cloudcreate.essentials.shared.messages.AbstractMessageTemplate
-
- dk.cloudcreate.essentials.shared.messages.MessageTemplate0
-
- All Implemented Interfaces:
MessageTemplate
public class MessageTemplate0 extends AbstractMessageTemplate
Represents aMessageTemplateaccepting 0 parameters.
Example defining aMessageTemplate0's:
Example creating a// Has key: "ESSENTIALS" MessageTemplate0 ROOT = MessageTemplates.root("ESSENTIALS"); // Has key: "ESSENTIALS.VALIDATION" MessageTemplate0 VALIDATION = ROOT.subKey("VALIDATION");Messagefrom aMessageTemplate0: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
Constructors Constructor Description MessageTemplate0(String messageKey)MessageTemplate0(String messageKey, String defaultMessage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Messagecreate()<PARAM_1> MessageTemplate1<PARAM_1>key1(String messageKey, String defaultMessage)Create aMessageTemplateswith 1 parameter Example:<PARAM_1,PARAM_2>
MessageTemplate2<PARAM_1,PARAM_2>key2(String messageKey, String defaultMessage)Create aMessageTemplateswith 2 parameters Example:<PARAM_1,PARAM_2,PARAM_3>
MessageTemplate3<PARAM_1,PARAM_2,PARAM_3>key3(String messageKey, String defaultMessage)Create aMessageTemplateswith 3 parameters Example:<PARAM_1,PARAM_2,PARAM_3,PARAM_4>
MessageTemplate4<PARAM_1,PARAM_2,PARAM_3,PARAM_4>key4(String messageKey, String defaultMessage)Create aMessageTemplateswith 4 parameters Example:MessageTemplate0subKey(String messageKey)Create a sub key which concatenates thisMessageTemplate'sAbstractMessageTemplate.getKey()with the providedmessageKey
Example:MessageTemplate0subKey(String messageKey, String defaultMessage)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
-
-
-
-
Method Detail
-
create
public Message create()
Create aMessagebased on thisMessageTemplate
Example creating aMessagefrom aMessageTemplate0:MessageTemplate0 VALIDATION = ROOT.subKey("VALIDATION"); Message msg = VALIDATION.create();- Returns:
- the new
Message
-
subKey
public MessageTemplate0 subKey(String messageKey)
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
public MessageTemplate0 subKey(String messageKey, String defaultMessage)
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
public <PARAM_1> MessageTemplate1<PARAM_1> key1(String messageKey, String defaultMessage)
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,PARAM_3> MessageTemplate3<PARAM_1,PARAM_2,PARAM_3> key3(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,PARAM_3,PARAM_4> MessageTemplate4<PARAM_1,PARAM_2,PARAM_3,PARAM_4> key4(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
-
-