Service which acts as a registry for named strategy implementations.
Strategies are more open ended than services, though a strategy managed here might very well also be a service. The
strategy is any interface that has multiple, (possibly short) named implementations.
StrategySelector manages resolution of particular implementation by (possibly short) name via the
StrategySelector.selectStrategyImplementor(java.lang.Class<T>, java.lang.String)
method, which is the main contract here. As indicated in the docs of that
method the given name might be either a short registered name or the implementation FQN. As an example, consider
resolving the
TransactionCoordinatorBuilder
implementation to use. To use the
JDBC-based TransactionCoordinatorBuilder the passed name might be either
"jdbc"
or
"org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorBuilderImpl"
(which is the FQN).
Strategy implementations can be managed by
StrategySelector.registerStrategyImplementor(java.lang.Class<T>, java.lang.String, java.lang.Class<? extends T>)
and
StrategySelector.unRegisterStrategyImplementor(java.lang.Class<T>, java.lang.Class<? extends T>)
. Originally designed to help the OSGi use case, though no longer used there.
The service also exposes a general typing API via
StrategySelector.resolveStrategy(java.lang.Class<T>, java.lang.Object)
and
StrategySelector.resolveDefaultableStrategy(java.lang.Class<T>, java.lang.Object, T)
which accept implementation references rather than implementation names, allowing for a multitude of interpretations
of said "implementation reference". See the docs for
StrategySelector.resolveDefaultableStrategy(java.lang.Class<T>, java.lang.Object, T)
for details.