GitHub user ahgittin opened a pull request:

    https://github.com/apache/brooklyn-server/pull/982

    Improve coercions esp with generics

    previously when we coerced or resolved values even with config keys, we did 
not reliably obey generics.  now we do.  preserves previous behaviour except 
now can be a bit stricter when convering, e.g. `ConfigKey<Set<Integer>>` now is 
only allowed to contain integers (but strings will be converted; previously it 
could contain strings and wouldn't even attempt to convert them)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ahgittin/brooklyn-server misc-coercions

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/brooklyn-server/pull/982.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #982
    
----
commit b8f6264067934f694ab82cf87d7bc1ddb8ff130a
Author: Alex Heneveld <alex.heneveld@...>
Date:   2018-08-30T20:08:01Z

    better message when trying to use a method to coerce

commit ddc6c71489926ee1d6d5c1d6d51697a7b5d18495
Author: Alex Heneveld <alex.heneveld@...>
Date:   2018-08-30T20:08:24Z

    better message in some cases when constraint validation fails

commit 89c692e4951deb17cbca05567dea74ce2dd78860
Author: Alex Heneveld <alex.heneveld@...>
Date:   2018-08-30T23:24:32Z

    coercing from string to list can now handle objects
    
    now have two methods for parsing a list as a string, depending whether it 
wants object or string

commit 8d081d01a3bb6e0e48ba64f13a6d4485d9d3cad8
Author: Alex Heneveld <alex.heneveld@...>
Date:   2018-08-31T00:13:37Z

    no longer coerce things if generic parametrized types don't match
    
    previously we would return e.g. a List not containing T if List<T> was 
requested.
    this was deprecated and we would warn, but now we are stricter.

commit 3e57b14b220bd7a994a9143d83bc123879086aff
Author: Alex Heneveld <alex.heneveld@...>
Date:   2018-08-31T09:28:57Z

    respect generics better when coercing
    
    previous commit used yaml parse even for things like List<String>; now do 
string-list parse in that case.
    means the json adapters have access to the type token, but that means 
running them earlier and ensuring we
    do a re-coercion if needed.

commit 312131c8b4032d2c78831af825b96a05e36bce6b
Author: Alex Heneveld <alex.heneveld@...>
Date:   2018-08-31T10:15:34Z

    preserve generics info when resolving config keys, more places
    
    previously we converted to Class in places, losing generic info for 
resolution

commit e8fa71e03b5b42cedfa15ca4df18324cafe122cc
Author: Alex Heneveld <alex.heneveld@...>
Date:   2018-08-31T12:49:48Z

    improve coercion of items with generics, esp config keys
    
    previously config keys did not properly keep generic information for their 
contents;
    now this information is preserved and the results coerced as per the types.
    also enhances the ValueResolver to have clearer semantics when coercing 
generics in maps/iterables.

----


---

Reply via email to