Package org.apache.kafka.connect.header
Class ConnectHeaders
java.lang.Object
org.apache.kafka.connect.header.ConnectHeaders
public class ConnectHeaders extends Object implements Headers
A basic
Headers
implementation.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.kafka.connect.header.Headers
Headers.HeaderTransform
-
Constructor Summary
Constructors Constructor Description ConnectHeaders()
ConnectHeaders(Iterable<Header> original)
-
Method Summary
Modifier and Type Method Description Headers
add(String key, Object value, Schema schema)
Add to this collection aHeader
with the given key and value.Headers
add(String key, SchemaAndValue schemaAndValue)
Add to this collection aHeader
with the given key and value.Headers
add(Header header)
Add the givenHeader
to this collection.Headers
addBoolean(String key, boolean value)
Add to this collection aHeader
with the given key and value.Headers
addByte(String key, byte value)
Add to this collection aHeader
with the given key and value.Headers
addBytes(String key, byte[] value)
Add to this collection aHeader
with the given key and value.Headers
addDate(String key, Date value)
Headers
addDecimal(String key, BigDecimal value)
Headers
addDouble(String key, double value)
Add to this collection aHeader
with the given key and value.Headers
addFloat(String key, float value)
Add to this collection aHeader
with the given key and value.Headers
addInt(String key, int value)
Add to this collection aHeader
with the given key and value.Headers
addList(String key, List<?> value, Schema schema)
Add to this collection aHeader
with the given key and value.Headers
addLong(String key, long value)
Add to this collection aHeader
with the given key and value.Headers
addMap(String key, Map<?,?> value, Schema schema)
Add to this collection aHeader
with the given key and value.Headers
addShort(String key, short value)
Add to this collection aHeader
with the given key and value.Headers
addString(String key, String value)
Add to this collection aHeader
with the given key and value.Headers
addStruct(String key, Struct value)
Add to this collection aHeader
with the given key and value.Headers
addTime(String key, Date value)
Headers
addTimestamp(String key, Date value)
protected Headers
addWithoutValidating(String key, Object value, Schema schema)
Iterator<Header>
allWithName(String key)
Headers
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.Headers
apply(Headers.HeaderTransform transform)
Get allHeader
s, apply the transform to each and store the result in place of the original.Headers
clear()
Removes all headers from this object.ConnectHeaders
duplicate()
Create a copy of thisHeaders
object.boolean
equals(Object obj)
int
hashCode()
boolean
isEmpty()
Determine whether this object has no headers.Iterator<Header>
iterator()
Header
lastWithName(String key)
Return the lastHeader
with the specified key.Headers
remove(String key)
Headers
retainLatest()
Removes all but the lastHeader
object with each key.Headers
retainLatest(String key)
int
size()
Get the number of headers in this object.String
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ConnectHeaders
public ConnectHeaders() -
ConnectHeaders
-
-
Method Details
-
size
public int size()Description copied from interface:Headers
Get the number of headers in this object. -
isEmpty
public boolean isEmpty()Description copied from interface:Headers
Determine whether this object has no headers. -
clear
Description copied from interface:Headers
Removes all headers from this object. -
add
Description copied from interface:Headers
Add the givenHeader
to this collection. -
addWithoutValidating
-
add
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value.- Specified by:
add
in interfaceHeaders
- 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
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value. -
addString
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value. -
addBytes
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value. -
addBoolean
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value.- Specified by:
addBoolean
in interfaceHeaders
- 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
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value. -
addShort
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value. -
addInt
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value. -
addLong
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value. -
addFloat
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value. -
addDouble
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value. -
addList
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value. -
addMap
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value. -
addStruct
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value. -
addDecimal
Description copied from interface:Headers
- Specified by:
addDecimal
in interfaceHeaders
- 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
Description copied from interface:Headers
-
addTime
Description copied from interface:Headers
-
addTimestamp
Description copied from interface:Headers
- Specified by:
addTimestamp
in interfaceHeaders
- 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
-
lastWithName
Description copied from interface:Headers
Return the lastHeader
with the specified key.- Specified by:
lastWithName
in interfaceHeaders
- 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
-
allWithName
Description copied from interface:Headers
- Specified by:
allWithName
in interfaceHeaders
- 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
-
iterator
-
remove
Description copied from interface:Headers
-
retainLatest
Description copied from interface:Headers
Removes all but the lastHeader
object with each key.- Specified by:
retainLatest
in interfaceHeaders
- Returns:
- this object to facilitate chaining multiple methods; never null
-
retainLatest
Description copied from interface:Headers
- Specified by:
retainLatest
in interfaceHeaders
- Parameters:
key
- the key; may not be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
apply
Description copied from interface:Headers
Get allHeader
s with the given key, apply the transform to each and store the result in place of the original. -
apply
Description copied from interface:Headers
Get allHeader
s, apply the transform to each and store the result in place of the original. -
hashCode
public int hashCode() -
equals
-
toString
-
duplicate
Description copied from interface:Headers
-