Package org.igniterealtime.jbosh
Class ComposableBody.Builder
java.lang.Object
org.igniterealtime.jbosh.ComposableBody.Builder
- Enclosing class:
ComposableBody
Class instance builder, after the builder pattern. This allows each
message instance to be immutable while providing flexibility when
building new messages.
Instances of this class are not thread-safe.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build the immutable object instance with the current configuration.private static ComposableBody.Builder
fromBody
(ComposableBody source) Creates a builder which is initialized to the values of the providedComposableBody
instance.setAttribute
(BodyQName name, String value) Set an attribute on the message body / wrapper element.setNamespaceDefinition
(String prefix, String uri) Convenience method to set a namespace definition.setPayloadXML
(String xml) Set the body message's wrapped payload content.
-
Field Details
-
map
-
doMapCopy
private boolean doMapCopy -
payloadXML
-
-
Constructor Details
-
Builder
private Builder()Prevent direct construction.
-
-
Method Details
-
fromBody
Creates a builder which is initialized to the values of the providedComposableBody
instance. This allows an existingComposableBody
to be used as a template/starting point.- Parameters:
source
- body template- Returns:
- builder instance
-
setPayloadXML
Set the body message's wrapped payload content. Any previous content will be replaced.- Parameters:
xml
- payload XML content- Returns:
- builder instance
-
setAttribute
Set an attribute on the message body / wrapper element.- Parameters:
name
- qualified name of the attributevalue
- value of the attribute- Returns:
- builder instance
-
setNamespaceDefinition
Convenience method to set a namespace definition. This would result in a namespace prefix definition similar to:<body xmlns:prefix="uri"/>
- Parameters:
prefix
- prefix to defineuri
- namespace URI to associate with the prefix- Returns:
- builder instance
-
build
Build the immutable object instance with the current configuration.- Returns:
- composable body instance
-