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