GitHub user rhauch opened a pull request:
https://github.com/apache/kafka/pull/270
KAFKA-2600 Align Kafka Streams' interfaces with Java 8 functional interfaces
A few of Kafka Stream's interfaces and classes are not as well-aligned with
Java 8's functional interfaces. By making these changes, when Kafka moves to
Java 8 these classes can extend standard Java 8 functional interfaces while
remaining backward compatible. This will make it easier for developers to use
Kafka Streams, and may allow us to eventually remove these custom interfaces
and just use the standard Java 8 interfaces.
The changes include:
1. The 'apply' method of KStream's `Predicate` functional interface was
renamed to `test` to match the method name on `java.util.function.BiPredicate`.
This will allow KStream's `Predicate` to extend `BiPredicate` when Kafka moves
to Java 8, and for the `KStream.filter` and `filterOut` methods to accept
`BiPredicate`.
2. Renamed the `ProcessorDef` and `WindowDef` interfaces to
`ProcessorSupplier` and `WindowSupplier`, respectively. Also the
`SlidingWindowDef` class was renamed to `SlidingWindowSupplier`, and the
`MockProcessorDef` test class was renamed to `MockProcessorSupplier`. The
`instance()` method in all were renamed to `get()`, so that all of these can
extend/implement Java 8's `java.util.function.Supplier` interface in the
future with no other changes and while remaining backward compatible. Variable
names that used some form of "def" were changed to use "supplier".
These two sets of changes were made in separate commits.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/rhauch/kafka kafka-2600
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/kafka/pull/270.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #270
commit 0e88dce3e03ec6b8821f256490467d7baa8bf4b4
Author: Randall Hauch
Date: 2015-10-01T16:07:51Z
KAFKA-2600 Renamed the method of KStream's Predicate to match Java 8's
BiPredicate
The 'apply' method of KStream's Predicate functional interface was renamed
to 'test' to match the method name on java.util.function.BiPredicate. This will
allow KStream's Predicate to extend BiPredicate when Kafka moves to Java 8, and
for the KStream.filter and filterOut methods to accept BiPredicate, making it a
bit easier for developers to use KStream.
commit 07dc4571b5aac28ac63948a5626d65fd2a40eb82
Author: Randall Hauch
Date: 2015-10-01T16:25:12Z
KAFKA-2600 Renamed the *Def interfaces to *Supplier
To better align with Java 8's Supplier interface, the ProcessorDef,
WindowDef, and SlidingWindowDef interfaces/classes were renamed to
ProcessorSupplier, WindowSupplier, and SlidingWindowSupplier, and their
'instance' methods were renamed to 'get'.
When Kafka moves to Java 8, these interfaces/classes can extend/implement
Java 8's Supplier, and these interfaces can be eventually removed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---