Class QueryTags

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,​java.lang.String>

    public class QueryTags
    extends java.util.HashMap<java.lang.String,​java.lang.String>
    A utility class representing a collection of query tags as a map of key-value pairs. This class extends HashMap and provides methods to build, encode, and parse query tags.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      QueryTags()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String encode()
      Encodes the QueryTags instance as a single string.
      static QueryTags of​(java.lang.String... tags)
      Creates a new QueryTags instance from an array of tag strings.
      static QueryTags parse​(com.fasterxml.jackson.core.JsonParser parser)
      Parses a JSON parser to construct a QueryTags instance.
      • Methods inherited from class java.util.HashMap

        clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        equals, hashCode
    • Constructor Detail

      • QueryTags

        public QueryTags()
    • Method Detail

      • of

        public static QueryTags of​(java.lang.String... tags)
        Creates a new QueryTags instance from an array of tag strings. Each tag string must be in the form "key=value".
        Parameters:
        tags - an array of strings representing tags in the format "k=v", where k is the tag key and v is the tag value.
        Returns:
        a new QueryTags instance containing the parsed tags.
        Throws:
        ClientResponseException - if a tag string is not in the expected "k=v" format.
      • encode

        public java.lang.String encode()
        Encodes the QueryTags instance as a single string. The tags are sorted by their keys and concatenated in the format "key=value,key=value,...".
        Returns:
        a String representing the encoded query tags.
      • parse

        public static QueryTags parse​(com.fasterxml.jackson.core.JsonParser parser)
                               throws java.io.IOException
        Parses a JSON parser to construct a QueryTags instance. This method expects the JSON to contain either a null value or a string representation of tags in "key=value,key=value,..." format.
        Parameters:
        parser - a JsonParser positioned at the JSON data to parse.
        Returns:
        a QueryTags instance representing the parsed tags, or null if the JSON value is null.
        Throws:
        java.io.IOException - if an error occurs during parsing.
        ClientResponseException - if the JSON token is not a string or null.