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

com.azure.resourcemanager.mediaservices.models.Rectangle Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for MediaServices Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. This Swagger was generated by the API Framework. Package tag package-account-2023-01.

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.mediaservices.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;

/**
 * Describes the properties of a rectangular window applied to the input media before processing it.
 */
@Fluent
public final class Rectangle implements JsonSerializable {
    /*
     * The number of pixels from the left-margin. This can be absolute pixel value (e.g 100), or relative to the size of
     * the video (For example, 50%).
     */
    private String left;

    /*
     * The number of pixels from the top-margin. This can be absolute pixel value (e.g 100), or relative to the size of
     * the video (For example, 50%).
     */
    private String top;

    /*
     * The width of the rectangular region in pixels. This can be absolute pixel value (e.g 100), or relative to the
     * size of the video (For example, 50%).
     */
    private String width;

    /*
     * The height of the rectangular region in pixels. This can be absolute pixel value (e.g 100), or relative to the
     * size of the video (For example, 50%).
     */
    private String height;

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

    /**
     * Get the left property: The number of pixels from the left-margin. This can be absolute pixel value (e.g 100), or
     * relative to the size of the video (For example, 50%).
     * 
     * @return the left value.
     */
    public String left() {
        return this.left;
    }

    /**
     * Set the left property: The number of pixels from the left-margin. This can be absolute pixel value (e.g 100), or
     * relative to the size of the video (For example, 50%).
     * 
     * @param left the left value to set.
     * @return the Rectangle object itself.
     */
    public Rectangle withLeft(String left) {
        this.left = left;
        return this;
    }

    /**
     * Get the top property: The number of pixels from the top-margin. This can be absolute pixel value (e.g 100), or
     * relative to the size of the video (For example, 50%).
     * 
     * @return the top value.
     */
    public String top() {
        return this.top;
    }

    /**
     * Set the top property: The number of pixels from the top-margin. This can be absolute pixel value (e.g 100), or
     * relative to the size of the video (For example, 50%).
     * 
     * @param top the top value to set.
     * @return the Rectangle object itself.
     */
    public Rectangle withTop(String top) {
        this.top = top;
        return this;
    }

    /**
     * Get the width property: The width of the rectangular region in pixels. This can be absolute pixel value (e.g
     * 100), or relative to the size of the video (For example, 50%).
     * 
     * @return the width value.
     */
    public String width() {
        return this.width;
    }

    /**
     * Set the width property: The width of the rectangular region in pixels. This can be absolute pixel value (e.g
     * 100), or relative to the size of the video (For example, 50%).
     * 
     * @param width the width value to set.
     * @return the Rectangle object itself.
     */
    public Rectangle withWidth(String width) {
        this.width = width;
        return this;
    }

    /**
     * Get the height property: The height of the rectangular region in pixels. This can be absolute pixel value (e.g
     * 100), or relative to the size of the video (For example, 50%).
     * 
     * @return the height value.
     */
    public String height() {
        return this.height;
    }

    /**
     * Set the height property: The height of the rectangular region in pixels. This can be absolute pixel value (e.g
     * 100), or relative to the size of the video (For example, 50%).
     * 
     * @param height the height value to set.
     * @return the Rectangle object itself.
     */
    public Rectangle withHeight(String height) {
        this.height = height;
        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("left", this.left);
        jsonWriter.writeStringField("top", this.top);
        jsonWriter.writeStringField("width", this.width);
        jsonWriter.writeStringField("height", this.height);
        return jsonWriter.writeEndObject();
    }

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

                if ("left".equals(fieldName)) {
                    deserializedRectangle.left = reader.getString();
                } else if ("top".equals(fieldName)) {
                    deserializedRectangle.top = reader.getString();
                } else if ("width".equals(fieldName)) {
                    deserializedRectangle.width = reader.getString();
                } else if ("height".equals(fieldName)) {
                    deserializedRectangle.height = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedRectangle;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy