Class DatevValidator
java.lang.Object
io.github.mrtyldr.datev.validation.DatevValidator
- All Implemented Interfaces:
BiConsumer<Integer,List<String>>
Immutable, implementation-neutral DATEV Buchungsstapel row validator.
This class is a thin adapter: it binds the shared validation core in
datev-exporter-core to the BiConsumer<Integer, List<String>> callback that both
lean DatevFile factories accept, without linking this artifact to either exporter
implementation.
The validator receives logical, unquoted values. CSV parsing and escaping remain the responsibility of the selected exporter.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder for an immutable validator. -
Method Summary
Modifier and TypeMethodDescriptionvoidImplements the standard callback accepted directly by both lean exporters.static DatevValidator.Builderbuilder()Starts an immutable validator builder.io.github.mrtyldr.datev.core.DatevValidationContextcontext()Returns metadata-dependent constraints.booleanCompares the configured mode and context.static DatevValidatorCreates a field-level validator without required or pair checks.inthashCode()Returns a hash code consistent withequals(Object).io.github.mrtyldr.datev.core.DatevValidationModemode()Returns the validation depth.static DatevValidatorstrict()Creates a strict validator without metadata-dependent constraints.toString()Returns a diagnostic description of this validator's configuration.List<io.github.mrtyldr.datev.core.DatevValidationError>Validates by numeric schema version, matching the lean exporters' dependency-free callback.List<io.github.mrtyldr.datev.core.DatevValidationError>Validates a complete fixed-schema row and returns every error in field order.voidvalidateOrThrow(int formatVersion, List<String> values) Validates by numeric schema version and throws one aggregate exception on failure.voidvalidateOrThrow(io.github.mrtyldr.datev.core.DatevSchema schema, List<String> values) Validates and throws one aggregate exception when any rule fails.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.function.BiConsumer
andThen
-
Method Details
-
equals
Compares the configured mode and context. -
hashCode
public int hashCode()Returns a hash code consistent withequals(Object). -
toString
Returns a diagnostic description of this validator's configuration. -
strict
Creates a strict validator without metadata-dependent constraints.- Returns:
- strict validator
-
fieldLevel
Creates a field-level validator without required or pair checks.- Returns:
- field-level validator
-
builder
Starts an immutable validator builder.- Returns:
- new builder
-
mode
public io.github.mrtyldr.datev.core.DatevValidationMode mode()Returns the validation depth.- Returns:
- mode
-
context
public io.github.mrtyldr.datev.core.DatevValidationContext context()Returns metadata-dependent constraints.- Returns:
- immutable context
-
validate
public List<io.github.mrtyldr.datev.core.DatevValidationError> validate(io.github.mrtyldr.datev.core.DatevSchema schema, List<String> values) Validates a complete fixed-schema row and returns every error in field order.- Parameters:
schema- fixed DATEV schemavalues- logical, unquoted cell values- Returns:
- immutable validation errors
- Throws:
IllegalArgumentException- when row width differs from the selected schema
-
validate
public List<io.github.mrtyldr.datev.core.DatevValidationError> validate(int formatVersion, List<String> values) Validates by numeric schema version, matching the lean exporters' dependency-free callback.- Parameters:
formatVersion- DATEV Buchungsstapel format version 12 or 13values- logical, unquoted cell values- Returns:
- immutable validation errors
-
validateOrThrow
Validates and throws one aggregate exception when any rule fails.- Parameters:
schema- fixed DATEV schemavalues- logical, unquoted cell values- Throws:
io.github.mrtyldr.datev.core.DatevValidationException- when validation fails
-
validateOrThrow
Validates by numeric schema version and throws one aggregate exception on failure.- Parameters:
formatVersion- DATEV Buchungsstapel format version 12 or 13values- logical, unquoted cell values
-
accept
Implements the standard callback accepted directly by both lean exporters.- Specified by:
acceptin interfaceBiConsumer<Integer,List<String>> - Parameters:
formatVersion- DATEV Buchungsstapel format version 12 or 13values- immutable logical row values
-