blob: 118052934d8889f7f2c8228fdbf771ad7b4609a2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
using System;
using Google.ProtocolBuffers.Descriptors;
namespace Google.ProtocolBuffers {
/// <summary>
/// Generated extension for a singular field.
/// </remarks>
public class GeneratedSingleExtension<TContainer, TExtension> : GeneratedExtensionBase<TContainer, TExtension>
where TContainer : IMessage<TContainer> {
internal GeneratedSingleExtension(FieldDescriptor descriptor) : base(descriptor) {
}
public static GeneratedSingleExtension<TContainer, TExtension> CreateInstance(FieldDescriptor descriptor) {
if (descriptor.IsRepeated) {
throw new ArgumentException("Must call GeneratedRepeateExtension.CreateInstance() for repeated types.");
}
return new GeneratedSingleExtension<TContainer, TExtension>(descriptor);
}
public override object FromReflectionType(object value) {
return base.SingularFromReflectionType(value);
}
}
}
|