Package com.hubspot.algebra
Class HttpResultWrapper<T,E>
- java.lang.Object
-
- com.hubspot.algebra.AbstractHttpResultWrapper<T,E>
-
- com.hubspot.algebra.HttpResultWrapper<T,E>
-
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class HttpResultWrapper<T,E> extends AbstractHttpResultWrapper<T,E>
Immutable implementation ofAbstractHttpResultWrapper.Use the builder to create immutable instances:
HttpResultWrapper.builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHttpResultWrapper.Builder<T,E>Builds instances of typeHttpResultWrapper.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T,E>
HttpResultWrapper.Builder<T,E>builder()Creates a builder forHttpResultWrapper.static <T,E>
HttpResultWrapper<T,E>copyOf(AbstractHttpResultWrapper<T,E> instance)Creates an immutable copy of aAbstractHttpResultWrappervalue.booleanequals(Object another)This instance is equal to all instances ofHttpResultWrapperthat have equal attribute values.Optional<E>getErrResultMaybe()intgetHttpStatusCode()Optional<T>getOkResultMaybe()inthashCode()Computes a hash code from attributes:okResultMaybe,errResultMaybe,httpStatusCode.StringtoString()Prints the immutable valueHttpResultWrapperwith attribute values.HttpResultWrapper<T,E>withErrResultMaybe(E value)Copy the current immutable object by setting a present value for the optionalerrResultMaybeattribute.HttpResultWrapper<T,E>withErrResultMaybe(Optional<? extends E> optional)Copy the current immutable object by setting an optional value for theerrResultMaybeattribute.HttpResultWrapper<T,E>withHttpStatusCode(int value)Copy the current immutable object by setting a value for thehttpStatusCodeattribute.HttpResultWrapper<T,E>withOkResultMaybe(Optional<? extends T> optional)Copy the current immutable object by setting an optional value for theokResultMaybeattribute.HttpResultWrapper<T,E>withOkResultMaybe(T value)Copy the current immutable object by setting a present value for the optionalokResultMaybeattribute.-
Methods inherited from class com.hubspot.algebra.AbstractHttpResultWrapper
err, ok, unwrap
-
-
-
-
Method Detail
-
getOkResultMaybe
public Optional<T> getOkResultMaybe()
- Specified by:
getOkResultMaybein classAbstractHttpResultWrapper<T,E>- Returns:
- The value of the
okResultMaybeattribute
-
getErrResultMaybe
public Optional<E> getErrResultMaybe()
- Specified by:
getErrResultMaybein classAbstractHttpResultWrapper<T,E>- Returns:
- The value of the
errResultMaybeattribute
-
getHttpStatusCode
public int getHttpStatusCode()
- Overrides:
getHttpStatusCodein classAbstractHttpResultWrapper<T,E>- Returns:
- The value of the
httpStatusCodeattribute
-
withOkResultMaybe
public final HttpResultWrapper<T,E> withOkResultMaybe(@Nullable T value)
Copy the current immutable object by setting a present value for the optionalokResultMaybeattribute.- Parameters:
value- The value for okResultMaybe,nullis accepted asjava.util.Optional.empty()- Returns:
- A modified copy of
thisobject
-
withOkResultMaybe
public final HttpResultWrapper<T,E> withOkResultMaybe(Optional<? extends T> optional)
Copy the current immutable object by setting an optional value for theokResultMaybeattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for okResultMaybe- Returns:
- A modified copy of
thisobject
-
withErrResultMaybe
public final HttpResultWrapper<T,E> withErrResultMaybe(@Nullable E value)
Copy the current immutable object by setting a present value for the optionalerrResultMaybeattribute.- Parameters:
value- The value for errResultMaybe,nullis accepted asjava.util.Optional.empty()- Returns:
- A modified copy of
thisobject
-
withErrResultMaybe
public final HttpResultWrapper<T,E> withErrResultMaybe(Optional<? extends E> optional)
Copy the current immutable object by setting an optional value for theerrResultMaybeattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for errResultMaybe- Returns:
- A modified copy of
thisobject
-
withHttpStatusCode
public final HttpResultWrapper<T,E> withHttpStatusCode(int value)
Copy the current immutable object by setting a value for thehttpStatusCodeattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for httpStatusCode- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofHttpResultWrapperthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:okResultMaybe,errResultMaybe,httpStatusCode.
-
toString
public String toString()
Prints the immutable valueHttpResultWrapperwith attribute values.
-
copyOf
public static <T,E> HttpResultWrapper<T,E> copyOf(AbstractHttpResultWrapper<T,E> instance)
Creates an immutable copy of aAbstractHttpResultWrappervalue. 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 TE- 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 forHttpResultWrapper.HttpResultWrapper.<T, E>builder() .setOkResultMaybe(T) // optionalokResultMaybe.setErrResultMaybe(E) // optionalerrResultMaybe.setHttpStatusCode(int) // optionalhttpStatusCode.build();- Type Parameters:
T- generic parameter TE- generic parameter E- Returns:
- A new HttpResultWrapper builder
-
-