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 Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidactionCompleted(java.lang.String id)Notifies that the action the selection was selected for is completed.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.default StrategycreateStrategy()Returns the switching strategy.default voidinitial(java.lang.String id)Called with the initial service id.java.lang.Stringselect(T input)Selects a service based on the input.
-
-
-
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 usecls- the class name of the selector to instantiatetype- the input type of the selectordflt- the default return value if the selector cannot be instantiated- Returns:
- a (default) selector
-
-