Package org.apache.juneau.http.header
Class BasicCsvHeader
java.lang.Object
org.apache.juneau.http.header.BasicHeader
org.apache.juneau.http.header.BasicCsvHeader
- All Implemented Interfaces:
Serializable
,Cloneable
,Header
,NameValuePair
- Direct Known Subclasses:
Allow
,ContentLanguage
,Thrown
,Upgrade
,Via
Category of headers that consist of a comma-delimited list of string values.
Example
Allow: GET, PUT
See Also:
-
Constructor Summary
ConstructorDescriptionBasicCsvHeader
(String name, String value) Constructor.BasicCsvHeader
(String name, String... value) Constructor.BasicCsvHeader
(String name, Supplier<String[]> value) Constructor with delayed value. -
Method Summary
Modifier and TypeMethodDescriptionasArray()
Returns the header value as an array wrapped in anOptional
.asList()
Returns the header value as a list wrapped in anOptional
.Provides the ability to perform fluent-style assertions on this header.boolean
Returnstrue if this header contains the specified value.boolean
containsIgnoreCase
(String val) Returnstrue if this header contains the specified value usingString.equalsIgnoreCase(String)
.getValue()
static BasicCsvHeader
Static creator.static BasicCsvHeader
Static creator.static BasicCsvHeader
Static creator with delayed value.String[]
Return the value if present, otherwise returnother .String[]
toArray()
Returns the header value as an array.toList()
Returns the header value as a list.Methods inherited from class org.apache.juneau.http.header.BasicHeader
assertName, assertStringValue, asString, equals, equalsIgnoreCase, get, getElements, getName, hashCode, isNotEmpty, isPresent, of, of, orElse, toString
-
Constructor Details
-
BasicCsvHeader
Constructor.- Parameters:
name
- The header name.value
- The header value.
Must be a comma-delimited list.
Can benull .- Throws:
IllegalArgumentException
- If name isnull or empty.
-
BasicCsvHeader
Constructor.- Parameters:
name
- The header name.value
- The header value.
Can benull .- Throws:
IllegalArgumentException
- If name isnull or empty.
-
BasicCsvHeader
Constructor with delayed value.Header value is re-evaluated on each call to
getValue()
.- Parameters:
name
- The header name.value
- The supplier of the header value.
Can benull .- Throws:
IllegalArgumentException
- If name isnull or empty.
-
-
Method Details
-
of
Static creator.- Parameters:
name
- The header name.value
- The header value.
Must be a comma-delimited list.
Can benull .- Returns:
- A new header bean, or
null if the value isnull . - Throws:
IllegalArgumentException
- If name isnull or empty.
-
of
Static creator.- Parameters:
name
- The header name.value
- The header value.
Can benull .- Returns:
- A new header bean, or
null if the value isnull . - Throws:
IllegalArgumentException
- If name isnull or empty.
-
of
Static creator with delayed value.Header value is re-evaluated on each call to
getValue()
.- Parameters:
name
- The header name.value
- The supplier of the header value.
Can benull .- Returns:
- A new header bean, or
null if the value isnull . - Throws:
IllegalArgumentException
- If name isnull or empty.
-
getValue
- Specified by:
getValue
in interfaceNameValuePair
- Overrides:
getValue
in classBasicHeader
-
asArray
Returns the header value as an array wrapped in anOptional
.The array is a copy of the value of this header.
- Returns:
- The header value as an array wrapped in an
Optional
. Nevernull .
-
toArray
Returns the header value as an array.The array is a copy of the value of this header.
- Returns:
- The header value as an array. Can be
null .
-
asList
Returns the header value as a list wrapped in anOptional
.The list is unmodifiable.
- Returns:
- The header value as a list wrapped in an
Optional
. Nevernull .
-
toList
Returns the header value as a list.The list is unmodifiable.
- Returns:
- The header value as a list. Can be
null .
-
contains
Returnstrue if this header contains the specified value.- Parameters:
val
- The value to check for.- Returns:
true if this header contains the specified value.
-
containsIgnoreCase
Returnstrue if this header contains the specified value usingString.equalsIgnoreCase(String)
.- Parameters:
val
- The value to check for.- Returns:
true if this header contains the specified value.
-
assertList
Provides the ability to perform fluent-style assertions on this header.- Returns:
- A new fluent assertion object.
- Throws:
AssertionError
- If assertion failed.
-
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 .
-