Class Discriminator

Namespace
Kuestenlogik.Bowire.Semantics
Assembly
Kuestenlogik.Bowire.dll

Declaration of how a method's message-type discriminator is read off the wire. Companion to MessageType: the discriminator says "look here to find which shape this frame is," then the resolver looks up annotations keyed by that shape.

public sealed record Discriminator : IEquatable<Discriminator>
Inheritance
Discriminator
Implements
Inherited Members

Remarks

Four flavours are supported (Phase 1 stores them, later phases read them):

  • WirePath — a byte-offset expression evaluated against the raw frame before JSON decode (e.g. byte[1] for the DIS PDU type byte).
  • JsonPath — a JSONPath expression evaluated after decode (e.g. $.type for envelope-tagged MQTT / WebSocket payloads).
  • Oneof — name of a protobuf oneof group.
  • None — explicit "method is single-type" marker; every frame keys under Wildcard.

Constructors

Discriminator(string, string)

Declaration of how a method's message-type discriminator is read off the wire. Companion to MessageType: the discriminator says "look here to find which shape this frame is," then the resolver looks up annotations keyed by that shape.

public Discriminator(string Kind, string Value)

Parameters

Kind string

Which flavour the Value should be interpreted as. One of the constants in DiscriminatorKinds.

Value string

Kind-dependent payload. For WirePath it is the byte-offset expression; for JsonPath the JSONPath; for Oneof the oneof group name; for None the empty string.

Remarks

Four flavours are supported (Phase 1 stores them, later phases read them):

  • WirePath — a byte-offset expression evaluated against the raw frame before JSON decode (e.g. byte[1] for the DIS PDU type byte).
  • JsonPath — a JSONPath expression evaluated after decode (e.g. $.type for envelope-tagged MQTT / WebSocket payloads).
  • Oneof — name of a protobuf oneof group.
  • None — explicit "method is single-type" marker; every frame keys under Wildcard.

Properties

IsNone

True when this is the None marker.

public bool IsNone { get; }

Property Value

bool

Kind

Which flavour the Value should be interpreted as. One of the constants in DiscriminatorKinds.

public string Kind { get; init; }

Property Value

string

None

Singleton marker for "this method is single-type." Every frame resolves to Wildcard.

public static Discriminator None { get; }

Property Value

Discriminator

Value

Kind-dependent payload. For WirePath it is the byte-offset expression; for JsonPath the JSONPath; for Oneof the oneof group name; for None the empty string.

public string Value { get; init; }

Property Value

string

Methods

Deconstruct(out string, out string)

public void Deconstruct(out string Kind, out string Value)

Parameters

Kind string
Value string

Equals(Discriminator?)

public bool Equals(Discriminator? other)

Parameters

other Discriminator

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

Operators

operator ==(Discriminator?, Discriminator?)

public static bool operator ==(Discriminator? left, Discriminator? right)

Parameters

left Discriminator
right Discriminator

Returns

bool

operator !=(Discriminator?, Discriminator?)

public static bool operator !=(Discriminator? left, Discriminator? right)

Parameters

left Discriminator
right Discriminator

Returns

bool