Class JsonParsers
java.lang.Object
net.thauvin.erik.frankfurter.internal.JsonParsers
Provides JSON parsing helpers for Frankfurter API responses.
These methods convert raw JSON strings into strongly typed model objects.
They are used internally by Frankfurter.
-
Method Summary
Modifier and TypeMethodDescriptionstatic CurrenciesparseCurrencies(String json) Parses a JSON object of currency entries.static CurrencyparseCurrency(String json) Parses a single currency entry.static ErrorResponseparseError(String json, int status) Parses an error response.static ProvidersparseProviders(String json) Parses a JSON object of provider entries.static ExchangeRatesparseRates(String json) Parses a JSON array of rate entries.static RateparseSingleRate(String json) Parses a single rate entry.
-
Method Details
-
parseCurrencies
Parses a JSON object of currency entries.- Parameters:
json- the JSON response (must not benull)- Returns:
- the parsed currencies (never null)
-
parseCurrency
Parses a single currency entry.- Parameters:
json- the JSON response (must not benull)- Returns:
- the parsed currency (never null)
-
parseError
Parses an error response.- Parameters:
json- the raw JSON or fallback text (must not benull)status- the HTTP status code- Returns:
- the parsed error response (never null)
-
parseProviders
Parses a JSON object of provider entries.- Parameters:
json- the JSON response (must not benull)- Returns:
- the parsed providers (never null)
-
parseRates
Parses a JSON array of rate entries.- Parameters:
json- the JSON response (must not benull)- Returns:
- the parsed exchange rates (never null)
-
parseSingleRate
Parses a single rate entry.- Parameters:
json- the JSON response (must not benull)- Returns:
- the parsed rate (never null)
-