注解处理器父接口重命名 SaAnnotationAbstractHandler -> SaAnnotationHandlerInterface

This commit is contained in:
click33
2024-08-20 13:00:22 +08:00
parent c4b6a6381e
commit 0ca8a1ab2d
23 changed files with 42 additions and 42 deletions

View File

@@ -24,7 +24,7 @@ import java.lang.reflect.Method;
* @author click33
* @since 2024/8/2
*/
public interface SaAnnotationAbstractHandler<T extends Annotation> {
public interface SaAnnotationHandlerInterface<T extends Annotation> {
/**
* 获取所要处理的注解类型

View File

@@ -27,7 +27,7 @@ import java.lang.reflect.Method;
* @author click33
* @since 2024/8/2
*/
public class SaCheckDisableHandler implements SaAnnotationAbstractHandler<SaCheckDisable> {
public class SaCheckDisableHandler implements SaAnnotationHandlerInterface<SaCheckDisable> {
@Override
public Class<SaCheckDisable> getHandlerAnnotationClass() {

View File

@@ -26,7 +26,7 @@ import java.lang.reflect.Method;
* @author click33
* @since 2024/8/2
*/
public class SaCheckHttpBasicHandler implements SaAnnotationAbstractHandler<SaCheckHttpBasic> {
public class SaCheckHttpBasicHandler implements SaAnnotationHandlerInterface<SaCheckHttpBasic> {
@Override
public Class<SaCheckHttpBasic> getHandlerAnnotationClass() {

View File

@@ -28,7 +28,7 @@ import java.lang.reflect.Method;
* @author click33
* @since 2024/8/2
*/
public class SaCheckHttpDigestHandler implements SaAnnotationAbstractHandler<SaCheckHttpDigest> {
public class SaCheckHttpDigestHandler implements SaAnnotationHandlerInterface<SaCheckHttpDigest> {
@Override
public Class<SaCheckHttpDigest> getHandlerAnnotationClass() {

View File

@@ -27,7 +27,7 @@ import java.lang.reflect.Method;
* @author click33
* @since 2024/8/2
*/
public class SaCheckLoginHandler implements SaAnnotationAbstractHandler<SaCheckLogin> {
public class SaCheckLoginHandler implements SaAnnotationHandlerInterface<SaCheckLogin> {
@Override
public Class<SaCheckLogin> getHandlerAnnotationClass() {

View File

@@ -31,7 +31,7 @@ import java.util.List;
* @author click33
* @since 2024/8/2
*/
public class SaCheckOrHandler implements SaAnnotationAbstractHandler<SaCheckOr> {
public class SaCheckOrHandler implements SaAnnotationHandlerInterface<SaCheckOr> {
@Override
public Class<SaCheckOr> getHandlerAnnotationClass() {

View File

@@ -30,7 +30,7 @@ import java.lang.reflect.Method;
* @author click33
* @since 2024/8/2
*/
public class SaCheckPermissionHandler implements SaAnnotationAbstractHandler<SaCheckPermission> {
public class SaCheckPermissionHandler implements SaAnnotationHandlerInterface<SaCheckPermission> {
@Override
public Class<SaCheckPermission> getHandlerAnnotationClass() {

View File

@@ -28,7 +28,7 @@ import java.lang.reflect.Method;
* @author click33
* @since 2024/8/2
*/
public class SaCheckRoleHandler implements SaAnnotationAbstractHandler<SaCheckRole> {
public class SaCheckRoleHandler implements SaAnnotationHandlerInterface<SaCheckRole> {
@Override
public Class<SaCheckRole> getHandlerAnnotationClass() {

View File

@@ -27,7 +27,7 @@ import java.lang.reflect.Method;
* @author click33
* @since 2024/8/2
*/
public class SaCheckSafeHandler implements SaAnnotationAbstractHandler<SaCheckSafe> {
public class SaCheckSafeHandler implements SaAnnotationHandlerInterface<SaCheckSafe> {
@Override
public Class<SaCheckSafe> getHandlerAnnotationClass() {

View File

@@ -26,7 +26,7 @@ import java.lang.reflect.Method;
* @author click33
* @since 2024/8/2
*/
public class SaIgnoreHandler implements SaAnnotationAbstractHandler<SaIgnore> {
public class SaIgnoreHandler implements SaAnnotationHandlerInterface<SaIgnore> {
@Override
public Class<SaIgnore> getHandlerAnnotationClass() {

View File

@@ -18,7 +18,7 @@ package cn.dev33.satoken.listener;
import java.util.ArrayList;
import java.util.List;
import cn.dev33.satoken.annotation.handler.SaAnnotationAbstractHandler;
import cn.dev33.satoken.annotation.handler.SaAnnotationHandlerInterface;
import cn.dev33.satoken.config.SaTokenConfig;
import cn.dev33.satoken.error.SaErrorCode;
import cn.dev33.satoken.exception.SaTokenException;
@@ -292,7 +292,7 @@ public class SaTokenEventCenter {
* 事件发布:有新的注解处理器载入到框架中
* @param handler 注解处理器
*/
public static void doRegisterAnnotationHandler(SaAnnotationAbstractHandler<?> handler) {
public static void doRegisterAnnotationHandler(SaAnnotationHandlerInterface<?> handler) {
for (SaTokenListener listener : listenerList) {
listener.doRegisterAnnotationHandler(handler);
}

View File

@@ -15,7 +15,7 @@
*/
package cn.dev33.satoken.listener;
import cn.dev33.satoken.annotation.handler.SaAnnotationAbstractHandler;
import cn.dev33.satoken.annotation.handler.SaAnnotationHandlerInterface;
import cn.dev33.satoken.config.SaTokenConfig;
import cn.dev33.satoken.stp.SaLoginModel;
import cn.dev33.satoken.stp.StpLogic;
@@ -130,7 +130,7 @@ public interface SaTokenListener {
* 注册了自定义注解处理器
* @param handler 注解处理器
*/
default void doRegisterAnnotationHandler(SaAnnotationAbstractHandler<?> handler) {}
default void doRegisterAnnotationHandler(SaAnnotationHandlerInterface<?> handler) {}
/**
* StpLogic 对象替换

View File

@@ -15,7 +15,7 @@
*/
package cn.dev33.satoken.listener;
import cn.dev33.satoken.annotation.handler.SaAnnotationAbstractHandler;
import cn.dev33.satoken.annotation.handler.SaAnnotationHandlerInterface;
import cn.dev33.satoken.config.SaTokenConfig;
import cn.dev33.satoken.stp.SaLoginModel;
import cn.dev33.satoken.stp.StpLogic;
@@ -136,7 +136,7 @@ public class SaTokenListenerForLog implements SaTokenListener {
* @param handler 注解处理器
*/
@Override
public void doRegisterAnnotationHandler(SaAnnotationAbstractHandler<?> handler) {
public void doRegisterAnnotationHandler(SaAnnotationHandlerInterface<?> handler) {
if(handler != null) {
log.info("注解扩展 @{} (处理器: {})", handler.getHandlerAnnotationClass().getSimpleName(), handler.getClass().getCanonicalName());
}

View File

@@ -49,7 +49,7 @@ public final class SaAnnotationStrategy {
/**
* 注解处理器集合
*/
public Map<Class<?>, SaAnnotationAbstractHandler<?>> annotationHandlerMap = new LinkedHashMap<>();
public Map<Class<?>, SaAnnotationHandlerInterface<?>> annotationHandlerMap = new LinkedHashMap<>();
/**
* 注册所有默认的注解处理器
@@ -69,7 +69,7 @@ public final class SaAnnotationStrategy {
/**
* 注册一个注解处理器
*/
public void registerAnnotationHandler(SaAnnotationAbstractHandler<?> handler) {
public void registerAnnotationHandler(SaAnnotationHandlerInterface<?> handler) {
annotationHandlerMap.put(handler.getHandlerAnnotationClass(), handler);
SaTokenEventCenter.doRegisterAnnotationHandler(handler);
}
@@ -77,8 +77,8 @@ public final class SaAnnotationStrategy {
/**
* 注册一个注解处理器,到首位
*/
public void registerAnnotationHandlerToFirst(SaAnnotationAbstractHandler<?> handler) {
Map<Class<?>, SaAnnotationAbstractHandler<?>> newMap = new LinkedHashMap<>();
public void registerAnnotationHandlerToFirst(SaAnnotationHandlerInterface<?> handler) {
Map<Class<?>, SaAnnotationHandlerInterface<?>> newMap = new LinkedHashMap<>();
newMap.put(handler.getHandlerAnnotationClass(), handler);
newMap.putAll(annotationHandlerMap);
this.annotationHandlerMap = newMap;
@@ -98,7 +98,7 @@ public final class SaAnnotationStrategy {
@SuppressWarnings("unchecked")
public SaCheckMethodAnnotationFunction checkMethodAnnotation = (method) -> {
// 遍历所有的注解处理器,检查此 method 是否具有这些指定的注解
for (Map.Entry<Class<?>, SaAnnotationAbstractHandler<?>> entry: annotationHandlerMap.entrySet()) {
for (Map.Entry<Class<?>, SaAnnotationHandlerInterface<?>> entry: annotationHandlerMap.entrySet()) {
// 先校验 Method 所属 Class 上的注解
Annotation classTakeAnnotation = instance.getAnnotation.apply(method.getDeclaringClass(), (Class<Annotation>)entry.getKey());