public class InnerRsfApiBinder extends Object implements RsfApiBinder
RsfPublisher.ConfigurationBuilder<T>, RsfPublisher.FilterBindBuilder<T>, RsfPublisher.LinkedBuilder<T>, RsfPublisher.RegisterBuilder<T>ApiBinder.InjectConstructorBindingBuilder<T>, ApiBinder.InjectPropertyBindingBuilder<T>, ApiBinder.LifeBindingBuilder<T>, ApiBinder.LinkedBindingBuilder<T>, ApiBinder.MetaDataBindingBuilder<T>, ApiBinder.NamedBindingBuilder<T>, ApiBinder.OptionPropertyBindingBuilder<T>, ApiBinder.ScopedBindingBuilder<T>, ApiBinder.TypeSupplierBindingBuilder<T>| Modifier | Constructor and Description |
|---|---|
protected |
InnerRsfApiBinder(ApiBinder apiBinder,
RsfEnvironment rsfEnvironment) |
| Modifier and Type | Method and Description |
|---|---|
protected <T> RsfBindInfo<T> |
addService(net.hasor.rsf.container.ServiceDefine<T> serviceDefine) |
protected void |
addShareFilter(net.hasor.rsf.container.FilterDefine filterDefine) |
RsfPublisher |
bindFilter(String filterID,
BindInfo<RsfFilter> filterBindInfo)
添加全局的RsfFilter。
|
RsfPublisher |
bindFilter(String filterID,
Class<? extends RsfFilter> rsfFilterType)
添加全局的RsfFilter。
|
RsfPublisher |
bindFilter(String filterID,
RsfFilter instance)
添加全局的RsfFilter。
|
RsfPublisher |
bindFilter(String filterID,
Supplier<? extends RsfFilter> provider)
添加全局的RsfFilter。
|
void |
bindInterceptor(Predicate<Class<?>> matcherClass,
Predicate<Method> matcherMethod,
MethodInterceptor interceptor)
使用匹配器配置Aop。
|
void |
bindInterceptor(String matcherExpression,
MethodInterceptor interceptor)
使用表达式配置Aop。
|
<T extends Scope> |
bindScope(String scopeName,
Supplier<T> scopeSupplier)
注册作用域。
|
<T extends EventListener> |
bindSpiJudge(Class<T> spiType,
Supplier<SpiJudge> spiJudgeSupplier)
设置一个 SPI 仲裁,一个SPI只能注册一个仲裁
|
<T extends EventListener> |
bindSpiListener(Class<T> spiType,
Supplier<T> listener)
添加SPI监听器
|
<T> ApiBinder.NamedBindingBuilder<T> |
bindType(Class<T> type)
bind type to context , 通过返回的 Builder 可以对绑定进行后续更加细粒度的配置。
|
ApiBinder.LinkedBindingBuilder<PropertyDelegate> |
dynamicProperty(Predicate<Class<?>> matcherClass,
String propertyName,
Class<?> propertyType)
匹配类,将符合条件的 Bean 新增一个属性,该方法会生成属性对应的 get/set 方法。
|
ApiBinder.LinkedBindingBuilder<PropertyDelegate> |
dynamicReadOnlyProperty(Predicate<Class<?>> matcherClass,
String propertyName,
Class<?> propertyType)
匹配类,将符合条件的 Bean 新增一个只读属性,该方法会生成属性对应的 get 方法。
|
<T> List<BindInfo<T>> |
findBindingRegister(Class<T> bindType)
通过一个类型获取所有绑定该类型下的绑定信息。
|
<T> BindInfo<T> |
findBindingRegister(String withName,
Class<T> bindType)
通过一个类型获取所有绑定该类型下的绑定信息。
|
Set<Class<?>> |
findClass(Class<?> featureType)
在框架扫描包的范围内查找具有特征类集合(特征可以是继承的类、标记的注解)。
-- 该方法会放弃在匹配的过程中如果类无法被ClassLoader所加载的类。 |
Set<Class<?>> |
findClass(Class<?> featureType,
String... scanPackages)
在框架扫描包的范围内查找具有特征类集合(特征可以是继承的类、标记的注解)。
-- 该方法会放弃在匹配的过程中如果类无法被ClassLoader所加载的类。 |
Supplier<Scope> |
findScope(String scopeName)
根据名字查找作用域
|
<T> BindInfo<T> |
getBindInfo(Class<T> bindType)
根据ID获取
BindInfo |
<T> BindInfo<T> |
getBindInfo(String bindID)
根据ID获取
BindInfo |
RsfEnvironment |
getEnvironment()
|
ApiBinder |
installModule(Module... module)
安装其它插件。
|
boolean |
isSingleton(BindInfo<?> bindInfo)
是否为单例
|
boolean |
isSingleton(Class<?> targetType)
是否为单例
|
ApiBinder |
loadModule(Class<?> moduleType,
TypeSupplier typeSupplier)
加载带有 @DimModule 注解的类。
|
<T> RsfPublisher.ConfigurationBuilder<T> |
rsfService(BindInfo<T> bindInfo)
绑定一个类型到RSF环境。
|
<T> RsfPublisher.LinkedBuilder<T> |
rsfService(Class<T> type)
绑定一个类型到RSF环境。
|
<T> RsfPublisher.ConfigurationBuilder<T> |
rsfService(Class<T> type,
BindInfo<T> bindInfo)
绑定一个类型并且为这个类型指定一个实现类。开发者可以通过返回的 Builder 可以对绑定进行后续更加细粒度的绑定。
|
<T> RsfPublisher.ConfigurationBuilder<T> |
rsfService(Class<T> type,
Class<? extends T> implementation)
绑定一个类型并且为这个类型指定一个实现类。开发者可以通过返回的 Builder 可以对绑定进行后续更加细粒度的绑定。
|
<T> RsfPublisher.ConfigurationBuilder<T> |
rsfService(Class<T> type,
Supplier<T> provider)
绑定一个类型并且为这个类型指定一个Provider。开发者可以通过返回的 Builder 可以对绑定进行后续更加细粒度的绑定。
|
<T> RsfPublisher.ConfigurationBuilder<T> |
rsfService(Class<T> type,
T instance)
绑定一个类型并且为这个类型指定一个实例。开发者可以通过返回的 Builder 可以对绑定进行后续更加细粒度的绑定。
|
protected <T> Supplier<? extends T> |
toProvider(BindInfo<T> bindInfo) |
protected <T> Supplier<? extends T> |
toProvider(Class<T> bindInfo) |
<T extends ApiBinder> |
tryCast(Class<T> castApiBinder)
尝试把 ApiBinder 转换为另一个 ApiBinder(如果它支持)
tips: 如果不支持转换则返回空。 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbindFilter, bindFilter, bindFilter, bindFilter, rsfService, rsfService, rsfService, rsfService, rsfServicebindScope, bindScope, bindSpiJudge, bindSpiListener, bindType, bindType, bindType, bindType, bindType, bindType, bindType, findScope, getProvider, getProvider, lazyLoad, loadModule, loadModule, loadModule, loadSpiListener, loadSpiListener, loadSpiListener, loadSpiListener, onShutdown, onShutdownprotected InnerRsfApiBinder(ApiBinder apiBinder, RsfEnvironment rsfEnvironment)
protected <T> RsfBindInfo<T> addService(net.hasor.rsf.container.ServiceDefine<T> serviceDefine)
protected void addShareFilter(net.hasor.rsf.container.FilterDefine filterDefine)
public RsfEnvironment getEnvironment()
RsfApiBindergetEnvironment in interface ApiBindergetEnvironment in interface RsfApiBindergetEnvironment in interface RsfPublisherRsfEnvironmentpublic <T> RsfPublisher.ConfigurationBuilder<T> rsfService(BindInfo<T> bindInfo)
RsfApiBinderrsfService in interface RsfApiBinderbindInfo - 服务类型public Set<Class<?>> findClass(Class<?> featureType)
ApiBinderpublic Set<Class<?>> findClass(Class<?> featureType, String... scanPackages)
ApiBinderpublic <T extends ApiBinder> T tryCast(Class<T> castApiBinder)
ApiBinderpublic ApiBinder installModule(Module... module) throws Throwable
ApiBinderinstallModule in interface ApiBindermodule - 新安装的插件Throwable - 在执行loadModule方法期间发生异常的。Module.loadModule(ApiBinder)public boolean isSingleton(BindInfo<?> bindInfo)
ApiBinderisSingleton in interface ApiBinderpublic boolean isSingleton(Class<?> targetType)
ApiBinderisSingleton in interface ApiBinderpublic ApiBinder loadModule(Class<?> moduleType, TypeSupplier typeSupplier)
ApiBinderloadModule in interface ApiBinderpublic void bindInterceptor(String matcherExpression, MethodInterceptor interceptor)
ApiBinder例:
格式:<返回值> <类名>.<方法名>(<参数签名列表>) * *.*() 匹配:任意无参方法 * *.*(*) 匹配:任意方法 * *.add*(*) 匹配:任意add开头的方法 * *.add*(*,*) 匹配:任意add开头并且具有两个参数的方法。 * net.test.hasor.*(*) 匹配:包“net.test.hasor”下的任意类,任意方法。 * net.test.hasor.add*(*) 匹配:包“net.test.hasor”下的任意类,任意add开头的方法。 java.lang.String *.*(*) 匹配:任意返回值为String类型的方法。
bindInterceptor in interface ApiBindermatcherExpression - 格式为“<返回值> <类名>.<方法名>(<参数签名列表>)”interceptor - 拦截器对象public void bindInterceptor(Predicate<Class<?>> matcherClass, Predicate<Method> matcherMethod, MethodInterceptor interceptor)
ApiBinderbindInterceptor in interface ApiBindermatcherClass - 类型匹配器matcherMethod - 方法匹配器interceptor - 拦截器对象public ApiBinder.LinkedBindingBuilder<PropertyDelegate> dynamicProperty(Predicate<Class<?>> matcherClass, String propertyName, Class<?> propertyType)
ApiBinderdynamicProperty in interface ApiBindermatcherClass - 属性名propertyName - 属性名propertyType - 属性类型ApiBinder.LinkedBindingBuilder。public ApiBinder.LinkedBindingBuilder<PropertyDelegate> dynamicReadOnlyProperty(Predicate<Class<?>> matcherClass, String propertyName, Class<?> propertyType)
ApiBinderdynamicReadOnlyProperty in interface ApiBindermatcherClass - 属性名propertyName - 属性名propertyType - 属性类型ApiBinder.LinkedBindingBuilder。public <T> BindInfo<T> getBindInfo(String bindID)
ApiBinderBindInfogetBindInfo in interface ApiBinderpublic <T> BindInfo<T> getBindInfo(Class<T> bindType)
ApiBinderBindInfogetBindInfo in interface ApiBinderpublic <T> List<BindInfo<T>> findBindingRegister(Class<T> bindType)
ApiBinderfindBindingRegister in interface ApiBinderbindType - bean typepublic <T> BindInfo<T> findBindingRegister(String withName, Class<T> bindType)
ApiBinderfindBindingRegister in interface ApiBinderwithName - 绑定名bindType - bean typepublic <T> ApiBinder.NamedBindingBuilder<T> bindType(Class<T> type)
ApiBinder
-- ApiBinder.NamedBindingBuilder类型,为绑定起名字。继承自:ApiBinder.LinkedBindingBuilder
-- ApiBinder.LinkedBindingBuilder类型,为绑定设置实现方式。继承自:ApiBinder.InjectPropertyBindingBuilder
-- ApiBinder.InjectPropertyBindingBuilder类型,为绑定设置注入属性。继承自:ApiBinder.LifeBindingBuilder
-- ApiBinder.LifeBindingBuilder类型,为绑定设置生命周期方法配置。继承自:ApiBinder.ScopedBindingBuilder
-- ApiBinder.ScopedBindingBuilder类型,为绑定设置作用域。继承自:ApiBinder.OptionPropertyBindingBuilder
-- ApiBinder.OptionPropertyBindingBuilder类型,为绑定设置作用域。继承自:ApiBinder.MetaDataBindingBuilder
-- ApiBinder.MetaDataBindingBuilder类型,绑定元信息配置。
bindType in interface ApiBindertype - bean type。ApiBinder.NamedBindingBuilder。public <T extends EventListener> void bindSpiListener(Class<T> spiType, Supplier<T> listener)
ApiBinderbindSpiListener in interface ApiBinderpublic <T extends EventListener> void bindSpiJudge(Class<T> spiType, Supplier<SpiJudge> spiJudgeSupplier)
ApiBinderbindSpiJudge in interface ApiBinderpublic <T extends Scope> Supplier<T> bindScope(String scopeName, Supplier<T> scopeSupplier)
ApiBinderpublic Supplier<Scope> findScope(String scopeName)
ApiBinderpublic RsfPublisher bindFilter(String filterID, RsfFilter instance)
RsfPublisherbindFilter in interface RsfPublisherfilterID - filter IDinstance - 过滤器实例public RsfPublisher bindFilter(String filterID, BindInfo<RsfFilter> filterBindInfo)
RsfPublisherbindFilter in interface RsfPublisherfilterID - filter IDfilterBindInfo - provider for RsfFilterpublic RsfPublisher bindFilter(String filterID, Class<? extends RsfFilter> rsfFilterType)
RsfPublisherbindFilter in interface RsfPublisherfilterID - filter IDrsfFilterType - type for RsfFilterpublic RsfPublisher bindFilter(String filterID, Supplier<? extends RsfFilter> provider)
RsfPublisherbindFilter in interface RsfPublisherfilterID - filter IDprovider - provider for RsfFilterpublic <T> RsfPublisher.LinkedBuilder<T> rsfService(Class<T> type)
RsfPublisherrsfService in interface RsfPublishertype - 服务类型RsfPublisher.LinkedBuilderpublic <T> RsfPublisher.ConfigurationBuilder<T> rsfService(Class<T> type, T instance)
RsfPublisher
该方法相当于“rsfBinder.rsfService(type).toInstance(instance);”
rsfService in interface RsfPublishertype - 服务类型instance - 为绑定指定的实例对象。RsfPublisher.ConfigurationBuilderRsfPublisher.rsfService(Class)public <T> RsfPublisher.ConfigurationBuilder<T> rsfService(Class<T> type, Class<? extends T> implementation)
RsfPublisher
该方法相当于“rsfBinder.rsfService(type).to(implementation);”
rsfService in interface RsfPublishertype - 服务类型implementation - 为绑定指定的实现类。RsfPublisher.ConfigurationBuilderRsfPublisher.rsfService(Class)public <T> RsfPublisher.ConfigurationBuilder<T> rsfService(Class<T> type, Supplier<T> provider)
RsfPublisher
该方法相当于“rsfBinder.rsfService(type).toProvider(provider);”
rsfService in interface RsfPublishertype - 服务类型provider - 为绑定指定的实现类。RsfPublisher.ConfigurationBuilderRsfPublisher.rsfService(Class)public <T> RsfPublisher.ConfigurationBuilder<T> rsfService(Class<T> type, BindInfo<T> bindInfo)
RsfPublisher
该方法相当于“rsfBinder.rsfService(type).toInfo(bindInfo);”
rsfService in interface RsfPublishertype - 服务类型bindInfo - 为绑定指定的实现类。RsfPublisher.ConfigurationBuilderRsfPublisher.rsfService(Class)Copyright © 2020. All rights reserved.