Record Class UserSpecification

java.lang.Object
java.lang.Record
com.app.persistence.specification.model.UserSpecification
Record Components:
name - the name of the user to filter by (exact match, optional)
surname - the surname of the user to filter by (exact match, optional)
username - the username to filter by (exact match, optional)
email - the email to filter by (exact match, optional)
minAge - the minimum age of the user (inclusive, optional)
maxAge - the maximum age of the user (inclusive, optional)
minHolidayHours - the minimum amount of holiday hours (inclusive, optional)
maxHolidayHours - the maximum amount of holiday hours (inclusive, optional)

public record UserSpecification(String name, String surname, String username, String email, Integer minAge, Integer maxAge, Long minHolidayHours, Long maxHolidayHours) extends Record
Specification model used to filter UserEntity entities based on dynamic criteria.

This record is intended to be used in conjunction with Specification<UserEntity> to build type-safe, flexible queries in a declarative way.

  • Constructor Details

    • UserSpecification

      public UserSpecification(String name, String surname, String username, String email, Integer minAge, Integer maxAge, Long minHolidayHours, Long maxHolidayHours)
      Creates an instance of a UserSpecification record class.
      Parameters:
      name - the value for the name record component
      surname - the value for the surname record component
      username - the value for the username record component
      email - the value for the email record component
      minAge - the value for the minAge record component
      maxAge - the value for the maxAge record component
      minHolidayHours - the value for the minHolidayHours record component
      maxHolidayHours - the value for the maxHolidayHours record component
  • Method Details

    • 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 Objects::equals(Object,Object).
      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.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • surname

      public String surname()
      Returns the value of the surname record component.
      Returns:
      the value of the surname record component
    • username

      public String username()
      Returns the value of the username record component.
      Returns:
      the value of the username record component
    • email

      public String email()
      Returns the value of the email record component.
      Returns:
      the value of the email record component
    • minAge

      public Integer minAge()
      Returns the value of the minAge record component.
      Returns:
      the value of the minAge record component
    • maxAge

      public Integer maxAge()
      Returns the value of the maxAge record component.
      Returns:
      the value of the maxAge record component
    • minHolidayHours

      public Long minHolidayHours()
      Returns the value of the minHolidayHours record component.
      Returns:
      the value of the minHolidayHours record component
    • maxHolidayHours

      public Long maxHolidayHours()
      Returns the value of the maxHolidayHours record component.
      Returns:
      the value of the maxHolidayHours record component