Class DatevFile.Builder

java.lang.Object
io.github.mrtyldr.datev.plain.DatevFile.Builder
Enclosing class:
DatevFile

public static final class DatevFile.Builder extends Object
Configures a fixed-schema file, including the optional EXTF management record.

The static factories cover the common cases; this builder exists so schema, validator and metadata can be combined without a factory per combination. Instances are not thread-safe.

  • Method Details

    • validator

      public DatevFile.Builder validator(BiConsumer<Integer,List<String>> validator)
      Sets the optional row validator.
      Parameters:
      validator - receives the format version and each immutable aligned row
      Returns:
      this builder
    • metadata

      public DatevFile.Builder metadata(io.github.mrtyldr.datev.core.DatevMetadata metadata)
      Sets the EXTF management record written before the heading.

      The metadata's format version must match this builder's schema, so a complete file cannot silently declare a version it does not contain.

      Parameters:
      metadata - the management record
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the metadata's format version differs from the schema
    • build

      public DatevFile build()
      Creates the configured file.
      Returns:
      a new file