Class ProviderInMemory<T>

java.lang.Object
net.tangly.core.providers.Provider<T>
net.tangly.core.providers.ProviderInMemory<T>
Type Parameters:
T - type of the instances handled in the provider

public class ProviderInMemory<T> extends Provider<T>
Provider where all instances are in memory. No persistence is provided.
  • Constructor Details

    • ProviderInMemory

      public ProviderInMemory()
  • Method Details

    • of

      public static <T> Provider<T> of()
    • of

      public static <T> Provider<T> of(@NotNull @NotNull Iterable<? extends T> items)
    • items

      public List<T> items()
      Description copied from class: Provider
      Returns a list containing all known instances of the entity type.
      Specified by:
      items in class Provider<T>
      Returns:
      list of all instances
    • update

      public void update(@NotNull T entity)
      Description copied from class: Provider
      Updates the data associated with the entity. If the entity is new, the update is handled as a create operation. The update is transitive and all referenced entities are also updated. The entity given as a parameter becomes the instance managed through the provider.
      Specified by:
      update in class Provider<T>
      Parameters:
      entity - entity to update
    • delete

      public void delete(@NotNull T entity)
      Description copied from class: Provider
      Deletes the data associated with the entity. The object identifier is invalidated.
      Specified by:
      delete in class Provider<T>
      Parameters:
      entity - entity to delete
    • deleteAll

      public void deleteAll()
      Description copied from class: Provider
      Deletes all the entities managed by the provider.
      Specified by:
      deleteAll in class Provider<T>