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 Headersadd(String key, Object value, Schema schema)Add to this collection aHeaderwith the given key and value.Headersadd(String key, SchemaAndValue schemaAndValue)Add to this collection aHeaderwith the given key and value.Headersadd(Header header)Add the givenHeaderto this collection.HeadersaddBoolean(String key, boolean value)Add to this collection aHeaderwith the given key and value.HeadersaddByte(String key, byte value)Add to this collection aHeaderwith the given key and value.HeadersaddBytes(String key, byte[] value)Add to this collection aHeaderwith the given key and value.HeadersaddDate(String key, Date value)HeadersaddDecimal(String key, BigDecimal value)HeadersaddDouble(String key, double value)Add to this collection aHeaderwith the given key and value.HeadersaddFloat(String key, float value)Add to this collection aHeaderwith the given key and value.HeadersaddInt(String key, int value)Add to this collection aHeaderwith the given key and value.HeadersaddList(String key, List<?> value, Schema schema)Add to this collection aHeaderwith the given key and value.HeadersaddLong(String key, long value)Add to this collection aHeaderwith the given key and value.HeadersaddMap(String key, Map<?,?> value, Schema schema)Add to this collection aHeaderwith the given key and value.HeadersaddShort(String key, short value)Add to this collection aHeaderwith the given key and value.HeadersaddString(String key, String value)Add to this collection aHeaderwith the given key and value.HeadersaddStruct(String key, Struct value)Add to this collection aHeaderwith the given key and value.HeadersaddTime(String key, Date value)HeadersaddTimestamp(String key, Date value)protected HeadersaddWithoutValidating(String key, Object value, Schema schema)Iterator<Header>allWithName(String key)Headersapply(String key, Headers.HeaderTransform transform)Get allHeaders with the given key, apply the transform to each and store the result in place of the original.Headersapply(Headers.HeaderTransform transform)Get allHeaders, apply the transform to each and store the result in place of the original.Headersclear()Removes all headers from this object.ConnectHeadersduplicate()Create a copy of thisHeadersobject.booleanequals(Object obj)inthashCode()booleanisEmpty()Determine whether this object has no headers.Iterator<Header>iterator()HeaderlastWithName(String key)Return the lastHeaderwith the specified key.Headersremove(String key)HeadersretainLatest()Removes all but the lastHeaderobject with each key.HeadersretainLatest(String key)intsize()Get the number of headers in this object.StringtoString()-
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:HeadersGet the number of headers in this object.
-
isEmpty
public boolean isEmpty()
Description copied from interface:HeadersDetermine whether this object has no headers.
-
clear
public Headers clear()
Description copied from interface:HeadersRemoves all headers from this object.
-
add
public Headers add(Header header)
Description copied from interface:HeadersAdd the givenHeaderto this collection.
-
addWithoutValidating
protected Headers addWithoutValidating(String key, Object value, Schema schema)
-
add
public Headers add(String key, SchemaAndValue schemaAndValue)
Description copied from interface:HeadersAdd to this collection aHeaderwith the given key and value.- Specified by:
addin interfaceHeaders- Parameters:
key- the header's key; may not be nullschemaAndValue- theSchemaAndValuefor 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:HeadersAdd to this collection aHeaderwith the given key and value.
-
addString
public Headers addString(String key, String value)
Description copied from interface:HeadersAdd to this collection aHeaderwith the given key and value.
-
addBytes
public Headers addBytes(String key, byte[] value)
Description copied from interface:HeadersAdd to this collection aHeaderwith the given key and value.
-
addBoolean
public Headers addBoolean(String key, boolean value)
Description copied from interface:HeadersAdd to this collection aHeaderwith the given key and value.- Specified by:
addBooleanin 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:HeadersAdd to this collection aHeaderwith the given key and value.
-
addShort
public Headers addShort(String key, short value)
Description copied from interface:HeadersAdd to this collection aHeaderwith the given key and value.
-
addInt
public Headers addInt(String key, int value)
Description copied from interface:HeadersAdd to this collection aHeaderwith the given key and value.
-
addLong
public Headers addLong(String key, long value)
Description copied from interface:HeadersAdd to this collection aHeaderwith the given key and value.
-
addFloat
public Headers addFloat(String key, float value)
Description copied from interface:HeadersAdd to this collection aHeaderwith the given key and value.
-
addDouble
public Headers addDouble(String key, double value)
Description copied from interface:HeadersAdd to this collection aHeaderwith the given key and value.
-
addList
public Headers addList(String key, List<?> value, Schema schema)
Description copied from interface:HeadersAdd to this collection aHeaderwith the given key and value.
-
addMap
public Headers addMap(String key, Map<?,?> value, Schema schema)
Description copied from interface:HeadersAdd to this collection aHeaderwith the given key and value.
-
addStruct
public Headers addStruct(String key, Struct value)
Description copied from interface:HeadersAdd to this collection aHeaderwith the given key and value.
-
addDecimal
public Headers addDecimal(String key, BigDecimal value)
Description copied from interface:Headers- Specified by:
addDecimalin interfaceHeaders- Parameters:
key- the header's key; may not be nullvalue- the header'sDecimalvalue; 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:
addTimestampin interfaceHeaders- Parameters:
key- the header's key; may not be nullvalue- the header'sTimestampvalue; may be null- Returns:
- this object to facilitate chaining multiple methods; never null
-
lastWithName
public Header lastWithName(String key)
Description copied from interface:HeadersReturn the lastHeaderwith the specified key.- Specified by:
lastWithNamein 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:
allWithNamein 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:HeadersRemoves all but the lastHeaderobject with each key.- Specified by:
retainLatestin interfaceHeaders- Returns:
- this object to facilitate chaining multiple methods; never null
-
retainLatest
public Headers retainLatest(String key)
Description copied from interface:Headers- Specified by:
retainLatestin 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:HeadersGet allHeaders 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:HeadersGet allHeaders, apply the transform to each and store the result in place of the original.
-
-