/// <summary> /// Clears an extension. /// </summary> public TBuilder ClearExtension <TExtension>(GeneratedExtensionBase <TExtension> extension) { ExtendableMessage <TMessage, TBuilder> message = MessageBeingBuilt; message.VerifyExtensionContainingType(extension); message.Extensions.ClearField(extension.Descriptor); return(ThisBuilder); }
/// <summary> /// Sets the value of an extension. /// </summary> public TBuilder SetExtension <TExtension>(GeneratedExtensionBase <TExtension> extension, TExtension value) { ExtendableMessage <TMessage, TBuilder> message = MessageBeingBuilt; message.VerifyExtensionContainingType(extension); message.Extensions[extension.Descriptor] = extension.ToReflectionType(value); return(ThisBuilder); }
/// <summary> /// Appends a value to a repeated extension. /// </summary> public TBuilder AddExtension <TExtension>(GeneratedExtensionBase <IList <TExtension> > extension, TExtension value) { ExtendableMessage <TMessage, TBuilder> message = MessageBeingBuilt; message.VerifyExtensionContainingType(extension); message.Extensions.AddRepeatedField(extension.Descriptor, extension.SingularToReflectionType(value)); return(ThisBuilder); }
internal ExtensionWriter(ExtendableMessage <TMessage, TBuilder> message) { extensions = message.extensions; iterator = message.extensions.GetEnumerator(); if (iterator.MoveNext()) { next = iterator.Current; } }
public override TBuilder AddRepeatedField(FieldDescriptor field, object value) { if (field.IsExtension) { ExtendableMessage <TMessage, TBuilder> message = MessageBeingBuilt; message.VerifyContainingType(field); message.Extensions.AddRepeatedField(field, value); return(ThisBuilder); } else { return(base.AddRepeatedField(field, value)); } }
public override TBuilder ClearField(FieldDescriptor field) { if (field.IsExtension) { ExtendableMessage <TMessage, TBuilder> message = MessageBeingBuilt; message.VerifyContainingType(field); message.Extensions.ClearField(field); return(ThisBuilder); } else { return(base.ClearField(field)); } }
public override object this[FieldDescriptor field] { set { if (field.IsExtension) { ExtendableMessage <TMessage, TBuilder> message = MessageBeingBuilt; message.VerifyContainingType(field); message.Extensions[field] = value; } else { base[field] = value; } } }
protected ExtensionWriter CreateExtensionWriter(ExtendableMessage <TMessage, TBuilder> message) { return(new ExtensionWriter(message)); }
protected void MergeExtensionFields(ExtendableMessage <TMessage, TBuilder> other) { MessageBeingBuilt.Extensions.MergeFrom(other.Extensions); }