Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/17/20 12:33:35 (4 years ago)
Author:
dpiringe
Message:

#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:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/IntervalRestrictedArrayJsonItem.cs

    r17473 r17477  
    2020    }
    2121
    22     public override void SetFromJObject(JObject jObject) {
    23       base.SetFromJObject(jObject);
    24       Minimum = jObject[nameof(IIntervalRestrictedJsonItem<T>.Minimum)].ToObject<T>();
    25       Maximum = jObject[nameof(IIntervalRestrictedJsonItem<T>.Maximum)].ToObject<T>();
     22    public override void SetJObject(JObject jObject) {
     23      base.SetJObject(jObject);
     24
     25      var minProp = jObject[nameof(IIntervalRestrictedJsonItem<T>.Minimum)];
     26      if (minProp != null) Minimum = minProp.ToObject<T>();
     27
     28
     29      var maxProp = jObject[nameof(IIntervalRestrictedJsonItem<T>.Maximum)];
     30      if (maxProp != null) Maximum = maxProp.ToObject<T>();
    2631    }
    2732  }
Note: See TracChangeset for help on using the changeset viewer.