Interface SerializablePredicate


public sealed interface SerializablePredicate
Serializable predicate evaluated by LoomCache servers for filtered scans, entry-listener filters, and continuous-query cache seeding.

This is not a Java functional interface: implementations must provide both local test(String, String) behavior and a bounded serialized representation. Supported callers should use the built-in encodings produced by the factory methods below.

Support boundary: the production-supported application surface is the static factory methods on this interface plus test(String, String) for local evaluation. The nested implementation types, byte-kind constants, and serialization hooks are hidden support for the client/server protocol. Applications should not persist, parse, or construct the predicate byte encoding directly.

  • Method Details

    • all

      static SerializablePredicate all()
      Returns a predicate that matches every entry.
      Returns:
      predicate that matches all entries
    • keyEquals

      static SerializablePredicate keyEquals(String value)
      Returns a predicate that matches entries whose key equals value.
      Parameters:
      value - key value to match
      Returns:
      predicate that matches entries with the exact key
      Throws:
      NullPointerException - if value is null
    • valueEquals

      static SerializablePredicate valueEquals(String value)
      Returns a predicate that matches entries whose value equals value.
      Parameters:
      value - entry value to match
      Returns:
      predicate that matches entries with the exact value
      Throws:
      NullPointerException - if value is null
    • keyStartsWith

      static SerializablePredicate keyStartsWith(String prefix)
      Returns a predicate that matches entries whose key starts with prefix.
      Parameters:
      prefix - non-empty key prefix to match
      Returns:
      predicate that matches keys starting with prefix
      Throws:
      NullPointerException - if prefix is null
      IllegalArgumentException - if prefix is empty
    • valueContains

      static SerializablePredicate valueContains(String substring)
      Returns a predicate that matches values containing substring.

      Values longer than 64K UTF-16 code units are treated as non-matches to keep server-side scan work bounded.

      Parameters:
      substring - non-empty substring to match
      Returns:
      predicate that matches values containing substring
      Throws:
      NullPointerException - if substring is null
      IllegalArgumentException - if substring is empty
    • test

      boolean test(String key, @Nullable String value)
      Evaluates this predicate locally against a key/value pair using the same semantics as the server-supported predicate family.
      Parameters:
      key - non-null entry key
      value - nullable entry value
      Returns:
      true when the entry matches