Package org.forgerock.am.cts.api.query
Class PartialToken
java.lang.Object
org.forgerock.am.cts.api.query.PartialToken
Represents a partial CTS
Token
. Used to represent the result of a query
where only selective attributes of the Token have been requested.
Importantly, this is not a full Token and cannot be used as such.
The main use case of this PartialToken is an optimisation when requesting data from
the CTS and not all fields are required.-
Constructor Summary
ConstructorDescriptionPartialToken
(Map<CoreTokenField, Object> entry) Initialise the PartialToken with the specific fields returned from the query.PartialToken
(PartialToken token, CoreTokenField field, Object value) Copy constructor allowing the caller to modify a field. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Check if thisPartialToken
can be converted into aToken
.The fields that were included in this query.<T> T
getValue
(CoreTokenField field) toToken()
Converts thisPartialToken
into aToken
containing all of the populated fields.
-
Constructor Details
-
PartialToken
Initialise the PartialToken with the specific fields returned from the query.- Parameters:
entry
- Non null, possibly empty collection.
-
PartialToken
Copy constructor allowing the caller to modify a field.- Parameters:
token
- The PartialToken to copy. Non null.field
- The field to modify, non null.value
- The value of the field to modify, non null.
-
-
Method Details
-
getFields
The fields that were included in this query.- Returns:
- A unmodifiable collection of fields.
-
getValue
- Type Parameters:
T
- The return type, simplifies- Parameters:
field
- The field to return.- Returns:
- The value that was stored or null if this PartialToken does not contain the requested field.
-
canConvertToToken
public boolean canConvertToToken()Check if thisPartialToken
can be converted into aToken
.- Returns:
- true if this
PartialToken
containsCoreTokenField.TOKEN_ID
andCoreTokenField.TOKEN_TYPE
. - Since:
- 14.0.0
- See Also:
-
toToken
Converts thisPartialToken
into aToken
containing all of the populated fields.Callers should ensure that this
PartialToken
can be converted by callingcanConvertToToken()
before calling this method.- Returns:
- A
Token
. - Throws:
IllegalStateException
- if thisPartialToken
does not containCoreTokenField.TOKEN_ID
andCoreTokenField.TOKEN_TYPE
.- Since:
- 14.0.0
- See Also:
-