Interface ReferenceBody.TextBody

All Superinterfaces:
ReferenceBody
All Known Implementing Classes:
OpcReferenceBody, ReferenceBody.TextBody.RenderedText
Enclosing interface:
ReferenceBody

public static non-sealed interface ReferenceBody.TextBody extends ReferenceBody
A text-modality body — the wire form is the exact text embedded between <reference> tags.

non-sealed so a typed provider can implement it with a record: keep the domain fields as real-typed components and derive rendered() from them on each call — so there is no stored wire string to keep in sync.

record OpcBody(String server, String nodeId) implements ReferenceBody.TextBody {
  @Override
  public String rendered() {
    return FieldsBuilder.buildFields(f -> f.put("OpcServer", server).put("NodeId", nodeId));
  }
}
See Also:
  • Method Details

    • rendered

      String rendered()
      Returns:
      the exact text the wire format embeds between <reference> tags.
    • of

      static ReferenceBody.TextBody of(String string)
      Returns:
      a text body carrying exactly string — for free-form prose payloads or callers that have already assembled their own text.
    • ofFields

      Assembles a one-off Key: value body with a scoped FieldsBuilder.
      Parameters:
      spec - populates the builder, e.g. f -> f.put("Path", path).put("Kind", kind).
      Returns:
      a one-off text body wrapping the rendered fields — the terminal for providers whose data is never read back.
      See Also: