You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "Romain Manni-Bucau (JIRA)" <ji...@apache.org> on 2016/11/09 11:53:58 UTC
[jira] [Resolved] (DELTASPIKE-1220) add converter option to
@ConfigProperty
[ https://issues.apache.org/jira/browse/DELTASPIKE-1220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Romain Manni-Bucau resolved DELTASPIKE-1220.
--------------------------------------------
Resolution: Fixed
Assignee: Romain Manni-Bucau
https://git-wip-us.apache.org/repos/asf?p=deltaspike.git;a=commit;h=6d0c4a272cbef0e56dd1c60ea4b3f4e4069b8eca
> add converter option to @ConfigProperty
> ---------------------------------------
>
> Key: DELTASPIKE-1220
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-1220
> Project: DeltaSpike
> Issue Type: New Feature
> Reporter: Romain Manni-Bucau
> Assignee: Romain Manni-Bucau
> Fix For: 1.8.0
>
>
> This will configure a nomals-scoped bean class used to lookup a CDI bean used as converter for the configuration:
> {code}
> @Inject
> @ConfigProperty(name = "urlListFromProperties", converter = UrlList.class)
> private List<URL> urlListFromProperties;
> {code}
> assuming we have:
> {code}
> public class UrlList implements ConfigResolver.Converter<List<URL>>
> {
> @Override
> public List<URL> convert(final String value)
> {
> final List<URL> urls = new ArrayList<URL>();
> if (value != null)
> {
> for (final String segment : value.split(","))
> {
> try
> {
> urls.add(new URL(segment));
> }
> catch (final MalformedURLException e)
> {
> throw new IllegalArgumentException(e);
> }
> }
> }
> return urls;
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)