public static class Event.Headers extends Object implements Serializable, Iterable<Tuple2<String,Object>>
String.CASE_INSENSITIVE_ORDER
. A header can be removed by setting its value to null
.Modifier and Type | Field and Description |
---|---|
static String |
ORIGIN
The name of the origin header
|
Constructor and Description |
---|
Headers()
Create an empty Headers
|
Headers(Map<String,Object> headers)
Creates a new Headers instance by copying the contents of the given
headers Map. |
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
asMap()
Get these headers as an unmodifiable
Map . |
boolean |
contains(String name)
Determine whether the headers contain a value for the given name.
|
<V> V |
get(String name)
Get the value for the given header.
|
String |
getOrigin()
Get the origin header
|
Iterator<Tuple2<String,Object>> |
iterator()
Returns an unmodifiable Iterator over a copy of this Headers' contents.
|
Event.Headers |
readOnly()
Get the headers as a read-only version
|
<V> Event.Headers |
set(String name,
V value)
Set the header value.
|
Event.Headers |
setAll(Map<String,Object> headers)
Sets all of the headers represented by entries in the given
headers Map. |
Event.Headers |
setOrigin(String id)
Set the origin header.
|
Event.Headers |
setOrigin(UUID id)
Set the origin header.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static final String ORIGIN
setOrigin(String)
,
setOrigin(UUID)
,
getOrigin()
,
Constant Field Valuespublic Headers(Map<String,Object> headers)
headers
Map. Note that, as the map is
copied, subsequent changes to its contents will have no effect upon the Headers.headers
- The map to copy.public Headers()
public Event.Headers setAll(Map<String,Object> headers)
headers
Map. Any entry with a null value will
cause the header matching the entry's name to be removed.headers
- The map of headers to set.this
public <V> Event.Headers set(String name, V value)
value
is null
the header with the given name
will be removed.name
- The name of the header.value
- The header's value.this
public Event.Headers setOrigin(UUID id)
id
is null
the origin header will be removed.id
- The id of the origin component.this
public String getOrigin()
null
.public Event.Headers setOrigin(String id)
id
is null
this origin header will be removed.id
- The id of the origin component.this
public <V> V get(String name)
name
- The header name.null
if none exists.public boolean contains(String name)
name
- The header name.true
if a value exists, false
otherwise.public Map<String,Object> asMap()
Map
.public Event.Headers readOnly()
public Iterator<Tuple2<String,Object>> iterator()
Copyright © 2016. All rights reserved.