com.azure.maps.weather.models.WeatherAlongRouteSummary Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-maps-weather Show documentation
Show all versions of azure-maps-weather Show documentation
This package contains the Microsoft Azure SDK for Weather SDK. For documentation on how to use this package, please see https://docs.microsoft.com/en-us/rest/api/maps/weather. Package tag 1.0-preview.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.maps.weather.models;
import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Short summary of the weather along the route.
*/
@Fluent
public final class WeatherAlongRouteSummary implements JsonSerializable {
/*
* Numeric value representing an image that displays the `iconPhrase`. Please refer to [Weather services in Azure Maps](/azure/azure-maps/weather-services-concepts#weather-icons) for details.
*/
private IconCode iconCode;
/*
* Description of the weather hazard affecting the trip.
*/
private WeatherHazards hazards;
/**
* Set default WeatherAlongRouteSummary constructor to private
*/
private WeatherAlongRouteSummary() {
}
/**
* Get the iconCode property: Numeric value representing an image that displays the `iconPhrase`. Please refer to
* [Weather services in Azure Maps](/azure/azure-maps/weather-services-concepts#weather-icons) for details.
*
* @return the iconCode value.
*/
public IconCode getIconCode() {
return this.iconCode;
}
/**
* Set the iconCode property: Numeric value representing an image that displays the `iconPhrase`. Please refer to
* [Weather services in Azure Maps](/azure/azure-maps/weather-services-concepts#weather-icons) for details.
*
* @param iconCode the iconCode value to set.
* @return the WeatherAlongRouteSummary object itself.
*/
public WeatherAlongRouteSummary setIconCode(IconCode iconCode) {
this.iconCode = iconCode;
return this;
}
/**
* Get the hazards property: Description of the weather hazard affecting the trip.
*
* @return the hazards value.
*/
public WeatherHazards getHazards() {
return this.hazards;
}
/**
* Set the hazards property: Description of the weather hazard affecting the trip.
*
* @param hazards the hazards value to set.
* @return the WeatherAlongRouteSummary object itself.
*/
public WeatherAlongRouteSummary setHazards(WeatherHazards hazards) {
this.hazards = hazards;
return this;
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeNumberField("iconCode", this.iconCode == null ? null : this.iconCode.toInt());
jsonWriter.writeJsonField("hazards", this.hazards);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of WeatherAlongRouteSummary from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of WeatherAlongRouteSummary if the JsonReader was pointing to an instance of it, or null if
* it was pointing to JSON null.
* @throws IOException If an error occurs while reading the WeatherAlongRouteSummary.
*/
public static WeatherAlongRouteSummary fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
WeatherAlongRouteSummary deserializedWeatherAlongRouteSummary = new WeatherAlongRouteSummary();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("iconCode".equals(fieldName)) {
deserializedWeatherAlongRouteSummary.iconCode = IconCode.fromInt(reader.getInt());
} else if ("hazards".equals(fieldName)) {
deserializedWeatherAlongRouteSummary.hazards = WeatherHazards.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedWeatherAlongRouteSummary;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy