Last change
on this file since 18077 was
18077,
checked in by dpiringe, 2 years ago
|
#3026
- added the dockerhub readme file
- fixed a bug which caused changed values (changed by events) to be overwritten with wrong values
|
File size:
756 bytes
|
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 | if(data.Active)
|
---|
14 | ((StringValue)item).Value = ((StringJsonItem)data).Value;
|
---|
15 | }
|
---|
16 |
|
---|
17 |
|
---|
18 | public override IJsonItem Extract(IItem value, IJsonItemConverter root) =>
|
---|
19 | new StringJsonItem() {
|
---|
20 | Name = value.ItemName,
|
---|
21 | Description = value.ItemDescription,
|
---|
22 | Value = ((StringValue)value).Value
|
---|
23 | };
|
---|
24 | }
|
---|
25 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.