All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.maps.weather.models.PrecipitationSummary Maven / Gradle / Ivy

Go to download

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;

/**
 * The PrecipitationSummary model.
 */
@Fluent
public final class PrecipitationSummary implements JsonSerializable {

    /*
     * The amount of precipitation (liquid equivalent) that has fallen in the past hour.
     */
    private WeatherUnitDetails pastHour;

    /*
     * The amount of precipitation (liquid equivalent) that has fallen in the past three hours.
     */
    private WeatherUnitDetails pastThreeHours;

    /*
     * The amount of precipitation (liquid equivalent) that has fallen in the past six hours. Contains Metric and Imperial Values.
     */
    private WeatherUnitDetails pastSixHours;

    /*
     * The amount of precipitation (liquid equivalent) that has fallen in the past nine hours.
     */
    private WeatherUnitDetails pastNineHours;

    /*
     * The amount of precipitation (liquid equivalent) that has fallen in the past 12 hours.
     */
    private WeatherUnitDetails pastTwelveHours;

    /*
     * The amount of precipitation (liquid equivalent) that has fallen in the past 18 hours.
     */
    private WeatherUnitDetails pastEighteenHours;

    /*
     * The amount of precipitation (liquid equivalent) that has fallen in the past 24 hours.
     */
    private WeatherUnitDetails pastTwentyFourHours;

    /**
     * Set default PrecipitationSummary constructor to private
     */
    private PrecipitationSummary() {
    }

    /**
     * Get the pastHour property: The amount of precipitation (liquid equivalent) that has fallen in the past hour.
     *
     * @return the pastHour value.
     */
    public WeatherUnitDetails getPastHour() {
        return this.pastHour;
    }

    /**
     * Get the pastThreeHours property: The amount of precipitation (liquid equivalent) that has fallen in the past
     * three hours.
     *
     * @return the pastThreeHours value.
     */
    public WeatherUnitDetails getPastThreeHours() {
        return this.pastThreeHours;
    }

    /**
     * Get the pastSixHours property: The amount of precipitation (liquid equivalent) that has fallen in the past six
     * hours. Contains Metric and Imperial Values.
     *
     * @return the pastSixHours value.
     */
    public WeatherUnitDetails getPastSixHours() {
        return this.pastSixHours;
    }

    /**
     * Get the pastNineHours property: The amount of precipitation (liquid equivalent) that has fallen in the past nine
     * hours.
     *
     * @return the pastNineHours value.
     */
    public WeatherUnitDetails getPastNineHours() {
        return this.pastNineHours;
    }

    /**
     * Get the pastTwelveHours property: The amount of precipitation (liquid equivalent) that has fallen in the past 12
     * hours.
     *
     * @return the pastTwelveHours value.
     */
    public WeatherUnitDetails getPastTwelveHours() {
        return this.pastTwelveHours;
    }

    /**
     * Get the pastEighteenHours property: The amount of precipitation (liquid equivalent) that has fallen in the past
     * 18 hours.
     *
     * @return the pastEighteenHours value.
     */
    public WeatherUnitDetails getPastEighteenHours() {
        return this.pastEighteenHours;
    }

    /**
     * Get the pastTwentyFourHours property: The amount of precipitation (liquid equivalent) that has fallen in the past
     * 24 hours.
     *
     * @return the pastTwentyFourHours value.
     */
    public WeatherUnitDetails getPastTwentyFourHours() {
        return this.pastTwentyFourHours;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("pastHour", this.pastHour);
        jsonWriter.writeJsonField("pastThreeHours", this.pastThreeHours);
        jsonWriter.writeJsonField("pastSixHours", this.pastSixHours);
        jsonWriter.writeJsonField("pastNineHours", this.pastNineHours);
        jsonWriter.writeJsonField("pastTwelveHours", this.pastTwelveHours);
        jsonWriter.writeJsonField("pastEighteenHours", this.pastEighteenHours);
        jsonWriter.writeJsonField("pastTwentyFourHours", this.pastTwentyFourHours);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of PrecipitationSummary from the JsonReader.
     *
     * @param jsonReader The JsonReader being read.
     * @return An instance of PrecipitationSummary 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 PrecipitationSummary.
     */
    public static PrecipitationSummary fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            PrecipitationSummary deserializedPrecipitationSummary = new PrecipitationSummary();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();
                if ("pastHour".equals(fieldName)) {
                    deserializedPrecipitationSummary.pastHour = WeatherUnitDetails.fromJson(reader);
                } else if ("pastThreeHours".equals(fieldName)) {
                    deserializedPrecipitationSummary.pastThreeHours = WeatherUnitDetails.fromJson(reader);
                } else if ("pastSixHours".equals(fieldName)) {
                    deserializedPrecipitationSummary.pastSixHours = WeatherUnitDetails.fromJson(reader);
                } else if ("pastNineHours".equals(fieldName)) {
                    deserializedPrecipitationSummary.pastNineHours = WeatherUnitDetails.fromJson(reader);
                } else if ("pastTwelveHours".equals(fieldName)) {
                    deserializedPrecipitationSummary.pastTwelveHours = WeatherUnitDetails.fromJson(reader);
                } else if ("pastEighteenHours".equals(fieldName)) {
                    deserializedPrecipitationSummary.pastEighteenHours = WeatherUnitDetails.fromJson(reader);
                } else if ("pastTwentyFourHours".equals(fieldName)) {
                    deserializedPrecipitationSummary.pastTwentyFourHours = WeatherUnitDetails.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }
            return deserializedPrecipitationSummary;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy