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