Package org.wildfly.security.authz
Interface Roles
-
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 Roles
addPrefix(String prefix)
Get a roles collection which adds a prefix to all role names.default Roles
addSuffix(String suffix)
Get a roles collection which adds a suffix to all role names.default Roles
and(Roles other)
Get the intersection of this collection and another.boolean
contains(String roleName)
Determine if this collection contains the given role name.default boolean
containsAll(Set<String> desiredRoles)
Determine if this collection contains all of the given role names.default boolean
containsAny(Set<String> desiredRoles)
Determine if this collection contains any of the given role names.static Roles
fromSet(Set<String> set)
Construct a new roles collection from a set.default boolean
isEmpty()
Determine whether this roles collection is empty.default Roles
minus(Roles other)
Get a roles collection which consists of the roles in this collection minus the roles in the other collection.static Roles
of(String role)
Construct a role set consisting of a single role.default Roles
or(Roles other)
Get the union of this collection and another.default Spliterator<String>
spliterator()
Create aSpliterator
over this roles collection.static Set<String>
toSet(Roles roles)
Returns a set (immutable) containing roles from a roles collection.default Roles
xor(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:
true
if the role is contained in this collection,false
otherwise
-
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:
true
if this collection contains any of the desired roles,false
otherwise.
-
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:
true
if this collection contains all of the desired roles,false
otherwise.
-
isEmpty
default boolean isEmpty()
Determine whether this roles collection is empty.- Returns:
true
if the collection is empty,false
otherwise
-
spliterator
default Spliterator<String> spliterator()
Create aSpliterator
over this roles collection.- Specified by:
spliterator
in 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
)
-
-