Rights (JavaMail API documentation)
Date: 2018-05-06

com.sun.mail.imap

## Class Rights

- java.lang.Object
- - com.sun.mail.imap.Rights

- All Implemented Interfaces:
    java.lang.Cloneable

      public class Rights
      extends java.lang.Object
      implements java.lang.Cloneable

  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);

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Rights.Right` This inner class represents an individual right.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Rights()` Construct an empty Rights object.
    `Rights(Rights.Right right)` Construct a Rights object initialized with the given right.
    `Rights(Rights rights)` Construct a Rights object initialized with the given rights.
    `Rights(java.lang.String rights)` Construct a Rights object initialized with the given rights.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(Rights.Right right)` Add the specified right to this Rights object.
    `void` | `add(Rights rights)` Add all the rights in the given Rights object to this Rights object.
    `java.lang.Object` | `clone()` Returns a clone of this Rights object.
    `boolean` | `contains(Rights.Right right)` Check whether the specified right is present in this Rights object.
    `boolean` | `contains(Rights rights)` Check whether all the rights in the specified Rights object are present in this Rights object.
    `boolean` | `equals(java.lang.Object obj)` Check whether the two Rights objects are equal.
    `Rights.Right[]` | `getRights()` Return all the rights in this Rights object.
    `int` | `hashCode()` Compute a hash code for this Rights object.
    `void` | `remove(Rights.Right right)` Remove the specified right from this Rights object.
    `void` | `remove(Rights rights)` Remove all rights in the given Rights object from this Rights object.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Rights

          public Rights()

      Construct an empty Rights object.

    - #### Rights

          public Rights(Rights rights)

      Construct a Rights object initialized with the given rights.
      Parameters:
        `rights` - the rights for initialization

    - #### Rights

          public Rights(java.lang.String rights)

      Construct a Rights object initialized with the given rights.
      Parameters:
        `rights` - the rights for initialization

    - #### Rights

          public Rights(Rights.Right right)

      Construct a Rights object initialized with the given right.
      Parameters:
        `right` - the right for initialization

  - ### Method Detail

    - #### add

          public void add(Rights.Right right)

      Add the specified right to this Rights object.
      Parameters:
        `right` - the right to add

    - #### add

          public void add(Rights rights)

      Add all the rights in the given Rights object to this Rights object.
      Parameters:
        `rights` - Rights object

    - #### remove

          public void remove(Rights.Right right)

      Remove the specified right from this Rights object.
      Parameters:
        `right` - the right to be removed

    - #### remove

          public void remove(Rights rights)

      Remove all rights in the given Rights object from this Rights object.
      Parameters:
        `rights` - the rights to be removed

    - #### contains

          public boolean contains(Rights.Right right)

      Check whether the specified right is present in this Rights object.
      Returns:
        true of the given right is present, otherwise false.

    - #### contains

          public boolean contains(Rights rights)

      Check whether all the rights in the specified Rights object are present in this Rights object.
      Returns:
        true if all rights in the given Rights object are present, otherwise false.

    - #### equals

          public boolean equals(java.lang.Object obj)

      Check whether the two Rights objects are equal.
      Overrides:
        `equals` in class `java.lang.Object`
      Returns:
        true if they're equal

    - #### hashCode

          public int hashCode()

      Compute a hash code for this Rights object.
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        the hash code

    - #### getRights

          public Rights.Right[] getRights()

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

    - #### clone

          public java.lang.Object clone()

      Returns a clone of this Rights object.
      Overrides:
        `clone` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

Copyright © 1996-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms< /a>.