brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: TypeCoercions: support JSON strin...
Date Wed, 25 Jun 2014 00:04:17 GMT
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/14#discussion_r14163066
  
    --- Diff: core/src/main/java/brooklyn/util/flags/TypeCoercions.java ---
    @@ -581,6 +583,14 @@ public BigInteger apply(Integer input) {
             registerAdapter(String.class, Map.class, new Function<String,Map>() {
                 @Override
                 public Map<String, String> apply(final String input) {
    +                try {
    +                    if (input.charAt(0) == '{') {
    +                        // treat as JSON
    +                        return new ObjectMapper().readValue(input, Map.class);
    --- End diff --
    
    yaml parsing might be slightly nicer, allowing to drop double quotes when unambiguous,
but might mean promoting our yaml parser dependency.  up to you.  maybe add a comment to this
effect if not implementing.


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