Record Class QueryItem

java.lang.Object
java.lang.Record
io.umadb.client.QueryItem
Record Components:
types - a non-null list of event types; may be empty
tags - a non-null list of tags; may be empty

public record QueryItem(List<String> types, List<String> tags) extends Record
Defines a single criterion for matching events.

A QueryItem matches an event if:

  • at least one of its types matches the event type, or types is empty; and
  • all of its tags match one of the event tags, or tags is empty.

Semantics:

  • types represents a logical OR across event types
  • tags represents a logical AND across event tags

QueryItems are combined in a Query to define which events should be selected.

  • Constructor Details

  • Method Details

    • matchAll

      public static QueryItem matchAll()
      Creates a QueryItem that matches all events.
      Returns:
      a QueryItem with no type or tag constraints
    • ofTypes

      public static QueryItem ofTypes(List<String> types)
      Creates a QueryItem that matches events of the given types.
      Parameters:
      types - the event types to match (logical OR)
      Returns:
      a QueryItem with the given type constraints
      Throws:
      IllegalArgumentException - if types is null
    • ofTags

      public static QueryItem ofTags(List<String> tags)
      Creates a QueryItem that matches events containing all the given tags.
      Parameters:
      tags - the tags to match (logical AND)
      Returns:
      a QueryItem with the given tag constraints
      Throws:
      IllegalArgumentException - if tags is null
    • of

      public static QueryItem of(List<String> types, List<String> tags)
      Creates a QueryItem that matches events that have any of the given types and containing all the given tags.
      Parameters:
      types - the event types to match (logical OR)
      tags - the tags to match (logical AND)
      Returns:
      a QueryItem with both type and tag constraints
      Throws:
      IllegalArgumentException - if types or tags is null
    • 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.
    • types

      public List<String> types()
      Returns the value of the types record component.
      Returns:
      the value of the types record component
    • tags

      public List<String> tags()
      Returns the value of the tags record component.
      Returns:
      the value of the tags record component