com.kuaishou.business.extension.spring.AbstractExtActuator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kbf-spring-extension Show documentation
Show all versions of kbf-spring-extension Show documentation
kwai-business-extension-framwork
The newest version!
package com.kuaishou.business.extension.spring;
import java.util.Set;
import java.util.function.Supplier;
import com.kuaishou.business.core.extpoint.ExtPoint;
import com.kuaishou.business.core.function.ExtAction;
import com.kuaishou.business.core.function.ExtCallback;
import com.kuaishou.business.core.identity.manage.NormalProductItem;
import com.kuaishou.business.core.reduce.Reducer;
import com.kuaishou.business.extension.engine.ExtActuator;
import lombok.extern.slf4j.Slf4j;
/**
* @author liuzhuo
* Created on 2023-03-17 下午5:42
* 扩展点识别(全局扫描)
*/
@Slf4j
public abstract class AbstractExtActuator implements ExtActuator {
@Override
public void executeVoid(Class extClz, ExtAction extMethod, Runnable defaultMethod, Reducer reducer, P request) {
execute(extClz, ext -> {
extMethod.accept(ext);
return null;
}, () -> {
defaultMethod.run();
return null;
}, reducer, request);
}
protected abstract Set recognize(P request);
@Override
public R execute(Class extClz, ExtCallback extMethod, Supplier defaultMethod, Reducer reducer, P request) {
SpringSimpleExecutor simpleExecutor = new SpringSimpleExecutor();
String methodName = KbfMethodsUtils.getMethodFromCallback(extClz, extMethod);
return simpleExecutor.execute(extClz, methodName, extMethod, defaultMethod, reducer, request);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy