add back GetOption methods, but mark them as obsolete

pull/7434/head
Jan Tattermusch 5 years ago
parent f4ff22026b
commit 062c2dc24b
  1. 19
      csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs
  2. 19
      csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs
  3. 19
      csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
  4. 19
      csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs
  5. 19
      csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs
  6. 19
      csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs
  7. 19
      csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs
  8. 19
      csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs

@ -137,5 +137,24 @@ namespace Google.Protobuf.Reflection
/// NOTE: A defensive copy is created each time this property is retrieved.
/// </summary>
public EnumOptions Options => (Proto.Options as IDeepCloneable<EnumOptions>)?.Clone();
/// <summary>
/// Gets a single value enum option for this descriptor
/// </summary>
[Obsolete("GetOption is obsolete. Use the Options property.")]
public T GetOption<T>(Extension<EnumOptions, T> extension)
{
var value = Proto.Options.GetExtension(extension);
return value is IDeepCloneable<T> ? (value as IDeepCloneable<T>).Clone() : value;
}
/// <summary>
/// Gets a repeated value enum option for this descriptor
/// </summary>
[Obsolete("GetOption is obsolete. Use the Options property.")]
public RepeatedField<T> GetOption<T>(RepeatedExtension<EnumOptions, T> extension)
{
return Proto.Options.GetExtension(extension).Clone();
}
}
}

@ -82,6 +82,25 @@ namespace Google.Protobuf.Reflection
/// NOTE: A defensive copy is created each time this property is retrieved.
/// </summary>
public EnumValueOptions Options => (Proto.Options as IDeepCloneable<EnumValueOptions>)?.Clone();
/// <summary>
/// Gets a single value enum value option for this descriptor
/// </summary>
[Obsolete("GetOption is obsolete. Use the Options property.")]
public T GetOption<T>(Extension<EnumValueOptions, T> extension)
{
var value = Proto.Options.GetExtension(extension);
return value is IDeepCloneable<T> ? (value as IDeepCloneable<T>).Clone() : value;
}
/// <summary>
/// Gets a repeated value enum value option for this descriptor
/// </summary>
[Obsolete("GetOption is obsolete. Use the Options property.")]
public RepeatedField<T> GetOption<T>(RepeatedExtension<EnumValueOptions, T> extension)
{
return Proto.Options.GetExtension(extension).Clone();
}
}
}

@ -314,6 +314,25 @@ namespace Google.Protobuf.Reflection
/// </summary>
public FieldOptions Options => (Proto.Options as IDeepCloneable<FieldOptions>)?.Clone();
/// <summary>
/// Gets a single value field option for this descriptor
/// </summary>
[Obsolete("GetOption is obsolete. Use the Options property.")]
public T GetOption<T>(Extension<FieldOptions, T> extension)
{
var value = Proto.Options.GetExtension(extension);
return value is IDeepCloneable<T> ? (value as IDeepCloneable<T>).Clone() : value;
}
/// <summary>
/// Gets a repeated value field option for this descriptor
/// </summary>
[Obsolete("GetOption is obsolete. Use the Options property.")]
public RepeatedField<T> GetOption<T>(RepeatedExtension<FieldOptions, T> extension)
{
return Proto.Options.GetExtension(extension).Clone();
}
/// <summary>
/// Look up and cross-link all field types etc.
/// </summary>

@ -557,6 +557,25 @@ namespace Google.Protobuf.Reflection
/// </summary>
public FileOptions Options => (Proto.Options as IDeepCloneable<FileOptions>)?.Clone();
/// <summary>
/// Gets a single value file option for this descriptor
/// </summary>
[Obsolete("GetOption is obsolete. Use the Options property.")]
public T GetOption<T>(Extension<FileOptions, T> extension)
{
var value = Proto.Options.GetExtension(extension);
return value is IDeepCloneable<T> ? (value as IDeepCloneable<T>).Clone() : value;
}
/// <summary>
/// Gets a repeated value file option for this descriptor
/// </summary>
[Obsolete("GetOption is obsolete. Use the Options property.")]
public RepeatedField<T> GetOption<T>(RepeatedExtension<FileOptions, T> extension)
{
return Proto.Options.GetExtension(extension).Clone();
}
/// <summary>
/// Performs initialization for the given generic type argument.
/// </summary>

@ -297,6 +297,25 @@ namespace Google.Protobuf.Reflection
/// </summary>
public MessageOptions Options => (Proto.Options as IDeepCloneable<MessageOptions>)?.Clone();
/// <summary>
/// Gets a single value message option for this descriptor
/// </summary>
[Obsolete("GetOption is obsolete. Use the Options property.")]
public T GetOption<T>(Extension<MessageOptions, T> extension)
{
var value = Proto.Options.GetExtension(extension);
return value is IDeepCloneable<T> ? (value as IDeepCloneable<T>).Clone() : value;
}
/// <summary>
/// Gets a repeated value message option for this descriptor
/// </summary>
[Obsolete("GetOption is obsolete. Use the Options property.")]
public Collections.RepeatedField<T> GetOption<T>(RepeatedExtension<MessageOptions, T> extension)
{
return Proto.Options.GetExtension(extension).Clone();
}
/// <summary>
/// Looks up and cross-links all fields and nested types.
/// </summary>

@ -83,6 +83,25 @@ namespace Google.Protobuf.Reflection
/// </summary>
public MethodOptions Options => (Proto.Options as IDeepCloneable<MethodOptions>)?.Clone();
/// <summary>
/// Gets a single value method option for this descriptor
/// </summary>
[Obsolete("GetOption is obsolete. Use the Options property.")]
public T GetOption<T>(Extension<MethodOptions, T> extension)
{
var value = Proto.Options.GetExtension(extension);
return value is IDeepCloneable<T> ? (value as IDeepCloneable<T>).Clone() : value;
}
/// <summary>
/// Gets a repeated value method option for this descriptor
/// </summary>
[Obsolete("GetOption is obsolete. Use the Options property.")]
public RepeatedField<T> GetOption<T>(RepeatedExtension<MethodOptions, T> extension)
{
return Proto.Options.GetExtension(extension).Clone();
}
internal MethodDescriptor(MethodDescriptorProto proto, FileDescriptor file,
ServiceDescriptor parent, int index)
: base(file, parent.FullName + "." + proto.Name, index)

@ -127,6 +127,25 @@ namespace Google.Protobuf.Reflection
/// </summary>
public OneofOptions Options => (proto.Options as IDeepCloneable<OneofOptions>)?.Clone();
/// <summary>
/// Gets a single value oneof option for this descriptor
/// </summary>
[Obsolete("GetOption is obsolete. Use the Options property.")]
public T GetOption<T>(Extension<OneofOptions, T> extension)
{
var value = proto.Options.GetExtension(extension);
return value is IDeepCloneable<T> ? (value as IDeepCloneable<T>).Clone() : value;
}
/// <summary>
/// Gets a repeated value oneof option for this descriptor
/// </summary>
[Obsolete("GetOption is obsolete. Use the Options property.")]
public RepeatedField<T> GetOption<T>(RepeatedExtension<OneofOptions, T> extension)
{
return proto.Options.GetExtension(extension).Clone();
}
internal void CrossLink()
{
List<FieldDescriptor> fieldCollection = new List<FieldDescriptor>();

@ -97,6 +97,25 @@ namespace Google.Protobuf.Reflection
[Obsolete("CustomOptions are obsolete. Use the Options property.")]
public CustomOptions CustomOptions => new CustomOptions(Proto.Options?._extensions?.ValuesByNumber);
/// <summary>
/// Gets a single value service option for this descriptor
/// </summary>
[Obsolete("GetOption is obsolete. Use the Options property.")]
public T GetOption<T>(Extension<ServiceOptions, T> extension)
{
var value = Proto.Options.GetExtension(extension);
return value is IDeepCloneable<T> ? (value as IDeepCloneable<T>).Clone() : value;
}
/// <summary>
/// Gets a repeated value service option for this descriptor
/// </summary>
[Obsolete("GetOption is obsolete. Use the Options property.")]
public RepeatedField<T> GetOption<T>(RepeatedExtension<ServiceOptions, T> extension)
{
return Proto.Options.GetExtension(extension).Clone();
}
/// <summary>
/// The <c>ServiceOptions</c>, defined in <c>descriptor.proto</c>.
/// Custom options can be retrieved as extensions of the returned message.

Loading…
Cancel
Save