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 Details

    • populateIdIfNecessary

      @Nullable T populateIdIfNecessary(@Nullable Object id)
      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

      @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

      @Nullable Object 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

      @Nullable ElasticsearchPersistentEntity<?> getPersistentEntity()
      Returns the ElasticsearchPersistentEntity associated with this entity.
      Returns:
      can be null if this entity is not mapped.
    • getRequiredPersistentEntity

      default ElasticsearchPersistentEntity<?> getRequiredPersistentEntity()
      Returns the required ElasticsearchPersistentEntity.
      Returns:
      Throws:
      IllegalStateException - if no ElasticsearchPersistentEntity is associated with this entity.