I'd like to propose a clean up on the code to always create a JsonLdOptions with the currently used documentLoader passed as parameter JsonLdOptions(jsonldObject.documentLoader). The goal is to avoid calling SchemeRouter.defaultInstance() on JsonLdOptions's default constructor. That method has a direct dependency on java.net.http.HttpClient which doesn't exist on Android's Runtime.
This also speeds things up a bit for anyone using custom DocumentLoaders by never creating the default instance just to replace it with the custom one.
Here's an example. Android developers need to override this method, going from
JsonLdOptions options = new JsonLdOptions();
if (this.getDocumentLoader() != null) {
options.setDocumentLoader(this.getDocumentLoader());
}
to
JsonLdOptions options = new JsonLdOptions(this.getDocumentLoader());
I actually don't know why this test exists: this.getDocumentLoader() != null, since the only way for the documentLoader to be null is if somebody manually set that to null, which seems weird.
I'd like to propose a clean up on the code to always create a
JsonLdOptions
with the currently used documentLoader passed as parameterJsonLdOptions(jsonldObject.documentLoader)
. The goal is to avoid callingSchemeRouter.defaultInstance()
onJsonLdOptions
's default constructor. That method has a direct dependency onjava.net.http.HttpClient
which doesn't exist on Android's Runtime.This also speeds things up a bit for anyone using custom DocumentLoaders by never creating the default instance just to replace it with the custom one.
Here's an example. Android developers need to override this method, going from
to
I actually don't know why this test exists:
this.getDocumentLoader() != null
, since the only way for thedocumentLoader
to be null is if somebody manually set that to null, which seems weird.