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).
  • Constructor Details

    • LegacyUnredactedTextFormat

      private LegacyUnredactedTextFormat()
  • 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.
    • legacyUnredactedToStringList

      @Deprecated public static Iterable<String> legacyUnredactedToStringList(Iterable<?> iterable)
      Deprecated.
      Map each element in an Iterable<T> to Iterable<String> using legacyUnredactedStringValueOf. This is a useful shortcut for callers that operate on an Iterable of objects.
    • legacyUnredactedToStringArray

      @Deprecated public static String[] legacyUnredactedToStringArray(Object[] objects)
      Deprecated.
      Map each element in an Object[] to String using legacyUnredactedStringValueOf. This is a useful shortcut for callers that operate on an Object[] of objects.
    • legacyUnredactedStringFormat

      public static String legacyUnredactedStringFormat(String format, Object... args)
      Return String.format() 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 useful for refactoring String.format() calls when 1) the objects being interpolated are Protobuf messages or contain Protobuf messages, and 2) the existing code expects toString() on the interpolated objects to output the text format.