Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#63] A multi-value config get operation #64

Merged
merged 2 commits into from
Dec 14, 2018
Merged

Conversation

dmlloyd
Copy link
Contributor

@dmlloyd dmlloyd commented Dec 13, 2018

This is a possible implementation of #63.

@dmlloyd
Copy link
Contributor Author

dmlloyd commented Dec 13, 2018

Many collection classes have a constructor that takes a single integer which is a size hint; these collections types can be passed in using method references. For other cases, where the collection type has a no-arg constructor, there could be a Supplier<C> variant. The method would probably have to have a different name in order to disambiguate cases where the class provides both (which includes ArrayList and HashSet, two choices which are likely to be popular).

I don't think this is really necessary though. The most interesting size-less constructor is probably TreeSet - but in this case it is likely that the user will want to pass in a Comparator anyway.

Here are some usage examples, just using String items:

    List<String> list = getValues("my.list", String.class, ArrayList::new);
    Set<String> plainSet = getValues("my.set", String.class, HashSet::new);
    SortedSet<String> fancySet = getValues("my.fancy.set", String.class, s -> new TreeSet<>(String.CASE_INSENSITIVE_ORDER));

@kenfinnigan kenfinnigan merged commit 8369341 into smallrye:master Dec 14, 2018
@dmlloyd dmlloyd deleted the multi branch December 14, 2018 16:58
@jmesnil
Copy link
Contributor

jmesnil commented Dec 14, 2018

having some tests would have been great

@dmlloyd
Copy link
Contributor Author

dmlloyd commented Dec 14, 2018

"Possible implmentation" went to "final implementation" faster than expected :)

@jmesnil
Copy link
Contributor

jmesnil commented Dec 14, 2018

eh, that was my impression ;)

I'm adding them

@kenfinnigan
Copy link
Contributor

What can I say, I'm over eager

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants