brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grkvlt <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Refactor config methods
Date Mon, 17 Nov 2014 13:21:22 GMT
Github user grkvlt commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/320#discussion_r20434339
  
    --- Diff: api/src/main/java/brooklyn/basic/BrooklynObject.java ---
    @@ -80,4 +86,51 @@
             boolean removeTag(@Nonnull Object tag);
         }
     
    +    @Beta
    +    public interface ConfigurationSupport {
    +
    +        /**
    +         * Gets the given configuration value for this entity, in the following order
of preference:
    +         * <ol>
    +         *   <li> value (including null) explicitly set on the entity
    +         *   <li> value (including null) explicitly set on an ancestor (inherited)
    +         *   <li> a default value (including null) on the best equivalent static
key of the same name declared on the entity
    +         *        (where best equivalence is defined as preferring a config key which
extends another, 
    +         *        as computed in EntityDynamicType.getConfigKeys)
    +         *   <li> a default value (including null) on the key itself
    +         *   <li> null
    +         * </ol>
    +         */
    +        <T> T get(ConfigKey<T> key);
    +        
    +        /**
    +         * @see {@link #getConfig(ConfigKey)}
    +         */
    +        <T> T get(HasConfigKey<T> key);
    +
    +        /**
    +         * Sets the config to the given value.
    +         */
    +        <T> T set(ConfigKey<T> key, T val);
    --- End diff --
    
    Should we support setting an `Object` value instead and doing type coercion if possible?


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