brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #182: Change to Catalog API so that policy conf...
Date Mon, 06 Jun 2016 14:23:21 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/182#discussion_r65898229
  
    --- Diff: rest/rest-resources/src/main/java/org/apache/brooklyn/rest/transform/CatalogTransformer.java
---
    @@ -131,7 +132,11 @@ public static CatalogItemSummary catalogItemSummary(BrooklynRestResourceUtils
b,
         }
     
         public static CatalogPolicySummary catalogPolicySummary(BrooklynRestResourceUtils
b, CatalogItem<? extends Policy,PolicySpec<?>> item, UriBuilder ub) {
    -        Set<PolicyConfigSummary> config = ImmutableSet.of();
    +        final Set<PolicyConfigSummary> config = new HashSet<>();
    +        final PolicySpec<?> spec = (PolicySpec<?>) b.getCatalog().createSpec((CatalogItem)
item);
    +        for (final SpecParameter<?> input : spec.getParameters()){
    --- End diff --
    
    Parameters are already ordered and you lose the ordering with the `HashSet`. Suggest to
use `LinkedHashSet`. (for the case of = priority).
    The API doesn't actually guarantee ordering (it's a `Set`), but Javascript will keep it
anyway. Decided to keep it like this (for the entity case) and not introduce backward compatibility
issues until needed.



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