Class ComposableBody.Builder

  • Enclosing class:
    ComposableBody

    public static final class ComposableBody.Builder
    extends java.lang.Object
    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 Detail

      • map

        private java.util.Map<BodyQName,​java.lang.String> map
      • doMapCopy

        private boolean doMapCopy
      • payloadXML

        private java.lang.String payloadXML
    • Constructor Detail

      • Builder

        private Builder()
        Prevent direct construction.
    • Method Detail

      • fromBody

        private static ComposableBody.Builder fromBody​(ComposableBody source)
        Creates a builder which is initialized to the values of the provided ComposableBody instance. This allows an existing ComposableBody to be used as a template/starting point.
        Parameters:
        source - body template
        Returns:
        builder instance
      • setPayloadXML

        public ComposableBody.Builder setPayloadXML​(java.lang.String xml)
        Set the body message's wrapped payload content. Any previous content will be replaced.
        Parameters:
        xml - payload XML content
        Returns:
        builder instance
      • setAttribute

        public ComposableBody.Builder setAttribute​(BodyQName name,
                                                   java.lang.String value)
        Set an attribute on the message body / wrapper element.
        Parameters:
        name - qualified name of the attribute
        value - value of the attribute
        Returns:
        builder instance
      • setNamespaceDefinition

        public ComposableBody.Builder setNamespaceDefinition​(java.lang.String prefix,
                                                             java.lang.String uri)
        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 define
        uri - namespace URI to associate with the prefix
        Returns:
        builder instance
      • build

        public ComposableBody build()
        Build the immutable object instance with the current configuration.
        Returns:
        composable body instance