mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
Compare commits
24 Commits
v6-dev
...
1a102f9359
Author | SHA1 | Date | |
---|---|---|---|
|
1a102f9359 | ||
|
51b9bfd8bb | ||
|
f8bf24aa0c | ||
|
05dfc221a5 | ||
|
8b3e6c99c4 | ||
|
80eccf98bb | ||
|
6d493b2fc9 | ||
|
eb68f61a18 | ||
|
9cbeea018d | ||
|
74738b67ca | ||
|
c8199504fc | ||
|
861b961b6f | ||
|
49093afcd4 | ||
|
2a90c4b7b5 | ||
|
bedfa07a8a | ||
|
07739d72db | ||
|
45419bb8dc | ||
|
570f846d4d | ||
|
1b54272ea8 | ||
|
869b82b8d0 | ||
|
33aa3ecf3a | ||
|
d58d5ea032 | ||
|
038a6ca0c8 | ||
|
22d487624d |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1,4 +1,4 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [Looly]
|
||||
custom: ['https://gitee.com/dromara/hutool', 'https://dromara.gitee.io/donate.html']
|
||||
custom: ['https://gitee.com/chinabugotech/hutool']
|
||||
|
38
README-EN.md
Executable file → Normal file
38
README-EN.md
Executable file → Normal file
@@ -33,11 +33,11 @@
|
||||
<a target="_blank" href='https://gitee.com/dromara/hutool/stargazers'>
|
||||
<img src='https://gitee.com/dromara/hutool/badge/star.svg?theme=gvp' alt='star'/>
|
||||
</a>
|
||||
<a target="_blank" href='https://github.com/dromara/hutool'>
|
||||
<img src="https://img.shields.io/github/stars/dromara/hutool.svg?style=social" alt="github star"/>
|
||||
<a target="_blank" href='https://github.com/chinabugotech/hutool'>
|
||||
<img src="https://img.shields.io/github/stars/chinabugotech/hutool.svg?style=social" alt="github star"/>
|
||||
</a>
|
||||
<a target="_blank" href='https://gitcode.com/dromara/hutool'>
|
||||
<img src="https://gitcode.com/dromara/hutool/star/badge.svg" alt="gitcode star"/>
|
||||
<a target="_blank" href='https://gitcode.com/chinabugotech/hutool'>
|
||||
<img src="https://gitcode.com/chinabugotech/hutool/star/badge.svg" alt="gitcode star"/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -126,32 +126,32 @@ Each module can be introduced individually, or all modules can be introduced by
|
||||
### 🍊Maven
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.dromara.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>6.0.0-M22</version>
|
||||
<groupId>cn.hutool.v7</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>7.0.0-M1</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
### 🍐Gradle
|
||||
```
|
||||
implementation 'org.dromara.hutool:hutool-all:6.0.0-M22'
|
||||
implementation 'cn.hutool.v7:hutool-all:7.0.0-M1'
|
||||
```
|
||||
|
||||
## 📥Download
|
||||
|
||||
- [Maven Repo](https://repo1.maven.org/maven2/cn/hutool/hutool-all/6.0.0-M22/)
|
||||
- [Maven Repo](https://repo1.maven.org/maven2/cn/hutool/v7/hutool-all/7.0.0-M1/)
|
||||
|
||||
> 🔔️note:
|
||||
> Hutool 5.x supports JDK8+ and is not tested on Android platforms, and cannot guarantee that all tool classes or tool methods are available.
|
||||
> Hutool 7.x supports JDK17 and is not tested on Android platforms, and cannot guarantee that all tool classes or tool methods are available.
|
||||
> If your project uses JDK7, please use Hutool 4.x version.
|
||||
|
||||
### 🚽Compile and install
|
||||
|
||||
Download the entire project source code
|
||||
|
||||
gitee:[https://gitee.com/dromara/hutool](https://gitee.com/dromara/hutool)
|
||||
gitee:[https://gitee.com/chinabugotech/hutool](https://gitee.com/chinabugotech/hutool)
|
||||
|
||||
github:[https://github.com/dromara/hutool](https://github.com/dromara/hutool)
|
||||
github:[https://github.com/chinabugotech/hutool](https://github.com/chinabugotech/hutool)
|
||||
|
||||
```sh
|
||||
cd ${hutool}
|
||||
@@ -168,16 +168,16 @@ Hutool's source code is divided into two branches:
|
||||
|
||||
| branch | description |
|
||||
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| v6-master | The master branch, the branch used by the release version, is the same as the jar committed to the central repository and does not receive any pr or modifications. |
|
||||
| v6-dev | Development branch, which defaults to the next SNAPSHOT version, accepts modifications or pr |
|
||||
| v7-master | The master branch, the branch used by the release version, is the same as the jar committed to the central repository and does not receive any pr or modifications. |
|
||||
| v7-dev | Development branch, which defaults to the next SNAPSHOT version, accepts modifications or pr |
|
||||
|
||||
### 🐞Provide feedback or suggestions on bugs
|
||||
|
||||
When submitting feedback, please indicate which JDK version, Hutool version, and related dependency library version you are using.
|
||||
|
||||
- [Gitee issue](https://gitee.com/dromara/hutool/issues)
|
||||
- [Github issue](https://github.com/dromara/hutool/issues)
|
||||
- [Gitcode issue](https://gitcode.com/dromara/hutool/issues)
|
||||
- [Gitee issue](https://gitee.com/chinabugotech/hutool/issues)
|
||||
- [Github issue](https://github.com/chinabugotech/hutool/issues)
|
||||
- [Gitcode issue](https://gitcode.com/chinabugotech/hutool/issues)
|
||||
|
||||
### 🧬Principles of PR(pull request)
|
||||
|
||||
@@ -186,13 +186,13 @@ Hutool welcomes anyone to contribute code to Hutool, but the author suffers from
|
||||
1. Improve the comments, especially each new method should follow the Java documentation specification to indicate the method description, parameter description, return value description and other information, if necessary, please add unit tests, if you want, you can also add your name.
|
||||
2. Code indentation according to Eclipse.
|
||||
3. Newly added methods do not use third-party library methods,Unless the method tool is add to the '**extra module**'.
|
||||
4. Please pull request to the `v6-dev` branch. Hutool uses a new branch after 5.x: `v6-master` is the master branch, which indicates the version of the central library that has been released, and this branch does not allow pr or modifications.
|
||||
4. Please pull request to the `v7-dev` branch. Hutool uses a new branch after 7.x: `v7-master` is the master branch, which indicates the version of the central library that has been released, and this branch does not allow pr or modifications.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## ⭐Star Hutool
|
||||
|
||||
[](https://starchart.cc/dromara/hutool)
|
||||
[](https://starchart.cc/chinabugotech/hutool)
|
||||
|
||||
## 📌WeChat Official Account
|
||||
|
||||
|
61
README.md
Executable file → Normal file
61
README.md
Executable file → Normal file
@@ -9,8 +9,8 @@
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a target="_blank" href="https://search.maven.org/artifact/org.dromara.hutool/hutool-all">
|
||||
<img alt="" src="https://img.shields.io/maven-central/v/org.dromara.hutool/hutool-all.svg?label=Maven%20Central" />
|
||||
<a target="_blank" href="https://search.maven.org/artifact/cn.hutool/hutool-all">
|
||||
<img alt="" src="https://img.shields.io/maven-central/v/cn.hutool/hutool-all.svg?label=Maven%20Central" />
|
||||
</a>
|
||||
<a target="_blank" href="https://www.apache.org/licenses/LICENSE-2.0.html">
|
||||
<img alt="" src="https://img.shields.io/:license-apache2.0-blue.svg?logo=apache" />
|
||||
@@ -18,26 +18,26 @@
|
||||
<a target="_blank" href="https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html">
|
||||
<img alt="" src="https://img.shields.io/badge/JDK-8+-green.svg" />
|
||||
</a>
|
||||
<a target="_blank" href="https://travis-ci.com/dromara/hutool">
|
||||
<img alt="" src="https://travis-ci.com/dromara/hutool.svg?branch=v5-master" />
|
||||
<a target="_blank" href="https://travis-ci.com/chinabugotech/hutool">
|
||||
<img alt="" src="https://travis-ci.com/chinabugotech/hutool.svg?branch=v5-master" />
|
||||
</a>
|
||||
<a href="https://www.codacy.com/gh/dromara/hutool/dashboard?utm_source=github.com&utm_medium=referral&utm_content=dromara/hutool&utm_campaign=Badge_Grade">
|
||||
<a href="https://www.codacy.com/gh/chinabugotech/hutool/dashboard?utm_source=github.com&utm_medium=referral&utm_content=chinabugotech/hutool&utm_campaign=Badge_Grade">
|
||||
<img alt="" src="https://app.codacy.com/project/badge/Grade/8a6897d9de7440dd9de8804c28d2871d"/>
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/dromara/hutool">
|
||||
<img alt="" src="https://codecov.io/gh/dromara/hutool/branch/v6-master/graph/badge.svg" />
|
||||
<a href="https://codecov.io/gh/cn/hutool">
|
||||
<img alt="" src="https://codecov.io/gh/chinabugotech/hutool/branch/v7-master/graph/badge.svg" />
|
||||
</a>
|
||||
<a target="_blank" href="https://gitter.im/hutool/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge">
|
||||
<img alt="" src="https://badges.gitter.im/hutool/Lobby.svg" />
|
||||
</a>
|
||||
<a target="_blank" href='https://gitee.com/dromara/hutool/stargazers'>
|
||||
<img alt="star" src='https://gitee.com/dromara/hutool/badge/star.svg?theme=gvp'/>
|
||||
<a target="_blank" href='https://gitee.com/chinabugotech/hutool/stargazers'>
|
||||
<img alt="star" src='https://gitee.com/chinabugotech/hutool/badge/star.svg'/>
|
||||
</a>
|
||||
<a target="_blank" href='https://github.com/dromara/hutool'>
|
||||
<img alt="github star" src="https://img.shields.io/github/stars/dromara/hutool.svg?style=social"/>
|
||||
<a target="_blank" href='https://github.com/chinabugotech/hutool'>
|
||||
<img alt="github star" src="https://img.shields.io/github/stars/chinabugotech/hutool.svg?style=social"/>
|
||||
</a>
|
||||
<a target="_blank" href='https://gitcode.com/dromara/hutool'>
|
||||
<img src="https://gitcode.com/dromara/hutool/star/badge.svg" alt="gitcode star"/>
|
||||
<a target="_blank" href='https://gitcode.com/chinabugotech/hutool'>
|
||||
<img src="https://gitcode.com/chinabugotech/hutool/star/badge.svg" alt="gitcode star"/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -77,13 +77,14 @@
|
||||
|
||||
### ✨版本选择
|
||||
|
||||
Hutool目前主要版本4.x、5.x、6.x,选择如下:
|
||||
Hutool目前主要版本4.x、5.x、6.x、7.x,选择如下:
|
||||
|
||||
| 版本 | jdk| Maven仓库 | 主要特点 |
|
||||
|-----|----|--------------------------------------------------------------------------------------------------------|-------------------------------------|
|
||||
| 版本 | jdk | Maven仓库 | 主要特点 |
|
||||
|-----|--------|--------------------------------------------------------------------------------------------------------|-------------------------------------|
|
||||
| 4.x | jdk1.7 | [cn.hutool/hutool-all/4.x](https://mvnrepository.com/artifact/cn.hutool/hutool-all/4.6.17) | jdk1.7编译 |
|
||||
| 5.x | jdk1.8 | [cn.hutool/hutool-all/5.x ](https://mvnrepository.com/artifact/cn.hutool/hutool-all) | jdk1.8编译,使用JavaEE,适配JDK11、17、21 |
|
||||
| 6.x | jdk1.8 | [org.dromara.hutool/hutool-all/6.x ](https://mvnrepository.com/artifact/org.dromara.hutool/hutool-all) | jdk1.8编译,使用Jakarta EE,适配JDK11、17、21 |
|
||||
| 7.x | jdk17 | [cn.hutool.v7/hutool-all/6.x ](https://mvnrepository.com/artifact/org.dromara.hutool/hutool-all) | jdk17编译,使用Jakarta EE,适配17+ |
|
||||
|
||||
## 🛠️包含组件
|
||||
|
||||
@@ -128,30 +129,30 @@ Hutool目前主要版本4.x、5.x、6.x,选择如下:
|
||||
```xml
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.hutool</groupId>
|
||||
<groupId>cn.hutool.v7</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>6.0.0-M22</version>
|
||||
<version>7.0.0-M1</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
### 🍐Gradle
|
||||
|
||||
```
|
||||
implementation 'org.dromara.hutool:hutool-all:6.0.0-M22'
|
||||
implementation 'cn.hutool.v7:hutool-all:7.0.0-M1'
|
||||
```
|
||||
|
||||
### 📥下载jar
|
||||
|
||||
点击以下链接,下载`hutool-all-X.X.X.jar`即可:
|
||||
|
||||
- [Maven中央库](https://repo1.maven.org/maven2/org/dromara/hutool/hutool-all/6.0.0-M22/)
|
||||
- [Maven中央库](https://repo1.maven.org/maven2/cn/hutool/v7/hutool-all/7.0.0-M1/)
|
||||
|
||||
> 🔔️注意
|
||||
> Hutool 6.x支持JDK8+,对Android平台没有测试,不能保证所有工具类或工具方法可用。
|
||||
> Hutool 7.x支持JDK17,对Android平台没有测试,不能保证所有工具类或工具方法可用。
|
||||
|
||||
### 🚽编译安装
|
||||
|
||||
访问Hutool的Gitee主页:[https://gitee.com/dromara/hutool](https://gitee.com/dromara/hutool)
|
||||
访问Hutool的Gitee主页:[https://gitee.com/chinabugotech/hutool](https://gitee.com/chinabugotech/hutool)
|
||||
下载整个项目源码(v6-master或v6-dev分支都可)然后进入Hutool项目目录执行:
|
||||
|
||||
```sh
|
||||
@@ -170,23 +171,23 @@ Hutool的源码分为两个分支,功能如下:
|
||||
|
||||
| 分支 | 作用 |
|
||||
|-----------|--------------------------------------------|
|
||||
| v6-master | 主分支,release版本使用的分支,与中央库提交的jar一致,不接收任何pr或修改 |
|
||||
| v6-dev | 开发分支,默认为下个版本的SNAPSHOT版本,接受修改或pr |
|
||||
| v7-master | 主分支,release版本使用的分支,与中央库提交的jar一致,不接收任何pr或修改 |
|
||||
| v7-dev | 开发分支,默认为下个版本的SNAPSHOT版本,接受修改或pr |
|
||||
|
||||
### 🐞提供bug反馈或建议
|
||||
|
||||
提交问题反馈请说明正在使用的JDK版本呢、Hutool版本和相关依赖库版本。
|
||||
|
||||
- [Gitee issue](https://gitee.com/dromara/hutool/issues)
|
||||
- [Github issue](https://github.com/dromara/hutool/issues)
|
||||
- [Gitcode issue Gitcode问题](https://gitcode.com/dromara/hutool/issues)
|
||||
- [Gitee issue](https://gitee.com/chinabugotech/hutool/issues)
|
||||
- [Github issue](https://github.com/chinabugotech/hutool/issues)
|
||||
- [Gitcode issue Gitcode问题](https://gitcode.com/chinabugotech/hutool/issues)
|
||||
|
||||
### 🧬贡献代码的步骤
|
||||
|
||||
1. 在Gitee、Github或Gitcode上fork项目到自己的repo
|
||||
2. 把fork过去的项目也就是你的项目clone到你的本地
|
||||
3. 修改代码(记得一定要修改v6-dev分支)
|
||||
4. commit后push到自己的库(v6-dev分支)
|
||||
3. 修改代码(记得一定要修改v7-dev分支)
|
||||
4. commit后push到自己的库(v7-dev分支)
|
||||
5. 登录Gitee、Github或Gitcode在你首页可以看到一个 pull request 按钮,点击它,填写一些说明信息,然后提交即可。
|
||||
6. 等待维护者合并
|
||||
|
||||
@@ -209,7 +210,7 @@ Hutool欢迎任何人为Hutool添砖加瓦,贡献代码,不过维护者是
|
||||
|
||||
## ⭐Star Hutool
|
||||
|
||||
[](https://starchart.cc/dromara/hutool)[](https://starchart.cc/dromara/hutool)
|
||||
[](https://starchart.cc/chinabugotech/hutool)
|
||||
|
||||
### GitHub Contributor Over Time
|
||||
[](https://git-contributor.com?chart=contributorOverTime&repo=dromara/hutool)
|
||||
|
13
SECURITY.md
13
SECURITY.md
@@ -1,13 +0,0 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions(支持的版本)
|
||||
|
||||
| Version | Supported |
|
||||
|---------|--------------------|
|
||||
| 6.x.x | :white_check_mark: |
|
||||
|
||||
## Reporting a Vulnerability(报告漏洞)
|
||||
|
||||
如果你发现有安全问题或漏洞,请发送邮件到`loolly@aliyun.com`。
|
||||
|
||||
To report any found security issues or vulnerabilities, please send a mail to `loolly@aliyun.com`.
|
@@ -16,12 +16,12 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
echo -e "\033[32mCheckout to v6-dev\033[0m"
|
||||
git checkout v6-dev
|
||||
echo -e "\033[32mCheckout to v7-dev\033[0m"
|
||||
git checkout v7-dev
|
||||
|
||||
echo -e "\033[32mPush to Github(origin) v6-dev\033[0m"
|
||||
git push origin v6-dev
|
||||
echo -e "\033[32mPush to Gitee v6-dev\033[0m"
|
||||
git push osc v6-dev
|
||||
echo -e "\033[32mPush to Gitcode v6-dev\033[0m"
|
||||
git push gitcode v6-dev
|
||||
echo -e "\033[32mPush to Github(origin) v7-dev\033[0m"
|
||||
git push origin v7-dev
|
||||
echo -e "\033[32mPush to Gitee v7-dev\033[0m"
|
||||
git push osc v7-dev
|
||||
echo -e "\033[32mPush to Gitcode v7-dev\033[0m"
|
||||
git push gitcode v7-dev
|
||||
|
@@ -19,15 +19,15 @@
|
||||
# show Hutool logo
|
||||
"$(dirname ${BASH_SOURCE[0]})"/logo.sh
|
||||
|
||||
echo -e "\033[32mCheckout to v6-master\033[0m"
|
||||
git checkout v6-master
|
||||
echo -e "\033[32mCheckout to v7-master\033[0m"
|
||||
git checkout v7-master
|
||||
|
||||
echo -e "\033[32mMerge v6-dev branch\033[0m"
|
||||
git merge v6-dev -m 'Prepare release'
|
||||
echo -e "\033[32mMerge v7-dev branch\033[0m"
|
||||
git merge v7-dev -m 'Prepare release'
|
||||
|
||||
echo -e "\033[32mPush to Github(origin) v6-master\033[0m"
|
||||
git push origin v6-master
|
||||
echo -e "\033[32mPush to Gitee v6-master\033[0m"
|
||||
git push osc v6-master
|
||||
echo -e "\033[32mPush to Gitcode v6-master\033[0m"
|
||||
git push gitcode v6-master
|
||||
echo -e "\033[32mPush to Github(origin) v7-master\033[0m"
|
||||
git push origin v7-master
|
||||
echo -e "\033[32mPush to Gitee v7-master\033[0m"
|
||||
git push osc v7-master
|
||||
echo -e "\033[32mPush to Gitcode v7-master\033[0m"
|
||||
git push gitcode v7-master
|
||||
|
10
bin/sync.sh
10
bin/sync.sh
@@ -19,10 +19,10 @@
|
||||
# show Hutool logo
|
||||
"$(dirname ${BASH_SOURCE[0]})"/logo.sh
|
||||
|
||||
# 保证当前在v6-dev分支
|
||||
git checkout v6-dev
|
||||
# 保证当前在v7-dev分支
|
||||
git checkout v7-dev
|
||||
|
||||
# 同时同步Gitee、Github和Gitcode的库
|
||||
git pull osc v6-dev
|
||||
git pull origin v6-dev
|
||||
git pull gitcode v6-dev
|
||||
git pull osc v7-dev
|
||||
git pull origin v7-dev
|
||||
git pull gitcode v7-dev
|
||||
|
@@ -1 +1 @@
|
||||
6.0.0-M22
|
||||
7.0.0-M1
|
||||
|
@@ -1 +1 @@
|
||||
var version = '6.0.0-M22'
|
||||
var version = '7.0.0-M1'
|
||||
|
@@ -7,9 +7,9 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.dromara.hutool</groupId>
|
||||
<groupId>cn.hutool.v7</groupId>
|
||||
<artifactId>hutool-parent</artifactId>
|
||||
<version>6.0.0-M22</version>
|
||||
<version>7.0.0-M1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>hutool-ai</artifactId>
|
||||
@@ -17,38 +17,201 @@
|
||||
<description>Hutool AI大模型封装</description>
|
||||
|
||||
<properties>
|
||||
<Automatic-Module-Name>org.dromara.hutool.ai</Automatic-Module-Name>
|
||||
<Automatic-Module-Name>cn.hutool.v7.ai</Automatic-Module-Name>
|
||||
<moshi.version>1.15.2</moshi.version>
|
||||
<jackson.version>2.18.1</jackson.version>
|
||||
<fastjson2.version>2.0.53</fastjson2.version>
|
||||
<gson.version>2.13.0</gson.version>
|
||||
|
||||
<jetty.version>12.0.19</jetty.version>
|
||||
<jakarta.xml.soap-api.version>3.0.2</jakarta.xml.soap-api.version>
|
||||
<httpclient5.version>5.4.3</httpclient5.version>
|
||||
<httpclient4.version>4.5.14</httpclient4.version>
|
||||
<okhttp.version>5.0.0-alpha.14</okhttp.version>
|
||||
<undertow.version>2.3.18.Final</undertow.version>
|
||||
<tomcat.version>11.0.6</tomcat.version>
|
||||
<smartboot.version>1.4.3</smartboot.version>
|
||||
|
||||
<slf4j.version>2.0.9</slf4j.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<log4j2.version>2.20.0</log4j2.version>
|
||||
<tinylog.version>1.3.6</tinylog.version>
|
||||
<tinylog2.version>2.7.0</tinylog2.version>
|
||||
<commons-logging.version>1.3.4</commons-logging.version>
|
||||
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.hutool</groupId>
|
||||
<groupId>cn.hutool.v7</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.hutool</groupId>
|
||||
<groupId>cn.hutool.v7</groupId>
|
||||
<artifactId>hutool-http</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.hutool</groupId>
|
||||
<groupId>cn.hutool.v7</groupId>
|
||||
<artifactId>hutool-log</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.hutool</groupId>
|
||||
<groupId>cn.hutool.v7</groupId>
|
||||
<artifactId>hutool-json</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.hutool</groupId>
|
||||
<groupId>cn.hutool.v7</groupId>
|
||||
<artifactId>hutool-crypto</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool.v7</groupId>
|
||||
<artifactId>hutool-swing</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.moshi</groupId>
|
||||
<artifactId>moshi</artifactId>
|
||||
<version>${moshi.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<version>${fastjson2.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>${gson.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcpkix-jdk18on</artifactId>
|
||||
<version>${bouncycastle.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<version>${jetty.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.soap</groupId>
|
||||
<artifactId>jakarta.xml.soap-api</artifactId>
|
||||
<version>${jakarta.xml.soap-api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.smartboot.http</groupId>
|
||||
<artifactId>smart-http-server</artifactId>
|
||||
<version>${smartboot.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.smartboot.socket</groupId>
|
||||
<artifactId>aio-core</artifactId>
|
||||
<version>1.6.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.smartboot.socket</groupId>
|
||||
<artifactId>aio-pro</artifactId>
|
||||
<version>1.6.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||
<artifactId>httpclient5</artifactId>
|
||||
<version>${httpclient5.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>${httpclient4.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>${okhttp.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 第三方HTTP服务器库 -->
|
||||
<dependency>
|
||||
<groupId>io.undertow</groupId>
|
||||
<artifactId>undertow-core</artifactId>
|
||||
<version>${undertow.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
<version>${tomcat.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.tinylog</groupId>
|
||||
<artifactId>tinylog</artifactId>
|
||||
<version>${tinylog.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.tinylog</groupId>
|
||||
<artifactId>tinylog-api</artifactId>
|
||||
<version>${tinylog2.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>${commons-logging.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai;
|
||||
package cn.hutool.v7.ai;
|
||||
|
||||
import org.dromara.hutool.core.exception.HutoolException;
|
||||
import cn.hutool.v7.core.exception.HutoolException;
|
||||
|
||||
/**
|
||||
* 异常处理类
|
@@ -14,15 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai;
|
||||
package cn.hutool.v7.ai;
|
||||
|
||||
import org.dromara.hutool.ai.core.AIConfig;
|
||||
import org.dromara.hutool.ai.core.AIService;
|
||||
import org.dromara.hutool.ai.core.AIServiceProvider;
|
||||
import org.dromara.hutool.core.map.concurrent.SafeConcurrentHashMap;
|
||||
import cn.hutool.v7.ai.core.AIConfig;
|
||||
import cn.hutool.v7.ai.core.AIService;
|
||||
import cn.hutool.v7.ai.core.AIServiceProvider;
|
||||
import cn.hutool.v7.core.spi.ServiceLoader;
|
||||
import cn.hutool.v7.core.spi.SpiUtil;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 创建AIModelService的工厂类
|
||||
@@ -32,11 +33,11 @@ import java.util.ServiceLoader;
|
||||
*/
|
||||
public class AIServiceFactory {
|
||||
|
||||
private static final Map<String, AIServiceProvider> providers = new SafeConcurrentHashMap<>();
|
||||
private static final Map<String, AIServiceProvider> providers = new ConcurrentHashMap<>();
|
||||
|
||||
// 加载所有 AIModelProvider 实现类
|
||||
static {
|
||||
final ServiceLoader<AIServiceProvider> loader = ServiceLoader.load(AIServiceProvider.class);
|
||||
final ServiceLoader<AIServiceProvider> loader = SpiUtil.loadList(AIServiceProvider.class);
|
||||
for (final AIServiceProvider provider : loader) {
|
||||
providers.put(provider.getServiceName().toLowerCase(), provider);
|
||||
}
|
@@ -14,15 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai;
|
||||
package cn.hutool.v7.ai;
|
||||
|
||||
import org.dromara.hutool.ai.core.AIConfig;
|
||||
import org.dromara.hutool.ai.core.AIService;
|
||||
import org.dromara.hutool.ai.core.Message;
|
||||
import org.dromara.hutool.ai.model.deepseek.DeepSeekService;
|
||||
import org.dromara.hutool.ai.model.doubao.DoubaoService;
|
||||
import org.dromara.hutool.ai.model.grok.GrokService;
|
||||
import org.dromara.hutool.ai.model.openai.OpenaiService;
|
||||
import cn.hutool.v7.ai.core.AIConfig;
|
||||
import cn.hutool.v7.ai.core.AIService;
|
||||
import cn.hutool.v7.ai.core.Message;
|
||||
import cn.hutool.v7.ai.model.deepseek.DeepSeekService;
|
||||
import cn.hutool.v7.ai.model.doubao.DoubaoService;
|
||||
import cn.hutool.v7.ai.model.grok.GrokService;
|
||||
import cn.hutool.v7.ai.model.openai.OpenaiService;
|
||||
|
||||
import java.util.List;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai;
|
||||
package cn.hutool.v7.ai;
|
||||
|
||||
/**
|
||||
* 模型厂商的名称(不指具体的模型)
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai;
|
||||
package cn.hutool.v7.ai;
|
||||
|
||||
/**
|
||||
* 各模型厂商包含的model(指具体的模型)
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.core;
|
||||
package cn.hutool.v7.ai.core;
|
||||
|
||||
import java.util.Map;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.core;
|
||||
package cn.hutool.v7.ai.core;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
@@ -14,12 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.core;
|
||||
package cn.hutool.v7.ai.core;
|
||||
|
||||
import org.dromara.hutool.core.map.concurrent.SafeConcurrentHashMap;
|
||||
import cn.hutool.v7.core.spi.ServiceLoader;
|
||||
import cn.hutool.v7.core.spi.SpiUtil;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* AIConfig实现类的加载器
|
||||
@@ -29,11 +30,11 @@ import java.util.ServiceLoader;
|
||||
*/
|
||||
public class AIConfigRegistry {
|
||||
|
||||
private static final Map<String, Class<? extends AIConfig>> configClasses = new SafeConcurrentHashMap<>();
|
||||
private static final Map<String, Class<? extends AIConfig>> configClasses = new ConcurrentHashMap<>();
|
||||
|
||||
// 加载所有 AIConfig 实现类
|
||||
static {
|
||||
final ServiceLoader<AIConfig> loader = ServiceLoader.load(AIConfig.class);
|
||||
final ServiceLoader<AIConfig> loader = SpiUtil.loadList(AIConfig.class);
|
||||
for (final AIConfig config : loader) {
|
||||
configClasses.put(config.getModelName().toLowerCase(), config.getClass());
|
||||
}
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.core;
|
||||
package cn.hutool.v7.ai.core;
|
||||
|
||||
import java.util.List;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.core;
|
||||
package cn.hutool.v7.ai.core;
|
||||
|
||||
/**
|
||||
* 用于加载AI服务,每一个通过SPI创建的AI服务都要实现此接口
|
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.core;
|
||||
package cn.hutool.v7.ai.core;
|
||||
|
||||
import org.dromara.hutool.ai.AIException;
|
||||
import org.dromara.hutool.http.HttpGlobalConfig;
|
||||
import org.dromara.hutool.http.HttpUtil;
|
||||
import org.dromara.hutool.http.client.Response;
|
||||
import org.dromara.hutool.http.meta.HeaderName;
|
||||
import org.dromara.hutool.http.meta.Method;
|
||||
import cn.hutool.v7.ai.AIException;
|
||||
import cn.hutool.v7.http.HttpGlobalConfig;
|
||||
import cn.hutool.v7.http.HttpUtil;
|
||||
import cn.hutool.v7.http.client.Response;
|
||||
import cn.hutool.v7.http.meta.HeaderName;
|
||||
import cn.hutool.v7.http.meta.Method;
|
||||
|
||||
import java.util.Map;
|
||||
|
@@ -14,11 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.core;
|
||||
|
||||
import org.dromara.hutool.core.map.concurrent.SafeConcurrentHashMap;
|
||||
package cn.hutool.v7.ai.core;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* Config基础类,定义模型配置的基本属性
|
||||
@@ -35,7 +34,7 @@ public class BaseConfig implements AIConfig {
|
||||
//具体模型
|
||||
protected volatile String model;
|
||||
//动态扩展字段
|
||||
protected Map<String, Object> additionalConfig = new SafeConcurrentHashMap<>();
|
||||
protected Map<String, Object> additionalConfig = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public void setApiKey(final String apiKey) {
|
||||
@@ -79,7 +78,7 @@ public class BaseConfig implements AIConfig {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getAdditionalConfigMap() {
|
||||
return new SafeConcurrentHashMap<>(additionalConfig);
|
||||
return new ConcurrentHashMap<>(additionalConfig);
|
||||
}
|
||||
|
||||
}
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.core;
|
||||
package cn.hutool.v7.ai.core;
|
||||
|
||||
/**
|
||||
* 公共Message类
|
@@ -21,4 +21,4 @@
|
||||
* @since 6.0.0
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.core;
|
||||
package cn.hutool.v7.ai.core;
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.deepseek;
|
||||
package cn.hutool.v7.ai.model.deepseek;
|
||||
|
||||
/**
|
||||
* deepSeek公共类
|
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.deepseek;
|
||||
package cn.hutool.v7.ai.model.deepseek;
|
||||
|
||||
import org.dromara.hutool.ai.Models;
|
||||
import org.dromara.hutool.ai.core.BaseConfig;
|
||||
import cn.hutool.v7.ai.Models;
|
||||
import cn.hutool.v7.ai.core.BaseConfig;
|
||||
|
||||
/**
|
||||
* DeepSeek配置类,初始化API接口地址,设置默认的模型
|
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.deepseek;
|
||||
package cn.hutool.v7.ai.model.deepseek;
|
||||
|
||||
import org.dromara.hutool.ai.core.AIConfig;
|
||||
import org.dromara.hutool.ai.core.AIServiceProvider;
|
||||
import cn.hutool.v7.ai.core.AIConfig;
|
||||
import cn.hutool.v7.ai.core.AIServiceProvider;
|
||||
|
||||
/**
|
||||
* 创建DeepSeek服务实现类
|
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.deepseek;
|
||||
package cn.hutool.v7.ai.model.deepseek;
|
||||
|
||||
import org.dromara.hutool.ai.core.AIService;
|
||||
import cn.hutool.v7.ai.core.AIService;
|
||||
|
||||
/**
|
||||
* deepSeek支持的扩展接口
|
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.deepseek;
|
||||
package cn.hutool.v7.ai.model.deepseek;
|
||||
|
||||
import org.dromara.hutool.ai.core.AIConfig;
|
||||
import org.dromara.hutool.ai.core.BaseAIService;
|
||||
import org.dromara.hutool.ai.core.Message;
|
||||
import org.dromara.hutool.http.client.Response;
|
||||
import org.dromara.hutool.json.JSONUtil;
|
||||
import cn.hutool.v7.ai.core.AIConfig;
|
||||
import cn.hutool.v7.ai.core.BaseAIService;
|
||||
import cn.hutool.v7.ai.core.Message;
|
||||
import cn.hutool.v7.http.client.Response;
|
||||
import cn.hutool.v7.json.JSONUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
@@ -21,4 +21,4 @@
|
||||
* @since 6.0.0
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.deepseek;
|
||||
package cn.hutool.v7.ai.model.deepseek;
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.doubao;
|
||||
package cn.hutool.v7.ai.model.doubao;
|
||||
|
||||
/**
|
||||
* doubao公共类
|
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.doubao;
|
||||
package cn.hutool.v7.ai.model.doubao;
|
||||
|
||||
import org.dromara.hutool.ai.Models;
|
||||
import org.dromara.hutool.ai.core.BaseConfig;
|
||||
import cn.hutool.v7.ai.Models;
|
||||
import cn.hutool.v7.ai.core.BaseConfig;
|
||||
|
||||
/**
|
||||
* Doubao配置类,初始化API接口地址,设置默认的模型
|
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.doubao;
|
||||
package cn.hutool.v7.ai.model.doubao;
|
||||
|
||||
import org.dromara.hutool.ai.core.AIConfig;
|
||||
import org.dromara.hutool.ai.core.AIServiceProvider;
|
||||
import cn.hutool.v7.ai.core.AIConfig;
|
||||
import cn.hutool.v7.ai.core.AIServiceProvider;
|
||||
|
||||
/**
|
||||
* 创建Doubap服务实现类
|
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.doubao;
|
||||
package cn.hutool.v7.ai.model.doubao;
|
||||
|
||||
import org.dromara.hutool.ai.core.AIService;
|
||||
import org.dromara.hutool.ai.core.Message;
|
||||
import cn.hutool.v7.ai.core.AIService;
|
||||
import cn.hutool.v7.ai.core.Message;
|
||||
|
||||
import java.util.List;
|
||||
|
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.doubao;
|
||||
package cn.hutool.v7.ai.model.doubao;
|
||||
|
||||
import org.dromara.hutool.ai.core.AIConfig;
|
||||
import org.dromara.hutool.ai.core.BaseAIService;
|
||||
import org.dromara.hutool.ai.core.Message;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.http.client.Response;
|
||||
import org.dromara.hutool.json.JSONUtil;
|
||||
import cn.hutool.v7.ai.core.AIConfig;
|
||||
import cn.hutool.v7.ai.core.BaseAIService;
|
||||
import cn.hutool.v7.ai.core.Message;
|
||||
import cn.hutool.v7.core.text.StrUtil;
|
||||
import cn.hutool.v7.http.client.Response;
|
||||
import cn.hutool.v7.json.JSONUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
@@ -21,4 +21,4 @@
|
||||
* @since 6.0.0
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.doubao;
|
||||
package cn.hutool.v7.ai.model.doubao;
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.grok;
|
||||
package cn.hutool.v7.ai.model.grok;
|
||||
|
||||
/**
|
||||
* grok公共类
|
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.grok;
|
||||
package cn.hutool.v7.ai.model.grok;
|
||||
|
||||
import org.dromara.hutool.ai.Models;
|
||||
import org.dromara.hutool.ai.core.BaseConfig;
|
||||
import cn.hutool.v7.ai.Models;
|
||||
import cn.hutool.v7.ai.core.BaseConfig;
|
||||
|
||||
/**
|
||||
* Grok配置类,初始化API接口地址,设置默认的模型
|
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.grok;
|
||||
package cn.hutool.v7.ai.model.grok;
|
||||
|
||||
import org.dromara.hutool.ai.core.AIConfig;
|
||||
import org.dromara.hutool.ai.core.AIServiceProvider;
|
||||
import cn.hutool.v7.ai.core.AIConfig;
|
||||
import cn.hutool.v7.ai.core.AIServiceProvider;
|
||||
|
||||
/**
|
||||
* 创建Grok服务实现类
|
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.grok;
|
||||
package cn.hutool.v7.ai.model.grok;
|
||||
|
||||
import org.dromara.hutool.ai.core.AIService;
|
||||
import cn.hutool.v7.ai.core.AIService;
|
||||
|
||||
import java.util.List;
|
||||
|
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.grok;
|
||||
package cn.hutool.v7.ai.model.grok;
|
||||
|
||||
import org.dromara.hutool.ai.core.AIConfig;
|
||||
import org.dromara.hutool.ai.core.BaseAIService;
|
||||
import org.dromara.hutool.ai.core.Message;
|
||||
import org.dromara.hutool.http.client.Response;
|
||||
import org.dromara.hutool.json.JSONUtil;
|
||||
import cn.hutool.v7.ai.core.AIConfig;
|
||||
import cn.hutool.v7.ai.core.BaseAIService;
|
||||
import cn.hutool.v7.ai.core.Message;
|
||||
import cn.hutool.v7.http.client.Response;
|
||||
import cn.hutool.v7.json.JSONUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
@@ -21,4 +21,4 @@
|
||||
* @since 6.0.0
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.grok;
|
||||
package cn.hutool.v7.ai.model.grok;
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.openai;
|
||||
package cn.hutool.v7.ai.model.openai;
|
||||
|
||||
/**
|
||||
* openai公共类
|
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.openai;
|
||||
package cn.hutool.v7.ai.model.openai;
|
||||
|
||||
import org.dromara.hutool.ai.Models;
|
||||
import org.dromara.hutool.ai.core.BaseConfig;
|
||||
import cn.hutool.v7.ai.Models;
|
||||
import cn.hutool.v7.ai.core.BaseConfig;
|
||||
|
||||
/**
|
||||
* openai配置类,初始化API接口地址,设置默认的模型
|
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.openai;
|
||||
package cn.hutool.v7.ai.model.openai;
|
||||
|
||||
import org.dromara.hutool.ai.core.AIConfig;
|
||||
import org.dromara.hutool.ai.core.AIServiceProvider;
|
||||
import cn.hutool.v7.ai.core.AIConfig;
|
||||
import cn.hutool.v7.ai.core.AIServiceProvider;
|
||||
|
||||
/**
|
||||
* 创建Openai服务实现类
|
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.openai;
|
||||
package cn.hutool.v7.ai.model.openai;
|
||||
|
||||
import org.dromara.hutool.ai.core.AIService;
|
||||
import org.dromara.hutool.ai.core.Message;
|
||||
import cn.hutool.v7.ai.core.AIService;
|
||||
import cn.hutool.v7.ai.core.Message;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.openai;
|
||||
package cn.hutool.v7.ai.model.openai;
|
||||
|
||||
import org.dromara.hutool.ai.core.AIConfig;
|
||||
import org.dromara.hutool.ai.core.BaseAIService;
|
||||
import org.dromara.hutool.ai.core.Message;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.http.client.Response;
|
||||
import org.dromara.hutool.json.JSONUtil;
|
||||
import cn.hutool.v7.ai.core.AIConfig;
|
||||
import cn.hutool.v7.ai.core.BaseAIService;
|
||||
import cn.hutool.v7.ai.core.Message;
|
||||
import cn.hutool.v7.core.text.StrUtil;
|
||||
import cn.hutool.v7.http.client.Response;
|
||||
import cn.hutool.v7.json.JSONUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
@@ -21,4 +21,4 @@
|
||||
* @since 6.0.0
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.openai;
|
||||
package cn.hutool.v7.ai.model.openai;
|
@@ -21,4 +21,4 @@
|
||||
* @since 6.0.0
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model;
|
||||
package cn.hutool.v7.ai.model;
|
@@ -21,4 +21,4 @@
|
||||
* @since 6.0.0
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai;
|
||||
package cn.hutool.v7.ai;
|
34
hutool-ai/src/main/java/module-info.java
Normal file
34
hutool-ai/src/main/java/module-info.java
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2025 Hutool Team and hutool.cn
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author choweli
|
||||
*/
|
||||
module hutool.ai {
|
||||
exports cn.hutool.v7.ai;
|
||||
exports cn.hutool.v7.ai.core;
|
||||
exports cn.hutool.v7.ai.model.deepseek;
|
||||
exports cn.hutool.v7.ai.model.doubao;
|
||||
exports cn.hutool.v7.ai.model.grok;
|
||||
exports cn.hutool.v7.ai.model.openai;
|
||||
|
||||
requires hutool.json;
|
||||
requires hutool.core;
|
||||
requires hutool.crypto;
|
||||
requires hutool.http;
|
||||
|
||||
}
|
@@ -0,0 +1,4 @@
|
||||
cn.hutool.v7.ai.model.deepseek.DeepSeekConfig
|
||||
cn.hutool.v7.ai.model.openai.OpenaiConfig
|
||||
cn.hutool.v7.ai.model.doubao.DoubaoConfig
|
||||
cn.hutool.v7.ai.model.grok.GrokConfig
|
@@ -0,0 +1,4 @@
|
||||
cn.hutool.v7.ai.model.deepseek.DeepSeekProvider
|
||||
cn.hutool.v7.ai.model.openai.OpenaiProvider
|
||||
cn.hutool.v7.ai.model.doubao.DoubaoProvider
|
||||
cn.hutool.v7.ai.model.grok.GrokProvider
|
@@ -1,4 +0,0 @@
|
||||
org.dromara.hutool.ai.model.deepseek.DeepSeekConfig
|
||||
org.dromara.hutool.ai.model.openai.OpenaiConfig
|
||||
org.dromara.hutool.ai.model.doubao.DoubaoConfig
|
||||
org.dromara.hutool.ai.model.grok.GrokConfig
|
@@ -1,4 +0,0 @@
|
||||
org.dromara.hutool.ai.model.deepseek.DeepSeekProvider
|
||||
org.dromara.hutool.ai.model.openai.OpenaiProvider
|
||||
org.dromara.hutool.ai.model.doubao.DoubaoProvider
|
||||
org.dromara.hutool.ai.model.grok.GrokProvider
|
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai;
|
||||
package cn.hutool.v7.ai;
|
||||
|
||||
import org.dromara.hutool.ai.core.AIConfigBuilder;
|
||||
import org.dromara.hutool.ai.core.AIService;
|
||||
import org.dromara.hutool.ai.model.deepseek.DeepSeekService;
|
||||
import cn.hutool.v7.ai.core.AIConfigBuilder;
|
||||
import cn.hutool.v7.ai.core.AIService;
|
||||
import cn.hutool.v7.ai.model.deepseek.DeepSeekService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
@@ -14,15 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai;
|
||||
package cn.hutool.v7.ai;
|
||||
|
||||
import org.dromara.hutool.ai.core.AIConfigBuilder;
|
||||
import org.dromara.hutool.ai.core.AIService;
|
||||
import org.dromara.hutool.ai.core.Message;
|
||||
import org.dromara.hutool.ai.model.deepseek.DeepSeekService;
|
||||
import org.dromara.hutool.ai.model.doubao.DoubaoService;
|
||||
import org.dromara.hutool.ai.model.grok.GrokService;
|
||||
import org.dromara.hutool.ai.model.openai.OpenaiService;
|
||||
import cn.hutool.v7.ai.core.AIConfigBuilder;
|
||||
import cn.hutool.v7.ai.core.AIService;
|
||||
import cn.hutool.v7.ai.core.Message;
|
||||
import cn.hutool.v7.ai.model.deepseek.DeepSeekService;
|
||||
import cn.hutool.v7.ai.model.doubao.DoubaoService;
|
||||
import cn.hutool.v7.ai.model.grok.GrokService;
|
||||
import cn.hutool.v7.ai.model.openai.OpenaiService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -82,6 +82,6 @@ class AIUtilTest {
|
||||
messages.add(new Message("system","你是财神爷,只会说“我是财神”"));
|
||||
messages.add(new Message("user","你是谁啊?"));
|
||||
final String chat = AIUtil.chat(new AIConfigBuilder(ModelName.DEEPSEEK.getValue()).setApiKey(key).build(), messages);
|
||||
System.out.println(chat);
|
||||
assertNotNull(chat);
|
||||
}
|
||||
}
|
@@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.deepseek;
|
||||
package cn.hutool.v7.ai.model.deepseek;
|
||||
|
||||
import org.dromara.hutool.ai.AIServiceFactory;
|
||||
import org.dromara.hutool.ai.ModelName;
|
||||
import org.dromara.hutool.ai.core.AIConfigBuilder;
|
||||
import org.dromara.hutool.ai.core.Message;
|
||||
import cn.hutool.v7.ai.AIServiceFactory;
|
||||
import cn.hutool.v7.ai.ModelName;
|
||||
import cn.hutool.v7.ai.core.AIConfigBuilder;
|
||||
import cn.hutool.v7.ai.core.Message;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.doubao;
|
||||
package cn.hutool.v7.ai.model.doubao;
|
||||
|
||||
import org.dromara.hutool.ai.AIServiceFactory;
|
||||
import org.dromara.hutool.ai.ModelName;
|
||||
import org.dromara.hutool.ai.Models;
|
||||
import org.dromara.hutool.ai.core.AIConfigBuilder;
|
||||
import org.dromara.hutool.ai.core.Message;
|
||||
import org.dromara.hutool.swing.img.ImgUtil;
|
||||
import cn.hutool.v7.ai.AIServiceFactory;
|
||||
import cn.hutool.v7.ai.ModelName;
|
||||
import cn.hutool.v7.ai.Models;
|
||||
import cn.hutool.v7.ai.core.AIConfigBuilder;
|
||||
import cn.hutool.v7.ai.core.Message;
|
||||
import cn.hutool.v7.swing.img.ImgUtil;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.grok;
|
||||
package cn.hutool.v7.ai.model.grok;
|
||||
|
||||
import org.dromara.hutool.ai.AIServiceFactory;
|
||||
import org.dromara.hutool.ai.ModelName;
|
||||
import org.dromara.hutool.ai.Models;
|
||||
import org.dromara.hutool.ai.core.AIConfigBuilder;
|
||||
import org.dromara.hutool.ai.core.Message;
|
||||
import org.dromara.hutool.swing.img.ImgUtil;
|
||||
import cn.hutool.v7.ai.AIServiceFactory;
|
||||
import cn.hutool.v7.ai.ModelName;
|
||||
import cn.hutool.v7.ai.Models;
|
||||
import cn.hutool.v7.ai.core.AIConfigBuilder;
|
||||
import cn.hutool.v7.ai.core.Message;
|
||||
import cn.hutool.v7.swing.img.ImgUtil;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.ai.model.openai;
|
||||
package cn.hutool.v7.ai.model.openai;
|
||||
|
||||
import org.dromara.hutool.ai.AIServiceFactory;
|
||||
import org.dromara.hutool.ai.ModelName;
|
||||
import org.dromara.hutool.ai.Models;
|
||||
import org.dromara.hutool.ai.core.AIConfigBuilder;
|
||||
import org.dromara.hutool.ai.core.Message;
|
||||
import org.dromara.hutool.core.io.file.FileUtil;
|
||||
import cn.hutool.v7.ai.AIServiceFactory;
|
||||
import cn.hutool.v7.ai.ModelName;
|
||||
import cn.hutool.v7.ai.Models;
|
||||
import cn.hutool.v7.ai.core.AIConfigBuilder;
|
||||
import cn.hutool.v7.ai.core.Message;
|
||||
import cn.hutool.v7.core.io.file.FileUtil;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@@ -23,9 +23,9 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.dromara.hutool</groupId>
|
||||
<groupId>cn.hutool.v7</groupId>
|
||||
<artifactId>hutool-parent</artifactId>
|
||||
<version>6.0.0-M22</version>
|
||||
<version>7.0.0-M1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>hutool-all</artifactId>
|
||||
@@ -33,7 +33,7 @@
|
||||
<description>
|
||||
Hutool是一个功能丰富且易用的Java工具库,通过诸多实用工具类的使用,旨在帮助开发者快速、便捷地完成各类开发任务。这些封装的工具涵盖了字符串、数字、集合、编码、日期、文件、IO、加密、数据库JDBC、JSON、HTTP客户端等一系列操作,可以满足各种不同的开发需求。
|
||||
</description>
|
||||
<url>https://github.com/dromara/hutool</url>
|
||||
<url>https://github.com/chinabugotech/hutool</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool;
|
||||
package cn.hutool.v7;
|
||||
|
||||
import org.dromara.hutool.core.lang.ConsoleTable;
|
||||
import org.dromara.hutool.core.reflect.ClassUtil;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import cn.hutool.v7.core.lang.ConsoleTable;
|
||||
import cn.hutool.v7.core.reflect.ClassUtil;
|
||||
import cn.hutool.v7.core.text.StrUtil;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@@ -60,7 +60,7 @@ public class Hutool {
|
||||
* @since 5.5.2
|
||||
*/
|
||||
public static Set<Class<?>> getAllUtils() {
|
||||
return ClassUtil.scanPackage("org.dromara.hutool",
|
||||
return ClassUtil.scanPackage("cn.hutool.v7",
|
||||
(clazz) -> (!clazz.isInterface()) && StrUtil.endWith(clazz.getSimpleName(), "Util"));
|
||||
}
|
||||
|
@@ -23,4 +23,4 @@
|
||||
*
|
||||
* @author Looly
|
||||
*/
|
||||
package org.dromara.hutool;
|
||||
package cn.hutool.v7;
|
24
hutool-all/src/main/java/module-info.java
Normal file
24
hutool-all/src/main/java/module-info.java
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2025 Hutool Team and hutool.cn
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author choweli
|
||||
*/
|
||||
module hutool.all {
|
||||
requires hutool.core;
|
||||
|
||||
}
|
@@ -23,15 +23,15 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.dromara.hutool</groupId>
|
||||
<groupId>cn.hutool.v7</groupId>
|
||||
<artifactId>hutool-parent</artifactId>
|
||||
<version>6.0.0-M22</version>
|
||||
<version>7.0.0-M1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>hutool-bom</artifactId>
|
||||
<name>${project.artifactId}</name>
|
||||
<description>提供丰富的Java工具方法,此模块为Hutool所有模块汇总,最终形式为拆分开的多个jar包,可以通过exclude方式排除不需要的模块</description>
|
||||
<url>https://github.com/dromara/hutool</url>
|
||||
<url>https://github.com/chinabugotech/hutool</url>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
@@ -23,9 +23,9 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.dromara.hutool</groupId>
|
||||
<groupId>cn.hutool.v7</groupId>
|
||||
<artifactId>hutool-parent</artifactId>
|
||||
<version>6.0.0-M22</version>
|
||||
<version>7.0.0-M1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>hutool-core</artifactId>
|
||||
@@ -33,7 +33,7 @@
|
||||
<description>Hutool核心,包括集合、字符串、Bean等工具</description>
|
||||
|
||||
<properties>
|
||||
<Automatic-Module-Name>org.dromara.hutool.core</Automatic-Module-Name>
|
||||
<Automatic-Module-Name>cn.hutool.v7.core</Automatic-Module-Name>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.annotation;
|
||||
package cn.hutool.v7.core.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.annotation;
|
||||
package cn.hutool.v7.core.annotation;
|
||||
|
||||
import org.dromara.hutool.core.annotation.elements.HierarchicalAnnotatedElements;
|
||||
import org.dromara.hutool.core.annotation.elements.MetaAnnotatedElement;
|
||||
import org.dromara.hutool.core.annotation.elements.RepeatableMetaAnnotatedElement;
|
||||
import org.dromara.hutool.core.array.ArrayUtil;
|
||||
import org.dromara.hutool.core.map.reference.WeakConcurrentMap;
|
||||
import org.dromara.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.v7.core.annotation.elements.HierarchicalAnnotatedElements;
|
||||
import cn.hutool.v7.core.annotation.elements.MetaAnnotatedElement;
|
||||
import cn.hutool.v7.core.annotation.elements.RepeatableMetaAnnotatedElement;
|
||||
import cn.hutool.v7.core.array.ArrayUtil;
|
||||
import cn.hutool.v7.core.map.reference.WeakConcurrentMap;
|
||||
import cn.hutool.v7.core.util.ObjUtil;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.annotation.Inherited;
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.annotation;
|
||||
package cn.hutool.v7.core.annotation;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
@@ -14,11 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.annotation;
|
||||
package cn.hutool.v7.core.annotation;
|
||||
|
||||
import org.dromara.hutool.core.map.concurrent.SafeConcurrentHashMap;
|
||||
import org.dromara.hutool.core.reflect.method.MethodUtil;
|
||||
import org.dromara.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.v7.core.reflect.method.MethodUtil;
|
||||
import cn.hutool.v7.core.text.CharSequenceUtil;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
@@ -28,6 +27,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -96,7 +96,7 @@ public final class AnnotationMappingProxy<T extends Annotation> implements Invoc
|
||||
private AnnotationMappingProxy(final AnnotationMapping<T> annotation) {
|
||||
final int methodCount = annotation.getAttributes().length;
|
||||
this.methods = new HashMap<>(methodCount + 5);
|
||||
this.valueCache = new SafeConcurrentHashMap<>(methodCount);
|
||||
this.valueCache = new ConcurrentHashMap<>(methodCount);
|
||||
this.mapping = annotation;
|
||||
loadMethods();
|
||||
}
|
@@ -14,11 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.annotation;
|
||||
package cn.hutool.v7.core.annotation;
|
||||
|
||||
import org.dromara.hutool.core.reflect.method.MethodUtil;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import cn.hutool.v7.core.reflect.method.MethodUtil;
|
||||
import cn.hutool.v7.core.text.StrUtil;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.InvocationHandler;
|
@@ -14,21 +14,21 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.annotation;
|
||||
package cn.hutool.v7.core.annotation;
|
||||
|
||||
import org.dromara.hutool.core.annotation.elements.CombinationAnnotatedElement;
|
||||
import org.dromara.hutool.core.array.ArrayUtil;
|
||||
import org.dromara.hutool.core.classloader.ClassLoaderUtil;
|
||||
import org.dromara.hutool.core.exception.HutoolException;
|
||||
import org.dromara.hutool.core.func.LambdaInfo;
|
||||
import org.dromara.hutool.core.func.LambdaUtil;
|
||||
import org.dromara.hutool.core.func.SerFunction;
|
||||
import org.dromara.hutool.core.map.reference.WeakConcurrentMap;
|
||||
import org.dromara.hutool.core.reflect.FieldUtil;
|
||||
import org.dromara.hutool.core.reflect.method.MethodUtil;
|
||||
import org.dromara.hutool.core.text.CharSequenceUtil;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.v7.core.annotation.elements.CombinationAnnotatedElement;
|
||||
import cn.hutool.v7.core.array.ArrayUtil;
|
||||
import cn.hutool.v7.core.classloader.ClassLoaderUtil;
|
||||
import cn.hutool.v7.core.exception.HutoolException;
|
||||
import cn.hutool.v7.core.func.LambdaInfo;
|
||||
import cn.hutool.v7.core.func.LambdaUtil;
|
||||
import cn.hutool.v7.core.func.SerFunction;
|
||||
import cn.hutool.v7.core.map.reference.WeakConcurrentMap;
|
||||
import cn.hutool.v7.core.reflect.FieldUtil;
|
||||
import cn.hutool.v7.core.reflect.method.MethodUtil;
|
||||
import cn.hutool.v7.core.text.CharSequenceUtil;
|
||||
import cn.hutool.v7.core.text.StrUtil;
|
||||
import cn.hutool.v7.core.util.ObjUtil;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
import java.lang.reflect.*;
|
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.annotation;
|
||||
package cn.hutool.v7.core.annotation;
|
||||
|
||||
import org.dromara.hutool.core.reflect.ClassUtil;
|
||||
import org.dromara.hutool.core.reflect.method.MethodUtil;
|
||||
import org.dromara.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.v7.core.reflect.ClassUtil;
|
||||
import cn.hutool.v7.core.reflect.method.MethodUtil;
|
||||
import cn.hutool.v7.core.text.CharSequenceUtil;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.annotation;
|
||||
package cn.hutool.v7.core.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.annotation;
|
||||
package cn.hutool.v7.core.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.annotation;
|
||||
package cn.hutool.v7.core.annotation;
|
||||
|
||||
import org.dromara.hutool.core.array.ArrayUtil;
|
||||
import org.dromara.hutool.core.collection.CollUtil;
|
||||
import org.dromara.hutool.core.map.reference.WeakConcurrentMap;
|
||||
import org.dromara.hutool.core.reflect.method.MethodUtil;
|
||||
import org.dromara.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.v7.core.array.ArrayUtil;
|
||||
import cn.hutool.v7.core.collection.CollUtil;
|
||||
import cn.hutool.v7.core.map.reference.WeakConcurrentMap;
|
||||
import cn.hutool.v7.core.reflect.method.MethodUtil;
|
||||
import cn.hutool.v7.core.text.CharSequenceUtil;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.annotation.Repeatable;
|
@@ -14,16 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.annotation;
|
||||
package cn.hutool.v7.core.annotation;
|
||||
|
||||
import org.dromara.hutool.core.annotation.elements.MetaAnnotatedElement;
|
||||
import org.dromara.hutool.core.collection.CollUtil;
|
||||
import org.dromara.hutool.core.lang.Assert;
|
||||
import org.dromara.hutool.core.map.multi.Graph;
|
||||
import org.dromara.hutool.core.reflect.ClassUtil;
|
||||
import org.dromara.hutool.core.reflect.method.MethodUtil;
|
||||
import org.dromara.hutool.core.text.CharSequenceUtil;
|
||||
import org.dromara.hutool.core.array.ArrayUtil;
|
||||
import cn.hutool.v7.core.annotation.elements.MetaAnnotatedElement;
|
||||
import cn.hutool.v7.core.collection.CollUtil;
|
||||
import cn.hutool.v7.core.lang.Assert;
|
||||
import cn.hutool.v7.core.map.multi.Graph;
|
||||
import cn.hutool.v7.core.reflect.ClassUtil;
|
||||
import cn.hutool.v7.core.reflect.method.MethodUtil;
|
||||
import cn.hutool.v7.core.text.CharSequenceUtil;
|
||||
import cn.hutool.v7.core.array.ArrayUtil;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.annotation;
|
||||
package cn.hutool.v7.core.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
@@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.annotation.elements;
|
||||
package cn.hutool.v7.core.annotation.elements;
|
||||
|
||||
import org.dromara.hutool.core.annotation.AnnotationUtil;
|
||||
import org.dromara.hutool.core.array.ArrayUtil;
|
||||
import org.dromara.hutool.core.collection.set.SetUtil;
|
||||
import org.dromara.hutool.core.map.TableMap;
|
||||
import cn.hutool.v7.core.annotation.AnnotationUtil;
|
||||
import cn.hutool.v7.core.array.ArrayUtil;
|
||||
import cn.hutool.v7.core.collection.set.SetUtil;
|
||||
import cn.hutool.v7.core.map.TableMap;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.annotation.*;
|
@@ -14,15 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.annotation.elements;
|
||||
package cn.hutool.v7.core.annotation.elements;
|
||||
|
||||
import org.dromara.hutool.core.annotation.AnnotationUtil;
|
||||
import org.dromara.hutool.core.collection.CollUtil;
|
||||
import org.dromara.hutool.core.collection.set.SetUtil;
|
||||
import org.dromara.hutool.core.reflect.ClassUtil;
|
||||
import org.dromara.hutool.core.reflect.method.MethodUtil;
|
||||
import org.dromara.hutool.core.text.CharSequenceUtil;
|
||||
import org.dromara.hutool.core.array.ArrayUtil;
|
||||
import cn.hutool.v7.core.annotation.AnnotationUtil;
|
||||
import cn.hutool.v7.core.collection.CollUtil;
|
||||
import cn.hutool.v7.core.collection.set.SetUtil;
|
||||
import cn.hutool.v7.core.reflect.ClassUtil;
|
||||
import cn.hutool.v7.core.reflect.method.MethodUtil;
|
||||
import cn.hutool.v7.core.text.CharSequenceUtil;
|
||||
import cn.hutool.v7.core.array.ArrayUtil;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.AnnotatedElement;
|
@@ -14,15 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.annotation.elements;
|
||||
package cn.hutool.v7.core.annotation.elements;
|
||||
|
||||
import org.dromara.hutool.core.annotation.AnnotationMapping;
|
||||
import org.dromara.hutool.core.annotation.AnnotationUtil;
|
||||
import org.dromara.hutool.core.annotation.ResolvedAnnotationMapping;
|
||||
import org.dromara.hutool.core.stream.EasyStream;
|
||||
import org.dromara.hutool.core.text.CharSequenceUtil;
|
||||
import org.dromara.hutool.core.array.ArrayUtil;
|
||||
import org.dromara.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.v7.core.annotation.AnnotationMapping;
|
||||
import cn.hutool.v7.core.annotation.AnnotationUtil;
|
||||
import cn.hutool.v7.core.annotation.ResolvedAnnotationMapping;
|
||||
import cn.hutool.v7.core.stream.EasyStream;
|
||||
import cn.hutool.v7.core.text.CharSequenceUtil;
|
||||
import cn.hutool.v7.core.array.ArrayUtil;
|
||||
import cn.hutool.v7.core.util.ObjUtil;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.annotation.Inherited;
|
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.annotation.elements;
|
||||
package cn.hutool.v7.core.annotation.elements;
|
||||
|
||||
import org.dromara.hutool.core.annotation.AnnotationMapping;
|
||||
import org.dromara.hutool.core.annotation.AnnotationUtil;
|
||||
import org.dromara.hutool.core.annotation.RepeatableAnnotationCollector;
|
||||
import org.dromara.hutool.core.collection.CollUtil;
|
||||
import org.dromara.hutool.core.text.CharSequenceUtil;
|
||||
import org.dromara.hutool.core.array.ArrayUtil;
|
||||
import cn.hutool.v7.core.annotation.AnnotationMapping;
|
||||
import cn.hutool.v7.core.annotation.AnnotationUtil;
|
||||
import cn.hutool.v7.core.annotation.RepeatableAnnotationCollector;
|
||||
import cn.hutool.v7.core.collection.CollUtil;
|
||||
import cn.hutool.v7.core.text.CharSequenceUtil;
|
||||
import cn.hutool.v7.core.array.ArrayUtil;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.AnnotatedElement;
|
@@ -19,4 +19,4 @@
|
||||
*
|
||||
* @author Looly, huangchengxing
|
||||
*/
|
||||
package org.dromara.hutool.core.annotation.elements;
|
||||
package cn.hutool.v7.core.annotation.elements;
|
@@ -26,4 +26,4 @@
|
||||
* @author Looly
|
||||
*
|
||||
*/
|
||||
package org.dromara.hutool.core.annotation;
|
||||
package cn.hutool.v7.core.annotation;
|
@@ -14,21 +14,21 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.array;
|
||||
package cn.hutool.v7.core.array;
|
||||
|
||||
import org.dromara.hutool.core.collection.ListUtil;
|
||||
import org.dromara.hutool.core.collection.set.SetUtil;
|
||||
import org.dromara.hutool.core.collection.set.UniqueKeySet;
|
||||
import org.dromara.hutool.core.comparator.CompareUtil;
|
||||
import org.dromara.hutool.core.convert.ConvertUtil;
|
||||
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||
import org.dromara.hutool.core.exception.HutoolException;
|
||||
import org.dromara.hutool.core.lang.Assert;
|
||||
import org.dromara.hutool.core.map.MapUtil;
|
||||
import org.dromara.hutool.core.text.StrJoiner;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.core.util.ObjUtil;
|
||||
import org.dromara.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.v7.core.collection.ListUtil;
|
||||
import cn.hutool.v7.core.collection.set.SetUtil;
|
||||
import cn.hutool.v7.core.collection.set.UniqueKeySet;
|
||||
import cn.hutool.v7.core.comparator.CompareUtil;
|
||||
import cn.hutool.v7.core.convert.ConvertUtil;
|
||||
import cn.hutool.v7.core.exception.ExceptionUtil;
|
||||
import cn.hutool.v7.core.exception.HutoolException;
|
||||
import cn.hutool.v7.core.lang.Assert;
|
||||
import cn.hutool.v7.core.map.MapUtil;
|
||||
import cn.hutool.v7.core.text.StrJoiner;
|
||||
import cn.hutool.v7.core.text.StrUtil;
|
||||
import cn.hutool.v7.core.util.ObjUtil;
|
||||
import cn.hutool.v7.core.util.RandomUtil;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.*;
|
@@ -14,15 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.array;
|
||||
package cn.hutool.v7.core.array;
|
||||
|
||||
import org.dromara.hutool.core.collection.iter.ArrayIter;
|
||||
import org.dromara.hutool.core.convert.ConvertUtil;
|
||||
import org.dromara.hutool.core.lang.wrapper.Wrapper;
|
||||
import org.dromara.hutool.core.lang.Assert;
|
||||
import org.dromara.hutool.core.lang.Validator;
|
||||
import org.dromara.hutool.core.reflect.ClassUtil;
|
||||
import org.dromara.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.v7.core.collection.iter.ArrayIter;
|
||||
import cn.hutool.v7.core.convert.ConvertUtil;
|
||||
import cn.hutool.v7.core.lang.wrapper.Wrapper;
|
||||
import cn.hutool.v7.core.lang.Assert;
|
||||
import cn.hutool.v7.core.lang.Validator;
|
||||
import cn.hutool.v7.core.reflect.ClassUtil;
|
||||
import cn.hutool.v7.core.util.ObjUtil;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Arrays;
|
@@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.array;
|
||||
package cn.hutool.v7.core.array;
|
||||
|
||||
import org.dromara.hutool.core.lang.Assert;
|
||||
import org.dromara.hutool.core.math.NumberUtil;
|
||||
import org.dromara.hutool.core.util.ObjUtil;
|
||||
import org.dromara.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.v7.core.lang.Assert;
|
||||
import cn.hutool.v7.core.math.NumberUtil;
|
||||
import cn.hutool.v7.core.util.ObjUtil;
|
||||
import cn.hutool.v7.core.util.RandomUtil;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Arrays;
|
@@ -19,4 +19,4 @@
|
||||
*
|
||||
* @author Looly
|
||||
*/
|
||||
package org.dromara.hutool.core.array;
|
||||
package cn.hutool.v7.core.array;
|
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.bean;
|
||||
package cn.hutool.v7.core.bean;
|
||||
|
||||
import org.dromara.hutool.core.reflect.Invoker;
|
||||
import cn.hutool.v7.core.reflect.Invoker;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
@@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.bean;
|
||||
package cn.hutool.v7.core.bean;
|
||||
|
||||
import org.dromara.hutool.core.array.ArrayUtil;
|
||||
import org.dromara.hutool.core.map.reference.WeakConcurrentMap;
|
||||
import org.dromara.hutool.core.reflect.FieldUtil;
|
||||
import org.dromara.hutool.core.reflect.JdkProxyUtil;
|
||||
import cn.hutool.v7.core.array.ArrayUtil;
|
||||
import cn.hutool.v7.core.map.reference.WeakConcurrentMap;
|
||||
import cn.hutool.v7.core.reflect.FieldUtil;
|
||||
import cn.hutool.v7.core.reflect.JdkProxyUtil;
|
||||
|
||||
/**
|
||||
* Bean描述信息工厂类<br>
|
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.bean;
|
||||
package cn.hutool.v7.core.bean;
|
||||
|
||||
import org.dromara.hutool.core.exception.HutoolException;
|
||||
import cn.hutool.v7.core.exception.HutoolException;
|
||||
|
||||
/**
|
||||
* Bean异常
|
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.bean;
|
||||
package cn.hutool.v7.core.bean;
|
||||
|
||||
import org.dromara.hutool.core.func.SerSupplier;
|
||||
import org.dromara.hutool.core.map.reference.ReferenceConcurrentMap;
|
||||
import org.dromara.hutool.core.map.reference.WeakConcurrentMap;
|
||||
import cn.hutool.v7.core.func.SerSupplier;
|
||||
import cn.hutool.v7.core.map.reference.ReferenceConcurrentMap;
|
||||
import cn.hutool.v7.core.map.reference.WeakConcurrentMap;
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.util.Map;
|
@@ -14,30 +14,30 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.bean;
|
||||
package cn.hutool.v7.core.bean;
|
||||
|
||||
import org.dromara.hutool.core.annotation.AnnotationUtil;
|
||||
import org.dromara.hutool.core.annotation.ReadableBean;
|
||||
import org.dromara.hutool.core.annotation.WritableBean;
|
||||
import org.dromara.hutool.core.array.ArrayUtil;
|
||||
import org.dromara.hutool.core.bean.copier.BeanCopier;
|
||||
import org.dromara.hutool.core.bean.copier.CopyOptions;
|
||||
import org.dromara.hutool.core.bean.copier.ValueProvider;
|
||||
import org.dromara.hutool.core.bean.path.BeanPath;
|
||||
import org.dromara.hutool.core.collection.set.SetUtil;
|
||||
import org.dromara.hutool.core.convert.ConvertUtil;
|
||||
import org.dromara.hutool.core.convert.impl.RecordConverter;
|
||||
import org.dromara.hutool.core.lang.mutable.MutableEntry;
|
||||
import org.dromara.hutool.core.map.BeanMap;
|
||||
import org.dromara.hutool.core.map.CaseInsensitiveMap;
|
||||
import org.dromara.hutool.core.map.Dict;
|
||||
import org.dromara.hutool.core.map.MapUtil;
|
||||
import org.dromara.hutool.core.reflect.ClassUtil;
|
||||
import org.dromara.hutool.core.reflect.ConstructorUtil;
|
||||
import org.dromara.hutool.core.reflect.FieldUtil;
|
||||
import org.dromara.hutool.core.reflect.ModifierUtil;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.v7.core.annotation.AnnotationUtil;
|
||||
import cn.hutool.v7.core.annotation.ReadableBean;
|
||||
import cn.hutool.v7.core.annotation.WritableBean;
|
||||
import cn.hutool.v7.core.array.ArrayUtil;
|
||||
import cn.hutool.v7.core.bean.copier.BeanCopier;
|
||||
import cn.hutool.v7.core.bean.copier.CopyOptions;
|
||||
import cn.hutool.v7.core.bean.copier.ValueProvider;
|
||||
import cn.hutool.v7.core.bean.path.BeanPath;
|
||||
import cn.hutool.v7.core.collection.set.SetUtil;
|
||||
import cn.hutool.v7.core.convert.ConvertUtil;
|
||||
import cn.hutool.v7.core.convert.impl.RecordConverter;
|
||||
import cn.hutool.v7.core.lang.mutable.MutableEntry;
|
||||
import cn.hutool.v7.core.map.BeanMap;
|
||||
import cn.hutool.v7.core.map.CaseInsensitiveMap;
|
||||
import cn.hutool.v7.core.map.Dict;
|
||||
import cn.hutool.v7.core.map.MapUtil;
|
||||
import cn.hutool.v7.core.reflect.ClassUtil;
|
||||
import cn.hutool.v7.core.reflect.ConstructorUtil;
|
||||
import cn.hutool.v7.core.reflect.FieldUtil;
|
||||
import cn.hutool.v7.core.reflect.ModifierUtil;
|
||||
import cn.hutool.v7.core.text.StrUtil;
|
||||
import cn.hutool.v7.core.util.ObjUtil;
|
||||
|
||||
import java.beans.*;
|
||||
import java.lang.reflect.Field;
|
||||
@@ -563,8 +563,8 @@ public class BeanUtil {
|
||||
|
||||
/**
|
||||
* 给定的Bean的类名是否匹配指定类名字符串<br>
|
||||
* 如果isSimple为{@code true},则只匹配类名而忽略包名,例如:org.dromara.hutool.TestEntity只匹配TestEntity<br>
|
||||
* 如果isSimple为{@code false},则匹配包括包名的全类名,例如:org.dromara.hutool.TestEntity匹配org.dromara.hutool.TestEntity
|
||||
* 如果isSimple为{@code true},则只匹配类名而忽略包名,例如:cn.hutool.v7.TestEntity只匹配TestEntity<br>
|
||||
* 如果isSimple为{@code false},则匹配包括包名的全类名,例如:cn.hutool.v7.TestEntity匹配cn.hutool.v7.TestEntity
|
||||
*
|
||||
* @param bean Bean
|
||||
* @param beanClassName Bean的类名
|
@@ -14,17 +14,17 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.bean;
|
||||
package cn.hutool.v7.core.bean;
|
||||
|
||||
import org.dromara.hutool.core.array.ArrayUtil;
|
||||
import org.dromara.hutool.core.collection.CollUtil;
|
||||
import org.dromara.hutool.core.collection.ListUtil;
|
||||
import org.dromara.hutool.core.convert.ConvertUtil;
|
||||
import org.dromara.hutool.core.exception.CloneException;
|
||||
import org.dromara.hutool.core.lang.Assert;
|
||||
import org.dromara.hutool.core.reflect.ClassUtil;
|
||||
import org.dromara.hutool.core.reflect.ConstructorUtil;
|
||||
import org.dromara.hutool.core.reflect.method.MethodUtil;
|
||||
import cn.hutool.v7.core.array.ArrayUtil;
|
||||
import cn.hutool.v7.core.collection.CollUtil;
|
||||
import cn.hutool.v7.core.collection.ListUtil;
|
||||
import cn.hutool.v7.core.convert.ConvertUtil;
|
||||
import cn.hutool.v7.core.exception.CloneException;
|
||||
import cn.hutool.v7.core.lang.Assert;
|
||||
import cn.hutool.v7.core.reflect.ClassUtil;
|
||||
import cn.hutool.v7.core.reflect.ConstructorUtil;
|
||||
import cn.hutool.v7.core.reflect.method.MethodUtil;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.bean;
|
||||
package cn.hutool.v7.core.bean;
|
||||
|
||||
/**
|
||||
* 为了解决反射过程中,需要传递null参数,但是会丢失参数类型而设立的包装类
|
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.bean;
|
||||
package cn.hutool.v7.core.bean;
|
||||
|
||||
import org.dromara.hutool.core.annotation.AnnotationUtil;
|
||||
import org.dromara.hutool.core.annotation.PropIgnore;
|
||||
import org.dromara.hutool.core.convert.ConvertUtil;
|
||||
import org.dromara.hutool.core.reflect.*;
|
||||
import org.dromara.hutool.core.reflect.method.MethodInvoker;
|
||||
import cn.hutool.v7.core.annotation.AnnotationUtil;
|
||||
import cn.hutool.v7.core.annotation.PropIgnore;
|
||||
import cn.hutool.v7.core.convert.ConvertUtil;
|
||||
import cn.hutool.v7.core.reflect.*;
|
||||
import cn.hutool.v7.core.reflect.method.MethodInvoker;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -55,6 +55,11 @@ public class PropDesc {
|
||||
*/
|
||||
protected Invoker setter;
|
||||
|
||||
private Boolean hasTransientForGetter;
|
||||
private Boolean hasTransientForSetter;
|
||||
private Boolean isReadable;
|
||||
private Boolean isWritable;
|
||||
|
||||
/**
|
||||
* 构造<br>
|
||||
* Getter和Setter方法设置为默认可访问
|
||||
@@ -181,27 +186,12 @@ public class PropDesc {
|
||||
* @since 5.4.2
|
||||
*/
|
||||
public boolean isReadable(final boolean checkTransient) {
|
||||
Field field = null;
|
||||
if (this.fieldInvoker instanceof FieldInvoker) {
|
||||
field = ((FieldInvoker) this.fieldInvoker).getField();
|
||||
}
|
||||
Method getterMethod = null;
|
||||
if (this.getter instanceof MethodInvoker) {
|
||||
getterMethod = ((MethodInvoker) this.getter).getMethod();
|
||||
}
|
||||
cacheReadable();
|
||||
|
||||
// 检查transient关键字和@Transient注解
|
||||
if (checkTransient && isTransientForGet(field, getterMethod)) {
|
||||
if(checkTransient && this.hasTransientForGetter){
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查@PropIgnore注解
|
||||
if (isIgnoreGet(field, getterMethod)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查是否有getter方法或是否为public修饰
|
||||
return null != getterMethod || ModifierUtil.isPublic(field);
|
||||
return this.isReadable;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -260,27 +250,12 @@ public class PropDesc {
|
||||
* @since 5.4.2
|
||||
*/
|
||||
public boolean isWritable(final boolean checkTransient) {
|
||||
Field field = null;
|
||||
if (this.fieldInvoker instanceof FieldInvoker) {
|
||||
field = ((FieldInvoker) this.fieldInvoker).getField();
|
||||
}
|
||||
Method setterMethod = null;
|
||||
if (this.setter instanceof MethodInvoker) {
|
||||
setterMethod = ((MethodInvoker) this.setter).getMethod();
|
||||
}
|
||||
cacheWritable();
|
||||
|
||||
// 检查transient关键字和@Transient注解
|
||||
if (checkTransient && isTransientForSet(field, setterMethod)) {
|
||||
if(checkTransient && this.hasTransientForSetter){
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查@PropIgnore注解
|
||||
if(isIgnoreSet(field, setterMethod)){
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查是否有setter方法或是否为public修饰
|
||||
return null != setterMethod || ModifierUtil.isPublic(field);
|
||||
return this.isWritable;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -373,6 +348,66 @@ public class PropDesc {
|
||||
|
||||
// region ----- private methods
|
||||
|
||||
/**
|
||||
* 缓存读取属性的可读性,如果已经检查过,直接返回true
|
||||
*/
|
||||
private void cacheReadable(){
|
||||
if(null != this.isReadable){
|
||||
return;
|
||||
}
|
||||
|
||||
Field field = null;
|
||||
if (this.fieldInvoker instanceof FieldInvoker) {
|
||||
field = ((FieldInvoker) this.fieldInvoker).getField();
|
||||
}
|
||||
Method getterMethod = null;
|
||||
if (this.getter instanceof MethodInvoker) {
|
||||
getterMethod = ((MethodInvoker) this.getter).getMethod();
|
||||
}
|
||||
|
||||
// 检查transient关键字和@Transient注解
|
||||
this.hasTransientForGetter = isTransientForGet(field, getterMethod);
|
||||
|
||||
// 检查@PropIgnore注解
|
||||
if (isIgnoreGet(field, getterMethod)) {
|
||||
this.isReadable = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查是否有getter方法或是否为public修饰
|
||||
this.isReadable = null != getterMethod || ModifierUtil.isPublic(field);
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存写入属性的可写性,如果已经检查过,直接返回true
|
||||
*/
|
||||
private void cacheWritable(){
|
||||
if(null != this.isWritable){
|
||||
return;
|
||||
}
|
||||
|
||||
Field field = null;
|
||||
if (this.fieldInvoker instanceof FieldInvoker) {
|
||||
field = ((FieldInvoker) this.fieldInvoker).getField();
|
||||
}
|
||||
Method setterMethod = null;
|
||||
if (this.setter instanceof MethodInvoker) {
|
||||
setterMethod = ((MethodInvoker) this.setter).getMethod();
|
||||
}
|
||||
|
||||
// 检查transient关键字和@Transient注解
|
||||
this.hasTransientForSetter = isTransientForSet(field, setterMethod);
|
||||
|
||||
// 检查@PropIgnore注解
|
||||
if(isIgnoreSet(field, setterMethod)){
|
||||
this.isWritable = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查是否有setter方法或是否为public修饰
|
||||
this.isWritable = null != setterMethod || ModifierUtil.isPublic(field);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过Getter和Setter方法中找到属性类型
|
||||
*
|
@@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.bean;
|
||||
package cn.hutool.v7.core.bean;
|
||||
|
||||
import org.dromara.hutool.core.bean.path.AbstractBeanDesc;
|
||||
import org.dromara.hutool.core.reflect.FieldUtil;
|
||||
import org.dromara.hutool.core.reflect.ModifierUtil;
|
||||
import org.dromara.hutool.core.reflect.method.MethodUtil;
|
||||
import cn.hutool.v7.core.bean.path.AbstractBeanDesc;
|
||||
import cn.hutool.v7.core.reflect.FieldUtil;
|
||||
import cn.hutool.v7.core.reflect.ModifierUtil;
|
||||
import cn.hutool.v7.core.reflect.method.MethodUtil;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2025 Hutool Team and hutool.cn
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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 cn.hutool.v7.core.bean;
|
||||
|
||||
import cn.hutool.v7.core.bean.copier.ValueProvider;
|
||||
import cn.hutool.v7.core.reflect.ConstructorUtil;
|
||||
|
||||
import java.lang.reflect.RecordComponent;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* java.lang.Record 相关工具类封装
|
||||
*
|
||||
* @author Looly
|
||||
* @since 7.0.0
|
||||
*/
|
||||
public class RecordUtil {
|
||||
|
||||
/**
|
||||
* 判断给定类是否为Record类
|
||||
*
|
||||
* @param clazz 类
|
||||
* @return 是否为Record类
|
||||
*/
|
||||
public static boolean isRecord(final Class<?> clazz) {
|
||||
return null != clazz && clazz.isRecord();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Record类中所有字段名称,getter方法名与字段同名
|
||||
*
|
||||
* @param recordClass Record类
|
||||
* @return 字段数组
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Map.Entry<String, Type>[] getRecordComponents(final Class<?> recordClass) {
|
||||
final RecordComponent[] components = recordClass.getRecordComponents();
|
||||
final Map.Entry<String, Type>[] entries = new Map.Entry[components.length];
|
||||
for (int i = 0; i < components.length; i++) {
|
||||
entries[i] = new AbstractMap.SimpleEntry<>(components[i].getName(), components[i].getGenericType());
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* 实例化Record类
|
||||
*
|
||||
* @param recordClass 类
|
||||
* @param valueProvider 参数值提供器
|
||||
* @return Record类
|
||||
*/
|
||||
public static Object newInstance(final Class<?> recordClass, final ValueProvider<String> valueProvider) {
|
||||
final Map.Entry<String, Type>[] recordComponents = getRecordComponents(recordClass);
|
||||
final Object[] args = new Object[recordComponents.length];
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
args[i] = valueProvider.value(recordComponents[i].getKey(), recordComponents[i].getValue());
|
||||
}
|
||||
|
||||
return ConstructorUtil.newInstance(recordClass, args);
|
||||
}
|
||||
}
|
@@ -14,14 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.bean;
|
||||
package cn.hutool.v7.core.bean;
|
||||
|
||||
import org.dromara.hutool.core.bean.path.AbstractBeanDesc;
|
||||
import org.dromara.hutool.core.reflect.method.MethodInvoker;
|
||||
import org.dromara.hutool.core.reflect.method.MethodNameUtil;
|
||||
import org.dromara.hutool.core.reflect.method.MethodUtil;
|
||||
import org.dromara.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.v7.core.bean.path.AbstractBeanDesc;
|
||||
import cn.hutool.v7.core.reflect.method.MethodInvoker;
|
||||
import cn.hutool.v7.core.reflect.method.MethodNameUtil;
|
||||
import cn.hutool.v7.core.reflect.method.MethodUtil;
|
||||
import cn.hutool.v7.core.util.BooleanUtil;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -37,6 +38,7 @@ import java.util.Map;
|
||||
* @since 6.0.0
|
||||
*/
|
||||
public class SimpleBeanDesc extends AbstractBeanDesc {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user