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
ConstructorsConstructorDescriptionPermissionsStatus(boolean hasUserPermission, boolean hasAdminPermission) Creates an instance of aPermissionsStatusrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of thehasAdminPermissionrecord component.booleanChecks if either the user-level or the admin-level permission is available.final inthashCode()Returns a hash code value for this object.booleanReturns the value of thehasUserPermissionrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PermissionsStatus
public PermissionsStatus(boolean hasUserPermission, boolean hasAdminPermission) Creates an instance of aPermissionsStatusrecord class.- Parameters:
hasUserPermission- the value for thehasUserPermissionrecord componenthasAdminPermission- the value for thehasAdminPermissionrecord component
-
-
Method Details
-
hasAnyPermission
public boolean hasAnyPermission()Checks if either the user-level or the admin-level permission is available.- Returns:
- True if either
hasUserPermissionorhasAdminPermissionis true.
-
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. -
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. -
equals
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 '=='. -
hasUserPermission
public boolean hasUserPermission()Returns the value of thehasUserPermissionrecord component.- Returns:
- the value of the
hasUserPermissionrecord component
-
hasAdminPermission
public boolean hasAdminPermission()Returns the value of thehasAdminPermissionrecord component.- Returns:
- the value of the
hasAdminPermissionrecord component
-