public final class TokenCredentials extends java.lang.Object implements Credentials
TokenCredentials
implements the Credentials
interface and represents single token credentials. Similar to
SimpleCredentials
this credentials implementation allows
to set additional attributes.Constructor and Description |
---|
TokenCredentials(@NotNull java.lang.String token)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
@Nullable java.lang.String |
getAttribute(@NotNull java.lang.String name)
Returns the value of the named attribute as an
Object , or
null if no attribute of the given name exists. |
@NotNull java.lang.String[] |
getAttributeNames()
Returns the names of the attributes available to this credentials
instance.
|
@NotNull java.lang.String |
getToken()
Returns the token this credentials are built from.
|
void |
removeAttribute(@NotNull java.lang.String name)
Removes an attribute from this credentials instance.
|
void |
setAttribute(@NotNull java.lang.String name,
@Nullable java.lang.String value)
Stores an attribute in this credentials instance.
|
public TokenCredentials(@NotNull @NotNull java.lang.String token) throws java.lang.IllegalArgumentException
token
- A token string used to create this credentials instance.java.lang.IllegalArgumentException
- If the specified token is null
or empty string.@NotNull public @NotNull java.lang.String getToken()
public void setAttribute(@NotNull @NotNull java.lang.String name, @Nullable @Nullable java.lang.String value)
name
- a String
specifying the name of the attributevalue
- the Object
to be stored@Nullable public @Nullable java.lang.String getAttribute(@NotNull @NotNull java.lang.String name)
Object
, or
null
if no attribute of the given name exists.name
- a String
specifying the name of the attributeObject
containing the value of the attribute, or
null
if the attribute does not existpublic void removeAttribute(@NotNull @NotNull java.lang.String name)
name
- a String
specifying the name of the attribute to
remove@NotNull public @NotNull java.lang.String[] getAttributeNames()
Copyright © 2010 - 2020 Adobe. All Rights Reserved