Record Class ModernMaterialStore.SearchCriteria
java.lang.Object
java.lang.Record
com.university.bookstore.api.ModernMaterialStore.SearchCriteria
- Record Components:
title- optional title search termcreator- optional creator search termtype- optional material type filterminPrice- optional minimum pricemaxPrice- optional maximum priceyearFrom- optional start yearyearTo- 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 ClassesModifier and TypeClassDescriptionstatic classBuilder for SearchCriteria. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a new builder.creator()Returns the value of thecreatorrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanChecks if any criteria is specified.final inthashCode()Returns a hash code value for this object.maxPrice()Returns the value of themaxPricerecord component.minPrice()Returns the value of theminPricerecord component.title()Returns the value of thetitlerecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.yearFrom()Returns the value of theyearFromrecord component.yearTo()Returns the value of theyearTorecord component.
-
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 aSearchCriteriarecord class.- Parameters:
title- the value for thetitlerecord componentcreator- the value for thecreatorrecord componenttype- the value for thetyperecord componentminPrice- the value for theminPricerecord componentmaxPrice- the value for themaxPricerecord componentyearFrom- the value for theyearFromrecord componentyearTo- the value for theyearTorecord component
-
-
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
-
hashCode
-
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 withObjects::equals(Object,Object). -
title
-
creator
-
type
-
minPrice
-
maxPrice
-
yearFrom
-
yearTo
-