internal sealed override object ReadValue(EmberReader reader, out ParameterType?parameterType) { switch (reader.InnerNumber) { case InnerNumber.Boolean: parameterType = ParameterType.Boolean; return(reader.ReadContentsAsBoolean()); case InnerNumber.Integer: parameterType = ParameterType.Integer; return(reader.ReadContentsAsInt64()); case InnerNumber.Octetstring: parameterType = ParameterType.Octets; return(reader.ReadContentsAsByteArray()); case InnerNumber.Real: parameterType = ParameterType.Real; return(reader.ReadContentsAsDouble()); default: parameterType = ParameterType.String; return(reader.AssertAndReadContentsAsString()); } }
internal ParameterDefinitionsValue(ParameterType?type, IList <object> allowedValues, object defaultValue, ParameterDefinitionsValueMetadata metadata) { Type = type; AllowedValues = allowedValues; DefaultValue = defaultValue; Metadata = metadata; }
/// <summary> /// Initializes a new instance of the WorkflowParameter class. /// </summary> public WorkflowParameter(ParameterType?type = default(ParameterType?), object value = default(object), object metadata = default(object), string description = default(string)) { Type = type; Value = value; Metadata = metadata; Description = description; }
public void VerifyParameterType(string bicepFileContents, ParameterType?expected) { var programSyntax = ParserHelper.Parse(bicepFileContents); programSyntax.Should().NotBeNull(); var parameterDeclarationSyntax = programSyntax.Declarations.First() as ParameterDeclarationSyntax; parameterDeclarationSyntax.Should().NotBeNull(); var bicepFilePath = FileHelper.SaveResultFile(TestContext, "input.bicep", bicepFileContents); var bicepDeploymentParametersHandler = GetBicepDeploymentParametersHandler(bicepFilePath, string.Empty); var result = bicepDeploymentParametersHandler.GetParameterType(parameterDeclarationSyntax !); result.Should().Be(expected); }
private void SetFinalTytpe(ParameterType?valueType, ParameterType?enumType, ParameterType?typeType) { var finalType = this.type ?? (typeType == ParameterType.Trigger ? typeType : null) ?? enumType ?? valueType ?? typeType; if (finalType.HasValue) { this.Type = finalType.Value; } else { if (this.RetrieveDetails) { const string Format = "No enumeration, enumMap, value or type field is available for the parameter with the path {0}."; throw new ModelException(string.Format(CultureInfo.InvariantCulture, Format, this.GetPath())); } } }
public static JObject UpdateJObjectBasedOnParameterType(ParameterType?parameterType, string?value, JObject valueObject) { if (parameterType is not null) { if (parameterType == ParameterType.Int && value is not null && value.GetType() != typeof(int)) { var updatedValue = int.Parse(value); valueObject.Add("value", updatedValue); return(valueObject); } else if (parameterType == ParameterType.Bool && value is not null && value.GetType() != typeof(bool)) { var updatedValue = bool.Parse(value); valueObject.Add("value", updatedValue); return(valueObject); } }
internal override RetrievalState ReadContents(EmberReader reader, ElementType actualType) { this.AssertElementType(ElementType.Parameter, actualType); ParameterType?valueType = null; ParameterType?enumType = null; ParameterType?typeType = null; while (reader.Read() && (reader.InnerNumber != InnerNumber.EndContainer)) { ParameterType?dummyType; switch (reader.GetContextSpecificOuterNumber()) { case GlowParameterContents.Description.OuterNumber: this.Description = reader.AssertAndReadContentsAsString(); break; case GlowParameterContents.Value.OuterNumber: this.SetProviderValue(this.ReadValue(reader, out valueType)); break; case GlowParameterContents.Minimum.OuterNumber: this.SetMinimum(this.ReadValue(reader, out dummyType)); break; case GlowParameterContents.Maximum.OuterNumber: this.SetMaximum(this.ReadValue(reader, out dummyType)); break; case GlowParameterContents.Access.OuterNumber: this.Access = this.ReadEnum <ParameterAccess>(reader, GlowParameterContents.Access.Name); break; case GlowParameterContents.Format.OuterNumber: this.Format = reader.AssertAndReadContentsAsString(); break; case GlowParameterContents.Enumeration.OuterNumber: this.EnumMapCore = ReadEnumeration(reader); enumType = ParameterType.Enum; break; case GlowParameterContents.Factor.OuterNumber: this.FactorCore = this.ReadInt(reader, GlowParameterContents.Factor.Name); break; case GlowParameterContents.IsOnline.OuterNumber: this.IsOnline = reader.AssertAndReadContentsAsBoolean(); var send = (this.RetrieveDetailsChangeStatus == RetrieveDetailsChangeStatus.Changed) && this.RetrieveDetails && this.StreamIdentifier.HasValue; this.RetrievalState &= send ? RetrievalState.None : RetrievalState.Complete; break; case GlowParameterContents.Formula.OuterNumber: this.FormulaCore = reader.AssertAndReadContentsAsString(); break; case GlowParameterContents.Step.OuterNumber: this.ReadInt(reader, GlowParameterContents.Step.Name); break; case GlowParameterContents.Default.OuterNumber: this.DefaultValue = this.ReadValue(reader, out dummyType); break; case GlowParameterContents.Type.OuterNumber: typeType = this.ReadEnum <ParameterType>(reader, GlowParameterContents.Type.Name); break; case GlowParameterContents.StreamIdentifier.OuterNumber: this.StreamIdentifier = this.ReadInt(reader, GlowParameterContents.StreamIdentifier.Name); break; case GlowParameterContents.EnumMap.OuterNumber: this.EnumMapCore = this.ReadEnumMap(reader); enumType = ParameterType.Enum; break; case GlowParameterContents.StreamDescriptor.OuterNumber: this.StreamDescriptor = this.ReadStreamDescriptor(reader); break; case GlowParameterContents.SchemaIdentifiers.OuterNumber: this.ReadSchemaIdentifiers(reader); break; default: reader.Skip(); break; } } this.SetFinalTytpe(valueType, enumType, typeType); return(this.RetrievalState); }
internal abstract TValue ReadValue(EmberReader reader, out ParameterType?parameterType);
internal static string ToSerializedValue(this ParameterType? value) { return value == null ? null : ((ParameterType)value).ToSerializedValue(); }
internal sealed override byte[] ReadValue(EmberReader reader, out ParameterType?parameterType) { parameterType = ParameterType.Octets; return(reader.AssertAndReadContentsAsByteArray()); }
/// <summary> /// Initializes a new instance of the WorkflowOutputParameter class. /// </summary> public WorkflowOutputParameter(ParameterType?type = default(ParameterType?), object value = default(object), object metadata = default(object), string description = default(string), object error = default(object)) : base(type, value, metadata, description) { Error = error; }
internal sealed override TEnum?ReadValue(EmberReader reader, out ParameterType?parameterType) { parameterType = ParameterType.Enum; return(FastEnum.ToEnum <TEnum>(reader.AssertAndReadContentsAsInt64())); }
internal sealed override bool?ReadValue(EmberReader reader, out ParameterType?parameterType) { parameterType = ParameterType.Boolean; return(reader.AssertAndReadContentsAsBoolean()); }
internal sealed override string ReadValue(EmberReader reader, out ParameterType?parameterType) { parameterType = ParameterType.String; return(reader.AssertAndReadContentsAsString()); }
private bool IsOfTypeArrayOrObject(ParameterType?parameterType) { return(parameterType is not null && (parameterType == ParameterType.Array || parameterType == ParameterType.Object)); }
internal sealed override double?ReadValue(EmberReader reader, out ParameterType?parameterType) { parameterType = ParameterType.Real; return(reader.AssertAndReadContentsAsDouble()); }
internal sealed override long?ReadValue(EmberReader reader, out ParameterType?parameterType) { parameterType = ParameterType.Integer; return(reader.AssertAndReadContentsAsInt64()); }
private record Dto( ParameterType?___ParameterType, JToken Config);