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

com.azure.cosmos.models.SpatialSpec Maven / Gradle / Ivy

Go to download

This Package contains Microsoft Azure Cosmos SDK (with Reactive Extension Reactor support) for Azure Cosmos DB SQL API

There is a newer version: 4.60.0
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.cosmos.models;

import com.azure.cosmos.implementation.Constants;
import com.azure.cosmos.implementation.JsonSerializable;
import com.fasterxml.jackson.databind.node.ObjectNode;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * The type Spatial spec.
 */
public final class SpatialSpec {

    private List spatialTypes;

    private JsonSerializable jsonSerializable;

    /**
     * Constructor.
     */
    public SpatialSpec() {
        this.jsonSerializable = new JsonSerializable();
    }

    /**
     * Constructor.
     *
     * @param jsonString the json string that represents the included path.
     */
    SpatialSpec(String jsonString) {
        this.jsonSerializable = new JsonSerializable(jsonString);
    }

    /**
     * Constructor.
     *
     * @param objectNode the object node that represents the included path.
     */
    SpatialSpec(ObjectNode objectNode) {
        this.jsonSerializable = new JsonSerializable(objectNode);
    }

    /**
     * Gets path.
     *
     * @return the path.
     */
    public String getPath() {
        return this.jsonSerializable.getString(Constants.Properties.PATH);
    }

    /**
     * Sets path.
     *
     * @param path the path.
     * @return the SpatialSpec.
     */
    public SpatialSpec setPath(String path) {
        this.jsonSerializable.set(Constants.Properties.PATH, path);
        return this;
    }

    /**
     * Gets the container of spatial types.
     *
     * @return the container of spatial types.
     */
    public List getSpatialTypes() {
        if (this.spatialTypes == null) {
            this.spatialTypes = this.jsonSerializable.getList(Constants.Properties.TYPES, SpatialType.class, true);

            if (this.spatialTypes == null) {
                this.spatialTypes = new ArrayList();
            }
        }

        return this.spatialTypes;
    }

    /**
     * Sets the container of spatial types.
     *
     * @param spatialTypes the container of spatial types.
     * @return the SpatialSpec.
     */
    public SpatialSpec setSpatialTypes(List spatialTypes) {
        this.spatialTypes = spatialTypes;
        Collection spatialTypeNames = new ArrayList();
        for (SpatialType spatialType : this.spatialTypes) {
            spatialTypeNames.add(spatialType.toString());
        }
        this.jsonSerializable.set(Constants.Properties.TYPES, spatialTypeNames);
        return this;
    }

    void populatePropertyBag() {
        this.jsonSerializable.populatePropertyBag();
    }

    JsonSerializable getJsonSerializable() { return this.jsonSerializable; }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy