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