Class HttpResultWrapper.Builder<T,​E>

  • Enclosing class:
    HttpResultWrapper<T,​E>

    @NotThreadSafe
    public static final class HttpResultWrapper.Builder<T,​E>
    extends Object
    Builds instances of type HttpResultWrapper. 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

        public final HttpResultWrapper.Builder<T,​E> from​(AbstractHttpResultWrapper<T,​E> instance)
        Fill a builder with attribute values from the provided AbstractHttpResultWrapper instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.
        Parameters:
        instance - The instance from which to copy values
        Returns:
        this builder for use in a chained invocation
      • setOkResultMaybe

        public final HttpResultWrapper.Builder<T,​E> setOkResultMaybe​(@Nullable
                                                                           T okResultMaybe)
        Initializes the optional value okResultMaybe to okResultMaybe.
        Parameters:
        okResultMaybe - The value for okResultMaybe, null is accepted as java.util.Optional.empty()
        Returns:
        this builder for chained invocation
      • setOkResultMaybe

        public final HttpResultWrapper.Builder<T,​E> setOkResultMaybe​(Optional<? extends T> okResultMaybe)
        Initializes the optional value okResultMaybe to okResultMaybe.
        Parameters:
        okResultMaybe - The value for okResultMaybe
        Returns:
        this builder for use in a chained invocation
      • setErrResultMaybe

        public final HttpResultWrapper.Builder<T,​E> setErrResultMaybe​(@Nullable
                                                                            E errResultMaybe)
        Initializes the optional value errResultMaybe to errResultMaybe.
        Parameters:
        errResultMaybe - The value for errResultMaybe, null is accepted as java.util.Optional.empty()
        Returns:
        this builder for chained invocation
      • setErrResultMaybe

        public final HttpResultWrapper.Builder<T,​E> setErrResultMaybe​(Optional<? extends E> errResultMaybe)
        Initializes the optional value errResultMaybe to errResultMaybe.
        Parameters:
        errResultMaybe - The value for errResultMaybe
        Returns:
        this builder for use in a chained invocation
      • setHttpStatusCode

        public final HttpResultWrapper.Builder<T,​E> setHttpStatusCode​(int httpStatusCode)
        Initializes the value for the httpStatusCode attribute.

        If not set, this attribute will have a default value as returned by the initializer of httpStatusCode.

        Parameters:
        httpStatusCode - The value for httpStatusCode
        Returns:
        this builder for use in a chained invocation
      • build

        public HttpResultWrapper<T,​E> build()
        Builds a new HttpResultWrapper.
        Returns:
        An immutable instance of HttpResultWrapper
        Throws:
        com.hubspot.immutables.validation.InvalidImmutableStateException - if any required attributes are missing