Class Problem

java.lang.Object
org.shredzone.acme4j.Problem
All Implemented Interfaces:
java.io.Serializable

public class Problem
extends java.lang.Object
implements java.io.Serializable
Represents a JSON Problem.
See Also:
RFC 7807, Serialized Form
  • Constructor Summary

    Constructors
    Constructor Description
    Problem​(JSON problem, java.net.URL baseUrl)
    Creates a new Problem object.
  • Method Summary

    Modifier and Type Method Description
    JSON asJSON()
    Returns the problem as JSON object, to access other fields.
    java.lang.String getDetail()
    Returns a detailed and specific human-readable explanation of the problem.
    Identifier getIdentifier()
    Returns the Identifier this problem relates to.
    java.net.URI getInstance()
    Returns an URI that identifies the specific occurence of the problem.
    java.util.List<Problem> getSubProblems()
    Returns a list of sub-problems.
    java.lang.String getTitle()
    Returns a short, human-readable summary of the problem.
    java.net.URI getType()
    Returns the problem type.
    java.lang.String toString()
    Returns a human-readable description of the problem, that is as specific as possible.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Problem

      public Problem​(JSON problem, java.net.URL baseUrl)
      Creates a new Problem object.
      Parameters:
      problem - Problem as JSON structure
      baseUrl - Document's base URL to resolve relative URIs against
  • Method Details

    • getType

      public java.net.URI getType()
      Returns the problem type. It is always an absolute URI.
    • getTitle

      @Nullable public java.lang.String getTitle()
      Returns a short, human-readable summary of the problem. The text may be localized if supported by the server. null if the server did not provide a title.
      See Also:
      toString()
    • getDetail

      @Nullable public java.lang.String getDetail()
      Returns a detailed and specific human-readable explanation of the problem. The text may be localized if supported by the server.
      See Also:
      toString()
    • getInstance

      @Nullable public java.net.URI getInstance()
      Returns an URI that identifies the specific occurence of the problem. It is always an absolute URI.
    • getIdentifier

      @Nullable public Identifier getIdentifier()
      Returns the Identifier this problem relates to. May be null.
      Since:
      2.3
    • getSubProblems

      public java.util.List<Problem> getSubProblems()
      Returns a list of sub-problems. May be empty, but is never null.
    • asJSON

      public JSON asJSON()
      Returns the problem as JSON object, to access other fields.
      Returns:
      Problem as JSON object
    • toString

      public java.lang.String toString()
      Returns a human-readable description of the problem, that is as specific as possible. The description may be localized if supported by the server.

      If getSubProblems() exist, they will be appended.

      Technically, it returns getDetail(). If not set, getTitle() is returned instead. As a last resort, getType() is returned.

      Overrides:
      toString in class java.lang.Object