public abstract class AbstractClient extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Locale |
locale |
protected Localization |
localization |
protected QueryBuilder |
queryBuilder |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractClient() |
protected |
AbstractClient(Locale locale)
Overloaded constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
get(String url)
Performs a GET request to the specified URL.
|
protected String |
getBaseUrl()
Determines the base URL for the API based on the current locale.
|
Locale |
getLocale()
Retrieves the language for this Client instance.
|
List<String> |
getRegions(String url)
Returns the list of the available regions for a given URL.
|
protected List<String> |
getYears(String url)
Returns the list of the available years for a given URL.
|
protected String |
post(String url,
String query)
Performs a POST request to the specified URL.
|
void |
setLocale(Locale locale)
Sets the language for this client instance.
|
void |
setLocalizationLanguage(Locale locale)
Changes the language used for the localization.
|
protected Locale locale
protected QueryBuilder queryBuilder
protected Localization localization
protected AbstractClient()
protected AbstractClient(Locale locale)
locale - the locale for this clientpublic Locale getLocale()
public void setLocale(Locale locale)
setLocalizationLanguage(Locale) overwrites the localization language with the input
of this method.locale - the language for this clientpublic void setLocalizationLanguage(Locale locale)
locale - the language for the localizationprotected String getBaseUrl()
protected String get(String url)
url - the URL which will be sent a GET requestprotected String post(String url, String query)
url - the URL which will be sent a POST requestquery - the payload which the API processespublic List<String> getRegions(String url)
url - the URL to retrieve the regions fromUnsupportedOperationException - if the specified URL doesn't supply a regions tableprotected List<String> getYears(String url)
url - the URL to retrieve the years fromUnsupportedOperationException - if the specified URL doesn't supply a years tableCopyright © 2016. All rights reserved.