Last change
on this file since 17712 was
17477,
checked in by dpiringe, 5 years ago
|
#3026:
- refactored JsonTemplateInstantiator -> now returns a InstantiatorResult which contains the optimizer and an IEnumerable of IResultJsonItem
- code cleanup in JCGenerator
- relocated the serialization of json items into IJsonItem with method GenerateJObject (virtual base implementation in JsonItem)
- this allows custom serialization for json items (example: ValueLookupJsonItem)
- items of interface IIntervalRestrictedJsonItem have a custom implementation of GenerateJObject -> hides Minimum and Maximum if the values are the physically min/max of their type
- code cleanup in BaseConverter
|
File size:
741 bytes
|
Rev | Line | |
---|
[17263] | 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;
|
---|
[17353] | 7 | using HeuristicLab.Data;
|
---|
[17263] | 8 | using Newtonsoft.Json.Linq;
|
---|
| 9 |
|
---|
[17284] | 10 | namespace HeuristicLab.JsonInterface {
|
---|
[17281] | 11 | public abstract class BaseConverter : IJsonItemConverter
|
---|
[17263] | 12 | {
|
---|
[17394] | 13 | public abstract int Priority { get; }
|
---|
| 14 | public abstract Type ConvertableType { get; }
|
---|
| 15 |
|
---|
[17407] | 16 | public abstract void Inject(IItem item, IJsonItem data, IJsonItemConverter root);
|
---|
| 17 | public abstract IJsonItem Extract(IItem value, IJsonItemConverter root);
|
---|
[17394] | 18 |
|
---|
[17266] | 19 | #region Helper
|
---|
[17263] | 20 |
|
---|
| 21 | protected IItem Instantiate(Type type, params object[] args) =>
|
---|
| 22 | (IItem)Activator.CreateInstance(type,args);
|
---|
[17266] | 23 | #endregion
|
---|
[17263] | 24 | }
|
---|
| 25 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.