Class APIResponseDTO.Builder<T>
- java.lang.Object
-
- com.github.m0nk3y2k4.thetvdb.internal.api.impl.model.APIResponseDTO.Builder<T>
-
- Enclosing class:
- APIResponseDTO<T>
public static class APIResponseDTO.Builder<T> extends Object
Builder used to create a new immutableAPIResponseDTO
implementation
This builder provides a fluent API for setting certain object properties and creating a new immutableAPIResponseDTO
instance based on these properties. New builders may be initialized with some existing DTO instance, which presets the builders properties to the values of the given DTO, still retaining the option to make additional changes before actually building a new immutable object.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description APIResponseDTO<T>
build()
Builds a newAPIResponseDTO
.APIResponseDTO.Builder<T>
data(T data)
Initializes the value for thedata
attribute.APIResponseDTO.Builder<T>
errors(APIResponse.Errors errors)
Initializes the optional valueerrors
to errors.APIResponseDTO.Builder<T>
errors(Optional<? extends APIResponse.Errors> errors)
Initializes the optional valueerrors
to errors.APIResponseDTO.Builder<T>
from(APIResponse<T> instance)
Fill a builder with attribute values from the providedcom.github.m0nk3y2k4.thetvdb.api.model.APIResponse
instance.APIResponseDTO.Builder<T>
from(APIResponseDTO<T> instance)
Fill a builder with attribute values from the providedcom.github.m0nk3y2k4.thetvdb.internal.api.impl.model.APIResponseDTO
instance.APIResponseDTO.Builder<T>
links(APIResponse.Links links)
Initializes the optional valuelinks
to links.APIResponseDTO.Builder<T>
links(Optional<? extends APIResponse.Links> links)
Initializes the optional valuelinks
to links.
-
-
-
Method Detail
-
from
public final APIResponseDTO.Builder<T> from(APIResponse<T> instance)
Fill a builder with attribute values from the providedcom.github.m0nk3y2k4.thetvdb.api.model.APIResponse
instance.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
from
public final APIResponseDTO.Builder<T> from(APIResponseDTO<T> instance)
Fill a builder with attribute values from the providedcom.github.m0nk3y2k4.thetvdb.internal.api.impl.model.APIResponseDTO
instance.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
data
public final APIResponseDTO.Builder<T> data(@Nullable T data)
Initializes the value for thedata
attribute.- Parameters:
data
- The value for data (can benull
)- Returns:
this
builder for use in a chained invocation
-
errors
public final APIResponseDTO.Builder<T> errors(APIResponse.Errors errors)
Initializes the optional valueerrors
to errors.- Parameters:
errors
- The value for errors- Returns:
this
builder for chained invocation
-
errors
public final APIResponseDTO.Builder<T> errors(Optional<? extends APIResponse.Errors> errors)
Initializes the optional valueerrors
to errors.- Parameters:
errors
- The value for errors- Returns:
this
builder for use in a chained invocation
-
links
public final APIResponseDTO.Builder<T> links(APIResponse.Links links)
Initializes the optional valuelinks
to links.- Parameters:
links
- The value for links- Returns:
this
builder for chained invocation
-
links
public final APIResponseDTO.Builder<T> links(Optional<? extends APIResponse.Links> links)
Initializes the optional valuelinks
to links.- Parameters:
links
- The value for links- Returns:
this
builder for use in a chained invocation
-
build
public APIResponseDTO<T> build()
Builds a newAPIResponseDTO
.- Returns:
- An immutable instance of APIResponseDTO
- Throws:
IllegalStateException
- if any required attributes are missing
-
-