Last change
on this file since 17829 was
17828,
checked in by dpiringe, 3 years ago
|
#3026
- removed the option to set the value for JsonItems via exporter
- reworked some base controls
- added new controls for JsonItem specific properties (e.g. ArrayResizable)
- deleted a lot of obsolet controls
- removed the Enable checkbox in the detail view of JsonItems
- exporter now clones the IOptimizer object
- added a check + message for unsupported exports
- list of JsonItems now includes unsupported JsonItems (disabled and marked with 'unsupported')
- refactored the converter type check
- now every converter has to specify its supported type(s)
|
File size:
791 bytes
|
Line | |
---|
1 | using System.Collections;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 |
|
---|
5 | namespace HeuristicLab.JsonInterface {
|
---|
6 |
|
---|
7 | public abstract class ConcreteRestrictedValueJsonItem<T> : ValueJsonItem<T>, IConcreteRestrictedJsonItem<T> {
|
---|
8 |
|
---|
9 | public IEnumerable<T> ConcreteRestrictedItems { get; set; }
|
---|
10 |
|
---|
11 | protected override ValidationResult Validate() {
|
---|
12 | if (ConcreteRestrictedItems == null) return ValidationResult.Successful();
|
---|
13 | foreach (var x in ConcreteRestrictedItems)
|
---|
14 | if (Value.Equals(x)) return ValidationResult.Successful();
|
---|
15 | return ValidationResult.Faulty(
|
---|
16 | $"[{Path}]: Value {Value} is not one of the allowed values: " +
|
---|
17 | $"'{ string.Join(",", ConcreteRestrictedItems.Select(s => s.ToString()).ToArray()) }'.");
|
---|
18 | }
|
---|
19 | }
|
---|
20 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.