Adding handling for AutocompletePrediction's structured formatting.#330
Adding handling for AutocompletePrediction's structured formatting.#330domesticmouse merged 3 commits intogooglemaps:masterfrom domesticmouse:master
Conversation
This is a fix for #244
|
/cc @apjanke do you want to review my javadoc for sanity? Thanks! |
apjanke
left a comment
There was a problem hiding this comment.
I've added some minor style suggestions, mostly about redundant words and shortening things to noun phrases.
| package com.google.maps.model; | ||
|
|
||
| /** Represents the Structured Formatting field of an {@see AutocompletePrediction}. */ | ||
| public class AutcompleteStructuredFormatting { |
There was a problem hiding this comment.
Typo: Should this be "AutocompleteStructuredFormatting" instead of "AutcompleteStructuredFormatting"?
There was a problem hiding this comment.
I would make this just The structured formatting info for a {@link com.google.maps.model.AutocompletePrediction}. IMHO, "represents" is redundant, since all data classes represent things, and we shouldn't call it a "field", because it's rather the kind of data that will be stored in the field.
There was a problem hiding this comment.
Done, and yes, that's quite a typo right there...
| /** Represents the Structured Formatting field of an {@see AutocompletePrediction}. */ | ||
| public class AutcompleteStructuredFormatting { | ||
|
|
||
| /** Contains the main text of a prediction, usually the name of the place. */ |
There was a problem hiding this comment.
IMHO, all these "contains" are also redundant, because all variables contain data. How about simplify this to just a noun phrase, like The main text of a prediction, usually the name of the place.?
| /** Contains the main text of a prediction, usually the name of the place. */ | ||
| public String mainText; | ||
|
|
||
| /** Contains an array of where the query matched the returned main text. */ |
There was a problem hiding this comment.
I'd just do Where the query matched the returned main text.. "Contains" is redundant, and the fact that it's an array is apparent from the field's type.
| } | ||
|
|
||
| /** | ||
| * Describe the location of the entered term in the prediction result text, so that the term can |
There was a problem hiding this comment.
I'd omit "describe", and pluralize "location". Maybe, The locations of the entered term in....
| public MatchedSubstring matchedSubstrings[]; | ||
|
|
||
| /** | ||
| * Structured formatting contains a description of how the autocomplete query matched the returned |
There was a problem hiding this comment.
I'd simplify to A description of how the autocomplete query matched the returned result.. Leading with "Structured formatting contains..." is basically repeating the class name.
| /** Contains an array of where the query matched the returned main text. */ | ||
| public AutocompletePrediction.MatchedSubstring mainTextMatchedSubstrings[]; | ||
|
|
||
| /** Contains the secondary text of a prediction, usually the location of the place. */ |
|
Thanks for the interest! I made some minor style comments. There's maybe a substantive issue to cover here, too: Are the (I don't know how likely this difference is to crop up in practice for Google Maps, because I don't know how far its localization reaches, but it might be worth noting for full correctness.) |
|
The APIs are served in UTF8 I believe, and the length and offsets should be Unicode characters, but I'm unsure whether we document this anywhere. At this point I'm copying across the documentation from the Places API documentation, as that is what is published, and I'm uncomfortable going above and beyond that. That said, if someone tests this, and finds that we aren't serving length and offset as unicode characters, then please raise a bug on our issue tracker. This client library is merely passing through what the APIs return, if the APIs are returning data that is incorrect then we have to fix the APIs themselves, not this client library. |
|
Oh, I don't think it's an issue of correctness with the APIs, just a matter of setting expectations for Java-centric developers who use this library. From what I've seen, most Java APIs seem to use Java Sorry if I'm belaboring a point that's already been gone over here in the past. |
|
Valid commentary, I'm not totally up to speed on I18N concerns, so I value this feedback. And I'd totally forgotten that Java is UTF16. I've obviously spent too long with Go and it's Unicode runes.... |
|
How's that look @apjanke? |
|
Yep, LGTM! |
|
Thanks for your careful reviews @apjanke! |
This is a fix for #244