net.hasor.rsf.container.InnerRsfApiBinder Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2008-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.hasor.rsf.container;
import net.hasor.core.*;
import net.hasor.core.aop.PropertyDelegate;
import net.hasor.core.binder.ApiBinderWrap;
import net.hasor.core.spi.SpiJudge;
import net.hasor.rsf.RsfApiBinder;
import net.hasor.rsf.RsfBindInfo;
import net.hasor.rsf.RsfEnvironment;
import java.lang.reflect.Method;
import java.util.EventListener;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.function.Predicate;
import java.util.function.Supplier;
/**
* 服务注册器
*
* @author 赵永春 ([email protected])
* @version : 2014年11月12日
*/
public class InnerRsfApiBinder extends AbstractRsfBindBuilder implements RsfApiBinder {
private final ApiBinder apiBinder;
private final RsfEnvironment rsfEnvironment;
protected InnerRsfApiBinder(ApiBinder apiBinder, RsfEnvironment rsfEnvironment) {
super();
this.apiBinder = new ApiBinderWrap(Objects.requireNonNull(apiBinder));
this.rsfEnvironment = Objects.requireNonNull(rsfEnvironment);
}
@Override
protected Supplier extends T> toProvider(BindInfo bindInfo) {
return this.apiBinder.getProvider(bindInfo);
}
@Override
protected Supplier extends T> toProvider(Class bindInfo) {
return this.apiBinder.getProvider(bindInfo);
}
@Override
protected RsfBindInfo addService(ServiceDefine serviceDefine) {
this.bindType(ServiceDefine.class).uniqueName().toInstance(serviceDefine);
return serviceDefine;
}
@Override
protected void addShareFilter(FilterDefine filterDefine) {
this.bindType(FilterDefine.class).uniqueName().toInstance(filterDefine);
}
@Override
public RsfEnvironment getEnvironment() {
return this.rsfEnvironment;
}
@Override
public ConfigurationBuilder rsfService(BindInfo bindInfo) {
return this.rsfService(bindInfo.getBindType()).toInfo(bindInfo);
}
@Override
public Set> findClass(Class> featureType) {
return this.apiBinder.findClass(featureType);
}
@Override
public Set> findClass(Class> featureType, String... scanPackages) {
return this.apiBinder.findClass(featureType, scanPackages);
}
@Override
public T tryCast(Class castApiBinder) {
return this.apiBinder.tryCast(castApiBinder);
}
@Override
public ApiBinder installModule(Module... module) throws Throwable {
return this.apiBinder.installModule(module);
}
@Override
public boolean isSingleton(BindInfo> bindInfo) {
return this.apiBinder.isSingleton(bindInfo);
}
@Override
public boolean isSingleton(Class> targetType) {
return this.apiBinder.isSingleton(targetType);
}
@Override
public ApiBinder loadModule(Class> moduleType, TypeSupplier typeSupplier) {
return this.apiBinder.loadModule(moduleType, typeSupplier);
}
@Override
public void bindInterceptor(String matcherExpression, MethodInterceptor interceptor) {
this.apiBinder.bindInterceptor(matcherExpression, interceptor);
}
@Override
public void bindInterceptor(Predicate> matcherClass, Predicate matcherMethod, MethodInterceptor interceptor) {
this.apiBinder.bindInterceptor(matcherClass, matcherMethod, interceptor);
}
@Override
public LinkedBindingBuilder dynamicProperty(Predicate> matcherClass, String propertyName, Class> propertyType) {
return this.apiBinder.dynamicProperty(matcherClass, propertyName, propertyType);
}
@Override
public LinkedBindingBuilder dynamicReadOnlyProperty(Predicate> matcherClass, String propertyName, Class> propertyType) {
return this.apiBinder.dynamicReadOnlyProperty(matcherClass, propertyName, propertyType);
}
@Override
public BindInfo getBindInfo(String bindID) {
return this.apiBinder.getBindInfo(bindID);
}
@Override
public BindInfo getBindInfo(Class bindType) {
return this.apiBinder.getBindInfo(bindType);
}
@Override
public List> findBindingRegister(Class bindType) {
return this.apiBinder.findBindingRegister(bindType);
}
@Override
public BindInfo findBindingRegister(String withName, Class bindType) {
return this.apiBinder.findBindingRegister(withName, bindType);
}
@Override
public NamedBindingBuilder bindType(Class type) {
return this.apiBinder.bindType(type);
}
@Override
public void bindSpiListener(Class spiType, Supplier extends T> listener) {
this.apiBinder.bindSpiListener(spiType, listener);
}
@Override
public void bindSpiJudge(Class spiType, Supplier spiJudgeSupplier) {
this.apiBinder.bindSpiJudge(spiType, spiJudgeSupplier);
}
@Override
public Supplier bindScope(String scopeName, Supplier scopeSupplier) {
return this.apiBinder.bindScope(scopeName, scopeSupplier);
}
@Override
public Supplier findScope(String scopeName) {
return this.apiBinder.findScope(scopeName);
}
}