/// <summary> /// Loads a <see cref="TsPropertySymbol" /> from the specified <see cref="TsPropertyMetadata" /> and <see cref="TsSymbolLookup" />. /// </summary> /// <param name="propertyMetadata">The property metadata.</param> /// <param name="symbolLookup">The symbol lookup.</param> /// <param name="options">The options.</param> /// <returns>A <see cref="TsPropertySymbol" />.</returns> /// <exception cref="NotSupportedException">The type {property.PropertyType.FullName} of {property.Name}</exception> internal static TsPropertySymbol LoadFrom(TsPropertyMetadata propertyMetadata, TsSymbolLookup symbolLookup, ISymbolLoadOptions options) { if (!symbolLookup.TryResolveSymbol(propertyMetadata.Property.PropertyType, out TsTypeSymbol type)) { throw new NotSupportedException($"The type {propertyMetadata.Property.PropertyType.FullName} of {propertyMetadata.Name} is not supported."); } string name = GetPropertyName(propertyMetadata.Property, options); return(new TsPropertySymbol(name, type, propertyMetadata)); }
/// <summary> /// Loads a <see cref="TsPropertySymbol" /> from the specified <see cref="PropertyInfo" /> and <see cref="TsSymbolLookup" />. /// </summary> /// <param name="property">The property.</param> /// <param name="symbolLookup">The symbol lookup.</param> /// <param name="options">The options.</param> /// <returns>A <see cref="TsPropertySymbol" />.</returns> /// <exception cref="NotSupportedException">The type {property.PropertyType.FullName} of {property.Name}</exception> internal static TsPropertySymbol LoadFrom(PropertyInfo property, TsSymbolLookup symbolLookup, ISymbolLoadOptions options) { TsPropertyMetadata propertyMetadata = TsPropertyMetadata.LoadFrom(property); return(LoadFrom(propertyMetadata, symbolLookup, options)); }
/// <summary> /// Initializes a new instance of the <see cref="TsPropertySymbol" /> class. /// </summary> /// <param name="name">The name.</param> /// <param name="type">The type.</param> /// <param name="propertyMetadata">The property metadata.</param> /// <exception cref="ArgumentNullException"></exception> internal TsPropertySymbol(string name, TsTypeSymbol type, TsPropertyMetadata propertyMetadata) { this.Name = name; this.Type = type ?? throw new ArgumentNullException(nameof(type)); this.PropertyMetadata = propertyMetadata ?? throw new ArgumentNullException(nameof(propertyMetadata)); }