CosmosEntityInformation<T,ID> Class

  • java.lang.Object
    • org.springframework.data.repository.core.support.AbstractEntityInformation
      • com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation<T,ID>

Type Parameters

T

domain type.

ID

id type.

public class CosmosEntityInformation<T,ID>
extends org.springframework.data.repository.core.support.AbstractEntityInformation<T,ID>

Class to describe cosmosDb entity

Constructor Summary

Constructor Description
CosmosEntityInformation(Class<T> domainType)

Initialization

Method Summary

Modifier and Type Method and Description
String getContainerName()

Get container name

ID getId(T entity)

Get the field represented by the supplied id field on the specified entity.

Field getIdField()

Get id field

String getIdFieldName()

Get id field name

Class<ID> getIdType()

Get id type

IndexingPolicy getIndexingPolicy()

Get indexing policy

static CosmosEntityInformation<?,?> getInstance(Class<?> domainClass)

Static Factory

String getPartitionKeyFieldName()

Return the partition key field name.

Object getPartitionKeyFieldValue(T entity)

Get the field value represented by the supplied partitionKeyField object on the specified entity object.

String getPartitionKeyPath()

Get the computed partition key path for container

Integer getRequestUnit()

Get request unit value

Integer getTimeToLive()

Get timeToLive value

List<String> getTransientFields()

Get transient field list

UniqueKeyPolicy getUniqueKeyPolicy()

Gets the UniqueKeyPolicy

String getVersionFieldName()

Get name of field annotated with @Version if any

String getVersionFieldValue(Object entity)

Get the value of the field marked as the version field

boolean isAutoCreateContainer()

Check if auto creating container is allowed

boolean isAutoScale()

Check if container should use autoscale for resource units

boolean isIndexingPolicySpecified()

Return whether indexing policy is specified.

boolean isNew(T entity)
boolean isOverwriteIndexingPolicy()

Check if overwrite indexing policy is enabled

boolean isVersioned()

Check if is versioned

boolean shouldGenerateId()

Should generate Id field value

Methods inherited from java.lang.Object

Methods inherited from org.springframework.data.repository.core.support.AbstractEntityInformation

org.springframework.data.repository.core.support.AbstractEntityInformation.getJavaType org.springframework.data.repository.core.support.AbstractEntityInformation.isNew

Constructor Details

CosmosEntityInformation

public CosmosEntityInformation(Class domainType)

Initialization

Parameters:

domainType - to specify id field

Method Details

getContainerName

public String getContainerName()

Get container name

Returns:

container name

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

getIdType

public Class getIdType()

Get id type

Returns:

class of id type

getIndexingPolicy

public IndexingPolicy getIndexingPolicy()

Get indexing policy

Returns:

IndexingPolicy

getInstance

public static CosmosEntityInformation getInstance(Class domainClass)

Static Factory

Parameters:

domainClass - to specify id field

Returns:

new CosmosEntityInformation

getPartitionKeyFieldName

public String getPartitionKeyFieldName()

Return the partition key field name.

Returns:

the partition key field name

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

getPartitionKeyPath

public String getPartitionKeyPath()

Get the computed partition key path for container

Returns:

partition key path

getRequestUnit

public Integer getRequestUnit()

Get request unit value

Returns:

request unit

getTimeToLive

public Integer getTimeToLive()

Get timeToLive value

Returns:

timeToLive

getTransientFields

public List getTransientFields()

Get transient field list

Returns:

fields with @Transient annotation

getUniqueKeyPolicy

public UniqueKeyPolicy getUniqueKeyPolicy()

Gets the UniqueKeyPolicy

Returns:

UniqueKeyPolicy

getVersionFieldName

public String getVersionFieldName()

Get name of field annotated with @Version if any

Returns:

String

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

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()

Return whether indexing policy is specified.

Returns:

whether indexing policy is specified

isNew

public boolean isNew(T entity)

Overrides:

CosmosEntityInformation<T,ID>.isNew(T entity)

Parameters:

entity

isOverwriteIndexingPolicy

public boolean isOverwriteIndexingPolicy()

Check if overwrite indexing policy is enabled

Returns:

boolean

isVersioned

public boolean isVersioned()

Check if is versioned

Returns:

boolean

shouldGenerateId

public boolean shouldGenerateId()

Should generate Id field value

Returns:

boolean

Applies to