Skip to content

Commit f8e854f

Browse files
committed
comment: 一些javadoc注释
1 parent 41f5a2c commit f8e854f

File tree

5 files changed

+33
-3
lines changed

5 files changed

+33
-3
lines changed

forest-core/src/main/java/com/dtflys/forest/backend/BodyBuilder.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,11 @@
99
*/
1010
public interface BodyBuilder<R> {
1111

12+
/**
13+
* 构建请求体
14+
* @param req 后端http请求对象
15+
* @param request Forest请Cont求对象
16+
* @param lifeCycleHandler 生命周期处理器
17+
*/
1218
void buildBody(R req, ForestRequest request, LifeCycleHandler lifeCycleHandler);
1319
}

forest-core/src/main/java/com/dtflys/forest/backend/body/AbstractBodyBuilder.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ public void buildBody(T httpRequest, ForestRequest request, LifeCycleHandler lif
7878
}
7979
}
8080

81+
/**
82+
* 设置字节数组类型请求体
83+
* @param httpReq 后端请求对象
84+
* @param request Forest请求对象
85+
* @param bytes 字节数组
86+
* @param charset 字符集
87+
* @param contentType 数据类型
88+
* @param mergeCharset 是否合并字符集
89+
*/
8190
public void setBody(T httpReq, ForestRequest request, byte[] bytes, String charset, String contentType, boolean mergeCharset) {
8291
if (charset != null) {
8392
String text = new String(bytes, Charset.forName(charset));

forest-core/src/main/java/com/dtflys/forest/interceptor/Interceptor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ default void afterExecute(ForestRequest request, ForestResponse response) {
9696
* @param request Forest请求对象
9797
* @param encoder Forest转换器
9898
* @param encodedData 序列化后的请求体数据
99+
* @return 编码后的请求体数据
99100
*/
100101
default byte[] onBodyEncode(ForestRequest request, ForestEncoder encoder, byte[] encodedData) {
101102
return encodedData;

forest-core/src/main/java/com/dtflys/forest/lifecycles/authorization/OAuth2Client.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
* @author HouKunLin
1313
* @since 1.5.0-BETA9
14-
* @deprecated 已过时,在引入 {@link OAuth2#forestInterceptor()} 功能后,这个接口用法就不再使用了,该接口在未来将会被删除,如果你的代码中有用到该接口,请及时迁移
14+
* @deprecated 已过时,在引入 {@link OAuth2#tokenInterceptor()} 功能后,这个接口用法就不再使用了,该接口在未来将会被删除,如果你的代码中有用到该接口,请及时迁移
1515
*/
1616
@Deprecated
1717
public interface OAuth2Client {
@@ -23,7 +23,7 @@ public interface OAuth2Client {
2323
* @param query GET 参数
2424
* @param body POST 参数
2525
* @return 返回json信息 {@link OAuth2Token}类实例
26-
* @deprecated 已过时,在引入 {@link OAuth2#forestInterceptor()} 功能后,这个接口用法就不再使用了,该接口在未来将会被删除,如果你的代码中有用到该接口,请及时迁移
26+
* @deprecated 已过时,在引入 {@link OAuth2#tokenInterceptor()} 功能后,这个接口用法就不再使用了,该接口在未来将会被删除,如果你的代码中有用到该接口,请及时迁移
2727
*/
2828
@Deprecated
2929
@PostRequest(url = "${tokenUri}")

forest-core/src/main/java/com/dtflys/forest/utils/Base64Utils.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,29 @@ public class Base64Utils {
1515
private final static Base64.Encoder ENCODER = Base64.getEncoder();
1616

1717

18+
/**
19+
* 对字符串进行 Base64 编码,并返回编码后的字符串
20+
* @param str 原字符串
21+
* @return Base64 编码后的字符串
22+
*/
1823
public static String encode(String str) {
1924
return ENCODER.encodeToString(str.getBytes());
2025
}
2126

27+
/**
28+
* 对字符串进行 Base64 编码,并返回编码后的字节数组
29+
* @param str 原字符串
30+
* @return Base64 编码后的字节数组
31+
*/
2232
public static byte[] encodeToByteArray(String str) {
2333
return ENCODER.encode(str.getBytes());
2434
}
2535

26-
36+
/**
37+
* 对 Base64 编码后的字符串进行解码,并返回解码后的字节数组
38+
* @param str Base64 编码后的字符串
39+
* @return Base64 解码后的字节数组
40+
*/
2741
public static byte[] decode(String str) {
2842
return DECODER.decode(str);
2943
}

0 commit comments

Comments
 (0)