Package io.github.mrtyldr.datev.advanced
Class DatevFile.Builder
java.lang.Object
io.github.mrtyldr.datev.advanced.DatevFile.Builder
- Enclosing class:
- DatevFile
Builds a file with immutable header configuration.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates a new file.Changes the character set used by output-stream convenience methods.headerOrder(String... completeOrder) Reorders the complete header using canonical keys or unambiguous output names.headerOrder(List<String> completeOrder) Reorders the complete header using canonical keys or unambiguous output names.metadata(io.github.mrtyldr.datev.core.DatevMetadata metadata) Adds the typed EXTF management record required for a complete Buchungsstapel v13 file.renameHeader(String canonicalKey, String outputName) Renames one header while retaining its stable canonical key and position.renameHeaders(Map<String, String> namesByCanonicalKey) Renames selected headers while retaining their stable canonical keys and positions.validationMode(io.github.mrtyldr.datev.core.DatevValidationMode validationMode) Selects semantic row validation.
-
Method Details
-
renameHeader
Renames one header while retaining its stable canonical key and position.- Parameters:
canonicalKey- the canonical key of the header to renameoutputName- the replacement output name- Returns:
- this builder
-
renameHeaders
Renames selected headers while retaining their stable canonical keys and positions.- Parameters:
namesByCanonicalKey- replacement output names keyed by canonical header key- Returns:
- this builder
-
headerOrder
Reorders the complete header using canonical keys or unambiguous output names.- Parameters:
completeOrder- every header identifier in the desired order- Returns:
- this builder
-
headerOrder
Reorders the complete header using canonical keys or unambiguous output names.- Parameters:
completeOrder- every header identifier in the desired order- Returns:
- this builder
-
charset
Changes the character set used by output-stream convenience methods.The caller is responsible for any encoding-specific markers required by the target DATEV import route.
- Parameters:
charset- the charset for output-stream based writing- Returns:
- this builder
-
metadata
Adds the typed EXTF management record required for a complete Buchungsstapel v13 file.Complete output intentionally requires the exact official v13 header, strict row validation and Windows-1252 encoding. These constraints prevent metadata that disagrees with the following records.
- Parameters:
metadata- the v13 metadata to serialize as record one- Returns:
- this builder
-
validationMode
public DatevFile.Builder validationMode(io.github.mrtyldr.datev.core.DatevValidationMode validationMode) Selects semantic row validation.Official v12/v13 headers default to
DatevValidationMode.STRICT; custom headers default toDatevValidationMode.NONE. Complete EXTF output requires strict validation.- Parameters:
validationMode- the mode applied atomically during every append- Returns:
- this builder
-
build
Creates a new file. Reusing this builder never shares row state between files.- Returns:
- a new file with this builder's current configuration
-