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
ConstructorsConstructorDescriptionPartialToken(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 TypeMethodDescriptionbooleanCheck if thisPartialTokencan be converted into aToken.The fields that were included in this query.<T> TgetValue(CoreTokenField field) toToken()Converts thisPartialTokeninto aTokencontaining 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 thisPartialTokencan be converted into aToken.- Returns:
- true if this
PartialTokencontainsCoreTokenField.TOKEN_IDandCoreTokenField.TOKEN_TYPE. - Since:
- 14.0.0
- See Also:
-
toToken
Converts thisPartialTokeninto aTokencontaining all of the populated fields.Callers should ensure that this
PartialTokencan be converted by callingcanConvertToToken()before calling this method.- Returns:
- A
Token. - Throws:
IllegalStateException- if thisPartialTokendoes not containCoreTokenField.TOKEN_IDandCoreTokenField.TOKEN_TYPE.- Since:
- 14.0.0
- See Also:
-