Class StringFilter

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class StringFilter extends Filter

Determines whether to include items by comparing strings to a fixed search term.

The strings are obtained from the items by evaluating an expression set with setExpression(Expression), and they are compared against a search term set with setSearch(String).

GtkStringFilter has several different modes of comparison - it can match the whole string, just a prefix, or any substring. Use setMatchMode(StringFilterMatchMode) choose a mode.

It is also possible to make case-insensitive comparisons, with setIgnoreCase(boolean).

  • Constructor Details

    • StringFilter

      public StringFilter(MemorySegment address)
      Create a StringFilter instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • StringFilter

      public StringFilter(@Nullable Expression expression)

      Creates a new string filter.

      You will want to set up the filter by providing a string to search for and by providing a property to look up on the item.

      Parameters:
      expression - the expression to evaluate
    • StringFilter

      public StringFilter()
      Create a new StringFilter.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the StringFilter class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected StringFilter asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Filter
      Returns:
      the instance as if it were its parent type
    • getExpression

      public @Nullable Expression getExpression()
      Gets the expression that the string filter uses to obtain strings from items.
      Returns:
      the expression
    • getIgnoreCase

      public boolean getIgnoreCase()
      Returns whether the filter ignores case differences.
      Returns:
      true if the filter ignores case
    • getMatchMode

      public StringFilterMatchMode getMatchMode()
      Returns the match mode that the filter is using.
      Returns:
      the match mode of the filter
    • getSearch

      public @Nullable String getSearch()
      Gets the search term.
      Returns:
      the search term
    • setExpression

      public void setExpression(@Nullable Expression expression)

      Sets the expression that the string filter uses to obtain strings from items.

      The expression must have a value type of G_TYPE_STRING.

      Parameters:
      expression - the expression
    • setIgnoreCase

      public void setIgnoreCase(boolean ignoreCase)
      Sets whether the filter ignores case differences.
      Parameters:
      ignoreCase - true to ignore case
    • setMatchMode

      public void setMatchMode(StringFilterMatchMode mode)
      Sets the match mode for the filter.
      Parameters:
      mode - the new match mode
    • setSearch

      public void setSearch(@Nullable String search)
      Sets the string to search for.
      Parameters:
      search - the string to search for
    • toString

      public String toString()
      Returns a string representation of the object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the object
    • builder

      public static StringFilter.Builder<? extends StringFilter.Builder> builder()
      A StringFilter.Builder object constructs a StringFilter with the specified properties. Use the various set...() methods to set properties, and finish construction with StringFilter.Builder.build().
      Returns:
      the builder object