Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/340#discussion_r80020866
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java ---
    @@ -1209,59 +1208,18 @@ public void remove(AttributeSensor<?> attribute) {
         public class BasicConfigurationSupport extends 
AbstractConfigurationSupportInternal {
     
             @Override
    -        public <T> T get(ConfigKey<T> key) {
    -            return configsInternal.getConfig(key);
    -        }
    -
    -        @Override
    -        public <T> T set(ConfigKey<T> key, T val) {
    +        protected <T> void assertValid(ConfigKey<T> key, T val) {
                 ConfigConstraints.assertValid(AbstractEntity.this, key, val);
    -            return setConfigInternal(key, val);
    -        }
    -
    -        @Override
    -        public <T> T set(ConfigKey<T> key, Task<T> val) {
    -            return setConfigInternal(key, val);
    -        }
    -
    -        @Override
    -        public ConfigBag getBag() {
    -            return configsInternal.getAllConfigBag();
    -        }
    -
    -        @Override
    -        public ConfigBag getLocalBag() {
    -            return configsInternal.getLocalConfigBag();
    -        }
    -
    -        @Override
    -        public Maybe<Object> getRaw(ConfigKey<?> key) {
    -            return configsInternal.getConfigRaw(key, true);
             }
    -
    -        @Override
    -        public Maybe<Object> getLocalRaw(ConfigKey<?> key) {
    -            return configsInternal.getConfigRaw(key, false);
    -        }
    -
    -        @Override
    -        public void addToLocalBag(Map<String, ?> vals) {
    -            configsInternal.addToLocalBag(vals);
    -        }
    -
    -        @Override
    -        public void removeFromLocalBag(String key) {
    -            configsInternal.removeFromLocalBag(key);
    +        
    +        protected AbstractConfigMapImpl<?> getConfigsInternal() {
    --- End diff --
    
    I like that pattern most places.  However if it is only protected usage and 
the return type is in an internal package I don't think there is any serious 
risk of confusion and it is not worth the burden of internal interfaces.  
(While not too hard to write it does make navigating the code much harder.)


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to