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 final Stringprivate final ConfigLoadResult.State -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateConfigLoadResult(Path file, ConfigLoadResult.State state, ConfigDocument document, String fingerprint, IOException cause, String parserMessage) -
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.state()The outcome.toString()(package private) static ConfigLoadResultunparseable(Path file, String parserMessage) (package private) static ConfigLoadResultunreadable(Path file, IOException cause)
-
Field Details
-
file
-
state
-
document
-
fingerprint
-
cause
-
parserMessage
-
-
Constructor Details
-
ConfigLoadResult
private ConfigLoadResult(Path file, ConfigLoadResult.State state, ConfigDocument document, String fingerprint, IOException cause, String parserMessage)
-
-
Method Details
-
absent
-
loaded
-
unreadable
-
unparseable
-
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
-
toString
-