kafka-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KAFKA-2600) Make KStream interfaces compatible with Java 8 java.util.function
Date Thu, 01 Oct 2015 17:16:27 GMT

    [ https://issues.apache.org/jira/browse/KAFKA-2600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14940085#comment-14940085

ASF GitHub Bot commented on KAFKA-2600:

GitHub user rhauch opened a pull request:


    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<T>` 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:


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 <rhauch@gmail.com>
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 <rhauch@gmail.com>
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.


> Make KStream interfaces compatible with Java 8 java.util.function
> -----------------------------------------------------------------
>                 Key: KAFKA-2600
>                 URL: https://issues.apache.org/jira/browse/KAFKA-2600
>             Project: Kafka
>          Issue Type: Sub-task
>            Reporter: Guozhang Wang
>            Assignee: Randall Hauch
> As suggested by [~rhauch], if we make the interface method names as the same to java.util.function.[Functions]:
> https://docs.oracle.com/javase/8/docs/api/java/util/function/package-summary.html
> Then we can migrate to Java8 later by simply extending them and not requiring a re-compile
on the user side.

This message was sent by Atlassian JIRA

View raw message