Interface ReferenceBody.TextBody
- All Superinterfaces:
ReferenceBody
- All Known Implementing Classes:
OpcReferenceBody, ReferenceBody.TextBody.RenderedText
- Enclosing interface:
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:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordConcreteReferenceBody.TextBodythat carries only its rendered wire text.Nested classes/interfaces inherited from interface ReferenceBody
ReferenceBody.TextBody -
Method Summary
Modifier and TypeMethodDescriptionstatic ReferenceBody.TextBodystatic ReferenceBody.TextBodyofFields(Consumer<FieldsBuilder> spec) Assembles a one-offKey: valuebody with a scopedFieldsBuilder.rendered()
-
Method Details
-
rendered
String rendered()- Returns:
- the exact text the wire format embeds between
<reference>tags.
-
of
- 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-offKey: valuebody with a scopedFieldsBuilder.- 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:
-