Package org.forgerock.json.resource
Interface ResourceResponse
- All Superinterfaces:
Response
A resource, comprising of a resource ID, a revision (etag), and its JSON
content.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the field which contains the resource content in the JSON representation.static final StringThe name of the field in the resource content which contains the resource ID.static final StringThe name of the field in the resource content which contains the resource revision.static final StringThe name of the field which contains the resource ID in the JSON representation.static final StringThe name of the field which contains the resource version in the JSON representation. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddField(JsonPointer... fields) Adds a field to the list of fields which should be included in this JSON resource after field filtering has occurred.Return this response as a result Promise.booleanReturnstrueif the provided object is a resource having the same resource ID and revision as this resource.Returns the JSON content of this resource.Returns the list of fields which should be included in this JSON resource after field filtering has occurred.getId()Returns the ID of this resource, if applicable.Returns the revision of this resource, if known.booleanReturns true if any fields have been added, indicating that the list of fields in this response should be included in this JSON resource after field filtering has occurred, otherwise returns false indicating that the original list of fields in the request should be used for filtering the response.inthashCode()Returns the hash code for this resource.default ResourceResponsesetCacheControl(ResponseCacheControl cacheControl) Sets the cache control for this response.Methods inherited from interface org.forgerock.json.resource.Response
getCacheControl, getResourceApiVersion, setResourceApiVersion
-
Field Details
-
FIELD_ID
The name of the field which contains the resource ID in the JSON representation.Note: when encoding the resource ID as part of a resource's content the field name
FIELD_CONTENT_IDshould be used.- See Also:
-
FIELD_REVISION
The name of the field which contains the resource version in the JSON representation.Note: when encoding the resource revision as part of a resource's content the field name
FIELD_CONTENT_REVISIONshould be used.- See Also:
-
FIELD_CONTENT_ID
The name of the field in the resource content which contains the resource ID. This field is semantically equivalent toFIELD_IDand is intended for use in cases where a commons REST API wishes to expose the resource ID as part of the resource content.- See Also:
-
FIELD_CONTENT_REVISION
The name of the field in the resource content which contains the resource revision. This field is semantically equivalent toFIELD_REVISIONand is intended for use in cases where a commons REST API wishes to expose the resource revision as part of the resource content.- See Also:
-
FIELD_CONTENT
The name of the field which contains the resource content in the JSON representation.- See Also:
-
-
Method Details
-
getContent
JsonValue getContent()Returns the JSON content of this resource.- Returns:
- The JSON content of this resource.
-
getId
String getId()Returns the ID of this resource, if applicable.- Returns:
- The ID of this resource, or
nullif this resource does not have an ID.
-
getRevision
String getRevision()Returns the revision of this resource, if known.- Returns:
- The revision of this resource, or
nullif the version is not known.
-
getFields
List<JsonPointer> getFields()Returns the list of fields which should be included in this JSON resource after field filtering has occurred. This list will override the list of fields that is included in the request. An empty list indicates that the original list of fields in the request should be used for filtering the response.- Returns:
- The list of fields which should be included in this JSON resource after field filtering has occurred.
-
hasFields
boolean hasFields()Returns true if any fields have been added, indicating that the list of fields in this response should be included in this JSON resource after field filtering has occurred, otherwise returns false indicating that the original list of fields in the request should be used for filtering the response.- Returns:
- true if any fields have been added, false otherwise.
-
addField
Adds a field to the list of fields which should be included in this JSON resource after field filtering has occurred. This list will override the list of fields that is included in the request.- Parameters:
fields- aJsonPointerrepresenting the field to add.
-
asPromise
Promise<ResourceResponse,ResourceException> asPromise()Return this response as a result Promise.- Returns:
- A Promise whose result is this ResourceResponse object.
-
setCacheControl
Sets the cache control for this response.- Parameters:
cacheControl- the cache controls to apply to this response.- Returns:
- this resource response.
-
equals
Returnstrueif the provided object is a resource having the same resource ID and revision as this resource. -
hashCode
int hashCode()Returns the hash code for this resource. Two resources are guaranteed to have the same hash code if they share the same resource ID and revision.
-