Class MessageLiteToString

java.lang.Object
com.google.protobuf.MessageLiteToString

final class MessageLiteToString extends Object
Helps generate String representations of MessageLite protos.
  • Field Details

  • Constructor Details

    • MessageLiteToString

      private MessageLiteToString()
  • Method Details

    • toString

      static String toString(MessageLite messageLite, String commentString)
      Returns a String representation of the MessageLite object. The first line of the String representation includes a comment string to uniquely identify the object instance. This acts as an indicator that this should not be relied on for comparisons.
    • reflectivePrintWithIndent

      private static void reflectivePrintWithIndent(MessageLite messageLite, StringBuilder buffer, int indent)
      Reflectively prints the MessageLite to the buffer at given indent level.
      Parameters:
      buffer - the buffer to write to
      indent - the number of spaces to indent the proto by
    • isDefaultValue

      private static boolean isDefaultValue(Object o)
    • printField

      static void printField(StringBuilder buffer, int indent, String name, Object object)
      Formats a text proto field.

      For use by generated code only.

      Parameters:
      buffer - the buffer to write to
      indent - the number of spaces the proto should be indented by
      name - the field name (in PascalCase)
      object - the object value of the field
    • indent

      private static void indent(int indent, StringBuilder buffer)
    • pascalCaseToSnakeCase

      private static String pascalCaseToSnakeCase(String pascalCase)