public class AuthCollection extends java.lang.Object
AuthMethods.
This holds a collection of AuthMethod instances, in order of preference, and allow for simple selection of an appropriate AuthMethod for a particular REST endpoint.
| Constructor and Description |
|---|
AuthCollection()
Create a new AuthCollection with an empty set of AuthMethods.
|
AuthCollection(AuthMethod... authMethods) |
AuthCollection(java.util.SortedSet<AuthMethod> authMethods) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(AuthMethod auth)
Add a new
AuthMethod to the set managed by this AuthCollection |
AuthMethod |
getAcceptableAuthMethod(java.util.Set<java.lang.Class> acceptableAuthMethodClasses)
Obtain an
AuthMethod instance for a set of acceptable AuthMethod classes. |
<T extends AuthMethod> |
getAuth(java.lang.Class<T> type)
Obtain an AuthMethod of type T, if one is contained in this collection.
|
public AuthCollection()
public AuthCollection(AuthMethod... authMethods)
public AuthCollection(java.util.SortedSet<AuthMethod> authMethods)
public void add(AuthMethod auth)
AuthMethod to the set managed by this AuthCollectionauth - AuthMethod method to be added to this collectionpublic <T extends AuthMethod> T getAuth(java.lang.Class<T> type) throws NexmoUnacceptableAuthException
T - The type of AuthMethod which will be returnedtype - The type of AuthMethod to be locatedNexmoUnacceptableAuthException - if no matching AuthMethod is found.public AuthMethod getAcceptableAuthMethod(java.util.Set<java.lang.Class> acceptableAuthMethodClasses) throws NexmoUnacceptableAuthException
AuthMethod instance for a set of acceptable AuthMethod classes.acceptableAuthMethodClasses - A Set of AuthMethod classes which are suitable for the target REST endpoint.NexmoUnacceptableAuthException - if no appropriate AuthMethod is held by this AuthCollection