com.atlassian.jira.rest.api.util
Class StringList

java.lang.Object
  extended by 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 Summary
StringList()
          Creates a new, empty, StringList.
StringList(Iterable<String> fields)
          Constructs the List of Strings from another List.
StringList(String queryParam)
          Constructs the List of Strings from a query param string.
 
Method Summary
 com.google.common.collect.ImmutableList<String> asList()
          Returns an immutable list of strings.
 StringList extend(StringList stringList)
          Returns a new StringList containing the concatenation of this StringList's fields and the fields in the given string list.
static StringList fromList(Iterable<String> strings)
          Creates a new StringList from an Iterable of strings.
static StringList fromList(String... strings)
          Creates a new StringList from an array of strings.
static StringList fromQueryParam(String queryParam)
          Creates a new StringList from a query parameter.
static StringList joinLists(List<StringList> stringLists)
          Returns a new StringList containing the concatenation of all of the StringLists in the given List.
 String toQueryParam()
          Returns a string representation of this StringList, suitable for using in a query param.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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 Detail

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 ""-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


Copyright © 2002-2014 Atlassian. All Rights Reserved.