Class JsonDocument

    • Method Detail

      • of

        public static JsonDocument of​(jakarta.json.JsonStructure structure)
        Create a new document from JsonStructure. Sets MediaType.JSON as the content type.
        Parameters:
        structure - representing parsed JSON content
        Returns:
        Document representing JSON content
      • of

        public static JsonDocument of​(MediaType contentType,
                                      jakarta.json.JsonStructure structure)
        Create a new document from JsonStructure.
        Parameters:
        contentType - reflecting the provided JsonStructure, e.g. MediaType.JSON_LD, any JSON based media type is allowed
        structure - representing parsed JSON content
        Returns:
        Document representing JSON content
      • accepts

        public static final boolean accepts​(MediaType contentType)
      • getJsonContent

        public Optional<jakarta.json.JsonStructure> getJsonContent()
        Description copied from interface: Document
        Get the document content as parsed JsonStructure.
        Specified by:
        getJsonContent in interface Document
        Returns:
        JsonStructure or Optional.empty() if document content is not JSON based
      • getContentType

        public MediaType getContentType()
        Description copied from interface: Document
        The Content-Type of the loaded document, exclusive of any optional parameters.
        Specified by:
        getContentType in interface Document
        Returns:
        Content-Type of the loaded document, never null
      • getContextUrl

        public URI getContextUrl()
        Description copied from interface: Document
        The value of the HTTP Link header when profile attribute matches http://www.w3.org/ns/json-ld#context.
        Specified by:
        getContextUrl in interface Document
        Returns:
        attached URI referencing document context or null if not available
      • getDocumentUrl

        public URI getDocumentUrl()
        Description copied from interface: Document
        The final URI of the loaded document.
        Specified by:
        getDocumentUrl in interface Document
        Returns:
        URI of the loaded document or null if not available