mirror of https://github.com/apache/kafka.git
MINOR: Add Functional Interface annotation to interfaces used by Lambdas (#19234)
Adds the FunctionalInterface annotation to relevant Kafka Streams classes. While this is not strictly required for Java, it's still best practice and also useful for better integration with other JVM languages, for example Clojure, to allow using these interfaces as lambdas. Reviewers: Matthias J. Sax <matthias@confluent.io>
This commit is contained in:
parent
f1bb29b93a
commit
db4e74b46e
|
@ -26,6 +26,7 @@ import java.util.Map;
|
|||
* A callback interface that the user can implement to trigger custom actions when a commit request completes. The callback
|
||||
* may be executed in any thread calling {@link Consumer#poll(java.time.Duration) poll()}.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface OffsetCommitCallback {
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,6 +38,7 @@ package org.apache.kafka.streams.kstream;
|
|||
* @see SessionWindowedKStream#aggregate(Initializer, Aggregator, Merger, Materialized)
|
||||
* @see Reducer
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Aggregator<K, V, VAgg> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,6 +30,7 @@ package org.apache.kafka.streams.kstream;
|
|||
*
|
||||
* @see KStream#foreach(ForeachAction)
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ForeachAction<K, V> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,6 +30,7 @@ package org.apache.kafka.streams.kstream;
|
|||
* @see SessionWindowedKStream#aggregate(Initializer, Aggregator, Merger)
|
||||
* @see SessionWindowedKStream#aggregate(Initializer, Aggregator, Merger, Materialized)
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Initializer<VAgg> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,6 +44,7 @@ import org.apache.kafka.streams.KeyValue;
|
|||
* @see KTable#groupBy(KeyValueMapper, Grouped)
|
||||
* @see KTable#toStream(KeyValueMapper)
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface KeyValueMapper<K, V, VR> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,6 +23,7 @@ package org.apache.kafka.streams.kstream;
|
|||
* @param <K> key type
|
||||
* @param <V> aggregate value type
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Merger<K, V> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.apache.kafka.streams.KeyValue;
|
|||
* @see KTable#filter(Predicate)
|
||||
* @see KTable#filterNot(Predicate)
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Predicate<K, V> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.apache.kafka.streams.KeyValue;
|
|||
* @see SessionWindowedKStream#reduce(Reducer, Materialized)
|
||||
* @see Aggregator
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Reducer<V> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,6 +38,7 @@ import java.util.function.Supplier;
|
|||
* @deprecated Since 4.0. Use {@link org.apache.kafka.streams.processor.api.ProcessorSupplier api.ProcessorSupplier} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@FunctionalInterface
|
||||
public interface TransformerSupplier<K, V, R> extends ConnectedStoreProvider, Supplier<Transformer<K, V, R>> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,6 +40,7 @@ package org.apache.kafka.streams.kstream;
|
|||
* @see KTable#leftJoin(KTable, ValueJoiner)
|
||||
* @see KTable#outerJoin(KTable, ValueJoiner)
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ValueJoiner<V1, V2, VR> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,6 +44,7 @@ package org.apache.kafka.streams.kstream;
|
|||
* @see KStream#leftJoin(GlobalKTable, KeyValueMapper, ValueJoinerWithKey)
|
||||
* @see KStream#leftJoin(GlobalKTable, KeyValueMapper, ValueJoinerWithKey, Named)
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ValueJoinerWithKey<K1, V1, V2, VR> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.apache.kafka.streams.processor.api.FixedKeyProcessor;
|
|||
* @see KTable#mapValues(ValueMapper)
|
||||
* @see KTable#mapValues(ValueMapperWithKey)
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ValueMapper<V, VR> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,6 +38,7 @@ package org.apache.kafka.streams.kstream;
|
|||
* @see KTable#mapValues(ValueMapperWithKey)
|
||||
*/
|
||||
|
||||
@FunctionalInterface
|
||||
public interface ValueMapperWithKey<K, V, VR> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.apache.kafka.streams.processor.api.FixedKeyProcessorSupplier;
|
|||
* @deprecated Since 4.0. Use {@link FixedKeyProcessorSupplier} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@FunctionalInterface
|
||||
public interface ValueTransformerSupplier<V, VR> extends ConnectedStoreProvider {
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.util.function.Supplier;
|
|||
* @see Transformer
|
||||
* @see TransformerSupplier
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ValueTransformerWithKeySupplier<K, V, VR> extends ConnectedStoreProvider, Supplier<ValueTransformerWithKey<K, V, VR>> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Collection;
|
|||
* It is expected that implementations of this class will not call the {@link StateRestoreCallback#restore(byte[],
|
||||
* byte[])} method.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface BatchingStateRestoreCallback extends StateRestoreCallback {
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.time.Duration;
|
|||
*
|
||||
* @see Punctuator
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Cancellable {
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.time.Duration;
|
|||
*
|
||||
* @see Cancellable
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Punctuator {
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.kafka.streams.processor;
|
|||
* Restoration logic for log-backed state stores upon restart,
|
||||
* it takes one record at a time from the logs to apply to the restoring state.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface StateRestoreCallback {
|
||||
|
||||
void restore(byte[] key, byte[] value);
|
||||
|
|
|
@ -50,6 +50,7 @@ import java.util.Set;
|
|||
* org.apache.kafka.common.serialization.Serializer, StreamPartitioner, String...)
|
||||
* @see Topology#addSink(String, String, StreamPartitioner, String...)
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface StreamPartitioner<K, V> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.apache.kafka.streams.kstream.KTable;
|
|||
* An interface that allows the Kafka Streams framework to extract a timestamp from an instance of {@link ConsumerRecord}.
|
||||
* The extracted timestamp is defined as milliseconds.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface TimestampExtractor {
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.kafka.streams.processor;
|
|||
/**
|
||||
* An interface that allows to dynamically determine the name of the Kafka topic to send at the sink node of the topology.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface TopicNameExtractor<K, V> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.time.Duration;
|
|||
* @param <VIn> the type of input values
|
||||
* @param <VOut> the type of output values
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface FixedKeyProcessor<KIn, VIn, VOut> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.time.Duration;
|
|||
* @param <KOut> the type of output keys
|
||||
* @param <VOut> the type of output values
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Processor<KIn, VIn, KOut, VOut> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,6 +24,7 @@ package org.apache.kafka.streams.processor.api;
|
|||
* To convert a {@link FixedKeyProcessorSupplier} instance into a {@link WrappedFixedKeyProcessorSupplier},
|
||||
* use the {@link ProcessorWrapper#asWrappedFixedKey(FixedKeyProcessorSupplier)} method
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface WrappedFixedKeyProcessorSupplier<KIn, VIn, VOut> extends FixedKeyProcessorSupplier<KIn, VIn, VOut> {
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ package org.apache.kafka.streams.processor.api;
|
|||
* To convert a {@link ProcessorSupplier} instance into a {@link WrappedProcessorSupplier},
|
||||
* use the {@link ProcessorWrapper#asWrapped(ProcessorSupplier)} method
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface WrappedProcessorSupplier<KIn, VIn, KOut, VOut> extends ProcessorSupplier<KIn, VIn, KOut, VOut> {
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue