Package org.kiwiproject.json
Class JsonDetectionResult
java.lang.Object
org.kiwiproject.json.JsonDetectionResult
Represents the result of attempting to detect if content is JSON. Provides enough information to determine whether
format detection
-
Method Summary
Modifier and TypeMethodDescription@Nullable ExceptionIf an error occurred during the detection process, return it, otherwise return nullbooleanWhether format detection succeeded in determining a positive or negative result.booleanhasError()Whether format detection caught an exception during the detection process.booleanisJson()Is the content JSON? This should only be called ifhasDetectionResult()returns true (or if you don't care whether an error occurred during detection).
-
Method Details
-
hasDetectionResult
public boolean hasDetectionResult()Whether format detection succeeded in determining a positive or negative result.- Returns:
- true if the format detection produced a result, otherwise false
-
hasError
public boolean hasError()Whether format detection caught an exception during the detection process.- Returns:
- true if there was an exception thrown during the detection process, otherwise false
-
isJson
public boolean isJson()Is the content JSON? This should only be called ifhasDetectionResult()returns true (or if you don't care whether an error occurred during detection).- Returns:
- true only if detection succeeded and the format was detected as JSON, otherwise false
-
getErrorOrNull
If an error occurred during the detection process, return it, otherwise return null- Returns:
- the exception thrown during the detection process, or null if there was no error
-