Package com.ultikits.ultitools.utils
Class CredentialStore.ReadResult
java.lang.Object
com.ultikits.ultitools.utils.CredentialStore.ReadResult
- Enclosing class:
CredentialStore
The outcome of a
CredentialStore.read() call. Deliberately has no isEmpty()-style method
that a caller could use to conflate isAbsent() with isParseFailure() --
the two are structurally distinct outcomes and must be checked separately.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final CredentialStore.ReadResult.Outcome -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateReadResult(CredentialStore.ReadResult.Outcome outcome, Map<String, Object> data, String failureMessage) -
Method Summary
Modifier and TypeMethodDescriptionprivate static CredentialStore.ReadResultabsent()data()The parsed content.(package private) StringThe operator-facing description of a parse failure -- which file, that it was left untouched, and what to check -- for a caller that turns it into its own failure.booleanisAbsent()booleanisParsed()booleanprivate static CredentialStore.ReadResultprivate static CredentialStore.ReadResultparseFailure(String failureMessage)
-
Field Details
-
outcome
-
data
-
failureMessage
-
-
Constructor Details
-
ReadResult
private ReadResult(CredentialStore.ReadResult.Outcome outcome, Map<String, Object> data, String failureMessage)
-
-
Method Details
-
absent
-
parsed
-
parseFailure
-
failureMessage
String failureMessage()The operator-facing description of a parse failure -- which file, that it was left untouched, and what to check -- for a caller that turns it into its own failure.- Returns:
- the description, or
nullunlessisParseFailure()
-
isAbsent
public boolean isAbsent()- Returns:
trueifdata.jsondid not exist at read time
-
isParsed
public boolean isParsed()- Returns:
trueifdata.jsonexisted and parsed successfully
-
isParseFailure
public boolean isParseFailure()- Returns:
trueif the credential file existed but is empty, whitespace-only, the JSON literalnullor not valid JSON -- a torn file, distinguishable fromisAbsent()(#573) -- or if only an unreadable pre-6.3.0 file exists
-
data
The parsed content. An absent file yields an empty map, by definition.- Returns:
- the parsed document
- Throws:
IllegalStateException- if this resultisParseFailure()-- there is no empty-map fallback for a torn file; the caller must check the outcome first
-