Interface EntityOperations.AdaptableEntity<T>
- Enclosing class:
EntityOperations
public static interface EntityOperations.AdaptableEntity<T>
Information and commands on an entity.
- Since:
- 3.2
- Author:
- Mark Paluch, Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptiongetBean()Returns the underlying bean.@Nullable ObjectgetId()Returns the identifier of the entity.@Nullable ElasticsearchPersistentEntity<?> Returns theElasticsearchPersistentEntityassociated with this entity.default ElasticsearchPersistentEntity<?> Returns the requiredElasticsearchPersistentEntity.@Nullable Stringreturns the routing for the entity if it is available@Nullable SeqNoPrimaryTermReturns SeqNoPropertyTerm for this entity.@Nullable NumberReturns the current version value if the entity has a version property.booleanReturns 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.booleanisNew()Returns whether the entity is considered to be new.default booleanReturns whether the entity is versioned, i.e. if it contains a version property.@Nullable TpopulateIdIfNecessary(@Nullable Object id) Populates the identifier of the backing entity if it has an identifier property and there's no identifier currently present.
-
Method Details
-
populateIdIfNecessary
-
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
@Nullable Number 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
@Nullable SeqNoPrimaryTerm getSeqNoPrimaryTerm()Returns SeqNoPropertyTerm for this entity.- Returns:
- SeqNoPrimaryTerm, may be null
- Since:
- 4.0
-
getRouting
@Nullable String getRouting()returns the routing for the entity if it is available- Returns:
- routing if available
- Since:
- 4.1
-
getId
-
isVersionedEntity
default boolean isVersionedEntity()Returns whether the entity is versioned, i.e. if it contains a version property.- Returns:
-
getBean
-
isNew
boolean isNew()Returns whether the entity is considered to be new.- Returns:
-
getPersistentEntity
@Nullable ElasticsearchPersistentEntity<?> getPersistentEntity()Returns theElasticsearchPersistentEntityassociated with this entity.- Returns:
- can be null if this entity is not mapped.
-
getRequiredPersistentEntity
Returns the requiredElasticsearchPersistentEntity.- Returns:
- Throws:
IllegalStateException- if noElasticsearchPersistentEntityis associated with this entity.
-