beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [1/2] beam git commit: Add @FunctionalInterface annotation to several interfaces
Date Mon, 09 Oct 2017 18:55:17 GMT
Repository: beam
Updated Branches:
  refs/heads/master 5130cab4a -> 63de41ac2


Add @FunctionalInterface annotation to several interfaces

By adding the @FunctionalInterface to RowMapper, StatementPreperator and
PreparedStatementSetter it's possible to write a JdbcIO source in a
more concise and functional style.

This change is backwards compatible with existing JdbcIO sources.


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

Branch: refs/heads/master
Commit: c1bfe00f77bb3726fd7d8282cd1cf41ef2ddd99e
Parents: 5130cab
Author: Ward Van Assche <ward@piesync.com>
Authored: Tue Oct 3 15:13:22 2017 +0200
Committer: Eugene Kirpichov <kirpichov@google.com>
Committed: Mon Oct 9 11:42:00 2017 -0700

----------------------------------------------------------------------
 .../io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/c1bfe00f/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java
----------------------------------------------------------------------
diff --git a/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java b/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java
index 6ac6341..b134ec0 100644
--- a/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java
+++ b/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java
@@ -169,6 +169,7 @@ public class JdbcIO {
    * An interface used by {@link JdbcIO.Read} for converting each row of the {@link ResultSet}
into
    * an element of the resulting {@link PCollection}.
    */
+  @FunctionalInterface
   public interface RowMapper<T> extends Serializable {
     T mapRow(ResultSet resultSet) throws Exception;
   }
@@ -268,6 +269,7 @@ public class JdbcIO {
    * An interface used by the JdbcIO Write to set the parameters of the {@link PreparedStatement}
    * used to setParameters into the database.
    */
+  @FunctionalInterface
   public interface StatementPreparator extends Serializable {
     void setParameters(PreparedStatement preparedStatement) throws Exception;
   }
@@ -499,6 +501,7 @@ public class JdbcIO {
    * An interface used by the JdbcIO Write to set the parameters of the {@link PreparedStatement}
    * used to setParameters into the database.
    */
+  @FunctionalInterface
   public interface PreparedStatementSetter<T> extends Serializable {
     void setParameters(T element, PreparedStatement preparedStatement) throws Exception;
   }


Mime
View raw message