Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-136

SPI to add @Option Converters for custom types

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Done
    • Major
    • 2.0.0.Alpha2
    • 1.0.0.Alpha2
    • Plugin API, UI - Shell
    • None

    Description

      This process should be encapsulated with a Forge interface API, adapter, and ServiceLoader for extension.

         void init(@Observes final Startup event, final PluginCommandCompleter pluginCompleter) throws Exception
         {
            BooleanConverter booleanConverter = new BooleanConverter();
      
            addConversionHandler(boolean.class, booleanConverter);
            addConversionHandler(Boolean.class, booleanConverter);
            addConversionHandler(File.class, new FileConverter());
            addConversionHandler(Dependency.class, new DependencyIdConverter());
            addConversionHandler(URL.class, new URLConverter());
            ...
         }
      
      public interface OptionValueConverter<T> {
      
         public boolean supports(Class<?> type);
      
         public T convert(Object value);
      
      }
      

      This interface should support injection.

      Attachments

        Activity

          People

            lincolnthree Lincoln Baxter III (Inactive)
            lincolnthree Lincoln Baxter III (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: