Free cookie consent management tool by TermsFeed Policy Generator

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

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

#3026

  • code cleanup
File size: 717 bytes
Line 
1using System;
2using HeuristicLab.Core;
3using HeuristicLab.Data;
4
5namespace HeuristicLab.JsonInterface {
6  public class StringValueConverter : BaseConverter {
7    public override int Priority => 1;
8
9    public override bool CanConvertType(Type t) =>
10      typeof(StringValue).IsAssignableFrom(t);
11
12    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) =>
13      ((StringValue)item).Value = ((StringJsonItem)data).Value;
14
15    public override IJsonItem Extract(IItem value, IJsonItemConverter root) =>
16      new StringJsonItem() {
17        Name = value.ItemName,
18        Description = value.ItemDescription,
19        Value = ((StringValue)value).Value
20      };
21  }
22}
Note: See TracBrowser for help on using the repository browser.