You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2018/03/21 08:31:47 UTC

flink git commit: [hotfix] [core] Add @FunctionalInterface to KeySelector

Repository: flink
Updated Branches:
  refs/heads/master 023146025 -> 328f72d14


[hotfix] [core] Add @FunctionalInterface to KeySelector

That clarifies that this interface should always be a SAM interface
to allow that users created lambdas for its use.


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/328f72d1
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/328f72d1
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/328f72d1

Branch: refs/heads/master
Commit: 328f72d14ea88d082fbbaae9193065be575ef846
Parents: 0231460
Author: Stephan Ewen <se...@apache.org>
Authored: Tue Mar 20 15:43:33 2018 +0100
Committer: Stephan Ewen <se...@apache.org>
Committed: Tue Mar 20 21:25:25 2018 +0100

----------------------------------------------------------------------
 .../flink/api/java/functions/KeySelector.java    | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/328f72d1/flink-core/src/main/java/org/apache/flink/api/java/functions/KeySelector.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/functions/KeySelector.java b/flink-core/src/main/java/org/apache/flink/api/java/functions/KeySelector.java
index 4aa8469..5594f9e 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/functions/KeySelector.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/functions/KeySelector.java
@@ -27,19 +27,20 @@ import java.io.Serializable;
  * The {@link KeySelector} allows to use deterministic objects for operations such as
  * reduce, reduceGroup, join, coGroup, etc. If invoked multiple times on the same object,
  * the returned key must be the same.
- * 
- * The extractor takes an object and returns the deterministic key for that object.
+ *
+ * <p>The extractor takes an object and returns the deterministic key for that object.
  *
  * @param <IN> Type of objects to extract the key from.
  * @param <KEY> Type of key.
  */
 @Public
+@FunctionalInterface
 public interface KeySelector<IN, KEY> extends Function, Serializable {
 
 	/**
 	 * User-defined function that deterministically extracts the key from an object.
-	 * 
-	 * For example for a class:
+	 *
+	 * <p>For example for a class:
 	 * <pre>
 	 * 	public class Word {
 	 * 		String word;
@@ -48,19 +49,19 @@ public interface KeySelector<IN, KEY> extends Function, Serializable {
 	 * </pre>
 	 * The key extractor could return the word as
 	 * a key to group all Word objects by the String they contain.
-	 * 
-	 * The code would look like this
+	 *
+	 * <p>The code would look like this
 	 * <pre>
 	 * 	public String getKey(Word w) {
 	 * 		return w.word;
 	 * 	}
 	 * </pre>
-	 * 
+	 *
 	 * @param value The object to get the key from.
 	 * @return The extracted key.
-	 * 
+	 *
 	 * @throws Exception Throwing an exception will cause the execution of the respective task to fail,
-	 *                   and trigger recovery or cancellation of the program. 
+	 *                   and trigger recovery or cancellation of the program.
 	 */
 	KEY getKey(IN value) throws Exception;
 }