Class ImmutableSearchParameters
- java.lang.Object
-
- com.spotify.github.v3.search.requests.ImmutableSearchParameters
-
- All Implemented Interfaces:
Parameters
,SearchParameters
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableSearchParameters extends Object implements SearchParameters
Immutable implementation ofSearchParameters
.Use the builder to create immutable instances:
ImmutableSearchParameters.builder()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ImmutableSearchParameters.Builder
Builds instances of typeImmutableSearchParameters
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableSearchParameters.Builder
builder()
Creates a builder forImmutableSearchParameters
.static ImmutableSearchParameters
copyOf(SearchParameters instance)
Creates an immutable copy of aSearchParameters
value.boolean
equals(Object another)
This instance is equal to all instances ofImmutableSearchParameters
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:q
,sort
,order
,per_page
,page
.Optional<String>
order()
The sort order if sort parameter is provided.Optional<Integer>
page()
Page number of the results to fetch.Optional<Integer>
per_page()
The number of results per page (max 100).String
q()
The search keywords, as well as any qualifiers.Optional<String>
sort()
The sort field.String
toString()
Prints the immutable valueSearchParameters
with attribute values.ImmutableSearchParameters
withOrder(String value)
Copy the current immutable object by setting a present value for the optionalorder
attribute.ImmutableSearchParameters
withOrder(Optional<String> optional)
Copy the current immutable object by setting an optional value for theorder
attribute.ImmutableSearchParameters
withPage(int value)
Copy the current immutable object by setting a present value for the optionalpage
attribute.ImmutableSearchParameters
withPage(Optional<Integer> optional)
Copy the current immutable object by setting an optional value for thepage
attribute.ImmutableSearchParameters
withPer_page(int value)
Copy the current immutable object by setting a present value for the optionalper_page
attribute.ImmutableSearchParameters
withPer_page(Optional<Integer> optional)
Copy the current immutable object by setting an optional value for theper_page
attribute.ImmutableSearchParameters
withQ(String value)
Copy the current immutable object by setting a value for theq
attribute.ImmutableSearchParameters
withSort(String value)
Copy the current immutable object by setting a present value for the optionalsort
attribute.ImmutableSearchParameters
withSort(Optional<String> optional)
Copy the current immutable object by setting an optional value for thesort
attribute.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.spotify.github.Parameters
serialize
-
-
-
-
Method Detail
-
q
@Nullable public String q()
The search keywords, as well as any qualifiers.- Specified by:
q
in interfaceSearchParameters
-
sort
public Optional<String> sort()
The sort field. One of stars, forks, or updated. Default: results are sorted by best match.- Specified by:
sort
in interfaceSearchParameters
-
order
public Optional<String> order()
The sort order if sort parameter is provided. One of asc or desc. Default: desc- Specified by:
order
in interfaceSearchParameters
-
per_page
public Optional<Integer> per_page()
The number of results per page (max 100). Default: 30- Specified by:
per_page
in interfaceSearchParameters
-
page
public Optional<Integer> page()
Page number of the results to fetch. Default: 1- Specified by:
page
in interfaceSearchParameters
-
withQ
public final ImmutableSearchParameters withQ(@Nullable String value)
Copy the current immutable object by setting a value for theq
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for q (can benull
)- Returns:
- A modified copy of the
this
object
-
withSort
public final ImmutableSearchParameters withSort(String value)
Copy the current immutable object by setting a present value for the optionalsort
attribute.- Parameters:
value
- The value for sort- Returns:
- A modified copy of
this
object
-
withSort
public final ImmutableSearchParameters withSort(Optional<String> optional)
Copy the current immutable object by setting an optional value for thesort
attribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for sort- Returns:
- A modified copy of
this
object
-
withOrder
public final ImmutableSearchParameters withOrder(String value)
Copy the current immutable object by setting a present value for the optionalorder
attribute.- Parameters:
value
- The value for order- Returns:
- A modified copy of
this
object
-
withOrder
public final ImmutableSearchParameters withOrder(Optional<String> optional)
Copy the current immutable object by setting an optional value for theorder
attribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for order- Returns:
- A modified copy of
this
object
-
withPer_page
public final ImmutableSearchParameters withPer_page(int value)
Copy the current immutable object by setting a present value for the optionalper_page
attribute.- Parameters:
value
- The value for per_page- Returns:
- A modified copy of
this
object
-
withPer_page
public final ImmutableSearchParameters withPer_page(Optional<Integer> optional)
Copy the current immutable object by setting an optional value for theper_page
attribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for per_page- Returns:
- A modified copy of
this
object
-
withPage
public final ImmutableSearchParameters withPage(int value)
Copy the current immutable object by setting a present value for the optionalpage
attribute.- Parameters:
value
- The value for page- Returns:
- A modified copy of
this
object
-
withPage
public final ImmutableSearchParameters withPage(Optional<Integer> optional)
Copy the current immutable object by setting an optional value for thepage
attribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for page- Returns:
- A modified copy of
this
object
-
equals
public boolean equals(@Nullable Object another)
This instance is equal to all instances ofImmutableSearchParameters
that have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:q
,sort
,order
,per_page
,page
.
-
toString
public String toString()
Prints the immutable valueSearchParameters
with attribute values.
-
copyOf
public static ImmutableSearchParameters copyOf(SearchParameters instance)
Creates an immutable copy of aSearchParameters
value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance
- The instance to copy- Returns:
- A copied immutable SearchParameters instance
-
builder
public static ImmutableSearchParameters.Builder builder()
Creates a builder forImmutableSearchParameters
.ImmutableSearchParameters.builder() .q(String | null) // nullable
q
.sort(String) // optionalsort
.order(String) // optionalorder
.per_page(Integer) // optionalper_page
.page(Integer) // optionalpage
.build();- Returns:
- A new ImmutableSearchParameters builder
-
-