Struct DetectionContext
- Namespace
- Kuestenlogik.Bowire.Semantics.Detectors
- Assembly
- Kuestenlogik.Bowire.dll
Addressing context handed to every IBowireFieldDetector
invocation: identifies which (service, method, message-type)
triple this frame belongs to and carries the decoded JSON payload
rooted at the frame body.
public readonly struct DetectionContext : IEquatable<DetectionContext>
- Implements
- Inherited Members
Remarks
readonly record struct by design — value-equality is unused but the by-value semantics keep the type cheap to construct on the hot path. JsonElement is itself a struct that carries a reference to the shared JsonDocument arena, so passing the whole context by in avoids copying anything beyond a handful of references.
In Phase 2 the stream hook fills MessageType with Wildcard because plugin-side discriminator wiring isn't in place yet. Phase 3 + later phases will plumb the real discriminator value through.
Constructors
DetectionContext(string, string, string, JsonElement)
Addressing context handed to every IBowireFieldDetector
invocation: identifies which (service, method, message-type)
triple this frame belongs to and carries the decoded JSON payload
rooted at the frame body.
public DetectionContext(string ServiceId, string MethodId, string MessageType, JsonElement Frame)
Parameters
ServiceIdstringPlugin-defined service identifier — same shape as ServiceId.
MethodIdstringPlugin-defined method identifier within
ServiceId.MessageTypestringDiscriminator value, or Wildcard for single-type methods.
FrameJsonElementDecoded JSON payload rooted at the frame body. Detectors receive the whole tree so paired-field rules (
lat+lonat the same parent) can match naturally.
Remarks
readonly record struct by design — value-equality is unused but the by-value semantics keep the type cheap to construct on the hot path. JsonElement is itself a struct that carries a reference to the shared JsonDocument arena, so passing the whole context by in avoids copying anything beyond a handful of references.
In Phase 2 the stream hook fills MessageType with Wildcard because plugin-side discriminator wiring isn't in place yet. Phase 3 + later phases will plumb the real discriminator value through.
Properties
Frame
Decoded JSON payload rooted at the frame body. Detectors receive
the whole tree so paired-field rules
(lat+lon at the same parent) can match naturally.
public JsonElement Frame { get; init; }
Property Value
MessageType
Discriminator value, or Wildcard for single-type methods.
public string MessageType { get; init; }
Property Value
MethodId
Plugin-defined method identifier within
ServiceId.
public string MethodId { get; init; }
Property Value
ServiceId
Plugin-defined service identifier — same shape as ServiceId.
public string ServiceId { get; init; }
Property Value
Methods
Deconstruct(out string, out string, out string, out JsonElement)
public void Deconstruct(out string ServiceId, out string MethodId, out string MessageType, out JsonElement Frame)
Parameters
ServiceIdstringMethodIdstringMessageTypestringFrameJsonElement
Equals(DetectionContext)
public bool Equals(DetectionContext other)
Parameters
otherDetectionContext
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(DetectionContext, DetectionContext)
public static bool operator ==(DetectionContext left, DetectionContext right)
Parameters
leftDetectionContextrightDetectionContext
Returns
operator !=(DetectionContext, DetectionContext)
public static bool operator !=(DetectionContext left, DetectionContext right)
Parameters
leftDetectionContextrightDetectionContext