Package org.forgerock.json.resource
Interface ResourceResponse
-
-
Field Summary
Fields Modifier and Type Field Description static String
FIELD_CONTENT
The name of the field which contains the resource content in the JSON representation.static String
FIELD_CONTENT_ID
The name of the field in the resource content which contains the resource ID.static String
FIELD_CONTENT_REVISION
The name of the field in the resource content which contains the resource revision.static String
FIELD_ID
The name of the field which contains the resource ID in the JSON representation.static String
FIELD_REVISION
The 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 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.Promise<ResourceResponse,ResourceException>
asPromise()
Return this response as a result Promise.boolean
equals(Object obj)
Returnstrue
if the provided object is a resource having the same resource ID and revision as this resource.JsonValue
getContent()
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.String
getId()
Returns the ID of this resource, if applicable.String
getRevision()
Returns the revision of this resource, if known.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.int
hashCode()
Returns the hash code for this resource.default ResourceResponse
setCacheControl(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_ID
should 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_REVISION
should 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_ID
and 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_REVISION
and 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
null
if 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
null
if 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
- aJsonPointer
representing 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)
Returnstrue
if the provided object is a resource having the same resource ID and revision as this resource.
-
-