Class CosmosEntityInformation<T,​ID>

  • All Implemented Interfaces:
    org.springframework.data.repository.core.EntityInformation<T,​ID>, org.springframework.data.repository.core.EntityMetadata<T>

    public class CosmosEntityInformation<T,​ID>
    extends org.springframework.data.repository.core.support.AbstractEntityInformation<T,​ID>
    Class to describe cosmosDb entity
    • Constructor Detail

      • CosmosEntityInformation

        public CosmosEntityInformation​(Class<T> domainType)
        Initialization
        Parameters:
        domainType - to specify id field
    • Method Detail

      • getInstance

        public static CosmosEntityInformation<?,​?> getInstance​(Class<?> domainClass)
        Static Factory
        Parameters:
        domainClass - to specify id field
        Returns:
        new CosmosEntityInformation
      • isNew

        public boolean isNew​(T entity)
        Specified by:
        isNew in interface org.springframework.data.repository.core.EntityInformation<T,​ID>
        Overrides:
        isNew in class org.springframework.data.repository.core.support.AbstractEntityInformation<T,​ID>
      • getId

        public ID getId​(T entity)
        Get the field represented by the supplied id field on the specified entity.
        Parameters:
        entity - the target object from which to get the field
        Returns:
        the id's current value
      • getIdField

        public Field getIdField()
        Get id field
        Returns:
        id
      • getIdFieldName

        public String getIdFieldName()
        Get id field name
        Returns:
        string
      • shouldGenerateId

        public boolean shouldGenerateId()
        Should generate Id field value
        Returns:
        boolean
      • getIdType

        public Class<ID> getIdType()
        Get id type
        Returns:
        class of id type
      • getContainerName

        public String getContainerName()
        Get container name
        Returns:
        container name
      • getRequestUnit

        public Integer getRequestUnit()
        Get request unit value
        Returns:
        request unit
      • getTimeToLive

        public Integer getTimeToLive()
        Get timeToLive value
        Returns:
        timeToLive
      • getIndexingPolicy

        @NonNull
        public IndexingPolicy getIndexingPolicy()
        Get indexing policy
        Returns:
        IndexingPolicy
      • getUniqueKeyPolicy

        public UniqueKeyPolicy getUniqueKeyPolicy()
        Gets the UniqueKeyPolicy
        Returns:
        UniqueKeyPolicy
      • isVersioned

        public boolean isVersioned()
        Check if is versioned
        Returns:
        boolean
      • getVersionFieldName

        public String getVersionFieldName()
        Get name of field annotated with @Version if any
        Returns:
        String
      • getPartitionKeyPath

        public String getPartitionKeyPath()
        Get the computed partition key path for container
        Returns:
        partition key path
      • getVersionFieldValue

        public String getVersionFieldValue​(Object entity)
        Get the value of the field marked as the version field
        Parameters:
        entity - the object to get the value from
        Returns:
        the value of the version field
      • getPartitionKeyFieldValue

        public Object getPartitionKeyFieldValue​(T entity)
        Get the field value represented by the supplied partitionKeyField object on the specified entity object.
        Parameters:
        entity - the target object from which to get the field
        Returns:
        partition key field
      • getPartitionKeyFieldName

        public String getPartitionKeyFieldName()
        Returns:
        the partition key field name
      • isAutoCreateContainer

        public boolean isAutoCreateContainer()
        Check if auto creating container is allowed
        Returns:
        boolean
      • isAutoScale

        public boolean isAutoScale()
        Check if container should use autoscale for resource units
        Returns:
        boolean
      • isIndexingPolicySpecified

        public boolean isIndexingPolicySpecified()
        Returns:
        whether indexing policy is specified