类 StrategySelectorImpl
- java.lang.Object
-
- org.hibernate.boot.registry.selector.internal.StrategySelectorImpl
-
- 所有已实现的接口:
Serializable,StrategySelector,Service
public class StrategySelectorImpl extends Object implements StrategySelector
Standard implementation of the StrategySelector contract.- 作者:
- Steve Ebersole
- 另请参阅:
- 序列化表格
-
-
字段概要
字段 修饰符和类型 字段 说明 static StrategyCreatorSTANDARD_STRATEGY_CREATOR
-
构造器概要
构造器 构造器 说明 StrategySelectorImpl(ClassLoaderService classLoaderService)Constructs a StrategySelectorImpl using the given class loader service.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 CollectiongetRegisteredStrategyImplementors(Class strategy)Retrieve all of the registered implementors of the given strategy.<T> voidregisterStrategyImplementor(Class<T> strategy, String name, Class<? extends T> implementation)Registers a named implementor of a particular strategy contract.<T> TresolveDefaultableStrategy(Class<T> strategy, Object strategyReference, Callable<T> defaultResolver)Resolve strategy instances.<T> TresolveDefaultableStrategy(Class<T> strategy, Object strategyReference, T defaultValue)Resolve strategy instances.<T> TresolveStrategy(Class<T> strategy, Object strategyReference)Resolve strategy instances.<T> TresolveStrategy(Class<T> strategy, Object strategyReference, Callable<T> defaultResolver, StrategyCreator<T> creator)<T> TresolveStrategy(Class<T> strategy, Object strategyReference, T defaultValue, StrategyCreator<T> creator)<T> Class<? extends T>selectStrategyImplementor(Class<T> strategy, String name)Locate the named strategy implementation.<T> voidunRegisterStrategyImplementor(Class<T> strategy, Class<? extends T> implementation)Un-registers a named implementor of a particular strategy contract.
-
-
-
字段详细资料
-
STANDARD_STRATEGY_CREATOR
public static final StrategyCreator STANDARD_STRATEGY_CREATOR
-
-
构造器详细资料
-
StrategySelectorImpl
public StrategySelectorImpl(ClassLoaderService classLoaderService)
Constructs a StrategySelectorImpl using the given class loader service.- 参数:
classLoaderService- The class loader service usable by this StrategySelectorImpl instance.
-
-
方法详细资料
-
registerStrategyImplementor
public <T> void registerStrategyImplementor(Class<T> strategy, String name, Class<? extends T> implementation)
从接口复制的说明:StrategySelectorRegisters a named implementor of a particular strategy contract.- 指定者:
registerStrategyImplementor在接口中StrategySelector- 类型参数:
T- The type of the strategy. Used to make sure that the strategy and implementation are type compatible.- 参数:
strategy- The strategy contract.name- The registration nameimplementation- The implementation Class
-
unRegisterStrategyImplementor
public <T> void unRegisterStrategyImplementor(Class<T> strategy, Class<? extends T> implementation)
从接口复制的说明:StrategySelectorUn-registers a named implementor of a particular strategy contract. Un-registers all named registrations for the given strategy contract naming the given class.- 指定者:
unRegisterStrategyImplementor在接口中StrategySelector- 类型参数:
T- The type of the strategy. Used to make sure that the strategy and implementation are type compatible.- 参数:
strategy- The strategy contract.implementation- The implementation Class
-
selectStrategyImplementor
public <T> Class<? extends T> selectStrategyImplementor(Class<T> strategy, String name)
从接口复制的说明:StrategySelectorLocate the named strategy implementation.- 指定者:
selectStrategyImplementor在接口中StrategySelector- 类型参数:
T- The type of the strategy. Used to make sure that the strategy and implementation are type compatible.- 参数:
strategy- The type of strategy to be resolved.name- The name of the strategy to locate; might be either a registered name or the implementation FQN.- 返回:
- The named strategy implementation class.
-
resolveStrategy
public <T> T resolveStrategy(Class<T> strategy, Object strategyReference)
从接口复制的说明:StrategySelectorResolve strategy instances. See discussion onStrategySelector.resolveDefaultableStrategy(java.lang.Class<T>, java.lang.Object, T). Only difference is that here, the implied default value isnull.- 指定者:
resolveStrategy在接口中StrategySelector- 类型参数:
T- The type of the strategy. Used to make sure that the strategy and implementation are type compatible.- 参数:
strategy- The type (interface) of the strategy to be resolved.strategyReference- The reference to the strategy for which we need to resolve an instance.- 返回:
- The strategy instance
-
resolveDefaultableStrategy
public <T> T resolveDefaultableStrategy(Class<T> strategy, Object strategyReference, T defaultValue)
从接口复制的说明:StrategySelectorResolve strategy instances. The incoming reference might be:-
null- in which case defaultValue is returned. - An actual instance of the strategy type - it is returned, as is
-
A reference to the implementation
Class- an instance is created by callingClass.newInstance()(aka, the class's no-arg ctor). -
The name of the implementation class - First the implementation's
Classreference is resolved, and then an instance is created by callingClass.newInstance()
- 指定者:
resolveDefaultableStrategy在接口中StrategySelector- 类型参数:
T- The type of the strategy. Used to make sure that the strategy and implementation are type compatible.- 参数:
strategy- The type (interface) of the strategy to be resolved.strategyReference- The reference to the strategy for which we need to resolve an instance.defaultValue- THe default value to use if strategyReference is null- 返回:
- The strategy instance
-
-
resolveDefaultableStrategy
public <T> T resolveDefaultableStrategy(Class<T> strategy, Object strategyReference, Callable<T> defaultResolver)
从接口复制的说明:StrategySelectorResolve strategy instances. The incoming reference might be:-
null- in which case defaultValue is returned. - An actual instance of the strategy type - it is returned, as is
-
A reference to the implementation
Class- an instance is created by callingClass.newInstance()(aka, the class's no-arg ctor). -
The name of the implementation class - First the implementation's
Classreference is resolved, and then an instance is created by callingClass.newInstance()
- 指定者:
resolveDefaultableStrategy在接口中StrategySelector- 类型参数:
T- The type of the strategy. Used to make sure that the strategy and implementation are type compatible.- 参数:
strategy- The type (interface) of the strategy to be resolved.strategyReference- The reference to the strategy for which we need to resolve an instance.defaultResolver- A strategy for resolving the default value strategyReference resolves to null.- 返回:
- The strategy instance
-
-
resolveStrategy
public <T> T resolveStrategy(Class<T> strategy, Object strategyReference, T defaultValue, StrategyCreator<T> creator)
- 指定者:
resolveStrategy在接口中StrategySelector
-
getRegisteredStrategyImplementors
public Collection getRegisteredStrategyImplementors(Class strategy)
从接口复制的说明:StrategySelectorRetrieve all of the registered implementors of the given strategy. Useful to allow defaulting the choice to the single registered implementor when only one is registered- 指定者:
getRegisteredStrategyImplementors在接口中StrategySelector- 返回:
- The implementors. Should never return
null
-
resolveStrategy
public <T> T resolveStrategy(Class<T> strategy, Object strategyReference, Callable<T> defaultResolver, StrategyCreator<T> creator)
- 指定者:
resolveStrategy在接口中StrategySelector
-
-