Package org.apache.juneau.http.part
Class BasicCsvArrayPart
java.lang.Object
org.apache.juneau.http.part.BasicPart
org.apache.juneau.http.part.BasicCsvArrayPart
- All Implemented Interfaces:
NameValuePair
,Headerable
A
NameValuePair
that consists of a comma-delimited list of string values.
See Also:
-
Constructor Summary
ConstructorDescriptionBasicCsvArrayPart
(String name, String value) Constructor.BasicCsvArrayPart
(String name, String... value) Constructor.BasicCsvArrayPart
(String name, Supplier<String[]> value) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionasArray()
Returns The part value as an array wrapped in anOptional
.asList()
Provides the ability to perform fluent-style assertions on this part.boolean
Returnstrue if this part contains the specified value.boolean
containsIgnoreCase
(String val) Returnstrue if this part contains the specified value usingString.equalsIgnoreCase(String)
.getValue()
static BasicCsvArrayPart
Static creator.static BasicCsvArrayPart
Static creator with delayed value.String[]
Return the value if present, otherwise returnother .String[]
toArray()
Returns The part value as an array.toList()
Returns The part value as aList
.Methods inherited from class org.apache.juneau.http.part.BasicPart
asHeader, assertName, assertValue, canCast, cast, getName, getRawValue, of, ofPair, toString
-
Constructor Details
-
BasicCsvArrayPart
Constructor.- Parameters:
name
- The part name. Must not benull .value
- The part value. Can benull .
-
BasicCsvArrayPart
Constructor.- Parameters:
name
- The part name. Must not benull .value
- The part value supplier. Can benull or supplynull .
-
BasicCsvArrayPart
Constructor.null values are treated asnull . Otherwise parses as a comma-delimited list with whitespace trimmed.- Parameters:
name
- The part name. Must not benull .value
- The part value. Can benull .
-
-
Method Details
-
of
Static creator.- Parameters:
name
- The part name.value
- The part value.- Returns:
- A new
BasicCsvArrayPart
object, ornull if the name or value isnull .
-
of
Static creator with delayed value.Part value is re-evaluated on each call to
NameValuePair.getValue()
.- Parameters:
name
- The part name.value
- The part value supplier.- Returns:
- A new
BasicCsvArrayPart
object, ornull if the name or supplier isnull .
-
getValue
- Specified by:
getValue
in interfaceNameValuePair
- Overrides:
getValue
in classBasicPart
-
contains
Returnstrue if this part contains the specified value.- Parameters:
val
- The value to check for.- Returns:
true if this part contains the specified value.
-
containsIgnoreCase
Returnstrue if this part contains the specified value usingString.equalsIgnoreCase(String)
.- Parameters:
val
- The value to check for.- Returns:
true if this part contains the specified value.
-
assertList
Provides the ability to perform fluent-style assertions on this part.- Returns:
- A new fluent assertion object.
- Throws:
AssertionError
- If assertion failed.
-
toList
Returns The part value as aList
.The list is unmodifiable.
- Returns:
- The part value as a
List
, ornull if the valuenull .
-
asList
-
toArray
Returns The part value as an array.The array is a copy of the value of this part.
- Returns:
- The part value as an array, or
null if the valuenull .
-
asArray
Returns The part value as an array wrapped in anOptional
.Array is a copy of the value of this part.
- Returns:
- The part value as an array wrapped in an
Optional
. Nevernull .
-
orElse
Return the value if present, otherwise returnother .This is a shortened form for calling
asArray().orElse( .other )- Parameters:
other
- The value to be returned if there is no value present, can benull .- Returns:
- The value, if present, otherwise
other .
-