Top Description Inners Fields Constructors Methods
com.sun.mail.imap

public Class Rights

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Imports
java.util.*

The Rights class represents the set of rights for an authentication identifier (for instance, a user or a group).

A right is represented by the Rights.Right inner class.

A set of standard rights are predefined (see RFC 2086). Most folder implementations are expected to support these rights. Some implementations may also support site-defined rights.

The following code sample illustrates how to examine your rights for a folder.


 Rights rights = folder.myRights();

 // Check if I can write this folder
 if (rights.contains(Rights.Right.WRITE))
	System.out.println("Can write folder");

 // Now give Joe all my rights, except the ability to write the folder
 rights.remove(Rights.Right.WRITE);
 ACL acl = new ACL("joe", rights);
 folder.setACL(acl);
 

Author
Bill Shannon

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Rights.Right

This inner class represents an individual right.

Field Summary

Modifier and TypeField and Description
private boolean[]

Constructor Summary

AccessConstructor and Description
public
Rights()

Construct an empty Rights object.

public
Rights(Rights
the rights for initialization
rights
)

Construct a Rights object initialized with the given rights.

public
Rights(String
the rights for initialization
rights
)

Construct a Rights object initialized with the given rights.

public
Rights(Rights.Right
the right for initialization
right
)

Construct a Rights object initialized with the given right.

Method Summary

Modifier and TypeMethod and Description
public void
add(Rights.Right
the right to add
right
)

Add the specified right to this Rights object.

public void
add(Rights
Rights object
rights
)

Add all the rights in the given Rights object to this Rights object.

public Object
clone()

Overrides java.lang.Object.clone.

Returns a clone of this Rights object.
public boolean

Returns:

true of the given right is present, otherwise false.
contains
(Rights.Right
the Right to check
right
)

Check whether the specified right is present in this Rights object.

public boolean

Returns:

true if all rights in the given Rights object are present, otherwise false.
contains
(Rights
the Rights to check
rights
)

Check whether all the rights in the specified Rights object are present in this Rights object.

public boolean

Returns:

true if they're equal
equals
(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Check whether the two Rights objects are equal.
public Rights.Right[]

Returns:

array of Rights.Right objects representing rights
getRights
()

Return all the rights in this Rights object.

public int

Returns:

the hash code
hashCode
()

Overrides java.lang.Object.hashCode.

Compute a hash code for this Rights object.
public void
remove(Rights.Right
the right to be removed
right
)

Remove the specified right from this Rights object.

public void
remove(Rights
the rights to be removed
rights
)

Remove all rights in the given Rights object from this Rights object.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
finalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

rightsback to summary
private boolean[] rights

Constructor Detail

Rightsback to summary
public Rights()

Construct an empty Rights object.

Rightsback to summary
public Rights(Rights rights)

Construct a Rights object initialized with the given rights.

Parameters
rights:Rights

the rights for initialization

Rightsback to summary
public Rights(String rights)

Construct a Rights object initialized with the given rights.

Parameters
rights:String

the rights for initialization

Rightsback to summary
public Rights(Rights.Right right)

Construct a Rights object initialized with the given right.

Parameters
right:Rights.Right

the right for initialization

Method Detail

addback to summary
public void add(Rights.Right right)

Add the specified right to this Rights object.

Parameters
right:Rights.Right

the right to add

addback to summary
public void add(Rights rights)

Add all the rights in the given Rights object to this Rights object.

Parameters
rights:Rights

Rights object

cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Returns a clone of this Rights object.

Returns:Object

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
containsback to summary
public boolean contains(Rights.Right right)

Check whether the specified right is present in this Rights object.

Parameters
right:Rights.Right

the Right to check

Returns:boolean

true of the given right is present, otherwise false.

containsback to summary
public boolean contains(Rights rights)

Check whether all the rights in the specified Rights object are present in this Rights object.

Parameters
rights:Rights

the Rights to check

Returns:boolean

true if all rights in the given Rights object are present, otherwise false.

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Check whether the two Rights objects are equal.

Parameters
obj:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

true if they're equal

Annotations
@Override
getRightsback to summary
public Rights.Right[] getRights()

Return all the rights in this Rights object. Returns an array of size zero if no rights are set.

Returns:Rights.Right[]

array of Rights.Right objects representing rights

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Compute a hash code for this Rights object.

Returns:int

the hash code

Annotations
@Override
removeback to summary
public void remove(Rights.Right right)

Remove the specified right from this Rights object.

Parameters
right:Rights.Right

the right to be removed

removeback to summary
public void remove(Rights rights)

Remove all rights in the given Rights object from this Rights object.

Parameters
rights:Rights

the rights to be removed

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override