Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/StringValueConverter.cs @ 17473

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

#3026:

  • refactored inheritance structure of json items, now the default JsonItem is an abstract class without properties Value and Range -> splitted up into new interfaces
  • updated view models for new json item structure
  • updated SingleLineArrayJsonWriter
File size: 831 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using HeuristicLab.Core;
7using HeuristicLab.Data;
8
9namespace HeuristicLab.JsonInterface {
10  public class StringValueConverter : BaseConverter {
11    public override int Priority => 1;
12    public override Type ConvertableType => typeof(StringValue);
13
14    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) =>
15      ((StringValue)item).Value = ((StringJsonItem)data).Value;
16
17    public override IJsonItem Extract(IItem value, IJsonItemConverter root) =>
18      new StringJsonItem() {
19        //Name = "[OverridableParamName]",
20        Name = value.ItemName,
21        Description = value.ItemDescription,
22        Value = ((StringValue)value).Value
23      };
24  }
25}
Note: See TracBrowser for help on using the repository browser.