Package org.wildfly.security.permission
Class SimpleActionBitsPermissionCollection
- java.lang.Object
-
- java.security.PermissionCollection
-
- org.wildfly.security.permission.AbstractPermissionCollection
-
- org.wildfly.security.permission.SimpleActionBitsPermissionCollection
-
- All Implemented Interfaces:
Serializable
,Iterable<Permission>
,PermissionVerifier
public final class SimpleActionBitsPermissionCollection extends AbstractPermissionCollection
A trivially simple permission collection, suitable as a default for most permission types (though probably not as efficient as a specialized type in many cases).- Author:
- David M. Lloyd
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static AbstractActionSetPermission<?>[]
NO_PERMS
private AtomicReference<AbstractActionSetPermission<?>[]>
permissionsRef
-
Fields inherited from interface org.wildfly.security.permission.PermissionVerifier
ALL, NONE
-
-
Constructor Summary
Constructors Constructor Description SimpleActionBitsPermissionCollection(AbstractActionSetPermission<?> sourcePermission)
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doAdd(AbstractActionSetPermission<?> permission)
Adds a permission.protected void
doAdd(AbstractPermission<?> permission)
Perform the work of adding a permission.Enumeration<Permission>
elements()
Iterate over this permission collection.boolean
implies(Permission permission)
Determine if the permission is verified by this object.Iterator<Permission>
iterator()
Iterate over this permission collection.int
size()
Get the size of this permission collection.-
Methods inherited from class org.wildfly.security.permission.AbstractPermissionCollection
add, getSourcePermission, writeReplace
-
Methods inherited from class java.security.PermissionCollection
elementsAsStream, isReadOnly, setReadOnly, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.wildfly.security.permission.PermissionVerifier
and, checkPermission, not, or, toPermissionCollection, unless, xor
-
-
-
-
Field Detail
-
NO_PERMS
private static final AbstractActionSetPermission<?>[] NO_PERMS
-
permissionsRef
private final AtomicReference<AbstractActionSetPermission<?>[]> permissionsRef
-
-
Constructor Detail
-
SimpleActionBitsPermissionCollection
public SimpleActionBitsPermissionCollection(AbstractActionSetPermission<?> sourcePermission)
Construct a new instance.- Parameters:
sourcePermission
- the source permission for this collection (must not benull
)
-
-
Method Detail
-
size
public int size()
Description copied from class:AbstractPermissionCollection
Get the size of this permission collection.- Specified by:
size
in classAbstractPermissionCollection
- Returns:
- the size of this permission collection
-
doAdd
protected void doAdd(AbstractPermission<?> permission)
Description copied from class:AbstractPermissionCollection
Perform the work of adding a permission. The permission is guaranteed to be of the correct type and the collection is guaranteed to have been writable at the time theAbstractPermissionCollection.add(Permission)
method was called.- Specified by:
doAdd
in classAbstractPermissionCollection
- Parameters:
permission
- the non-null
permission
-
doAdd
protected void doAdd(AbstractActionSetPermission<?> permission)
Adds a permission.- Parameters:
permission
- the non-null
permission
-
implies
public boolean implies(Permission permission)
Description copied from interface:PermissionVerifier
Determine if the permission is verified by this object.- Specified by:
implies
in interfacePermissionVerifier
- Specified by:
implies
in classPermissionCollection
- Parameters:
permission
- the permission to verify (must not benull
)- Returns:
true
if the permission is implied by this verifier,false
otherwise
-
iterator
public Iterator<Permission> iterator()
Description copied from class:AbstractPermissionCollection
Iterate over this permission collection.- Specified by:
iterator
in interfaceIterable<Permission>
- Specified by:
iterator
in classAbstractPermissionCollection
- Returns:
- the iterator (not
null
)
-
elements
public Enumeration<Permission> elements()
Description copied from class:AbstractPermissionCollection
Iterate over this permission collection.- Specified by:
elements
in classAbstractPermissionCollection
- Returns:
- the iterator (not
null
)
-
-