| OLD | NEW |
| (Empty) |
| 1 using System; | |
| 2 | |
| 3 namespace Google.Protobuf.Reflection | |
| 4 { | |
| 5 /// <summary> | |
| 6 /// Extra information provided by generated code when initializing a message
or file descriptor. | |
| 7 /// These are constructed as required, and are not long-lived. Hand-written
code should | |
| 8 /// never need to use this type. | |
| 9 /// </summary> | |
| 10 public sealed class GeneratedCodeInfo | |
| 11 { | |
| 12 private static readonly string[] EmptyNames = new string[0]; | |
| 13 private static readonly GeneratedCodeInfo[] EmptyCodeInfo = new Generate
dCodeInfo[0]; | |
| 14 | |
| 15 /// <summary> | |
| 16 /// Irrelevant for file descriptors; the CLR type for the message for me
ssage descriptors. | |
| 17 /// </summary> | |
| 18 public Type ClrType { get; private set; } | |
| 19 | |
| 20 /// <summary> | |
| 21 /// Irrelevant for file descriptors; the CLR property names (in message
descriptor field order) | |
| 22 /// for fields in the message for message descriptors. | |
| 23 /// </summary> | |
| 24 public string[] PropertyNames { get; private set; } | |
| 25 | |
| 26 /// <summary> | |
| 27 /// Irrelevant for file descriptors; the CLR property "base" names (in m
essage descriptor oneof order) | |
| 28 /// for oneofs in the message for message descriptors. It is expected th
at for a oneof name of "Foo", | |
| 29 /// there will be a "FooCase" property and a "ClearFoo" method. | |
| 30 /// </summary> | |
| 31 public string[] OneofNames { get; private set; } | |
| 32 | |
| 33 /// <summary> | |
| 34 /// The reflection information for types within this file/message descri
ptor. Elements may be null | |
| 35 /// if there is no corresponding generated type, e.g. for map entry type
s. | |
| 36 /// </summary> | |
| 37 public GeneratedCodeInfo[] NestedTypes { get; private set; } | |
| 38 | |
| 39 /// <summary> | |
| 40 /// The CLR types for enums within this file/message descriptor. | |
| 41 /// </summary> | |
| 42 public Type[] NestedEnums { get; private set; } | |
| 43 | |
| 44 /// <summary> | |
| 45 /// Creates a GeneratedCodeInfo for a message descriptor, with nested ty
pes, nested enums, the CLR type, property names and oneof names. | |
| 46 /// Each array parameter may be null, to indicate a lack of values. | |
| 47 /// The parameter order is designed to make it feasible to format the ge
nerated code readably. | |
| 48 /// </summary> | |
| 49 public GeneratedCodeInfo(Type clrType, string[] propertyNames, string[]
oneofNames, Type[] nestedEnums, GeneratedCodeInfo[] nestedTypes) | |
| 50 { | |
| 51 NestedTypes = nestedTypes ?? EmptyCodeInfo; | |
| 52 NestedEnums = nestedEnums ?? ReflectionUtil.EmptyTypes; | |
| 53 ClrType = clrType; | |
| 54 PropertyNames = propertyNames ?? EmptyNames; | |
| 55 OneofNames = oneofNames ?? EmptyNames; | |
| 56 } | |
| 57 | |
| 58 /// <summary> | |
| 59 /// Creates a GeneratedCodeInfo for a file descriptor, with only types a
nd enums. | |
| 60 /// </summary> | |
| 61 public GeneratedCodeInfo(Type[] nestedEnums, GeneratedCodeInfo[] nestedT
ypes) | |
| 62 : this(null, null, null, nestedEnums, nestedTypes) | |
| 63 { | |
| 64 } | |
| 65 } | |
| 66 } | |
| OLD | NEW |