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 #358: Allow REST API to return the config key's...
Date Thu, 29 Sep 2016 12:32:42 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/358#discussion_r81124997
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/config/BasicConfigKey.java ---
    @@ -331,12 +337,19 @@ public ConfigInheritance getParentInheritance() {
             return parentInheritance;
         }
     
    +    /** @see ConfigKey#getConstraints() */
    +    @Nonnull
    +    @Override
    +    public Map<String, Predicate<? super T>> getConstraints() {
    +        return constraints;
    +    }
    +
         /** @see ConfigKey#getConstraint() */
         @Override @Nonnull
         public Predicate<? super T> getConstraint() {
             // Could be null after rebinding
    -        if (constraint != null) {
    -            return constraint;
    +        if (constraints.size() > 0) {
    +            return Predicates.and(constraints.values());
             } else {
                 return Predicates.alwaysTrue();
             }
    --- End diff --
    
    What we care about is the "required" as implemented in yaml (`isNonBlank`). It's enought
to support that, but could easily add some more to a white-list. Also alias to it as a "required"
predicate to be used in Java if anyone wants to integrate with UI better from Java land.
    
    Also keep in mind backwards compatibility (always :) ). Instead of changing the API straight
away we'd have to go through a deprecation cycle where the old signatures are still supported.
 That's one more reason why stick to the existing non-labeled predicates.


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