Interface MessageTemplate<Type>

  • All Known Subinterfaces:
    EmailTemplate<Type>

    public interface MessageTemplate<Type>
    MessageTemplate it the template a Message of a Mailing is build of. It must be able to build a Message for each recipient. The Message has to be in the format that is able to be send by a MessageGateway.
    As MessageTemplates are likely to access resources, that have a state. Eg. a Session to the Repository, Binary Values or Database access. Therefore the template must be disposed if there is no further use for it.
    Since:
    5.4
    See Also:
    Mailing
    • Method Detail

      • getType

        Class<Type> getType()
        Returns:
        indicate the Type the message will be build
      • dispose

        void dispose()
              throws MailingException
        Called if the Template will not be used any longer. A subsequent call to buildMessage will fail. Implementations can dispose any used Resources eg. Binary Values, Database access.
        Throws:
        MailingException - in case of exception disposing one of the resources
      • put

        void put​(String var,
                 String replace)
        Adds or overwrites a mapping of this replacer.
        Parameters:
        var - name of the variable to map
        replace - the value of the variable