Class PrivilegeBits


  • public class PrivilegeBits
    extends Object
    PrivilegeBits
    • Method Detail

      • getInstance

        public static PrivilegeBits getInstance()
        Creates a mutable instance of privilege bits.
        Returns:
        a new instance of privilege bits.
      • getInstance

        public static PrivilegeBits getInstance​(PrivilegeBits base)
        Creates a mutable instance of privilege bits.
        Parameters:
        base -
        Returns:
        a new instance of privilege bits.
      • isEmpty

        public boolean isEmpty()
        Returns true if this privilege bits includes no privileges at all.
        Returns:
        true if this privilege bits includes no privileges at all; false otherwise.
        See Also:
        PrivilegeRegistry.NO_PRIVILEGE
      • unmodifiable

        public PrivilegeBits unmodifiable()
        Returns an unmodifiable instance.
        Returns:
        an unmodifiable PrivilegeBits instance.
      • isModifiable

        public boolean isModifiable()
        Returns true if this privilege bits instance can be altered.
        Returns:
        true if this privilege bits instance can be altered.
      • includesRead

        public boolean includesRead()
        Returns true if this instance includes the jcr:read privilege. Shortcut for calling includes(PrivilegeBits) where the other bits represented the jcr:read privilege.
        Returns:
        true if this instance includes the jcr:read privilege; false otherwise.
      • includes

        public boolean includes​(PrivilegeBits otherBits)
        Returns true if all privileges defined by the specified otherBits are present in this instance.
        Parameters:
        otherBits -
        Returns:
        true if all privileges defined by the specified otherBits are included in this instance; false otherwise.
      • add

        public void add​(PrivilegeBits other)
        Adds the other privilege bits to this instance.
        Parameters:
        other - The other privilege bits to be added.
        Throws:
        UnsupportedOperationException - if this instance is immutable.
      • diff

        public void diff​(PrivilegeBits other)
        Subtracts the other PrivilegeBits from the this.
        If the specified bits do not intersect with this, it isn't modified.
        If this is included in other empty privilege bits is returned.
        Parameters:
        other - The other privilege bits to be substracted from this instance.
        Throws:
        UnsupportedOperationException - if this instance is immutable.
      • addDifference

        public void addDifference​(PrivilegeBits a,
                                  PrivilegeBits b)
        Subtracts the b from a and adds the result (diff) to this instance.
        Parameters:
        a - An instance of privilege bits.
        b - An instance of privilege bits.
        Throws:
        UnsupportedOperationException - if this instance is immutable.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object