Class SingletonEntityList

java.lang.Object
ch.tocco.nice2.persist.core.api.util.SingletonEntityList
All Implemented Interfaces:
EntityList, Iterable<Entity>

@Deprecated public class SingletonEntityList extends Object implements EntityList
Deprecated.
  • Constructor Details

    • SingletonEntityList

      public SingletonEntityList(Entity entity, EntityManager manager)
      Deprecated.
    • SingletonEntityList

      public SingletonEntityList(Entity entity)
      Deprecated.
  • Method Details

    • size

      public int size()
      Deprecated.
      Description copied from interface: EntityList
      Get the number of entities this list contains.
      Specified by:
      size in interface EntityList
      Returns:
      The number of entities.
    • isEmpty

      public boolean isEmpty()
      Deprecated.
      Description copied from interface: EntityList
      Same as size() == 0
      Specified by:
      isEmpty in interface EntityList
      Returns:
      If the list is empty.
    • getKeys

      public PrimaryKey[] getKeys()
      Deprecated.
      Description copied from interface: EntityList
      Read in subclasses if this array can contain null values or not.
      Specified by:
      getKeys in interface EntityList
      Returns:
      A defensive copy of the array. The size matches the EntityList.size() method.
    • get

      public Entity get(int index) throws PersistException
      Deprecated.
      Description copied from interface: EntityList
      Get the entity at the specified index with eager loading.

      This method will load a full page if the entity is currently hollow.

      Specified by:
      get in interface EntityList
      Parameters:
      index - The index.
      Returns:
      The entity at the specified index potentially in unusable state, or null.
      Throws:
      PersistException
    • get

      public Entity get(PrimaryKey key) throws PersistException
      Deprecated.
      Description copied from interface: EntityList
      Get the entity with the specified key in that list with eager loading.
      Specified by:
      get in interface EntityList
      Returns:
      The entity potentially in unusable state, or null.
      Throws:
      PersistException
      See Also:
    • get

      public Entity get(int index, boolean eager) throws PersistException
      Deprecated.
      Description copied from interface: EntityList
      Get the entity at the specified index.
      Specified by:
      get in interface EntityList
      Parameters:
      index - The index.
      eager - true, if a page should be eagerly loaded, if the entity's state is hollow, false otherwise.
      Returns:
      The entity at the specified index potentially in unusable state, or null.
      Throws:
      PersistException
    • get

      public Entity get(PrimaryKey key, boolean eager) throws PersistException
      Deprecated.
      Description copied from interface: EntityList
      Get the entity with the specified key in that list.
      Specified by:
      get in interface EntityList
      Parameters:
      key - The key of the entity.
      eager - true, if a page should be eagerly loaded, if the entity's state is hollow, false otherwise.
      Returns:
      The entity with the specified key potentially in unusable state, or null.
      Throws:
      PersistException
    • toList

      public List<Entity> toList() throws PersistException
      Deprecated.
      Description copied from interface: EntityList
      Returns the Entities of this list in a List using eager loading.
      Specified by:
      toList in interface EntityList
      Throws:
      PersistException
    • toList

      public List<Entity> toList(Predicate<Entity> filter) throws PersistException
      Deprecated.
      Description copied from interface: EntityList
      Returns the Entities of this list in a List using eager loading.
      Specified by:
      toList in interface EntityList
      Throws:
      PersistException
    • getKey

      public PrimaryKey getKey(int index)
      Deprecated.
      Description copied from interface: EntityList
      Returns the PrimaryKey at the specified position.
      Specified by:
      getKey in interface EntityList
    • indexOf

      public int indexOf(PrimaryKey key)
      Deprecated.
      Description copied from interface: EntityList
      Get the index within the list of the entity with the specified key.
      Specified by:
      indexOf in interface EntityList
      Parameters:
      key - The primary key.
      Returns:
      The index or -1, if there's no such entity in the list.
    • contains

      public boolean contains(PrimaryKey key)
      Deprecated.
      Description copied from interface: EntityList
      Determine, whether the list contains an entity with the specified key.
      Specified by:
      contains in interface EntityList
      Parameters:
      key - The primary key.
      Returns:
      true, if there's an entity with the specified key, false otherwise.
    • expect

      public EntityList expect(int amount) throws PermanentPersistException
      Deprecated.
      Description copied from interface: EntityList
      Throws if the list does not contain exactly that amount.

      Example: EntityList entityList = myQuery.execute(1).expect(1);

      Specified by:
      expect in interface EntityList
      Parameters:
      amount - The expected amount.
      Returns:
      The list itself.
      Throws:
      PermanentPersistException
      See Also:
    • expectAtLeast

      public EntityList expectAtLeast(int min) throws PermanentPersistException
      Deprecated.
      Description copied from interface: EntityList
      Throws if the list contains fewer than min items.

      Example: EntityList entityList = myQuery.execute().expectAtLeast(3);

      Specified by:
      expectAtLeast in interface EntityList
      Parameters:
      min - The expected minimal amount, including.
      Returns:
      The list itself.
      Throws:
      PermanentPersistException
      See Also:
    • expectAtMost

      public EntityList expectAtMost(int max) throws PermanentPersistException
      Deprecated.
      Description copied from interface: EntityList
      Throws if the list contains more than max items.

      Example: EntityList entityList = myQuery.execute(3).expectAtMost(3);

      Specified by:
      expectAtMost in interface EntityList
      Parameters:
      max - The expected maximal amount, including.
      Returns:
      The list itself.
      Throws:
      PermanentPersistException
      See Also:
    • getModel

      public EntityModel getModel()
      Deprecated.
      Description copied from interface: EntityList
      Get the model of the entity type contained in this list.
      Specified by:
      getModel in interface EntityList
      Returns:
      The model of the entity type contained in this list.
    • getManager

      public EntityManager getManager()
      Deprecated.
      Description copied from interface: EntityList
      Get the entity manager.
      Specified by:
      getManager in interface EntityList
      Returns:
      The entity manager.
    • unwrap

      public EntityList unwrap()
      Deprecated.
      Description copied from interface: EntityList
      Unwrap to the underlying entity list.

      Wrappers of entity lists should delegate this to the list they're wrapping, implementations return this. It may be that they cannot, and then return themselves (MultiEntityList).

      Specified by:
      unwrap in interface EntityList
      Returns:
      The underlying entity list implementation.
    • setPageSize

      public void setPageSize(int pageSize)
      Deprecated.
      Description copied from interface: EntityList
      Set the page size. The page size determines how many objects will be loaded, once a hollow entity has been accessed.
      Specified by:
      setPageSize in interface EntityList
      Parameters:
      pageSize - The new page size.
    • getPageSize

      public int getPageSize()
      Deprecated.
      Description copied from interface: EntityList
      Get the current page size.
      Specified by:
      getPageSize in interface EntityList
      Returns:
      The current page size.
    • getPageCount

      public int getPageCount()
      Deprecated.
      Description copied from interface: EntityList
      Get the number of pages in this list.
      Specified by:
      getPageCount in interface EntityList
      Returns:
      The number of pages in this list (size/pageSize + (size%pageSize>0 ? 1 : 0)).
    • iterator

      public Iterator<Entity> iterator()
      Deprecated.
      Specified by:
      iterator in interface Iterable<Entity>