Interface Roles

All Superinterfaces:
Iterable<String>

public interface Roles extends Iterable<String>
A collection of roles.
Author:
David M. Lloyd
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Roles
    The empty roles collection.
  • Method Summary

    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
    Construct a new roles collection from a set.
    default boolean
    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.
    Create a Spliterator 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.

    Methods inherited from interface java.lang.Iterable

    forEach, iterator
  • Field Details

    • NONE

      static final Roles NONE
      The empty roles collection.
  • Method Details

    • 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 a Spliterator over this roles collection.
      Specified by:
      spliterator in interface Iterable<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 be null)
      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 (not null)
      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 be null)
      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 be null)
      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 be null)
      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 be null)
      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 be null)
      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 be null)
      Returns:
      the new roles collection (not null)
    • addPrefix

      default Roles addPrefix(String prefix)
      Get a roles collection which adds a prefix to all role names.
      Parameters:
      prefix - the prefix to add (must not be null)
      Returns:
      the new roles collection (not null)