Exemplo n.º 1
0
        public override bool Equals(object obj)
        {
            ExtendableMessageLite <TMessage, TBuilder> other = obj as ExtendableMessageLite <TMessage, TBuilder>;

            return(!ReferenceEquals(null, other) &&
                   Dictionaries.Equals(extensions.AllFields, other.extensions.AllFields));
        }
        public TBuilder AddExtension <TExtension>(GeneratedExtensionLite <TMessage, IList <TExtension> > extension, TExtension value)
        {
            ExtendableMessageLite <TMessage, TBuilder> extendableMessageLite = this.MessageBeingBuilt;

            extendableMessageLite.VerifyExtensionContainingType <IList <TExtension> >(extension);
            extendableMessageLite.Extensions.AddRepeatedField(extension.Descriptor, extension.SingularToReflectionType(value));
            return(this.ThisBuilder);
        }
        /// <summary>
        /// Clears an extension.
        /// </summary>
        public TBuilder ClearExtension <TExtension>(GeneratedExtensionLite <TMessage, TExtension> extension)
        {
            ExtendableMessageLite <TMessage, TBuilder> message = MessageBeingBuilt;

            message.VerifyExtensionContainingType(extension);
            message.Extensions.ClearField(extension.Descriptor);
            return(ThisBuilder);
        }
        public TBuilder SetExtension <TExtension>(GeneratedExtensionLite <TMessage, IList <TExtension> > extension, int index, TExtension value)
        {
            ExtendableMessageLite <TMessage, TBuilder> extendableMessageLite = this.MessageBeingBuilt;

            extendableMessageLite.VerifyExtensionContainingType <IList <TExtension> >(extension);
            extendableMessageLite.Extensions[extension.Descriptor, index] = extension.SingularToReflectionType(value);
            return(this.ThisBuilder);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Sets the value of an extension.
        /// </summary>
        public TBuilder SetExtension <TExtension>(GeneratedExtensionLite <TMessage, TExtension> extension, TExtension value)
        {
            ExtendableMessageLite <TMessage, TBuilder> message = MessageBeingBuilt;

            message.VerifyExtensionContainingType(extension);
            message.Extensions[extension.Descriptor] = extension.ToReflectionType(value);
            return(ThisBuilder);
        }
Exemplo n.º 6
0
 internal ExtensionWriter(ExtendableMessageLite <TMessage, TBuilder> message)
 {
     extensions = message.extensions;
     iterator   = message.extensions.GetEnumerator();
     if (iterator.MoveNext())
     {
         next = iterator.Current;
     }
 }
Exemplo n.º 7
0
 internal ExtensionWriter(ExtendableMessageLite <TMessage, TBuilder> message)
 {
     this.extensions = message.extensions;
     this.iterator   = message.extensions.GetEnumerator();
     if (this.iterator.MoveNext())
     {
         this.next = new KeyValuePair <IFieldDescriptorLite, object>?(this.iterator.Current);
     }
 }
 public TBuilder AddRepeatedField(IFieldDescriptorLite field, object value)
 {
     if (field.IsExtension)
     {
         ExtendableMessageLite <TMessage, TBuilder> extendableMessageLite = this.MessageBeingBuilt;
         extendableMessageLite.Extensions.AddRepeatedField(field, value);
         return(this.ThisBuilder);
     }
     throw new NotSupportedException("Not supported in the lite runtime.");
 }
 public TBuilder ClearField(IFieldDescriptorLite field)
 {
     if (field.IsExtension)
     {
         ExtendableMessageLite <TMessage, TBuilder> message = MessageBeingBuilt;
         message.Extensions.ClearField(field);
         return(ThisBuilder);
     }
     else
     {
         throw new NotSupportedException("Not supported in the lite runtime.");
     }
 }
Exemplo n.º 10
0
 public object this[IFieldDescriptorLite field, int index]
 {
     set
     {
         if (field.IsExtension)
         {
             ExtendableMessageLite <TMessage, TBuilder> extendableMessageLite = this.MessageBeingBuilt;
             extendableMessageLite.Extensions[field, index] = value;
             return;
         }
         throw new NotSupportedException("Not supported in the lite runtime.");
     }
 }
Exemplo n.º 11
0
 public object this[IFieldDescriptorLite field] {
     set {
         if (field.IsExtension)
         {
             ExtendableMessageLite <TMessage, TBuilder> message = MessageBeingBuilt;
             message.Extensions[field] = value;
         }
         else
         {
             throw new NotSupportedException("Not supported in the lite runtime.");
         }
     }
 }
Exemplo n.º 12
0
 protected ExtensionWriter CreateExtensionWriter(ExtendableMessageLite <TMessage, TBuilder> message)
 {
     return(new ExtensionWriter(message));
 }
 protected void MergeExtensionFields(ExtendableMessageLite <TMessage, TBuilder> other)
 {
     MessageBeingBuilt.Extensions.MergeFrom(other.Extensions);
 }
Exemplo n.º 14
0
        public override bool Equals(object obj)
        {
            ExtendableMessageLite <TMessage, TBuilder> extendableMessageLite = obj as ExtendableMessageLite <TMessage, TBuilder>;

            return(!object.ReferenceEquals(null, extendableMessageLite) && Dictionaries.Equals <IFieldDescriptorLite, object>(this.extensions.AllFields, extendableMessageLite.extensions.AllFields));
        }