/// <summary> /// Initializes a new instance of the <see cref="Field" /> class. /// </summary> /// <param name="node">The node associated with the symbol.</param> /// <param name="parent">The struct that contains this field.</param> /// <param name="fieldId">The field's Id.</param> /// <param name="rawFieldId">The raw text representing the field Id.</param> /// <param name="requiredness">The level of requiredness of the field.</param> /// <param name="name">The name of the field.</param> /// <param name="isFieldIdImplicit"> /// Indicates whether the field Id was generated automatically by the /// compiler rather than being explicitly defined in the IDL. /// </param> /// <param name="binderProvider">Used to get binders.</param> public Field( FieldContext node, IStruct parent, int?fieldId, string rawFieldId, FieldRequiredness requiredness, string name, bool isFieldIdImplicit, IBinderProvider binderProvider) : base(node, parent) { this.FieldId = fieldId; this.RawFieldId = rawFieldId; this.Requiredness = requiredness; this.Name = name; this.IsFieldIdImplicit = isFieldIdImplicit; this.binderProvider = binderProvider; }
protected Field SetupField( FieldContext fieldNode, Exception exception, int?fieldId = null, string name = null, FieldRequiredness requiredness = FieldRequiredness.Default) { var field = new FieldBuilder() .SetNode(fieldNode) .SetFieldId(fieldId) .SetRequiredness(requiredness) .SetName(name) .Build(); this.binderProvider.GetBinder(fieldNode).Returns(this.fieldBinder); this.fieldBinder.Bind <Field>(fieldNode, exception).Returns(field); return(field); }
/// <summary> /// Sets the requiredness of the field. /// </summary> /// <param name="requiredness">The requiredness of the field.</param> /// <returns>The field builder.</returns> public FieldBuilder SetRequiredness(FieldRequiredness requiredness) { this.Requiredness = requiredness; return(this); }