Record Class SearchHistoryEntry

java.lang.Object
java.lang.Record
ca.phon.util.SearchHistoryEntry
All Implemented Interfaces:
Serializable

public record SearchHistoryEntry(LocalDateTime date, String queryText, SearchType queryType, boolean caseSensitive, Map<String,String> parameters) extends Record implements Serializable

Represents a single search history entry with comprehensive metadata. Each entry contains the search query, type, search options, and timestamp information needed for advanced search history management.

This record is immutable to ensure thread safety and data integrity. Use the SearchHistoryEntry.Builder to create new instances or modify existing ones.

Usage example:

 SearchHistoryEntry entry = SearchHistoryEntry.builder()
         .queryText("phoneme transcription")
         .queryType("phonex")
         .caseSensitive(false)
         .parameter("target", "IPA Target")
         .parameter("group", "Word")
         .build();
 
See Also:
  • Constructor Details

    • SearchHistoryEntry

      public SearchHistoryEntry(LocalDateTime date, String queryText, SearchType queryType, boolean caseSensitive, Map<String,String> parameters)
      Compact constructor with validation and defensive copying.
  • Method Details

    • getParameter

      public String getParameter(String key)
      Gets the value of a specific parameter.
      Parameters:
      key - the parameter key
      Returns:
      the parameter value, or null if not found
    • hasParameter

      public boolean hasParameter(String key)
      Checks if a parameter exists.
      Parameters:
      key - the parameter key
      Returns:
      true if the parameter exists
    • builder

      public static SearchHistoryEntry.Builder builder()
      Creates a new builder instance.
      Returns:
      a new builder
    • toBuilder

      public SearchHistoryEntry.Builder toBuilder()
      Creates a new builder initialized with this entry's values.
      Returns:
      a new builder with this entry's values
    • equals

      public boolean equals(Object obj)
      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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      obj - the object with which to compare
      Returns:
      true if this object is the same as the obj argument; false otherwise.
    • equalsExceptDate

      public boolean equalsExceptDate(Object obj)
    • 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
    • date

      public LocalDateTime date()
      Returns the value of the date record component.
      Returns:
      the value of the date record component
    • queryText

      public String queryText()
      Returns the value of the queryText record component.
      Returns:
      the value of the queryText record component
    • queryType

      public SearchType queryType()
      Returns the value of the queryType record component.
      Returns:
      the value of the queryType record component
    • caseSensitive

      public boolean caseSensitive()
      Returns the value of the caseSensitive record component.
      Returns:
      the value of the caseSensitive record component
    • parameters

      public Map<String,String> parameters()
      Returns the value of the parameters record component.
      Returns:
      the value of the parameters record component