Record Class JournalFilter

java.lang.Object
java.lang.Record
mekhq.campaign.roleplay.JournalFilter
Record Components:
text - text the entry must contain, ignoring case and formatting
from - the earliest date to include
to - the latest date to include
types - the types of entry to include; empty includes every type
thread - the id of a plot thread the entry must be tagged with
character - the id of an Oracle character the entry must be tagged with

public record JournalFilter(String text, LocalDate from, LocalDate to, Set<JournalEntryType> types, UUID thread, UUID character) extends Record
Criteria for narrowing the journal. Every criterion is optional: a null (or blank search text) matches everything.
  • Field Details

    • ALL

      public static final JournalFilter ALL
      A filter that matches every entry.
  • Constructor Details

    • JournalFilter

      public JournalFilter(@Nullable String text, @Nullable LocalDate from, @Nullable LocalDate to, Set<JournalEntryType> types, @Nullable UUID thread, @Nullable UUID character)
      Creates an instance of a JournalFilter record class.
      Parameters:
      text - the value for the text record component
      from - the value for the from record component
      to - the value for the to record component
      types - the value for the types record component
      thread - the value for the thread record component
      character - the value for the character record component
  • Method Details

    • matches

      public boolean matches(JournalEntry entry)
      Parameters:
      entry - a journal entry
      Returns:
      true if the entry meets every criterion
    • isActive

      public boolean isActive()
      Returns:
      true if this filter narrows anything
    • withText

      public JournalFilter withText(@Nullable String newText)
      Parameters:
      newText - the search text
      Returns:
      a copy of this filter with different search text
    • 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.
    • text

      @Nullable public String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • from

      @Nullable public LocalDate from()
      Returns the value of the from record component.
      Returns:
      the value of the from record component
    • to

      @Nullable public LocalDate to()
      Returns the value of the to record component.
      Returns:
      the value of the to record component
    • types

      public Set<JournalEntryType> types()
      Returns the value of the types record component.
      Returns:
      the value of the types record component
    • thread

      @Nullable public UUID thread()
      Returns the value of the thread record component.
      Returns:
      the value of the thread record component
    • character

      @Nullable public UUID character()
      Returns the value of the character record component.
      Returns:
      the value of the character record component