Class Roles
- 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:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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()
-
Methods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size, spliterator
-
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
-
-
-
Field Detail
-
USER
public static final String USER
USER role (for use in annotations)- See Also:
- Constant Field Values
-
ADMIN
public static final String ADMIN
ADMIN role (for use in annotations)- See Also:
- Constant Field Values
-
-
Method Detail
-
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 classAbstractCollection<String>
- See Also:
Object.toString()
-
-