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

com.azure.resourcemanager.databoxedge.models.TrackingInfo Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for DataBoxEdge Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2019-08.

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.resourcemanager.databoxedge.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;

/**
 * Tracking courier information.
 */
@Fluent
public final class TrackingInfo implements JsonSerializable {
    /*
     * Serial number of the device being tracked.
     */
    private String serialNumber;

    /*
     * Name of the carrier used in the delivery.
     */
    private String carrierName;

    /*
     * Tracking ID of the shipment.
     */
    private String trackingId;

    /*
     * Tracking URL of the shipment.
     */
    private String trackingUrl;

    /**
     * Creates an instance of TrackingInfo class.
     */
    public TrackingInfo() {
    }

    /**
     * Get the serialNumber property: Serial number of the device being tracked.
     * 
     * @return the serialNumber value.
     */
    public String serialNumber() {
        return this.serialNumber;
    }

    /**
     * Set the serialNumber property: Serial number of the device being tracked.
     * 
     * @param serialNumber the serialNumber value to set.
     * @return the TrackingInfo object itself.
     */
    public TrackingInfo withSerialNumber(String serialNumber) {
        this.serialNumber = serialNumber;
        return this;
    }

    /**
     * Get the carrierName property: Name of the carrier used in the delivery.
     * 
     * @return the carrierName value.
     */
    public String carrierName() {
        return this.carrierName;
    }

    /**
     * Set the carrierName property: Name of the carrier used in the delivery.
     * 
     * @param carrierName the carrierName value to set.
     * @return the TrackingInfo object itself.
     */
    public TrackingInfo withCarrierName(String carrierName) {
        this.carrierName = carrierName;
        return this;
    }

    /**
     * Get the trackingId property: Tracking ID of the shipment.
     * 
     * @return the trackingId value.
     */
    public String trackingId() {
        return this.trackingId;
    }

    /**
     * Set the trackingId property: Tracking ID of the shipment.
     * 
     * @param trackingId the trackingId value to set.
     * @return the TrackingInfo object itself.
     */
    public TrackingInfo withTrackingId(String trackingId) {
        this.trackingId = trackingId;
        return this;
    }

    /**
     * Get the trackingUrl property: Tracking URL of the shipment.
     * 
     * @return the trackingUrl value.
     */
    public String trackingUrl() {
        return this.trackingUrl;
    }

    /**
     * Set the trackingUrl property: Tracking URL of the shipment.
     * 
     * @param trackingUrl the trackingUrl value to set.
     * @return the TrackingInfo object itself.
     */
    public TrackingInfo withTrackingUrl(String trackingUrl) {
        this.trackingUrl = trackingUrl;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("serialNumber", this.serialNumber);
        jsonWriter.writeStringField("carrierName", this.carrierName);
        jsonWriter.writeStringField("trackingId", this.trackingId);
        jsonWriter.writeStringField("trackingUrl", this.trackingUrl);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of TrackingInfo from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of TrackingInfo 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 TrackingInfo.
     */
    public static TrackingInfo fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            TrackingInfo deserializedTrackingInfo = new TrackingInfo();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("serialNumber".equals(fieldName)) {
                    deserializedTrackingInfo.serialNumber = reader.getString();
                } else if ("carrierName".equals(fieldName)) {
                    deserializedTrackingInfo.carrierName = reader.getString();
                } else if ("trackingId".equals(fieldName)) {
                    deserializedTrackingInfo.trackingId = reader.getString();
                } else if ("trackingUrl".equals(fieldName)) {
                    deserializedTrackingInfo.trackingUrl = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedTrackingInfo;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy