Skip to content
Snippets Groups Projects
Commit 2792a39b authored by Quentin Leblanc's avatar Quentin Leblanc
Browse files

commented

parent ff86e822
No related branches found
No related tags found
2 merge requests!21*poof* final version,!15Finished Weather API
......@@ -8,22 +8,48 @@ public class Meteo {
private double temperature;
private String conditions;
/**
* Constructor of Meteo class to obtain basic information on the weather
* @param temperature
* @param conditions
*/
private Meteo(double temperature, String conditions){
this.temperature = temperature;
this.conditions = conditions;
}
/**
* Get the temperature of the Meteo Object
* @return temperature
*/
public double getTemperature(){ return temperature; }
/**
* Get the weather conditions of the Meteo Object
* @return conditions
*/
public String getConditions(){ return conditions; }
/**
* Builder of Meteo Object
*/
public static class MeteoBuilder{
private JSONObject datas;
/**
* Constructor of the class MeteoBuilder
* Stock Datas from a JSON object given
* @param datas contains datas to construct a Meteo object
*/
public MeteoBuilder(JSONObject datas){
this.datas = datas;
}
/**
* Build a Meteo object from the datas obtained
* @return a new Meteo object
* @throws CantReadWeatherException
*/
public Meteo build() throws CantReadWeatherException {
double temperature = datas.isNull("tmp") ? -2000 : datas.getDouble("tmp");
String conditions = datas.getString("condition");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment