![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.automation.models.AdvancedScheduleMonthlyOccurrence 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.automation.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;
/**
* The properties of the create advanced schedule monthly occurrence.
*/
@Fluent
public final class AdvancedScheduleMonthlyOccurrence implements JsonSerializable {
/*
* Occurrence of the week within the month. Must be between 1 and 5
*/
private Integer occurrence;
/*
* Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday, friday, saturday, sunday.
*/
private ScheduleDay day;
/**
* Creates an instance of AdvancedScheduleMonthlyOccurrence class.
*/
public AdvancedScheduleMonthlyOccurrence() {
}
/**
* Get the occurrence property: Occurrence of the week within the month. Must be between 1 and 5.
*
* @return the occurrence value.
*/
public Integer occurrence() {
return this.occurrence;
}
/**
* Set the occurrence property: Occurrence of the week within the month. Must be between 1 and 5.
*
* @param occurrence the occurrence value to set.
* @return the AdvancedScheduleMonthlyOccurrence object itself.
*/
public AdvancedScheduleMonthlyOccurrence withOccurrence(Integer occurrence) {
this.occurrence = occurrence;
return this;
}
/**
* Get the day property: Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday, friday,
* saturday, sunday.
*
* @return the day value.
*/
public ScheduleDay day() {
return this.day;
}
/**
* Set the day property: Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday, friday,
* saturday, sunday.
*
* @param day the day value to set.
* @return the AdvancedScheduleMonthlyOccurrence object itself.
*/
public AdvancedScheduleMonthlyOccurrence withDay(ScheduleDay day) {
this.day = day;
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.writeNumberField("occurrence", this.occurrence);
jsonWriter.writeStringField("day", this.day == null ? null : this.day.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AdvancedScheduleMonthlyOccurrence from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AdvancedScheduleMonthlyOccurrence 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 AdvancedScheduleMonthlyOccurrence.
*/
public static AdvancedScheduleMonthlyOccurrence fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AdvancedScheduleMonthlyOccurrence deserializedAdvancedScheduleMonthlyOccurrence
= new AdvancedScheduleMonthlyOccurrence();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("occurrence".equals(fieldName)) {
deserializedAdvancedScheduleMonthlyOccurrence.occurrence = reader.getNullable(JsonReader::getInt);
} else if ("day".equals(fieldName)) {
deserializedAdvancedScheduleMonthlyOccurrence.day = ScheduleDay.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedAdvancedScheduleMonthlyOccurrence;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy