Class ConfigLoadResult
java.lang.Object
com.ultikits.ultitools.config.document.ConfigLoadResult
What reading one config file found.
ConfigDocument.load(Path) returns one of four states and never
throws, so a file that exists but cannot be read or parsed is never mistaken for a missing file - the
distinction that keeps the framework from overwriting an operator's broken file with defaults
(UltiKits/UltiTools-Reborn#511, #470).- Since:
- 6.3.0
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final IOExceptionprivate final ConfigDocumentprivate final Pathprivate final Stringprivate static final Patternprivate final Stringprivate final Stringprivate final ConfigLoadResult.State -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateConfigLoadResult(Path file, ConfigLoadResult.State state, ConfigDocument document, String fingerprint, IOException cause, String parserMessage, String parserLocation) -
Method Summary
Modifier and TypeMethodDescription(package private) static ConfigLoadResultcause()Why the file could not be read.document()The parsed document.file()The file that was read.The SHA-256 of the bytes read, as 64 lower-case hex digits, so a later write can tell whether the file changed on disk since it was read.(package private) static ConfigLoadResultloaded(Path file, ConfigDocument document, String fingerprint) Why the file could not be parsed: the parser's own message, naming the line and column.A value-safe parse diagnostic shared by configuration loads, reloads and migration.private static StringsafeParserLocation(Throwable failure, String message) Extracts only numeric metadata while the typed parser failure is still available.state()The outcome.toString()(package private) static ConfigLoadResultunparseable(Path file, String parserMessage) (package private) static ConfigLoadResultunparseable(Path file, String parserMessage, Throwable parserFailure) (package private) static ConfigLoadResultunreadable(Path file, IOException cause)
-
Field Details
-
PARSER_LOCATION
-
file
-
state
-
document
-
fingerprint
-
cause
-
parserMessage
-
parserLocation
-
-
Constructor Details
-
ConfigLoadResult
private ConfigLoadResult(Path file, ConfigLoadResult.State state, ConfigDocument document, String fingerprint, IOException cause, String parserMessage, String parserLocation)
-
-
Method Details
-
absent
-
loaded
-
unreadable
-
unparseable
-
unparseable
-
safeParserLocation
Extracts only numeric metadata while the typed parser failure is still available. -
file
The file that was read.- Returns:
- the path as passed to
load
-
state
The outcome.- Returns:
- the state
-
document
The parsed document.- Returns:
- the document when
ConfigLoadResult.State.LOADED, otherwisenull
-
fingerprint
The SHA-256 of the bytes read, as 64 lower-case hex digits, so a later write can tell whether the file changed on disk since it was read.- Returns:
- the fingerprint when
ConfigLoadResult.State.LOADED, otherwisenull
-
cause
Why the file could not be read.- Returns:
- the I/O failure when
ConfigLoadResult.State.UNREADABLE, otherwisenull
-
parserMessage
Why the file could not be parsed: the parser's own message, naming the line and column.- Returns:
- the message when
ConfigLoadResult.State.UNPARSEABLE, otherwisenull
-
safeParserLocation
A value-safe parse diagnostic shared by configuration loads, reloads and migration. The typed parser problem mark takes precedence over text metadata; no raw exception is retained.- Returns:
- the one-based problem line and column, or a generic YAML/UTF-8 failure category
-
toString
-