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
RevLine 
[17263]1using System;
2using HeuristicLab.Core;
3using HeuristicLab.Data;
4
[17284]5namespace HeuristicLab.JsonInterface {
[17281]6  public class StringValueConverter : BaseConverter {
[17394]7    public override int Priority => 1;
[17263]8
[17828]9    public override bool CanConvertType(Type t) =>
[17843]10      typeof(StringValue).IsAssignableFrom(t);
[17828]11
[17407]12    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) =>
[17410]13      ((StringValue)item).Value = ((StringJsonItem)data).Value;
[17394]14
[17407]15    public override IJsonItem Extract(IItem value, IJsonItemConverter root) =>
[17410]16      new StringJsonItem() {
[17473]17        Name = value.ItemName,
[17433]18        Description = value.ItemDescription,
[17407]19        Value = ((StringValue)value).Value
20      };
[17263]21  }
22}
Note: See TracBrowser for help on using the repository browser.