brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tbouron <>
Subject [GitHub] incubator-brooklyn pull request: Add support for correct configkey...
Date Thu, 15 Oct 2015 11:22:28 GMT
Github user tbouron commented on a diff in the pull request:
    --- Diff: usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js ---
    @@ -85,6 +85,13 @@ define([
             if (entity.config && _.size(entity.config)) result["brooklyn.config"]
= entity.config;
             return result;
    +    function getConvertedConfigValue(value) {
    +        try {
    +            return $.parseJSON(value);
    +        } catch (e) {
    +            return value;
    --- End diff --
    I have examples of that. One of my clients uses `String` configkey only because of this
    Does it really matter to check at this stage the config key is != enum, string ? The CAMP
Java parser will convert to the correct type afterward. 
    For example, I have the following enum:
    public enum Product {
    and configuration key:
    ConfigKey<Product> PRODUCT = ConfigKeys.newConfigKey(Product.class, "product", "My
product", Product.A);
    If I put this in the UI `product: B`, the method `getConvertedConfigValue()` will return
'B' as a JS `String`. But the CAMP parser will still try to match that to my enum by calling
`Product.valueOf("B");` which will return the valid result.

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

View raw message