Skip to content

Commit 88aea67

Browse files
committed
docs(xtream-codec-core): xtream-codec 适配器相关文档
Closes 93
1 parent b14ae75 commit 88aea67

13 files changed

Lines changed: 381 additions & 85 deletions

File tree

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ Jt-808协议服务端。
5353
- Github : https://github.com/hylexus/xtream-codec
5454
- Gitee : https://gitee.com/hylexus/xtream-codec
5555

56+
> **3.0.0-rc.1** 开始,**jt-framework** 内置了 [xtream-codec-core](https://github.com/hylexus/xtream-codec) 的适配器。
57+
5658
## Compatibility / 兼容性
5759

5860
支持 **spring-boot-2.x** [![spring-boot-2.x](https://img.shields.io/maven-central/v/io.github.hylexus.jt/jt-808-server-spring-boot-starter-boot2.svg?label=spring-boot-2.x)](https://search.maven.org/search?q=g:%22io.github.hylexus.jt%22%20AND%20a:%22jt-808-server-spring-boot-starter-boot2%22)
@@ -148,16 +150,16 @@ Jt-808协议服务端。
148150
### 2. 添加依赖
149151

150152
- **spring-boot-3.x**
151-
- `jt-808-server-spring-boot-starter-2.3.0.jar`
153+
- `jt-808-server-spring-boot-starter-3.0.0-rc.1.jar`
152154
- **spring-boot-2.x**
153-
- `jt-808-server-spring-boot-starter-boot2-2.3.0.jar`
155+
- `jt-808-server-spring-boot-starter-boot2-3.0.0-rc.1.jar`
154156

155157
按需求引入为 `808协议` 提供的 `spring-boot-starter`
156158

157159
- gradle
158160

159161
```groovy
160-
implementation group: 'io.github.hylexus.jt', name: 'jt-808-server-spring-boot-starter-boot2', version: "2.3.0"
162+
implementation group: 'io.github.hylexus.jt', name: 'jt-808-server-spring-boot-starter-boot2', version: "3.0.0-rc.1"
161163
```
162164

163165
- maven
@@ -167,7 +169,7 @@ implementation group: 'io.github.hylexus.jt', name: 'jt-808-server-spring-boot-s
167169
<dependency>
168170
<groupId>io.github.hylexus.jt</groupId>
169171
<artifactId>jt-808-server-spring-boot-starter-boot2</artifactId>
170-
<version>2.3.0</version>
172+
<version>3.0.0-rc.1</version>
171173
</dependency>
172174
```
173175

build-script/maven/publish-to-maven-repository-local.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ rm -rf /tmp/jt-framework/temp-artifacts
1313
-P jt-framework.maven.repo.central-portal.enabled=false \
1414
-P jt-framework.maven.repo.private.enabled=false \
1515
-P jt-framework.maven.repo.github.enabled=false \
16-
-P jt-framework.maven.publications.signing=on \
16+
-P jt-framework.maven.publications.signing=off \
1717
-P jt-framework.backend.build.checkstyle.enabled=true \
1818
-P jt-framework.backend.build.debug-module-fatjar.enabled=false

buildSrc/src/main/kotlin/JtFrameworkVersions.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ object JtFrameworkVersions {
117117
"jt-808-server-spring-boot-autoconfigure",
118118
"jt-808-server-spring-boot-starter-boot2",
119119
"jt-808-server-spring-boot-starter",
120+
"jt-808-server-xtream-codec-adapter",
121+
"jt-808-server-xtream-codec-adapter-spring-boot-starter",
122+
"jt-808-server-xtream-codec-adapter-spring-boot-starter-boot2",
120123
)
121124

122125
// 不需要 Lombok 的模块

docs/src/.vuepress/sidebar/zh.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ export const zhSidebar = sidebar({
6161
'/v2/jt-808/guide/annotation-based-dev/notices-for-builtin-msg.md',
6262
]
6363
},
64+
{
65+
text:"xtream-codec 适配器",
66+
icon: 'extend',
67+
collapsible: true,
68+
children: [
69+
'/v2/jt-808/guide/xtream-codec-adapter/intro.md',
70+
'/v2/jt-808/guide/xtream-codec-adapter/quick-start.md',
71+
]
72+
},
6473
{
6574
text: "定制化",
6675
collapsible: true,
@@ -105,6 +114,7 @@ export const zhSidebar = sidebar({
105114
],
106115
'/v2/release-notes': [
107116
'/v2/release-notes/latest.md',
117+
'/v2/release-notes/2.3.x.md',
108118
'/v2/release-notes/2.1.x.md',
109119
'/v2/release-notes/2.0.x.md',
110120
'/v2/release-notes/1.x.md',
@@ -119,6 +129,7 @@ export const zhSidebar = sidebar({
119129
"/v2/jt-808/config/sub-package.md",
120130
"/v2/jt-808/config/others.md",
121131
"/v2/jt-808/config/extension-jiangsu.md",
132+
"/v2/jt-808/config/xtream-codec.md",
122133
],
123134
'/v1/jt-808/config/': ["/v1/jt-808/config/"],
124135
'/v1/jt-808/guide/': [
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
icon: extend
3+
---
4+
5+
# xtream-codec(v3.0.0)
6+
7+
## 配置项
8+
9+
```yaml
10+
# xtream-codec 适配器配置
11+
xtream:
12+
codec:
13+
# 表达式类型
14+
expression:
15+
# 取值 spel | mvel | aviator | custom
16+
type: spel
17+
```

docs/src/v2/jt-808/guide/quick-start/compatibility.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ icon: plugin
8787
<dependency>
8888
<groupId>io.github.hylexus.jt</groupId>
8989
<artifactId>jt-808-server-spring-boot-starter-boot2</artifactId>
90-
<version>2.3.0</version>
90+
<version>3.0.0-rc.1</version>
9191
<!-- 1. 排除 jt-framework 自带的 spring-boot-starter(2.7.18) -->
9292
<exclusions>
9393
<exclusion>
@@ -120,7 +120,7 @@ icon: plugin
120120
<dependency>
121121
<groupId>io.github.hylexus.jt</groupId>
122122
<artifactId>jt-808-server-spring-boot-starter</artifactId>
123-
<version>2.3.0</version>
123+
<version>3.0.0-rc.1</version>
124124
<exclusions>
125125
<!-- 1. 排除 jt-framework 自带的 spring-boot-starter(3.3.0) -->
126126
<exclusion>

docs/src/v2/jt-808/guide/quick-start/quick-start.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ icon: launch
3737
<dependency>
3838
<groupId>io.github.hylexus.jt</groupId>
3939
<artifactId>jt-808-server-spring-boot-starter-boot2</artifactId>
40-
<version>2.3.0</version>
40+
<version>3.0.0-rc.1</version>
4141
</dependency>
4242
```
4343

4444
@tab:active gradle
4545

4646
```groovy
47-
implementation 'io.github.hylexus.jt:jt-808-server-spring-boot-starter-boot2:2.3.0'
47+
implementation 'io.github.hylexus.jt:jt-808-server-spring-boot-starter-boot2:3.0.0-rc.1'
4848
```
4949

5050
:::
@@ -62,14 +62,14 @@ implementation 'io.github.hylexus.jt:jt-808-server-spring-boot-starter-boot2:2.3
6262
<dependency>
6363
<groupId>io.github.hylexus.jt</groupId>
6464
<artifactId>jt-808-server-spring-boot-starter</artifactId>
65-
<version>2.3.0</version>
65+
<version>3.0.0-rc.1</version>
6666
</dependency>
6767
```
6868

6969
@tab:active gradle
7070

7171
```groovy
72-
implementation 'io.github.hylexus.jt:jt-808-server-spring-boot-starter:2.3.0'
72+
implementation 'io.github.hylexus.jt:jt-808-server-spring-boot-starter:3.0.0-rc.1'
7373
```
7474

7575
:::
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# xtream-codec 适配器
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
icon: proposal
3+
---
4+
5+
# 请先读我
6+
7+
## 介绍 <Badge text="3.0.0" type="tip" vertical="top"/>
8+
9+
从 <Badge text="3.0.0" type="tip" vertical="middle"/> 开始,**jt-framework** 适配了 [xtream-codec-core](https://hylexus.github.io/xtream-codec/guide/core/annotation-driven/builtin-annotations.html) 的注解。
10+
11+
## 前置条件
12+
13+
- <span style="color:red;">JDK21+</span>
14+
- spring-boot-2.x 或 spring-boot-3.x
15+
16+
::: tip 提示
17+
18+
[xtream-codec](https://github.com/hylexus/xtream-codec) 是基于 <span style="color:red;">JDK21+</span> 的,
19+
因此在 jt-framework 中使用 **xtream-codec** 的编解码库,必须要 <span style="color:red;">JDK21+</span>。
20+
21+
:::
22+
23+
## xtream-codec 注解 VS jt-framework 注解
24+
25+
### 数据处理维度
26+
27+
**jt-framework** 注解对请求和响应分开处理了:
28+
29+
- `@RequestField`
30+
- `@ResponseField`
31+
- 另外提供了两种内置别名注解
32+
- `@RequestFieldAlias`
33+
- `@ResponseFieldAlias`
34+
35+
**xtream-codec** 注解不区分请求和响应:
36+
37+
- 底层统一使用 `@XtreamField` 这一个注解
38+
- 另外提供了两种内置别名注解
39+
- `@Preset.RustStyle.XXX()`: **rust** 风格的别名注解
40+
- `@Preset.JtStyle.XXX()`: **JT** 风格的别名注解
41+
42+
### 数据类型维度
43+
44+
- **xtream-codec** 注解支持的数据类型更加丰富
45+
- **xtream-codec** 自定义编解码器更加灵活
46+
- **xtream-codec** 注解支持 `Record`
47+
48+
具体参考: [xtream-codec-core 内置类型对比](https://hylexus.github.io/xtream-codec/guide/core/annotation-driven/builtin-annotations.html#%E5%86%85%E7%BD%AE%E7%B1%BB%E5%9E%8B%E5%AF%B9%E6%AF%94)
49+
50+
### 混合版本
51+
52+
- **xtream-codec** 注解支持在同一个实体类上处理不同版本的协议字段
53+
54+
### 调试埋点
55+
56+
**xtream-codec** 支持调试埋点。
57+
58+
具体参考: [xtream-codec-core 调试埋点](https://hylexus.github.io/xtream-codec/guide/core/annotation-driven/entity-codec-tracker.html)

0 commit comments

Comments
 (0)