# 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

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `ModernMaterialStore.SearchCriteria.Builder`
  Builder for SearchCriteria.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SearchCriteria(Optional<String> title, Optional<String> creator, Optional<Material.MaterialType> type, Optional<Double> minPrice, Optional<Double> maxPrice, Optional<Integer> yearFrom, Optional<Integer> yearTo)`
  Creates an instance of a `SearchCriteria` record class.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static ModernMaterialStore.SearchCriteria.Builder`
  `builder()`
  Creates a new builder.
  `Optional<String>`
  `creator()`
  Returns the value of the `creator` record component.
  `final boolean`
  `equals(Object o)`
  Indicates whether some other object is "equal to" this one.
  `boolean`
  `hasAnyCriteria()`
  Checks if any criteria is specified.
  `final int`
  `hashCode()`
  Returns a hash code value for this object.
  `Optional<Double>`
  `maxPrice()`
  Returns the value of the `maxPrice` record component.
  `Optional<Double>`
  `minPrice()`
  Returns the value of the `minPrice` record component.
  `Optional<String>`
  `title()`
  Returns the value of the `title` record component.
  `final String`
  `toString()`
  Returns a string representation of this record class.
  `Optional<Material.MaterialType>`
  `type()`
  Returns the value of the `type` record component.
  `Optional<Integer>`
  `yearFrom()`
  Returns the value of the `yearFrom` record component.
  `Optional<Integer>`
  `yearTo()`
  Returns the value of the `yearTo` record component.

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### SearchCriteria

    public SearchCriteria(Optional<String> title, Optional<String> creator, Optional<Material.MaterialType> type, Optional<Double> minPrice, Optional<Double> maxPrice, Optional<Integer> yearFrom, Optional<Integer> yearTo)
    Creates an instance of a `SearchCriteria` record class.
    Parameters:
      `title` - the value for the `title` record component
      `creator` - the value for the `creator` record component
      `type` - the value for the `type` record component
      `minPrice` - the value for the `minPrice` record component
      `maxPrice` - the value for the `maxPrice` record component
      `yearFrom` - the value for the `yearFrom` record component
      `yearTo` - the value for the `yearTo` record component

- ## Method Details

  - ### builder

    public static ModernMaterialStore.SearchCriteria.Builder 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

    public Optional<Material.MaterialType> 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