Class PermissionActions


  • @Deprecated
    public final class PermissionActions
    extends Object
    Deprecated.
    Use one of the abstract permission classes like AbstractActionSetPermission instead.
    A helper class for defining permissions which use a finite list of actions. Define custom permissions using an enum of actions, where the string representation (via toString()) of each enum is one possible action name. Typically the enum should be non-public, and the constant names should be lowercase. If an action name contains a character which is not a valid Java identifier, then the toString() method of such constants should be overridden to report the correct string. The actions may be stored on the permission as an EnumSet, an int, or a long. The field should be marked transient, and the actions represented by a (possibly synthetic) field of type String which uses the canonical representation of the actions.
    Author:
    David M. Lloyd
    • Constructor Detail

      • PermissionActions

        private PermissionActions()
        Deprecated.
    • Method Detail

      • parseActionStringToSet

        public static <E extends Enum<E>> EnumSet<E> parseActionStringToSet​(Class<E> actionType,
                                                                            String actionString)
                                                                     throws IllegalArgumentException
        Deprecated.
        Parse an action string using the given action type to an EnumSet.
        Type Parameters:
        E - the action enum type
        Parameters:
        actionType - the action enum type class
        actionString - the string to parse
        Returns:
        the set of actions from the string
        Throws:
        IllegalArgumentException - if the string contained an invalid action
      • parseActionStringToInt

        public static <E extends Enum<E>> int parseActionStringToInt​(Class<E> actionType,
                                                                     String actionString)
                                                              throws IllegalArgumentException
        Deprecated.
        Parse an action string using the given action type to an int. The given enum type must have 32 or fewer constant values.
        Type Parameters:
        E - the action enum type
        Parameters:
        actionType - the action enum type class
        actionString - the string to parse
        Returns:
        the set of actions from the string
        Throws:
        IllegalArgumentException - if the string contained an invalid action
      • parseActionStringToLong

        public static <E extends Enum<E>> long parseActionStringToLong​(Class<E> actionType,
                                                                       String actionString)
                                                                throws IllegalArgumentException
        Deprecated.
        Parse an action string using the given action type to a long. The given enum type must have 64 or fewer constant values.
        Type Parameters:
        E - the action enum type
        Parameters:
        actionType - the action enum type class
        actionString - the string to parse
        Returns:
        the set of actions from the string
        Throws:
        IllegalArgumentException - if the string contained an invalid action
      • getCanonicalActionString

        public static <E extends Enum<E>> String getCanonicalActionString​(EnumSet<E> set)
        Deprecated.
        Get the canonical action string representation for the given action set.
        Type Parameters:
        E - the action type
        Parameters:
        set - the action set
        Returns:
        the canonical representation
      • getCanonicalActionString

        public static <E extends Enum<E>> void getCanonicalActionString​(EnumSet<E> set,
                                                                        StringBuilder b)
        Deprecated.
        Get the canonical action string representation for the given action set, appending it to the given string builder.
        Type Parameters:
        E - the action type
        Parameters:
        set - the action set
        b - the string builder
      • getCanonicalActionString

        public static <E extends Enum<E>> String getCanonicalActionString​(Class<E> type,
                                                                          int set)
        Deprecated.
        Get the canonical action string representation for the given action set.
        Type Parameters:
        E - the action type
        Parameters:
        type - the action enum type class
        set - the action set
        Returns:
        the canonical representation
      • getCanonicalActionString

        public static <E extends Enum<E>> void getCanonicalActionString​(Class<E> type,
                                                                        int set,
                                                                        StringBuilder b)
        Deprecated.
        Get the canonical action string representation for the given action set, appending it to the given string builder.
        Type Parameters:
        E - the action type
        Parameters:
        type - the action enum type class
        set - the action set
        b - the string builder
      • getCanonicalActionString

        public static <E extends Enum<E>> String getCanonicalActionString​(Class<E> type,
                                                                          long set)
        Deprecated.
        Get the canonical action string representation for the given action set.
        Type Parameters:
        E - the action type
        Parameters:
        type - the action enum type class
        set - the action set
        Returns:
        the canonical representation
      • getCanonicalActionString

        public static <E extends Enum<E>> void getCanonicalActionString​(Class<E> type,
                                                                        long set,
                                                                        StringBuilder b)
        Deprecated.
        Get the canonical action string representation for the given action set, appending it to the given string builder.
        Type Parameters:
        E - the action type
        Parameters:
        type - the action enum type class
        set - the action set
        b - the string builder