Github user tbouron commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/358#discussion_r81124231
--- 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 --
Thought about that but there is issue as you can have more than one
implementation of `Predicate` to do the same thing. In the case of `required`,
I have seen implemented as:
- `StringPredicates.isNonBlank()`
- `Predicates.notNull()`
And we could potential have others
---
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 [email protected] or file a JIRA ticket
with INFRA.
---