Class AbstractActionSetPermission<This extends AbstractActionSetPermission<This>>

All Implemented Interfaces:
Serializable, Guard, PermissionVerifier
Direct Known Subclasses:
AbstractNamingPermission

public abstract class AbstractActionSetPermission<This extends AbstractActionSetPermission<This>> extends AbstractActionPermission<This>
An abstract base class for permissions which use a bit set to represent actions.
Author:
David M. Lloyd
See Also:
  • Constructor Details

    • AbstractActionSetPermission

      protected AbstractActionSetPermission(String name, int actionBits, StringEnumeration actionEnumeration)
      Construct a new instance. The given bits are masked by actionsMask() before being stored in the object instance.
      Parameters:
      name - the permission name
      actionBits - the permission action bits
      actionEnumeration - the permission actions enumeration
    • AbstractActionSetPermission

      protected AbstractActionSetPermission(String name, String actions, StringEnumeration actionEnumeration)
      Construct a new instance.
      Parameters:
      name - the permission name
      actions - the permission actions string
      actionEnumeration - the permission actions enumeration
  • Method Details

    • getActionBits

      public final int getActionBits()
      Get the action bits of this permission.
      Returns:
      the action bits
    • actionsEquals

      public final boolean actionsEquals(This permission)
      Description copied from class: AbstractActionPermission
      Determine whether the actions of this permission are equal to the actions of given permission.
      Specified by:
      actionsEquals in class AbstractActionPermission<This extends AbstractActionSetPermission<This>>
      Parameters:
      permission - the permission whose actions are to be compared
      Returns:
      true if the actions are equal, false otherwise
    • impliesActions

      public final boolean impliesActions(This permission)
      Description copied from class: AbstractActionPermission
      Determine whether this permission's actions value implies the actions of the given permission.
      Specified by:
      impliesActions in class AbstractActionPermission<This extends AbstractActionSetPermission<This>>
      Parameters:
      permission - the permission whose actions are to be compared
      Returns:
      true if this permission implies the other; false otherwise
    • impliesActions

      public final boolean impliesActions(String actions)
      Description copied from class: AbstractActionPermission
      Determine whether this permission's actions value implies the given actions value.
      Specified by:
      impliesActions in class AbstractActionPermission<This extends AbstractActionSetPermission<This>>
      Parameters:
      actions - the actions to test (must not be null)
      Returns:
      true if this permission implies the other; false otherwise
    • impliesActionBits

      public final boolean impliesActionBits(int actionBits)
      Determine whether this permission's actions value implies the given action bits.
      Parameters:
      actionBits - the actions bits to test
      Returns:
      true if this permission implies the given action bits; false otherwise
    • actionsHashCode

      protected final int actionsHashCode()
      Description copied from class: AbstractActionPermission
      Get the actions hash code.
      Specified by:
      actionsHashCode in class AbstractActionPermission<This extends AbstractActionSetPermission<This>>
      Returns:
      the actions hash code
    • getActions

      public final String getActions()
      Get the actions string. The string is computed the first time this method is called, and cached thereafter.
      Overrides:
      getActions in class AbstractPermission<This extends AbstractActionSetPermission<This>>
      Returns:
      the actions string (not null)
    • parseActions

      public final int parseActions(String actionsString) throws IllegalArgumentException
      Parse the actions string into a bit set.
      Parameters:
      actionsString - the actions string
      Returns:
      the bit set
      Throws:
      IllegalArgumentException - if the actions string contained an invalid name or invalid syntax
    • withActions

      public final This withActions(String actionsString)
      Description copied from class: AbstractActionPermission
      Get a permission which is identical to this one, but with new actions which consist of the union of the actions from this permission and the actions from the given string. The returned permission may or may not be a new instance, and may be equal to this instance.
      Specified by:
      withActions in class AbstractActionPermission<This extends AbstractActionSetPermission<This>>
      Parameters:
      actionsString - the actions string (must not be null)
      Returns:
      the permission (not null)
    • withActionsFrom

      public final This withActionsFrom(This permission)
      Description copied from class: AbstractActionPermission
      Get a permission which is identical to this one, but with new actions which consist of the union of the actions from this permission and the actions from the given permission. The returned permission may or may not be a new instance, and may be equal to this instance.
      Overrides:
      withActionsFrom in class AbstractActionPermission<This extends AbstractActionSetPermission<This>>
      Parameters:
      permission - the other permission (must not be null)
      Returns:
      the permission (not null)
    • withActionBits

      public final This withActionBits(int actionBits)
      Get a permission which is identical to this one, but with new actions which consist of the union of the actions from this permission and the action bits from the given value. The returned permission may or may not be a new instance, and may be equal to this instance.
      Parameters:
      actionBits - the action bits
      Returns:
      the permission (not null)
    • withoutActions

      public final This withoutActions(String actionsString)
      Description copied from class: AbstractActionPermission
      Get a permission which is identical to this one, but with new actions which consist of the actions from this permission without the actions from the given string. The returned permission may or may not be a new instance, and may be equal to this instance.
      Specified by:
      withoutActions in class AbstractActionPermission<This extends AbstractActionSetPermission<This>>
      Parameters:
      actionsString - the actions string (must not be null)
      Returns:
      the permission (not null)
    • withoutActionsFrom

      public final This withoutActionsFrom(This permission)
      Description copied from class: AbstractActionPermission
      Get a permission which is identical to this one, but with new actions which consist of the actions from this permission without the actions from the given permission. The returned permission may or may not be a new instance, and may be equal to this instance.
      Overrides:
      withoutActionsFrom in class AbstractActionPermission<This extends AbstractActionSetPermission<This>>
      Parameters:
      permission - the other permission (must not be null)
      Returns:
      the permission (not null)
    • withoutActionBits

      public final This withoutActionBits(int actionBits)
      Get a permission which is identical to this one, but with new actions which consist of the actions from this permission without the action bits from the given value. The returned permission may or may not be a new instance, and may be equal to this instance.
      Parameters:
      actionBits - the action bits
      Returns:
      the permission (not null)
    • withNewActions

      public final This withNewActions(String actionsString)
      Description copied from class: AbstractActionPermission
      Get a permission which is identical to this one, but with new actions as given by actionsString. The returned permission may or may not be a new instance, and may be equal to this instance.
      Specified by:
      withNewActions in class AbstractActionPermission<This extends AbstractActionSetPermission<This>>
      Parameters:
      actionsString - the actions string (must not be null)
      Returns:
      the permission (not null)
    • withNewActionsFrom

      public final This withNewActionsFrom(This permission)
      Description copied from class: AbstractActionPermission
      Get a permission which is identical to this one, but with new actions as given by actionsString. The returned permission may or may not be a new instance, and may be equal to this instance.
      Overrides:
      withNewActionsFrom in class AbstractActionPermission<This extends AbstractActionSetPermission<This>>
      Parameters:
      permission - the other permission (must not be null)
      Returns:
      the permission (not null)
    • withNewActionBits

      public final This withNewActionBits(int actionBits)
      Get a permission which is identical to this one, but with new action bits as given by actionBits. The returned permission may or may not be a new instance, and may be equal to this instance.
      Parameters:
      actionBits - the action bits
      Returns:
      the permission (not null)
    • constructWithActionBits

      protected abstract This constructWithActionBits(int actionBits)
      Construct or return a permission of this type with the same name as this one but with the given action bits.
      Parameters:
      actionBits - the action bits
      Returns:
      the permission