Class AbstractPermission

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractPermission​(int mask)
      Sets the permission mask and uses the '*' character to represent active bits when represented as a bit pattern string.
      protected AbstractPermission​(int mask, char code)
      Sets the permission mask and uses the specified character for active bits.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      int getMask()
      Returns the bits that represents the permission.
      java.lang.String getPattern()
      Returns a 32-character long bit pattern String representing this permission.
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • code

        protected final char code
      • mask

        protected int mask
    • Constructor Detail

      • AbstractPermission

        protected AbstractPermission​(int mask)
        Sets the permission mask and uses the '*' character to represent active bits when represented as a bit pattern string.
        Parameters:
        mask - the integer bit mask for the permission
      • AbstractPermission

        protected AbstractPermission​(int mask,
                                     char code)
        Sets the permission mask and uses the specified character for active bits.
        Parameters:
        mask - the integer bit mask for the permission
        code - the character to print for each active bit in the mask (see Permission.getPattern())
    • Method Detail

      • equals

        public final boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getMask

        public final int getMask()
        Description copied from interface: Permission
        Returns the bits that represents the permission.
        Specified by:
        getMask in interface Permission
        Returns:
        the bits that represent the permission
      • getPattern

        public java.lang.String getPattern()
        Description copied from interface: Permission
        Returns a 32-character long bit pattern String representing this permission.

        Implementations are free to format the pattern as they see fit, although under no circumstances may Permission.RESERVED_OFF or Permission.RESERVED_ON be used within the pattern. An exemption is in the case of Permission.RESERVED_OFF which is used to denote a bit that is off (clear). Implementations may also elect to use Permission.RESERVED_ON internally for computation purposes, although this method may not return any String containing Permission.RESERVED_ON.

        The returned String must be 32 characters in length.

        This method is only used for user interface and logging purposes. It is not used in any permission calculations. Therefore, duplication of characters within the output is permitted.

        Specified by:
        getPattern in interface Permission
        Returns:
        a 32-character bit pattern