Class BuildItemContainer<I,V>

java.lang.Object
io.spring.initializr.generator.buildsystem.BuildItemContainer<I,V>
Type Parameters:
I - the type of the identifier
V - the type of the item
Direct Known Subclasses:
BomContainer, DependencyContainer, MavenRepositoryContainer

public class BuildItemContainer<I,V> extends Object
A container for items.
Author:
Stephane Nicoll
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    BuildItemContainer(Map<I,V> items, Function<I, @Nullable V> itemResolver)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(I id)
    Lookup the item with the specified id and register it to this container.
    void
    add(I id, V item)
    Register the specified item with the specified id.
    @Nullable V
    get(I id)
    Return the item with the specified id or null if no such item exists.
    boolean
    has(I id)
    Specify if this container has an item with the specified id.
    ids()
    Return a Stream of registered identifiers.
    boolean
    Specify if this container is empty.
    Return a Stream of registered items.
    boolean
    remove(I id)
    Remove the item with the specified id.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BuildItemContainer

      protected BuildItemContainer(Map<I,V> items, Function<I, @Nullable V> itemResolver)
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Specify if this container is empty.
      Returns:
      true if no item is registered
    • has

      public boolean has(I id)
      Specify if this container has an item with the specified id.
      Parameters:
      id - the id of an item
      Returns:
      true if an item with the specified id is registered
    • ids

      public Stream<I> ids()
      Return a Stream of registered identifiers.
      Returns:
      a stream of ids
    • items

      public Stream<V> items()
      Return a Stream of registered items.
      Returns:
      a stream of items
    • get

      public @Nullable V get(I id)
      Return the item with the specified id or null if no such item exists.
      Parameters:
      id - the id of an item
      Returns:
      the item or null
    • add

      public void add(I id)
      Lookup the item with the specified id and register it to this container.
      Parameters:
      id - the id of an item
    • add

      public void add(I id, V item)
      Register the specified item with the specified id.
      Parameters:
      id - the id of the item
      item - the item to register
    • remove

      public boolean remove(I id)
      Remove the item with the specified id.
      Parameters:
      id - the id of the item to remove
      Returns:
      true if such an item was registered, false otherwise