You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2019/08/11 02:15:26 UTC

[pulsar] branch master updated: [site2] fix Function classname importing (#4924)

This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new bdfefc7  [site2] fix Function classname importing (#4924)
bdfefc7 is described below

commit bdfefc72e51c71d88822e727a1bb324ae42c4683
Author: Luo Tian <lt...@basecity.com>
AuthorDate: Sun Aug 11 10:15:20 2019 +0800

    [site2] fix Function classname importing (#4924)
    
    ### Motivation
    
    The code snippets in functions documentation are wrong: `Function` class of java native is from package `java.util.function` instead of `java.util`.
    
    ### Modifications
    
    in 2 markdown file, corrected 2 java source snippets.
---
 site2/docs/functions-api.md      | 12 ++++++------
 site2/docs/functions-overview.md |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/site2/docs/functions-api.md b/site2/docs/functions-api.md
index 4d4c040..bfd7ce7 100644
--- a/site2/docs/functions-api.md
+++ b/site2/docs/functions-api.md
@@ -153,8 +153,8 @@ class WordFilter(Function):
 
 Writing Pulsar Functions in Java involves implementing one of two interfaces:
 
-* The [`java.util.Function`](https://docs.oracle.com/javase/8/docs/api/java/util/function/Function.html) interface
-* The {@inject: javadoc:Function:/pulsar-functions/org/apache/pulsar/functions/api/Function} interface. This interface works much like the `java.util.Function` interface, but with the important difference that it provides a {@inject: javadoc:Context:/pulsar-functions/org/apache/pulsar/functions/api/Context} object that you can use in a [variety of ways](#context)
+* The [`java.util.function.Function`](https://docs.oracle.com/javase/8/docs/api/java/util/function/Function.html) interface
+* The {@inject: javadoc:Function:/pulsar-functions/org/apache/pulsar/functions/api/Function} interface. This interface works much like the `java.util.function.Function` interface, but with the important difference that it provides a {@inject: javadoc:Context:/pulsar-functions/org/apache/pulsar/functions/api/Context} object that you can use in a [variety of ways](#context)
 
 ### Get started
 
@@ -187,14 +187,14 @@ How you get started writing Pulsar Functions in Java depends on which API you're
 
 #### Packaging
 
-Whether you're writing Java Pulsar Functions using the [native](#java-native-functions) Java `java.util.Function` interface or using the [Java SDK](#java-sdk-functions), you'll need to package your function(s) as a "fat" JAR.
+Whether you're writing Java Pulsar Functions using the [native](#java-native-functions) Java `java.util.function.Function` interface or using the [Java SDK](#java-sdk-functions), you'll need to package your function(s) as a "fat" JAR.
 
 > #### Starter repo
 > If you'd like to get up and running quickly, you can use [this repo](https://github.com/streamlio/pulsar-functions-java-starter), which contains the necessary Maven configuration to build a fat JAR as well as some example functions.
 
 ### Java native functions
 
-If your function doesn't require access to its [context](#context), you can create a Pulsar Function by implementing the [`java.util.Function`](https://docs.oracle.com/javase/8/docs/api/java/util/function/Function.html) interface, which has this very simple, single-method signature:
+If your function doesn't require access to its [context](#context), you can create a Pulsar Function by implementing the [`java.util.function.Function`](https://docs.oracle.com/javase/8/docs/api/java/util/function/Function.html) interface, which has this very simple, single-method signature:
 
 ```java
 public interface Function<I, O> {
@@ -205,11 +205,11 @@ public interface Function<I, O> {
 Here's an example function that takes a string as its input, adds an exclamation point to the end of the string, and then publishes the resulting string:
 
 ```java
-import java.util.Function;
+import java.util.function.Function;
 
 public class ExclamationFunction implements Function<String, String> {
     @Override
-    public String process(String input) {
+    public String apply(String input) {
         return String.format("%s!", input);
     }
 }
diff --git a/site2/docs/functions-overview.md b/site2/docs/functions-overview.md
index bc051a4..98793c5 100644
--- a/site2/docs/functions-overview.md
+++ b/site2/docs/functions-overview.md
@@ -13,7 +13,7 @@ sidebar_label: Overview
 The following is an example of a Pulsar Function written in Java (using the [native interface](functions-api.md#java-native-functions)).
 
 ```java
-import java.util.Function;
+import java.util.function.Function;
 
 public class ExclamationFunction implements Function<String, String> {
     @Override