Package org.forgerock.json.resource
Interface ResourceResponse
-
-
Field Summary
Fields Modifier and Type Field Description static StringFIELD_CONTENTThe name of the field which contains the resource content in the JSON representation.static StringFIELD_CONTENT_IDThe name of the field in the resource content which contains the resource ID.static StringFIELD_CONTENT_REVISIONThe name of the field in the resource content which contains the resource revision.static StringFIELD_IDThe name of the field which contains the resource ID in the JSON representation.static StringFIELD_REVISIONThe name of the field which contains the resource version in the JSON representation.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddField(JsonPointer... fields)Adds a field to the list of fields which should be included in this JSON resource after field filtering has occurred.Promise<ResourceResponse,ResourceException>asPromise()Return this response as a result Promise.booleanequals(Object obj)Returnstrueif the provided object is a resource having the same resource ID and revision as this resource.JsonValuegetContent()Returns the JSON content of this resource.List<JsonPointer>getFields()Returns the list of fields which should be included in this JSON resource after field filtering has occurred.StringgetId()Returns the ID of this resource, if applicable.StringgetRevision()Returns the revision of this resource, if known.booleanhasFields()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.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 Detail
-
FIELD_ID
static final String 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:
- Constant Field Values
-
FIELD_REVISION
static final String 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:
- Constant Field Values
-
FIELD_CONTENT_ID
static final String 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:
- Constant Field Values
-
FIELD_CONTENT_REVISION
static final String 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:
- Constant Field Values
-
FIELD_CONTENT
static final String FIELD_CONTENT
The name of the field which contains the resource content in the JSON representation.- See Also:
- Constant Field Values
-
-
Method Detail
-
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
void addField(JsonPointer... fields)
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
default ResourceResponse setCacheControl(ResponseCacheControl cacheControl)
Sets the cache control for this response.- Parameters:
cacheControl- the cache controls to apply to this response.- Returns:
- this resource response.
-
equals
boolean equals(Object obj)
Returnstrueif the provided object is a resource having the same resource ID and revision as this resource.
-
-