Interface WeatherServiceRequester

All Known Implementing Classes:
AccuWeatherRequester, OpenWeatherMapRequester, YahooWeatherRequester
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface WeatherServiceRequester
Requester of a remote weather service to fetch weather forecast data over several days.
Author:
mmoquillon
  • Method Details

    • getForService

      static WeatherServiceRequester getForService(String serviceName)
      Gets the requester relative to the specified weather service.
      Parameters:
      serviceName - a name of the weather service
      Returns:
      the requester for the specified weather service. If the service isn't supported, then returns the default weather service used by Silverpeas.
    • request

      WeatherForecastData request(String cityId)
      Request weather forecast data of the specified city. If the requesting fails, then a WebApplicationException is thrown.
      Parameters:
      cityId - a unique identifier of a city. Such identifiers are specific to the weather service.
      Returns:
      a JSON or an XML representation of the weather forecast data.