public class Roles extends HashSet<String> implements IClusterable
Modifier and Type | Field and Description |
---|---|
static String |
ADMIN
ADMIN role (for use in annotations)
|
static String |
USER
USER role (for use in annotations)
|
Constructor and Description |
---|
Roles()
Construct.
|
Roles(Collection<String> roles) |
Roles(String roles)
Construct.
|
Roles(String[] roles)
Construct.
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasAllRoles(Roles roles)
Whether this roles object contains all the provided roles.
|
boolean |
hasAnyRole(Roles roles)
Whether this roles object contains any of the provided roles.
|
boolean |
hasRole(String role)
Whether this roles object containes the provided role.
|
String |
toString() |
add, clear, clone, contains, isEmpty, iterator, remove, size
equals, hashCode, removeAll
addAll, containsAll, retainAll, toArray, toArray
public static final String USER
public static final String ADMIN
public Roles()
public Roles(String roles)
roles
- Roles as a comma separated list, like "ADMIN, USER"public Roles(String[] roles)
roles
- Rolespublic Roles(Collection<String> roles)
public boolean hasRole(String role)
role
- the role to checkpublic boolean hasAnyRole(Roles roles)
roles
- the roles to checkpublic boolean hasAllRoles(Roles roles)
roles
- the roles to checkpublic String toString()
toString
in class AbstractCollection<String>
Object.toString()
Copyright © 2006–2021 Apache Software Foundation. All rights reserved.