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
Modifier and TypeMethodDescriptiondefault voidNotifies that the action the selection was selected for is completed.static <T> ServiceSelector<T> createInstance(ClassLoader loader, String cls, Class<T> type, String dflt) Creates a selector instance with fallback.default StrategyReturns the switching strategy.default voidCalled with the initial service id.Selects a service based on the input.
-
Method Details
-
select
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
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
Called with the initial service id.- Parameters:
id- the service id
-
createStrategy
Returns the switching strategy.- Returns:
- the switching strategy
-
createInstance
static <T> ServiceSelector<T> createInstance(ClassLoader loader, String cls, Class<T> type, 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
-