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

com.azure.spring.data.cosmos.repository.query.SimpleCosmosEntityMetadata Maven / Gradle / Ivy

There is a newer version: 5.16.0
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.spring.data.cosmos.repository.query;

import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation;
import org.springframework.util.Assert;

/**
 * Metadata class to describe simple cosmos entity includes domain type and cosmos entity information
 */
public class SimpleCosmosEntityMetadata implements CosmosEntityMetadata {

    private final Class type;
    private final CosmosEntityInformation entityInformation;

    /**
     * Initialization
     *
     * @param type the actual domain class type
     * @param entityInformation cosmos entity
     */
    public SimpleCosmosEntityMetadata(Class type, CosmosEntityInformation entityInformation) {
        Assert.notNull(type, "type must not be null!");
        Assert.notNull(entityInformation, "entityInformation must not be null!");

        this.type = type;
        this.entityInformation = entityInformation;
    }

    /**
     * Return the actual domain class type
     *
     * @return type
     */
    public Class getJavaType() {
        return type;
    }

    /**
     * Get collection name of cosmos
     *
     * @return container name
     */
    public String getCollectionName() {
        return entityInformation.getContainerName();
    }

    /**
     * Get container name of cosmos
     *
     * @return container name
     */
    public String getContainerName() {
        return entityInformation.getContainerName();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy