import de.example.exampletdd.model.currentweather.Current;
import de.example.exampletdd.model.currentweather.Main;
import de.example.exampletdd.model.currentweather.Rain;
+import de.example.exampletdd.model.currentweather.Snow;
import de.example.exampletdd.model.currentweather.Sys;
import de.example.exampletdd.model.currentweather.Wind;
import de.example.exampletdd.model.forecastweather.City;
currentWeatherData.setMain(new Main());
currentWeatherData.setRain(new Rain());
currentWeatherData.setSys(new Sys());
+ currentWeatherData.setSnow(new Snow());
currentWeatherData
.setWeather(new ArrayList<de.example.exampletdd.model.currentweather.Weather>());
currentWeatherData.setWind(new Wind());
private void getCurrentWeatherDataObjects(final Current currentWeatherData,
final JsonParser jParser, final String fieldname) throws JsonParseException,
IOException {
- if (fieldname == "coord") {
+ if ("coord".equals(fieldname)) {
while (jParser.nextToken() != JsonToken.END_OBJECT) {
final String namefield = jParser.getCurrentName();
jParser.nextToken(); // move to value
}
}
}
- if (fieldname == "sys") {
+ if ("sys".equals(fieldname)) {
while (jParser.nextToken() != JsonToken.END_OBJECT) {
final String namefield = jParser.getCurrentName();
jParser.nextToken(); // move to value
}
}
}
- if (fieldname == "weather") {
+ if ("weather".equals(fieldname)) {
final de.example.exampletdd.model.currentweather.Weather weather = new de.example.exampletdd.model.currentweather.Weather();
currentWeatherData.getWeather().add(weather);
while (jParser.nextToken() != JsonToken.END_OBJECT) {
}
}
- if (fieldname == "base") {
+ if ("base".equals(fieldname)) {
currentWeatherData.setBase(jParser.getText());
}
- if (fieldname == "main") {
+ if ("main".equals(fieldname)) {
while (jParser.nextToken() != JsonToken.END_OBJECT) {
final String namefield = jParser.getCurrentName();
jParser.nextToken(); // move to value
}
}
}
- if (fieldname == "wind") {
+ if ("wind".equals(fieldname)) {
while (jParser.nextToken() != JsonToken.END_OBJECT) {
final String namefield = jParser.getCurrentName();
jParser.nextToken(); // move to value
}
}
}
- if (fieldname == "clouds") {
+ if ("clouds".equals(fieldname)) {
while (jParser.nextToken() != JsonToken.END_OBJECT) {
final String namefield = jParser.getCurrentName();
jParser.nextToken(); // move to value
}
}
}
- if (fieldname == "dt") {
+ if ("dt".equals(fieldname)) {
currentWeatherData.setDt(jParser.getLongValue());
}
- if (fieldname == "rain") {
+ if ("rain".equals(fieldname)) {
while (jParser.nextToken() != JsonToken.END_OBJECT) {
final String namefield = jParser.getCurrentName();
jParser.nextToken(); // move to value
}
}
}
- if (fieldname == "snow") {
+ if ("snow".equals(fieldname)) {
while (jParser.nextToken() != JsonToken.END_OBJECT) {
final String namefield = jParser.getCurrentName();
jParser.nextToken(); // move to value
}
}
}
- if (fieldname == "id") {
+ if ("id".equals(fieldname)) {
currentWeatherData.setId(jParser.getLongValue());
}
- if (fieldname == "name") {
+ if ("name".equals(fieldname)) {
currentWeatherData.setName(jParser.getText());
}
- if (fieldname == "cod") {
+ if ("cod".equals(fieldname)) {
currentWeatherData.setCod(jParser.getIntValue());
}
}
final JsonParser jParser, final String fieldname) throws JsonParseException,
IOException {
- if (fieldname == "cod") {
+ if ("cod".equals(fieldname)) {
final String stringCod = jParser.getText();
forecastWeatherData.setCod(Long.valueOf(stringCod));
}
- if (fieldname == "message") {
+ if ("message".equals(fieldname)) {
forecastWeatherData.setMessage(jParser.getDoubleValue());
}
- if (fieldname == "city") {
+ if ("city".equals(fieldname)) {
while (jParser.nextToken() != JsonToken.END_OBJECT) {
final String namefield = jParser.getCurrentName();
final JsonToken nextToken = jParser.nextToken(); // move to
}
}
}
- if (fieldname == "cnt") {
+ if ("cnt".equals(fieldname)) {
forecastWeatherData.setCnt(jParser.getIntValue());
}
- if (fieldname == "coord") {
+ if ("coord".equals(fieldname)) {
while (jParser.nextToken() != JsonToken.END_OBJECT) {
final String namefield = jParser.getCurrentName();
jParser.nextToken(); // move to value
}
}
}
- if (fieldname == "list") {
+ if ("list".equals(fieldname)) {
final de.example.exampletdd.model.forecastweather.List list = new de.example.exampletdd.model.forecastweather.List();
list.setTemp(new Temp());
list.setWeather(new ArrayList<de.example.exampletdd.model.forecastweather.Weather>());
}
}
}
- if (fieldname == "temp") {
+ if ("temp".equals(fieldname)) {
final de.example.exampletdd.model.forecastweather.List list = forecastWeatherData
.getList().get(
(forecastWeatherData.getList().size() - 1));
}
}
}
- if (fieldname == "weather") {
+ if ("weather".equals(fieldname)) {
final de.example.exampletdd.model.forecastweather.List list = forecastWeatherData
.getList().get(
(forecastWeatherData.getList().size() - 1));