Package org.apache.juneau.http.part
Class HttpCsvArrayPart
java.lang.Object
org.apache.juneau.http.part.HttpPartBean
org.apache.juneau.http.part.HttpCsvArrayPart
- All Implemented Interfaces:
HttpPart
An
HttpPart whose value is a comma-delimited list of strings.
Mirrors the semantics of BasicCsvArrayPart from juneau-rest-common-classic without
the Apache HttpCore dependency.
- Since:
- 10.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionHttpCsvArrayPart(String name, String value) Constructor accepting a comma-delimited wire string.HttpCsvArrayPart(String name, String... value) Constructor accepting an array of values.HttpCsvArrayPart(String name, Supplier<String[]> supplier) Constructor accepting a lazy supplier of array values. -
Method Summary
Modifier and TypeMethodDescriptionasArray()Returns the value as a copy of the underlying array, wrapped in anOptional.asList()booleanReturnstrueif this part contains the given value (case-sensitive).booleancontainsIgnoreCase(String val) Returnstrueif this part contains the given value (case-insensitive).static HttpCsvArrayPartCreates anHttpCsvArrayPartwith the given name and array value.static HttpCsvArrayPartCreates anHttpCsvArrayPartwith a lazy array supplier.static HttpCsvArrayPartCreates anHttpCsvArrayPartby parsing the given comma-delimited wire value.String[]Returns the value if present, otherwise returnsother.String[]toArray()Returns a copy of the underlying array, ornullif not set.toList()Returns the value as an unmodifiableList, ornullif not set.
-
Constructor Details
-
HttpCsvArrayPart
Constructor accepting an array of values.- Parameters:
name- The part name. Must not benull .value- The array of values. May benull .
-
HttpCsvArrayPart
Constructor accepting a comma-delimited wire string.- Parameters:
name- The part name. Must not benull .value- The wire value. May benull or empty.
-
HttpCsvArrayPart
Constructor accepting a lazy supplier of array values.- Parameters:
name- The part name. Must not benull .supplier- Supplier for the array value. Must not benull .
-
-
Method Details
-
of
Creates anHttpCsvArrayPartwith the given name and array value.- Parameters:
name- The part name. Must not benull .value- The array of values. May benull .- Returns:
- A new instance. Never
null .
-
ofString
Creates anHttpCsvArrayPartby parsing the given comma-delimited wire value.- Parameters:
name- The part name. Must not benull .value- The wire value. May benull or empty.- Returns:
- A new instance. Never
null .
-
ofLazy
Creates anHttpCsvArrayPartwith a lazy array supplier.- Parameters:
name- The part name. Must not benull .supplier- Supplier for the array value. Must not benull .- Returns:
- A new instance. Never
null .
-
asArray
Returns the value as a copy of the underlying array, wrapped in anOptional.- Returns:
- The array value, wrapped in an
Optional. Nevernull .
-
asList
- Returns:
- The list value, wrapped in an
Optional. Nevernull .
-
contains
Returnstrueif this part contains the given value (case-sensitive).- Parameters:
val- The value to check for.- Returns:
trueif the value is present.
-
containsIgnoreCase
Returnstrueif this part contains the given value (case-insensitive).- Parameters:
val- The value to check for.- Returns:
trueif the value is present.
-
toArray
Returns a copy of the underlying array, ornullif not set.- Returns:
- The array, possibly
null.
-
toList
Returns the value as an unmodifiableList, ornullif not set.- Returns:
- The list, possibly
null.
-
orElse
Returns the value if present, otherwise returnsother.- Parameters:
other- The default value.- Returns:
- The value or
other.
-