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

com.azure.resourcemanager.servicebus.models.Action Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure ServiceBus Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt

There is a newer version: 2.44.0
Show 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.servicebus.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;

/**
 * Represents the filter actions which are allowed for the transformation of a message that have been matched by a
 * filter expression.
 */
@Fluent
public class Action implements JsonSerializable {
    /*
     * SQL expression. e.g. MyProperty='ABC'
     */
    private String sqlExpression;

    /*
     * This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded
     * to 20.
     */
    private Integer compatibilityLevel;

    /*
     * Value that indicates whether the rule action requires preprocessing.
     */
    private Boolean requiresPreprocessing;

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

    /**
     * Get the sqlExpression property: SQL expression. e.g. MyProperty='ABC'.
     * 
     * @return the sqlExpression value.
     */
    public String sqlExpression() {
        return this.sqlExpression;
    }

    /**
     * Set the sqlExpression property: SQL expression. e.g. MyProperty='ABC'.
     * 
     * @param sqlExpression the sqlExpression value to set.
     * @return the Action object itself.
     */
    public Action withSqlExpression(String sqlExpression) {
        this.sqlExpression = sqlExpression;
        return this;
    }

    /**
     * Get the compatibilityLevel property: This property is reserved for future use. An integer value showing the
     * compatibility level, currently hard-coded to 20.
     * 
     * @return the compatibilityLevel value.
     */
    public Integer compatibilityLevel() {
        return this.compatibilityLevel;
    }

    /**
     * Set the compatibilityLevel property: This property is reserved for future use. An integer value showing the
     * compatibility level, currently hard-coded to 20.
     * 
     * @param compatibilityLevel the compatibilityLevel value to set.
     * @return the Action object itself.
     */
    public Action withCompatibilityLevel(Integer compatibilityLevel) {
        this.compatibilityLevel = compatibilityLevel;
        return this;
    }

    /**
     * Get the requiresPreprocessing property: Value that indicates whether the rule action requires preprocessing.
     * 
     * @return the requiresPreprocessing value.
     */
    public Boolean requiresPreprocessing() {
        return this.requiresPreprocessing;
    }

    /**
     * Set the requiresPreprocessing property: Value that indicates whether the rule action requires preprocessing.
     * 
     * @param requiresPreprocessing the requiresPreprocessing value to set.
     * @return the Action object itself.
     */
    public Action withRequiresPreprocessing(Boolean requiresPreprocessing) {
        this.requiresPreprocessing = requiresPreprocessing;
        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("sqlExpression", this.sqlExpression);
        jsonWriter.writeNumberField("compatibilityLevel", this.compatibilityLevel);
        jsonWriter.writeBooleanField("requiresPreprocessing", this.requiresPreprocessing);
        return jsonWriter.writeEndObject();
    }

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

                if ("sqlExpression".equals(fieldName)) {
                    deserializedAction.sqlExpression = reader.getString();
                } else if ("compatibilityLevel".equals(fieldName)) {
                    deserializedAction.compatibilityLevel = reader.getNullable(JsonReader::getInt);
                } else if ("requiresPreprocessing".equals(fieldName)) {
                    deserializedAction.requiresPreprocessing = reader.getNullable(JsonReader::getBoolean);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAction;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy