Interface QueryParameters

  • All Superinterfaces:
    Iterable<QueryParameters.Parameter>
    All Known Implementing Classes:
    QueryParametersImpl

    public interface QueryParameters
    extends Iterable<QueryParameters.Parameter>
    Interface representing a set of query parameters. These parameters can be used for some of the API calls in order to narrow the results being returned by the remote service. Instances of this interface might be created by using the TheTVDBApiFactory class.


    Individual parameters hold by this object can be accessed as Iterator or Stream.

    • Method Detail

      • addParameter

        QueryParameters addParameter​(@Nonnull
                                     String key,
                                     @Nonnull
                                     String value)
        Adds a new parameter to this object. An individual query parameter consists of a key/value pair. Adding the same parameter key twice will not result in two different parameters. Instead the parameter value from the first addition will be replaced by the new given value. For a predefined list of query parameters see Query.
        Parameters:
        key - The new parameters key. The class Query provides a basic set of parameter constants for the various API routes, which can be used at this point.
        value - The new parameters value. Should not be null or empty. These values will be encoded before being added to the URI.
        Returns:
        Reference to this very instance. Can be used to add multiple parameters in a fluent notation.
      • getParameterValue

        Optional<String> getParameterValue​(@Nonnull
                                           String key)
        Returns an Optional representing the parameter value for the given key. The Optional might be empty if this object currently holds no individual query parameter with this key.
        Parameters:
        key - The parameter key for which the current value should be returned
        Returns:
        Optional containing the current value for the given key or Optional.empty() if no parameter with this key exists
        See Also:
        containsParameter(key)
      • containsParameter

        boolean containsParameter​(@Nonnull
                                  String key)
        Returns true if an individual parameter with the given key exists in this very object or false if no such parameter has been added yet.
        Parameters:
        key - The parameter key to check for
        Returns:
        True if a parameter with the given key has already been added to this object or false if not
      • size

        int size()
        Returns the count of single parameter elements held by this container
        Returns:
        Number of single query parameters contained in this parameter set
      • stream

        Stream<QueryParameters.Parameter> stream()
        Returns a Stream of individual query parameters held by this class.
        Returns:
        Stream of all query parameters that have been added to this object