Class SearchHistoryEntry.Builder
java.lang.Object
ca.phon.util.SearchHistoryEntry.Builder
- Enclosing class:
SearchHistoryEntry
Builder class for creating
SearchHistoryEntry instances.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the search history entry.caseSensitive(boolean caseSensitive) Sets whether the search is case sensitive.Clears all parameters.date(LocalDateTime date) Sets the search date.Adds a single parameter.parameters(Map<String, String> parameters) Adds multiple parameters from a map.Sets the query text.queryType(SearchType queryType) Sets the query type.removeParameter(String key) Removes a parameter.
-
Method Details
-
date
Sets the search date. If not specified, the current date/time will be used.- Parameters:
date- the search date- Returns:
- this builder
-
queryText
Sets the query text.- Parameters:
queryText- the query text (required, cannot be null or empty)- Returns:
- this builder
- Throws:
IllegalArgumentException- if queryText is null or empty
-
queryType
Sets the query type.- Parameters:
queryType- the query type (required, cannot be null or empty)- Returns:
- this builder
- Throws:
IllegalArgumentException- if queryType is null or empty
-
caseSensitive
Sets whether the search is case sensitive.- Parameters:
caseSensitive- true for case sensitive search- Returns:
- this builder
-
parameter
Adds a single parameter.- Parameters:
key- the parameter key (cannot be null)value- the parameter value (cannot be null)- Returns:
- this builder
- Throws:
IllegalArgumentException- if key or value is null
-
parameters
Adds multiple parameters from a map.- Parameters:
parameters- the parameters to add (cannot be null)- Returns:
- this builder
- Throws:
IllegalArgumentException- if parameters is null or contains null keys/values
-
removeParameter
Removes a parameter.- Parameters:
key- the parameter key to remove- Returns:
- this builder
-
clearParameters
-
build
Builds the search history entry.- Returns:
- a new SearchHistoryEntry instance
- Throws:
IllegalStateException- if required fields are not set
-