public class ValidationResult extends Object
IP2LocationConfig.
A validation result contains lists of errors and warnings discovered during configuration validation. Errors indicate problems that must be fixed before the configuration can be applied, while warnings indicate potential issues that may be acceptable in some situations.
ValidationResult result = config.validate();
if (!result.isValid()) {
for (String error : result.getErrors()) {
System.err.println("Error: " + error);
}
}
if (result.hasWarnings()) {
for (String warning : result.getWarnings()) {
System.out.println("Warning: " + warning);
}
}
| Field | Validation | Severity |
|---|---|---|
| Token | Required when enabled | Error |
| Database path | Must be non-empty | Error |
| Database | Must be specified | Error |
| Memory-mapped files | IPv6 with large DB | Warning |
IP2LocationConfig.validate()| Modifier and Type | Class and Description |
|---|---|
static class |
ValidationResult.Builder
Builder for constructing
ValidationResult instances. |
| Modifier and Type | Method and Description |
|---|---|
static ValidationResult.Builder |
builder()
Creates a new builder for constructing validation results.
|
List<String> |
getAllMessages()
Returns all messages (errors and warnings) combined.
|
List<String> |
getErrors()
Returns the list of error messages.
|
String |
getFormattedMessages()
Returns a formatted string representation of all validation messages.
|
List<String> |
getWarnings()
Returns the list of warning messages.
|
boolean |
hasWarnings()
Returns whether there are any warnings.
|
boolean |
isValid()
Returns whether the configuration is valid (has no errors).
|
String |
toString() |
static ValidationResult |
valid()
Returns a validation result indicating the configuration is valid.
|
public static ValidationResult valid()
public boolean isValid()
A configuration with warnings but no errors is considered valid.
true if there are no errors, false otherwisepublic boolean hasWarnings()
true if there are warnings, false otherwisepublic List<String> getErrors()
The returned list is unmodifiable.
public List<String> getWarnings()
The returned list is unmodifiable.
public List<String> getAllMessages()
public String getFormattedMessages()
Each message is prefixed with "ERROR: " or "Warning: " accordingly.
public static ValidationResult.Builder builder()
Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© 2026 Mindus SARL. All rights reserved.