Class LookupStub

java.lang.Object
org.apache.maven.api.plugin.testing.stubs.LookupStub
All Implemented Interfaces:
Service, Lookup

public class LookupStub extends Object implements Lookup
A stub implementation of Lookup for testing purposes. Provides a simple service lookup mechanism for tests.
Since:
4.0.0
  • Field Details

    • EMPTY

      public static final Lookup EMPTY
  • Constructor Details

    • LookupStub

      protected LookupStub()
      For sub-class constructors.
  • Method Details

    • lookup

      public <T> T lookup(Class<T> type)
      Description copied from interface: Lookup
      Performs a lookup for given typed component.
      Specified by:
      lookup in interface Lookup
      Type Parameters:
      T - The component type.
      Parameters:
      type - The component type.
      Returns:
      The component.
    • lookup

      public <T> T lookup(Class<T> type, String string)
      Description copied from interface: Lookup
      Performs a lookup for given typed component.
      Specified by:
      lookup in interface Lookup
      Type Parameters:
      T - The component type.
      Parameters:
      type - The component type.
      string - The component name.
      Returns:
      The component.
    • lookupOptional

      public <T> Optional<T> lookupOptional(Class<T> type)
      Description copied from interface: Lookup
      Performs a lookup for optional typed component.
      Specified by:
      lookupOptional in interface Lookup
      Type Parameters:
      T - The component type.
      Parameters:
      type - The component type.
      Returns:
      Optional carrying component or empty optional if no such component.
    • lookupOptional

      public <T> Optional<T> lookupOptional(Class<T> type, String string)
      Description copied from interface: Lookup
      Performs a lookup for optional typed component.
      Specified by:
      lookupOptional in interface Lookup
      Type Parameters:
      T - The component type.
      Parameters:
      type - The component type.
      string - The component name.
      Returns:
      Optional carrying component or empty optional if no such component.
    • lookupList

      public <T> List<T> lookupList(Class<T> type)
      Description copied from interface: Lookup
      Performs a collection lookup for given typed components.
      Specified by:
      lookupList in interface Lookup
      Type Parameters:
      T - The component type.
      Parameters:
      type - The component type.
      Returns:
      The list of components. The list may be empty if no components found.
    • lookupMap

      public <T> Map<String,T> lookupMap(Class<T> type)
      Description copied from interface: Lookup
      Performs a collection lookup for given typed components.
      Specified by:
      lookupMap in interface Lookup
      Type Parameters:
      T - The component type.
      Parameters:
      type - The component type.
      Returns:
      The map of components. The map may be empty if no components found.