diff options
author | csharptest <roger@csharptest.net> | 2011-09-09 15:53:10 -0500 |
---|---|---|
committer | rogerk <devnull@localhost> | 2011-09-09 15:53:10 -0500 |
commit | 4a594cac938258c6fc5150a7b99530bed9df483e (patch) | |
tree | 12f285f82937a7651c1edc8b117da4cf6cd5800b /src/ProtoGen/MessageFieldGenerator.cs | |
parent | 8f0dcf3df1548a1eff0bed54a9b992f55b8f72d5 (diff) | |
download | protobuf-4a594cac938258c6fc5150a7b99530bed9df483e.tar.gz protobuf-4a594cac938258c6fc5150a7b99530bed9df483e.tar.bz2 protobuf-4a594cac938258c6fc5150a7b99530bed9df483e.zip |
Implemented [Obsolete] attribute for deprecated fields
Diffstat (limited to 'src/ProtoGen/MessageFieldGenerator.cs')
-rw-r--r-- | src/ProtoGen/MessageFieldGenerator.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ProtoGen/MessageFieldGenerator.cs b/src/ProtoGen/MessageFieldGenerator.cs index b86f2c9a..8e4bef5b 100644 --- a/src/ProtoGen/MessageFieldGenerator.cs +++ b/src/ProtoGen/MessageFieldGenerator.cs @@ -49,9 +49,11 @@ namespace Google.ProtocolBuffers.ProtoGen {
writer.WriteLine("private bool has{0};", PropertyName);
writer.WriteLine("private {0} {1}_ = {2};", TypeName, Name, DefaultValue);
+ AddDeprecatedFlag(writer);
writer.WriteLine("public bool Has{0} {{", PropertyName);
writer.WriteLine(" get {{ return has{0}; }}", PropertyName);
writer.WriteLine("}");
+ AddDeprecatedFlag(writer);
writer.WriteLine("public {0} {1} {{", TypeName, PropertyName);
writer.WriteLine(" get {{ return {0}_; }}", Name);
writer.WriteLine("}");
@@ -59,25 +61,30 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateBuilderMembers(TextGenerator writer)
{
+ AddDeprecatedFlag(writer);
writer.WriteLine("public bool Has{0} {{", PropertyName);
writer.WriteLine(" get {{ return result.has{0}; }}", PropertyName);
writer.WriteLine("}");
+ AddDeprecatedFlag(writer);
writer.WriteLine("public {0} {1} {{", TypeName, PropertyName);
writer.WriteLine(" get {{ return result.{0}; }}", PropertyName);
writer.WriteLine(" set {{ Set{0}(value); }}", PropertyName);
writer.WriteLine("}");
+ AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Set{0}({1} value) {{", PropertyName, TypeName);
AddNullCheck(writer);
writer.WriteLine(" result.has{0} = true;", PropertyName);
writer.WriteLine(" result.{0}_ = value;", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
+ AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Set{0}({1}.Builder builderForValue) {{", PropertyName, TypeName);
AddNullCheck(writer, "builderForValue");
writer.WriteLine(" result.has{0} = true;", PropertyName);
writer.WriteLine(" result.{0}_ = builderForValue.Build();", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
+ AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Merge{0}({1} value) {{", PropertyName, TypeName);
AddNullCheck(writer);
writer.WriteLine(" if (result.has{0} &&", PropertyName);
@@ -90,6 +97,7 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine(" result.has{0} = true;", PropertyName);
writer.WriteLine(" return this;");
writer.WriteLine("}");
+ AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Clear{0}() {{", PropertyName);
writer.WriteLine(" result.has{0} = false;", PropertyName);
writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue);
|