Interface EntityOperations.AdaptableEntity<T>
- Enclosing class:
- EntityOperations
public static interface EntityOperations.AdaptableEntity<T>
Information and commands on an entity.
- Author:
- Mark Paluch, Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptiongetBean()
Returns the underlying bean.getId()
Returns the identifier of the entity.Returns theElasticsearchPersistentEntity
associated with this entity.default ElasticsearchPersistentEntity<?>
Returns the requiredElasticsearchPersistentEntity
.returns the routing for the entity if it is availableReturns SeqNoPropertyTerm for this entity.Returns the current version value if the entity has a version property.boolean
Returns whether there is a property with type SeqNoPrimaryTerm in this entity.Increments the value of the version property if available.Initializes the version property of the of the current entity if available.boolean
isNew()
Returns whether the entity is considered to be new.default boolean
Returns whether the entity is versioned, i.e. if it contains a version property.Populates the identifier of the backing entity if it has an identifier property and there's no identifier currently present.
-
Method Details
-
populateIdIfNecessary
Populates the identifier of the backing entity if it has an identifier property and there's no identifier currently present.- Parameters:
id
- can be null.- Returns:
- can be null.
-
initializeVersionProperty
T initializeVersionProperty()Initializes the version property of the of the current entity if available.- Returns:
- the entity with the version property updated if available.
-
incrementVersion
T incrementVersion()Increments the value of the version property if available.- Returns:
- the entity with the version property incremented if available.
-
getVersion
Returns the current version value if the entity has a version property.- Returns:
- the current version or null in case it's uninitialized or the entity doesn't expose a version property.
-
hasSeqNoPrimaryTerm
boolean hasSeqNoPrimaryTerm()Returns whether there is a property with type SeqNoPrimaryTerm in this entity.- Returns:
- true if there is SeqNoPrimaryTerm property
- Since:
- 4.0
-
getSeqNoPrimaryTerm
Returns SeqNoPropertyTerm for this entity.- Returns:
- SeqNoPrimaryTerm, may be null
- Since:
- 4.0
-
getRouting
returns the routing for the entity if it is available- Returns:
- routing if available
- Since:
- 4.1
-
getId
Returns the identifier of the entity.- Returns:
- the ID value, can be null.
-
isVersionedEntity
default boolean isVersionedEntity()Returns whether the entity is versioned, i.e. if it contains a version property.- Returns:
-
getBean
T getBean()Returns the underlying bean.- Returns:
-
isNew
boolean isNew()Returns whether the entity is considered to be new.- Returns:
-
getPersistentEntity
Returns theElasticsearchPersistentEntity
associated with this entity.- Returns:
- can be null if this entity is not mapped.
-
getRequiredPersistentEntity
Returns the requiredElasticsearchPersistentEntity
.- Returns:
- Throws:
IllegalStateException
- if noElasticsearchPersistentEntity
is associated with this entity.
-