Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Добавил отображение подсказок на латинице в адресах #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,21 @@ public class AddressRequest extends BasicRequest {
private Map<String, String> toBound;
@JsonProperty("restrict_value")
private Boolean restrictValue;
@JsonProperty("language")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если название поля совпадает с полем в json, то аннотацию @JsonProperty не обязательно ставить

private String language;


public AddressRequest(String query,
Integer count,
List<Map<FilterProperty, String>> locationsBoost,
List<Map<FilterProperty, String>> locations, Map<String, String> fromBound,
Map<String, String> toBound, Boolean restrictValue) {
Map<String, String> toBound, Boolean restrictValue, String language) {
super(query, count);
this.locationsBoost = locationsBoost;
this.locations = locations;
this.fromBound = fromBound;
this.toBound = toBound;
this.restrictValue = restrictValue;
this.language = language;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class AddressRequestBuilder extends RequestBuilder<AddressRequest> {
private Map<String, String> fromBound = new HashMap<>();
private Map<String, String> toBound = new HashMap<>();
private Boolean restrictValue = false;
private String language;

public static AddressRequestBuilder create(String query) {
return new AddressRequestBuilder(query);
Expand Down Expand Up @@ -43,9 +44,15 @@ public AddressRequestBuilder restrictValue() {
return this;
}

public AddressRequestBuilder outputLanguage(String language) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Предлагаю сделать более типизировано: у нас есть конечный список языков, которые поддерживаются – это русский (ru) и английский (en). Можно сделать Enum, например:

public enum Language {
  EN,
  RU
}

А при создании AddressRequest делать такое: language.name().toLower()

this.language = language;
return this;
}


@Override
public AddressRequest build() {
return new AddressRequest(super.query, super.count, super.locationsBoost, locations, fromBound, toBound,
restrictValue);
restrictValue, language);
}
}