Class StringSorter

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class StringSorter extends Sorter

Sorts items by comparing strings.

To obtain the strings to compare, this sorter evaluates a Expression.

It does the comparison in a linguistically correct way using the current locale by normalizing Unicode strings and possibly case-folding them before performing the comparison.

  • Constructor Details

    • StringSorter

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

      public StringSorter(@Nullable Expression expression)

      Creates a new string sorter that compares items using the given expression.

      Unless an expression is set on it, this sorter will always compare items as invalid.

      Parameters:
      expression - The expression to evaluate
    • StringSorter

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

    • getType

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

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

      protected StringSorter 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 Sorter
      Returns:
      the instance as if it were its parent type
    • getCollation

      public Collation getCollation()
      Gets which collation method the sorter uses.
      Returns:
      The collation method
      Since:
      4.10
    • getExpression

      public @Nullable Expression getExpression()
      Gets the expression that is evaluated to obtain strings from items.
      Returns:
      a GtkExpression
    • getIgnoreCase

      public boolean getIgnoreCase()
      Gets whether the sorter ignores case differences.
      Returns:
      true if this StringSorter is ignoring case differences
    • setCollation

      public void setCollation(Collation collation)
      Sets the collation method to use for sorting.
      Parameters:
      collation - the collation method
      Since:
      4.10
    • setExpression

      public void setExpression(@Nullable Expression expression)

      Sets the expression that is evaluated to obtain strings from items.

      The expression must have the type G_TYPE_STRING.

      Parameters:
      expression - a GtkExpression
    • setIgnoreCase

      public void setIgnoreCase(boolean ignoreCase)
      Sets whether the sorter will ignore case differences.
      Parameters:
      ignoreCase - true to ignore case differences
    • builder

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