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
ConstructorsConstructorDescriptionBasicCsvArrayPart(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.booleanReturnstrue if this part contains the specified value.booleancontainsIgnoreCase(String val) Returnstrue if this part contains the specified value usingString.equalsIgnoreCase(String).getValue()static BasicCsvArrayPartStatic creator.static BasicCsvArrayPartStatic 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.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 .
-
BasicCsvArrayPart
Constructor.- Parameters:
name- The part name. Must not benull .value- The part value supplier. Can benull or supplynull .
-
-
Method Details
-
of
Static creator.- Parameters:
name- The part name.value- The part value.- Returns:
- A new
BasicCsvArrayPartobject, 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
BasicCsvArrayPartobject, ornull if the name or supplier isnull .
-
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 .
-
asList
-
assertList
Provides the ability to perform fluent-style assertions on this part.- Returns:
- A new fluent assertion object.
- Throws:
AssertionError- If assertion failed.
-
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.
-
getValue
- Specified by:
getValuein interfaceNameValuePair- Overrides:
getValuein classBasicPart
-
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 .
-
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 .
-
toList
Returns The part value as aList.The list is unmodifiable.
- Returns:
- The part value as a
List, ornull if the valuenull .
-