Class ImmutableSearchParameters.Builder
- java.lang.Object
-
- com.spotify.github.v3.search.requests.ImmutableSearchParameters.Builder
-
- Enclosing class:
- ImmutableSearchParameters
@NotThreadSafe public static final class ImmutableSearchParameters.Builder extends Object
Builds instances of typeImmutableSearchParameters
. Initialize attributes and then invoke thebuild()
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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableSearchParameters
build()
Builds a newImmutableSearchParameters
.ImmutableSearchParameters.Builder
from(SearchParameters instance)
Fill a builder with attribute values from the providedSearchParameters
instance.ImmutableSearchParameters.Builder
order(String order)
Initializes the optional valueorder
to order.ImmutableSearchParameters.Builder
order(Optional<String> order)
Initializes the optional valueorder
to order.ImmutableSearchParameters.Builder
page(int page)
Initializes the optional valuepage
to page.ImmutableSearchParameters.Builder
page(Optional<Integer> page)
Initializes the optional valuepage
to page.ImmutableSearchParameters.Builder
per_page(int per_page)
Initializes the optional valueper_page
to per_page.ImmutableSearchParameters.Builder
per_page(Optional<Integer> per_page)
Initializes the optional valueper_page
to per_page.ImmutableSearchParameters.Builder
q(String q)
Initializes the value for theq
attribute.ImmutableSearchParameters.Builder
sort(String sort)
Initializes the optional valuesort
to sort.ImmutableSearchParameters.Builder
sort(Optional<String> sort)
Initializes the optional valuesort
to sort.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableSearchParameters.Builder from(SearchParameters instance)
Fill a builder with attribute values from the providedSearchParameters
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
-
q
@CanIgnoreReturnValue public final ImmutableSearchParameters.Builder q(@Nullable String q)
Initializes the value for theq
attribute.- Parameters:
q
- The value for q (can benull
)- Returns:
this
builder for use in a chained invocation
-
sort
@CanIgnoreReturnValue public final ImmutableSearchParameters.Builder sort(String sort)
Initializes the optional valuesort
to sort.- Parameters:
sort
- The value for sort- Returns:
this
builder for chained invocation
-
sort
@CanIgnoreReturnValue public final ImmutableSearchParameters.Builder sort(Optional<String> sort)
Initializes the optional valuesort
to sort.- Parameters:
sort
- The value for sort- Returns:
this
builder for use in a chained invocation
-
order
@CanIgnoreReturnValue public final ImmutableSearchParameters.Builder order(String order)
Initializes the optional valueorder
to order.- Parameters:
order
- The value for order- Returns:
this
builder for chained invocation
-
order
@CanIgnoreReturnValue public final ImmutableSearchParameters.Builder order(Optional<String> order)
Initializes the optional valueorder
to order.- Parameters:
order
- The value for order- Returns:
this
builder for use in a chained invocation
-
per_page
@CanIgnoreReturnValue public final ImmutableSearchParameters.Builder per_page(int per_page)
Initializes the optional valueper_page
to per_page.- Parameters:
per_page
- The value for per_page- Returns:
this
builder for chained invocation
-
per_page
@CanIgnoreReturnValue public final ImmutableSearchParameters.Builder per_page(Optional<Integer> per_page)
Initializes the optional valueper_page
to per_page.- Parameters:
per_page
- The value for per_page- Returns:
this
builder for use in a chained invocation
-
page
@CanIgnoreReturnValue public final ImmutableSearchParameters.Builder page(int page)
Initializes the optional valuepage
to page.- Parameters:
page
- The value for page- Returns:
this
builder for chained invocation
-
page
@CanIgnoreReturnValue public final ImmutableSearchParameters.Builder page(Optional<Integer> page)
Initializes the optional valuepage
to page.- Parameters:
page
- The value for page- Returns:
this
builder for use in a chained invocation
-
build
public ImmutableSearchParameters build()
Builds a newImmutableSearchParameters
.- Returns:
- An immutable instance of SearchParameters
- Throws:
IllegalStateException
- if any required attributes are missing
-
-