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 | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Threading.Tasks;
|
---|
6 | using HeuristicLab.Core;
|
---|
7 | using HeuristicLab.Data;
|
---|
8 |
|
---|
9 | namespace 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.