11/**
2- * Copyright (C) 2018 Lightbend Inc. <https://www.lightbend.com>
3- */
2+ * Copyright (C) 2018 Lightbend Inc. <https://www.lightbend.com>
3+ */
44
55package com .lightbend .kafka .scala .streams
66
77import java .util .regex .Pattern
88
9- import ImplicitConversions ._
10- import org .apache .kafka .streams .kstream .{ GlobalKTable , Materialized }
9+ import com .lightbend .kafka .scala .streams .ImplicitConversions ._
10+ import org .apache .kafka .common .utils .Bytes
11+ import org .apache .kafka .streams .kstream .{GlobalKTable , Materialized }
1112import org .apache .kafka .streams .processor .{ProcessorSupplier , StateStore }
12- import org .apache .kafka .streams .state .{ StoreBuilder , KeyValueStore }
13+ import org .apache .kafka .streams .state .{KeyValueStore , StoreBuilder }
1314import org .apache .kafka .streams .{Consumed , StreamsBuilder , Topology }
14- import org .apache .kafka .common .utils .Bytes
1515
1616import scala .collection .JavaConverters ._
1717
1818/**
19- * Wraps the Java class StreamsBuilder and delegates method calls to the underlying Java object.
20- */
21- class StreamsBuilderS (inner: StreamsBuilder ) {
19+ * Wraps the Java class StreamsBuilder and delegates method calls to the underlying Java object.
20+ */
21+ class StreamsBuilderS (inner : StreamsBuilder = new StreamsBuilder ) {
2222
23- def stream [K , V ](topic : String ) : KStreamS [K , V ] =
24- inner.stream[K , V ](topic)
23+ def stream [K , V ](topic : String ): KStreamS [K , V ] =
24+ inner.stream[K , V ](topic)
2525
26- def stream [K , V ](topic : String , consumed : Consumed [K , V ]) : KStreamS [K , V ] =
27- inner.stream[K , V ](topic, consumed)
26+ def stream [K , V ](topic : String , consumed : Consumed [K , V ]): KStreamS [K , V ] =
27+ inner.stream[K , V ](topic, consumed)
2828
2929 def stream [K , V ](topics : List [String ]): KStreamS [K , V ] =
30- inner.stream[K , V ](topics.asJava)
30+ inner.stream[K , V ](topics.asJava)
3131
3232 def stream [K , V ](topics : List [String ], consumed : Consumed [K , V ]): KStreamS [K , V ] =
33- inner.stream[K , V ](topics.asJava, consumed)
33+ inner.stream[K , V ](topics.asJava, consumed)
3434
35- def stream [K , V ](topicPattern : Pattern ) : KStreamS [K , V ] =
35+ def stream [K , V ](topicPattern : Pattern ): KStreamS [K , V ] =
3636 inner.stream[K , V ](topicPattern)
3737
38- def stream [K , V ](topicPattern : Pattern , consumed : Consumed [K , V ]) : KStreamS [K , V ] =
38+ def stream [K , V ](topicPattern : Pattern , consumed : Consumed [K , V ]): KStreamS [K , V ] =
3939 inner.stream[K , V ](topicPattern, consumed)
4040
41- def table [K , V ](topic : String ) : KTableS [K , V ] = inner.table[K , V ](topic)
41+ def table [K , V ](topic : String ): KTableS [K , V ] = inner.table[K , V ](topic)
4242
43- def table [K , V ](topic : String , consumed : Consumed [K , V ]) : KTableS [K , V ] =
43+ def table [K , V ](topic : String , consumed : Consumed [K , V ]): KTableS [K , V ] =
4444 inner.table[K , V ](topic, consumed)
4545
4646 def table [K , V ](topic : String , consumed : Consumed [K , V ],
47- materialized : Materialized [K , V , KeyValueStore [Bytes , Array [Byte ]]]): KTableS [K , V ] =
48- inner.table[K , V ](topic, consumed, materialized)
47+ materialized : Materialized [K , V , KeyValueStore [Bytes , Array [Byte ]]]): KTableS [K , V ] =
48+ inner.table[K , V ](topic, consumed, materialized)
4949
5050 def table [K , V ](topic : String ,
51- materialized : Materialized [K , V , KeyValueStore [Bytes , Array [Byte ]]]): KTableS [K , V ] =
51+ materialized : Materialized [K , V , KeyValueStore [Bytes , Array [Byte ]]]): KTableS [K , V ] =
5252 inner.table[K , V ](topic, materialized)
5353
5454 def globalTable [K , V ](topic : String ): GlobalKTable [K , V ] =
5555 inner.globalTable(topic)
5656
57- def globalTable [K , V ](topic : String , consumed : Consumed [K , V ]) : GlobalKTable [K , V ] =
58- inner.globalTable(topic, consumed)
57+ def globalTable [K , V ](topic : String , consumed : Consumed [K , V ]): GlobalKTable [K , V ] =
58+ inner.globalTable(topic, consumed)
5959
6060 def globalTable [K , V ](topic : String , consumed : Consumed [K , V ],
61- materialized : Materialized [K , V , KeyValueStore [Bytes , Array [Byte ]]]): GlobalKTable [K , V ] =
62- inner.globalTable(topic, consumed, materialized)
61+ materialized : Materialized [K , V , KeyValueStore [Bytes , Array [Byte ]]]): GlobalKTable [K , V ] =
62+ inner.globalTable(topic, consumed, materialized)
6363
6464 def globalTable [K , V ](topic : String ,
65- materialized : Materialized [K , V , KeyValueStore [Bytes , Array [Byte ]]]): GlobalKTable [K , V ] =
66- inner.globalTable(topic, materialized)
65+ materialized : Materialized [K , V , KeyValueStore [Bytes , Array [Byte ]]]): GlobalKTable [K , V ] =
66+ inner.globalTable(topic, materialized)
6767
6868 def addStateStore (builder : StoreBuilder [_ <: StateStore ]): StreamsBuilder = inner.addStateStore(builder)
6969
7070 def addGlobalStore (storeBuilder : StoreBuilder [_ <: StateStore ], topic : String , sourceName : String , consumed : Consumed [_, _], processorName : String , stateUpdateSupplier : ProcessorSupplier [_, _]): StreamsBuilder =
71- inner.addGlobalStore(storeBuilder,topic,sourceName,consumed,processorName,stateUpdateSupplier)
72-
73- def build () : Topology = inner.build()
74- }
75-
76- object StreamsBuilderS {
77-
78- def apply () = new StreamsBuilderS (new StreamsBuilder )
71+ inner.addGlobalStore(storeBuilder, topic, sourceName, consumed, processorName, stateUpdateSupplier)
7972
80- def apply ( streamsBuilder : StreamsBuilder ) = new StreamsBuilderS (streamsBuilder )
73+ def build () : Topology = inner.build( )
8174}
0 commit comments