java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
java.util.HashSet<String>
org.apache.wicket.authroles.authorization.strategies.role.Roles
All Implemented Interfaces:
Serializable, Cloneable, Iterable<String>, Collection<String>, Set<String>, IClusterable

public class Roles extends HashSet<String> implements IClusterable
Utility class for working with roles.
Author:
Eelco Hillenius, Jonathan Locke
See Also:
  • Field Details

  • Constructor Details

    • Roles

      public Roles()
      Construct.
    • Roles

      public Roles(String roles)
      Construct.
      Parameters:
      roles - Roles as a comma separated list, like "ADMIN, USER"
    • Roles

      public Roles(String[] roles)
      Construct.
      Parameters:
      roles - Roles
    • Roles

      public Roles(Collection<String> roles)
  • Method Details

    • hasRole

      public boolean hasRole(String role)
      Whether this roles object containes the provided role.
      Parameters:
      role - the role to check
      Returns:
      true if it contains the role, false otherwise
    • hasAnyRole

      public boolean hasAnyRole(Roles roles)
      Whether this roles object contains any of the provided roles.
      Parameters:
      roles - the roles to check
      Returns:
      true if it contains any of the roles, false otherwise
    • hasAllRoles

      public boolean hasAllRoles(Roles roles)
      Whether this roles object contains all the provided roles.
      Parameters:
      roles - the roles to check
      Returns:
      true if it contains all the roles or the provided roles object is null, false otherwise
    • toString

      public String toString()
      Overrides:
      toString in class AbstractCollection<String>
      See Also: