Package org.apache.kafka.connect.header
Class ConnectHeaders
- java.lang.Object
-
- org.apache.kafka.connect.header.ConnectHeaders
-
-
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
All Methods Instance Methods Concrete Methods 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
-
-
-
-
Method Detail
-
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
public Headers clear()
Description copied from interface:Headers
Removes all headers from this object.
-
add
public Headers add(Header header)
Description copied from interface:Headers
Add the givenHeader
to this collection.
-
addWithoutValidating
protected Headers addWithoutValidating(String key, Object value, Schema schema)
-
add
public Headers add(String key, SchemaAndValue schemaAndValue)
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
public Headers add(String key, Object value, Schema schema)
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value.
-
addString
public Headers addString(String key, String value)
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value.
-
addBytes
public Headers addBytes(String key, byte[] value)
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value.
-
addBoolean
public Headers addBoolean(String key, boolean value)
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
public Headers addByte(String key, byte value)
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value.
-
addShort
public Headers addShort(String key, short value)
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value.
-
addInt
public Headers addInt(String key, int value)
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value.
-
addLong
public Headers addLong(String key, long value)
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value.
-
addFloat
public Headers addFloat(String key, float value)
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value.
-
addDouble
public Headers addDouble(String key, double value)
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value.
-
addList
public Headers addList(String key, List<?> value, Schema schema)
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value.
-
addMap
public Headers addMap(String key, Map<?,?> value, Schema schema)
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value.
-
addStruct
public Headers addStruct(String key, Struct value)
Description copied from interface:Headers
Add to this collection aHeader
with the given key and value.
-
addDecimal
public Headers addDecimal(String key, BigDecimal value)
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
-
addTimestamp
public Headers addTimestamp(String key, Date value)
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
public Header lastWithName(String key)
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
public Iterator<Header> allWithName(String key)
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
-
retainLatest
public 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
public Headers retainLatest(String key)
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
public Headers apply(String key, Headers.HeaderTransform transform)
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
public Headers apply(Headers.HeaderTransform transform)
Description copied from interface:Headers
Get allHeader
s, apply the transform to each and store the result in place of the original.
-
-