java.lang.Object
java.lang.Record
nl.datasteel.crudcraft.codegen.descriptor.field.part.Security
Record Components:
defined - whether a FieldSecurity annotation is present
readRoles - roles allowed to read the field
writeRoles - roles allowed to write the field

public record Security(boolean defined, String[] readRoles, String[] writeRoles) extends Record
Field level security configuration.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Security(boolean defined, String[] readRoles, String[] writeRoles)
    Immutable constructor for Security.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns the value of the defined record component.
    boolean
    Checks if the current Security object is equal to another object.
    Returns the roles allowed to read the field.
    Returns the roles allowed to write the field.
    boolean
    Indicates whether any field security is configured.
    int
    Computes the hash code for the Security object based on read and write roles.
    Safe, defensive accessor for read roles.
    Returns a string representation of the Security object.
    Safe, defensive accessor for write roles.

    Methods inherited from class java.lang.Object

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

    • Security

      public Security(boolean defined, String[] readRoles, String[] writeRoles)
      Immutable constructor for Security. Initializes read and write roles, ensuring they are not null.
      Parameters:
      readRoles - roles allowed to read the field
      writeRoles - roles allowed to write the field
  • Method Details

    • readRoles

      public String[] readRoles()
      Safe, defensive accessor for read roles.
    • getReadRoles

      public String[] getReadRoles()
      Returns the roles allowed to read the field.
    • writeRoles

      public String[] writeRoles()
      Safe, defensive accessor for write roles.
    • getWriteRoles

      public String[] getWriteRoles()
      Returns the roles allowed to write the field.
    • hasFieldSecurity

      public boolean hasFieldSecurity()
      Indicates whether any field security is configured.
    • equals

      public boolean equals(Object o)
      Checks if the current Security object is equal to another object. Two Security objects are considered equal if they have the same read and write roles.
      Specified by:
      equals in class Record
      Parameters:
      o - the object to compare with
      Returns:
      true if both objects are equal, false otherwise
    • hashCode

      public int hashCode()
      Computes the hash code for the Security object based on read and write roles.
      Specified by:
      hashCode in class Record
      Returns:
      the hash code value
    • toString

      public String toString()
      Returns a string representation of the Security object.
      Specified by:
      toString in class Record
      Returns:
      a string describing the security configuration
    • defined

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