Class QueryParametersImpl

    • Field Detail

      • params

        protected final Map<String,String> params
        Simple map holding the individual query parameters as key/value pairs
    • Constructor Detail

      • QueryParametersImpl

        public QueryParametersImpl()
        Creates a new empty set of query parameters
      • QueryParametersImpl

        public QueryParametersImpl​(@Nonnull
                                   Map<String,String> parameters)
        Creates an object of this class with a pre-defined set of individual query parameters based on the given key/value pairs. For each entry in this map an appropriate query parameter will be added to this instance.
        Parameters:
        parameters - Map containing key/value pairs of query parameters to be initially added to this instance. Might be empty but not null.
    • Method Detail

      • addParameter

        public QueryParameters addParameter​(@Nonnull
                                            String key,
                                            @Nonnull
                                            String value)
        Description copied from interface: QueryParameters
        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.
        Specified by:
        addParameter in interface QueryParameters
        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

        public Optional<String> getParameterValue​(@Nonnull
                                                  String key)
        Description copied from interface: QueryParameters
        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.
        Specified by:
        getParameterValue in interface QueryParameters
        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

        public boolean containsParameter​(@Nonnull
                                         String key)
        Description copied from interface: QueryParameters
        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.
        Specified by:
        containsParameter in interface QueryParameters
        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

        public int size()
        Description copied from interface: QueryParameters
        Returns the count of single parameter elements held by this container
        Specified by:
        size in interface QueryParameters
        Returns:
        Number of single query parameters contained in this parameter set