Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-1220

add converter option to @ConfigProperty

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.8.0
    • None
    • None

    Description

      This will configure a nomals-scoped bean class used to lookup a CDI bean used as converter for the configuration:

          @Inject
          @ConfigProperty(name = "urlListFromProperties", converter = UrlList.class)
          private List<URL> urlListFromProperties;
      

      assuming we have:

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

      Attachments

        Activity

          People

            romain.manni-bucau Romain Manni-Bucau
            romain.manni-bucau Romain Manni-Bucau
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: