Package io.github.zhh2001.jp4.match
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 ClassesModifier and TypeInterfaceDescriptionstatic final recordExact match against a single value.static final recordLongest-prefix match:prefixLenmost significant bits ofvalue.static final recordP4Runtime "optional" match kind: present (treated as exact) or absent (skipped).static final recordRange match:low≤ field ≤high.static final recordTernary match:valuemasked bymask. -
Method Summary
-
Method Details
-
exact
-
exact
-
lpm
-
ternary
-