Return-Path: X-Original-To: apmail-beam-commits-archive@minotaur.apache.org Delivered-To: apmail-beam-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D4CB2184A5 for ; Thu, 31 Mar 2016 22:28:03 +0000 (UTC) Received: (qmail 34581 invoked by uid 500); 31 Mar 2016 22:28:03 -0000 Delivered-To: apmail-beam-commits-archive@beam.apache.org Received: (qmail 34532 invoked by uid 500); 31 Mar 2016 22:28:03 -0000 Mailing-List: contact commits-help@beam.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@beam.incubator.apache.org Delivered-To: mailing list commits@beam.incubator.apache.org Received: (qmail 34523 invoked by uid 99); 31 Mar 2016 22:28:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Mar 2016 22:28:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 4575E18028D for ; Thu, 31 Mar 2016 22:28:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.021 X-Spam-Level: X-Spam-Status: No, score=-4.021 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id nL7vjGxFw1lp for ; Thu, 31 Mar 2016 22:28:01 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with SMTP id C7A265F217 for ; Thu, 31 Mar 2016 22:28:00 +0000 (UTC) Received: (qmail 34502 invoked by uid 99); 31 Mar 2016 22:28:00 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Mar 2016 22:28:00 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 023D6DFC75; Thu, 31 Mar 2016 22:27:59 +0000 (UTC) From: swegner To: commits@beam.incubator.apache.org Reply-To: commits@beam.incubator.apache.org Message-ID: Subject: [GitHub] incubator-beam pull request: [BEAM-134] Example of AutoValue integ... Content-Type: text/plain Date: Thu, 31 Mar 2016 22:27:59 +0000 (UTC) GitHub user swegner opened a pull request: https://github.com/apache/incubator-beam/pull/109 [BEAM-134] Example of AutoValue integration This is a sample for [\[BEAM-134\] Investigate use of AutoValue](https://issues.apache.org/jira/browse/BEAM-134) In the case of `IsmFormat`, there are four inner-classes used as immutable value types which can be simplified with AutoValue. Each of them demonstrate some interesting functionality: * `KeyPrefix` is the simplest of the bunch, and it's implementation basically disappears after conversion. * `IsmRecord` can act as two different types (value or metadata), and has validation logic in its getters they verify correct usage. In this case, we can keep the existing getter functionality and let AutoValue hook into separate package-private abstract properties. `IsmShard` is similar in this respect. * `Footer` provides has custom logic in its `.toString()` to include a version string. For other value classes, AutoValue will generate a `toString()` implementation compatible with the equivalent `Objects.toStringHelper` version. In this case, we can keep the existing implementation and AutoValue won't override it. As noted in the JIRA issue, I've identified 39 distinct classes which could be similarly converted. The benefits to converting are: * Less boilerplate code to maintain. * Eliminate a common source of bugs. * Lower the barrier to writing immutable value types, which carry their own benefits. I recommend we take this work. You can merge this pull request into a Git repository by running: $ git pull https://github.com/swegner/incubator-beam autovalue-example Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-beam/pull/109.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 #109 ---- commit 880a0685e3ff8e235cb9f046c4097e3f797e9760 Author: Scott Wegner Date: 2016-03-31T22:04:26Z Refactor IsmFormat value classes to use AutoValue ---- --- 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 infrastructure@apache.org or file a JIRA ticket with INFRA. ---