Merge pull request #1049 from jskeet/any-format

Handle Any formatting for diagnostic purposes
This commit is contained in:
Jon Skeet 2015-12-17 13:10:16 +00:00
commit afbc89a263
22 changed files with 192 additions and 118 deletions

View File

@ -43,6 +43,9 @@ namespace Google.Protobuf.Examples.AddressBook {
}
#region Messages
/// <summary>
/// [START messages]
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Person : pb::IMessage<Person> {
private static readonly pb::MessageParser<Person> _parser = new pb::MessageParser<Person>(() => new Person());
@ -143,7 +146,7 @@ namespace Google.Protobuf.Examples.AddressBook {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -302,7 +305,7 @@ namespace Google.Protobuf.Examples.AddressBook {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -426,7 +429,7 @@ namespace Google.Protobuf.Examples.AddressBook {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -284,7 +284,7 @@ namespace Conformance {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -532,7 +532,7 @@ namespace Conformance {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1544,7 +1544,7 @@ namespace Conformance {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -2343,7 +2343,7 @@ namespace Conformance {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -2471,7 +2471,7 @@ namespace Conformance {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -425,7 +425,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -633,7 +633,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -741,7 +741,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -851,7 +851,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1121,7 +1121,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1318,7 +1318,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1427,7 +1427,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -110,7 +110,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -96,7 +96,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -126,7 +126,7 @@ namespace UnitTest.Issues.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -204,7 +204,7 @@ namespace UnitTest.Issues.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -282,7 +282,7 @@ namespace UnitTest.Issues.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -405,7 +405,7 @@ namespace UnitTest.Issues.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -511,7 +511,7 @@ namespace UnitTest.Issues.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -668,7 +668,7 @@ namespace UnitTest.Issues.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -831,7 +831,7 @@ namespace UnitTest.Issues.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -947,7 +947,7 @@ namespace UnitTest.Issues.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1056,7 +1056,7 @@ namespace UnitTest.Issues.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1279,7 +1279,7 @@ namespace UnitTest.Issues.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -927,7 +927,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1600,7 +1600,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1736,7 +1736,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1873,7 +1873,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1980,7 +1980,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -2070,7 +2070,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -2162,7 +2162,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -2291,7 +2291,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -2421,7 +2421,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -2547,7 +2547,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -2669,7 +2669,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -2883,7 +2883,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -3107,7 +3107,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -3278,7 +3278,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -3400,7 +3400,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -3506,7 +3506,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -3608,7 +3608,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -3704,7 +3704,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -3807,7 +3807,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -3913,7 +3913,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -4016,7 +4016,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -4119,7 +4119,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -4222,7 +4222,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -4325,7 +4325,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -4486,7 +4486,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -4780,7 +4780,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -5140,7 +5140,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -5414,7 +5414,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -5554,7 +5554,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -5647,7 +5647,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -5723,7 +5723,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -5799,7 +5799,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -5875,7 +5875,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -5951,7 +5951,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -6027,7 +6027,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -466,7 +466,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1106,7 +1106,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1625,7 +1625,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -2213,7 +2213,7 @@ namespace Google.Protobuf.TestProtos {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -62,5 +62,28 @@ namespace Google.Protobuf.WellKnownTypes
var unpacked = any.Unpack<TestAllTypes>();
Assert.AreEqual(message, unpacked);
}
[Test]
public void ToString_WithValues()
{
var message = SampleMessages.CreateFullTestAllTypes();
var any = Any.Pack(message);
var text = any.ToString();
Assert.That(text, Is.StringContaining("\"@value\": \"" + message.ToByteString().ToBase64() + "\""));
}
[Test]
public void ToString_Empty()
{
var any = new Any();
Assert.AreEqual("{ \"@type\": \"\", \"@value\": \"\" }", any.ToString());
}
[Test]
public void ToString_MessageContainingAny()
{
var message = new TestWellKnownTypes { AnyField = new Any() };
Assert.AreEqual("{ \"anyField\": { \"@type\": \"\", \"@value\": \"\" } }", message.ToString());
}
}
}

View File

@ -56,17 +56,19 @@ namespace Google.Protobuf
public sealed class JsonFormatter
{
internal const string AnyTypeUrlField = "@type";
internal const string AnyDiagnosticValueField = "@value";
internal const string AnyWellKnownTypeValueField = "value";
private const string TypeUrlPrefix = "type.googleapis.com";
private const string NameValueSeparator = ": ";
private const string PropertySeparator = ", ";
private static JsonFormatter defaultInstance = new JsonFormatter(Settings.Default);
/// <summary>
/// Returns a formatter using the default settings.
/// </summary>
public static JsonFormatter Default { get { return defaultInstance; } }
public static JsonFormatter Default { get; } = new JsonFormatter(Settings.Default);
// A JSON formatter which *only* exists
private static readonly JsonFormatter diagnosticFormatter = new JsonFormatter(Settings.Default);
/// <summary>
/// The JSON representation of the first 160 characters of Unicode.
@ -149,6 +151,29 @@ namespace Google.Protobuf
return builder.ToString();
}
/// <summary>
/// Converts a message to JSON for diagnostic purposes with no extra context.
/// </summary>
/// <remarks>
/// <para>
/// This differs from calling <see cref="Format(IMessage)"/> on the default JSON
/// formatter in its handling of <see cref="Any"/>. As no type registry is available
/// in <see cref="object.ToString"/> calls, the normal way of resolving the type of
/// an <c>Any</c> message cannot be applied. Instead, a JSON property named <c>@value</c>
/// is included with the base64 data from the <see cref="Any.Value"/> property of the message.
/// </para>
/// <para>The value returned by this method is only designed to be used for diagnostic
/// purposes. It may not be parsable by <see cref="JsonParser"/>, and may not be parsable
/// by other Protocol Buffer implementations.</para>
/// </remarks>
/// <param name="message">The message to format for diagnostic purposes.</param>
/// <returns>The diagnostic-only JSON representation of the message</returns>
public static string ToDiagnosticString(IMessage message)
{
Preconditions.CheckNotNull(message, nameof(message));
return diagnosticFormatter.Format(message);
}
private void WriteMessage(StringBuilder builder, IMessage message)
{
if (message == null)
@ -516,6 +541,12 @@ namespace Google.Protobuf
private void WriteAny(StringBuilder builder, IMessage value)
{
if (ReferenceEquals(this, diagnosticFormatter))
{
WriteDiagnosticOnlyAny(builder, value);
return;
}
string typeUrl = (string) value.Descriptor.Fields[Any.TypeUrlFieldNumber].Accessor.GetValue(value);
ByteString data = (ByteString) value.Descriptor.Fields[Any.ValueFieldNumber].Accessor.GetValue(value);
string typeName = GetTypeName(typeUrl);
@ -544,6 +575,23 @@ namespace Google.Protobuf
builder.Append(" }");
}
private void WriteDiagnosticOnlyAny(StringBuilder builder, IMessage value)
{
string typeUrl = (string) value.Descriptor.Fields[Any.TypeUrlFieldNumber].Accessor.GetValue(value);
ByteString data = (ByteString) value.Descriptor.Fields[Any.ValueFieldNumber].Accessor.GetValue(value);
builder.Append("{ ");
WriteString(builder, AnyTypeUrlField);
builder.Append(NameValueSeparator);
WriteString(builder, typeUrl);
builder.Append(PropertySeparator);
WriteString(builder, AnyDiagnosticValueField);
builder.Append(NameValueSeparator);
builder.Append('"');
builder.Append(data.ToBase64());
builder.Append('"');
builder.Append(" }");
}
internal static string GetTypeName(String typeUrl)
{
string[] parts = typeUrl.Split('/');

View File

@ -225,7 +225,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -489,7 +489,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -827,7 +827,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1021,7 +1021,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1162,7 +1162,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1436,7 +1436,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1741,7 +1741,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1872,7 +1872,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -2031,7 +2031,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -2196,7 +2196,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -2404,7 +2404,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -2863,7 +2863,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -3302,7 +3302,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -3596,7 +3596,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -3845,7 +3845,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -3990,7 +3990,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -4121,7 +4121,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -4252,7 +4252,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -4451,7 +4451,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -4653,7 +4653,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -4823,7 +4823,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -5051,7 +5051,7 @@ namespace Google.Protobuf.Reflection {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -165,7 +165,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -230,7 +230,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -503,7 +503,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -783,7 +783,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -164,7 +164,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -94,7 +94,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -221,7 +221,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -105,7 +105,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -136,7 +136,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -361,7 +361,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -555,7 +555,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -175,7 +175,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -230,7 +230,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -522,7 +522,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -910,7 +910,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1098,7 +1098,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1244,7 +1244,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -117,7 +117,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -228,7 +228,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -339,7 +339,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -450,7 +450,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -561,7 +561,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -672,7 +672,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -783,7 +783,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -894,7 +894,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@ -1005,7 +1005,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
public override string ToString() {
return pb::JsonFormatter.Default.Format(this);
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {

View File

@ -353,7 +353,7 @@ void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) {
printer->Print(
"public override string ToString() {\n"
" return pb::JsonFormatter.Default.Format(this);\n"
" return pb::JsonFormatter.ToDiagnosticString(this);\n"
"}\n\n");
}