Skip to content
This repository was archived by the owner on Jan 22, 2019. It is now read-only.
This repository was archived by the owner on Jan 22, 2019. It is now read-only.

Add fluent addColumns operation to CsvSchema.Builder #130

Closed
@ansell

Description

@ansell

The current CsvSchema.Builder doesn't support the fluent addition of multiple fields in a single operation. This makes it necessary to break out of the fluent interface temporarily to loop through field names before completing the build.

This could be supported through either 1 or 2 new operations added to CsvSchema.Builder:

        public Builder addColumns(Iterable<Column> cs) {
            for (Column c : cs) {
                _columns.add(c);
            }
            return this;
        }
        public Builder addColumns(Iterable<String> names, ColumnType type) {
            Builder result = this;
            for (String name : names) {
                result = addColumn(name, type);
            }
            return result;
        }

Note that CsvSchema itself would match Iterable<Column>, which may or may not be what is most intuitive as it wouldn't copy across all of the other values as the Builder(CsvSchema src) constructor does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions