Interface Problem


  • public interface Problem
    A problem found during the validation.
    • Method Detail

      • getMessage

        default String getMessage()
        Return the message describing this problem.
        Returns:
        the message describing this problem, never be null.
      • getMessage

        String getMessage​(Locale locale)
        Return the message describing this problem, which will be localized for the specified locale.
        Parameters:
        locale - the locale for which the message will be localized.
        Returns:
        the message describing this problem, never be null.
        Throws:
        NullPointerException - if the specified locale is null.
      • getContextualMessage

        default String getContextualMessage()
        Return the message describing this problem, which includes the location where this problem is found in the input source.
        Returns:
        the message of this problem.
      • getContextualMessage

        String getContextualMessage​(Locale locale)
        Return the message describing this problem, which includes the location where this problem is found in the input source. The message will be localized for the specified locale.
        Parameters:
        locale - the locale for which the message will be localized.
        Returns:
        the message of this problem.
        Throws:
        NullPointerException - if the specified locale is null.
      • getLocation

        JsonLocation getLocation()
        Returns the location where this problem is found in the input source.
        Returns:
        the location where this problem occurred. This can be null if the location is unknown.
      • getPointer

        String getPointer()
        Returns the JSON pointer where this problem is found in the input source.
        Returns:
        the string representation of JSON pointer where this problem occurred. This can be null if the location is unknown.
        Since:
        0.14.0
      • getSchema

        JsonSchema getSchema()
        Returns the JSON schema which provided the assertion.
        Returns:
        the JSON schema which provided the assertion, never be null.
      • getKeyword

        String getKeyword()
        Returns the keyword which provided the assertion.
        Returns:
        the keyword which provided the assertion. This may be null.
      • parametersAsMap

        Map<String,​?> parametersAsMap()
        Returns all parameters of this problem as a map.
        Returns:
        the map containing all parameters this problem has. The map may be empty, but never be null.
      • isResolvable

        boolean isResolvable()
        Checks if this problem is resolvable or not.
        Returns:
        true if this problem can be resolved. false if this problem is inevitable and cannot be resolved.
      • hasBranches

        default boolean hasBranches()
        Checks if this problem has any branches or not.
        Returns:
        true if this problem has any branhes. false if this problem does not have any branches.
      • countBranches

        default int countBranches()
        Returns the number of branches in this problem.
        Returns:
        the number of branches.
      • getBranch

        default List<Problem> getBranch​(int index)
        Returns the list of the problems contained in the branch at the specified index.
        Parameters:
        index - the index of the problem branch.
        Returns:
        the unmodifiable list of the problems in the specified index, never be null.
        Throws:
        IndexOutOfBoundsException - if the index is out of range.
        See Also:
        hasBranches(), countBranches()
      • toString

        String toString()
        Returns the same string as getContextualMessage() for the default locale.
        Overrides:
        toString in class Object
        Returns:
        the message describing this problem including the location, never be null.