| | 1 | | using Newtonsoft.Json.Linq; |
| | 2 | | using ValidateLib.ErrorsAndWarnings.Warnings; |
| | 3 | | using ValidateLib.Metadata.Descriptors.Interfaces; |
| | 4 | | using ValidateLib.Metadata.Parsers; |
| | 5 | | using ValidateLib.Metadata.PropertyParsers; |
| | 6 | | using ValidateLib.Metadata.PropertyParsers.DataType.Format; |
| | 7 | | using ValidateLib.Metadata.PropertyParsers.DescriptorNS; |
| | 8 | |
|
| | 9 | | namespace ValidateLib.Metadata.Descriptors |
| | 10 | | { |
| | 11 | | public class FormatDescriptor : Descriptor, Interfaces.IParsable<FormatDescriptor>, ITypable |
| | 12 | | { |
| 1 | 13 | | public string? decimalChar { get; set; } |
| 1 | 14 | | public string? groupChar { get; set; } |
| 1 | 15 | | public string? pattern { get; set; } |
| 1 | 16 | | public bool wasObject { get; set; } = false; |
| | 17 | | public static IParser<FormatDescriptor> GetParser(List<Warning> warnings, FormatDescriptor? descriptor = null) |
| | 18 | | { |
| 1 | 19 | | return new FormatParser(warnings); |
| | 20 | | } |
| | 21 | |
|
| 0 | 22 | | public new static string getTypeForTypeProperty() => "Datatype"; |
| | 23 | |
|
| | 24 | | public new IPropertyParserBase? GetPropertyParser(JProperty property, List<Warning> warnings) |
| | 25 | | { |
| 1 | 26 | | switch (property.Name) |
| | 27 | | { |
| | 28 | | case "decimalChar": |
| 1 | 29 | | return new DecimalCharPropertyParser(warnings, this); |
| | 30 | | case "groupChar": |
| 1 | 31 | | return new GroupCharPropertyParser(warnings, this); |
| | 32 | | case "pattern": |
| 1 | 33 | | return new PatternPropertyParser(warnings, this); |
| | 34 | | case "@type": |
| 0 | 35 | | return new TypePropertyParser<FormatDescriptor>(warnings, this); |
| | 36 | | default: |
| 0 | 37 | | warnings.Add(WarningFactory.GetUnknownPropertyWarning(property)); |
| 0 | 38 | | return null; |
| | 39 | | } |
| | 40 | | } |
| | 41 | | } |
| | 42 | | } |