
com.azure.resourcemanager.datafactory.models.MapperPolicyRecurrence 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.datafactory.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;
/**
* CDC policy recurrence details.
*/
@Fluent
public final class MapperPolicyRecurrence implements JsonSerializable {
/*
* Frequency of period in terms of 'Hour', 'Minute' or 'Second'.
*/
private FrequencyType frequency;
/*
* Actual interval value as per chosen frequency.
*/
private Integer interval;
/**
* Creates an instance of MapperPolicyRecurrence class.
*/
public MapperPolicyRecurrence() {
}
/**
* Get the frequency property: Frequency of period in terms of 'Hour', 'Minute' or 'Second'.
*
* @return the frequency value.
*/
public FrequencyType frequency() {
return this.frequency;
}
/**
* Set the frequency property: Frequency of period in terms of 'Hour', 'Minute' or 'Second'.
*
* @param frequency the frequency value to set.
* @return the MapperPolicyRecurrence object itself.
*/
public MapperPolicyRecurrence withFrequency(FrequencyType frequency) {
this.frequency = frequency;
return this;
}
/**
* Get the interval property: Actual interval value as per chosen frequency.
*
* @return the interval value.
*/
public Integer interval() {
return this.interval;
}
/**
* Set the interval property: Actual interval value as per chosen frequency.
*
* @param interval the interval value to set.
* @return the MapperPolicyRecurrence object itself.
*/
public MapperPolicyRecurrence withInterval(Integer interval) {
this.interval = interval;
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("frequency", this.frequency == null ? null : this.frequency.toString());
jsonWriter.writeNumberField("interval", this.interval);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of MapperPolicyRecurrence from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of MapperPolicyRecurrence 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 MapperPolicyRecurrence.
*/
public static MapperPolicyRecurrence fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
MapperPolicyRecurrence deserializedMapperPolicyRecurrence = new MapperPolicyRecurrence();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("frequency".equals(fieldName)) {
deserializedMapperPolicyRecurrence.frequency = FrequencyType.fromString(reader.getString());
} else if ("interval".equals(fieldName)) {
deserializedMapperPolicyRecurrence.interval = reader.getNullable(JsonReader::getInt);
} else {
reader.skipChildren();
}
}
return deserializedMapperPolicyRecurrence;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy