Class AclEntry

java.lang.Object
java.nio.file.attribute.AclEntry

public final class AclEntry extends Object
An entry in an access control list (ACL).

The ACL entry represented by this class is based on the ACL model specified in RFC 3530: Network File System (NFS) version 4 Protocol. Each entry has four components as follows:

  1. The type component determines if the entry grants or denies access.

  2. The principal component, sometimes called the "who" component, is a UserPrincipal corresponding to the identity that the entry grants or denies access

  3. The permissions component is a set of permissions

  4. The flags component is a set of flags to indicate how entries are inherited and propagated

ACL entries are created using an associated AclEntry.Builder object by invoking its build method.

ACL entries are immutable and are safe for use by multiple concurrent threads.

Since:
1.7
External Specifications
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A builder of AclEntry objects.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compares the specified object with this ACL entry for equality.
    Returns a copy of the flags component.
    int
    Returns the hash-code value for this ACL entry.
    Constructs a new builder.
    Constructs a new builder with the components of an existing ACL entry.
    Returns a copy of the permissions component.
    Returns the principal component.
    Returns the string representation of this ACL entry.
    Returns the ACL entry type.

    Methods declared in class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Creates and returns a copy of this object.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Finalization is deprecated and subject to removal in a future release.
    final Class<?>
    Returns the runtime class of this Object.
    final void
    Wakes up a single thread that is waiting on this object's monitor.
    final void
    Wakes up all threads that are waiting on this object's monitor.
    final void
    Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
    final void
    wait(long timeoutMillis)
    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
    final void
    wait(long timeoutMillis, int nanos)
    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  • Method Details

    • newBuilder

      public static AclEntry.Builder newBuilder()
      Constructs a new builder. The initial value of the type and who components is null. The initial value of the permissions and flags components is the empty set.
      Returns:
      a new builder
    • newBuilder

      public static AclEntry.Builder newBuilder(AclEntry entry)
      Constructs a new builder with the components of an existing ACL entry.
      Parameters:
      entry - an ACL entry
      Returns:
      a new builder
    • type

      public AclEntryType type()
      Returns the ACL entry type.
      Returns:
      the ACL entry type
    • principal

      public UserPrincipal principal()
      Returns the principal component.
      Returns:
      the principal component
    • permissions

      public Set<AclEntryPermission> permissions()
      Returns a copy of the permissions component.

      The returned set is a modifiable copy of the permissions.

      Returns:
      the permissions component
    • flags

      public Set<AclEntryFlag> flags()
      Returns a copy of the flags component.

      The returned set is a modifiable copy of the flags.

      Returns:
      the flags component
    • equals

      public boolean equals(Object ob)
      Compares the specified object with this ACL entry for equality.

      If the given object is not an AclEntry then this method immediately returns false.

      For two ACL entries to be considered equals requires that they are both the same type, their who components are equal, their permissions components are equal, and their flags components are equal.

      This method satisfies the general contract of the Object.equals method.

      Overrides:
      equals in class Object
      Parameters:
      ob - the object to which this object is to be compared
      Returns:
      true if, and only if, the given object is an AclEntry that is identical to this AclEntry
      See Also:
    • hashCode

      public int hashCode()
      Returns the hash-code value for this ACL entry.

      This method satisfies the general contract of the Object.hashCode() method.

      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object
      See Also:
    • toString

      public String toString()
      Returns the string representation of this ACL entry.
      Overrides:
      toString in class Object
      Returns:
      the string representation of this entry