< Summary

Information
Class: ValidateLib.Metadata.Descriptors.InheritedPropertiesDescriptor
Assembly: validatelib.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\Descriptors\InheritedPropertiesDescriptor.cs
Line coverage
97%
Covered lines: 46
Uncovered lines: 1
Coverable lines: 47
Total lines: 113
Line coverage: 97.8%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\Descriptors\InheritedPropertiesDescriptor.cs

#LineLine coverage
 1using Newtonsoft.Json.Linq;
 2using ValidateLib.ErrorsAndWarnings.Warnings;
 3using ValidateLib.Metadata.Parsers;
 4using ValidateLib.Metadata.Properties;
 5using ValidateLib.Metadata.Properties.AtomicProperties;
 6using ValidateLib.Metadata.PropertyParsers;
 7using ValidateLib.Metadata.PropertyParsers.InheritedProperties;
 8
 9namespace ValidateLib.Metadata.Descriptors
 10{
 11    public class InheritedPropertiesDescriptor : CommonPropertiesDescriptor, Interfaces.IParsable<InheritedPropertiesDes
 12    {
 113        public URITemplateProperty? aboutURL { get; set; }
 114        public AtomicProperty<DatatypeDescriptor>? datatype { get; set; }
 115        public AtomicPropertyString? _default { get; set; } = new AtomicPropertyString("") { IsDefault = true };
 116        public AtomicPropertyString? lang { get; set; } = new AtomicPropertyString("und") { IsDefault = true };
 117        public AtomicPropertyArray<string>? _null { get; set; } = new AtomicPropertyArray<string>(new List<string>() { "
 118        public AtomicPropertyBoolean? ordered { get; set; } = new AtomicPropertyBoolean(false) { IsDefault = true };
 119        public URITemplateProperty? propertyUrl { get; set; }
 120        public AtomicPropertyBoolean? required { get; set; } = new AtomicPropertyBoolean(false) { IsDefault = true };
 121        public AtomicPropertyString? separator { get; set; } = new AtomicPropertyString(null) { IsDefault = true };
 122        public AtomicPropertyString? textDirection { get; set; } = new AtomicPropertyString("inherit") { IsDefault = tru
 123        public URITemplateProperty? valueUrl { get; set; }
 24
 25        new public static List<Warning> NormalizeProperty(JProperty property, Context context)
 26        {
 127            List<Warning> errors = new List<Warning>();
 128            if (CommonProperty.IsCommonProperty(property.Name)) return CommonProperty.Normalize(property.Value, context,
 129            switch (property.Name)
 30            {
 31                case "aboutUrl":
 32                case "default":
 33                case "lang":
 34                case "null":
 35                case "ordered":
 36                case "propertyUrl":
 37                case "required":
 38                case "separator":
 39                case "textDirection":
 40                case "valueUrl":
 141                    return errors;
 42                case "datatype":
 143                    return DatatypeDescriptor.Normalize(property.Value, context, property);
 44                default:
 145                    return ContextDescriptor.NormalizeProperty(property, context);
 46
 47            }
 48        }
 49
 50        new public IPropertyParserBase? GetPropertyParser(JProperty property, List<Warning> warnings)
 51        {
 152            string propertyName = property.Name;
 153            if (CommonProperty.IsCommonProperty(propertyName))
 54            {
 155                ((CommonPropertiesDescriptor)this).GetPropertyParser(property, warnings);
 56            }
 57            switch (propertyName)
 58            {
 59                case "aboutUrl":
 160                    return new AboutUrlPropertyParser(warnings, this);
 61                case "datatype":
 162                    return new DatatypePropertyParser(warnings, this);
 63                case "default":
 164                    return new DefaultPropertyParser(warnings, this);
 65                case "lang":
 166                    return new LangPropertyParser(warnings, this);
 67                case "null":
 168                    return new NullPropertyParser(warnings, this);
 69                case "ordered":
 170                    return new OrderedPropertyParser(warnings, this);
 71                case "propertyUrl":
 172                    return new PropertyUrlPropertyParser(warnings, this);
 73                case "required":
 174                    return new RequiredPropertyParser(warnings, this);
 75                case "separator":
 176                    return new SeparatorPropertyParser(warnings, this);
 77                case "textDirection":
 178                    return new TextDirectionPropertyParser(warnings, this);
 79                case "valueUrl":
 180                    return new ValueUrlPropertyParser(warnings, this);
 81                default:
 182                    return ((ContextDescriptor)this).GetPropertyParser(property, warnings);
 83            }
 84        }
 85
 86        public static IParser<InheritedPropertiesDescriptor> GetParser(List<Warning> warnings, InheritedPropertiesDescri
 87        {
 088            throw new NotImplementedException();
 89        }
 90
 91        public virtual void ProcessPassedInheritedProperties(InheritedPropertiesDescriptor descriptor)
 92        {
 193            if ((aboutURL is null || aboutURL.IsDefault) && descriptor.aboutURL is not null) aboutURL = descriptor.about
 194            if ((datatype is null || datatype.IsDefault) && descriptor.datatype is not null) datatype = descriptor.datat
 195            if ((_default is null || _default.IsDefault) && descriptor._default is not null) _default = descriptor._defa
 196            if ((lang is null || lang.IsDefault) && descriptor.lang is not null) lang = descriptor.lang;
 197            if ((_null is null || _null.IsDefault) && descriptor._null is not null) _null = descriptor._null;
 198            if ((ordered is null || ordered.IsDefault) && descriptor.ordered is not null) ordered = descriptor.ordered;
 199            if ((propertyUrl is null || propertyUrl.IsDefault) && descriptor.propertyUrl is not null) propertyUrl = desc
 1100            if ((required is null || required.IsDefault) && descriptor.required is not null) required = descriptor.requi
 1101            if ((separator is null || separator.IsDefault) && descriptor.separator is not null) separator = descriptor.s
 1102            if ((textDirection is null || textDirection.IsDefault) && descriptor.textDirection is not null) textDirectio
 1103            if ((valueUrl is null || valueUrl.IsDefault) && descriptor.valueUrl is not null) valueUrl = descriptor.value
 104
 1105            PassInheritedProperties();
 106
 1107        }
 108
 109        public virtual void PassInheritedProperties()
 110        {
 1111        }
 112    }
 113}

Methods/Properties

aboutURL()
aboutURL(ValidateLib.Metadata.Properties.URITemplateProperty)
datatype()
datatype(ValidateLib.Metadata.Properties.AtomicProperties.AtomicProperty<ValidateLib.Metadata.Descriptors.DatatypeDescriptor>)
_default()
_default(ValidateLib.Metadata.Properties.AtomicProperties.AtomicPropertyString)
InheritedPropertiesDescriptor()
lang()
lang(ValidateLib.Metadata.Properties.AtomicProperties.AtomicPropertyString)
_null()
_null(ValidateLib.Metadata.Properties.AtomicProperties.AtomicPropertyArray<string>)
ordered()
ordered(ValidateLib.Metadata.Properties.AtomicProperties.AtomicPropertyBoolean)
propertyUrl()
propertyUrl(ValidateLib.Metadata.Properties.URITemplateProperty)
required()
required(ValidateLib.Metadata.Properties.AtomicProperties.AtomicPropertyBoolean)
separator()
separator(ValidateLib.Metadata.Properties.AtomicProperties.AtomicPropertyString)
textDirection()
textDirection(ValidateLib.Metadata.Properties.AtomicProperties.AtomicPropertyString)
valueUrl()
valueUrl(ValidateLib.Metadata.Properties.URITemplateProperty)
NormalizeProperty(Newtonsoft.Json.Linq.JProperty, ValidateLib.Metadata.Descriptors.Context)
GetPropertyParser(Newtonsoft.Json.Linq.JProperty, System.Collections.Generic.List<ValidateLib.ErrorsAndWarnings.Warnings.Warning>)
GetParser(System.Collections.Generic.List<ValidateLib.ErrorsAndWarnings.Warnings.Warning>, ValidateLib.Metadata.Descriptors.InheritedPropertiesDescriptor)
ProcessPassedInheritedProperties(ValidateLib.Metadata.Descriptors.InheritedPropertiesDescriptor)
PassInheritedProperties()