Interface UriQueryWriteable

All Superinterfaces:
Parameters, UriQuery

public interface UriQueryWriteable extends UriQuery
Mutable HTTP query.
  • Method Details

    • create

      static UriQueryWriteable create()
      Create a new HTTP Query to write parameter into.
      Returns:
      new mutable HTTP query
    • from

      UriQueryWriteable from(UriQuery uriQuery)
      Update this query by copying all names and their value(s) from the provided query. Raw and decoded parameter lists are copied independently. Generic queries are copied using raw parameter names from UriQuery.rawValue() when those names can be looked up through UriQuery.getAllRaw(String), retaining each serialized raw spelling. Additional nonempty raw lists exposed through Parameters.names() are copied only for decoded names absent from the serialization; empty raw lists can also retain parameter membership. A generic query cannot distinguish a decoded lookup alias from a new nonempty raw alias of an existing decoded name omitted by stale serialization. Such supplemental raw aliases are not copied. If a serialized name cannot be looked up, raw lookups instead use Parameters.names(), preserving the historical lookup behavior for decorators that rewrite serialized names. This fallback cannot retain raw aliases that the parameter names do not expose. Names from this fallback or supplemental lookups are query-encoded before being written. Values are read from the current parameter lists rather than the serialized query.
      Parameters:
      uriQuery - uri query to read
      Returns:
      updated instance
      Throws:
      NoSuchElementException - if the source supports raw lookups by neither its serialized names nor its parameter names
    • set

      UriQueryWriteable set(String name, String... value)
      Set a query parameter with values.
      Parameters:
      name - name of the parameter
      value - value(s) of the parameter
      Returns:
      this instance
    • add

      UriQueryWriteable add(String name, String value)
      Add a new query parameter or add a value to existing.
      Parameters:
      name - name of the parameter
      value - additional value of the parameter
      Returns:
      this instance
    • setIfAbsent

      UriQueryWriteable setIfAbsent(String name, String... value)
      Set a query parameter with values, if not already defined.
      Parameters:
      name - name of the parameter
      value - value(s) of the parameter
      Returns:
      this instance
    • remove

      UriQueryWriteable remove(String name)
      Remove a query parameter.
      Parameters:
      name - name of the parameter
      Returns:
      this instance
    • remove

      UriQueryWriteable remove(String name, Consumer<List<String>> removedConsumer)
      Remove a query parameter.
      Parameters:
      name - name of the parameter
      removedConsumer - consumer of existing values, only called if there was an existing value
      Returns:
      this instance
    • fromQueryString

      void fromQueryString(String queryString)
      Update from a query string (with encoded values).

      This documentation (and behavior) has been changed, as we cannot create a proper query from decoded values, as these may contain characters used to split the query. Malformed percent-encoded sequences are preserved literally when parameter names and values are decoded. Use UriValidator.validateQuery(String) for strict query validation before updating this instance.

      Parameters:
      queryString - encoded query string to update this instance
    • clear

      void clear()
      Clear all query parameters.