Class ContextPermission

java.lang.Object
java.security.Permission
org.wildfly.common.context.ContextPermission
All Implemented Interfaces:
Serializable, Guard

public final class ContextPermission extends Permission
A permission object for operations on 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):

Additionally, the special * action name is allowed which implies all of the above actions.

The newPermissionCollection() method returns an optimized container for context permissions.

Author:
David M. Lloyd
See Also:
  • Constructor Details

    • ContextPermission

      public ContextPermission(String name, String actions)
      Constructs a permission with the specified name.
      Parameters:
      name - name of the Permission object being created (must not be null)
      actions - the actions string (must not be null)
  • Method Details

    • implies

      public boolean implies(Permission permission)
      Determine if the given permission is implied by this permission.
      Specified by:
      implies in class Permission
      Parameters:
      permission - the other permission
      Returns:
      true if the other permission is not null and is a context permission which is implied by this permission instance; false otherwise
    • implies

      public boolean implies(ContextPermission permission)
      Determine if the given permission is implied by this permission.
      Parameters:
      permission - the other permission
      Returns:
      true if the other permission is not null and is a context permission which is implied by this permission instance; false otherwise
    • equals

      public boolean equals(Object obj)
      Determine if this permission is equal to the given object.
      Specified by:
      equals in class Permission
      Parameters:
      obj - the other object
      Returns:
      true if the object is a context permission that is exactly equal to this one; false otherwise
    • equals

      public boolean equals(ContextPermission permission)
      Determine if this permission is equal to the given permission.
      Parameters:
      permission - the other permission
      Returns:
      true if the permission is a context permission that is exactly equal to this one; false otherwise
    • hashCode

      public int hashCode()
      Get the hash code of this permission.
      Specified by:
      hashCode in class Permission
      Returns:
      the hash code of this permission
    • getActions

      public String getActions()
      Get the actions string. This string will be returned in a canonical format.
      Specified by:
      getActions in class Permission
      Returns:
      the actions string
    • withActions

      @NotNull public ContextPermission withActions(String actions)
      Create a copy of this permission with the additional given actions.
      Parameters:
      actions - the additional actions (must not be null)
      Returns:
      the new permission (not null)
    • withoutActions

      @NotNull public ContextPermission withoutActions(String actions)
      Create a copy of this permission without any of the given actions.
      Parameters:
      actions - the actions to subtract (must not be null)
      Returns:
      the new permission (not null)
    • newPermissionCollection

      public PermissionCollection newPermissionCollection()
      Get a new permission collection instance which can hold this type of permissions.
      Overrides:
      newPermissionCollection in class Permission
      Returns:
      a new permission collection instance (not null)