/// <summary> /// Adds a new option specification. /// </summary> /// <param name="requirementLevel">The requirement level of the entry to add.</param> /// <param name="nameKind">The name kind to consider.</param> /// <param name="aliases">Aliases of the option to add.</param> public IOptionSpecSet AddOption( RequirementLevels requirementLevel, OptionNameKind nameKind, params string[] aliases) { return(AddOption(DataValueTypes.Text, requirementLevel, nameKind, aliases)); }
/// <summary> /// Adds a new option specification. /// </summary> /// <param name="dataValueType">The value type to consider.</param> /// <param name="nameKind">The name kind to consider.</param> /// <param name="aliases">Aliases of the option to add.</param> public IOptionSpecSet AddOption( DataValueTypes dataValueType, OptionNameKind nameKind, params string[] aliases) { return(AddOption(dataValueType, RequirementLevels.Required, OptionNameKind.OnlyValue, aliases)); }
/// <summary> /// Adds a new option specification. /// </summary> /// <param name="type">The type to consider.</param> /// <param name="requirementLevel">The requirement level of the option to consider.</param> /// <param name="nameKind">The name kind to consider.</param> /// <param name="aliases">Aliases of the option to add.</param> public IOptionSpecSet AddOption( Type type, RequirementLevels requirementLevel, OptionNameKind nameKind, params string[] aliases) { return(AddOption(type.GetValueType(), requirementLevel, nameKind, aliases)); }
/// <summary> /// Adds a new option specification. /// </summary> /// <param name="dataValueType">The value type to consider.</param> /// <param name="requirementLevel">The requirement level of the entry to consider.</param> /// <param name="nameKind">The name kind to consider.</param> /// <param name="aliases">Aliases of the option to add.</param> public IOptionSpecSet AddOption( DataValueTypes dataValueType, RequirementLevels requirementLevel, OptionNameKind nameKind, params string[] aliases) { Add(new OptionSpec(dataValueType, requirementLevel, nameKind, aliases)); return(this); }
/// <summary> /// Instantiates a new instance of the OptionSpec class. /// </summary> /// <param name="dataValueType">The value type to consider.</param> /// <param name="requirementLevel">The requirement level of the entry to consider.</param> /// <param name="nameKind">The name kind to consider.</param> /// <param name="aliases">Aliases of the option to add.</param> public OptionSpec( DataValueTypes dataValueType, RequirementLevels requirementLevel, OptionNameKind nameKind, params string[] aliases) : base() { Aliases = (aliases ?? new string[1] { "{{*}}" }).ToList(); MinimumItemNumber = nameKind.HasValue() ? 1 : 0; MaximumItemNumber = nameKind.HasName() ? 0 : 1; RequirementLevel = requirementLevel; }
/// <summary> /// Instantiates a new instance of the OptionSpec class. /// </summary> /// <param name="type">The type to consider.</param> /// <param name="requirementLevel">The requirement level of the option to consider.</param> /// <param name="nameKind">The name kind to consider.</param> /// <param name="aliases">Aliases of the option to add.</param> public OptionSpec( Type type, RequirementLevels requirementLevel, OptionNameKind nameKind, params string[] aliases) : this(type.GetValueType(), requirementLevel, nameKind, aliases) { if (type?.IsEnum == true) { ConstraintStatement = new DataConstraintStatement(); ConstraintStatement.AddConstraint( null, "standard$" + KnownRoutineKind.ItemMustBeInList, ElementFactory.CreateSet( ElementFactory.CreateScalar(DataValueTypes.Text, type.GetEnumFields()))); } }
/// <summary> /// Instantiates a new instance of the OptionSpec class. /// </summary> /// <param name="requirementLevel">The requirement level of the entry to add.</param> /// <param name="nameKind">The name kind to consider.</param> /// <param name="aliases">Aliases of the option to add.</param> public OptionSpec( RequirementLevels requirementLevel, OptionNameKind nameKind, params string[] aliases) : this(DataValueTypes.Text, requirementLevel, nameKind, aliases) { }
/// <summary> /// Instantiates a new instance of the OptionSpec class. /// </summary> /// <param name="dataValueType">The value type to consider.</param> /// <param name="nameKind">The name kind to consider.</param> /// <param name="aliases">Aliases of the option to add.</param> public OptionSpec( DataValueTypes dataValueType, OptionNameKind nameKind, params string[] aliases) : this(dataValueType, RequirementLevels.Required, OptionNameKind.OnlyName, aliases) { }
/// <summary> /// Instantiates a new instance of the OptionSpec class. /// </summary> /// <param name="nameKind">The name kind to consider.</param> /// <param name="aliases">Aliases of the option to add.</param> public OptionSpec( OptionNameKind nameKind, params string[] aliases) : this(DataValueTypes.Text, RequirementLevels.Optional, OptionNameKind.OnlyName, aliases) { }
/// <summary> /// Indicates whether the specified kind has value. /// </summary> /// <param name="kind">The kind of the option name.</param> /// <returns>Returns true or false.</returns> public static bool HasValue(this OptionNameKind kind) { return(kind == OptionNameKind.NameThenValue || kind == OptionNameKind.NameWithValue || kind == OptionNameKind.OnlyValue); }