Class LegacyUnredactedTextFormat

java.lang.Object
com.google.protobuf.LegacyUnredactedTextFormat

public final class LegacyUnredactedTextFormat extends Object
The legacy APIs preserve the existing toString() behavior (output TextFormat), which allows us to migrate toString callers that expect TextFormat output off toString. Eventually, we will make toString output DebugFormat, which is randomized and redacts SPII fields (incompatible with TextFormat).
  • Method Details

    • legacyUnredactedMultilineString

      public static String legacyUnredactedMultilineString(MessageOrBuilder message)
      Like TextFormat.printer().printToString(message), but for legacy purposes.
    • legacyUnredactedMultilineString

      public static String legacyUnredactedMultilineString(UnknownFieldSet fields)
      Like TextFormat.printer().printToString(fields), but for legacy purposes.
    • legacyUnredactedSingleLineString

      public static String legacyUnredactedSingleLineString(MessageOrBuilder message)
      Like TextFormat.printer().emittingSingleLine(true).printToString(message), but for legacy purposes.
    • legacyUnredactedSingleLineString

      public static String legacyUnredactedSingleLineString(UnknownFieldSet fields)
      Like TextFormat.printer().emittingSingleLine(true).printToString(fields), but for legacy purposes.
    • legacyUnredactedToString

      public static String legacyUnredactedToString(Object object)
      Return object.toString() with the guarantee that any Protobuf Message.toString() invoked under this call always returns TextFormat (except for Message.toString() calls that are also under ProtobufToStringOutput.callWithDebugFormat). This is particularly useful for toString calls on objects that contain Protobuf messages (e.g collections) and existing code expects toString() on these objects to contain Message.toString() outputs in TextFormat.
    • legacyUnredactedStringValueOf

      public static String legacyUnredactedStringValueOf(Object object)
      Return String.valueOf() with the guarantee that any Protobuf Message.toString() invoked under this call always returns TextFormat (except for Message.toString() calls that are also under ProtobufToStringOutput.callWithDebugFormat). This is particularly useful for explicit and implicit String.valueOf() calls on objects that contain Protobuf messages (e.g collections) and may be null, and existing code expects toString() on these objects to contain Message.toString() outputs in TextFormat.