Interface AbstractEntitySet<T extends EntityType<?>,KEY extends Serializable,EC extends Collection<T>>

All Superinterfaces:
Iterable<T>, Serializable
All Known Implementing Classes:
EntitySetInvocationHandler, InlineEntitySetInvocationHandler

public interface AbstractEntitySet<T extends EntityType<?>,KEY extends Serializable,EC extends Collection<T>> extends Iterable<T>, Serializable
Interface for synchronous CRUD operations on an EntitySet.
  • Method Details

    • add

      boolean add(T entity)
    • exists

      Boolean exists(KEY key) throws IllegalArgumentException
      Returns whether an entity with the given id exists.
      Parameters:
      key - must not be null
      Returns:
      true if an entity with the given id exists, false otherwise
      Throws:
      IllegalArgumentException - in case the given key is null
    • getByKey

      T getByKey(KEY key) throws IllegalArgumentException
      Retrieves an entity by its key.
      Parameters:
      key - must not be null
      Returns:
      the entity with the given id or null if none found
      Throws:
      IllegalArgumentException - in case the given key is null
    • getByKey

      <S extends T> S getByKey(KEY key, Class<S> reference) throws IllegalArgumentException
      Retrieves an entity by its key, considering polymorphism.
      Type Parameters:
      S -
      Parameters:
      key - must not be null
      reference - entity class to be returned
      Returns:
      the entity with the given id or null if none found
      Throws:
      IllegalArgumentException - in case the given key is null
    • count

      Long count()
      Returns the number of entities available.
      Returns:
      the number of entities
    • delete

      void delete(KEY key) throws IllegalArgumentException
      Deletes the entity with the given key.
      Parameters:
      key - must not be null
      Throws:
      IllegalArgumentException - in case the given key is null
    • delete

      <S extends T> void delete(S entity)
      Deletes the given entity in a batch.
      Type Parameters:
      S -
      Parameters:
      entity - to be deleted
    • delete

      <S extends T> void delete(Iterable<S> entities)
      Deletes the given entities in a batch.
      Type Parameters:
      S -
      Parameters:
      entities - to be deleted
    • createSearch

      Search<T,EC> createSearch()
      Create an instance of Search.
      Returns:
      the new search instance
    • createSearch

      <S extends T, SEC extends EntityCollection<S, ?, ?>> Search<S,SEC> createSearch(Class<SEC> reference)
      Create an instance of Search.
      Type Parameters:
      S -
      SEC -
      Parameters:
      reference -
      Returns:
      the new search instance