Class HttpResultWrapper<T,​E>


  • @ParametersAreNonnullByDefault
    @Generated("org.immutables.processor.ProxyProcessor")
    @Immutable
    public final class HttpResultWrapper<T,​E>
    extends AbstractHttpResultWrapper<T,​E>
    Immutable implementation of AbstractHttpResultWrapper.

    Use the builder to create immutable instances: HttpResultWrapper.builder().

    • Method Detail

      • withOkResultMaybe

        public final HttpResultWrapper<T,​E> withOkResultMaybe​(@Nullable
                                                                    T value)
        Copy the current immutable object by setting a present value for the optional okResultMaybe attribute.
        Parameters:
        value - The value for okResultMaybe, null is accepted as java.util.Optional.empty()
        Returns:
        A modified copy of this object
      • withOkResultMaybe

        public final HttpResultWrapper<T,​E> withOkResultMaybe​(Optional<? extends T> optional)
        Copy the current immutable object by setting an optional value for the okResultMaybe attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for okResultMaybe
        Returns:
        A modified copy of this object
      • withErrResultMaybe

        public final HttpResultWrapper<T,​E> withErrResultMaybe​(@Nullable
                                                                     E value)
        Copy the current immutable object by setting a present value for the optional errResultMaybe attribute.
        Parameters:
        value - The value for errResultMaybe, null is accepted as java.util.Optional.empty()
        Returns:
        A modified copy of this object
      • withErrResultMaybe

        public final HttpResultWrapper<T,​E> withErrResultMaybe​(Optional<? extends E> optional)
        Copy the current immutable object by setting an optional value for the errResultMaybe attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for errResultMaybe
        Returns:
        A modified copy of this object
      • withHttpStatusCode

        public final HttpResultWrapper<T,​E> withHttpStatusCode​(int value)
        Copy the current immutable object by setting a value for the httpStatusCode attribute. A value equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for httpStatusCode
        Returns:
        A modified copy of the this object
      • equals

        public boolean equals​(@Nullable
                              Object another)
        This instance is equal to all instances of HttpResultWrapper that have equal attribute values.
        Overrides:
        equals in class Object
        Returns:
        true if this is equal to another instance
      • hashCode

        public int hashCode()
        Computes a hash code from attributes: okResultMaybe, errResultMaybe, httpStatusCode.
        Overrides:
        hashCode in class Object
        Returns:
        hashCode value
      • toString

        public String toString()
        Prints the immutable value HttpResultWrapper with attribute values.
        Overrides:
        toString in class Object
        Returns:
        A string representation of the value
      • copyOf

        public static <T,​E> HttpResultWrapper<T,​E> copyOf​(AbstractHttpResultWrapper<T,​E> instance)
        Creates an immutable copy of a AbstractHttpResultWrapper value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
        Type Parameters:
        T - generic parameter T
        E - generic parameter E
        Parameters:
        instance - The instance to copy
        Returns:
        A copied immutable HttpResultWrapper instance
      • builder

        public static <T,​E> HttpResultWrapper.Builder<T,​E> builder()
        Creates a builder for HttpResultWrapper.
         HttpResultWrapper.&lt;T, E&gt;builder()
            .setOkResultMaybe(T) // optional okResultMaybe
            .setErrResultMaybe(E) // optional errResultMaybe
            .setHttpStatusCode(int) // optional httpStatusCode
            .build();
         
        Type Parameters:
        T - generic parameter T
        E - generic parameter E
        Returns:
        A new HttpResultWrapper builder