Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 17444 was 17433, checked in by dpiringe, 4 years ago

#3026:

  • added property Description in IJsonItem and updated all construction calls
  • updated UnsupportedJsonItem with unsupported property Description
  • updated JsonItemBaseControl and JsonItemVMBase for new property Description
File size: 890 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using HeuristicLab.Core;
7
8namespace HeuristicLab.JsonInterface {
9  public class LookupParameterConverter : BaseConverter {
10    public override int Priority => 3;
11    public override Type ConvertableType => typeof(ILookupParameter);
12   
13    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) =>
14      ((ILookupParameter)item).ActualName = data.ActualName as string;
15
16    public override IJsonItem Extract(IItem value, IJsonItemConverter root) {
17      IParameter parameter = value as IParameter;
18
19      IJsonItem item = new JsonItem() {
20        Name = parameter.Name,
21        Description = parameter.Description,
22        ActualName = ((ILookupParameter)parameter).ActualName
23      };
24      return item;
25    }
26  }
27}
Note: See TracBrowser for help on using the repository browser.