Package org.apache.kafka.connect.header
Interface Headers
- All Known Implementing Classes:
ConnectHeaders
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
A function to transform the suppliedHeader
. -
Method Summary
Modifier and TypeMethodDescriptionAdd to this collection aHeader
with the given key and value.add
(String key, SchemaAndValue schemaAndValue) Add to this collection aHeader
with the given key and value.Add the givenHeader
to this collection.addBoolean
(String key, boolean value) Add to this collection aHeader
with the given key and value.Add to this collection aHeader
with the given key and value.Add to this collection aHeader
with the given key and value.addDecimal
(String key, BigDecimal value) Add to this collection aHeader
with the given key and value.Add to this collection aHeader
with the given key and value.Add to this collection aHeader
with the given key and value.Add to this collection aHeader
with the given key and value.Add to this collection aHeader
with the given key and value.Add to this collection aHeader
with the given key and value.Add to this collection aHeader
with the given key and value.Add to this collection aHeader
with the given key and value.Add to this collection aHeader
with the given key and value.addTimestamp
(String key, Date value) allWithName
(String key) apply
(String key, Headers.HeaderTransform transform) Get allHeader
s with the given key, apply the transform to each and store the result in place of the original.apply
(Headers.HeaderTransform transform) Get allHeader
s, apply the transform to each and store the result in place of the original.clear()
Removes all headers from this object.Create a copy of thisHeaders
object.boolean
isEmpty()
Determine whether this object has no headers.lastWithName
(String key) Return the lastHeader
with the specified key.Removes all but the lastHeader
object with each key.retainLatest
(String key) int
size()
Get the number of headers in this object.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
size
int size()Get the number of headers in this object.- Returns:
- the number of headers; never negative
-
isEmpty
boolean isEmpty()Determine whether this object has no headers.- Returns:
- true if there are no headers, or false if there is at least one header
-
allWithName
- Parameters:
key
- the key; may not be null- Returns:
- the iterator over headers with the specified key; may be null if there are no headers with the specified key
-
lastWithName
Return the lastHeader
with the specified key.- Parameters:
key
- the key for the header; may not be null- Returns:
- the last Header, or null if there are no headers with the specified key
-
add
Add the givenHeader
to this collection.- Parameters:
header
- the header; may not be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
add
Add to this collection aHeader
with the given key and value.- Parameters:
key
- the header's key; may not be nullschemaAndValue
- theSchemaAndValue
for the header; may be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
add
Add to this collection aHeader
with the given key and value.- Parameters:
key
- the header's key; may not be nullvalue
- the header's value; may be nullschema
- the schema for the header's value; may not be null if the value is not null- Returns:
- this object to facilitate chaining multiple methods; never null
-
addString
Add to this collection aHeader
with the given key and value.- Parameters:
key
- the header's key; may not be nullvalue
- the header's value; may be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
addBoolean
Add to this collection aHeader
with the given key and value.- Parameters:
key
- the header's key; may not be nullvalue
- the header's value; may be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
addByte
Add to this collection aHeader
with the given key and value.- Parameters:
key
- the header's key; may not be nullvalue
- the header's value; may be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
addShort
Add to this collection aHeader
with the given key and value.- Parameters:
key
- the header's key; may not be nullvalue
- the header's value; may be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
addInt
Add to this collection aHeader
with the given key and value.- Parameters:
key
- the header's key; may not be nullvalue
- the header's value; may be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
addLong
Add to this collection aHeader
with the given key and value.- Parameters:
key
- the header's key; may not be nullvalue
- the header's value; may be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
addFloat
Add to this collection aHeader
with the given key and value.- Parameters:
key
- the header's key; may not be nullvalue
- the header's value; may be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
addDouble
Add to this collection aHeader
with the given key and value.- Parameters:
key
- the header's key; may not be nullvalue
- the header's value; may be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
addBytes
Add to this collection aHeader
with the given key and value.- Parameters:
key
- the header's key; may not be nullvalue
- the header's value; may be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
addList
Add to this collection aHeader
with the given key and value.- Parameters:
key
- the header's key; may not be nullvalue
- the header's value; may be nullschema
- the schema describing the list value; may not be null- Returns:
- this object to facilitate chaining multiple methods; never null
- Throws:
DataException
- if the header's value is invalid
-
addMap
Add to this collection aHeader
with the given key and value.- Parameters:
key
- the header's key; may not be nullvalue
- the header's value; may be nullschema
- the schema describing the map value; may not be null- Returns:
- this object to facilitate chaining multiple methods; never null
- Throws:
DataException
- if the header's value is invalid
-
addStruct
Add to this collection aHeader
with the given key and value.- Parameters:
key
- the header's key; may not be nullvalue
- the header's value; may be null- Returns:
- this object to facilitate chaining multiple methods; never null
- Throws:
DataException
- if the header's value is invalid
-
addDecimal
- Parameters:
key
- the header's key; may not be nullvalue
- the header'sDecimal
value; may be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
addDate
- Parameters:
key
- the header's key; may not be nullvalue
- the header'sDate
value; may be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
addTime
- Parameters:
key
- the header's key; may not be nullvalue
- the header'sTime
value; may be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
addTimestamp
- Parameters:
key
- the header's key; may not be nullvalue
- the header'sTimestamp
value; may be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
remove
- Parameters:
key
- the key; may not be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
retainLatest
- Parameters:
key
- the key; may not be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
retainLatest
Headers retainLatest()Removes all but the lastHeader
object with each key.- Returns:
- this object to facilitate chaining multiple methods; never null
-
clear
Headers clear()Removes all headers from this object.- Returns:
- this object to facilitate chaining multiple methods; never null
-
duplicate
Headers duplicate()Create a copy of thisHeaders
object. The new copy will contain all of the sameHeader
objects as this object.- Returns:
- the copy; never null
-
apply
Get allHeader
s, apply the transform to each and store the result in place of the original.- Parameters:
transform
- the transform to apply; may not be null- Returns:
- this object to facilitate chaining multiple methods; never null
- Throws:
DataException
- if the header's value is invalid
-
apply
Get allHeader
s with the given key, apply the transform to each and store the result in place of the original.- Parameters:
key
- the header's key; may not be nulltransform
- the transform to apply; may not be null- Returns:
- this object to facilitate chaining multiple methods; never null
- Throws:
DataException
- if the header's value is invalid
-