
com.azure.resourcemanager.billing.models.BillingAccountPropertiesSoldTo 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.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* The address of the individual or organization that is responsible for the billing account.
*/
@Fluent
public final class BillingAccountPropertiesSoldTo extends AddressDetails {
/**
* Creates an instance of BillingAccountPropertiesSoldTo class.
*/
public BillingAccountPropertiesSoldTo() {
}
/**
* {@inheritDoc}
*/
@Override
public BillingAccountPropertiesSoldTo withAddressLine1(String addressLine1) {
super.withAddressLine1(addressLine1);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BillingAccountPropertiesSoldTo withAddressLine2(String addressLine2) {
super.withAddressLine2(addressLine2);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BillingAccountPropertiesSoldTo withAddressLine3(String addressLine3) {
super.withAddressLine3(addressLine3);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BillingAccountPropertiesSoldTo withCity(String city) {
super.withCity(city);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BillingAccountPropertiesSoldTo withCompanyName(String companyName) {
super.withCompanyName(companyName);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BillingAccountPropertiesSoldTo withCountry(String country) {
super.withCountry(country);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BillingAccountPropertiesSoldTo withDistrict(String district) {
super.withDistrict(district);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BillingAccountPropertiesSoldTo withEmail(String email) {
super.withEmail(email);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BillingAccountPropertiesSoldTo withFirstName(String firstName) {
super.withFirstName(firstName);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BillingAccountPropertiesSoldTo withLastName(String lastName) {
super.withLastName(lastName);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BillingAccountPropertiesSoldTo withMiddleName(String middleName) {
super.withMiddleName(middleName);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BillingAccountPropertiesSoldTo withPhoneNumber(String phoneNumber) {
super.withPhoneNumber(phoneNumber);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BillingAccountPropertiesSoldTo withPostalCode(String postalCode) {
super.withPostalCode(postalCode);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BillingAccountPropertiesSoldTo withRegion(String region) {
super.withRegion(region);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BillingAccountPropertiesSoldTo withIsValidAddress(Boolean isValidAddress) {
super.withIsValidAddress(isValidAddress);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (addressLine1() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property addressLine1 in model BillingAccountPropertiesSoldTo"));
}
if (country() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property country in model BillingAccountPropertiesSoldTo"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(BillingAccountPropertiesSoldTo.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("addressLine1", addressLine1());
jsonWriter.writeStringField("country", country());
jsonWriter.writeStringField("addressLine2", addressLine2());
jsonWriter.writeStringField("addressLine3", addressLine3());
jsonWriter.writeStringField("city", city());
jsonWriter.writeStringField("companyName", companyName());
jsonWriter.writeStringField("district", district());
jsonWriter.writeStringField("email", email());
jsonWriter.writeStringField("firstName", firstName());
jsonWriter.writeStringField("lastName", lastName());
jsonWriter.writeStringField("middleName", middleName());
jsonWriter.writeStringField("phoneNumber", phoneNumber());
jsonWriter.writeStringField("postalCode", postalCode());
jsonWriter.writeStringField("region", region());
jsonWriter.writeBooleanField("isValidAddress", isValidAddress());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of BillingAccountPropertiesSoldTo from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of BillingAccountPropertiesSoldTo if the JsonReader was pointing to an instance of it, or
* null if it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the BillingAccountPropertiesSoldTo.
*/
public static BillingAccountPropertiesSoldTo fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
BillingAccountPropertiesSoldTo deserializedBillingAccountPropertiesSoldTo
= new BillingAccountPropertiesSoldTo();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("addressLine1".equals(fieldName)) {
deserializedBillingAccountPropertiesSoldTo.withAddressLine1(reader.getString());
} else if ("country".equals(fieldName)) {
deserializedBillingAccountPropertiesSoldTo.withCountry(reader.getString());
} else if ("addressLine2".equals(fieldName)) {
deserializedBillingAccountPropertiesSoldTo.withAddressLine2(reader.getString());
} else if ("addressLine3".equals(fieldName)) {
deserializedBillingAccountPropertiesSoldTo.withAddressLine3(reader.getString());
} else if ("city".equals(fieldName)) {
deserializedBillingAccountPropertiesSoldTo.withCity(reader.getString());
} else if ("companyName".equals(fieldName)) {
deserializedBillingAccountPropertiesSoldTo.withCompanyName(reader.getString());
} else if ("district".equals(fieldName)) {
deserializedBillingAccountPropertiesSoldTo.withDistrict(reader.getString());
} else if ("email".equals(fieldName)) {
deserializedBillingAccountPropertiesSoldTo.withEmail(reader.getString());
} else if ("firstName".equals(fieldName)) {
deserializedBillingAccountPropertiesSoldTo.withFirstName(reader.getString());
} else if ("lastName".equals(fieldName)) {
deserializedBillingAccountPropertiesSoldTo.withLastName(reader.getString());
} else if ("middleName".equals(fieldName)) {
deserializedBillingAccountPropertiesSoldTo.withMiddleName(reader.getString());
} else if ("phoneNumber".equals(fieldName)) {
deserializedBillingAccountPropertiesSoldTo.withPhoneNumber(reader.getString());
} else if ("postalCode".equals(fieldName)) {
deserializedBillingAccountPropertiesSoldTo.withPostalCode(reader.getString());
} else if ("region".equals(fieldName)) {
deserializedBillingAccountPropertiesSoldTo.withRegion(reader.getString());
} else if ("isValidAddress".equals(fieldName)) {
deserializedBillingAccountPropertiesSoldTo
.withIsValidAddress(reader.getNullable(JsonReader::getBoolean));
} else {
reader.skipChildren();
}
}
return deserializedBillingAccountPropertiesSoldTo;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy