Record Class PermissionsStatus

java.lang.Object
java.lang.Record
nl.pim16aap2.animatedarchitecture.core.commands.PermissionsStatus

public record PermissionsStatus(boolean hasUserPermission, boolean hasAdminPermission) extends Record
Represents a pair of booleans that determine whether a user has user-level and/or admin-level permission access to some kind of action.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PermissionsStatus(boolean hasUserPermission, boolean hasAdminPermission)
    Creates an instance of a PermissionsStatus record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    boolean
    Returns the value of the hasAdminPermission record component.
    boolean
    Checks if either the user-level or the admin-level permission is available.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the hasUserPermission record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PermissionsStatus

      public PermissionsStatus(boolean hasUserPermission, boolean hasAdminPermission)
      Creates an instance of a PermissionsStatus record class.
      Parameters:
      hasUserPermission - the value for the hasUserPermission record component
      hasAdminPermission - the value for the hasAdminPermission record component
  • Method Details

    • hasAnyPermission

      public boolean hasAnyPermission()
      Checks if either the user-level or the admin-level permission is available.
      Returns:
      True if either hasUserPermission or hasAdminPermission is true.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • hasUserPermission

      public boolean hasUserPermission()
      Returns the value of the hasUserPermission record component.
      Returns:
      the value of the hasUserPermission record component
    • hasAdminPermission

      public boolean hasAdminPermission()
      Returns the value of the hasAdminPermission record component.
      Returns:
      the value of the hasAdminPermission record component