Interface ServiceSelector<T>

  • Type Parameters:
    T - selection input type

    public interface ServiceSelector<T>
    Code plugin to select a service from a given type. To be hooked into through configuration model and code generation.
    Author:
    Holger Eichelberger, SSE
    • Method Detail

      • select

        java.lang.String select​(T input)
        Selects a service based on the input.
        Parameters:
        input - the input to use
        Returns:
        the service id, null for staying with the actual service
      • actionCompleted

        default void actionCompleted​(java.lang.String id)
        Notifies that the action the selection was selected for is completed.
        Parameters:
        id - the selected service id, this may still be the same service id as before, null if no service is running
      • initial

        default void initial​(java.lang.String id)
        Called with the initial service id.
        Parameters:
        id - the service id
      • createStrategy

        default Strategy createStrategy()
        Returns the switching strategy.
        Returns:
        the switching strategy
      • createInstance

        static <T> ServiceSelector<T> createInstance​(java.lang.ClassLoader loader,
                                                     java.lang.String cls,
                                                     java.lang.Class<T> type,
                                                     java.lang.String dflt)
        Creates a selector instance with fallback.
        Type Parameters:
        T - the input type of the selector
        Parameters:
        loader - the class loader to use
        cls - the class name of the selector to instantiate
        type - the input type of the selector
        dflt - the default return value if the selector cannot be instantiated
        Returns:
        a (default) selector