- fix: javadoc注释调整
This commit is contained in:
xpc 2025-04-13 21:15:16 +08:00
parent f5ac2ffabb
commit 60fcd3c937
13 changed files with 125 additions and 265 deletions

View File

@ -32,6 +32,7 @@ public @interface IndexId {
/** /**
* 是否将主键写入到source中 * 是否将主键写入到source中
* @return 默认写入
*/ */
boolean writeToSource() default false; boolean writeToSource() default true;
} }

View File

@ -10,6 +10,7 @@ import co.elastic.clients.elasticsearch.indices.IndexSettings;
public interface ISettingsProvider { public interface ISettingsProvider {
/** /**
* 获取settings * 获取settings
* @param builder 索引建造者
*/ */
void settings(IndexSettings.Builder builder); void settings(IndexSettings.Builder builder);
} }

View File

@ -42,136 +42,52 @@ public class JsonUtils {
return base; return base;
} }
/**
* 打印字符串
*
* @param data 数据
* @return json字符串
*/
public static String toJsonStr(Object data) { public static String toJsonStr(Object data) {
return toJsonStr(OM_DEFAULT, data); return toJsonStr(OM_DEFAULT, data);
} }
/**
* 字符数组
*
* @param data 数据
* @return json字符串
*/
public static byte[] toBytes(Object data) { public static byte[] toBytes(Object data) {
return toBytes(OM_DEFAULT, data); return toBytes(OM_DEFAULT, data);
} }
/**
* 格式化打印字符串
*
* @param data 数据
* @return json字符串
*/
public static String toJsonPrettyStr(Object data) { public static String toJsonPrettyStr(Object data) {
return toJsonPrettyStr(OM_DEFAULT, data); return toJsonPrettyStr(OM_DEFAULT, data);
} }
/**
* 字符串 == bean
*
* @param json 字符串
* @param type 类型
* @param <T> 数据泛型
* @return bean
*/
public static <T> T toBean(String json, Class<T> type) { public static <T> T toBean(String json, Class<T> type) {
return toBean(OM_DEFAULT, json, type); return toBean(OM_DEFAULT, json, type);
} }
/**
* 字符串 == bean
*
* @param json 字符串
* @param type 类型
* @param <T> 数据泛型
* @return bean
*/
public static <T> T toBean(String json, TypeReference<T> type) { public static <T> T toBean(String json, TypeReference<T> type) {
return toBean(OM_DEFAULT, json, type); return toBean(OM_DEFAULT, json, type);
} }
/**
* 字符串 == bean
*
* @param json 字符串
* @param type 类型
* @param <T> 数据泛型
* @return bean
*/
public static <T> T toBean(String json, Type type) { public static <T> T toBean(String json, Type type) {
return toBean(OM_DEFAULT, json, type); return toBean(OM_DEFAULT, json, type);
} }
/**
* 字符串 == List
*
* @param json 字符串
* @param <V> 数据泛型
* @return List
*/
public static <V> List<V> toList(String json, Class<V> v) { public static <V> List<V> toList(String json, Class<V> v) {
return toList(OM_DEFAULT, json, v); return toList(OM_DEFAULT, json, v);
} }
/**
* 字符串 == Set
*
* @param json 字符串
* @param <V> 数据泛型
* @return Set
*/
public static <V> Set<V> toSet(String json, Class<V> v) { public static <V> Set<V> toSet(String json, Class<V> v) {
return toSet(OM_DEFAULT, json, v); return toSet(OM_DEFAULT, json, v);
} }
/**
* 字符串 == Map
*
* @param json 字符串
* @param <K> 键泛型
* @param <V> 值泛型
* @return Map
*/
public static <K, V> Map<K, V> toMap(String json, Class<K> k, Class<V> v) { public static <K, V> Map<K, V> toMap(String json, Class<K> k, Class<V> v) {
return toMap(OM_DEFAULT, json, k, v); return toMap(OM_DEFAULT, json, k, v);
} }
/**
* 字符串 == 集合Map, List, Set等
*
* @param json 字符串
* @param parametrized 主类型
* @param parameterClasses 类型参数
* @param <T> 集合泛型
* @return 集合
* @throws Exception 异常
*/
public static <T> T toCollection(String json, Class<?> parametrized, Class<?>... parameterClasses) throws Exception { public static <T> T toCollection(String json, Class<?> parametrized, Class<?>... parameterClasses) throws Exception {
return toCollection(OM_DEFAULT, json, parametrized, parameterClasses); return toCollection(OM_DEFAULT, json, parametrized, parameterClasses);
} }
/**
* 字符串 == JsonNode
*
* @param json 字符串
* @return JsonNode
*/
public static JsonNode readTree(String json) { public static JsonNode readTree(String json) {
return readTree(OM_DEFAULT, json); return readTree(OM_DEFAULT, json);
} }
/**
* 打印字符串
*
* @param data 数据
* @return json字符串
*/
public static String toJsonStr(ObjectMapper om, Object data) { public static String toJsonStr(ObjectMapper om, Object data) {
try { try {
if (data == null) { if (data == null) {
@ -184,12 +100,6 @@ public class JsonUtils {
} }
} }
/**
* 字符数组
*
* @param data 数据
* @return json字符串
*/
public static byte[] toBytes(ObjectMapper om, Object data) { public static byte[] toBytes(ObjectMapper om, Object data) {
try { try {
if (data == null) { if (data == null) {
@ -202,12 +112,7 @@ public class JsonUtils {
} }
} }
/**
* 格式化打印字符串
*
* @param data 数据
* @return json字符串
*/
public static String toJsonPrettyStr(ObjectMapper om, Object data) { public static String toJsonPrettyStr(ObjectMapper om, Object data) {
try { try {
if (data == null) { if (data == null) {
@ -220,14 +125,7 @@ public class JsonUtils {
} }
} }
/**
* 字符串 == bean
*
* @param json 字符串
* @param type 类型
* @param <T> 数据泛型
* @return bean
*/
public static <T> T toBean(ObjectMapper om, String json, Class<T> type) { public static <T> T toBean(ObjectMapper om, String json, Class<T> type) {
try { try {
if (StringUtils.isEmpty(json)) { if (StringUtils.isEmpty(json)) {
@ -240,14 +138,7 @@ public class JsonUtils {
} }
} }
/**
* 字符串 == bean
*
* @param json 字符串
* @param type 类型
* @param <T> 数据泛型
* @return bean
*/
public static <T> T toBean(ObjectMapper om, String json, TypeReference<T> type) { public static <T> T toBean(ObjectMapper om, String json, TypeReference<T> type) {
try { try {
if (StringUtils.isEmpty(json)) { if (StringUtils.isEmpty(json)) {
@ -260,14 +151,7 @@ public class JsonUtils {
} }
} }
/**
* 字符串 == bean
*
* @param json 字符串
* @param type 类型
* @param <T> 数据泛型
* @return bean
*/
public static <T> T toBean(ObjectMapper om, String json, Type type) { public static <T> T toBean(ObjectMapper om, String json, Type type) {
try { try {
if (StringUtils.isEmpty(json)) { if (StringUtils.isEmpty(json)) {
@ -280,13 +164,6 @@ public class JsonUtils {
} }
} }
/**
* 字符串 == List
*
* @param json 字符串
* @param <V> 数据泛型
* @return List
*/
public static <V> List<V> toList(ObjectMapper om, String json, Class<V> v) { public static <V> List<V> toList(ObjectMapper om, String json, Class<V> v) {
try { try {
return toCollection(om, json, List.class, v); return toCollection(om, json, List.class, v);
@ -296,13 +173,6 @@ public class JsonUtils {
} }
} }
/**
* 字符串 == Set
*
* @param json 字符串
* @param <V> 数据泛型
* @return Set
*/
public static <V> Set<V> toSet(ObjectMapper om, String json, Class<V> v) { public static <V> Set<V> toSet(ObjectMapper om, String json, Class<V> v) {
try { try {
return toCollection(om, json, Set.class, v); return toCollection(om, json, Set.class, v);
@ -312,14 +182,6 @@ public class JsonUtils {
} }
} }
/**
* 字符串 == Map
*
* @param json 字符串
* @param <K> 键泛型
* @param <V> 值泛型
* @return Map
*/
public static <K, V> Map<K, V> toMap(ObjectMapper om, String json, Class<K> k, Class<V> v) { public static <K, V> Map<K, V> toMap(ObjectMapper om, String json, Class<K> k, Class<V> v) {
try { try {
return toCollection(om, json, Map.class, k, v); return toCollection(om, json, Map.class, k, v);
@ -329,16 +191,6 @@ public class JsonUtils {
} }
} }
/**
* 字符串 == 集合Map, List, Set等
*
* @param json 字符串
* @param parametrized 主类型
* @param parameterClasses 类型参数
* @param <T> 集合泛型
* @return 集合
* @throws Exception 异常
*/
public static <T> T toCollection(ObjectMapper om, String json, Class<?> parametrized, Class<?>... parameterClasses) throws Exception { public static <T> T toCollection(ObjectMapper om, String json, Class<?> parametrized, Class<?>... parameterClasses) throws Exception {
if (StringUtils.isEmpty(json)) { if (StringUtils.isEmpty(json)) {
return null; return null;
@ -347,12 +199,6 @@ public class JsonUtils {
return om.readValue(json, type); return om.readValue(json, type);
} }
/**
* 字符串 == JsonNode
*
* @param json 字符串
* @return JsonNode
*/
public static JsonNode readTree(ObjectMapper om, String json) { public static JsonNode readTree(ObjectMapper om, String json) {
try { try {
if (StringUtils.isEmpty(json)) { if (StringUtils.isEmpty(json)) {

View File

@ -30,10 +30,10 @@ public class BaseCache {
/** /**
* 初始化mapper缓存 * 初始化mapper缓存
*
* @param mapperInterface mapper接口 * @param mapperInterface mapper接口
* @param client es客户端
* @param entityClass 实体类 * @param entityClass 实体类
* @param client es客户端
* @param <T> 泛型
*/ */
public static <T> void initMapperCache(Class<?> mapperInterface, Class<T> entityClass, ElasticsearchClient client) { public static <T> void initMapperCache(Class<?> mapperInterface, Class<T> entityClass, ElasticsearchClient client) {
// 初始化baseEsMapper的所有实现类实例 // 初始化baseEsMapper的所有实现类实例

View File

@ -23,9 +23,9 @@ public interface Index<Children, R> extends Serializable {
/** /**
* 设置索引的分片数和副本数 * 设置索引的分片数和副本数
*
* @param shards 分片数 * @param shards 分片数
* @param replicas 副本数 * @param replicas 副本数
* @param maxResultWindow 最大返回窗口
* @return wrapper * @return wrapper
*/ */
Children settings(Integer shards, Integer replicas, Integer maxResultWindow); Children settings(Integer shards, Integer replicas, Integer maxResultWindow);

View File

@ -470,7 +470,9 @@ public class WrapperProcessor {
/** /**
* 获取兜底索引名称 * 获取兜底索引名称
* * @param entityClass 实体类
* @param indexName 索引名
* @param <T> 泛型
* @return 索引名称 * @return 索引名称
*/ */
public static <T> String getIndexName(Class<T> entityClass, String indexName) { public static <T> String getIndexName(Class<T> entityClass, String indexName) {
@ -484,7 +486,9 @@ public class WrapperProcessor {
/** /**
* 获取兜底索引名称数组 * 获取兜底索引名称数组
* *
* @param entityClass 实体类
* @param indexNames 原始索引名称数组 * @param indexNames 原始索引名称数组
* @param <T> 泛型
* @return 目标索引名称数组 * @return 目标索引名称数组
*/ */
public static <T> List<String> getIndexName(Class<T> entityClass, String[] indexNames) { public static <T> List<String> getIndexName(Class<T> entityClass, String[] indexNames) {
@ -502,8 +506,9 @@ public class WrapperProcessor {
/** /**
* 获取兜底索引名称数组 * 获取兜底索引名称数组
* * @param entityClass 实体类
* @param indexNames 原始索引名称数组 * @param indexNames 原始索引名称数组
* @param <T> 泛型
* @return 目标索引名称数组 * @return 目标索引名称数组
*/ */
public static <T> List<String> getIndexName(Class<T> entityClass, Collection<String> indexNames) { public static <T> List<String> getIndexName(Class<T> entityClass, Collection<String> indexNames) {

View File

@ -34,6 +34,7 @@ public abstract class Generator {
* generate model entity 生成实体类 * generate model entity 生成实体类
* *
* @param config 配置 * @param config 配置
* @param client 客户端
*/ */
@SneakyThrows @SneakyThrows
public void generateEntity(GeneratorConfig config, ElasticsearchClient client) { public void generateEntity(GeneratorConfig config, ElasticsearchClient client) {

View File

@ -127,9 +127,8 @@ public class GeoUtils {
/** /**
* geoJson 转换 * geoJson 转换
*
* @param geometry geometry * @param geometry geometry
* @return Map<String, Object> * @return map
*/ */
public static Map<String, Object> toMap(Geometry geometry) { public static Map<String, Object> toMap(Geometry geometry) {
String geoJsonName = null; String geoJsonName = null;
@ -276,6 +275,7 @@ public class GeoUtils {
* *
* @param geometry geometry * @param geometry geometry
* @return String * @return String
* @throws Exception RuntimeException
*/ */
public static String getGeoJsonName(Geometry geometry) throws Exception { public static String getGeoJsonName(Geometry geometry) throws Exception {
return geometry.visit(new GeometryVisitor<String, Exception>() { return geometry.visit(new GeometryVisitor<String, Exception>() {

View File

@ -967,6 +967,7 @@ public class IndexUtils {
* 根据配置生成创建索引参数 * 根据配置生成创建索引参数
* *
* @param entityInfo 配置信息 * @param entityInfo 配置信息
* @param clazz 实体类
* @return 创建索引参数 * @return 创建索引参数
*/ */
public static CreateIndexParam getCreateIndexParam(EntityInfo entityInfo, Class<?> clazz) { public static CreateIndexParam getCreateIndexParam(EntityInfo entityInfo, Class<?> clazz) {
@ -999,6 +1000,7 @@ public class IndexUtils {
* *
* @param entityInfo 实体信息 * @param entityInfo 实体信息
* @param fieldList 字段列表 * @param fieldList 字段列表
* @param clazz 实体类
* @return 索引参数列表 * @return 索引参数列表
*/ */
public static List<EsIndexParam> initIndexParam(EntityInfo entityInfo, Class<?> clazz, List<EntityFieldInfo> fieldList) { public static List<EsIndexParam> initIndexParam(EntityInfo entityInfo, Class<?> clazz, List<EntityFieldInfo> fieldList) {

View File

@ -32,6 +32,9 @@ public class PrintUtils {
* 参考{@link ElasticsearchTransportBase#prepareTransportRequest(Object, Endpoint)}获取相关数据 * 参考{@link ElasticsearchTransportBase#prepareTransportRequest(Object, Endpoint)}获取相关数据
* *
* @param request es请求参数 * @param request es请求参数
* @param <RequestT> 泛型
* @param <ResponseT> 泛型
* @param <ErrorT> 泛型
* @param mapper 序列化mapper * @param mapper 序列化mapper
*/ */
public static <RequestT, ResponseT, ErrorT> void printDsl(RequestT request, JsonpMapper mapper) { public static <RequestT, ResponseT, ErrorT> void printDsl(RequestT request, JsonpMapper mapper) {
@ -96,6 +99,7 @@ public class PrintUtils {
* *
* @param request es请求参数 * @param request es请求参数
* @param client es客户端 * @param client es客户端
* @param <RequestT> 泛型
*/ */
public static <RequestT> void printDsl(RequestT request, ElasticsearchClient client) { public static <RequestT> void printDsl(RequestT request, ElasticsearchClient client) {
printDsl(request, client._jsonpMapper()); printDsl(request, client._jsonpMapper());

View File

@ -162,103 +162,103 @@
<!-- 使用个人资料由于生成javadoc和源jar以及使用GPG签署组件是一个相当耗时的过程因此这些执行通常与正常的构建配置隔离并移动到配置文件中。然后在通过激活配置文件执行部署时将使用此配置文件。 --> <!-- 使用个人资料由于生成javadoc和源jar以及使用GPG签署组件是一个相当耗时的过程因此这些执行通常与正常的构建配置隔离并移动到配置文件中。然后在通过激活配置文件执行部署时将使用此配置文件。 -->
<!-- <profiles>--> <profiles>
<!-- <profile>--> <profile>
<!-- <id>release</id>--> <id>release</id>
<!-- &lt;!&ndash; <id>ossrh</id>&ndash;&gt;--> <!-- <id>ossrh</id>-->
<!-- <activation>--> <activation>
<!-- <activeByDefault>true</activeByDefault>--> <activeByDefault>true</activeByDefault>
<!-- </activation>--> </activation>
<!-- <build>--> <build>
<!-- <plugins>--> <plugins>
<!-- <plugin>--> <plugin>
<!-- <groupId>org.sonatype.central</groupId>--> <groupId>org.sonatype.central</groupId>
<!-- <artifactId>central-publishing-maven-plugin</artifactId>--> <artifactId>central-publishing-maven-plugin</artifactId>
<!-- <version>0.5.0</version>--> <version>0.5.0</version>
<!-- <extensions>true</extensions>--> <extensions>true</extensions>
<!-- <configuration>--> <configuration>
<!-- <publishingServerId>central</publishingServerId>--> <publishingServerId>central</publishingServerId>
<!-- </configuration>--> </configuration>
<!-- </plugin>--> </plugin>
<!-- <plugin>--> <plugin>
<!-- <groupId>org.apache.maven.plugins</groupId>--> <groupId>org.apache.maven.plugins</groupId>
<!-- <artifactId>maven-source-plugin</artifactId>--> <artifactId>maven-source-plugin</artifactId>
<!-- <version>2.2.1</version>--> <version>2.2.1</version>
<!-- <executions>--> <executions>
<!-- <execution>--> <execution>
<!-- <id>attach-sources</id>--> <id>attach-sources</id>
<!-- <goals>--> <goals>
<!-- <goal>jar</goal>--> <goal>jar</goal>
<!-- </goals>--> </goals>
<!-- </execution>--> </execution>
<!-- </executions>--> </executions>
<!-- </plugin>--> </plugin>
<!-- <plugin>--> <plugin>
<!-- <groupId>org.apache.maven.plugins</groupId>--> <groupId>org.apache.maven.plugins</groupId>
<!-- <artifactId>maven-javadoc-plugin</artifactId>--> <artifactId>maven-javadoc-plugin</artifactId>
<!-- <configuration>--> <configuration>
<!-- <charset>UTF-8</charset>--> <charset>UTF-8</charset>
<!-- <encoding>UTF-8</encoding>--> <encoding>UTF-8</encoding>
<!-- <docencoding>UTF-8</docencoding>--> <docencoding>UTF-8</docencoding>
<!-- </configuration>--> </configuration>
<!-- <version>2.9.1</version>--> <version>2.9.1</version>
<!-- <executions>--> <executions>
<!-- <execution>--> <execution>
<!-- <id>attach-javadocs</id>--> <id>attach-javadocs</id>
<!-- <goals>--> <goals>
<!-- <goal>jar</goal>--> <goal>jar</goal>
<!-- </goals>--> </goals>
<!-- </execution>--> </execution>
<!-- </executions>--> </executions>
<!-- </plugin>--> </plugin>
<!-- &lt;!&ndash;maven发布到中央仓库 gpg 证书,自建仓库,可以注释该插件&ndash;&gt;--> <!--maven发布到中央仓库 gpg 证书,自建仓库,可以注释该插件-->
<!-- <plugin>--> <plugin>
<!-- <groupId>org.apache.maven.plugins</groupId>--> <groupId>org.apache.maven.plugins</groupId>
<!-- <artifactId>maven-gpg-plugin</artifactId>--> <artifactId>maven-gpg-plugin</artifactId>
<!-- <version>1.5</version>--> <version>1.5</version>
<!-- <executions>--> <executions>
<!-- <execution>--> <execution>
<!-- <id>sign-artifacts</id>--> <id>sign-artifacts</id>
<!-- <phase>verify</phase>--> <phase>verify</phase>
<!-- <goals>--> <goals>
<!-- <goal>sign</goal>--> <goal>sign</goal>
<!-- </goals>--> </goals>
<!-- </execution>--> </execution>
<!-- </executions>--> </executions>
<!-- </plugin>--> </plugin>
<!-- &lt;!&ndash;java getImplementationVersion获取版本号&ndash;&gt;--> <!--java getImplementationVersion获取版本号-->
<!-- <plugin>--> <plugin>
<!-- <groupId>org.apache.maven.plugins</groupId>--> <groupId>org.apache.maven.plugins</groupId>
<!-- <artifactId>maven-jar-plugin</artifactId>--> <artifactId>maven-jar-plugin</artifactId>
<!-- <version>${maven-jar-plugin.version}</version>--> <version>${maven-jar-plugin.version}</version>
<!-- <configuration>--> <configuration>
<!-- <archive>--> <archive>
<!-- <manifest>--> <manifest>
<!-- <addDefaultImplementationEntries>true</addDefaultImplementationEntries>--> <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<!-- </manifest>--> </manifest>
<!-- </archive>--> </archive>
<!-- </configuration>--> </configuration>
<!-- </plugin>--> </plugin>
<!-- </plugins>--> </plugins>
<!-- </build>--> </build>
<!-- &lt;!&ndash; 【注】snapshotRepository 与 repository 中的 id 一定要与 setting.xml 中 server 的 id 保持一致! &ndash;&gt;--> <!-- 【注】snapshotRepository 与 repository 中的 id 一定要与 setting.xml 中 server 的 id 保持一致! -->
<!-- <distributionManagement>--> <distributionManagement>
<!-- <snapshotRepository>--> <snapshotRepository>
<!-- &lt;!&ndash; <id>ossrh</id>&ndash;&gt;--> <!-- <id>ossrh</id>-->
<!-- <id>release</id>--> <id>release</id>
<!-- <url>https://oss.sonatype.org/content/repositories/snapshots</url>--> <url>https://oss.sonatype.org/content/repositories/snapshots</url>
<!-- </snapshotRepository>--> </snapshotRepository>
<!-- <repository>--> <repository>
<!-- <id>central</id>--> <id>central</id>
<!-- <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>--> <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<!-- </repository>--> </repository>
<!-- </distributionManagement>--> </distributionManagement>
<!-- </profile>--> </profile>
<!-- </profiles>--> </profiles>
</project> </project>

View File

@ -41,7 +41,7 @@ public class EsAutoConfiguration {
/** /**
* 装配ElasticsearchClient * 装配ElasticsearchClient
* * @param easyEsProperties 配置
* @return ElasticsearchClient bean * @return ElasticsearchClient bean
*/ */
@Bean @Bean

View File

@ -1,6 +1,7 @@
easy-es: easy-es:
# enable: true # enable: true
address: 10.18.2.45:9200 address: 10.18.2.45:9200
compatible: true
# schema: http # schema: http
# username: elastic # username: elastic
# password: mg123456 # password: mg123456
@ -25,7 +26,6 @@ easy-es:
# address: 10.18.2.45:9200 # 数据源2 # address: 10.18.2.45:9200 # 数据源2
#username: '若无可去掉此行' #username: '若无可去掉此行'
#password: '若无可去掉此行' #password: '若无可去掉此行'
compatible: true
#logging: #logging:
# level: # level:
# tracer: trace # tracer: trace