001// Generated by delombok at Sun Jun 30 16:31:41 CEST 2019
002package com.credibledoc.substitution.doc.module.substitution.participant;
003
004import com.credibledoc.substitution.core.content.Content;
005import com.credibledoc.substitution.core.content.ContentGenerator;
006import com.credibledoc.substitution.core.placeholder.Placeholder;
007import lombok.NonNull;
008import net.steppschuh.markdowngenerator.table.Table;
009import com.credibledoc.substitution.doc.module.substitution.markdown.table.TableService;
010import com.credibledoc.substitution.doc.plantuml.Participant;
011import org.springframework.stereotype.Service;
012import javax.inject.Inject;
013
014/**
015 * Generates a table of {@link Participant}s maintained in the substitution-doc module.
016 */
017@Service
018public class ParticipantsTableMarkdownGenerator implements ContentGenerator {
019    @NonNull
020    private final TableService tableService;
021
022    @Override
023    public Content generate(Placeholder placeholder) {
024        Table.Builder tableBuilder = new Table.Builder().addRow("Participant name", "Description");
025        String markdown = tableService.createMarkdownTableFromEnum(tableBuilder, Participant.class);
026        Content content = new Content();
027        content.setMarkdownContent(markdown);
028        return content;
029    }
030
031    @Inject
032    @java.lang.SuppressWarnings("all")
033    public ParticipantsTableMarkdownGenerator(@NonNull final TableService tableService) {
034        if (tableService == null) {
035            throw new java.lang.NullPointerException("tableService");
036        }
037        this.tableService = tableService;
038    }
039}