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 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();
 
  • Constructor Details

    • MessageTemplate0

      public MessageTemplate0(String messageKey, String defaultMessage)
    • MessageTemplate0

      public MessageTemplate0(String messageKey)
  • Method Details

    • create

      public Message create()
      Create a Message based on this MessageTemplate
      Example creating a Message from a MessageTemplate0:
      
       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 this MessageTemplate's AbstractMessageTemplate.getKey() with the provided messageKey
      Example:
      
       MessageTemplate0 ROOT = MessageTemplates.root("ESSENTIALS");
      
       // SubKey has key: "ESSENTIALS.VALIDATION"
       MessageTemplate0 VALIDATION = ROOT.subKey("VALIDATION");
       
      Parameters:
      messageKey - the message key
      Returns:
      a new MessageTemplate with AbstractMessageTemplate.getKey(): this.getKey() + "." + messageKey
    • subKey

      public MessageTemplate0 subKey(String messageKey, String defaultMessage)
      Create a MessageTemplate with a key that is a concatenation of this MessageTemplate's AbstractMessageTemplate.getKey() and the provided messageKey
      Example:
      
       MessageTemplate0 ROOT = MessageTemplates.root("ESSENTIALS");
      
       // SubKey has key: "ESSENTIALS.VALIDATION"
       MessageTemplate0 VALIDATION = ROOT.subKey("VALIDATION");
       
      Parameters:
      messageKey - the message key
      defaultMessage - the default message
      Returns:
      a new MessageTemplate with AbstractMessageTemplate.getKey(): this.getKey() + "." + messageKey and the provided defaultMessage
    • key1

      public <PARAM_1> MessageTemplate1<PARAM_1> key1(String messageKey, String defaultMessage)
      Create a MessageTemplates with 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 key
      defaultMessage - the default message
      Returns:
      a new MessageTemplate with AbstractMessageTemplate.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 a MessageTemplates with 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 0
      PARAM_2 - the type for the parameter with index 1
      Parameters:
      messageKey - the message key
      defaultMessage - the default message
      Returns:
      a new MessageTemplate with AbstractMessageTemplate.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 a MessageTemplates with 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 0
      PARAM_2 - the type for the parameter with index 1
      PARAM_3 - the type for the parameter with index 2
      Parameters:
      messageKey - the message key
      defaultMessage - the default message
      Returns:
      a new MessageTemplate with AbstractMessageTemplate.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 a MessageTemplates with 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 0
      PARAM_2 - the type for the parameter with index 1
      PARAM_3 - the type for the parameter with index 2
      PARAM_3 - the type for the parameter with index 3
      Parameters:
      messageKey - the message key
      defaultMessage - the default message
      Returns:
      a new MessageTemplate with AbstractMessageTemplate.getKey(): this.getKey() + "." + messageKey and the provided defaultMessage