
com.azure.resourcemanager.billing.models.SavingsPlanValidResponseProperty 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;
/**
* Benefit scope response property.
*/
@Fluent
public final class SavingsPlanValidResponseProperty implements JsonSerializable {
/*
* Indicates if the provided input is valid
*/
private Boolean valid;
/*
* Failure reason code if the provided input is invalid
*/
private String reasonCode;
/*
* Failure reason if the provided input is invalid
*/
private String reason;
/**
* Creates an instance of SavingsPlanValidResponseProperty class.
*/
public SavingsPlanValidResponseProperty() {
}
/**
* Get the valid property: Indicates if the provided input is valid.
*
* @return the valid value.
*/
public Boolean valid() {
return this.valid;
}
/**
* Set the valid property: Indicates if the provided input is valid.
*
* @param valid the valid value to set.
* @return the SavingsPlanValidResponseProperty object itself.
*/
public SavingsPlanValidResponseProperty withValid(Boolean valid) {
this.valid = valid;
return this;
}
/**
* Get the reasonCode property: Failure reason code if the provided input is invalid.
*
* @return the reasonCode value.
*/
public String reasonCode() {
return this.reasonCode;
}
/**
* Set the reasonCode property: Failure reason code if the provided input is invalid.
*
* @param reasonCode the reasonCode value to set.
* @return the SavingsPlanValidResponseProperty object itself.
*/
public SavingsPlanValidResponseProperty withReasonCode(String reasonCode) {
this.reasonCode = reasonCode;
return this;
}
/**
* Get the reason property: Failure reason if the provided input is invalid.
*
* @return the reason value.
*/
public String reason() {
return this.reason;
}
/**
* Set the reason property: Failure reason if the provided input is invalid.
*
* @param reason the reason value to set.
* @return the SavingsPlanValidResponseProperty object itself.
*/
public SavingsPlanValidResponseProperty withReason(String reason) {
this.reason = reason;
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.writeBooleanField("valid", this.valid);
jsonWriter.writeStringField("reasonCode", this.reasonCode);
jsonWriter.writeStringField("reason", this.reason);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SavingsPlanValidResponseProperty from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SavingsPlanValidResponseProperty 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 SavingsPlanValidResponseProperty.
*/
public static SavingsPlanValidResponseProperty fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SavingsPlanValidResponseProperty deserializedSavingsPlanValidResponseProperty
= new SavingsPlanValidResponseProperty();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("valid".equals(fieldName)) {
deserializedSavingsPlanValidResponseProperty.valid = reader.getNullable(JsonReader::getBoolean);
} else if ("reasonCode".equals(fieldName)) {
deserializedSavingsPlanValidResponseProperty.reasonCode = reader.getString();
} else if ("reason".equals(fieldName)) {
deserializedSavingsPlanValidResponseProperty.reason = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedSavingsPlanValidResponseProperty;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy