Class ReadableResource.Builder<T extends ReadableResource.Builder<T>>
java.lang.Object
com.janeirodigital.sai.core.resources.ReadableResource.Builder<T>
- Type Parameters:
 T- Parameterized type of an inheriting builder
- Direct Known Subclasses:
 CRUDResource.Builder,ImmutableResource.Builder,ReadableAccessGrant.Builder,ReadableAgentRegistration.Builder,ReadableDataGrant.Builder,ReadableSocialAgentProfile.Builder
- Enclosing class:
 - ReadableResource
 
public abstract static class ReadableResource.Builder<T extends ReadableResource.Builder<T>>
extends Object
Generic builder which is extended by readable resource builders, as well as builders for the other
 base resource types 
CRUDResource and
 ImmutableResource, respectively.- 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.janeirodigital.sai.httputils.ContentTypeprotected org.apache.jena.rdf.model.Modelprotected booleanprotected Stringprotected org.apache.jena.rdf.model.Resourceprotected final SaiSessionprotected booleanprotected final URI - 
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuilder(URI uri, SaiSession saiSession) Base builder for all resource types. - 
Method Summary
Modifier and TypeMethodDescriptionabstract TgetThis()Necessary to so that we don't get an unchecked cast warning when casting the return value of setters in this and any inheriting builders.setContentType(com.janeirodigital.sai.httputils.ContentType contentType) Set the content-type for the resource (as opposed to the default set by the builder constructor).setDataset(okhttp3.Response response) Extracts a Jena Model from an HTTP response and callssetDataset(Model)after extractionsetDataset(org.apache.jena.rdf.model.Model dataset) Jena Model that is used to initialize attributes of inheriting builders rather than set them manually.setJsonLdContext(String jsonLdContext) Set the JSON-LD context to use for the resource (as opposed to the default context by the builder constructor).Set the resource type as unprotected. 
- 
Field Details
- 
uri
 - 
saiSession
 - 
unprotected
protected boolean unprotected - 
contentType
protected com.janeirodigital.sai.httputils.ContentType contentType - 
dataset
protected org.apache.jena.rdf.model.Model dataset - 
resource
protected org.apache.jena.rdf.model.Resource resource - 
jsonLdContext
 - 
exists
protected boolean exists 
 - 
 - 
Constructor Details
- 
Builder
Base builder for all resource types. Use setters for all further configuration- Parameters:
 uri- URI of the resource to buildsaiSession-SaiSessionto use
 
 - 
 - 
Method Details
- 
getThis
Necessary to so that we don't get an unchecked cast warning when casting the return value of setters in this and any inheriting builders.- Returns:
 - T generic - on implementations this is the resource type that is being built
 
 - 
setUnprotected
Set the resource type as unprotected. Keeps any credentials from being sent along as part of any requests issued for this resource- Returns:
 ReadableResource.Builder
 - 
setContentType
Set the content-type for the resource (as opposed to the default set by the builder constructor).- Parameters:
 contentType-ContentTypeto set- Returns:
 ReadableResource.Builder
 - 
setDataset
Jena Model that is used to initialize attributes of inheriting builders rather than set them manually. Used in all read scenarios when populating the Builder from the contents of a remote resource.- Parameters:
 dataset- Jena model to populate the Builder attributes with- Returns:
 ReadableResource.Builder- Throws:
 SaiException
 - 
setDataset
Extracts a Jena Model from an HTTP response and callssetDataset(Model)after extraction- Parameters:
 response- OkHttp Response to extract from- Returns:
 ReadableResource.Builder- Throws:
 SaiException
 - 
setJsonLdContext
Set the JSON-LD context to use for the resource (as opposed to the default context by the builder constructor). Note that this setting won't matter unless theContentTypeof the resource is LD_JSON.- Parameters:
 jsonLdContext- JSON-LD context to set- Returns:
 ReadableResource.Builder
 
 -