AclEntry (Apache Hadoop Main 3.5.0 API)
Description: declaration: package: org.apache.hadoop.fs.permission, class: AclEntry

Package org.apache.hadoop.fs.permission

# Class AclEntry

java.lang.Object
org.apache.hadoop.fs.permission.AclEntry

@Public @Stable public class AclEntry extends Object
Defines a single entry in an ACL. An ACL entry has a type (user, group, mask, or other), an optional name (referring to a specific user or group), a set of permissions (any combination of read, write and execute), and a scope (access or default). AclEntry instances are immutable. Use a `AclEntry.Builder` to create a new instance.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `org.apache.hadoop.fs.permission.AclEntry.Builder`
  Builder for creating new AclEntry instances.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static String`
  `aclSpecToString(List<AclEntry> aclSpec)`
  Convert a List of AclEntries into a string - the reverse of parseAclSpec.
  `boolean`
  `equals(Object o)`
  `String`
  `getName()`
  Returns the optional ACL entry name.
  `FsAction`
  `getPermission()`
  Returns the set of permissions in the ACL entry.
  `AclEntryScope`
  `getScope()`
  Returns the scope of the ACL entry.
  `AclEntryType`
  `getType()`
  Returns the ACL entry type.
  `int`
  `hashCode()`
  `static AclEntry`
  `parseAclEntry(String aclStr, boolean includePermission)`
  Parses a string representation of an ACL into a AclEntry object.
  The expected format of ACL entries in the string parameter is the same format produced by the `toStringStable()` method.
  `static List<AclEntry>`
  `parseAclSpec(String aclSpec, boolean includePermission)`
  Parses a string representation of an ACL spec into a list of AclEntry objects.
  `String`
  `toString()`
  `String`
  `toStringStable()`
  Returns a string representation guaranteed to be stable across versions to satisfy backward compatibility requirements, such as for shell command output or serialization.

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

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

- ## Method Details

  - ### getType

    public AclEntryType getType()
    Returns the ACL entry type.
    Returns:
      AclEntryType ACL entry type

  - ### getName

    public String getName()
    Returns the optional ACL entry name.
    Returns:
      String ACL entry name, or null if undefined

  - ### getPermission

    public FsAction getPermission()
    Returns the set of permissions in the ACL entry.
    Returns:
      FsAction set of permissions in the ACL entry

  - ### getScope

    public AclEntryScope getScope()
    Returns the scope of the ACL entry.
    Returns:
      AclEntryScope scope of the ACL entry

  - ### equals

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

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### toString

    @Unstable public String toString()
    Overrides:
      `toString` in class `Object`

  - ### toStringStable

    public String toStringStable()
    Returns a string representation guaranteed to be stable across versions to satisfy backward compatibility requirements, such as for shell command output or serialization. The format of this string representation matches what is expected by the `parseAclSpec(String, boolean)` and `parseAclEntry(String, boolean)` methods.
    Returns:
      stable, backward compatible string representation

  - ### parseAclSpec

    public static List<AclEntry> parseAclSpec(String aclSpec, boolean includePermission)
    Parses a string representation of an ACL spec into a list of AclEntry objects. Example: "user::rwx,user:foo:rw-,group::r--,other::---" The expected format of ACL entries in the string parameter is the same format produced by the `toStringStable()` method.
    Parameters:
      `aclSpec` - String representation of an ACL spec.
      `includePermission` - for setAcl operations this will be true. i.e. AclSpec should include permissions.
      But for removeAcl operation it will be false. i.e. AclSpec should not contain permissions.
      Example: "user:foo,group:bar"
    Returns:
      Returns list of `AclEntry` parsed

  - ### parseAclEntry

    public static AclEntry parseAclEntry(String aclStr, boolean includePermission)
    Parses a string representation of an ACL into a AclEntry object.
    The expected format of ACL entries in the string parameter is the same format produced by the `toStringStable()` method.
    Parameters:
      `aclStr` - String representation of an ACL.
      Example: "user:foo:rw-"
      `includePermission` - for setAcl operations this will be true. i.e. Acl should include permissions.
      But for removeAcl operation it will be false. i.e. Acl should not contain permissions.
      Example: "user:foo,group:bar,mask::"
    Returns:
      Returns an `AclEntry` object

  - ### aclSpecToString

    public static String aclSpecToString(List<AclEntry> aclSpec)
    Convert a List of AclEntries into a string - the reverse of parseAclSpec.
    Parameters:
      `aclSpec` - List of AclEntries to convert
    Returns:
      String representation of aclSpec