| | 1 | | using Newtonsoft.Json.Linq; |
| | 2 | | using ValidateLib.ErrorsAndWarnings.Errors; |
| | 3 | | using ValidateLib.ErrorsAndWarnings.Warnings; |
| | 4 | | using ValidateLib.Metadata.Descriptors; |
| | 5 | | using ValidateLib.Metadata.Parsers; |
| | 6 | | using ValidateLib.Metadata.Properties; |
| | 7 | |
|
| | 8 | |
|
| | 9 | | namespace ValidateLib.Metadata.PropertyParsers.DescriptorNS |
| | 10 | | { |
| | 11 | | public class IdPropertyParser : PropertyParserBase<Descriptor>, IPropertyParser<Descriptor> |
| | 12 | | { |
| 1 | 13 | | public IdPropertyParser(List<Warning> warnings, Descriptor descriptor) : base(warnings, descriptor) |
| | 14 | | { |
| 1 | 15 | | } |
| | 16 | |
|
| | 17 | | public void ParseProperty(JProperty property) |
| | 18 | | { |
| | 19 | |
|
| 1 | 20 | | if (property.Value.Type == JTokenType.String && property.Value.ToString().StartsWith("_:")) ErrorFactory.Thr |
| 1 | 21 | | var linkPropertyParser = new LinkPropertyParser(Warnings); |
| 1 | 22 | | var idValue = linkPropertyParser.ParseJToken(property.Value, property.Name); |
| 1 | 23 | | if (idValue == null) Descriptor.id = new LinkProperty(""); |
| 1 | 24 | | else Descriptor.id = idValue; |
| 1 | 25 | | } |
| | 26 | | } |
| | 27 | | } |