Class StringList

java.lang.Object
com.atlassian.jira.rest.api.util.StringList

@Immutable public class StringList extends Object
This class is used for dealing with query parameters that contain comma-separated lists of strings. The utility methods fromQueryParam(String) and toQueryParam() can be used to convert back and forth between String and StringList.
Since:
v5.0
  • Constructor Details

    • StringList

      public StringList()
      Creates a new, empty, StringList.
    • StringList

      public StringList(@Nullable String queryParam)
      Constructs the List of Strings from a query param string.
      Parameters:
      queryParam - a String containing the query param value
    • StringList

      public StringList(@Nullable Iterable<String> fields)
      Constructs the List of Strings from another List.
      Parameters:
      fields - a List of Strings
  • Method Details

    • fromList

      public static StringList fromList(String... strings)
      Creates a new StringList from an array of strings.
      Parameters:
      strings - an array of String
      Returns:
      a new StringList
    • fromList

      public static StringList fromList(Iterable<String> strings)
      Creates a new StringList from an Iterable of strings.
      Parameters:
      strings - an array of String
      Returns:
      a new StringList
    • fromQueryParam

      public static StringList fromQueryParam(String queryParam)
      Creates a new StringList from a query parameter. The input string is expected to be a comma-separated list of strings.
      Parameters:
      queryParam - a comma-separated String list
      Returns:
      a new StringList
    • asList

      public com.google.common.collect.ImmutableList<String> asList()
      Returns an immutable list of strings.
      Returns:
      an ImmutableList<String>
    • toQueryParam

      public String toQueryParam()
      Returns a string representation of this StringList, suitable for using in a query param. This essentially a comma-separated list of values.
      Returns:
      a String containing a representation of this StringList
    • extend

      public StringList extend(StringList stringList)
      Returns a new StringList containing the concatenation of this StringList's fields and the fields in the given string list.
      Parameters:
      stringList - a StringList
      Returns:
      a new StringList
    • joinLists

      public static StringList joinLists(List<StringList> stringLists)
      Returns a new StringList containing the concatenation of all of the StringLists in the given List.
      Parameters:
      stringLists - a List of StringLists
      Returns:
      a new StringList
    • toString

      public String toString()
      Overrides:
      toString in class Object