mirror of
https://bitbucket.org/ethauvin/owm-japis.git
synced 2025-04-25 09:47:11 -07:00
2.5.0.4 is here with bug-fixes and upload to Maven. :)
This commit is contained in:
parent
eac5eb95c2
commit
4a32d93012
14 changed files with 173 additions and 90 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2014 Ashutosh Kumar Singh <me@aksingh.net>
|
||||
* Copyright (c) 2013-2015 Ashutosh Kumar Singh <me@aksingh.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -30,19 +30,48 @@ import java.io.IOException;
|
|||
* </p>
|
||||
*
|
||||
* @author Ashutosh Kumar Singh
|
||||
* @version 2014/12/27
|
||||
* @version 2015/01/22
|
||||
* @since 2.5.0.3
|
||||
*/
|
||||
public class HourlyForecastTest {
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
OpenWeatherMap owm = new OpenWeatherMap("");
|
||||
HourlyForecast hourlyForecast = owm.hourlyForecastByCityName("London, UK");
|
||||
HourlyForecast hf = owm.hourlyForecastByCityName("London, UK");
|
||||
|
||||
if (!hourlyForecast.isValid()) {
|
||||
if (!hf.isValid()) {
|
||||
System.out.println("Reponse is inValid!");
|
||||
} else {
|
||||
System.out.println("Reponse is Valid!");
|
||||
System.out.println();
|
||||
|
||||
if (hf.hasCityInstance()) {
|
||||
HourlyForecast.City city = hf.getCityInstance();
|
||||
if (city.hasCityName()) {
|
||||
if (city.hasCityCode()) {
|
||||
System.out.println("City code: " + city.getCityCode());
|
||||
}
|
||||
if (city.hasCityName()) {
|
||||
System.out.println("City name: " + city.getCityName());
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Total forecast instances: " + hf.getForecastCount());
|
||||
System.out.println();
|
||||
|
||||
for (int i = 0; i < hf.getForecastCount(); i++) {
|
||||
HourlyForecast.Forecast forecast = hf.getForecastInstance(i);
|
||||
|
||||
System.out.println("*** Forecast instance number " + (i+1) + " ***");
|
||||
|
||||
if (forecast.hasDateTime()) {
|
||||
System.out.println(forecast.getDateTime());
|
||||
}
|
||||
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue