source:
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueLookupParameterConverter.cs
@
17287
Last change on this file since 17287 was 17287, checked in by dpiringe, 5 years ago | |
---|---|
File size: 955 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 | |
8 | namespace HeuristicLab.JsonInterface { |
9 | public class ValueLookupParameterConverter : ParameterBaseConverter { |
10 | public override JsonItem ExtractData(IParameter value) { |
11 | IValueLookupParameter param = value.Cast<IValueLookupParameter>(); |
12 | return new JsonItem() { |
13 | Name = value.Name, |
14 | Default = param.ActualName, |
15 | Reference = param.Value != null ? JsonItemConverter.Extract(param.Value) : null |
16 | }; |
17 | } |
18 | |
19 | public override void InjectData(IParameter parameter, JsonItem data) { |
20 | IValueLookupParameter param = parameter.Cast<IValueLookupParameter>(); |
21 | param.ActualName = CastValue<string>(data.Default); |
22 | if (param.Value != null && data.Reference != null) |
23 | JsonItemConverter.Inject(param.Value, data.Reference); |
24 | } |
25 | } |
26 | } |
Note: See TracBrowser
for help on using the repository browser.