From 776acc6e5c652dd6cf9324dad5dd07f7d0d31305 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=90=B4=E6=B3=BD=E5=A8=81?= <958142070@qq.com>
Date: Wed, 24 Dec 2025 17:55:32 +0800
Subject: [PATCH] =?UTF-8?q?feat(api-doc):=20=E5=A2=9E=E5=8A=A0=E5=9F=BA?=
=?UTF-8?q?=E7=A1=80=E6=9E=9A=E4=B8=BE=E5=A4=84=E7=90=86=E5=99=A8=E6=94=AF?=
=?UTF-8?q?=E6=8C=81=E6=9E=9A=E4=B8=BE=E6=8F=92=E4=BB=B6=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- pom.xml 中添加 nextdoc4j-plugin-enums 依赖
- 在 SpringDocAutoConfiguration 中新增 BaseEnumProcessor Bean
- 实现 BaseEnumProcessor 用于 nextdoc4j 枚举插件支持
- BaseEnumProcessor 判断枚举类型并关联 BaseEnum 接口
---
continew-starter-api-doc/pom.xml | 6 +++
.../SpringDocAutoConfiguration.java | 12 ++++++
.../apidoc/processor/BaseEnumProcessor.java | 42 +++++++++++++++++++
3 files changed, 60 insertions(+)
create mode 100644 continew-starter-api-doc/src/main/java/top/continew/starter/apidoc/processor/BaseEnumProcessor.java
diff --git a/continew-starter-api-doc/pom.xml b/continew-starter-api-doc/pom.xml
index be55cab2..9aa4ca51 100644
--- a/continew-starter-api-doc/pom.xml
+++ b/continew-starter-api-doc/pom.xml
@@ -28,5 +28,11 @@
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * http://www.gnu.org/licenses/lgpl.html + *
+ * 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 top.continew.starter.apidoc.processor; + +import cn.hutool.core.util.ClassUtil; +import org.springframework.stereotype.Component; +import top.continew.starter.core.enums.BaseEnum; +import top.nextdoc4j.enums.resolver.EnumMetadataResolver; + +/** + * 基础枚举处理器 - nextdoc4j 枚举插件展示枚举值 + * + * @author echo + * @since 2.15.0 + */ +@Component +public class BaseEnumProcessor implements EnumMetadataResolver { + @Override + public boolean supports(Class> aClass) { + return aClass != null && aClass.isEnum() && ClassUtil.isAssignable(BaseEnum.class, aClass); + } + + @Override + public Class> getEnumInterfaceType() { + return BaseEnum.class; + } + +}