Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItemConverterFactory.cs @ 17591

Last change on this file since 17591 was 17519, checked in by dpiringe, 5 years ago

#3026:

  • added error output for failed runner initialization
  • reorganised some final view models
  • TargetedJsonItemType (in JsonItemVMBase) now automatically returns the type of the defined JsonItem
  • code cleanup
  • refactored RegressionProblemDataConverter
  • added lots of comments
  • added new view for StringArrayJsonItem
  • added new UI component for concrete restricted items and used it in JsonItemConcreteItemArrayControl and JsonItemValidValuesControl
File size: 739 bytes
Line 
1using System;
2using System.Collections.Generic;
3using HeuristicLab.PluginInfrastructure;
4
5namespace HeuristicLab.JsonInterface {
6  public static class JsonItemConverterFactory {
7    private static IDictionary<Type, IJsonItemConverter> ConverterCache { get; set; }
8
9    public static JsonItemConverter Create() {
10      if (ConverterCache == null)
11        InitCache();
12      return new JsonItemConverter(ConverterCache);
13    }
14
15    private static void InitCache() {
16      ConverterCache = new Dictionary<Type, IJsonItemConverter>();
17      foreach (var converter in ApplicationManager.Manager.GetInstances<IJsonItemConverter>()) {
18        ConverterCache.Add(converter.ConvertableType, converter);
19      }
20    }
21  }
22}
Note: See TracBrowser for help on using the repository browser.