diff options
author | Jon Skeet <skeet@pobox.com> | 2015-08-05 07:09:17 +0100 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2015-08-05 07:09:17 +0100 |
commit | d77d70d227b648ac8c36183ac9d85cf39f782978 (patch) | |
tree | 7763ffd6be6c84baa68431035b1e87fbc4c1d986 /csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs | |
parent | 95910f1c7dfa95b329c0b25a1b9beedbdc133800 (diff) | |
parent | 30e8157550e02625bb4a4fa93153442d6e454709 (diff) | |
download | protobuf-d77d70d227b648ac8c36183ac9d85cf39f782978.tar.gz protobuf-d77d70d227b648ac8c36183ac9d85cf39f782978.tar.bz2 protobuf-d77d70d227b648ac8c36183ac9d85cf39f782978.zip |
Merge pull request #691 from jskeet/xml-documentation
Document everything, and turn on errors if we fail to document anything in the future
Diffstat (limited to 'csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs')
-rw-r--r-- | csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs index 60f2bb8b..bb8e9bbb 100644 --- a/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs @@ -93,6 +93,15 @@ namespace Google.Protobuf.Reflection internal FieldDescriptorProto Proto { get { return proto; } } + /// <summary> + /// Returns the accessor for this field, or <c>null</c> if this descriptor does + /// not support reflective access. + /// </summary> + /// <remarks> + /// While a <see cref="FieldDescriptor"/> describes the field, it does not provide + /// any way of obtaining or changing the value of the field within a specific message; + /// that is the responsibility of the accessor. + /// </remarks> public IFieldAccessor Accessor { get { return accessor; } } /// <summary> @@ -141,43 +150,61 @@ namespace Google.Protobuf.Reflection default: throw new ArgumentException("Invalid type specified"); } - } + } + /// <summary> + /// Returns <c>true</c> if this field is a repeated field; <c>false</c> otherwise. + /// </summary> public bool IsRepeated { get { return Proto.Label == FieldDescriptorProto.Types.Label.LABEL_REPEATED; } } + /// <summary> + /// Returns <c>true</c> if this field is a map field; <c>false</c> otherwise. + /// </summary> public bool IsMap { get { return fieldType == FieldType.Message && messageType.Proto.Options != null && messageType.Proto.Options.MapEntry; } } + // TODO(jonskeet): Check whether this is correct with proto3, where we default to packed... + + /// <summary> + /// Returns <c>true</c> if this field is a packed, repeated field; <c>false</c> otherwise. + /// </summary> public bool IsPacked { get { return Proto.Options != null && Proto.Options.Packed; } } /// <summary> - /// Get the field's containing type. For extensions, this is the type being - /// extended, not the location where the extension was defined. See - /// <see cref="ExtensionScope" />. + /// Get the field's containing message type. /// </summary> public MessageDescriptor ContainingType { get { return containingType; } } + /// <summary> + /// Returns the oneof containing this field, or <c>null</c> if it is not part of a oneof. + /// </summary> public OneofDescriptor ContainingOneof { get { return containingOneof; } - } + } + /// <summary> + /// Returns the type of the field. + /// </summary> public FieldType FieldType { get { return fieldType; } } + /// <summary> + /// Returns the field number declared in the proto file. + /// </summary> public int FieldNumber { get { return Proto.Number; } |