Class AbstractActionSetPermission<This extends AbstractActionSetPermission<This>>

    • Field Detail

      • actionBits

        private final int actionBits
      • actions

        private String actions
    • Constructor Detail

      • 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 Detail

      • getActionBits

        public final int getActionBits()
        Get the action bits of this permission.
        Returns:
        the action bits
      • 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
      • actionsMask

        private int actionsMask()
      • 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)
      • 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
      • isSet

        private static boolean isSet​(int bits,
                                     int test)