Github user neykov commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/462#discussion_r94777251
--- Diff:
api/src/main/java/org/apache/brooklyn/api/internal/AbstractBrooklynObjectSpec.java
---
@@ -147,27 +147,28 @@ public SpecT tagsReplace(Iterable<Object>
tagsToReplace) {
// it is a CatalogConfig or merely a config key, maybe introducing
displayable, or even priority
// (but note part of the reason for CatalogConfig.priority is that
java reflection doesn't preserve field order) .
// see also comments on the camp SpecParameterResolver.
+
+ // probably the thing to do is deprecate the ambiguous method in
favour of an explicit
@Beta
public SpecT parameters(List<? extends SpecParameter<?>> parameters) {
return parametersReplace(parameters);
}
- /** adds the given parameters */
+ /** adds the given parameters, new ones first so they dominate
subsequent ones */
@Beta
public SpecT parametersAdd(List<? extends SpecParameter<?>>
parameters) {
// parameters follows immutable pattern, unlike the other fields
Set<SpecParameter<?>> params =
MutableSet.<SpecParameter<?>>copyOf(parameters);
Set<SpecParameter<?>> current =
MutableSet.<SpecParameter<?>>copyOf(this.parameters);
current.removeAll(params);
- this.parameters = ImmutableList.<SpecParameter<?>>builder()
+ return parametersReplace(ImmutableList.<SpecParameter<?>>builder()
.addAll(params)
.addAll(current)
- .build();
- return self();
+ .build());
}
/** replaces parameters with the given */
@Beta
- public SpecT parametersReplace(List<? extends SpecParameter<?>>
parameters) {
+ public SpecT parametersReplace(Collection<? extends SpecParameter<?>>
parameters) {
--- End diff --
`parameters` are ordered - that's why the signature requires a `List`. It's
also consistent with the other two parameters related methods.
---
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.
---