All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gherkin.formatter.model.Examples Maven / Gradle / Ivy

There is a newer version: 2.12.2
Show newest version
package gherkin.formatter.model;

import gherkin.formatter.Formatter;

import java.util.ArrayList;
import java.util.List;

public class Examples extends TagStatement {
    private List rows;

    public static class Builder implements gherkin.formatter.model.Builder {
        private final List comments;
        private final List tags;
        private final String keyword;
        private final String name;
        private final String description;
        private final int line;
        private final String id;
        private List rows;

        public Builder(List comments, List tags, String keyword, String name, String description, int line, String id) {
            this.comments = comments;
            this.tags = tags;
            this.keyword = keyword;
            this.name = name;
            this.description = description;
            this.line = line;
            this.id = id;
        }

        public void row(List comments, List cells, int line, String id) {
            if (rows == null) {
                rows = new ArrayList();
            }
            rows.add(new ExamplesTableRow(comments, cells, line, id));
        }

        public void replay(Formatter formatter) {
            new Examples(comments, tags, keyword, name, description, line, id, rows).replay(formatter);
        }

        public void docString(DocString docString) {
            throw new IllegalStateException("Can't have DocString in Examples");
        }
    }

    public Examples(List comments, List tags, String keyword, String name, String description, int line, String id, List rows) {
        super(comments, tags, keyword, name, description, line, id);
        this.rows = rows;
    }

    @Override
    public void replay(Formatter formatter) {
        formatter.examples(this);
    }

    public List getRows() {
        return rows;
    }

    public void setRows(List rows) {
        this.rows = rows;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy