Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/StringValueConverter.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: 885 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 bool CanConvertType(Type t) =>
15      ConvertableType.IsAssignableFrom(t);
16
17    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) =>
18      ((StringValue)item).Value = ((StringJsonItem)data).Value;
19
20    public override IJsonItem Extract(IItem value, IJsonItemConverter root) =>
21      new StringJsonItem() {
22        Name = value.ItemName,
23        Description = value.ItemDescription,
24        Value = ((StringValue)value).Value
25      };
26  }
27}
Note: See TracBrowser for help on using the repository browser.