Interface Match

All Known Implementing Classes:
Match.Exact, Match.Lpm, Match.Optional, Match.Range, Match.Ternary

public sealed interface Match permits Match.Exact, Match.Lpm, Match.Ternary, Match.Range, Match.Optional
One value in a TableEntry match key. Sealed; subtypes correspond to the P4Runtime FieldMatch oneof variants. Use switch on a returned Match for compile-time exhaustive handling.

All five variants are immutable records, safe to share across threads. The byte[]-bearing variants (Match.Exact, Match.Lpm, Match.Ternary, Match.Range, Match.Optional) wrap their Bytes fields, which defensively copy on construction; mutating an input array does not affect a constructed Match value.

Since:
0.1.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    Exact match against a single value.
    static final record 
    Longest-prefix match: prefixLen most significant bits of value.
    static final record 
    P4Runtime "optional" match kind: present (treated as exact) or absent (skipped).
    static final record 
    Range match: low ≤ field ≤ high.
    static final record 
    Ternary match: value masked by mask.
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    static Match
    exact(int value)
     
    static Match
    exact(Bytes value)
     
    static Match
    lpm(String cidr)
     
    static Match
    ternary(int value, int mask)
     
  • Method Details

    • exact

      static Match exact(Bytes value)
    • exact

      static Match exact(int value)
    • lpm

      static Match lpm(String cidr)
    • ternary

      static Match ternary(int value, int mask)