public final class ComposableBody extends AbstractBody
AbstractBody class which allows for the
definition of messages from individual elements of a body.
A message is constructed by creating a builder, manipulating the
configuration of the builder, and then building it into a class instance,
as in the following example:
ComposableBody body = ComposableBody.builder()
.setNamespaceDefinition("foo", "http://foo.com/bar")
.setPayloadXML("Data to send to remote server ")
.build();
Class instances can also be "rebuilt", allowing them to be used as templates
when building many similar messages:
ComposableBody body2 = body.rebuild()
.setPayloadXML("More data to send ")
.build();
This class does only minimal syntactic and semantic checking with respect
to what the generated XML will look like. It is up to the developer to
protect against the definition of malformed XML messages when building
instances of this class.
Instances of this class are immutable and thread-safe.| Modifier and Type | Class and Description |
|---|---|
static class |
ComposableBody.Builder
Class instance builder, after the builder pattern.
|
| Modifier and Type | Method and Description |
|---|---|
static ComposableBody.Builder |
builder()
Create a builder instance to build new instances of this class.
|
Map<BodyQName,String> |
getAttributes()
Get a map of all defined attribute names with their corresponding values.
|
String |
getPayloadXML()
Get the paylaod XML in String form.
|
ComposableBody.Builder |
rebuild()
If this
ComposableBody instance is a dynamic instance, uses this
ComposableBody instance as a starting point, create a builder
which can be used to create another ComposableBody instance
based on this one. |
String |
toXML()
Get an XML String representation of this message.
|
getAttribute, getAttributeNamespublic static ComposableBody.Builder builder()
public ComposableBody.Builder rebuild()
ComposableBody instance is a dynamic instance, uses this
ComposableBody instance as a starting point, create a builder
which can be used to create another ComposableBody instance
based on this one. This allows a ComposableBody instance to be
used as a template. Note that the use of the returned builder in no
way modifies or manipulates the current ComposableBody instance.ComposableBody instancespublic Map<BodyQName,String> getAttributes()
getAttributes in class AbstractBodypublic String toXML()
toXML in class AbstractBodypublic String getPayloadXML()
Copyright © 2015. All rights reserved.