Class JsonDocument
java.lang.Object
no.hasmac.jsonld.document.JsonDocument
- All Implemented Interfaces:
Document
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateJsonDocument(MediaType type, String profile, jakarta.json.JsonStructure structure) -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanprivate static voidassertContentType(MediaType contentType) private static JsonDocumentThe Content-Type of the loaded document, exclusive of any optional parameters.The value of the HTTP Link header when profile attribute matcheshttp://www.w3.org/ns/json-ld#context.The finalURIof the loaded document.Optional<jakarta.json.JsonStructure> Get the document content as parsedJsonStructure.The value of anyprofileparameter retrieved as part of the originalDocument.getContentType().static JsonDocumentof(jakarta.json.JsonStructure structure) Create a new document fromJsonStructure.static JsonDocumentof(InputStream is) Create a new document from content provided byInputStream.static JsonDocumentCreate a new document from content provided byReader.static JsonDocumentCreate a new document fromJsonStructure.static JsonDocumentof(MediaType contentType, InputStream is) Create a new document from content provided byInputStream.static JsonDocumentCreate a new document from content provided byReader.voidsetContextUrl(URI contextUrl) voidsetDocumentUrl(URI documentUrl) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Document
getRdfContent
-
Field Details
-
PLUS_JSON
- See Also:
-
contentType
-
structure
private final jakarta.json.JsonStructure structure -
profile
-
documentUrl
-
contentUrl
-
-
Constructor Details
-
JsonDocument
-
-
Method Details
-
of
Create a new document fromJsonStructure. SetsMediaType.JSONas the content type.- Parameters:
structure- representing parsed JSON content- Returns:
Documentrepresenting JSON content
-
of
Create a new document fromJsonStructure.- Parameters:
contentType- reflecting the providedJsonStructure, e.g.MediaType.JSON_LD, any JSON based media type is allowedstructure- representing parsed JSON content- Returns:
Documentrepresenting JSON content
-
of
Create a new document from content provided byInputStream. SetsMediaType.JSONas the content type.- Parameters:
is- representing parsed JSON content- Returns:
Documentrepresenting JSON document- Throws:
JsonLdError
-
of
Create a new document from content provided byInputStream.- Parameters:
contentType- reflecting the providedInputStreamcontent, e.g.MediaType.JSON_LD, any JSON based media type is allowedis- providing JSON content- Returns:
Documentrepresenting JSON document- Throws:
JsonLdError
-
of
Create a new document from content provided byReader. SetsMediaType.JSONas the content type.- Parameters:
reader- providing JSON content- Returns:
Documentrepresenting JSON document- Throws:
JsonLdError
-
of
Create a new document from content provided byReader.- Parameters:
contentType- reflecting the provided content, e.g.MediaType.JSON_LD, any JSON based media type is allowedreader- providing JSON content- Returns:
Documentrepresenting JSON document- Throws:
JsonLdError
-
doParse
private static JsonDocument doParse(MediaType contentType, jakarta.json.stream.JsonParser parser) throws JsonLdError - Throws:
JsonLdError
-
accepts
-
assertContentType
-
getJsonContent
Description copied from interface:DocumentGet the document content as parsedJsonStructure.- Specified by:
getJsonContentin interfaceDocument- Returns:
JsonStructureorOptional.empty()if document content is not JSON based
-
getContentType
Description copied from interface:DocumentThe Content-Type of the loaded document, exclusive of any optional parameters.- Specified by:
getContentTypein interfaceDocument- Returns:
Content-Typeof the loaded document, nevernull
-
getContextUrl
Description copied from interface:DocumentThe value of the HTTP Link header when profile attribute matcheshttp://www.w3.org/ns/json-ld#context.- Specified by:
getContextUrlin interfaceDocument- Returns:
- attached
URIreferencing document context ornullif not available
-
setContextUrl
- Specified by:
setContextUrlin interfaceDocument
-
getDocumentUrl
-
setDocumentUrl
- Specified by:
setDocumentUrlin interfaceDocument
-
getProfile
Description copied from interface:DocumentThe value of anyprofileparameter retrieved as part of the originalDocument.getContentType().- Specified by:
getProfilein interfaceDocument- Returns:
- document profile or
Optional.empty()
-