FieldDescriptor.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. 
  2. using System;
  3. namespace Google.ProtocolBuffers.Descriptors {
  4. public class FieldDescriptor {
  5. private EnumDescriptor enumType;
  6. public bool IsRequired {
  7. get;
  8. set;
  9. }
  10. public MappedType MappedType { get; set; }
  11. public bool IsRepeated { get; set; }
  12. public FieldType FieldType { get; set; }
  13. public int FieldNumber { get; set; }
  14. public bool IsExtension { get; set; }
  15. public MessageDescriptor ContainingType { get; set; }
  16. public string FullName { get; set; }
  17. public bool IsOptional { get; set; }
  18. public MessageDescriptor MessageType { get; set; }
  19. public MessageDescriptor ExtensionScope { get; set; }
  20. /// <summary>
  21. /// For enum fields, returns the field's type.
  22. /// </summary>
  23. public EnumDescriptor EnumType {
  24. get {
  25. if (MappedType != MappedType.Enum) {
  26. throw new InvalidOperationException("EnumType is only valid for enum fields.");
  27. }
  28. return enumType;
  29. }
  30. }
  31. /// <summary>
  32. /// The default value for this field. For repeated fields
  33. /// this will always be an empty list. For message fields it will
  34. /// always be null. For singular values, it will depend on the descriptor.
  35. /// </summary>
  36. public object DefaultValue
  37. {
  38. get { throw new NotImplementedException(); }
  39. }
  40. public string Name
  41. {
  42. get { throw new NotImplementedException(); }
  43. }
  44. }
  45. }