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

com.azure.resourcemanager.newrelicobservability.models.UserInfo Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.newrelicobservability.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;

/**
 * User Info of NewRelic Monitor resource.
 */
@Fluent
public final class UserInfo implements JsonSerializable {
    /*
     * First name
     */
    private String firstName;

    /*
     * Last name
     */
    private String lastName;

    /*
     * User Email
     */
    private String emailAddress;

    /*
     * Contact phone number
     */
    private String phoneNumber;

    /*
     * country if user
     */
    private String country;

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

    /**
     * Get the firstName property: First name.
     * 
     * @return the firstName value.
     */
    public String firstName() {
        return this.firstName;
    }

    /**
     * Set the firstName property: First name.
     * 
     * @param firstName the firstName value to set.
     * @return the UserInfo object itself.
     */
    public UserInfo withFirstName(String firstName) {
        this.firstName = firstName;
        return this;
    }

    /**
     * Get the lastName property: Last name.
     * 
     * @return the lastName value.
     */
    public String lastName() {
        return this.lastName;
    }

    /**
     * Set the lastName property: Last name.
     * 
     * @param lastName the lastName value to set.
     * @return the UserInfo object itself.
     */
    public UserInfo withLastName(String lastName) {
        this.lastName = lastName;
        return this;
    }

    /**
     * Get the emailAddress property: User Email.
     * 
     * @return the emailAddress value.
     */
    public String emailAddress() {
        return this.emailAddress;
    }

    /**
     * Set the emailAddress property: User Email.
     * 
     * @param emailAddress the emailAddress value to set.
     * @return the UserInfo object itself.
     */
    public UserInfo withEmailAddress(String emailAddress) {
        this.emailAddress = emailAddress;
        return this;
    }

    /**
     * Get the phoneNumber property: Contact phone number.
     * 
     * @return the phoneNumber value.
     */
    public String phoneNumber() {
        return this.phoneNumber;
    }

    /**
     * Set the phoneNumber property: Contact phone number.
     * 
     * @param phoneNumber the phoneNumber value to set.
     * @return the UserInfo object itself.
     */
    public UserInfo withPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
        return this;
    }

    /**
     * Get the country property: country if user.
     * 
     * @return the country value.
     */
    public String country() {
        return this.country;
    }

    /**
     * Set the country property: country if user.
     * 
     * @param country the country value to set.
     * @return the UserInfo object itself.
     */
    public UserInfo withCountry(String country) {
        this.country = country;
        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("firstName", this.firstName);
        jsonWriter.writeStringField("lastName", this.lastName);
        jsonWriter.writeStringField("emailAddress", this.emailAddress);
        jsonWriter.writeStringField("phoneNumber", this.phoneNumber);
        jsonWriter.writeStringField("country", this.country);
        return jsonWriter.writeEndObject();
    }

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

                if ("firstName".equals(fieldName)) {
                    deserializedUserInfo.firstName = reader.getString();
                } else if ("lastName".equals(fieldName)) {
                    deserializedUserInfo.lastName = reader.getString();
                } else if ("emailAddress".equals(fieldName)) {
                    deserializedUserInfo.emailAddress = reader.getString();
                } else if ("phoneNumber".equals(fieldName)) {
                    deserializedUserInfo.phoneNumber = reader.getString();
                } else if ("country".equals(fieldName)) {
                    deserializedUserInfo.country = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedUserInfo;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy