Package com.hubspot.algebra
Class HttpResultWrapper.Builder<T,E>
- java.lang.Object
-
- com.hubspot.algebra.HttpResultWrapper.Builder<T,E>
-
- Enclosing class:
- HttpResultWrapper<T,E>
@NotThreadSafe public static final class HttpResultWrapper.Builder<T,E> extends Object
Builds instances of typeHttpResultWrapper. Initialize attributes and then invoke thebuild()method to create an immutable instance.Builderis not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpResultWrapper<T,E>build()Builds a newHttpResultWrapper.HttpResultWrapper.Builder<T,E>from(AbstractHttpResultWrapper<T,E> instance)Fill a builder with attribute values from the providedAbstractHttpResultWrapperinstance.HttpResultWrapper.Builder<T,E>setErrResultMaybe(E errResultMaybe)Initializes the optional valueerrResultMaybeto errResultMaybe.HttpResultWrapper.Builder<T,E>setErrResultMaybe(Optional<? extends E> errResultMaybe)Initializes the optional valueerrResultMaybeto errResultMaybe.HttpResultWrapper.Builder<T,E>setHttpStatusCode(int httpStatusCode)Initializes the value for thehttpStatusCodeattribute.HttpResultWrapper.Builder<T,E>setOkResultMaybe(Optional<? extends T> okResultMaybe)Initializes the optional valueokResultMaybeto okResultMaybe.HttpResultWrapper.Builder<T,E>setOkResultMaybe(T okResultMaybe)Initializes the optional valueokResultMaybeto okResultMaybe.
-
-
-
Method Detail
-
from
public final HttpResultWrapper.Builder<T,E> from(AbstractHttpResultWrapper<T,E> instance)
Fill a builder with attribute values from the providedAbstractHttpResultWrapperinstance. 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:
thisbuilder for use in a chained invocation
-
setOkResultMaybe
public final HttpResultWrapper.Builder<T,E> setOkResultMaybe(@Nullable T okResultMaybe)
Initializes the optional valueokResultMaybeto okResultMaybe.- Parameters:
okResultMaybe- The value for okResultMaybe,nullis accepted asjava.util.Optional.empty()- Returns:
thisbuilder for chained invocation
-
setOkResultMaybe
public final HttpResultWrapper.Builder<T,E> setOkResultMaybe(Optional<? extends T> okResultMaybe)
Initializes the optional valueokResultMaybeto okResultMaybe.- Parameters:
okResultMaybe- The value for okResultMaybe- Returns:
thisbuilder for use in a chained invocation
-
setErrResultMaybe
public final HttpResultWrapper.Builder<T,E> setErrResultMaybe(@Nullable E errResultMaybe)
Initializes the optional valueerrResultMaybeto errResultMaybe.- Parameters:
errResultMaybe- The value for errResultMaybe,nullis accepted asjava.util.Optional.empty()- Returns:
thisbuilder for chained invocation
-
setErrResultMaybe
public final HttpResultWrapper.Builder<T,E> setErrResultMaybe(Optional<? extends E> errResultMaybe)
Initializes the optional valueerrResultMaybeto errResultMaybe.- Parameters:
errResultMaybe- The value for errResultMaybe- Returns:
thisbuilder for use in a chained invocation
-
setHttpStatusCode
public final HttpResultWrapper.Builder<T,E> setHttpStatusCode(int httpStatusCode)
Initializes the value for thehttpStatusCodeattribute.If not set, this attribute will have a default value as returned by the initializer of
httpStatusCode.- Parameters:
httpStatusCode- The value for httpStatusCode- Returns:
thisbuilder for use in a chained invocation
-
build
public HttpResultWrapper<T,E> build()
Builds a newHttpResultWrapper.- Returns:
- An immutable instance of HttpResultWrapper
- Throws:
com.hubspot.immutables.validation.InvalidImmutableStateException- if any required attributes are missing
-
-