Record Class ModernMaterialStore.SearchCriteria

java.lang.Object
java.lang.Record
com.university.bookstore.api.ModernMaterialStore.SearchCriteria
Record Components:
title - optional title search term
creator - optional creator search term
type - optional material type filter
minPrice - optional minimum price
maxPrice - optional maximum price
yearFrom - optional start year
yearTo - optional end year
Enclosing interface:
ModernMaterialStore

public static record ModernMaterialStore.SearchCriteria(Optional<String> title, Optional<String> creator, Optional<Material.MaterialType> type, Optional<Double> minPrice, Optional<Double> maxPrice, Optional<Integer> yearFrom, Optional<Integer> yearTo) extends Record
Search criteria record for complex searches.
Since:
2024-09-15
Version:
4.0
Author:
Navid Mohaghegh
  • Constructor Details

  • Method Details

    • builder

      Creates a new builder.
      Returns:
      new builder instance
    • hasAnyCriteria

      public boolean hasAnyCriteria()
      Checks if any criteria is specified.
      Returns:
      true if at least one criterion is present
    • 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.
    • title

      public Optional<String> title()
      Returns the value of the title record component.
      Returns:
      the value of the title record component
    • creator

      public Optional<String> creator()
      Returns the value of the creator record component.
      Returns:
      the value of the creator record component
    • type

      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • minPrice

      public Optional<Double> minPrice()
      Returns the value of the minPrice record component.
      Returns:
      the value of the minPrice record component
    • maxPrice

      public Optional<Double> maxPrice()
      Returns the value of the maxPrice record component.
      Returns:
      the value of the maxPrice record component
    • yearFrom

      public Optional<Integer> yearFrom()
      Returns the value of the yearFrom record component.
      Returns:
      the value of the yearFrom record component
    • yearTo

      public Optional<Integer> yearTo()
      Returns the value of the yearTo record component.
      Returns:
      the value of the yearTo record component