Class ImmutableSearchParameters

  • All Implemented Interfaces:
    Parameters, SearchParameters

    @ParametersAreNonnullByDefault
    @Generated("org.immutables.processor.ProxyProcessor")
    @Immutable
    @CheckReturnValue
    public final class ImmutableSearchParameters
    extends Object
    implements SearchParameters
    Immutable implementation of SearchParameters.

    Use the builder to create immutable instances: ImmutableSearchParameters.builder().

    • Method Detail

      • q

        @Nullable
        public String q()
        The search keywords, as well as any qualifiers.
        Specified by:
        q in interface SearchParameters
      • 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 interface SearchParameters
      • withQ

        public final ImmutableSearchParameters withQ​(@Nullable
                                                     String value)
        Copy the current immutable object by setting a value for the q attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for q (can be null)
        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 optional sort 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 the sort attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
        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 optional order 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 the order attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for order
        Returns:
        A modified copy of this object
      • equals

        public boolean equals​(@Nullable
                              Object another)
        This instance is equal to all instances of ImmutableSearchParameters that have equal attribute values.
        Overrides:
        equals in class Object
        Returns:
        true if this is equal to another instance
      • hashCode

        public int hashCode()
        Computes a hash code from attributes: q, sort, order.
        Overrides:
        hashCode in class Object
        Returns:
        hashCode value
      • toString

        public String toString()
        Prints the immutable value SearchParameters with attribute values.
        Overrides:
        toString in class Object
        Returns:
        A string representation of the value
      • copyOf

        public static ImmutableSearchParameters copyOf​(SearchParameters instance)
        Creates an immutable copy of a SearchParameters 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