org.apache.jackrabbit.core.security.authorization
Class PrivilegeBits

java.lang.Object
  extended by org.apache.jackrabbit.core.security.authorization.PrivilegeBits

public class PrivilegeBits
extends Object

PrivilegeBits


Field Summary
static PrivilegeBits EMPTY
           
 
Method Summary
 void add(PrivilegeBits other)
          Adds the other privilege bits to this instance.
 void addDifference(PrivilegeBits a, PrivilegeBits b)
          Subtracts the b from a and adds the result (diff) to this instance.
 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.
 boolean equals(Object o)
           
static PrivilegeBits getInstance()
          Creates a mutable instance of privilege bits.
static PrivilegeBits getInstance(PrivilegeBits base)
          Creates a mutable instance of privilege bits.
 int hashCode()
           
 boolean includes(PrivilegeBits otherBits)
          Returns true if all privileges defined by the specified otherBits are present in this instance.
 boolean includesRead()
          Returns true if this instance includes the jcr:read privilege.
 boolean isEmpty()
          Returns true if this privilege bits includes no privileges at all.
 boolean isModifiable()
          Returns true if this privilege bits instance can be altered.
 String toString()
           
 PrivilegeBits unmodifiable()
          Returns an unmodifiable instance.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final PrivilegeBits EMPTY
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

equals

public boolean equals(Object o)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.