- 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中
* @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 {
/**
* 获取settings
* @param builder 索引建造者
*/
void settings(IndexSettings.Builder builder);
}

View File

@ -42,136 +42,52 @@ public class JsonUtils {
return base;
}
/**
* 打印字符串
*
* @param data 数据
* @return json字符串
*/
public static String toJsonStr(Object data) {
return toJsonStr(OM_DEFAULT, data);
}
/**
* 字符数组
*
* @param data 数据
* @return json字符串
*/
public static byte[] toBytes(Object data) {
return toBytes(OM_DEFAULT, data);
}
/**
* 格式化打印字符串
*
* @param data 数据
* @return json字符串
*/
public static String toJsonPrettyStr(Object 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) {
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) {
return toBean(OM_DEFAULT, json, type);
}
/**
* 字符串 == bean
*
* @param json 字符串
* @param type 类型
* @param <T> 数据泛型
* @return bean
*/
public static <T> T toBean(String json, Type 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) {
return toList(OM_DEFAULT, json, v);
}
/**
* 字符串 == Set
*
* @param json 字符串
* @param <V> 数据泛型
* @return Set
*/
public static <V> Set<V> toSet(String json, Class<V> 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) {
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 {
return toCollection(OM_DEFAULT, json, parametrized, parameterClasses);
}
/**
* 字符串 == JsonNode
*
* @param json 字符串
* @return JsonNode
*/
public static JsonNode readTree(String json) {
return readTree(OM_DEFAULT, json);
}
/**
* 打印字符串
*
* @param data 数据
* @return json字符串
*/
public static String toJsonStr(ObjectMapper om, Object data) {
try {
if (data == null) {
@ -184,12 +100,6 @@ public class JsonUtils {
}
}
/**
* 字符数组
*
* @param data 数据
* @return json字符串
*/
public static byte[] toBytes(ObjectMapper om, Object data) {
try {
if (data == null) {
@ -202,12 +112,7 @@ public class JsonUtils {
}
}
/**
* 格式化打印字符串
*
* @param data 数据
* @return json字符串
*/
public static String toJsonPrettyStr(ObjectMapper om, Object data) {
try {
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) {
try {
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) {
try {
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) {
try {
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) {
try {
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) {
try {
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) {
try {
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 {
if (StringUtils.isEmpty(json)) {
return null;
@ -347,12 +199,6 @@ public class JsonUtils {
return om.readValue(json, type);
}
/**
* 字符串 == JsonNode
*
* @param json 字符串
* @return JsonNode
*/
public static JsonNode readTree(ObjectMapper om, String json) {
try {
if (StringUtils.isEmpty(json)) {

View File

@ -30,10 +30,10 @@ public class BaseCache {
/**
* 初始化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) {
// 初始化baseEsMapper的所有实现类实例

View File

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

View File

@ -470,7 +470,9 @@ public class WrapperProcessor {
/**
* 获取兜底索引名称
*
* @param entityClass 实体类
* @param indexName 索引名
* @param <T> 泛型
* @return 索引名称
*/
public static <T> String getIndexName(Class<T> entityClass, String indexName) {
@ -484,7 +486,9 @@ public class WrapperProcessor {
/**
* 获取兜底索引名称数组
*
* @param entityClass 实体类
* @param indexNames 原始索引名称数组
* @param <T> 泛型
* @return 目标索引名称数组
*/
public static <T> List<String> getIndexName(Class<T> entityClass, String[] indexNames) {
@ -502,8 +506,9 @@ public class WrapperProcessor {
/**
* 获取兜底索引名称数组
*
* @param entityClass 实体类
* @param indexNames 原始索引名称数组
* @param <T> 泛型
* @return 目标索引名称数组
*/
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 生成实体类
*
* @param config 配置
* @param client 客户端
*/
@SneakyThrows
public void generateEntity(GeneratorConfig config, ElasticsearchClient client) {

View File

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

View File

@ -967,6 +967,7 @@ public class IndexUtils {
* 根据配置生成创建索引参数
*
* @param entityInfo 配置信息
* @param clazz 实体类
* @return 创建索引参数
*/
public static CreateIndexParam getCreateIndexParam(EntityInfo entityInfo, Class<?> clazz) {
@ -999,6 +1000,7 @@ public class IndexUtils {
*
* @param entityInfo 实体信息
* @param fieldList 字段列表
* @param clazz 实体类
* @return 索引参数列表
*/
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)}获取相关数据
*
* @param request es请求参数
* @param <RequestT> 泛型
* @param <ResponseT> 泛型
* @param <ErrorT> 泛型
* @param mapper 序列化mapper
*/
public static <RequestT, ResponseT, ErrorT> void printDsl(RequestT request, JsonpMapper mapper) {
@ -96,6 +99,7 @@ public class PrintUtils {
*
* @param request es请求参数
* @param client es客户端
* @param <RequestT> 泛型
*/
public static <RequestT> void printDsl(RequestT request, ElasticsearchClient client) {
printDsl(request, client._jsonpMapper());

View File

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

View File

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

View File

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