Package org.wildfly.security.authz
Interface Roles
-
- All Known Implementing Classes:
AddPrefixRoles,AddSuffixRoles,DifferenceRoles,DisjunctionRoles,IntersectionRoles,MappedRoles,OneRole,RegexRoles,UnionRoles
public interface Roles extends Iterable<String>
A collection of roles.- Author:
- David M. Lloyd
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default RolesaddPrefix(String prefix)Get a roles collection which adds a prefix to all role names.default RolesaddSuffix(String suffix)Get a roles collection which adds a suffix to all role names.default Rolesand(Roles other)Get the intersection of this collection and another.booleancontains(String roleName)Determine if this collection contains the given role name.default booleancontainsAll(Set<String> desiredRoles)Determine if this collection contains all of the given role names.default booleancontainsAny(Set<String> desiredRoles)Determine if this collection contains any of the given role names.static RolesfromSet(Set<String> set)Construct a new roles collection from a set.default booleanisEmpty()Determine whether this roles collection is empty.default Rolesminus(Roles other)Get a roles collection which consists of the roles in this collection minus the roles in the other collection.static Rolesof(String role)Construct a role set consisting of a single role.default Rolesor(Roles other)Get the union of this collection and another.default Spliterator<String>spliterator()Create aSpliteratorover this roles collection.static Set<String>toSet(Roles roles)Returns a set (immutable) containing roles from a roles collection.default Rolesxor(Roles other)Get the disjunction of this collection and another.
-
-
-
Field Detail
-
NONE
static final Roles NONE
The empty roles collection.
-
-
Method Detail
-
contains
boolean contains(String roleName)
Determine if this collection contains the given role name.- Parameters:
roleName- the role name- Returns:
trueif the role is contained in this collection,falseotherwise
-
containsAny
default boolean containsAny(Set<String> desiredRoles)
Determine if this collection contains any of the given role names.- Parameters:
desiredRoles- the roles to check.- Returns:
trueif this collection contains any of the desired roles,falseotherwise.
-
containsAll
default boolean containsAll(Set<String> desiredRoles)
Determine if this collection contains all of the given role names.- Parameters:
desiredRoles- the roles to check.- Returns:
trueif this collection contains all of the desired roles,falseotherwise.
-
isEmpty
default boolean isEmpty()
Determine whether this roles collection is empty.- Returns:
trueif the collection is empty,falseotherwise
-
spliterator
default Spliterator<String> spliterator()
Create aSpliteratorover this roles collection.- Specified by:
spliteratorin interfaceIterable<String>- Returns:
- the spliterator (not
null)
-
fromSet
static Roles fromSet(Set<String> set)
Construct a new roles collection from a set.- Parameters:
set- the set of role names (must not benull)- Returns:
- the roles collection (not
null)
-
toSet
static Set<String> toSet(Roles roles)
Returns a set (immutable) containing roles from a roles collection.- Parameters:
roles- collection (notnull)- Returns:
- the set of role names (must not be
null)
-
of
static Roles of(String role)
Construct a role set consisting of a single role.- Parameters:
role- the role name (must not benull)- Returns:
- the role set (not
null)
-
and
default Roles and(Roles other)
Get the intersection of this collection and another.- Parameters:
other- the other roles collection (must not benull)- Returns:
- the intersection (not
null)
-
or
default Roles or(Roles other)
Get the union of this collection and another.- Parameters:
other- the other roles collection (must not benull)- Returns:
- the union (not
null)
-
xor
default Roles xor(Roles other)
Get the disjunction of this collection and another.- Parameters:
other- the other roles collection (must not benull)- Returns:
- the disjunction (not
null)
-
minus
default Roles minus(Roles other)
Get a roles collection which consists of the roles in this collection minus the roles in the other collection.- Parameters:
other- the other collection (must not benull)- Returns:
- the difference (not
null)
-
addSuffix
default Roles addSuffix(String suffix)
Get a roles collection which adds a suffix to all role names.- Parameters:
suffix- the suffix to add (must not benull)- Returns:
- the new roles collection (not
null)
-
-