Class MessageTemplate3<PARAM_1,PARAM_2,PARAM_3>
java.lang.Object
dk.cloudcreate.essentials.shared.messages.AbstractMessageTemplate
dk.cloudcreate.essentials.shared.messages.MessageTemplate3<PARAM_1,PARAM_2,PARAM_3>
- All Implemented Interfaces:
MessageTemplate
Represents a
Example defining a
MessageTemplate accepting 3 parametersExample defining a
MessageTemplate3's:
// Has key: "ESSENTIALS"
MessageTemplate0 ROOT = MessageTemplates.root("ESSENTIALS");
// Has key: "ESSENTIALS.ACCOUNT_OVERDRAWN"
MessageTemplate3<String, BigDecimal, BigDecimal> ACCOUNT_OVERDRAWN = MessageTemplates.key3("ACCOUNT_OVERDRAWN",
"Account {0} is overdrawn by {1}. Fee {2}");
Example creating a Message from a MessageTemplate3:
MessageTemplate2<String, BigDecimal, BigDecimal> ACCOUNT_OVERDRAWN = MessageTemplates.key3("ACCOUNT_OVERDRAWN",
"Account {0} is overdrawn by {1}. Fee {2}");
String accountId = ...;
BigDecimal requestedAmount = ...;
BigDecimal maximumAmountAllowed = ...;
Message msg = ACCOUNT_OVERDRAWN.create(accountId,
requestedAmount,
maximumAmountAllowed);
-
Field Summary
Fields inherited from class dk.cloudcreate.essentials.shared.messages.AbstractMessageTemplate
defaultMessage, key -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate aMessage, with the provided parameter, based on thisMessageTemplate
Example creating aMessagefrom aMessageTemplate3:Methods inherited from class dk.cloudcreate.essentials.shared.messages.AbstractMessageTemplate
equals, getDefaultMessage, getKey, hashCode, toString
-
Constructor Details
-
MessageTemplate3
-
-
Method Details
-
create
Create aMessage, with the provided parameter, based on thisMessageTemplate
Example creating aMessagefrom aMessageTemplate3:MessageTemplate2<String, BigDecimal, BigDecimal> ACCOUNT_OVERDRAWN = MessageTemplates.key3("ACCOUNT_OVERDRAWN", "Account {0} is overdrawn by {1}. Fee {2}"); String accountId = ...; BigDecimal requestedAmount = ...; BigDecimal maximumAmountAllowed = ...; Message msg = ACCOUNT_OVERDRAWN.create(accountId, requestedAmount, maximumAmountAllowed);- Parameters:
param1- the parameter with index 0 in the generatedMessage.getMessage()param2- the parameter with index 1 in the generatedMessage.getMessage()param3- the parameter with index 2 in the generatedMessage.getMessage()- Returns:
- the new
Messagewith the parameter applied
-