Class ImmutableAccessControlEntry

java.lang.Object
org.bremersee.acl.model.ImmutableAccessControlEntry
All Implemented Interfaces:
Comparable<AccessControlEntry>, AccessControlEntry

@Generated(from="AccessControlEntry", generator="Immutables") @Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableAccessControlEntry extends Object implements AccessControlEntry
Immutable implementation of AccessControlEntry.

Use the builder to create immutable instances: ImmutableAccessControlEntry.builder().

  • Method Details

    • getPermission

      public String getPermission()
      Specifies the permission.
      Specified by:
      getPermission in interface AccessControlEntry
      Returns:
      the permission
    • isGuest

      public boolean isGuest()
      Specifies whether anybody is granted or not.
      Specified by:
      isGuest in interface AccessControlEntry
      Returns:
      whether anybody is granted (true) or not (false)
    • getUsers

      public Collection<String> getUsers()
      Specifies the granted users.
      Specified by:
      getUsers in interface AccessControlEntry
      Returns:
      the users
    • getRoles

      public Collection<String> getRoles()
      Specifies the granted roles.
      Specified by:
      getRoles in interface AccessControlEntry
      Returns:
      the roles
    • getGroups

      public Collection<String> getGroups()
      Specifies the granted groups.
      Specified by:
      getGroups in interface AccessControlEntry
      Returns:
      the groups
    • withPermission

      public final ImmutableAccessControlEntry withPermission(String value)
      Copy the current immutable object by setting a value for the permission attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for permission
      Returns:
      A modified copy or the this object
    • withIsGuest

      public final ImmutableAccessControlEntry withIsGuest(boolean value)
      Copy the current immutable object by setting a value for the isGuest attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for isGuest
      Returns:
      A modified copy or the this object
    • withUsers

      public final ImmutableAccessControlEntry withUsers(Collection<String> value)
      Copy the current immutable object by setting a value for the users attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for users
      Returns:
      A modified copy or the this object
    • withRoles

      public final ImmutableAccessControlEntry withRoles(Collection<String> value)
      Copy the current immutable object by setting a value for the roles attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for roles
      Returns:
      A modified copy or the this object
    • withGroups

      public final ImmutableAccessControlEntry withGroups(Collection<String> value)
      Copy the current immutable object by setting a value for the groups attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for groups
      Returns:
      A modified copy or the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableAccessControlEntry that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: permission, isGuest, users, roles, groups.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value AccessControlEntry with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableAccessControlEntry copyOf(AccessControlEntry instance)
      Creates an immutable copy of a AccessControlEntry value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable AccessControlEntry instance
    • builder

      public static ImmutableAccessControlEntry.Builder builder()
      Creates a builder for ImmutableAccessControlEntry.
       ImmutableAccessControlEntry.builder()
          .permission(String) // required permission
          .isGuest(boolean) // optional isGuest
          .users(Collection<String>) // optional users
          .roles(Collection<String>) // optional roles
          .groups(Collection<String>) // optional groups
          .build();
       
      Returns:
      A new ImmutableAccessControlEntry builder