brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: simplify yaml for averaging + sum...
Date Tue, 21 Apr 2015 16:02:46 GMT
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/605#discussion_r28793323
  
    --- Diff: core/src/main/java/brooklyn/enricher/Enrichers.java ---
    @@ -216,13 +219,25 @@ public B fromHardcodedProducers(Iterable<? extends Entity>
val) {
                 this.fromHardcodedProducers = ImmutableSet.copyOf(val);
                 return self();
             }
    +        @SuppressWarnings({ "unchecked", "rawtypes" })
             public B computing(Function<? super Collection<S>, ? extends T> val)
{
    -            this.computing = checkNotNull(val);
    +            this.computingSupplier = (Supplier)Suppliers.ofInstance(checkNotNull(val));
                 return self();
             }
    -        @SuppressWarnings({ "unchecked", "rawtypes" })
             public B computingSum() {
    -            // relies of TypeCoercion of result from Number to T, and type erasure for
us to get away with it!
    +            this.computingSupplier = new Supplier<Function<? super Collection<S>,
? extends T>>() {
    --- End diff --
    
    The `Supplier` is local to the builder, resolved before the spec is built, so I think
it's fine.  The `Function` itself is a static class.


---
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.
---

Mime
View raw message