Class JsonDetectionResult

java.lang.Object
org.kiwiproject.json.JsonDetectionResult

public class JsonDetectionResult extends Object
Represents the result of attempting to detect if content is JSON. Provides enough information to determine whether format 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 if hasDetectionResult() 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

      public @Nullable Exception 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