private String canonicalString ( ) { ImmutableList < String > segments = getSegments ( ) ; StringBuilder builder = new StringBuilder ( ) ; for ( int i = 0 ; i < segments . size ( ) ; i ++ ) { if ( i > 0 ) { builder . append ( "." ) ; } // Escape backslashes and backticks. String escaped = segments . get ( i ) ; escaped = escaped . replace ( "\\" , "\\\\" ) . replace ( "`" , "\\`" ) ; if ( ! isValidIdentifier ( escaped ) ) { escaped = ' ' + escaped + ' ' ; } builder . append ( escaped ) ; } return builder . toString ( ) ; }
Encodes a list of field name segments in the server - accepted format .