4using System.Collections.Generic;
6using System.Reflection;
36 IEnumerable<string> enumValues,
79 object[] attrs =
property.GetCustomAttributes(
true);
85 property.PropertyType,
92 return spec.WithLongName(property.Name.ToLowerInvariant());
103 property.PropertyType,
104 property.PropertyType.GetTypeInfo()
106 ? Enum.GetNames(property.PropertyType)
107 : Enumerable.Empty<
string>()
111 throw new InvalidOperationException();
The Maybe type models an optional value. A value of type Maybe a either contains a value of type a (r...
static OptionSpecification FromAttribute(OptionAttribute attribute, Type conversionType, IEnumerable< string > enumValues)
Specification(SpecificationType tag, bool required, Maybe< int > min, Maybe< int > max, Maybe< object > defaultValue, string helpText, string metaValue, IEnumerable< string > enumValues, Type conversionType, TargetType targetType, bool hidden=false)
static Specification FromProperty(PropertyInfo property)
Maybe< object > DefaultValue
Type ConversionType
This information is denormalized to decouple Specification from PropertyInfo.
IEnumerable< string > EnumValues
static ValueSpecification FromAttribute(ValueAttribute attribute, Type conversionType, IEnumerable< string > enumValues)
static IEnumerable< string > GetNamesOfEnum(Type t)
Models an option specification.
Models an value specification, or better how to handle values not bound to options.