Class ImmutableTxResponse.Builder

  • Enclosing class:
    ImmutableTxResponse

    @NotThreadSafe
    public static final class ImmutableTxResponse.Builder
    extends java.lang.Object
    Builds instances of type ImmutableTxResponse. Initialize attributes and then invoke the build() method to create an immutable instance.

    Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

    • Method Detail

      • from

        @CanIgnoreReturnValue
        public final ImmutableTxResponse.Builder from​(TxResponse instance)
        Fill a builder with attribute values from the provided TxResponse instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.
        Parameters:
        instance - The instance from which to copy values
        Returns:
        this builder for use in a chained invocation
      • addResults

        @CanIgnoreReturnValue
        public final ImmutableTxResponse.Builder addResults​(java.util.Map<java.lang.String,​Value> element)
        Adds one element to results list.
        Parameters:
        element - A results element
        Returns:
        this builder for use in a chained invocation
      • addResults

        @CanIgnoreReturnValue
        @SafeVarargs
        public final ImmutableTxResponse.Builder addResults​(java.util.Map<java.lang.String,​Value>... elements)
        Adds elements to results list.
        Parameters:
        elements - An array of results elements
        Returns:
        this builder for use in a chained invocation
      • results

        @CanIgnoreReturnValue
        public final ImmutableTxResponse.Builder results​(java.lang.Iterable<? extends java.util.Map<java.lang.String,​Value>> elements)
        Sets or replaces all elements for results list.
        Parameters:
        elements - An iterable of results elements
        Returns:
        this builder for use in a chained invocation
      • addAllResults

        @CanIgnoreReturnValue
        public final ImmutableTxResponse.Builder addAllResults​(java.lang.Iterable<? extends java.util.Map<java.lang.String,​Value>> elements)
        Adds elements to results list.
        Parameters:
        elements - An iterable of results elements
        Returns:
        this builder for use in a chained invocation
      • addErrors

        @CanIgnoreReturnValue
        public final ImmutableTxResponse.Builder addErrors​(TxError element)
        Adds one element to errors list.
        Parameters:
        element - A errors element
        Returns:
        this builder for use in a chained invocation
      • addErrors

        @CanIgnoreReturnValue
        public final ImmutableTxResponse.Builder addErrors​(TxError... elements)
        Adds elements to errors list.
        Parameters:
        elements - An array of errors elements
        Returns:
        this builder for use in a chained invocation
      • errors

        @CanIgnoreReturnValue
        public final ImmutableTxResponse.Builder errors​(java.lang.Iterable<? extends TxError> elements)
        Sets or replaces all elements for errors list.
        Parameters:
        elements - An iterable of errors elements
        Returns:
        this builder for use in a chained invocation
      • addAllErrors

        @CanIgnoreReturnValue
        public final ImmutableTxResponse.Builder addAllErrors​(java.lang.Iterable<? extends TxError> elements)
        Adds elements to errors list.
        Parameters:
        elements - An iterable of errors elements
        Returns:
        this builder for use in a chained invocation
      • build

        public ImmutableTxResponse build()
        Builds a new ImmutableTxResponse.
        Returns:
        An immutable instance of TxResponse
        Throws:
        java.lang.IllegalStateException - if any required attributes are missing