Class MessageLiteToString


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

      Constructors 
      Modifier Constructor Description
      private MessageLiteToString()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static void indent​(int indent, java.lang.StringBuilder buffer)  
      private static boolean isDefaultValue​(java.lang.Object o)  
      private static java.lang.String pascalCaseToSnakeCase​(java.lang.String pascalCase)  
      (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
    • Field Detail

      • BUILDER_LIST_SUFFIX

        private static final java.lang.String BUILDER_LIST_SUFFIX
        See Also:
        Constant Field Values
      • INDENT_BUFFER

        private static final char[] INDENT_BUFFER
    • Constructor Detail

      • MessageLiteToString

        private 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 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,
                                                      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 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 PascalCase)
        object - the object value of the field
      • indent

        private static void indent​(int indent,
                                   java.lang.StringBuilder buffer)
      • pascalCaseToSnakeCase

        private static java.lang.String pascalCaseToSnakeCase​(java.lang.String pascalCase)