Github user aledsage commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/589#discussion_r28204758
--- Diff: core/src/main/java/brooklyn/util/config/ConfigBag.java ---
@@ -96,14 +102,42 @@ public static ConfigBag newInstanceCopying(final
ConfigBag configBag) {
* (note: this applies even for values which are overridden and the
overridden value is used);
* however subsequent uses in the original set will not be marked here
*/
- public static ConfigBag newInstanceExtending(final ConfigBag
configBag, Map<?,?> flags) {
+ @Beta
+ public static ConfigBag newInstanceExtending(final ConfigBag
parentBag) {
+ return new ConfigBagExtendingParent(parentBag).copy(parentBag);
+ }
+
+ /** @see #newInstanceExtending(ConfigBag) */
+ public static class ConfigBagExtendingParent extends ConfigBag {
+ ConfigBag parentBag;
+ private ConfigBagExtendingParent(ConfigBag parentBag) {
+ this.parentBag = parentBag;
--- End diff --
Was a bit surprised this didn't do `copy(parentBag)`. Should we leave that
up to the caller, or do it inside `ConfigBagExtendingParent`'s constructor? I
lean towards the latter because otherwise it hasn't really extended it. But no
strong feelings.
---
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.
---