public final class ContextPermission
extends java.security.Permission
ContextManager instances.
This type of permission requires a name and an action. The name may be the name
of a context manager, or the special * name which means the permission applies to all context managers.
The action may be one or more of the following (each action name being separated by a comma):
get - allow getting the current contextgetPrivilegedSupplier - allow access to the ContextManager.getPrivilegedSupplier() methodgetGlobalDefault - allow access to the global default contextsetGlobalDefault - allow setting the global default instancesetGlobalDefaultSupplier - allow setting the global default instance suppliergetThreadDefault - allow access to the per-thread default contextsetThreadDefault - allow setting the per-thread default instancesetThreadDefaultSupplier - allow setting the per-thread default instance supplier* action name is allowed which implies all of the above actions.
The newPermissionCollection() method returns an optimized container for context permissions.
| Constructor and Description |
|---|
ContextPermission(java.lang.String name,
java.lang.String actions)
Constructs a permission with the specified name.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(ContextPermission permission)
Determine if this permission is equal to the given permission.
|
boolean |
equals(java.lang.Object obj)
Determine if this permission is equal to the given object.
|
java.lang.String |
getActions()
Get the actions string.
|
int |
hashCode()
Get the hash code of this permission.
|
boolean |
implies(ContextPermission permission)
Determine if the given permission is implied by this permission.
|
boolean |
implies(java.security.Permission permission)
Determine if the given permission is implied by this permission.
|
java.security.PermissionCollection |
newPermissionCollection()
Get a new permission collection instance which can hold this type of permissions.
|
ContextPermission |
withActions(java.lang.String actions)
Create a copy of this permission with the additional given actions.
|
ContextPermission |
withoutActions(java.lang.String actions)
Create a copy of this permission without any of the given actions.
|
public ContextPermission(java.lang.String name,
java.lang.String actions)
name - name of the Permission object being created (must not be null)actions - the actions string (must not be null)public boolean implies(java.security.Permission permission)
implies in class java.security.Permissionpermission - the other permissiontrue if the other permission is not null and is a context permission which is implied by
this permission instance; false otherwisepublic boolean implies(ContextPermission permission)
permission - the other permissiontrue if the other permission is not null and is a context permission which is implied by
this permission instance; false otherwisepublic boolean equals(java.lang.Object obj)
equals in class java.security.Permissionobj - the other objecttrue if the object is a context permission that is exactly equal to this one; false otherwisepublic boolean equals(ContextPermission permission)
permission - the other permissiontrue if the permission is a context permission that is exactly equal to this one; false otherwisepublic int hashCode()
hashCode in class java.security.Permissionpublic java.lang.String getActions()
getActions in class java.security.Permission@NotNull public ContextPermission withActions(java.lang.String actions)
actions - the additional actions (must not be null)null)@NotNull public ContextPermission withoutActions(java.lang.String actions)
actions - the actions to subtract (must not be null)null)public java.security.PermissionCollection newPermissionCollection()
newPermissionCollection in class java.security.Permissionnull)Copyright © 2015 JBoss, a division of Red Hat, Inc.