public class CredentialsMatchers extends Object
| Modifier and Type | Method and Description |
|---|---|
static CredentialsMatcher |
allOf(CredentialsMatcher... matchers)
Creates a matcher that matches when all of the supplied matchers match.
|
static CredentialsMatcher |
always()
Creates a matcher that always matches.
|
static CredentialsMatcher |
anyOf(CredentialsMatcher... matchers)
Creates a matcher that matches when any of the supplied matchers match.
|
static CredentialsMatcher |
both(CredentialsMatcher matcher1,
CredentialsMatcher matcher2)
Creates a matcher that matches when both of the supplied matchers match.
|
static CredentialsMatcher |
either(CredentialsMatcher matcher1,
CredentialsMatcher matcher2)
Creates a matcher that matches when either of the supplied matchers match.
|
static <C extends Credentials> |
filter(Collection<C> credentials,
CredentialsMatcher matcher)
Filters credentials using the supplied matcher.
|
static <C extends Credentials> |
filter(Iterable<C> credentials,
CredentialsMatcher matcher)
Filters credentials using the supplied matcher.
|
static <C extends Credentials> |
filter(List<C> credentials,
CredentialsMatcher matcher)
Filters credentials using the supplied matcher.
|
static <C extends Credentials> |
filter(Set<C> credentials,
CredentialsMatcher matcher)
Filters credentials using the supplied matcher.
|
static <C extends Credentials,V> |
filterKeys(Map<C,V> credentialMap,
CredentialsMatcher matcher)
Filters a map keyed by credentials using the supplied matcher.
|
static <C extends Credentials,K> |
filterValues(Map<K,C> credentialMap,
CredentialsMatcher matcher)
Filters a map based on credential values using the supplied matcher.
|
static <C extends Credentials> |
firstOrDefault(Iterable<C> credentials,
CredentialsMatcher matcher,
C defaultIfNone)
Returns the first credential from a collection that matches the supplied matcher or if none match then the
specified default.
|
static <C extends Credentials> |
firstOrNull(Iterable<C> credentials,
CredentialsMatcher matcher)
Returns the first credential from a collection that matches the supplied matcher or
null if none match. |
static CredentialsMatcher |
instanceOf(Class clazz)
Creates a matcher that matches credentials of the specified type.
|
static CredentialsMatcher |
never()
Creates a matcher that never matches.
|
static CredentialsMatcher |
noneOf(CredentialsMatcher... matchers)
Creates a matcher that matches when none of the supplied matchers match.
|
static CredentialsMatcher |
not(CredentialsMatcher matcher)
Creates a matcher that inverts the supplied matcher.
|
static CredentialsMatcher |
withId(String id)
Creates a matcher that matches
IdCredentials with the
supplied IdCredentials.getId() |
static CredentialsMatcher |
withScope(CredentialsScope scope)
Creates a matcher that matches
Credentials with the supplied CredentialsScope. |
static CredentialsMatcher |
withScopes(Collection<CredentialsScope> scopes)
Creates a matcher that matches
Credentials with the supplied CredentialsScope. |
static CredentialsMatcher |
withScopes(CredentialsScope... scopes)
Creates a matcher that matches
Credentials with the supplied CredentialsScope. |
static CredentialsMatcher |
withUsername(String username)
Creates a matcher that matches
UsernameCredentials with the
supplied UsernameCredentials.getUsername() |
@NonNull public static CredentialsMatcher always()
@NonNull public static CredentialsMatcher never()
@NonNull public static CredentialsMatcher not(@NonNull CredentialsMatcher matcher)
matcher - matcher to invert.@NonNull public static CredentialsMatcher instanceOf(@NonNull Class clazz)
clazz - the type of credential to match.@NonNull public static CredentialsMatcher withId(@NonNull String id)
IdCredentials with the
supplied IdCredentials.getId()id - the IdCredentials.getId() to match.IdCredentials with the
supplied IdCredentials.getId()@NonNull public static CredentialsMatcher withScope(@NonNull CredentialsScope scope)
Credentials with the supplied CredentialsScope.scope - the CredentialsScope to match.Credentials with the supplied CredentialsScope.@NonNull public static CredentialsMatcher withScopes(@NonNull CredentialsScope... scopes)
Credentials with the supplied CredentialsScope.scopes - the CredentialsScopes to match.Credentials with the supplied CredentialsScopes.@NonNull public static CredentialsMatcher withScopes(@NonNull Collection<CredentialsScope> scopes)
Credentials with the supplied CredentialsScope.scopes - the CredentialsScopes to match.Credentials with the supplied CredentialsScopes.@NonNull public static CredentialsMatcher withUsername(@NonNull String username)
UsernameCredentials with the
supplied UsernameCredentials.getUsername()username - the UsernameCredentials.getUsername() to match.UsernameCredentials with the
supplied UsernameCredentials.getUsername()@NonNull public static CredentialsMatcher allOf(@NonNull CredentialsMatcher... matchers)
matchers - the matchers to match.@NonNull public static CredentialsMatcher anyOf(@NonNull CredentialsMatcher... matchers)
matchers - the matchers to match.@NonNull public static CredentialsMatcher both(@NonNull CredentialsMatcher matcher1, @NonNull CredentialsMatcher matcher2)
matcher1 - the first matcher to match.matcher2 - the second matcher to match.@NonNull public static CredentialsMatcher either(@NonNull CredentialsMatcher matcher1, @NonNull CredentialsMatcher matcher2)
matcher1 - the first matcher to match.matcher2 - the second matcher to match.@NonNull public static CredentialsMatcher noneOf(@NonNull CredentialsMatcher... matchers)
matchers - the matchers to match.@NonNull public static <C extends Credentials> Collection<C> filter(@NonNull Collection<C> credentials, @NonNull CredentialsMatcher matcher)
C - the type of credentials.credentials - the credentials to filter.matcher - the matcher to match on.@NonNull public static <C extends Credentials> Set<C> filter(@NonNull Set<C> credentials, @NonNull CredentialsMatcher matcher)
C - the type of credentials.credentials - the credentials to filter.matcher - the matcher to match on.@NonNull public static <C extends Credentials> List<C> filter(@NonNull List<C> credentials, @NonNull CredentialsMatcher matcher)
C - the type of credentials.credentials - the credentials to filter.matcher - the matcher to match on.@NonNull public static <C extends Credentials> Iterable<C> filter(@NonNull Iterable<C> credentials, @NonNull CredentialsMatcher matcher)
C - the type of credentials.credentials - the credentials to filter.matcher - the matcher to match on.@NonNull public static <C extends Credentials,V> Map<C,V> filterKeys(@NonNull Map<C,V> credentialMap, @NonNull CredentialsMatcher matcher)
C - the type of credentials.V - the type of the map values.credentialMap - the map keyed by credentials to filter.matcher - the matcher to match on.@NonNull public static <C extends Credentials,K> Map<K,C> filterValues(@NonNull Map<K,C> credentialMap, @NonNull CredentialsMatcher matcher)
K - the type of the map keys.C - the type of credentials.credentialMap - the map with credentials values to filter.matcher - the matcher to match on.@CheckForNull public static <C extends Credentials> C firstOrDefault(@NonNull Iterable<C> credentials, @NonNull CredentialsMatcher matcher, @CheckForNull C defaultIfNone)
C - the type of credential.credentials - the credentials to select from.matcher - the matcher.defaultIfNone - the default value if no match found.@CheckForNull public static <C extends Credentials> C firstOrNull(@NonNull Iterable<C> credentials, @NonNull CredentialsMatcher matcher)
null if none match.C - the type of credential.credentials - the credentials to select from.matcher - the matcher.Copyright © 2004-2015. All Rights Reserved.