Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/LookupParameterConverter.cs @ 17828

Last change on this file since 17828 was 17828, checked in by dpiringe, 3 years ago

#3026

  • removed the option to set the value for JsonItems via exporter
    • reworked some base controls
    • added new controls for JsonItem specific properties (e.g. ArrayResizable)
    • deleted a lot of obsolet controls
  • removed the Enable checkbox in the detail view of JsonItems
  • exporter now clones the IOptimizer object
  • added a check + message for unsupported exports
  • list of JsonItems now includes unsupported JsonItems (disabled and marked with 'unsupported')
  • refactored the converter type check
    • now every converter has to specify its supported type(s)
File size: 1.0 KB
RevLine 
[17266]1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using HeuristicLab.Core;
7
[17284]8namespace HeuristicLab.JsonInterface {
[17407]9  public class LookupParameterConverter : BaseConverter {
[17394]10    public override int Priority => 3;
11    public override Type ConvertableType => typeof(ILookupParameter);
[17828]12
13    public override bool CanConvertType(Type t) =>
14      t.GetInterfaces().Any(x => x == typeof(ILookupParameter));
15
[17407]16    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) =>
[17471]17      ((ILookupParameter)item).ActualName = ((ILookupJsonItem)data).ActualName as string;
[17266]18
[17407]19    public override IJsonItem Extract(IItem value, IJsonItemConverter root) {
20      IParameter parameter = value as IParameter;
[17394]21
[17471]22      IJsonItem item = new LookupJsonItem() {
[17407]23        Name = parameter.Name,
[17433]24        Description = parameter.Description,
[17407]25        ActualName = ((ILookupParameter)parameter).ActualName
26      };
27      return item;
28    }
[17266]29  }
30}
Note: See TracBrowser for help on using the repository browser.