Class MessageLiteToString


  • final class MessageLiteToString
    extends java.lang.Object
    Helps generate String representations of MessageLite protos.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.String camelCaseToSnakeCase​(java.lang.String camelCase)  
      private static boolean isDefaultValue​(java.lang.Object o)  
      (package private) static void printField​(java.lang.StringBuilder buffer, int indent, java.lang.String name, java.lang.Object object)
      Formats a text proto field.
      private static void reflectivePrintWithIndent​(MessageLite messageLite, java.lang.StringBuilder buffer, int indent)
      Reflectively prints the MessageLite to the buffer at given indent level.
      (package private) static java.lang.String toString​(MessageLite messageLite, java.lang.String commentString)
      Returns a String representation of the MessageLite object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MessageLiteToString

        MessageLiteToString()
    • Method Detail

      • toString

        static java.lang.String toString​(MessageLite messageLite,
                                         java.lang.String commentString)
        Returns a String representation of the MessageLite object. The first line of the String representation 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.

        For use by generated code only.

      • reflectivePrintWithIndent

        private static void reflectivePrintWithIndent​(MessageLite messageLite,
                                                      java.lang.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​(java.lang.Object o)
      • printField

        static final void printField​(java.lang.StringBuilder buffer,
                                     int indent,
                                     java.lang.String name,
                                     java.lang.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 lower underscore case)
        object - the object value of the field
      • camelCaseToSnakeCase

        private static final java.lang.String camelCaseToSnakeCase​(java.lang.String camelCase)