public static final class ValidationResult.Builder extends Object
ValidationResult instances.
This builder collects errors and warnings during validation, then produces an immutable result.
ValidationResult.Builder builder=ValidationResult.builder();
if ( token==null || token.isEmpty() )
{
builder.addError("Token is required when service is enabled");
}
if ( useMemoryMappedFiles && database.getIPv6FileSize()>100_000_000 )
{
builder.addWarning("Large IPv6 database may consume significant memory");
}
return builder.build();
| Modifier and Type | Method and Description |
|---|---|
ValidationResult.Builder |
addError(String message)
Adds an error message.
|
ValidationResult.Builder |
addWarning(String message)
Adds a warning message.
|
ValidationResult |
build()
Builds an immutable validation result.
|
boolean |
hasErrors()
Returns whether any errors have been added.
|
boolean |
hasWarnings()
Returns whether any warnings have been added.
|
public ValidationResult.Builder addError(String message)
Errors indicate problems that must be fixed before the configuration can be applied.
message - The error message (should not be null or empty)public ValidationResult.Builder addWarning(String message)
Warnings indicate potential issues that may be acceptable in some situations.
message - The warning message (should not be null or empty)public boolean hasErrors()
true if there are errors, false otherwisepublic boolean hasWarnings()
true if there are warnings, false otherwisepublic ValidationResult build()
If no errors or warnings were added, returns the shared
ValidationResult.valid() instance for efficiency.
Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© 2026 Mindus SARL. All rights reserved.