beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swegner <>
Subject [GitHub] incubator-beam pull request: [BEAM-134] Example of AutoValue integ...
Date Thu, 31 Mar 2016 22:27:59 GMT
GitHub user swegner opened a pull request:

    [BEAM-134] Example of AutoValue integration

    This is a sample for [\[BEAM-134\] Investigate use of AutoValue](
    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 autovalue-example

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 #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 or file a JIRA ticket
with INFRA.

View raw message