
com.azure.resourcemanager.billing.models.Beneficiary 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.billing.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;
/**
* Details of the beneficiary.
*/
@Fluent
public final class Beneficiary implements JsonSerializable {
/*
* The ID that uniquely identifies a tenant.
*/
private String tenantId;
/*
* The ID that uniquely identifies a user in a tenant.
*/
private String objectId;
/**
* Creates an instance of Beneficiary class.
*/
public Beneficiary() {
}
/**
* Get the tenantId property: The ID that uniquely identifies a tenant.
*
* @return the tenantId value.
*/
public String tenantId() {
return this.tenantId;
}
/**
* Set the tenantId property: The ID that uniquely identifies a tenant.
*
* @param tenantId the tenantId value to set.
* @return the Beneficiary object itself.
*/
public Beneficiary withTenantId(String tenantId) {
this.tenantId = tenantId;
return this;
}
/**
* Get the objectId property: The ID that uniquely identifies a user in a tenant.
*
* @return the objectId value.
*/
public String objectId() {
return this.objectId;
}
/**
* Set the objectId property: The ID that uniquely identifies a user in a tenant.
*
* @param objectId the objectId value to set.
* @return the Beneficiary object itself.
*/
public Beneficiary withObjectId(String objectId) {
this.objectId = objectId;
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("tenantId", this.tenantId);
jsonWriter.writeStringField("objectId", this.objectId);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of Beneficiary from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of Beneficiary 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 Beneficiary.
*/
public static Beneficiary fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
Beneficiary deserializedBeneficiary = new Beneficiary();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("tenantId".equals(fieldName)) {
deserializedBeneficiary.tenantId = reader.getString();
} else if ("objectId".equals(fieldName)) {
deserializedBeneficiary.objectId = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedBeneficiary;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy