Class MultiValueCodec
java.lang.Object
io.jenkins.plugins.restlistparam.util.MultiValueCodec
Converts the value of a REST Multi List Parameter between its list form and its text form,
a compact Json array of Json strings such as
["a","c"].
parse(encode(list)) yields list for every list of non-null strings.
-
Method Summary
-
Method Details
-
parse
Reads a value supplied as a single string. A strict (RFC 4627) Json array whose elements are all Json strings becomes the list of those strings; the empty string and[]become the empty list; any other string, including malformed or non-strict Json such as[a,b], becomes a one-element list holding the string verbatim. The string is never split on a delimiter.- Parameters:
input- The supplied string- Returns:
- The list of elements, or
nullwheninputisnull
-
encode
Writes a list as a compact Json array of Json strings, with no whitespace between tokens. Every element is written as a Json string, even when its text is itself Json.- Parameters:
elements- The elements, none of themnull- Returns:
- The Json array text
-