Package org.dmfs.httpessentials.headers
Interface Headers
Interface of an object that holds a list of
Headers. Instances must be immutable.-
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(HeaderType<?> headerType) Returns whether these Headers contain aHeaderof the givenHeaderType.header(ListHeaderType<T> headerType) Returns the value of the header of the givenListHeaderType.<T> Header<T>header(SingletonHeaderType<T> headerType) Returns the value of the header of the givenSingletonHeaderType.<T> HeaderswithHeader(Header<T> header) ReturnsHeadersthat contain the given header.<T> HeaderswithoutHeaderType(HeaderType<T> headerType) Removes any header of the givenHeaderTypeand returns the resultingHeaders.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
contains
Returns whether these Headers contain aHeaderof the givenHeaderType.- Parameters:
headerType-- Returns:
-
header
Returns the value of the header of the givenSingletonHeaderType.- Parameters:
headerType- TheHeaderTypeto look for.- Returns:
- An
IteratorofHeaders, may be empty, but nevernull. - Throws:
NoSuchElementException- if no such header exists within theseHeaders.
-
header
Returns the value of the header of the givenListHeaderType.- Parameters:
headerType- TheHeaderTypeto look for.- Returns:
- An
IteratorofHeaders, may be empty, but nevernull. - Throws:
NoSuchElementException- if no such header exists within theseHeaders.
-
withHeader
ReturnsHeadersthat contain the given header. If another header of the same type already exists in this object, it is overridden with the new header.- Parameters:
header- The header to add.- Returns:
Headersthat contain the given header.
-
withoutHeaderType
Removes any header of the givenHeaderTypeand returns the resultingHeaders.- Parameters:
headerType- TheHeaderTypeof the headers to remove.- Returns:
Headersthat don't contain any header of the given type.
-