All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.machinelearning.models.CustomTargetLags Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Machine Learning Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. These APIs allow end users to operate on Azure Machine Learning Workspace resources. Package tag package-2024-04.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.machinelearning.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;
import java.util.List;

/**
 * The CustomTargetLags model.
 */
@Fluent
public final class CustomTargetLags extends TargetLags {
    /*
     * [Required] Set target lags mode - Auto/Custom
     */
    private TargetLagsMode mode = TargetLagsMode.CUSTOM;

    /*
     * [Required] Set target lags values.
     */
    private List values;

    /**
     * Creates an instance of CustomTargetLags class.
     */
    public CustomTargetLags() {
    }

    /**
     * Get the mode property: [Required] Set target lags mode - Auto/Custom.
     * 
     * @return the mode value.
     */
    @Override
    public TargetLagsMode mode() {
        return this.mode;
    }

    /**
     * Get the values property: [Required] Set target lags values.
     * 
     * @return the values value.
     */
    public List values() {
        return this.values;
    }

    /**
     * Set the values property: [Required] Set target lags values.
     * 
     * @param values the values value to set.
     * @return the CustomTargetLags object itself.
     */
    public CustomTargetLags withValues(List values) {
        this.values = values;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (values() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException("Missing required property values in model CustomTargetLags"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(CustomTargetLags.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeArrayField("values", this.values, (writer, element) -> writer.writeInt(element));
        jsonWriter.writeStringField("mode", this.mode == null ? null : this.mode.toString());
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of CustomTargetLags from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of CustomTargetLags 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 CustomTargetLags.
     */
    public static CustomTargetLags fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            CustomTargetLags deserializedCustomTargetLags = new CustomTargetLags();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("values".equals(fieldName)) {
                    List values = reader.readArray(reader1 -> reader1.getInt());
                    deserializedCustomTargetLags.values = values;
                } else if ("mode".equals(fieldName)) {
                    deserializedCustomTargetLags.mode = TargetLagsMode.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedCustomTargetLags;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy