Package org.forgerock.am.cts.api.query
Interface PartialToken
-
public interface PartialToken
Represents a partial CTSToken
. 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.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canConvertToToken()
Check if thisPartialToken
can be converted into aToken
.Collection<CoreTokenField>
getFields()
The fields that were included in this query.<T> T
getValue(CoreTokenField field)
Token
toToken()
Converts thisPartialToken
into aToken
containing all of the populated fields.
-
-
-
Method Detail
-
getFields
Collection<CoreTokenField> getFields()
The fields that were included in this query.- Returns:
- A unmodifiable collection of fields.
-
getValue
<T> T getValue(CoreTokenField field)
- 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
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()
-
toToken
Token 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:
canConvertToToken()
-
-