Module org.apache.wicket.auth.roles
Class Roles
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<String>
,Collection<String>
,Set<String>
,IClusterable
Utility class for working with roles.
- Author:
- Eelco Hillenius, Jonathan Locke
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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
Whether this roles object containes the provided role.toString()
Methods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size, spliterator, toArray, toArray
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll
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 Details
-
USER
USER role (for use in annotations)- See Also:
-
ADMIN
ADMIN role (for use in annotations)- See Also:
-
-
Constructor Details
-
Roles
public Roles()Construct. -
Roles
Construct.- Parameters:
roles
- Roles as a comma separated list, like "ADMIN, USER"
-
Roles
Construct.- Parameters:
roles
- Roles
-
Roles
-
-
Method Details
-
hasRole
Whether this roles object containes the provided role.- Parameters:
role
- the role to check- Returns:
- true if it contains the role, false otherwise
-
hasAnyRole
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
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
- Overrides:
toString
in classAbstractCollection<String>
- See Also:
-