![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.automation.models.AdvancedSchedule 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;
import java.util.List;
/**
* The properties of the create Advanced Schedule.
*/
@Fluent
public final class AdvancedSchedule implements JsonSerializable {
/*
* Days of the week that the job should execute on.
*/
private List weekDays;
/*
* Days of the month that the job should execute on. Must be between 1 and 31.
*/
private List monthDays;
/*
* Occurrences of days within a month.
*/
private List monthlyOccurrences;
/**
* Creates an instance of AdvancedSchedule class.
*/
public AdvancedSchedule() {
}
/**
* Get the weekDays property: Days of the week that the job should execute on.
*
* @return the weekDays value.
*/
public List weekDays() {
return this.weekDays;
}
/**
* Set the weekDays property: Days of the week that the job should execute on.
*
* @param weekDays the weekDays value to set.
* @return the AdvancedSchedule object itself.
*/
public AdvancedSchedule withWeekDays(List weekDays) {
this.weekDays = weekDays;
return this;
}
/**
* Get the monthDays property: Days of the month that the job should execute on. Must be between 1 and 31.
*
* @return the monthDays value.
*/
public List monthDays() {
return this.monthDays;
}
/**
* Set the monthDays property: Days of the month that the job should execute on. Must be between 1 and 31.
*
* @param monthDays the monthDays value to set.
* @return the AdvancedSchedule object itself.
*/
public AdvancedSchedule withMonthDays(List monthDays) {
this.monthDays = monthDays;
return this;
}
/**
* Get the monthlyOccurrences property: Occurrences of days within a month.
*
* @return the monthlyOccurrences value.
*/
public List monthlyOccurrences() {
return this.monthlyOccurrences;
}
/**
* Set the monthlyOccurrences property: Occurrences of days within a month.
*
* @param monthlyOccurrences the monthlyOccurrences value to set.
* @return the AdvancedSchedule object itself.
*/
public AdvancedSchedule withMonthlyOccurrences(List monthlyOccurrences) {
this.monthlyOccurrences = monthlyOccurrences;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (monthlyOccurrences() != null) {
monthlyOccurrences().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("weekDays", this.weekDays, (writer, element) -> writer.writeString(element));
jsonWriter.writeArrayField("monthDays", this.monthDays, (writer, element) -> writer.writeInt(element));
jsonWriter.writeArrayField("monthlyOccurrences", this.monthlyOccurrences,
(writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AdvancedSchedule from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AdvancedSchedule 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 AdvancedSchedule.
*/
public static AdvancedSchedule fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AdvancedSchedule deserializedAdvancedSchedule = new AdvancedSchedule();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("weekDays".equals(fieldName)) {
List weekDays = reader.readArray(reader1 -> reader1.getString());
deserializedAdvancedSchedule.weekDays = weekDays;
} else if ("monthDays".equals(fieldName)) {
List monthDays = reader.readArray(reader1 -> reader1.getInt());
deserializedAdvancedSchedule.monthDays = monthDays;
} else if ("monthlyOccurrences".equals(fieldName)) {
List monthlyOccurrences
= reader.readArray(reader1 -> AdvancedScheduleMonthlyOccurrence.fromJson(reader1));
deserializedAdvancedSchedule.monthlyOccurrences = monthlyOccurrences;
} else {
reader.skipChildren();
}
}
return deserializedAdvancedSchedule;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy