com.aspose.email

Interfaces

Classes

Enums

Exceptions

com.aspose.email

Class TemplateEngine



  • public final class TemplateEngine
    extends Object

    This class uses specified template to construct E-Mail messages.

    • Constructor Detail

      • TemplateEngine

        public TemplateEngine(String fileName)

        Initializes a new instance of the TemplateEngine class.

        Parameters:
        fileName - Name of the file.
      • TemplateEngine

        public TemplateEngine(MailMessage templateMessage)

        Initializes a new instance of the TemplateEngine class.

        Parameters:
        templateMessage - The template message.
    • Method Detail

      • registerRoutine

        public final void registerRoutine(String name,
                           TemplateRoutine routine)

        Registers the template routine to the temaplate engine.

        Parameters:
        name - The name of the funciton.
        routine - Delegate processing the data
      • isRoutineRegistered

        public final boolean isRoutineRegistered(String name)

        Determines if a name of template routine is registered in the template engine.

        Parameters:
        name - The name that is used to register the template routine.
        Returns:
        Returns True if the name is registered in the template engine, otherwise returns False.
      • unregisterRoutine

        public final void unregisterRoutine(String name)

        Unregister the template routine from the template engine by name.

        Parameters:
        name - The name that is used to unregister the template routine.
      • merge

        public final MailMessage merge(MailMessage source)

        Merge a source MailMessage with the template

        Parameters:
        source - The source MailMessage
        Returns:
        The MailMessage merged with template
      • merge

        public final MailMessage merge(DataRow row)

        Merge a source DataRow with the template.

        Parameters:
        row - The source DataRow.
        Returns:
        The MailMessage merged with template.
      • reset

        public final void reset()

        Resets this instance.

      • instantiate

        public final MailMessageCollection instantiate(DataTable table,
                                        DataColumnMappingCollection mappings)

        Instantiates the template with a DataTable as datasource.

        Parameters:
        table - The DataTable, which contains the source data to instantiate the template.
        mappings - The IColumnMappingCollection, which represents the mapping between the source column in DataTable and target field in template
        Returns:
        A MailMessageCollection that generated by the template and the datasource.
      • instantiate

        public final MailMessageCollection instantiate(DataTable table)

        Instantiates the template with a DataTable as datasource.

        Parameters:
        table - The DataTable, which contains the source data to instantiate the template.
        Returns:
        A MailMessageCollection that generated by the template and the datasource.
      • instantiate

        public final MailMessageCollection instantiate(DataRowCollection rows,
                                        DataColumnMappingCollection mappings)

        Instantiates the template with a DataRowCollection as datasource.

        Parameters:
        rows - The DataRowCollection, which contains the source data to instantiate the template.
        mappings - The IColumnMappingCollection, which represents the mapping between the source column in data source and target field in template
        Returns:
        A MailMessageCollection that generated by the template and the datasource.
      • instantiate

        public final MailMessageCollection instantiate(DataRowCollection rows)

        Instantiates the template with a DataRowCollection as datasource.

        Parameters:
        rows - The DataRowCollection, which contains the source data to instantiate the template.
        Returns:
        A MailMessageCollection that generated by the template and the datasource.
      • instantiate

        public final MailMessageCollection instantiate(IDataReader reader)

        Instantiates the template with a IDataReader as datasource.

        Parameters:
        reader - The IDataReader, which will provide the source data to instantiate the template.
        Returns:
        A MailMessageCollection that generated by the template and the datasource.