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 SummaryFieldsModifier 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 SummaryModifier 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.ResponsegetCacheControl, getResourceApiVersion, setResourceApiVersion
- 
Field Details- 
FIELD_IDThe 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_REVISIONThe 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_IDThe 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_REVISIONThe 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_CONTENTThe name of the field which contains the resource content in the JSON representation.- See Also:
 
 
- 
- 
Method Details- 
getContentJsonValue getContent()Returns the JSON content of this resource.- Returns:
- the JSON content of this resource
 
- 
getIdString getId()Returns the ID of this resource, if applicable.- Returns:
- The ID of this resource, or nullif this resource does not have an ID.
 
- 
getRevisionString getRevision()Returns the revision of this resource, if known.- Returns:
- The revision of this resource, or nullif the version is not known.
 
- 
getFieldsList<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.
 
- 
hasFieldsboolean 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.
 
- 
addFieldAdds 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- a- JsonPointerrepresenting the field to add.
 
- 
asPromisePromise<ResourceResponse,ResourceException> asPromise()Return this response as a result Promise.- Returns:
- A Promise whose result is this ResourceResponse object.
 
- 
setCacheControlSets the cache control for this response.- Parameters:
- cacheControl- the cache controls to apply to this response.
- Returns:
- this resource response.
 
- 
equalsReturnstrueif the provided object is a resource having the same resource ID and revision as this resource.
- 
hashCodeint 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.
 
-