1507 Commits
2.7.0 ... main

Author SHA1 Message Date
redkale
e7f64abc21 ThrowFunction 2024-11-19 22:15:33 +08:00
redkale
800da01c72 SslReadCompletionHandler 2024-11-11 08:50:18 +08:00
redkale
6ade0fdb77 AsyncConnection 2024-11-10 01:07:00 +08:00
redkale
08e79dfde2 Response 2024-11-10 00:20:24 +08:00
redkale
fa982b33cc writePending 2024-11-10 00:05:47 +08:00
redkale
84ac030c42 HttpResponse 2024-11-09 23:58:08 +08:00
redkale
bfb0848fa2 HttpResponse 2024-11-09 23:46:30 +08:00
redkale
7a76256317 Response优化 2024-11-09 23:35:35 +08:00
redkale
f700743134 增加MessageProducer.sendDelayMessage接口 2024-11-09 19:02:21 +08:00
redkale
6401c74f10 增加MessageProducer.sendDelayMessage接口 2024-11-09 18:58:06 +08:00
redkale
65b4e66677 移除pipelineWrite 2024-11-09 08:37:51 +08:00
redkale
243bd95b44 write 2024-11-09 07:50:24 +08:00
redkale
b40f167867 移除writeLock 2024-11-09 07:43:19 +08:00
redkale
550f955678 临时调整writeInLock 2024-11-06 21:18:30 +08:00
redkale
39b1ea3e4e CachedEntry 2024-11-05 16:09:59 +08:00
redkale
da25cd531f HttpResponse 2024-11-04 21:59:19 +08:00
redkale
3876f149fd 注释 2024-11-04 20:07:52 +08:00
redkale
151b09ce0b doc 2024-11-04 08:36:17 +08:00
redkale
9d691e50f7 AsyncConnection 2024-10-31 21:33:42 +08:00
redkale
0895c82525 AsyncConnection 2024-10-31 08:47:56 +08:00
redkale
e6d4b26c9d AsyncConnection 2024-10-28 21:47:56 +08:00
redkale
39f743b47d writeInLock 2024-10-28 12:18:08 +08:00
redkale
f33ac5f88a pipelineWrite 2024-10-28 10:41:55 +08:00
redkale
edfc7b9190 writeLock 2024-10-28 09:22:18 +08:00
redkale
c43d151d4d AsyncNioConnection 2024-10-27 17:28:27 +08:00
redkale
f3f84bd5b3 pipelineWrite 2024-10-27 11:38:17 +08:00
redkale
8f257761fd 移除WebSocket泛型 2024-10-26 09:32:39 +08:00
redkale
020d9c853d 解决WebSocket注入多Service问题 2024-10-25 17:04:55 +08:00
redkale
da88762f99 defaultConvert 2024-10-25 11:07:30 +08:00
redkale
60a47d33c4 json 2024-10-24 20:59:54 +08:00
redkale
ec17eea1e0 sonar 2024-10-24 16:00:12 +08:00
redkale
29ea1eb76b sonar 2024-10-24 09:17:01 +08:00
redkale
9c7ece9282 JsonDynEncoder 2024-10-24 08:37:48 +08:00
redkale
2c0dbeaa15 json 2024-10-23 15:31:21 +08:00
redkale
377799f19a json 2024-10-23 12:24:13 +08:00
redkale
7e85fc134b test 2024-10-23 12:05:09 +08:00
redkale
95e207fd34 json 2024-10-23 09:43:03 +08:00
redkale
3a7a462f65 json 2024-10-23 08:32:56 +08:00
redkale
f8b8429044 JsonByteBufferReader 2024-10-22 14:16:42 +08:00
redkale
f9744b8480 ProtobufAnyDecoder 2024-10-22 09:58:10 +08:00
redkale
4695d787c5 JsonAnyDecoder 2024-10-22 09:45:02 +08:00
redkale
1d9f385da9 sendToChannel0 2024-10-21 20:41:57 +08:00
redkale
72fe0dc2ba abort 2024-10-21 20:26:08 +08:00
redkale
5fbe56bfc1 WebSocket优化 2024-10-21 17:10:52 +08:00
redkale
e2a3560661 pipelineWrite 2024-10-21 14:29:27 +08:00
redkale
c524e15267 conn 2024-10-21 14:22:35 +08:00
redkale
5da88a7916 PipelinePacket 2024-10-21 12:41:17 +08:00
redkale
7c9c3822e0 AnyValue 2024-10-20 14:15:45 +08:00
redkale
1d6b1a3a30 json 2024-10-20 14:12:23 +08:00
redkale
aec47a7a9a loadEncoder 2024-10-20 14:09:19 +08:00
redkale
754c9f0c2b pb 2024-10-20 08:39:19 +08:00
redkale
7405ce4dab pb 2024-10-20 02:12:30 +08:00
redkale
59b9c695ec pb 2024-10-20 01:49:10 +08:00
redkale
c2a923619e pb 2024-10-20 01:00:41 +08:00
redkale
a19b083478 pb 2024-10-19 23:10:49 +08:00
redkale
9cf402f18c pb 2024-10-19 19:42:40 +08:00
redkale
9a085536fb pb 2024-10-19 19:31:48 +08:00
redkale
e82f7e39b0 anyvalue 2024-10-19 17:50:11 +08:00
redkale
fa8ca1fb38 response 2024-10-19 09:28:32 +08:00
redkale
fd5225ab37 doc 2024-10-18 14:46:21 +08:00
redkale
c0960b21f1 pipelineWrite 2024-10-18 14:41:48 +08:00
redkale
062f9a09db source 2024-10-18 09:59:25 +08:00
redkale
264cc3995b convert 2024-10-17 20:24:19 +08:00
redkale
173a5c8a24 json 2024-10-17 20:09:31 +08:00
redkale
1491f6be70 json 2024-10-17 19:55:40 +08:00
redkale
cc760ff327 json 2024-10-17 19:49:40 +08:00
redkale
2c47e5db30 json 2024-10-17 12:33:00 +08:00
redkale
4f6ca16ca6 json 2024-10-17 12:30:11 +08:00
redkale
57686cf221 json 2024-10-17 12:10:54 +08:00
redkale
7586577521 json 2024-10-17 09:05:09 +08:00
redkale
f1ae2bd165 json 2024-10-16 23:40:52 +08:00
redkale
048c718ba2 json 2024-10-16 22:50:23 +08:00
redkale
6429cc93f8 json 2024-10-16 20:50:59 +08:00
redkale
e4bf7432f4 json 2024-10-16 18:16:41 +08:00
redkale
a989f1af9f test 2024-10-16 17:07:54 +08:00
redkale
687606282a json 2024-10-16 16:54:02 +08:00
redkale
ae7bae1b05 pom 2024-10-15 18:02:05 +08:00
redkale
bea6f6fd5a test 2024-10-15 17:07:31 +08:00
redkale
50994c3f78 json优化 2024-10-15 15:28:48 +08:00
redkale
0d45e6c43b readRegister 2024-10-15 00:26:05 +08:00
redkale
3e06534b63 finishJson 2024-10-14 23:31:18 +08:00
redkale
2ec628cc7d doc 2024-10-14 18:12:16 +08:00
redkale
4d17fe7e3f BoolRef 2024-10-14 08:50:17 +08:00
redkale
4e2ba22fc3 test 2024-10-13 21:27:46 +08:00
redkale
85ac8f743d cache 2024-10-13 19:07:56 +08:00
redkale
f65c02677f dyn 2024-10-13 14:20:13 +08:00
redkale
399df22672 dyn 2024-10-13 13:12:12 +08:00
redkale
1cc659276b visitLocalVariable 2024-10-13 10:45:10 +08:00
redkale
909b813573 finishJson优化 2024-10-13 09:29:23 +08:00
redkale
38ec269df2 getPathLastParam废弃 2024-10-12 12:43:02 +08:00
redkale
dbee6c15b0 isCacheClassLoader 2024-10-12 08:39:41 +08:00
redkale
3a532617a1 createCacheClassLoader 2024-10-12 08:33:14 +08:00
redkale
b6accc97f6 currentClassLoader 2024-10-12 08:25:46 +08:00
redkale
a1c4fafa47 test 2024-10-11 22:37:07 +08:00
redkale
bb611413a5 dynclass 2024-10-11 22:02:58 +08:00
redkale
3f172824b6 sncp 2024-10-11 20:24:30 +08:00
redkale
acf8eb1ce0 inNativeImage 2024-10-11 20:05:10 +08:00
redkale
45b0e7098b 优化classloader 2024-10-11 18:57:16 +08:00
redkale
5a7181428f collection 2024-10-11 14:51:49 +08:00
redkale
d5908815d9 client 2024-10-11 14:29:29 +08:00
redkale
f86f82db8d 调整生成动态字节码时的ClassLoader 2024-10-11 12:26:13 +08:00
redkale
1dc07638e5 sncp 2024-10-11 01:04:57 +08:00
redkale
335933a0f4 sncp 2024-10-11 00:46:23 +08:00
redkale
8ea63c5171 creator 2024-10-10 22:29:39 +08:00
redkale
ed2d9527bf sncp 2024-10-10 20:10:08 +08:00
redkale
dc3396daf5 sncp 2024-10-10 14:28:03 +08:00
redkale
72d9427426 WebSocketNode 2024-10-10 01:53:11 +08:00
redkale
35754cb8f5 ws 2024-10-10 01:15:05 +08:00
redkale
6769389f3a WebSocket 2024-10-09 23:45:56 +08:00
redkale
1bcc35cbcf json 2024-10-09 23:18:31 +08:00
redkale
227e94b546 readpending 2024-10-09 22:46:32 +08:00
redkale
0d84ef0541 AnonymousVirtuals 2024-10-09 21:32:46 +08:00
redkale
21c00b3419 sncp 2024-10-09 21:29:04 +08:00
redkale
62eb06f272 移除ConvertEntity 2024-10-09 19:37:16 +08:00
redkale
e5acbdcdee 移除BSON功能 2024-10-09 19:28:47 +08:00
redkale
71cec55f1c 修复WebSocket.readPending问题 2024-10-09 18:07:55 +08:00
redkale
76623e9c6b json 2024-10-08 20:28:55 +08:00
redkale
59ad1d8617 readRegisterInIOThread 2024-10-08 16:01:11 +08:00
redkale
a542c03e8b 移除fastWrite 2024-10-08 15:54:51 +08:00
redkale
845a1e97ff fastWrite 2024-10-08 09:14:01 +08:00
redkale
3d8c2f1fc5 fastWrite优化 2024-10-07 22:22:25 +08:00
redkale
77a8b8fa7f 注释 2024-10-07 21:51:53 +08:00
redkale
0427a76b55 AsyncConnection新增fastWrite功能 2024-10-07 20:17:21 +08:00
redkale
ba7bbed7b1 json 2024-10-07 12:27:08 +08:00
redkale
0138e46ee5 getDeclaredConstructor 2024-10-07 11:04:41 +08:00
redkale
8ca483c63e Utility 2024-10-07 10:18:28 +08:00
redkale
2b06bc26bf Utility 2024-10-07 10:14:32 +08:00
redkale
1db55185d7 Unsafe优化 2024-10-07 09:38:03 +08:00
redkale
d6a90f23a5 Utility 2024-10-07 00:06:52 +08:00
redkale
c8cd1e23ef Utility 2024-10-06 23:30:51 +08:00
redkale
34fef28ed6 un 2024-10-06 22:38:26 +08:00
redkale
d20d20f46a unsafe 2024-10-06 22:36:29 +08:00
redkale
acdd626d4f Utility 2024-10-06 21:39:59 +08:00
redkale
f3a0e7a1a8 findStaticVarHandle 2024-10-06 21:34:27 +08:00
redkale
545a0c5473 临时代码 2024-10-06 21:19:50 +08:00
redkale
4eb34ba7d9 ProtocolCodec.readRegister优化 2024-10-05 22:22:40 +08:00
redkale
7bab2742a5 ProtocolCodec.readRegister 优化 2024-10-05 22:19:52 +08:00
redkale
154fd08183 Jdk21Inners 2024-10-05 21:39:47 +08:00
redkale
07eb1386de module-info 2024-10-05 19:31:39 +08:00
redkale
162401ee19 HttpRequest 2024-10-05 19:27:09 +08:00
redkale
a0a12bc709 ByteTreeNode 2024-10-05 19:04:50 +08:00
redkale
d2b8ef4471 readMethodUriLine优化 2024-10-05 17:53:49 +08:00
redkale
a2ac9ff896 ByteTreeNode 2024-10-05 16:04:08 +08:00
redkale
04e539ab0f ByteTreeNode 2024-10-05 15:30:16 +08:00
redkale
2f5f96290f Jdk21Inners 2024-10-05 10:17:19 +08:00
redkale
198a3575f8 pb 2024-10-04 20:22:44 +08:00
redkale
69fa2c9156 pb 2024-10-04 20:02:37 +08:00
redkale
37cc5dd080 pb 2024-10-04 19:37:02 +08:00
redkale
a3cbc19de9 pb 2024-10-04 18:13:12 +08:00
redkale
b56feefd8a pb 2024-10-04 17:04:45 +08:00
redkale
96ac0d8715 pb 2024-10-04 16:58:44 +08:00
redkale
b5c381d992 pb 2024-10-04 13:17:42 +08:00
redkale
aaa719214d pb 2024-10-04 11:21:36 +08:00
redkale
5c5bce467f pb 2024-10-04 11:01:49 +08:00
redkale
b7a604ebee ProtobufBytesWriter 2024-10-03 10:03:35 +08:00
redkale
88417f35a4 pb 2024-10-03 01:06:07 +08:00
redkale
8e981e1b7e pb 2024-10-03 01:05:12 +08:00
redkale
67aa3c0609 pb 2024-10-02 09:29:04 +08:00
redkale
4e71f8009a protobuf 2024-10-02 00:50:40 +08:00
redkale
692f0fa8b1 protobuf 2024-10-02 00:41:08 +08:00
redkale
cd15a1a586 protobuf 2024-10-01 19:55:40 +08:00
redkale
e8a53d6b24 pb 2024-10-01 08:56:17 +08:00
redkale
00c22d4a72 pb 2024-09-30 19:56:51 +08:00
redkale
bb92e4541a pb 2024-09-30 19:40:16 +08:00
redkale
e7f05c31e0 Protobuf 2024-09-30 18:38:50 +08:00
redkale
306dbabc7d PatternSimpledCoder 2024-09-30 15:02:04 +08:00
redkale
f18ffb7940 readField 2024-09-30 12:45:31 +08:00
redkale
850ff211ca convert 2024-09-30 11:50:50 +08:00
redkale
40000ae026 protobuf 2024-09-30 10:11:40 +08:00
redkale
dad7d38202 convert 2024-09-30 09:45:30 +08:00
redkale
8cf8a2c037 bson 2024-09-30 08:59:17 +08:00
redkale
c847b349a2 Request 2024-09-30 08:28:10 +08:00
redkale
4070945270 request 2024-09-30 08:14:32 +08:00
redkale
b40f975c14 decodeable 2024-09-29 23:02:53 +08:00
redkale
fbe2a01519 loadHeaderBytes优化 2024-09-29 22:47:28 +08:00
redkale
0b10009d5e EnumSimpledCoder 2024-09-29 14:46:51 +08:00
redkale
b724ce1a0c ConvertStandardString 2024-09-29 14:27:52 +08:00
redkale
ab2773ba86 convert 2024-09-29 12:18:31 +08:00
redkale
bc4b3ab17f convert 2024-09-29 12:15:23 +08:00
redkale
f42ff13824 convert 2024-09-29 12:12:21 +08:00
redkale
b736cbafc6 json 2024-09-29 09:59:50 +08:00
redkale
090bfb5629 convert 2024-09-29 09:34:33 +08:00
redkale
73eb306eb2 protobuf 2024-09-29 00:23:01 +08:00
redkale
71cfd9e1cd test 2024-09-29 00:09:25 +08:00
redkale
1dec372d18 protobuf 2024-09-29 00:07:13 +08:00
redkale
7536744d93 protobuf 2024-09-28 19:39:45 +08:00
redkale
b50a28132b protobuf 2024-09-28 18:58:30 +08:00
redkale
c804cb8c1c writer 2024-09-28 17:52:27 +08:00
redkale
fd5b63f58c convert 2024-09-28 17:23:33 +08:00
redkale
7229fb90de protobuf 2024-09-28 15:20:38 +08:00
redkale
81c7c162bb protobuf 2024-09-28 12:41:53 +08:00
redkale
20b4080f40 test 2024-09-28 12:29:38 +08:00
redkale
4f9805b254 protobuf 2024-09-28 09:21:01 +08:00
redkale
d245f134b7 protobuf 2024-09-28 08:58:21 +08:00
redkale
84177f43f4 convert优化 2024-09-27 18:07:16 +08:00
redkale
438ce904ab convert 2024-09-27 12:49:19 +08:00
redkale
de5114a480 convert 2024-09-27 10:27:31 +08:00
redkale
a0472438c8 减少unsafe使用 2024-09-26 22:00:31 +08:00
redkale
a3e660ff63 protobuf 2024-09-26 18:13:08 +08:00
redkale
271f6d1e03 protobuf 2024-09-26 16:03:20 +08:00
redkale
2ad4dce50e protobuf 2024-09-26 10:32:47 +08:00
redkale
78ba874dbf EntityFullFunc 2024-09-26 08:32:52 +08:00
redkale
4028c9a465 protobuf 2024-09-25 23:27:33 +08:00
redkale
1d4a1d4b66 protobuf 2024-09-25 18:55:18 +08:00
redkale
23eaff080b dyn 2024-09-25 18:39:16 +08:00
redkale
bc55d24e08 TagDecodeable 2024-09-25 18:28:28 +08:00
redkale
c50cb855d1 utf8 2024-09-25 15:40:57 +08:00
redkale
cf638997f6 protobuf 2024-09-25 15:30:27 +08:00
redkale
a42e3cd63c ProtobufDynEncoder 2024-09-25 15:21:24 +08:00
redkale
b58b630be0 JsonDynEncoder 2024-09-25 15:11:36 +08:00
redkale
aa4c592d9e javadoc 2024-09-25 15:01:53 +08:00
redkale
133c280dc2 protobuf 2024-09-25 14:53:52 +08:00
redkale
3e23c9143a protobuf 2024-09-25 13:58:21 +08:00
redkale
3ce56c08df 格式化 2024-09-25 08:54:48 +08:00
redkale
ee29eb98a0 ProtobufWriter 2024-09-25 00:43:54 +08:00
redkale
1d453b7883 ProtobufWriter 2024-09-25 00:33:12 +08:00
redkale
f0fae107ba protobuf 2024-09-24 16:03:30 +08:00
redkale
242f668aa6 protobuf 2024-09-24 12:31:12 +08:00
redkale
97e732e9e3 pbtest 2024-09-24 00:00:47 +08:00
redkale
5f6a8c5a12 EntityFullFunc 2024-09-23 23:08:10 +08:00
redkale
6aa4e87b35 getBigDecimal 2024-09-23 22:56:53 +08:00
redkale
c098674ab8 JsonCharsWriter 2024-09-23 17:49:48 +08:00
redkale
7b03a9fffe AbstractCacheSource 2024-09-23 12:31:10 +08:00
redkale
9235cd035a Asms 2024-09-23 11:23:40 +08:00
redkale
6162e71d29 EntityFullFunc 2024-09-23 11:11:59 +08:00
redkale
a060075d08 EntityFullFunc 2024-09-22 23:38:39 +08:00
redkale
5474cd846d EntityFullFunc 2024-09-22 22:03:38 +08:00
redkale
f207999117 DataJdbcResultSet 2024-09-22 18:53:12 +08:00
redkale
f51a52e895 source 2024-09-21 22:30:56 +08:00
redkale
82d375b517 Request 2024-09-20 20:43:49 +08:00
redkale
8ad28e8932 protobuf 2024-09-19 17:04:43 +08:00
redkale
5f2abc725b protobuf 2024-09-19 16:20:34 +08:00
redkale
f4c4bfda70 protobuf 2024-09-19 12:45:21 +08:00
redkale
2cf74bedca protobuf 2024-09-19 10:25:13 +08:00
redkale
3646e0ab15 protobuf 2024-09-19 08:59:58 +08:00
redkale
a79c4303aa protobuf 2024-09-18 22:15:10 +08:00
redkale
79e63fa7ad json 2024-09-17 17:33:09 +08:00
redkale
10842830dc json 2024-09-17 17:01:22 +08:00
redkale
016ee632c1 json 2024-09-17 16:33:03 +08:00
redkale
5015834d69 json 2024-09-17 15:31:28 +08:00
redkale
58d3f5101c JsonByteBufferReader 2024-09-17 13:24:20 +08:00
redkale
f2992a76fa convertListFrom 2024-09-17 12:16:46 +08:00
redkale
8cc83af502 JsonReader 2024-09-17 11:40:41 +08:00
redkale
64f6ac55e7 DeMemberInfo 2024-09-17 11:12:14 +08:00
redkale
a7cddab9fb CharArray 2024-09-17 10:34:35 +08:00
redkale
1cfc17766a DeMemberNode 2024-09-17 08:57:39 +08:00
redkale
c8ba21dac2 JsonCharsWriter 2024-09-16 22:30:25 +08:00
redkale
fe293c6f25 BYTE_DQUOTE 2024-09-16 21:03:15 +08:00
redkale
6dca528381 json 2024-09-16 17:21:13 +08:00
redkale
fcff5ccf7e json 2024-09-16 11:53:36 +08:00
redkale
a65f4318f5 格式化 2024-09-15 09:40:54 +08:00
redkale
cc5a3106aa 格式化 2024-09-14 23:21:23 +08:00
redkale
c4a02e05e1 Client 2024-09-14 08:55:54 +08:00
redkale
67312e3a7e 格式化 2024-09-13 23:09:20 +08:00
redkale
767f689351 移除shareAsyncGroup 2024-09-13 22:47:27 +08:00
redkale
334c4920d9 HttpRequest 2024-09-13 12:33:15 +08:00
redkale
0c1f605dbb 还原 2024-09-13 08:39:37 +08:00
redkale
c0ea28cf9c 临时 2024-09-13 08:36:29 +08:00
redkale
28aa2285f5 HttpRequest 2024-09-13 08:34:58 +08:00
redkale
a757504877 Response 2024-09-13 07:47:26 +08:00
redkale
aa3a00a40f HttpRequest 2024-09-12 18:36:48 +08:00
redkale
1035052f02 Request.pipelineHeaderLength 2024-09-12 16:35:16 +08:00
redkale
c370c885e6 Response 2024-09-12 08:44:38 +08:00
redkale
2c39167025 Client 2024-09-11 22:15:52 +08:00
redkale
ff1d392196 CachedManager 2024-09-11 17:43:06 +08:00
redkale
20518259aa Cached.checkName 2024-09-11 17:23:32 +08:00
redkale
5aa3e61686 CachedAction 2024-09-11 17:07:46 +08:00
redkale
12a39ac405 CachedLocalSource 2024-09-11 16:51:33 +08:00
redkale
2a8bda69e5 增加Cached.localLimit属性 2024-09-11 16:43:22 +08:00
redkale
ebf498edf8 CachedManagerService 2024-09-11 13:47:34 +08:00
redkale
357d8b3d11 CachedLocalSource 2024-09-11 13:45:30 +08:00
redkale
91eee09e2f CachedAction 2024-09-11 11:30:48 +08:00
redkale
2b18310050 增加Cached.name属性 2024-09-11 11:17:39 +08:00
redkale
61586beb45 格式化 2024-09-11 10:12:24 +08:00
redkale
eced5e522e 格式化 2024-09-11 09:56:01 +08:00
redkale
352dc9038f CachedManager 2024-09-10 14:53:38 +08:00
redkale
9c4aeda85c readHeader 2024-09-10 08:17:39 +08:00
redkale
ac8d146c98 CacheSource.lock 2024-09-09 20:03:21 +08:00
redkale
98021cb87f 格式化 2024-09-09 17:55:22 +08:00
redkale
588e1eca90 SncpRequest 2024-09-09 12:38:13 +08:00
redkale
d5c3841198 HttpRequest 2024-09-08 18:16:08 +08:00
redkale
da8ee3a6d7 Request.subobject 2024-09-08 18:15:07 +08:00
redkale
672b5a7cf5 EntityInfo 2024-09-08 02:06:14 +08:00
redkale
3ca986e5a5 EntityCache 2024-09-08 01:13:28 +08:00
redkale
8c448da19a EntityInfo 2024-09-08 00:46:43 +08:00
redkale
2f37dd9c03 Application.shareAsyncGroup 2024-09-08 00:17:45 +08:00
redkale
9da964657d Context.maxHeader 2024-09-07 23:33:10 +08:00
redkale
50c10f31fa ByteBufferPool 2024-09-07 23:01:26 +08:00
redkale
9cb4889a9c Client 2024-09-07 19:55:51 +08:00
redkale
426e8e463a 格式化 2024-09-07 12:48:11 +08:00
redkale
2c25cc9f27 DataSource增加nonBlocking配置 2024-09-07 12:33:57 +08:00
redkale
ea01415b5f 格式化 2024-09-07 09:29:11 +08:00
redkale
21b9239c8d 还原 2024-09-05 15:24:43 +08:00
redkale
aab8a631f0 临时屏蔽 2024-09-05 15:00:42 +08:00
redkale
2506405d8c HttpContext.lazyHeader 2024-09-05 12:25:55 +08:00
redkale
3cda0c4dd9 Client.authenticate 2024-09-05 12:11:34 +08:00
redkale
8ca6f46c4a 优化 2024-09-05 08:46:05 +08:00
redkale
ec7f54809f 优化 2024-09-04 22:54:18 +08:00
redkale
cfcb11ae61 增加SourceType 2024-09-04 17:57:32 +08:00
redkale
01c8aca36a Request增加Annotation[]属性 2024-09-04 17:09:39 +08:00
redkale
4c6403a4ca youhua 2024-08-27 11:42:05 +08:00
redkale
1d3049b743 Utility.inNativeImage 2024-08-26 23:36:24 +08:00
redkale
932bf729b0 hasLimit 2024-08-26 14:23:58 +08:00
redkale
48007b141b Client优化 2024-08-25 09:43:51 +08:00
redkale
5ddf730c7d Filter文档 2024-08-24 11:36:12 +08:00
redkale
6fb70c3945 RetException优化 2024-08-23 10:20:52 +08:00
redkale
cce667e019 增加Messaged.regexTopic 2024-08-22 20:00:16 +08:00
redkale
6a72fecbb1 完善文档 2024-08-21 16:25:34 +08:00
redkale
4328eb7770 修复RestConvertCoder不生效的bug 2024-08-21 11:51:58 +08:00
redkale
a33f5dcd6f AsyncConnection 2024-08-20 22:43:50 +08:00
redkale
21cb0e191e 代码优化 2024-08-20 18:49:03 +08:00
redkale
f6d20a6324 AnyValue.toJsonObject 2024-08-20 18:16:12 +08:00
redkale
254ab9a25a ByteTuple 2024-08-19 19:47:38 +08:00
redkale
b48182f7cc HttpResponse.sendHandler 2024-08-19 16:20:25 +08:00
redkale
4adf23e57c HttpResponse优化 2024-08-19 15:57:49 +08:00
redkale
95fff255cf 文档完善 2024-08-19 11:44:10 +08:00
redkale
05d2a5aa8c 完善文档 2024-08-19 11:36:22 +08:00
redkale
ff70491e55 完善文档 2024-08-19 11:31:04 +08:00
redkale
43d739638d 完善文档 2024-08-19 11:28:34 +08:00
redkale
2c65bb5996 javadoc 2024-08-18 11:06:11 +08:00
redkale
74823fe2fe MessageEvent 2024-08-18 01:44:09 +08:00
redkale
9137aed8db WebClient优化 2024-08-17 16:13:14 +08:00
redkale
6f9d851965 注释 2024-08-17 12:29:11 +08:00
redkale
cd415699b7 ClientWriteThread 2024-08-17 11:32:27 +08:00
redkale
9402db9fd5 Client 2024-08-17 11:11:20 +08:00
redkale
96e9d897ec Client优化 2024-08-16 22:18:42 +08:00
redkale
5384e9ab96 Client优化 2024-08-16 19:31:31 +08:00
redkale
cf65c780c8 ClientFuture 2024-08-16 17:23:48 +08:00
redkale
e1a88ef5d9 ClientConnection 2024-08-16 16:45:55 +08:00
redkale
86ea5f8cb9 完善文档 2024-08-16 15:52:10 +08:00
redkale
db0b81b4a0 readChunkedBody 2024-08-16 12:00:19 +08:00
redkale
e7ed4ae9bc lazyHeader 2024-08-16 09:37:50 +08:00
redkale
60b4425a47 chunked 2024-08-15 23:06:14 +08:00
redkale
742a0fde42 实现Content-Encoding 2024-08-15 19:53:00 +08:00
redkale
b1d87f4d66 移除chunked 2024-08-15 18:14:09 +08:00
redkale
5a2dbc4e67 增加chunked信息 2024-08-15 18:08:06 +08:00
redkale
6edf8b58fc keep-alive必须要有content-length 2024-08-15 17:52:45 +08:00
redkale
dd0debd51e Flipper.sort兼容多余的空格 2024-08-15 17:07:27 +08:00
redkale
c520910d5c AppConfig 2024-08-15 12:06:07 +08:00
redkale
8c0b9a0f6a 增加source.yml配置 2024-08-15 12:02:32 +08:00
redkale
4876191e7a YamlProvider 2024-08-14 23:34:52 +08:00
redkale
5168dd59ce YamlLoader 2024-08-14 23:29:30 +08:00
redkale
09d710b928 YamlReader 2024-08-14 23:01:35 +08:00
redkale
d3580668b6 AnyValue增加toProperties方法 2024-08-14 22:11:30 +08:00
redkale
0c9576603d 格式化 2024-08-14 20:07:35 +08:00
redkale
f10ade8795 AbstractDataSource 2024-08-14 20:04:56 +08:00
redkale
483244bda2 YmlProvider 2024-08-14 17:02:59 +08:00
redkale
d69412b1f8 YmlProvider 2024-08-14 15:32:00 +08:00
redkale
66806d60a5 MessagedInstanceTest 2024-08-13 23:03:55 +08:00
redkale
9d169c568b protobuf更换包名 2024-08-13 19:57:06 +08:00
redkale
3acf6a40ad readme 2024-08-13 19:16:32 +08:00
redkale
3158f9265f 文档完善 2024-08-13 19:09:27 +08:00
redkale
df8fd31e75 注释 2024-08-13 15:39:02 +08:00
redkale
44bb9ac086 MessageAsmMethodBoost优化 2024-08-13 15:27:54 +08:00
redkale
cb9b57a04c MessageAsmMethodBoost优化 2024-08-13 11:25:14 +08:00
redkale
f694b617cf MessageAsmMethodBoost优化 2024-08-13 02:34:25 +08:00
redkale
f19e2a916e AsmMethodBoost优化 2024-08-13 01:52:33 +08:00
redkale
a51141d497 MessageAsmMethodBoost优化 2024-08-13 01:36:28 +08:00
redkale
aee5745172 MessageAsmMethodBoost优化 2024-08-12 23:49:25 +08:00
redkale
cebd463d58 MessageAgent优化 2024-08-12 20:25:55 +08:00
redkale
45548f2de9 MessageAsmMethodBoost优化 2024-08-12 20:05:59 +08:00
redkale
6ad3ba192b MessageAgent优化 2024-08-12 17:15:33 +08:00
redkale
f8fbabaef9 完善注释 2024-08-09 15:03:40 +08:00
redkale
328d2c432e ClassFilter过滤优化 2024-08-09 00:11:20 +08:00
redkale
f871c36080 ResourceTypeLoader优化 2024-08-08 23:52:37 +08:00
redkale
33c579f14f 注释优化 2024-08-08 23:08:35 +08:00
redkale
aa47820ee7 优化Configuration 2024-08-08 17:19:44 +08:00
redkale
b6659ea15e 优化Configuration 2024-08-08 16:49:29 +08:00
redkale
cca73a5045 增加Configuration功能 2024-08-08 16:22:35 +08:00
redkale
c6fa2a688c isEmpty 2024-08-07 21:16:52 +08:00
redkale
2733cbcc62 @Serial 2024-08-05 16:15:18 +08:00
redkale
f1f8f653e4 ScheduledManager增加execute方法 2024-08-01 08:03:10 +08:00
redkale
d6cd97c798 addURI 2024-07-25 15:25:14 +08:00
redkale
61a9e88cd0 CacheClusterAgent 2024-07-24 22:50:16 +08:00
redkale
c357373310 ClassFilter.toPattern优化 2024-07-24 22:32:28 +08:00
redkale
15cd481713 增加HttpRequest.remoteAddrHeaders属性 2024-07-05 10:21:02 +08:00
redkale
7bbf05af21 MessageAgent优化 2024-07-03 16:12:27 +08:00
redkale
20d400178b MessageManager接口异步化 2024-07-03 15:04:36 +08:00
redkale
8fde50fabf 格式化 2024-07-02 11:21:14 +08:00
redkale
69c2baae51 ClusterAgent 2024-07-01 13:10:25 +08:00
redkale
9b48e85b26 ClusterAgent优化 2024-07-01 11:38:06 +08:00
redkale
913a055e7e CachedManager增加node属性 2024-06-29 23:48:57 +08:00
redkale
ff76c698f4 SQL模板支持默认值 2024-06-29 19:18:45 +08:00
redkale
8136345484 修正regx为regex 2024-06-29 16:32:03 +08:00
redkale
def85ca1ac 注释 2024-06-29 12:16:50 +08:00
redkale
f9d762534d 优化RowBound 2024-06-29 11:24:50 +08:00
redkale
68af3c7495 Entity增加camelCase属性 2024-06-27 21:24:37 +08:00
redkale
da17758614 增加RetException 2024-06-27 12:32:18 +08:00
redkale
76761acb9b 完善文档 2024-06-25 22:21:32 +08:00
redkale
c05be6d4f8 优化ScheduleManagerService 2024-06-25 15:07:39 +08:00
redkale
978afdd829 MultiHashKey支持字段名同名的getter方法 2024-06-25 12:24:35 +08:00
redkale
38e8da994e 多个正则支持逗号分隔 2024-06-21 11:04:33 +08:00
redkale
c99cf9d0d9 注释 2024-06-21 10:54:26 +08:00
redkale
52cf34ba29 增加formatPackageRegx 2024-06-21 10:50:23 +08:00
redkale
ca06085dfb 优化PatternSimpledCoder 2024-06-20 12:18:22 +08:00
redkale
9ddd8472b1 CachedManager 2024-06-13 15:34:34 +08:00
redkale
4411a32522 CachedActionFunc 2024-06-13 15:23:12 +08:00
redkale
892e09cb53 Merge branch 'main' of https://github.com/redkale/redkale 2024-06-12 22:41:21 +08:00
redkale
01439d0779 doc 2024-06-12 22:40:49 +08:00
Redkale
f1fe2ac81b Update README.md 2024-06-12 22:31:19 +08:00
Redkale
c5de588fd3 Update README.md 2024-06-12 22:30:40 +08:00
Redkale
1e5442a1b9 Update README.md 2024-06-12 22:30:05 +08:00
redkale
0ccddc04c0 增加RestGetMapping/RestPostMapping 2024-06-12 20:42:01 +08:00
redkale
fd4aa227d3 RetCodes 2024-06-12 19:29:43 +08:00
redkale
7d841e938c RetCodes 2024-06-12 19:21:53 +08:00
redkale
a47f73cf10 RetCodes 2024-06-12 19:09:18 +08:00
redkale
9acb7a5290 RetLabel 2024-06-12 16:32:52 +08:00
redkale
15a501b2cd 增加RetCodes错误码加载器 2024-06-12 16:18:57 +08:00
redkale
0f110fca33 ConvertType 2024-06-12 15:40:34 +08:00
redkale
3060b99a89 pom 2024-06-12 15:23:47 +08:00
redkale
53f1d6dded pom 2024-06-12 15:22:18 +08:00
redkale
145dcdf1d3 加强注释 2024-06-12 15:19:25 +08:00
redkale
a676dca6b4 DataResultSetRow 2024-06-12 10:43:29 +08:00
redkale
7c28f2c54d 注释 2024-06-11 15:38:13 +08:00
redkale
a1645e8b46 CachedManagerTest 2024-06-11 15:00:17 +08:00
redkale
52c120e5ac 注释 2024-06-11 14:52:15 +08:00
redkale
5913c515b9 调整ResourceTypeLoader 2024-06-11 12:05:37 +08:00
redkale
b89bc452e6 CACHED_CHANNEL_TOPIC 2024-06-11 00:44:35 +08:00
redkale
ff1bba7679 getChannelTopic 2024-06-11 00:43:30 +08:00
redkale
da6855193b CachedEventMessage 2024-06-11 00:36:41 +08:00
redkale
7d2903b1a8 config 2024-06-11 00:13:21 +08:00
redkale
a6ae2ec816 CachedManager 2024-06-11 00:07:58 +08:00
redkale
c23055a7d3 CachedManager多实例化 2024-06-11 00:00:45 +08:00
redkale
2ee9dcfeb2 AsyncConnection移除超时参数 2024-06-10 13:21:43 +08:00
redkale
4478c521e6 AsyncGroup 2024-06-09 07:35:50 +08:00
redkale
36fb3391cc scheduled 2024-06-08 19:47:53 +08:00
redkale
74b91ac5b0 scheduled优化 2024-06-08 19:00:19 +08:00
redkale
ca7c0d47b0 EventListener 2024-06-08 16:55:24 +08:00
redkale
6bcb1de304 LockedAction 2024-06-08 16:32:52 +08:00
redkale
bbf72bb27b Cached优化 2024-06-08 15:23:58 +08:00
redkale
f62b276033 CachedAsyncLock 2024-06-08 12:25:37 +08:00
redkale
f9339229bc CONFIG_NAME 2024-06-08 11:41:13 +08:00
redkale
c60c96a672 cached包重命名 2024-06-08 11:07:42 +08:00
redkale
0ff3d3133b cache优化 2024-06-07 22:42:59 +08:00
redkale
5e5577e685 CacheManager config 2024-06-07 14:58:42 +08:00
redkale
1a4e2986ad CacheManager优化 2024-06-07 14:51:01 +08:00
redkale
90097909ce NativeParserNode 2024-06-07 09:35:23 +08:00
redkale
ba25120dea 新增RowBound功能 2024-06-07 08:43:52 +08:00
redkale
1c07fcc6fa test 2024-06-06 23:53:52 +08:00
redkale
f0bc867220 Cached优化 2024-06-06 23:35:36 +08:00
redkale
4ee64ed1ef DataSqlMonitor 2024-06-06 18:11:40 +08:00
redkale
02202e3d06 executeQuerySheet 2024-06-06 17:24:08 +08:00
redkale
43012a5399 nativePageSql 2024-06-06 17:00:35 +08:00
redkale
2e8c183c3a mariadb 2024-06-06 16:00:36 +08:00
redkale
9fefe9d19e sqlserver 2024-06-06 15:49:27 +08:00
redkale
f3896483ad createPageCountSql 2024-06-06 14:56:32 +08:00
redkale
a358e5bf01 nativePageSql 2024-06-06 14:55:12 +08:00
redkale
071f1f35b7 createPageCountSql 2024-06-06 11:21:00 +08:00
redkale
07d2ca87b9 nativePageSql 2024-06-06 08:32:52 +08:00
redkale
5a8557bf63 createLimitSQL 2024-06-05 23:14:12 +08:00
redkale
698e6c6ee7 DataSqlMapperBuilder 2024-06-05 22:39:33 +08:00
redkale
f3f5f53535 DataSqlMapperBuilder 2024-06-05 17:39:26 +08:00
redkale
00e0a820c7 FilterOrs 2024-06-05 16:55:19 +08:00
redkale
7d84c0ca1f RestSleepTest 2024-06-05 16:51:33 +08:00
redkale
c1992434d0 pom 2024-06-05 16:38:59 +08:00
redkale
0c61ffbe19 pom 2024-06-05 16:21:06 +08:00
redkale
81c6543650 pom 2024-06-05 16:18:38 +08:00
redkale
31cd2163e5 pom 2024-06-04 19:56:28 +08:00
redkale
9668623b25 pom 2024-06-04 19:53:34 +08:00
redkale
e733980e33 增加FilterOrs功能 2024-06-04 19:46:46 +08:00
redkale
e9645e6b05 ColumnHandler 2024-06-04 17:38:10 +08:00
redkale
19041335b4 ConvertColumnHandler优化 2024-06-04 17:26:15 +08:00
redkale
3819e42593 ConvertColumnTransfer优化 2024-06-04 12:14:37 +08:00
redkale
897eb97d46 ConvertColumnTransfer优化 2024-06-04 11:05:38 +08:00
redkale
9b22fc3f5d pom 2024-06-02 08:32:58 +08:00
redkale
91a353900a pom 2024-06-02 08:25:59 +08:00
redkale
fb82801bda pom 2024-06-02 08:20:32 +08:00
redkale
d8c13c8420 pom 2024-06-02 07:56:21 +08:00
redkale
bea1900fdc pom 2024-06-01 09:41:22 +08:00
redkale
439d702e97 pom 2024-06-01 09:05:38 +08:00
redkale
e67720f066 pom 2024-06-01 08:55:42 +08:00
redkale
90dab3a4c6 pom 2024-06-01 08:49:13 +08:00
redkale
a49e340622 pom 2024-06-01 08:44:20 +08:00
redkale
d7ca6bdc6e pom 2024-06-01 08:23:07 +08:00
redkale
2355bb2796 pom 2024-06-01 03:40:07 +08:00
redkale
02013be08a pom 2024-06-01 03:22:41 +08:00
redkale
7f7c4c857e pom 2024-06-01 03:16:14 +08:00
redkale
09e00c02b9 pom 2024-06-01 03:11:47 +08:00
redkale
1b41b6e568 pom 2024-06-01 03:05:45 +08:00
redkale
2665ebf52b pom 2024-06-01 02:50:57 +08:00
redkale
da807e5b8e pom 2024-06-01 02:49:12 +08:00
redkale
4d3a94ca17 pom 2024-06-01 02:47:15 +08:00
redkale
b37cdc2c6d pom 2024-06-01 02:14:06 +08:00
redkale
41c293ed1f pom 2024-06-01 02:08:27 +08:00
redkale
5cdde0eeaa pom 2024-06-01 02:06:58 +08:00
redkale
3e0bfc581c pom 2024-06-01 02:04:24 +08:00
redkale
9463887112 pom 2024-06-01 01:59:30 +08:00
redkale
7e77183dad pom 2024-06-01 01:49:08 +08:00
redkale
9fe7069eed pom 2024-06-01 01:45:45 +08:00
redkale
ffd0ccdf21 pom 2024-06-01 01:36:48 +08:00
redkale
30df2c5b07 pom 2024-06-01 01:34:15 +08:00
redkale
db40973bea pom 2024-06-01 01:30:37 +08:00
redkale
a641485921 pom 2024-06-01 01:26:30 +08:00
redkale
7b571f630c pom 2024-06-01 01:19:52 +08:00
redkale
931b3f57a1 MAVEN_GPG_PASSPHRASE 2024-06-01 00:48:23 +08:00
redkale
080b3a77f3 pom 2024-06-01 00:36:25 +08:00
redkale
d56b9b7ac9 --pinentry-mode 2024-06-01 00:26:04 +08:00
redkale
244909db85 pom 2024-06-01 00:17:59 +08:00
redkale
98571c3779 pom 2024-06-01 00:17:13 +08:00
redkale
32234cd1dd pom 2024-06-01 00:13:50 +08:00
redkale
4608c34dc8 pom 2024-06-01 00:08:20 +08:00
redkale
fb4bbb1ce5 pom 2024-06-01 00:01:27 +08:00
redkale
5fe760c40b pom 2024-05-31 23:46:34 +08:00
redkale
80b0feb611 pom 2024-05-31 17:01:07 +08:00
redkale
825fad4109 pom 2024-05-31 16:45:17 +08:00
redkale
1226f0bd21 pom 2024-05-31 16:30:09 +08:00
redkale
3a837e4cf3 pom 2024-05-31 16:20:45 +08:00
redkale
8ea2415586 pom 2024-05-31 16:02:08 +08:00
redkale
14f4c81e75 pom 2024-05-31 15:27:46 +08:00
redkale
20f9ad40d3 pom 2024-05-31 09:00:58 +08:00
redkale
1cd58f4a01 pom 2024-05-31 08:58:05 +08:00
Redkale
e98cdd4028 Update maven_snapshot.yml 2024-05-31 08:34:35 +08:00
redkale
26308abc70 Merge branch 'main' of https://github.com/redkale/redkale 2024-05-31 08:23:36 +08:00
redkale
635e7111cf test 2024-05-31 08:23:23 +08:00
Redkale
54a8822bf8 Create maven_snapshot.yml 2024-05-31 08:17:52 +08:00
Redkale
b3514773ad Rename maven.yml to maven_check.yml 2024-05-31 08:16:31 +08:00
Redkale
c85188b026 Update maven.yml 2024-05-31 08:16:10 +08:00
redkale
220dff2802 Format 2024-05-30 20:37:31 +08:00
redkale
8cab0c78df Format 2024-05-30 20:35:40 +08:00
redkale
30236f9bbc CacheKeyGenerator 2024-05-30 20:24:44 +08:00
redkale
641efad649 优化CacheKeyGenerator 2024-05-30 15:39:33 +08:00
redkale
b5b8e5b59b CacheKeyGenerator 2024-05-30 15:37:50 +08:00
redkale
f556d9fe29 format 2024-05-30 15:31:16 +08:00
redkale
c94be39f02 增加CacheKeyGenerator功能 2024-05-30 15:21:01 +08:00
redkale
ec9a0bbaf0 @Cached.key与方法参数数的校验 2024-05-29 09:44:46 +08:00
redkale
bf6213aca1 BiFunctionConvertTest 2024-05-28 20:02:45 +08:00
redkale
249468c601 BiFunctionConvertTest 2024-05-28 19:58:59 +08:00
redkale
5f0b738264 BiFunctionConvertTest 2024-05-28 19:57:09 +08:00
redkale
5f9a06c1e4 BiFunctionConvertTest 2024-05-28 19:54:46 +08:00
redkale
5f5f246c2e BiFunctionConvertTest 2024-05-28 19:52:57 +08:00
redkale
c21801767f BiFunctionConvertTest 2024-05-28 19:50:35 +08:00
redkale
e5b7921860 FunctionConvertTest 2024-05-28 19:47:28 +08:00
redkale
54487a73c0 FunctionConvertTest 2024-05-28 19:41:05 +08:00
redkale
698591fe28 BiFuncConvertTest 2024-05-28 19:38:12 +08:00
Redkale
53e50bbd95 Update BiFunctionConvertTest.java 2024-05-28 19:05:08 +08:00
redkale
d665c89799 BiFunctionConvertTest 2024-05-28 19:01:14 +08:00
redkale
717fd0376b BiFunctionConvertTest 2024-05-28 18:50:52 +08:00
redkale
17889c2b33 BiFunctionConvertTest 2024-05-28 09:04:43 +08:00
redkale
284785841a BiFunctionConvertTest 2024-05-28 08:58:47 +08:00
redkale
54e8ab3b7e BiFunctionConvertTest 2024-05-28 08:34:44 +08:00
Redkale
09304c198c Update BiFunctionConvertTest.java 2024-05-28 08:27:52 +08:00
redkale
2209d6147e BiFunctionConvertTest 2024-05-28 08:24:01 +08:00
redkale
faea36a92b BiFunctionConvertTest 2024-05-28 08:19:45 +08:00
redkale
e9005637af BiFunctionConvertTest 2024-05-28 08:14:37 +08:00
redkale
65413baccd BiFunctionConvertTest 2024-05-28 08:05:58 +08:00
redkale
0ce73064f5 BiFunctionConvertTest 2024-05-27 21:06:08 +08:00
Redkale
6632846f10 Create maven.yml 2024-05-27 15:21:34 +08:00
Redkale
3cff00b5b8 Delete src/test/java/org/redkale/test/convert/BiFunctionConvertTest.java 2024-05-27 15:07:10 +08:00
redkale
f5479e13db Merge branch 'main' of http://github.com/redkale/redkale
# Conflicts:
#	src/test/java/org/redkale/test/convert/BiFunctionConvertTest.java
2024-05-27 15:05:58 +08:00
redkale
6cc6056e37 format 2024-05-27 15:04:23 +08:00
Redkale
a70cc585a9 Update BiFunctionConvertTest.java 2024-05-27 15:02:52 +08:00
redkale
626c2452d8 Merge branch 'main' of http://github.com/redkale/redkale 2024-05-27 14:59:18 +08:00
redkale
d27657b113 format 2024-05-27 14:58:44 +08:00
Redkale
36fd26264e Update pom.xml 2024-05-27 14:50:43 +08:00
Redkale
51656cbaa1 Update pom.xml 2024-05-27 14:47:59 +08:00
redkale
dc8ec75ada format 2024-05-27 14:47:25 +08:00
redkale
58685dacb2 format 2024-05-27 14:26:48 +08:00
redkale
10f9f57218 remove workflows 2024-05-27 14:17:38 +08:00
redkale
bb14060517 format 2024-05-27 14:05:27 +08:00
redkale
a77180a0ba Merge branch 'main' of http://github.com/redkale/redkale 2024-05-27 13:54:13 +08:00
redkale
d47ecacf1f format 2024-05-27 13:53:59 +08:00
redkale
5813e99f0c format 2024-05-27 13:39:32 +08:00
redkale
38b3bec2a8 pom 2024-05-27 13:10:54 +08:00
redkale
27bfda94a0 format 2024-05-27 13:02:25 +08:00
redkale
cbb224046c Merge branch 'main' of http://github.com/redkale/redkale 2024-05-27 12:53:07 +08:00
redkale
053cda1017 pom 2024-05-27 12:52:35 +08:00
redkale
5079560037 format 2024-05-27 12:19:58 +08:00
redkale
4d1eaa9766 check 2024-05-27 12:04:58 +08:00
redkale
41e6b5da7d apply 2024-05-27 12:01:31 +08:00
redkale
bcf74fbe71 format 2024-05-27 11:59:19 +08:00
redkale
f189803bb7 format 2024-05-27 11:54:36 +08:00
redkale
56c460e6c3 Merge branch 'main' of http://github.com/redkale/redkale 2024-05-27 11:52:13 +08:00
redkale
db048652cc format 2024-05-27 11:51:46 +08:00
Redkale
f71e824539 Update LoginBean.java 2024-05-27 11:48:21 +08:00
Redkale
dbc5ff378a Update LoginBean.java
format
2024-05-27 11:45:39 +08:00
redkale
7f05b61ad9 format 2024-05-27 11:43:19 +08:00
redkale
8147001f3f format 2024-05-27 11:40:04 +08:00
redkale
325639a49c lineEndings 2024-05-27 11:30:33 +08:00
redkale
38e31df6d7 pom 2024-05-27 10:56:11 +08:00
redkale
5722b25429 format 2024-05-27 08:57:43 +08:00
redkale
74421024ea format 2024-05-27 08:34:15 +08:00
redkale
6cea220256 Merge branch 'main' of http://github.com/redkale/redkale 2024-05-27 08:28:46 +08:00
redkale
3a4e41c531 format 2024-05-27 08:28:27 +08:00
Redkale
9cbb706302 Create maven.yml 2024-05-27 08:27:20 +08:00
redkale
ecc53303d1 pom check 2024-05-26 09:01:30 +08:00
redkale
aeeb7a3c72 Full Code Format 2024-05-26 08:26:36 +08:00
redkale
7230be701e MissingParamException 2024-05-25 08:03:13 +08:00
redkale
b5e7111e78 简单优化 2024-05-24 19:57:30 +08:00
redkale
05dd539f4f DataSqlMapper优化 2024-05-24 19:35:41 +08:00
redkale
b51259cb91 优化DataNativeSqlParser 2024-05-24 17:21:53 +08:00
redkale
4227a8a080 格式化 2024-05-24 12:33:49 +08:00
redkale
b4ded6f746 优化异常抛出 2024-05-24 12:00:27 +08:00
redkale
4f008796d7 优化注释 2024-05-24 11:21:03 +08:00
redkale
46e5130e08 优化DataNativeSqlParser 2024-05-24 11:15:51 +08:00
redkale
0f0c4eac6e 优化DataNativeJsqlParser 2024-05-24 08:00:27 +08:00
redkale
3331723aea 优化命名 2024-05-22 16:10:27 +08:00
redkale
95836a73cd source.parser优化 2024-05-22 11:37:42 +08:00
redkale
04a8c6f784 扩展PageBean参数接口 2024-04-01 11:38:16 +08:00
redkale
665b295a96 EntityBuilder支持下划线小写字段转化 2024-03-24 21:05:41 +08:00
redkale
07cdf26aaf Flipper优化 2024-03-05 12:24:33 +08:00
redkale
e0aac13710 isTableNotExist优化 2024-02-29 14:58:46 +08:00
redkale
6f21745537 优化isTableNotExist 2024-02-29 14:48:32 +08:00
redkale
49405c509b 优化ResourceTypeLoader 2024-02-29 14:29:08 +08:00
redkale
94bc2a512d ResourceAnnotationProvider改ResourceAnnotationLoader 2024-02-29 10:51:18 +08:00
redkale
2b6e44015b 优化JsonArray 2024-02-20 11:38:42 +08:00
redkale
f5c412c286 ResourceEntry 2024-02-06 10:31:39 +08:00
redkale
9fbce21de9 Messaged 2024-02-05 23:39:40 +08:00
redkale
dc7a481463 loadClassByFilters 2024-02-03 10:38:58 +08:00
redkale
dc57d62f34 优化ClassFilter 2024-02-03 09:50:36 +08:00
redkale
cd059c02a2 ResourceFactory优化 2024-02-01 08:54:58 +08:00
redkale
5ce226edd7 MultiHashKey 2024-01-30 23:15:06 +08:00
redkale
54d629155b Environment 2024-01-30 21:10:13 +08:00
redkale
c83aa7e8a8 MultiHashKey 2024-01-30 20:52:54 +08:00
redkale
f725e491f0 ClassDepends 2024-01-27 08:58:25 +08:00
redkale
3fdea1b1d8 DynClassDepends 2024-01-27 08:36:24 +08:00
redkale
75f645e9cf CacheClusterAgent 2024-01-26 23:49:05 +08:00
redkale
7bf75b69cd ClusterAgent 2024-01-26 23:23:26 +08:00
redkale
c94c34e6a8 doc 2024-01-26 15:56:10 +08:00
redkale
258fa43bba DataJdbcSource 2024-01-26 11:03:12 +08:00
redkale
0ef0ebabd2 WebRequest 2024-01-25 14:46:40 +08:00
redkale
4cd6d85bc1 WebRequest 2024-01-25 10:25:41 +08:00
redkale
16a1e25f42 format 2024-01-24 21:33:26 +08:00
redkale
84e4a24ff5 格式化 2024-01-24 20:23:40 +08:00
redkale
99a217cef6 src 2024-01-24 15:18:09 +08:00
redkale
97d517abd9 Scheduled 2024-01-24 10:24:35 +08:00
redkale
b326e6ea6f app 2024-01-24 08:36:49 +08:00
redkale
ddfdf68c83 threads 2024-01-23 23:42:37 +08:00
redkale
07e9ad4a21 Rest 2024-01-23 23:21:47 +08:00
redkale
2d80646cc4 doc 2024-01-23 23:09:57 +08:00
redkale
cd39b484f5 增加ColumnValues 2024-01-23 23:00:33 +08:00
redkale
1c19b70ae9 createUDPClient 2024-01-22 22:40:11 +08:00
redkale
257b406d73 timeout 2024-01-22 22:37:47 +08:00
redkale
70fe0fde1e format 2024-01-20 23:51:15 +08:00
redkale
470e636e55 doc 2024-01-20 23:07:12 +08:00
redkale
436853dd03 格式化 2024-01-20 22:24:27 +08:00
redkale
f9994b33af CacheSource 2024-01-20 14:25:08 +08:00
redkale
47584f3106 CacheSource增加rateLimit接口 2024-01-20 12:40:26 +08:00
redkale
ef985e2aef HttpResponse 2024-01-19 15:59:31 +08:00
redkale
4f34f1fd2e http 2024-01-18 22:44:41 +08:00
redkale
c633d1c0e8 youhua 2024-01-18 15:08:49 +08:00
redkale
e347a43738 格式化 2024-01-18 11:26:49 +08:00
redkale
636927e4eb 代码格式化 2024-01-17 22:57:23 +08:00
redkale
49f03f9701 youhua 2024-01-17 12:23:08 +08:00
redkale
93d7277bfe 优化非实现类的Service加载 2024-01-15 22:47:00 +08:00
redkale
4b7b140c7b Inherited 2024-01-15 10:00:13 +08:00
redkale
b17716780a Index 2024-01-14 21:53:43 +08:00
redkale
2992250745 CacheSource增加delex方法 2024-01-14 20:47:31 +08:00
redkale
ef802bb1ce EntityBuilder 2024-01-12 14:34:18 +08:00
redkale
076c260793 DataNativeSqlInfo 2024-01-11 21:42:44 +08:00
redkale
7162116ae3 Param 2024-01-11 09:28:30 +08:00
redkale
5ea5869897 DataSqlMapperBuilder 2024-01-10 23:44:34 +08:00
redkale
fb2cf4e5e3 DataSqlMapper 2024-01-10 20:42:28 +08:00
redkale
7d327e7864 DataSqlMapperBuilder 2024-01-09 23:39:06 +08:00
redkale
ce630ee253 sql 2024-01-09 23:22:12 +08:00
redkale
4de3d3f505 DataSqlMapper 2024-01-09 15:06:22 +08:00
redkale
6c331f733b DataSqlMapper 2024-01-09 14:39:27 +08:00
redkale
853f501ffd 定义DataSqlMapper 2024-01-09 13:31:16 +08:00
redkale
6b877e8136 DataResultSet 2024-01-08 22:48:39 +08:00
redkale
8c5b8b0a70 EntityBuilder优化 2024-01-06 21:37:23 +08:00
redkale
a7f1ef2c3b AbstractDataSqlSource 2024-01-06 19:58:16 +08:00
redkale
a34bc80f19 FilterNode优化 2024-01-06 19:10:57 +08:00
redkale
267a17858f FilterNode优化 2024-01-06 18:53:02 +08:00
redkale
81340be2e1 DistributeTableStrategy增加getSource接口,待实现 2024-01-06 12:19:16 +08:00
redkale
87f46d2785 source加载优化 2024-01-05 23:24:57 +08:00
redkale
503c2c6f72 DispatcherServlet 2024-01-04 22:23:16 +08:00
redkale
6348aa884f 可定制DispatcherServlet 2024-01-04 18:34:02 +08:00
redkale
0435cc4e48 ScheduleManagerService 2024-01-04 10:06:52 +08:00
redkale
1e715285fa doc 2024-01-04 09:57:45 +08:00
redkale
f3707a3499 HttpServer 2024-01-04 08:43:36 +08:00
redkale
552d1ac872 ScheduleManager优化 2024-01-04 02:33:32 +08:00
redkale
6078c9a686 优化HttpServer 2024-01-04 02:11:04 +08:00
redkale
564eadec11 Scheduled 2024-01-03 17:19:49 +08:00
redkale
d6b9df4109 AbstractDataSqlSource 2024-01-03 10:12:06 +08:00
redkale
95539580a7 ScheduleManager优化 2024-01-02 16:23:12 +08:00
redkale
34a03b0e26 ScheduleManager优化 2024-01-02 15:48:26 +08:00
redkale
cad219d7e1 doc 2023-12-30 10:52:28 +08:00
redkale
4a383a9dc1 doc 2023-12-30 10:48:09 +08:00
redkale
5ee14bc859 doc 2023-12-30 10:05:05 +08:00
redkale
e6f22a1f18 doc 2023-12-30 08:53:49 +08:00
redkale
fe6a5dd91c doc 2023-12-29 23:19:10 +08:00
redkale
263aa86211 doc 2023-12-29 14:45:39 +08:00
redkale
718dfc6fd1 doc 2023-12-29 14:39:12 +08:00
redkale
372f96b3a9 HttpHeaders优化 2023-12-29 12:54:57 +08:00
redkale
af3079377f HttpHeaders优化 2023-12-29 12:38:29 +08:00
redkale
62042d3aaa doc 2023-12-29 12:05:42 +08:00
redkale
ce94610a72 doc 2023-12-29 12:01:34 +08:00
redkale
7648f0cdc8 doc 2023-12-29 12:00:32 +08:00
redkale
a4f8519bcf doc 2023-12-29 11:52:17 +08:00
redkale
6cade6a1da group增加nodes属性 2023-12-29 11:31:04 +08:00
redkale
fc420221cf doc 2023-12-29 11:19:17 +08:00
redkale
be202cef6a 远程模式依赖注入 2023-12-29 10:54:34 +08:00
redkale
06a1d5d1bb DataSource接口扩展 2023-12-29 10:04:30 +08:00
redkale
79a310181c CacheSource增加pttl等接口 2023-12-29 08:47:30 +08:00
redkale
46d2629fca 修复nodeid溢出问题 2023-12-28 19:41:21 +08:00
redkale
83dd4da4ec CacheManager优化 2023-12-27 14:40:05 +08:00
redkale
fb321c58a7 CacheSource 2023-12-27 11:04:02 +08:00
redkale
0840f04847 CacheSource 2023-12-27 10:21:24 +08:00
redkale
8a19914a07 CacheSource增加setnxpx接口 2023-12-27 09:36:27 +08:00
redkale
dc1dc42bef checkNodeid 2023-12-26 19:14:26 +08:00
redkale
9c64cde003 doc 2023-12-26 18:41:12 +08:00
redkale
1d80041c16 Application.nodeid改为string类型 2023-12-26 18:36:03 +08:00
redkale
fb9bdd22c4 CacheManager 2023-12-26 17:10:10 +08:00
redkale
f552c657b6 doc 2023-12-26 15:07:52 +08:00
redkale
0c10e928fc doc 2023-12-26 15:04:41 +08:00
redkale
58bd2b08a4 CacheManager 2023-12-26 14:45:43 +08:00
redkale
fd3e33d836 spi 2023-12-26 11:04:23 +08:00
redkale
cac8da9b4d 注释 2023-12-26 09:47:07 +08:00
redkale
c57a32143b 增加LoadMode功能 2023-12-26 09:24:58 +08:00
redkale
6db029263c MessageAsmMethodBoost 2023-12-26 00:16:45 +08:00
redkale
498b2ff70f BootModule 2023-12-25 19:09:13 +08:00
redkale
710f8fc632 cluster 2023-12-25 12:37:58 +08:00
redkale
0c18e29aaf CacheSource 2023-12-25 12:25:20 +08:00
redkale
08f679c422 Sncp.remote优化 2023-12-25 12:05:28 +08:00
redkale
0578fa3ca5 Sncp remote支持字段名 2023-12-25 10:44:54 +08:00
redkale
7ef195f49e AsmMethodBoost优化 2023-12-25 08:51:15 +08:00
redkale
a5fc08a821 DynForMessage 2023-12-24 22:42:34 +08:00
redkale
88392fd5dd Messaged 2023-12-24 21:08:57 +08:00
redkale
ae03bdecad DEFAULT_HASH 2023-12-24 09:18:58 +08:00
redkale
240b2b226b messageManager 2023-12-24 08:40:54 +08:00
redkale
b52090d1f2 mq.spi 2023-12-24 08:32:24 +08:00
redkale
7664edb9a1 doc 2023-12-23 22:18:17 +08:00
redkale
5a156467d7 java 2023-12-23 15:36:01 +08:00
redkale
5951b1b9cb logo 2023-12-23 15:32:36 +08:00
redkale
29bf353e40 logo 2023-12-23 15:29:19 +08:00
redkale
69014e83c5 文档更新 2023-12-23 15:23:46 +08:00
redkale
25881ff06a 文档更新 2023-12-23 15:23:22 +08:00
redkale
d6e82eb8c1 文档更新 2023-12-23 15:20:09 +08:00
Redkale
2cc67af409 Update README.md 2023-12-23 11:46:43 +08:00
redkale
88c20f798f CacheSource增加msetnx接口 2023-12-22 14:54:49 +08:00
redkale
ce36250e60 Scheduled 2023-12-22 14:15:00 +08:00
redkale
ec26e3c9f7 CacheAsmMethodBoost 2023-12-22 00:00:31 +08:00
redkale
cfbf4bbe85 ThrowSupplier 2023-12-21 19:52:15 +08:00
redkale
95b08e1db0 AsmMethodParam 2023-12-21 15:30:21 +08:00
redkale
382ad87c5f CacheAction 2023-12-21 14:44:52 +08:00
redkale
bbddb31752 DataSource 2023-12-21 13:48:13 +08:00
redkale
81da17ddd4 修复EntityCache复制反了的bug 2023-12-21 13:25:32 +08:00
redkale
e5a3c4c102 HttpResourceServlet 2023-12-21 12:25:51 +08:00
redkale
63c3326265 CacheManager 2023-12-21 10:32:33 +08:00
redkale
cda78cfc7d MultiHashKey 2023-12-21 10:20:05 +08:00
redkale
f9ec08adea CombinedKey 2023-12-21 07:54:30 +08:00
redkale
50607df3ef CacheAction 2023-12-21 00:10:02 +08:00
redkale
00ead74204 CacheAsmMethodBoost优化 2023-12-20 20:29:16 +08:00
redkale
3fba0a3eeb AsmMethodBoost 2023-12-20 20:22:39 +08:00
redkale
ebaf4ebe16 asm 2023-12-20 18:52:41 +08:00
redkale
ff7ed50e82 DynForCache 2023-12-20 18:13:39 +08:00
redkale
0c1e34c2cc lock 2023-12-20 17:19:43 +08:00
redkale
5d9bd3018a AsmMethodBean 2023-12-20 15:27:19 +08:00
redkale
ef5349098d CacheDyn 2023-12-20 12:04:08 +08:00
redkale
4ddf2dbe86 AsmMethodBoost优化 2023-12-19 22:57:56 +08:00
redkale
7a37df319c 优化schedule 2023-12-19 22:23:43 +08:00
redkale
e8eea11ca6 修复Application空指针问题 2023-12-19 17:10:10 +08:00
redkale
8e413db8d1 ScheduleEvent 2023-12-19 16:48:37 +08:00
redkale
ec48417e20 AsmMethodBoost接口 2023-12-19 14:58:41 +08:00
redkale
9942a194a6 优化 2023-12-19 10:49:25 +08:00
redkale
70aac955c6 spi 2023-12-19 10:13:14 +08:00
redkale
24a043195a 增加ResourceInjected功能 2023-12-19 09:53:46 +08:00
redkale
d3a6f46c6c spi 2023-12-19 00:07:40 +08:00
redkale
1a49db8a1b 优化包名 2023-12-19 00:02:09 +08:00
redkale
d971fe94ee proto 2023-12-18 23:53:30 +08:00
redkale
fc228964fd ResourceFactory迁移到inject包 2023-12-18 23:42:18 +08:00
redkale
7e45b458e9 优化 2023-12-18 17:07:16 +08:00
redkale
eb7c44de18 Application优化 2023-12-18 17:00:39 +08:00
redkale
6cb0a05720 优化 2023-12-15 22:55:27 +08:00
redkale
387f1688f4 优化 2023-12-15 22:40:19 +08:00
redkale
eec8939461 AnyValueWriter 2023-12-15 22:10:19 +08:00
redkale
feb063a4ed PropertiesAgent 2023-12-15 12:45:50 +08:00
redkale
56d0ad2711 优化 2023-12-14 23:18:52 +08:00
redkale
9b641edc11 ModuleEngine大优化 2023-12-14 23:08:57 +08:00
redkale
398b7b76a5 copier 2023-12-13 15:22:45 +08:00
redkale
a357c9f20e 格式化 2023-12-13 13:07:06 +08:00
redkale
680a12d83b CacheManager 2023-12-13 11:26:44 +08:00
redkale
9df80032a7 CacheManager支持nullable 2023-12-13 08:52:38 +08:00
redkale
8ef27add1c Copier兼容不是void返回类型的setter方法 2023-12-12 21:43:39 +08:00
redkale
8ab6b6e955 CacheManager 2023-12-12 16:38:15 +08:00
redkale
08d667d4d1 CacheManager优化 2023-12-12 14:44:43 +08:00
redkale
8698d12d1f CacheManager 2023-12-12 00:31:43 +08:00
redkale
618a42c5df localGet 2023-12-11 23:41:57 +08:00
redkale
f7e3f7d7ec 优化 2023-12-11 22:18:17 +08:00
redkale
a2f6578503 优化 2023-12-11 22:00:10 +08:00
redkale
53f029052b support 2023-12-11 20:15:49 +08:00
redkale
ce5125db9c CacheManagerService 2023-12-11 18:34:03 +08:00
redkale
d6b9402ce0 ScheduleEngine 2023-12-11 18:24:15 +08:00
redkale
8780365e17 CacheManager 2023-12-11 16:33:57 +08:00
redkale
c008dfdfd7 CacheExpire 2023-12-11 16:30:27 +08:00
redkale
2ee787f08b CacheManagerService优化 2023-12-11 16:19:33 +08:00
redkale
71a7e7e7f6 CacheManager 2023-12-11 15:18:51 +08:00
redkale
bd088ab9ec CacheMemorySource优化 2023-12-11 14:45:35 +08:00
redkale
8e51f99c7a CacheManager 2023-12-11 10:55:03 +08:00
redkale
d589eef853 trace 2023-12-10 17:18:07 +08:00
redkale
5b6c978620 CacheEntry 2023-12-09 19:05:29 +08:00
redkale
7dc6dc6a6d //TODO 2023-12-09 11:21:40 +08:00
redkale
23cfbf6f1e 优化命名 2023-12-09 11:19:11 +08:00
redkale
d06406c200 Caching 2023-12-09 11:16:18 +08:00
redkale
6d9f2ec6be Cacheing 2023-12-09 11:12:33 +08:00
redkale
c2f66b61ec CachedFactory 2023-12-09 11:00:53 +08:00
redkale
86cfeafd8d cacheing 2023-12-09 10:51:18 +08:00
redkale
e7a7461d9d CacheMemorySource优化 2023-12-08 10:01:05 +08:00
redkale
6615326edb EntityCache优化 2023-12-07 22:06:37 +08:00
redkale
64c3a2c4bd 废弃Cacheable类 2023-12-07 21:59:51 +08:00
redkale
8f6098834f ScheduledFactory优化 2023-12-07 15:45:02 +08:00
redkale
e204b60ac4 注释 2023-12-07 15:26:08 +08:00
redkale
0177599442 Resource的#改成@ 2023-12-07 15:18:08 +08:00
redkale
9f0a2b99b7 Scheduled优化 2023-12-07 15:08:19 +08:00
redkale
42a1229f1f Scheduled优化 2023-12-07 14:48:54 +08:00
redkale
cdcc42c90a CronExpression 2023-12-07 14:35:40 +08:00
redkale
875d335cc9 注释 2023-12-07 14:00:07 +08:00
redkale
989153815f 优化client 2023-12-06 21:35:02 +08:00
redkale
b3ea041b67 优化timeout 2023-12-06 21:03:43 +08:00
redkale
54f9b68b3d 单元测试用例 2023-12-05 17:44:18 +08:00
redkale
a0da13bc4f 增加定时任务功能 2023-12-05 16:59:13 +08:00
redkale
dbd4a79589 VertxSqlDataSource优化 2023-12-04 21:05:42 +08:00
redkale
158ff3b961 EntityInfo优化 2023-12-04 15:30:29 +08:00
redkale
c62b55fea4 DataJdbcSource优化 2023-12-04 12:10:54 +08:00
redkale
aeafac22b0 DataJdbcSource优化 2023-12-04 11:22:01 +08:00
redkale
225460f522 DataJdbcSource优化 2023-12-04 09:14:24 +08:00
redkale
7522e79f7d DataJdbcSource优化 2023-12-03 22:52:19 +08:00
redkale
ed8719c27b FilterJoinType增加 2023-12-02 11:12:02 +08:00
redkale
31c6ffdd17 client优化 2023-12-02 09:00:19 +08:00
redkale
0085493b3f 变更ne方法 2023-12-01 16:15:53 +08:00
redkale
c234663f87 ClientAddress优化 2023-12-01 08:40:30 +08:00
redkale
061fecf7b4 下划线字段名自动转换驼峰 2023-11-30 21:43:02 +08:00
redkale
609242bce8 DataSources 2023-11-30 18:12:15 +08:00
redkale
916f0eb793 DataSources优化 2023-11-30 18:08:34 +08:00
redkale
9dff5967fb 优化 2023-11-30 16:53:38 +08:00
redkale
c25001c5e4 HttpSimpleClient优化 2023-11-30 15:40:09 +08:00
redkale
f0e53d4a8e 优化client 2023-11-29 23:20:57 +08:00
redkale
a4b277e875 优化ProtocolCodec的续读功能 2023-11-29 22:59:13 +08:00
redkale
ba788eec9c 优化Client 2023-11-29 22:22:08 +08:00
redkale
fa575da721 DataJdbcSource优化 2023-11-28 22:02:02 +08:00
redkale
ad58cb76aa DataNativeSqlParser优化 2023-11-28 13:56:22 +08:00
redkale
b574313e61 jsqlparser升级到4.7 2023-11-28 12:10:28 +08:00
redkale
c3862297b1 加强注释 2023-11-28 10:28:36 +08:00
redkale
e192d37bf0 HttpSimpleClient优化 2023-11-27 22:50:09 +08:00
redkale
252a45fbb4 HttpSimpleClient优化 2023-11-27 19:21:58 +08:00
redkale
90e813a06c DataJdbcSource 2023-11-25 21:52:05 +08:00
redkale
0a93ccb818 DataJdbcSource优化 2023-11-24 22:44:19 +08:00
redkale
05e3046af8 HttpRequest.path优化 2023-11-23 15:14:07 +08:00
redkale
0bb91186a8 HttpSimpleRequest优化 2023-11-22 10:33:20 +08:00
redkale
7433530998 RestURI更名RestPath 2023-11-21 18:02:34 +08:00
redkale
aefd10c029 asm 2023-11-21 14:30:36 +08:00
redkale
b1b58da3ec npe 2023-11-20 22:40:06 +08:00
redkale
5be0cb5d2e 修复set方法 2023-11-20 22:13:30 +08:00
redkale
19d2bab0d1 代码格式优化 2023-11-20 21:44:59 +08:00
redkale
aecbf0fb26 json 2023-11-20 19:05:45 +08:00
redkale
4a8c3a58f7 增加HttpParameters 2023-11-20 18:56:40 +08:00
redkale
2223845ab3 HttpHeaders 2023-11-20 18:19:52 +08:00
redkale
753d8b020a 增加HttpHeader 2023-11-20 18:17:48 +08:00
redkale
ae91e47a73 优化javadoc 2023-11-18 11:52:55 +08:00
redkale
930f0781b8 ColumnValue优化 2023-11-18 11:28:49 +08:00
redkale
8f913dff0b 增加ColumnNodes 2023-11-18 08:52:08 +08:00
redkale
c82f454e42 增加DataJdbcConnection功能 2023-11-17 23:22:28 +08:00
redkale
1ee5d79866 删除注释 2023-11-17 23:05:09 +08:00
redkale
02b24953ea ColumnNode 2023-11-17 23:03:13 +08:00
redkale
b29dedbb79 增加ColumnXXXNode功能 2023-11-17 22:57:21 +08:00
redkale
36c68df5ff ColumnNodeValue更名为ColumnExpNode 2023-11-17 20:54:18 +08:00
redkale
ea13e89146 ClientCodec修复runWork逻辑 2023-11-17 20:10:08 +08:00
redkale
044e6c8b7a ClientCodec优化 2023-11-17 19:35:15 +08:00
redkale
b256db65d4 ClusterAgent优化 2023-11-16 13:16:42 +08:00
redkale
e44afc9208 FilterKey更名为FilterColValue 2023-11-16 09:41:06 +08:00
redkale
af45c451a3 sonar优化 2023-11-13 11:48:51 +08:00
redkale
ea91894cec 修正javadoc 2023-11-13 11:12:29 +08:00
redkale
c9386a445b sonar优化 2023-11-13 10:57:08 +08:00
redkale
73411593b2 移除excludelibs 2023-11-12 21:35:37 +08:00
redkale
d1a318f8ed 移除excludelibs配置功能 2023-11-12 21:27:27 +08:00
redkale
cfcc229000 移除jctools复制过来的的三个类 2023-11-12 20:03:02 +08:00
redkale
5e25bc623c 注释优化 2023-11-12 19:59:01 +08:00
redkale
cb2abab70c queryAddress优化 2023-11-11 12:34:15 +08:00
redkale
fdfa70c765 增加Times 2023-11-11 11:00:23 +08:00
redkale
2f80bbf379 MessageCoder优化 2023-11-11 08:50:34 +08:00
redkale
0391304024 优化命名 2023-11-10 22:42:40 +08:00
redkale
03152e4e6a 更换rpconly和automapping大小写 2023-11-10 22:31:52 +08:00
redkale
553622cfec 加强注释 2023-11-10 22:01:20 +08:00
redkale
3eb357055f FilterJoinNode优化 2023-11-10 14:38:17 +08:00
redkale
25398327c7 FilterNode优化 2023-11-10 13:58:12 +08:00
redkale
700ef231df FilterNode优化 2023-11-10 13:44:56 +08:00
redkale
b5a21838d2 优化注释 2023-11-09 08:47:55 +08:00
redkale
602647891c HttpRequest 2023-11-07 23:51:03 +08:00
redkale
ff4c34fe33 HttpSimpleRequest优化 2023-11-07 23:38:12 +08:00
redkale
7f8d6f96f1 优化Rest 2023-11-07 23:27:52 +08:00
redkale
8cbdcca40f sonar优化 2023-11-07 11:09:52 +08:00
redkale
c065f693a9 增加AnonymousThreadFactory功能 2023-10-26 15:18:59 +08:00
redkale
d78f2df9a8 HttpSimpleRequest优化 2023-10-25 08:13:49 +08:00
redkale
ce164d3047 keepAlive 2023-10-23 23:09:50 +08:00
redkale
bd9b04ce0b 增加ClientResult功能 2023-10-23 23:00:03 +08:00
redkale
2304e115da produceMessage加返回值 2023-10-23 15:27:21 +08:00
redkale
073568d6ac Utility优化 2023-10-22 21:29:44 +08:00
redkale
8ed6d18190 Utility 2023-10-22 09:14:16 +08:00
redkale
f04d55adab 优化httpclient 2023-10-21 17:28:01 +08:00
redkale
960e4ff358 注释 2023-10-21 15:51:12 +08:00
redkale
b3c1b156ee AnonymousVirtualExecutor优化 2023-10-21 15:04:37 +08:00
redkale
9dd3128a65 优化client 2023-10-21 14:27:23 +08:00
redkale
cb3cb00e2b 优化client 2023-10-21 08:04:53 +08:00
redkale
da81509157 优化traceid 2023-10-21 00:18:22 +08:00
redkale
48a4c60737 HttpResponse 2023-10-20 17:02:22 +08:00
redkale
2019c0ce3c trace完善 2023-10-20 16:08:51 +08:00
redkale
09596e9b4b 优化traceid 2023-10-20 15:40:16 +08:00
redkale
482a3313c4 traceid 2023-10-20 14:54:41 +08:00
redkale
fa8225fb1b 优化trace 2023-10-20 11:52:43 +08:00
redkale
ca93aceafc AsyncConnection写异常时需要终结 2023-10-20 08:17:12 +08:00
redkale
3d8dcc0026 sncp优化 2023-10-19 08:26:58 +08:00
redkale
8cba160af8 Response.finishError 2023-10-18 15:29:56 +08:00
redkale
d743d7e90d AnonymousVirtualExecutor 2023-10-18 08:37:00 +08:00
redkale
cde5b80c2d HttpSimpleClient 2023-10-17 21:37:58 +08:00
redkale
3b5010c0a7 HttpSimpleClient 2023-10-17 21:28:02 +08:00
redkale
cc6624bfdc 优化cluster 2023-10-17 18:40:34 +08:00
redkale
0e30db3463 CacheSource 2023-10-17 16:22:50 +08:00
redkale
bda65b483e 修复sncpAsyncGroup未启动的bug 2023-10-17 15:10:23 +08:00
redkale
2155c58989 MessageAgent增加rpcFirst配置 2023-10-17 10:20:06 +08:00
redkale
c3928fdc2b DataJdbcSource 2023-10-17 09:26:31 +08:00
redkale
8c625e93c7 修复bson问题 2023-10-16 20:07:30 +08:00
redkale
c4b91ebbc6 优化日志 2023-10-16 16:42:13 +08:00
redkale
6d63798ccf isVirtualWorkExecutor 2023-10-16 15:02:20 +08:00
redkale
a32586bf3b AbstractDataSource 2023-10-16 11:21:13 +08:00
redkale
b1f91d3b8a javadoc注释 2023-10-16 10:29:33 +08:00
redkale
89b0a06e51 修复DataJdbcSource事务问题 2023-10-16 10:10:43 +08:00
redkale
c5acc25dec 简化过滤类的正则 2023-10-15 08:41:54 +08:00
redkale
59ccb0fe6a BoolRef增加 2023-10-14 19:47:53 +08:00
redkale
007db8d508 优化提示 2023-10-14 16:14:32 +08:00
redkale
17fbb29957 mq 2023-10-14 15:29:38 +08:00
redkale
c2e3636062 日志 2023-10-14 10:04:40 +08:00
redkale
8ed540890b 优化 2023-10-14 09:19:08 +08:00
redkale
48c1263ea1 优化mq 2023-10-14 08:13:25 +08:00
redkale
bad571aecb 非空 2023-10-13 22:06:47 +08:00
redkale
98ff3cdfcf 重构mq 2023-10-13 21:37:41 +08:00
redkale
5936ec1986 shutdownNow 2023-10-12 20:08:11 +08:00
redkale
2dd2f6c38e 优化 2023-10-11 22:42:42 +08:00
redkale
c783c1ef31 修复HttpMessageResponse 2023-10-11 20:55:29 +08:00
redkale
52d7a7a3f7 优化 2023-10-11 13:52:32 +08:00
redkale
a5e3a277ba getParameterizedType 2023-10-10 15:48:05 +08:00
redkale
71a0a69bd3 优化getGenericType 2023-10-10 00:09:58 +08:00
redkale
404e1b8eee 优化 2023-10-09 22:05:57 +08:00
redkale
2fd56afe2a 简化 2023-10-09 12:45:40 +08:00
redkale
bf4920de93 修复currentUserid类型为String会报错的bug 2023-10-09 12:22:10 +08:00
redkale
c66aafe7fe WebSocket 2023-10-09 09:28:21 +08:00
redkale
c58c603e6d getSuperclass 2023-10-08 22:26:01 +08:00
redkale
1fa17bf10c mq 2023-10-08 12:11:49 +08:00
redkale
33e751a44c mq 2023-10-07 23:42:52 +08:00
redkale
fc574a31ff text 2023-10-07 23:16:08 +08:00
redkale
0d406530eb textPayload 2023-10-07 23:09:36 +08:00
redkale
26795ece3f 优化 2023-10-07 22:53:04 +08:00
redkale
341309e7ae 优化mq 2023-10-07 15:43:32 +08:00
redkale
89ff54a15e cluster 2023-10-07 08:45:28 +08:00
redkale
4351b74a91 cluster 2023-10-06 22:13:42 +08:00
redkale
2e060cba45 优化cluster 2023-10-06 18:04:42 +08:00
redkale
690acf286c 优化 2023-10-06 12:15:05 +08:00
redkale
d5e193d0a8 serviceType 2023-10-06 10:08:29 +08:00
redkale
d961a4283b mq兼容name='' 2023-10-06 09:19:19 +08:00
redkale
361e5a8500 RedkaleException 2023-10-06 09:04:31 +08:00
redkale
001c51c8fe getPropertyValue 2023-10-06 08:35:40 +08:00
redkale
8954c63285 移除MessageMultiConsumer功能 2023-10-06 05:36:03 +08:00
redkale
c7e06ed519 MessageConsumer 2023-10-05 22:51:12 +08:00
redkale
da1de47927 mq 2023-10-05 22:41:01 +08:00
redkale
61e2cc16ad 优化 2023-10-05 21:53:40 +08:00
redkale
a71544a78d 优化group 2023-10-05 21:22:06 +08:00
redkale
b8d5800434 ResourceProducer增加required属性 2023-10-05 20:22:43 +08:00
redkale
e280061dff 优化MessageConsumer 2023-10-05 19:47:40 +08:00
redkale
f4b4609acc 增加AnonymousThreadLocal 2023-10-02 12:53:52 +08:00
redkale
87f260d25a 默认线程池大小 2023-10-01 07:01:38 +08:00
redkale
dbf4c2e8ca 优化mq 2023-09-30 09:12:38 +08:00
redkale
1eb153f51f update 2023-09-25 14:30:27 +08:00
redkale
1c7bcdebc7 diect 2023-09-22 23:29:55 +08:00
redkale
e41af85715 移除continuousid功能 2023-09-22 23:16:51 +08:00
redkale
f97f17bceb 更新 2023-09-21 23:09:06 +08:00
redkale
19db4fdae9 优化client 2023-09-21 22:36:19 +08:00
redkale
8b65320491 优化native-image 2023-09-21 19:41:16 +08:00
redkale
e60e869fe9 优化Copier 2023-09-21 17:25:36 +08:00
redkale
915583d915 sequent 2023-09-21 15:06:25 +08:00
redkale
eab480f0be 新增MessageConext 2023-09-20 19:57:42 +08:00
redkale
2939556800 临时 2023-09-18 00:03:56 +08:00
redkale
df0c4489db javadoc 2023-09-17 23:47:04 +08:00
redkale
bca85e7e5f 优化MessageProducer 2023-09-17 23:42:56 +08:00
redkale
d748ca1bde write 2023-09-16 22:41:56 +08:00
redkale
164ec113cd 移除ConvertMask功能 2023-09-16 22:11:19 +08:00
redkale
39eea4be5a module-info 2023-09-16 14:51:25 +08:00
redkale
94121da0f3 增加ProtobufConvert 2023-09-16 14:44:52 +08:00
redkale
b2b8c0de2d Creator 2023-09-15 14:52:52 +08:00
redkale
c1414de552 JsonElement 2023-09-14 23:20:24 +08:00
redkale
fc1487bda4 修正常量名错误单词 2023-09-14 15:52:31 +08:00
redkale
ddfabc0010 CacheScoredValue 2023-09-12 08:21:15 +08:00
redkale
42bf6ec73b 优化DeParser 2023-09-09 22:39:43 +08:00
redkale
30213e9b0b CacheMemorySource 2023-09-08 13:12:22 +08:00
redkale
4c3f919238 增加ClientMessageListener功能 2023-09-08 13:09:02 +08:00
redkale
ddd3d33edc Client增加newConnection 2023-09-07 17:07:54 +08:00
redkale
388505c899 CacheMemorySource 2023-09-07 16:40:52 +08:00
redkale
da41c7f7fa 优化CacheSource 2023-09-07 15:20:44 +08:00
redkale
8af945d8c2 优化DeParser 2023-09-05 06:59:39 +08:00
redkale
b599dc9acb CacheMemorySource优化 2023-09-03 21:25:06 +08:00
redkale
55d26693bc unsubscribeAsync 2023-09-02 12:28:38 +08:00
redkale
95499542a4 RestLocale 2023-09-01 08:26:48 +08:00
redkale
651be0c50d 优化Writer 2023-09-01 07:45:14 +08:00
redkale
79ee417ae6 优化ConvertFactory.features 2023-09-01 07:38:03 +08:00
redkale
707ad2da70 convert优化features 2023-08-31 22:30:55 +08:00
redkale
3979af71cb AsyncNioConnection 2023-08-30 08:36:43 +08:00
redkale
58620ac519 AsyncNioConnection 2023-08-30 08:31:30 +08:00
redkale
d326750222 优化fastWrite 2023-08-30 00:10:32 +08:00
redkale
8db24bdcd6 DataNativeSqlParser增加loadFirst方法 2023-08-24 22:20:11 +08:00
redkale
41daf2ede5 Attribute 2023-08-22 23:44:23 +08:00
redkale
2caf609a2e 增加LambdaBiConsumer 2023-08-22 23:38:49 +08:00
redkale
1a95fb3d3a Inners 2023-08-22 23:07:18 +08:00
redkale
24188de9e0 DataNativeSqlParser 2023-08-20 20:14:04 +08:00
redkale
4bfe4278f3 Copier 2023-08-19 09:01:09 +08:00
redkale
061575bb94 DataNativeSqlParser支持#{},${} 2023-08-17 11:48:42 +08:00
redkale
00a37fb263 增加nativeQuerySheet方法 2023-08-16 15:45:15 +08:00
redkale
8130eea859 javadoc 2023-08-16 12:01:21 +08:00
redkale
3c33c2ecbb DataSqlSource优化 2023-08-16 11:20:20 +08:00
redkale
317f1ffbb8 DataNativeSqlParser优化 2023-08-14 15:16:40 +08:00
redkale
87892b27e7 增加AsmDepends 2023-08-13 22:27:11 +08:00
redkale
5ed7bc2c6f Invoker 2023-08-13 22:10:04 +08:00
redkale
1d52cc5acf 修复StringWrapper序列化json问题 2023-08-12 22:05:20 +08:00
redkale
eb1c0e1513 优化util 2023-08-12 18:50:22 +08:00
redkale
e729f04917 Creator优化 2023-08-12 14:05:27 +08:00
redkale
a6de4df777 Copier优化 2023-08-12 09:28:05 +08:00
redkale
509e81888c Copier 2023-08-11 23:22:22 +08:00
redkale
c0e2295c1c func 2023-08-11 22:42:59 +08:00
redkale
56cf1d0873 Copier兼容src==null 2023-08-11 22:39:33 +08:00
redkale
0b5c74b458 Copier增加Function方法 2023-08-11 22:14:06 +08:00
redkale
e8e9b46206 Copier增加OPTION_ALLOW_TYPE_CAST配置项 2023-08-11 16:11:29 +08:00
redkale
52a1fa9f3a Copier优化 2023-08-10 15:30:14 +08:00
redkale
e5d31344b9 DataNativeSqlParser 2023-08-10 00:08:09 +08:00
redkale
302259e30d 增加DataNativeSqlParser功能 2023-08-09 23:54:39 +08:00
redkale
398071a272 修复HttpRequest.readHeader问题 2023-08-07 18:45:43 +08:00
redkale
7fa66930a4 修复空指针问题 2023-08-07 17:57:24 +08:00
redkale
3e2a8c932e 修复Resource.name使用$的问题 2023-08-07 17:48:20 +08:00
redkale
357962ec97 Reproduce作废过期 2023-08-07 12:51:45 +08:00
redkale
6d613f715f 新增Copier 2023-08-07 11:43:17 +08:00
redkale
906c147ed6 Reproduce优化 2023-08-06 00:27:14 +08:00
redkale
d228228eee DataSqlSource增加natvieQuery的参数模板功能 2023-08-05 16:47:37 +08:00
redkale
30a6e29897 Utility.convertValue优化 2023-08-05 09:02:13 +08:00
redkale
11d88c887f EntityBuilder支持Map类型 2023-08-05 08:11:11 +08:00
redkale
213a9a362d ReproduceTest 2023-08-04 21:26:54 +08:00
redkale
f1a7c4588b Reproduce支持Map类型 2023-08-04 21:22:33 +08:00
redkale
82b64c2e38 增加convertValue方法 2023-08-04 17:55:18 +08:00
redkale
be11b0767e Reproduce优化 2023-08-04 16:41:10 +08:00
redkale
0fb3684a18 优化Reproduce 2023-08-04 15:38:01 +08:00
redkale
25a7aeacfa Resource里特殊值$改成# 2023-07-31 08:36:54 +08:00
redkale
4804eed0a7 移除FilterNode中的itemand属性 2023-07-29 22:17:36 +08:00
redkale
07585a01ed Filter优化 2023-07-29 20:20:23 +08:00
redkale
8346df60ec DataSource优化 2023-07-29 12:22:07 +08:00
redkale
047149798b 移除JsonCharsWriter 2023-07-29 12:11:51 +08:00
redkale
b84006d8db ConvertFactory增加nullable配置 2023-07-29 09:20:13 +08:00
redkale
e20d398a73 CacheMemorySource优化 2023-07-28 14:41:14 +08:00
redkale
a8ee396ffa CacheMemorySource优化 2023-07-28 13:09:07 +08:00
redkale
56924fb447 Reproduce优化 2023-07-27 22:01:42 +08:00
redkale
5b8f797b33 恢复GeneratedValue功能 2023-07-26 15:57:41 +08:00
redkale
f2769dc182 DataSqlSource增加executeQueryMap方法 2023-07-25 21:51:42 +08:00
redkale
fe67add571 DataSqlSource优化 2023-07-25 21:25:33 +08:00
redkale
70764f1ea4 EntityBuilder优化 2023-07-25 20:00:25 +08:00
redkale
e86638e490 EntityBuilder优化 2023-07-25 18:34:38 +08:00
redkale
1e87f6497c AbstractDataSource 2023-07-25 18:20:14 +08:00
redkale
16acc3a959 增加EntityBuilder功能 2023-07-25 18:09:15 +08:00
redkale
06efe3f5c3 DataBatch优化 2023-07-25 12:46:20 +08:00
redkale
3c45093632 DataJdbcSource优化 2023-07-24 22:51:35 +08:00
redkale
f33a1b997f 优化DataSqlSource 2023-07-24 22:11:00 +08:00
redkale
835e9b7eea 优化properties配置 2023-07-23 08:53:39 +08:00
redkale
f9bee11001 优化jsonobject 2023-07-21 14:55:09 +08:00
redkale
ede8f40b0d DataJdbcSource优化 2023-07-21 14:03:48 +08:00
redkale
7dcaa3eda0 DataJdbcSource优化 2023-07-18 20:01:43 +08:00
redkale
2a5184f4fc 修复writeVirtualRequest模式问题 2023-07-18 11:51:38 +08:00
redkale
0b1c02ac96 CacheSource优化 2023-07-18 09:16:41 +08:00
redkale
8b3c472d70 优化fastHandler 2023-07-18 08:37:30 +08:00
redkale
8ccea3750e 修复getDel问题 2023-07-18 07:33:22 +08:00
redkale
222969e8a3 CacheSource增加getDel方法 2023-07-15 22:06:51 +08:00
redkale
f9463c0f82 优化JsonObject 2023-07-15 11:09:19 +08:00
redkale
6b27653a99 增加JsonString类型 2023-07-15 08:12:00 +08:00
redkale
50faf01d10 增加JsonObject、JsonArray功能 2023-07-14 22:54:30 +08:00
redkale
ad71343650 优化ClientCodec回调 2023-07-11 11:58:52 +08:00
redkale
f234ed0614 优化CacheSource 2023-07-11 11:21:32 +08:00
redkale
69797fd29c Client增加批量请求方法 2023-07-08 09:01:06 +08:00
redkale
2163ce3c4c 增加setIfNull方法 2023-07-06 14:44:08 +08:00
redkale
a57b186c67 SncpHeader优化 2023-07-06 09:42:08 +08:00
redkale
4c11217dda Traceid生成规则优化 2023-07-06 08:11:52 +08:00
redkale
78b1285b37 优化traces 2023-07-05 21:52:20 +08:00
redkale
1ef6d51497 SncpRequest优化 2023-07-05 15:57:45 +08:00
redkale
1b7bdd2ad9 sncp协议优化 2023-07-05 14:51:28 +08:00
redkale
cfd22623b7 Merge branch 'main' of http://github.com/redkale/redkale 2023-07-05 06:50:30 +08:00
redkale
7b7fb33b7b 优化ByteBufferWriter 2023-07-05 06:48:26 +08:00
redkale
c64763cb35 AsyncConnection优化 2023-07-05 06:38:17 +08:00
redkale
c80bb876a3 AsyncNioConnection优化fastWrite 2023-07-04 22:30:06 +08:00
redkale
fbea655e96 AsyncConnection优化 2023-07-04 22:11:38 +08:00
redkale
5390147985 AsyncConnection优化 2023-07-04 19:09:29 +08:00
redkale
81e871cca9 ClientConnection优化 2023-07-03 16:03:06 +08:00
redkale
f016d5fb4a ClientConnection优化 2023-07-03 16:02:15 +08:00
redkale
319b9e04dd SncpHeader优化 2023-07-03 09:06:01 +08:00
redkale
6bb91552f7 AnyValue优化 2023-06-30 13:20:22 +08:00
redkale
7c66446459 ClientCodec优化 2023-06-30 10:29:15 +08:00
redkale
f38adacbe4 优化net 2023-06-30 10:18:00 +08:00
redkale
479d2d427a ClientCodec优化 2023-06-30 09:29:38 +08:00
redkale
6be5f42ddd 优化net模块 2023-06-30 08:56:30 +08:00
redkale
93524d515a 优化net模块 2023-06-30 08:55:57 +08:00
redkale
2fa3b1c7b2 youhua 2023-06-29 19:31:38 +08:00
redkale
4a62ea0cd3 移除SerializedLambda 2023-06-29 17:58:36 +08:00
redkale
1fd6dca941 doWrite必须全输出 2023-06-29 16:55:35 +08:00
redkale
647cf7ca7d 移除日志 2023-06-29 16:10:39 +08:00
redkale
49823d457c 临时日志 2023-06-29 15:43:12 +08:00
redkale
5f34ef68cc 临时日志 2023-06-29 14:49:04 +08:00
redkale
f6abbc99ab 优化LambdaFunction 2023-06-29 14:32:43 +08:00
redkale
9ff03e3ec6 兼容native 2023-06-29 12:01:55 +08:00
redkale
773a260438 SerializedLambda优化 2023-06-29 11:31:45 +08:00
redkale
7e7e352924 兼容native 2023-06-29 11:24:40 +08:00
redkale
cdb3dce63a 优化LambdaFunction/LambdaSupplier 2023-06-29 10:46:39 +08:00
redkale
00cc5d896e 增加LambdaFunction和LambdaSupplier功能 2023-06-29 08:25:12 +08:00
redkale
2591d92959 优化依赖注入 2023-06-28 10:37:16 +08:00
redkale
5b45022dfb 优化filter加载 2023-06-28 10:27:25 +08:00
redkale
a2be5a9430 优化注释 2023-06-27 21:04:06 +08:00
redkale
8c08112097 优化Response.completeInIOThread里的readRegister 2023-06-27 17:55:02 +08:00
redkale
5e6b2fb86e ClientConnection优化临时方案 2023-06-27 15:25:27 +08:00
redkale
f3475341a0 AsyncConnection优化 2023-06-27 09:10:24 +08:00
redkale
87899d514b CacheSource增加linsert方法 2023-06-26 16:51:43 +08:00
redkale
acee7cdfb0 CacheSource增加sunion方法 2023-06-26 15:30:31 +08:00
redkale
564aa972dc CacheSource增加srandmember方法 2023-06-26 10:38:48 +08:00
redkale
936f50659b CacheSource增加hstrlen方法 2023-06-26 08:16:27 +08:00
redkale
264dce055c 优化HttpResponse 2023-06-25 22:43:31 +08:00
redkale
ff5b9a897a Convert优化 2023-06-25 10:50:56 +08:00
redkale
d44fb67f88 Convert优化 2023-06-25 10:44:48 +08:00
redkale
27f54ebd15 ClientCodec优化responseComplete方法 2023-06-25 09:58:19 +08:00
redkale
94774d917f 优化Utility.aes 2023-06-23 20:22:20 +08:00
redkale
06d71bb2bc 优化CacheSource 2023-06-17 23:01:20 +08:00
redkale
cc0f35ce70 CacheSource增加zrange方法 2023-06-17 14:01:05 +08:00
redkale
4b329296f2 CacheSource增加zrank方法 2023-06-17 11:49:36 +08:00
redkale
197d76fd3c CacheSource增加zincrby方法 2023-06-16 09:15:36 +08:00
redkale
644186a398 优化CacheMemorySource 2023-06-14 22:43:01 +08:00
redkale
e2c6990265 CacheSource增加sorted set操作 2023-06-13 12:10:06 +08:00
redkale
98f89d87d4 删除append容易产生歧义的方法 2023-06-12 12:54:38 +08:00
redkale
3d379d59ef CacheSource增加smismember方法 2023-06-11 22:53:17 +08:00
redkale
a00a5eb5e2 CacheSource增加diff方法 2023-06-11 20:16:49 +08:00
redkale
2daa9ce7fd CacheSource优化srem、sadd 2023-06-11 17:30:12 +08:00
redkale
4dfeb2aa88 CacheSource增加lpop、lpush等系列方法 2023-06-11 16:43:58 +08:00
redkale
8603e98b9b 修正方法名 2023-06-09 22:18:11 +08:00
redkale
4b0570770c CacheSource增加list的rpop、lpush等一系列方法 2023-06-09 21:58:06 +08:00
redkale
85d23214ec 优化CacheSource.lrange 2023-06-09 11:34:55 +08:00
redkale
2e35abccd0 CacheSource增加sscan方法 2023-06-08 11:34:34 +08:00
redkale
685ae89685 CacheSource增加flushdb方法 2023-06-08 08:23:25 +08:00
redkale
2e6ec01711 增加isNotEmpty方法 2023-06-06 15:00:18 +08:00
redkale
d63d8ff836 增加scan方法 2023-06-04 22:41:41 +08:00
redkale
450ae24e94 优化CacheSource.hmap方法 2023-06-02 16:12:23 +08:00
redkale
39b0e0f318 增加removeHeader、removeParameter 2023-06-01 21:46:39 +08:00
redkale
ca9a13ea27 CacheSource增加hvals、hgetall方法 2023-05-31 10:39:39 +08:00
redkale
ca782e7c62 CacheSource增加persist、rename方法 2023-05-30 10:38:02 +08:00
redkale
29d45b1e3d 优化ProtocolCodec.start 2023-05-27 22:10:50 +08:00
redkale
2202465e31 修复JsonByteBuffer解析bug 2023-05-09 14:45:25 +08:00
redkale
454e6b60d7 修复json在ByteBuffer、InputSteam参数下无法解决数组的问题 2023-05-08 19:38:47 +08:00
redkale
6ff04b408c DataSqlSource 变量由${}改成#{}, 为了区别于配置项${} 2023-05-08 14:29:23 +08:00
redkale
de7c5e84f4 Response增加afterFinishListeners 2023-05-08 08:25:36 +08:00
redkale
18932bf48b DataJdbcSource优化 2023-05-06 08:21:27 +08:00
redkale
1b1bfbb3ac DataJdbcSource优化 2023-05-05 20:31:21 +08:00
redkale
20a98e2a95 优化mq 2023-05-05 08:12:03 +08:00
redkale
8dbf474662 优化mq 2023-05-04 21:35:59 +08:00
redkale
26d0cce404 优化mq 2023-05-04 14:06:29 +08:00
redkale
eb5142a125 优化NodeServer 2023-05-01 09:30:17 +08:00
redkale
4911aa3f15 修改module-info 2023-04-28 14:21:45 +08:00
redkale
4a8fc9d771 修复URISimpledCoder的常量笔误问题 2023-04-28 14:18:57 +08:00
redkale
0d9216dd35 DataJdbcSource增加PreparedStatement缓存 2023-04-22 14:37:48 +08:00
redkale
331047957a DataSqlSource方法名优化 2023-04-20 21:49:16 +08:00
redkale
bec1c0c2d8 DataSqlSource方法名优化 2023-04-20 21:47:01 +08:00
redkale
82fa56d66c 废弃ThreadHashExecutor 2023-04-20 19:56:02 +08:00
redkale
8db6fd7b73 优化@Local的Service 2023-04-20 19:38:06 +08:00
redkale
b82a7d86e5 NodeServer优化 2023-04-20 17:58:09 +08:00
redkale
698269f8b0 增加MessageConsumer、MessageProducer功能 2023-04-20 14:30:39 +08:00
redkale
5e9c85e0fc DataJdbcSource优化 2023-04-18 22:30:25 +08:00
redkale
0fca7cd47b DataJdbcSource优化 2023-04-18 08:51:07 +08:00
redkale
d56af6043d 修复checkValid问题 2023-04-18 08:38:20 +08:00
redkale
021bf8ce51 优化DataJdbcSource 2023-04-17 23:44:39 +08:00
redkale
53e8f44088 优化ByteArray 2023-04-11 08:11:14 +08:00
redkale
3f244b2cff 修复SncpServlet的asm问题 2023-04-10 08:27:57 +08:00
redkale
3178221c44 优化ByteArray 2023-04-09 21:28:55 +08:00
redkale
41d0cbcb46 优化iothread 2023-04-07 14:57:43 +08:00
redkale
e6a2167261 优化client 2023-04-07 14:05:13 +08:00
redkale
7286531bc5 WebSocket优化 2023-04-06 21:23:27 +08:00
redkale
91d7f51678 修复Rest将Future<HttpResult<byte[]>>类型用finishJsonFuture格式输出 2023-04-06 11:07:09 +08:00
redkale
5746449cfb 优化sncp版WebSocketNode 2023-04-05 22:52:17 +08:00
redkale
4bdbf0f493 优化WebSocket 2023-04-05 18:43:38 +08:00
redkale
68b9d955f6 优化uriPathCaches 2023-04-05 17:07:59 +08:00
redkale
39ac48884f 优化Utility 2023-04-03 23:24:22 +08:00
redkale
663ca4f441 jdbc优化 2023-04-03 22:17:46 +08:00
redkale
8f3ae4b5a7 jdbc优化 2023-04-03 21:39:36 +08:00
redkale
db77b8c8cb jdbc优化 2023-04-03 20:38:47 +08:00
redkale
dc6d53e6be 日志优化 2023-04-03 14:48:01 +08:00
redkale
849d628a75 增加测试用例 2023-04-03 11:02:15 +08:00
redkale
22fd2212de mq命名优化 2023-04-03 09:32:44 +08:00
redkale
188a74423b mq优化命名 2023-04-03 08:48:43 +08:00
redkale
8727b5165a client还原 2023-04-02 23:41:22 +08:00
redkale
aa03d356b8 client优化 2023-04-02 23:32:48 +08:00
redkale
d417fb7232 HttpRequest优化 2023-04-02 22:34:11 +08:00
redkale
156131d4b5 实现DataBatch 2023-04-01 14:43:41 +08:00
redkale
dba72cab46 client优化 2023-03-31 20:06:54 +08:00
redkale
0b4a52ccb1 client优化 2023-03-31 14:22:00 +08:00
redkale
6b92748b7c client优化 2023-03-31 12:07:39 +08:00
redkale
00829cf198 convert优化 2023-03-31 11:09:15 +08:00
redkale
20ebcad982 client优化 2023-03-31 08:11:19 +08:00
redkale
6f03f38222 增加AnonymousVirtualExecutor 2023-03-30 23:05:38 +08:00
redkale
5c6b9dcec8 Client.connect 2023-03-30 20:21:53 +08:00
redkale
c9be4a89af isThreadLocalConnMode 2023-03-30 19:54:19 +08:00
redkale
41e1ffa6e2 Nonnull 2023-03-30 18:29:12 +08:00
redkale
c9c202f63f 优化Source 2023-03-30 12:56:32 +08:00
redkale
1dbaf107ca EntityCache优化 2023-03-29 21:36:51 +08:00
redkale
ee535692b4 EntityCache优化 2023-03-29 21:34:55 +08:00
redkale
df0a290032 EntityCache优化 2023-03-29 21:05:18 +08:00
redkale
7de19f142f 增加Cacheable.continuousid功能 2023-03-29 20:06:54 +08:00
redkale
0cfb00e40b ClientConnection优化 2023-03-28 23:36:18 +08:00
redkale
3cf560f220 修复EntityCache 2023-03-28 23:31:45 +08:00
redkale
3bb287b3ef EntityCache临时屏蔽 2023-03-28 23:18:02 +08:00
redkale
49662a7d5f client优化 2023-03-28 15:04:43 +08:00
redkale
d7655aa2be 优化client 2023-03-28 13:16:10 +08:00
redkale
a61d515a49 优化client 2023-03-28 08:12:58 +08:00
redkale
94185cc23e 优化client 2023-03-28 08:05:04 +08:00
redkale
9ef977aee9 优化WebSocket.IOThread 2023-03-27 21:36:22 +08:00
redkale
34fb441817 优化workexecutor 2023-03-27 21:18:16 +08:00
redkale
ac33b36d20 update pom 2023-03-27 20:04:43 +08:00
redkale
372656fea9 临时屏蔽workExecutor 2023-03-27 19:56:52 +08:00
redkale
a872c6e75f 增加APP_GLOBAL_IOGROUP功能 2023-03-27 19:45:39 +08:00
redkale
067b88ab72 废弃ClientWriteIOThread 2023-03-27 18:55:27 +08:00
redkale
ffbad698b4 AsyncConnection增加readRegister方法 2023-03-26 21:15:00 +08:00
redkale
71d3c015d9 readTimeoutSeconds优化 2023-03-25 10:18:54 +08:00
redkale
051299d4a5 优化sncp cluster配置 2023-03-23 15:21:53 +08:00
redkale
ac9995fb1a 优化sncp 2023-03-23 13:11:41 +08:00
redkale
83d04d02da SncpClientRequest.seqno生成规则优化 2023-03-23 13:03:13 +08:00
redkale
80bad30811 SncpClient优化 2023-03-23 11:56:13 +08:00
redkale
f34554f2cb 修复AsyncNioConnection 2023-03-22 23:51:55 +08:00
redkale
e2f331ab6b 优化SncpClient 2023-03-22 23:24:01 +08:00
redkale
039ed0f569 优化SncpClient的新实现 2023-03-22 16:02:17 +08:00
redkale
358ad80f21 优化HttpScope 2023-03-20 14:31:48 +08:00
redkale
f9a65f7492 http优化 2023-03-19 19:26:11 +08:00
redkale
32cae92848 http优化 2023-03-19 10:05:03 +08:00
redkale
e168c1368c rest优化 2023-03-17 18:42:26 +08:00
redkale
9cab0c6443 http优化 2023-03-17 13:39:20 +08:00
redkale
9e7e4cc177 http优化 2023-03-16 22:09:58 +08:00
redkale
523c101e25 优化http注释 2023-03-15 16:23:30 +08:00
redkale
1428cd8f10 增加Nonnull、Nullable注解 2023-03-15 09:36:40 +08:00
redkale
1edd256028 Resource支持@name、@type 2023-03-14 10:56:19 +08:00
redkale
42201c7c11 HTTP支持Expect:100-continue 2023-03-13 18:55:04 +08:00
redkale
aec65a2ff5 加强注释 2023-03-12 17:31:37 +08:00
redkale
c2b5733ceb sncp优化 2023-02-08 23:07:50 +08:00
redkale
2e40c98b81 sncp优化 2023-02-08 22:44:00 +08:00
redkale
6622e88232 sncp优化 2023-02-08 21:33:14 +08:00
redkale
67cd0b1b46 sncp优化 2023-02-08 19:06:22 +08:00
redkale
3ec4f9f96d sncp优化 2023-02-08 17:57:28 +08:00
redkale
530bf8078e udp优化 2023-02-07 17:34:33 +08:00
redkale
848f33bd2b udp优化 2023-02-07 17:27:55 +08:00
redkale
1d6b76b182 udp优化 2023-02-07 16:43:47 +08:00
redkale
bab857778b udp优化 2023-02-07 15:02:19 +08:00
redkale
75469a49e8 udp优化 2023-02-07 14:55:58 +08:00
redkale
7d2a9f6d94 udp优化 2023-02-07 14:26:14 +08:00
redkale
35fddb48de 优化sncp.udp 2023-02-07 14:08:13 +08:00
redkale
89f9baee46 sncp优化 2023-02-07 01:18:06 +08:00
redkale
797d04fea7 sncp优化 2023-02-07 00:50:53 +08:00
redkale
5df83b2649 移除ChannelContext 2023-02-06 19:08:20 +08:00
redkale
0aa8e8653c 增加RedkaleException 2023-02-05 17:19:03 +08:00
redkale
2751e6475e 优化client 2023-02-04 21:20:35 +08:00
redkale
e9d25a67f8 优化client 2023-02-04 20:21:41 +08:00
redkale
eef43e8edc 优化client 2023-02-04 20:19:35 +08:00
redkale
b60e5fef96 Context.getWorkHashExecutor 2023-02-04 16:10:08 +08:00
redkale
b9c1fa723c redkale.convert.tiny默认值改为false 2023-02-04 15:32:30 +08:00
redkale
63f4a6ee0d 实现@NonBlocking 2023-02-04 14:59:30 +08:00
redkale
894ea65a35 Filter.isNonBlocking 2023-02-03 22:10:42 +08:00
redkale
73c9a3cdb4 增加NonBlocking 2023-02-03 21:47:39 +08:00
redkale
de39ac1981 优化掉Array.newInstance 2023-02-02 23:16:24 +08:00
redkale
6973e6b159 SncpClientCodecTest 2023-02-02 21:40:58 +08:00
redkale
7f379f9874 Server.changeAddress 2023-02-02 17:54:19 +08:00
redkale
3c6b15ee9d Context.updateServerAddress 2023-02-02 17:42:33 +08:00
redkale
c6ef28c358 sncp优化 2023-02-02 15:31:19 +08:00
redkale
2ef5eb6cd0 优化client 2023-02-02 15:02:43 +08:00
redkale
cfc20c6248 增加SncpClientRequest 2023-02-02 13:47:34 +08:00
redkale
ea9505c2da EntityCache优化synchronized 2023-02-01 20:41:34 +08:00
redkale
1c1c54ea8a 优化Array.newInstance 2023-02-01 20:34:01 +08:00
redkale
851c81e096 优化MessageProducer的closed 2023-02-01 19:53:55 +08:00
redkale
78f969d2cc synchronized优化 2023-02-01 19:17:32 +08:00
redkale
ad981835f9 synchronized优化 2023-02-01 17:23:33 +08:00
redkale
f7f9e8db41 优化DataMemorySource 2023-02-01 14:45:52 +08:00
redkale
44f0fe1852 DataJdbcSource读操作不自动建表 2023-02-01 14:37:39 +08:00
redkale
8088197e29 增加AbstractDataSqlSource 2023-02-01 14:23:51 +08:00
redkale
76797228a0 ResourceFactory支持BigDecimal 2023-01-31 22:03:07 +08:00
redkale
ba3c0fdf72 DataTransaction 2023-01-31 20:39:02 +08:00
redkale
c6a1d584ea ConvertFactory优化 2023-01-31 17:05:26 +08:00
redkale
be5da6e287 移除默认tiny=true系统变量 2023-01-31 13:20:07 +08:00
redkale
7c8f54dd5c ClusterAgent优化 2023-01-31 11:08:25 +08:00
redkale
7b2dc52a35 ClusterAgent优化 2023-01-31 10:59:25 +08:00
redkale
e55d991bce UDP优化 2023-01-31 10:24:52 +08:00
redkale
e47abd6417 命名优化 2023-01-30 22:29:13 +08:00
redkale
afaf97aaf8 优化命名 2023-01-30 21:15:42 +08:00
redkale
9bafeccd38 CacheSource和DataSource支持资源复用 2023-01-30 21:10:28 +08:00
redkale
18afbd6bae 优化命名 2023-01-30 20:13:58 +08:00
redkale
4d2458da64 writePipeline优化 2023-01-30 18:50:53 +08:00
redkale
737d36be67 优化SNCP.UDP 2023-01-30 17:52:58 +08:00
redkale
6d1cf4b6bf 优化sncp 2023-01-30 16:32:36 +08:00
redkale
7dc57c67ed AsyncNioConnection优化 2023-01-30 13:53:03 +08:00
redkale
823b89ec48 Rest优化 2023-01-30 12:10:41 +08:00
redkale
d428c58e15 ProtocolCodec优化 2023-01-30 10:49:55 +08:00
redkale
4b70e19211 Request增加getRequestid方法 2023-01-30 10:33:00 +08:00
redkale
ae27fffdb0 重写Sncp.getServiceType 2023-01-29 22:22:12 +08:00
redkale
f41a1bc3a1 重写Sncp.getServiceType 2023-01-29 22:21:05 +08:00
redkale
ed5c52cfdc EnumSimpledCoder支持字段名作为setter方法名 2023-01-29 20:11:17 +08:00
redkale
5740d2704a 优化Creator 2023-01-29 19:45:38 +08:00
redkale
56e7775c5a Convert不再限制setter要求void返回类型 2023-01-29 19:11:23 +08:00
redkale
d4e807ada3 ConvertCoder优化 2023-01-29 18:05:29 +08:00
redkale
0b5a8863f3 Creator增加paramTypes方法 2023-01-29 17:37:28 +08:00
redkale
83b4887dd6 优化doWrite 2023-01-28 11:58:27 +08:00
redkale
2a7f0901af 优化pipeline 2023-01-28 11:28:10 +08:00
Redkale
71fb4102f6 Sncp.getServiceType 优化 2023-01-27 17:31:00 +08:00
Redkale
a492cbd815 net浼樺寲璁℃暟鍣? 2023-01-27 15:59:09 +08:00
Redkale
8d4ebe653d net浼樺寲璁℃暟鍣? 2023-01-27 15:39:12 +08:00
Redkale
88026fae3c Client浼樺寲connIndex 2023-01-23 20:38:25 +08:00
Redkale
f34ec61458 ClientFuture优化 2023-01-18 11:22:09 +08:00
Redkale
4d42f94be4 ClientFuture优化 2023-01-18 11:19:15 +08:00
Redkale
961ff7fa22 ClientConnection优化 2023-01-17 22:40:00 +08:00
Redkale
4d41b2afda 浼樺寲AsyncIOThread 2023-01-17 18:22:12 +08:00
Redkale
ec5b337460 EntityInfo优化 2023-01-17 14:28:42 +08:00
Redkale
1d559ef4d4 EntityInfo优化 2023-01-17 12:06:11 +08:00
Redkale
732e855daa EntityInfo优化 2023-01-17 09:59:19 +08:00
Redkale
b74bc43007 Client优化 2023-01-16 08:50:13 +08:00
Redkale
f5d79c7035 DataSqlSource命名优化 2023-01-15 23:11:16 +08:00
Redkale
19c8ffb79d Response优化finish方法 2023-01-15 21:11:59 +08:00
Redkale
39ade6f3ab CacheSource优化 2023-01-15 19:39:04 +08:00
Redkale
8789c0915b CacheSource增加setnxex系列方法 2023-01-15 16:21:37 +08:00
Redkale
55ddf7c417 优化WebSocket的写操作 2023-01-14 22:33:05 +08:00
Redkale
58e206d0e9 增加WebSocketWriteIOThread 2023-01-14 21:04:44 +08:00
Redkale
dc0849d82a 优化ByteBuffer对象池 2023-01-14 19:45:57 +08:00
Redkale
9192cb4606 优化AsyncConnection 2023-01-14 18:09:49 +08:00
Redkale
87f7b82e0a Server优化 2023-01-14 17:08:04 +08:00
Redkale
21df7f05dd WorkThread优化 2023-01-14 16:13:46 +08:00
Redkale
e6150b3469 优化WebSocket 2023-01-14 14:44:46 +08:00
Redkale
68bfa944fe ProtocolCodec优化 2023-01-14 13:17:37 +08:00
Redkale
a973834325 ProtocolCodec优化 2023-01-14 11:58:15 +08:00
Redkale
6c8b482f65 AsyncNioTcpProtocolServer优化 2023-01-14 11:36:07 +08:00
Redkale
0712b71b71 浼樺寲AsyncNioTcpProtocolServer 2023-01-14 11:17:58 +08:00
Redkale
52b9fd8326 浼樺寲ClientCodec 2023-01-13 22:39:02 +08:00
Redkale
8e7b27eb16 浼樺寲ClientCodec 2023-01-13 22:38:00 +08:00
Redkale
ab79359eff ClientRequest增加transfer功能 2023-01-13 21:31:38 +08:00
Redkale
f904af3da6 优化loadEntityInfo 2023-01-13 19:42:57 +08:00
Redkale
48e1c5dc86 浼樺寲ClientExecutor鐨勭嚎绋嬫暟 2023-01-13 19:17:49 +08:00
Redkale
25214db1dd CacheSource修改setnx返回值 2023-01-13 17:15:02 +08:00
Redkale
091a08b783 优化SncpDyn 2023-01-13 13:52:09 +08:00
Redkale
cf37303b5e client泛型优化 2023-01-13 11:21:54 +08:00
Redkale
ad059eb3d6 client泛型优化 2023-01-13 11:05:04 +08:00
Redkale
41028384af 重构Client模块的IO读写策略 2023-01-13 09:33:23 +08:00
Redkale
43ff13867f 重构Client模块的IO读写策略 2023-01-12 20:26:39 +08:00
Redkale
9b66bd186f DataSqlSource优化UpdateSqlInfo 2023-01-12 20:04:06 +08:00
Redkale
851efa5097 Client优化 2023-01-12 10:57:47 +08:00
Redkale
35d923d856 Client优化 2023-01-11 11:49:31 +08:00
Redkale
bf3bf836ac AsyncConnection增加writeInIOThread方法 2023-01-10 20:41:20 +08:00
Redkale
8f8a2ef325 【不兼容】移除RpcCall、RpcCallAttribute功能 2023-01-10 16:12:20 +08:00
Redkale
eeaefb1ed2 优化命名 2023-01-10 13:13:41 +08:00
Redkale
6a605359d7 优化ClientExecutor 2023-01-09 17:46:44 +08:00
Redkale
d603915d2b 优化ClientWriteIOThread 2023-01-09 16:37:22 +08:00
Redkale
bb4482c08c 移除MAX_INVOKER_ONSTACK 2023-01-09 12:18:32 +08:00
Redkale
645ecc3a32 增加自定义Exception 2023-01-09 10:37:30 +08:00
Redkale
da96d2ef9f 增加部分package-info 2023-01-07 20:19:46 +08:00
Redkale
084ba6609d 优化线程名 2023-01-06 22:09:48 +08:00
Redkale
9cef4b4f79 优化线程名 2023-01-06 22:08:49 +08:00
Redkale
1898fa7717 优化命名 2023-01-06 19:47:22 +08:00
Redkale
159c7f9e1b 优化HttpRequest 2023-01-06 16:05:48 +08:00
Redkale
158ea68265 优化ClientAddress 2023-01-06 15:16:58 +08:00
Redkale
7ce7c71163 优化命名 2023-01-06 13:31:57 +08:00
Redkale
4e5a03bb65 Deprecated方法增加since描述 2023-01-06 12:47:12 +08:00
Redkale
a986becb70 优化HttpRequest 2023-01-06 12:21:21 +08:00
Redkale
aa78b98ebf 浼樺寲ByteArray鏋勯€犲嚱鏁? 2023-01-06 10:26:26 +08:00
Redkale
442d806161 优化ClientAddress 2023-01-05 22:31:05 +08:00
Redkale
310d6fe217 新增WeightAddress 2023-01-05 22:29:45 +08:00
Redkale
288cab7c4f redkale.net.invoker.max.onstack榛樿鍊兼敼鎴? 2023-01-05 11:06:13 +08:00
Redkale
6f9a6e32bd 优化HttpRequest 2023-01-05 10:19:33 +08:00
Redkale
bb8faf14cb 澧炲姞ObjectReference宸ュ叿绫? 2023-01-04 20:48:30 +08:00
Redkale
9be0afacef 修复ArrayEncoder并发下componentEncoder偶尔为null的bug 2023-01-04 16:38:20 +08:00
Redkale
809b574f12 【不兼容】DLong更名为Uint128 2023-01-04 13:56:31 +08:00
Redkale
5975be44d9 优化ClientFuture 2023-01-04 11:53:17 +08:00
Redkale
7680b4e165 优化net.client 2023-01-04 11:32:48 +08:00
Redkale
80c04d9645 修复JDK15下StringBuilder.isEmpty方法 2023-01-04 10:44:50 +08:00
Redkale
abe73c4022 优化Client的pingRequest和closeRequest 2023-01-04 10:21:07 +08:00
Redkale
13ef219ab1 绉婚櫎ioThread澶氫綑浠g爜 2023-01-03 18:52:42 +08:00
Redkale
d6d3fd0966 优化AsyncConnection的Thread 2023-01-03 16:57:21 +08:00
Redkale
43f2f38ae3 优化AsyncConnection的Thread 2023-01-03 15:59:05 +08:00
Redkale
44500b6500 AsyncConnection区分read/write 2023-01-03 14:46:28 +08:00
Redkale
979a263c88 优化DEFAULT_MAX_PIPELINES 2023-01-03 12:08:42 +08:00
Redkale
c72d0bec8c 优化ClientConnection.responseQueue命名 2023-01-03 10:56:32 +08:00
Redkale
ba82ca3051 DataSource增加createTable方法 2023-01-03 10:03:23 +08:00
Redkale
0032c06498 优化HttpRequest 2023-01-02 18:54:32 +08:00
Redkale
0c0cee756a 优化AsyncIOGroup 2023-01-02 16:24:56 +08:00
Redkale
21f66d13ee 优化DataSqlSource 2023-01-02 11:37:48 +08:00
Redkale
496b165d42 优化DataJdbcSource 2023-01-02 10:01:24 +08:00
Redkale
3a306a6235 优化DataJdbcSource 2023-01-02 08:43:34 +08:00
Redkale
6b75e950ec 优化DataJdbcSource 2023-01-01 22:07:24 +08:00
Redkale
f09a323b20 优化DataJdbcSource 2023-01-01 20:50:29 +08:00
Redkale
6f6c3f70ff 优化AsyncConnection 2023-01-01 19:52:44 +08:00
Redkale
1c1211a298 优化Response.channel.write 2023-01-01 17:51:52 +08:00
Redkale
b3862cea72 Client实现requestid 2023-01-01 13:53:19 +08:00
Redkale
391352e077 优化命名 2023-01-01 13:02:54 +08:00
Redkale
de089072fa 临时优化Client runWork 2022-12-31 09:58:51 +08:00
Redkale
2542eb959a 临时优化Client runWork 2022-12-30 10:08:50 +08:00
Redkale
76a85a6e3d 优化Client 2022-12-30 00:07:50 +08:00
Redkale
2c861a5ed4 优化DataJdbcSource 2022-12-29 14:56:24 +08:00
Redkale
8701450940 优化DataJdbcSource 2022-12-29 13:35:40 +08:00
Redkale
478b22e7c8 优化DataJdbcSource 2022-12-29 12:15:51 +08:00
Redkale
38436e7f37 格式化代码 2022-12-28 22:43:34 +08:00
Redkale
43a665497d 优化DataJdbcSource 2022-12-28 21:26:12 +08:00
Redkale
1622cb0285 DataJdbcSource优化事务 2022-12-28 19:36:22 +08:00
Redkale
3a28111cfc 优化TableStrategy 2022-12-28 19:18:15 +08:00
Redkale
b8b8873eaf Application加锁cacheSources 2022-12-28 17:07:19 +08:00
Redkale
34023f6d08 优化DataJdbcSource 2022-12-28 15:28:52 +08:00
Redkale
65f7692116 优化DataJdbcSource 2022-12-28 14:30:24 +08:00
Redkale
2af90d790b DataJdbcSource支持分表分库insert 2022-12-28 11:31:37 +08:00
Redkale
daa6fe4cbb 日志优化 2022-12-28 10:14:37 +08:00
Redkale
9c7676a3f2 Utility增加indexOf方法 2022-12-27 13:53:19 +08:00
Redkale
06bd653b24 优化CacheSource 2022-12-26 22:59:16 +08:00
Redkale
441a74a7c9 优化CacheSource 2022-12-26 22:48:59 +08:00
Redkale
ebd010b6d9 优化CacheSource 2022-12-26 22:27:24 +08:00
Redkale
9200a3a32b 优化CacheSource 2022-12-26 19:57:53 +08:00
Redkale
54ea96b820 CacheSource增加incrbyFloat方法 2022-12-26 14:46:49 +08:00
Redkale
ef6b90c2f6 EntityInfo浼樺寲 2022-12-26 11:12:55 +08:00
Redkale
bcb2a89388 优化DataSource 2022-12-25 17:54:37 +08:00
Redkale
9e37f693c3 DistributeTableStrategy增加getTables方法 2022-12-25 17:36:35 +08:00
Redkale
337377c001 浼樺寲HttpSimpleClient 2022-12-25 09:35:20 +08:00
Redkale
8636a1a43d 优化ConvertException 2022-12-23 21:15:42 +08:00
Redkale
b656c8877b 增加SourceException 2022-12-23 21:12:10 +08:00
Redkale
48ba0edd2e 优化日志 2022-12-23 20:56:27 +08:00
Redkale
e44bfbe9f3 优化CacheSource 2022-12-23 17:45:04 +08:00
Redkale
5750dd5dc3 优化CacheSource 2022-12-23 14:00:44 +08:00
Redkale
bb750d3689 优化CacheSource 2022-12-23 13:09:22 +08:00
Redkale
6940b7af81 优化CacheSource 2022-12-23 12:08:09 +08:00
Redkale
31eb6f8701 优化CacheSource 2022-12-23 10:48:27 +08:00
Redkale
989f1cddf8 打印慢sql日志 2022-12-22 21:49:11 +08:00
Redkale
2d06fd6ea9 优化CacheSource 2022-12-22 15:02:41 +08:00
Redkale
e79427f708 优化CacheSource 2022-12-22 13:05:14 +08:00
Redkale
68ff0f7bab 优化CacheSource 2022-12-22 10:48:08 +08:00
Redkale
19b22161c9 Convert兼容setter返回值是void或类本身对象 2022-12-22 09:55:35 +08:00
Redkale
2d84fc3eda 优化CacheSource 2022-12-22 09:46:56 +08:00
Redkale
e823c2e4e1 优化CacheSource 2022-12-22 08:28:31 +08:00
Redkale
e5a905f04c CacheSource增加getex系列方法 2022-12-21 22:46:11 +08:00
Redkale
616a501af7 优化CacheSource部分方法名 2022-12-21 17:35:43 +08:00
Redkale
c48ba58d55 优化CacheSource部分方法名 2022-12-21 16:43:32 +08:00
Redkale
d3236f57d2 CacheSource增加setnx、hsetnx系列方法 2022-12-21 16:33:44 +08:00
Redkale
f327378d18 修复APP_EXECUTOR资源为null时inject报错的bug 2022-12-21 14:43:13 +08:00
Redkale
66a1850c49 优化createDataSource和createCacheSource 2022-12-21 13:43:25 +08:00
Redkale
3ac01eca15 PrepareCompiler兼容旧注解 2022-12-21 12:17:10 +08:00
Redkale
e7aac019e1 javax.annotation包迁移至org.redkale.annotation; javax.persistence包迁移至org.redkale.persistence 2022-12-21 11:42:01 +08:00
Redkale
628e3f15b1 增加"redkale.resource.skip.check"系统变量 2022-12-18 23:58:28 +08:00
Redkale
321ce372d2 增加"redkale.resource.skip.check"系统变量 2022-12-18 23:52:02 +08:00
Redkale
4fa449990f 优化Traces 2022-12-18 21:25:52 +08:00
Redkale
d57b4715d0 修复Application.replaceValue空指针问题 2022-12-18 17:39:15 +08:00
Redkale
664ad9e4aa 修复Application.replaceValue空指针问题 2022-12-18 17:35:30 +08:00
Redkale
a31e47ea42 优化SncpResponse.fillRespHeader 2022-12-18 15:51:47 +08:00
Redkale
1334e2439d 修改Traces方法名 2022-12-17 14:22:18 +08:00
Redkale
543db6f8ab 增加慢sql告警日志 2022-12-17 11:07:34 +08:00
Redkale
8fd679d21f 优化命名规范 2022-12-16 09:52:34 +08:00
Redkale
d4def48c99 优化命名规范 2022-12-15 20:58:30 +08:00
Redkale
c805beeb34 优化DataBatch 2022-12-15 13:38:27 +08:00
Redkale
a2331ad71a 增加DefaultDataBatch类 2022-12-13 21:31:11 +08:00
Redkale
eaa2c4c269 ColumnValue.name做空判断 2022-12-13 20:17:41 +08:00
Redkale
bab765a8f8 优化变量名 2022-12-12 19:24:15 +08:00
Redkale
348b27365b 调整Application设置系统变量优先级 2022-12-12 11:08:48 +08:00
Redkale
164dd3d8ea Environment增加forEach方法 2022-12-12 09:36:22 +08:00
Redkale
4a91e6eb18 废弃依赖注入配置项时自动加入"property."前缀 2022-12-11 21:37:23 +08:00
Redkale
b6a0885927 优化LoggingSearchHandler 2022-12-11 19:24:13 +08:00
Redkale
93ce83f137 优化AnyValue.loadFromProperties 2022-12-11 17:57:44 +08:00
Redkale
d36c168faa 配置中心支持动态更改mq和cluster配置 2022-12-11 13:29:33 +08:00
Redkale
86c66aab6d 配置中心支持动态更改日志配置 2022-12-11 10:45:47 +08:00
Redkale
8c20ba96f6 Application.xml废弃<resources>节点 2022-12-09 21:54:51 +08:00
Redkale
8a630ff007 优化AnyValue.toString 2022-12-08 23:15:44 +08:00
Redkale
8e55ddfcae 优化AnyValue.toString 2022-12-08 22:46:45 +08:00
Redkale
1e49fa50b5 优化AnyValue.merge方法 2022-12-08 19:36:26 +08:00
Redkale
5093663cfd 修复WebSocketNodeService无sncp服务情况下不注入CacheSource的bug 2022-12-08 17:18:55 +08:00
Redkale
b41f34cade 优化DataSource配置中心通知 2022-12-07 22:21:47 +08:00
Redkale
1972e6308c AnyValue增加copy和merge方法 2022-12-07 21:28:12 +08:00
Redkale
c0c5cb7e93 修复mysql下 DELETE FROM table a别名问题 2022-12-07 20:10:10 +08:00
Redkale
186b6c8649 FilterNode.filter方法废弃 2022-12-07 19:55:21 +08:00
Redkale
23e68e2d0d CacheSource.getSet系列方法还原 2022-12-07 19:19:30 +08:00
Redkale
1247c37d71 Utility.md5默认改成utf-8 2022-12-07 16:16:02 +08:00
Redkale
2d92c78c0b Application初始化顺序优化 2022-12-07 14:31:14 +08:00
Redkale
07ed7163ea PropertiesAgent优化 2022-12-07 13:26:52 +08:00
Redkale
4560c231ce CacheSource.getSet系列方法改成setGet 2022-12-07 10:04:57 +08:00
Redkale
5a1f6c8b1a 日志优化 2022-12-07 09:56:03 +08:00
Redkale
7a915c7015 优化DataSqlSource.onResourceChange 2022-12-06 21:32:21 +08:00
Redkale
2663b6dea0 DataJdbcSource支持配置中心动态变更配置 2022-12-06 19:53:15 +08:00
Redkale
cc3c07d0c2 移除SourceChangeable 2022-12-06 13:38:21 +08:00
Redkale
e01cb1b94d 修改SourceChangeable类接口 2022-12-05 20:04:10 +08:00
Redkale
709d320a5a DataResultSetRow增加getColumnLabels方法 2022-12-05 19:44:07 +08:00
Redkale
e781be25a0 优化Application.updateSourceProperties方法实现 2022-12-05 17:43:39 +08:00
Redkale
f8eb3d03ad 增加SourceChangeable 2022-12-04 15:45:27 +08:00
Redkale
b2e7160ce7 ResourceListener支持对Environment环境变量的支持 2022-12-01 20:31:28 +08:00
Redkale
18bb3b807b 优化Application 2022-11-30 10:15:56 +08:00
Redkale
af92ac4048 优化updateEnvironmentProperty方法 2022-11-29 21:13:08 +08:00
Redkale
6ab8aa8e72 优化PropertiesAgent 2022-11-29 20:14:11 +08:00
Redkale
595e2b83f5 优化PropertiesAgent 2022-11-29 18:26:28 +08:00
Redkale
ea8ffbc510 优化PropertiesAgent 2022-11-29 12:00:57 +08:00
Redkale
2663fb318c Utility优化参数名 2022-11-28 13:33:20 +08:00
Redkale
1c70fd201a Application增加reconfigLogging方法 2022-11-27 15:46:25 +08:00
Redkale
6e635d4272 修复LoggingConsoleHandler.denyreg相关bug 2022-11-26 14:47:41 +08:00
Redkale
2c41a354f3 优化日志级别调用方式 2022-11-26 14:00:27 +08:00
Redkale
b24eb1ce9e 优化PropertiesAgent接口 2022-11-25 20:27:41 +08:00
Redkale
d6b626fd47 Resource增加required属性 2022-11-25 17:29:31 +08:00
Redkale
53f7e5d337 优化PropertiesAgent 2022-11-25 17:14:23 +08:00
Redkale
232accc0da 浼樺寲PropertiesAgent 2022-11-25 17:04:42 +08:00
Redkale
56119d2aab 浼樺寲PropertiesAgent 2022-11-25 17:00:22 +08:00
Redkale
53d35fa02f 优化PropertiesAgent.init接口参数 2022-11-25 16:55:27 +08:00
Redkale
a68d63d2be Utility增加remove方法 2022-11-25 14:31:04 +08:00
Redkale
17dcddcd80 ResourceEvent增加containsName方法 2022-11-25 13:46:23 +08:00
Redkale
7621c4bdc3 增加InstanceProvider,统一Provider接口 2022-11-25 13:34:52 +08:00
Redkale
949498f3a7 PropertiesAgent加强注释 2022-11-24 22:31:18 +08:00
Redkale
0b2f2b189c 优化PropertiesAgent 2022-11-24 20:01:41 +08:00
Redkale
050ebc673a HttpSimpleRequest和client模块增加链路ID 2022-11-24 15:31:24 +08:00
Redkale
cc397ed07b redkale.convert.tiny默认值还原成true 2022-11-24 13:44:34 +08:00
Redkale
5c7e0b8098 convert/BsonMainTest.tiny 默认为true 2022-11-24 10:33:55 +08:00
Redkale
16ebdcde85 客户端组AsyncGroup不再使用WorkExecutor线程池而是单独新建一个 2022-11-24 10:09:44 +08:00
Redkale
4e675d007e redkale.convert.tiny默认值由true改成false 2022-11-18 15:23:53 +08:00
Redkale
a4dd37fff2 增加ConvertEnumValue功能 2022-11-16 11:25:15 +08:00
Redkale
20a545825c 优化Sheet 2022-09-27 13:44:10 +08:00
Redkale
b912e3a35f HttpServlet提供finish404、finish405的可定制化接口 2022-09-06 22:08:36 +08:00
Redkale
86a7ffb642 http协议请求不符合method要求时改成返回405 2022-09-06 17:39:23 +08:00
Redkale
cd3e5bdd14 支持redkale.datasource.xxx 和 redkale.cachesource.xxx 配置格式 2022-07-12 09:36:05 +08:00
Redkale
48db5a76b0 Redkale 2.8.0 开始 2022-07-12 07:14:14 +08:00
902 changed files with 156728 additions and 93040 deletions

36
.github/workflows/maven_check.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Maven Check
on:
workflow_dispatch:
#push:
# branches: [ "main" ]
#pull_request:
# branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6

35
.github/workflows/maven_snapshot.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Maven Snapshot
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
java: [11]
name: Java ${{ matrix.java }} build
steps:
- uses: actions/checkout@v4
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
env:
MAVEN_USERNAME: ${{ secrets.OSSRHUSERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRHPASSWORD }}
- name: Build with Maven
run: |
cp -fr my/pom.xml pom.xml
mvn --batch-mode -e -X clean deploy -DskipTests=true
env:
MAVEN_GPG_KEY: ${{ secrets.OSSRHGPGKEY }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRHGPGPASSWORD }}

34
.gitignore vendored
View File

@@ -1,15 +1,19 @@
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/target/
/.idea/
/redkale.iml
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/target/
/.idea/
/redkale.iml
/ClientConnection.java
/nbactions.xml
/nb-configuration.xml
/my/target/

View File

@@ -1,27 +1,48 @@
<b>项目介绍</b>
<p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Redkale (中文名: 红菜苔,一种湖北特产蔬菜) 是基于Java 11全新的微服务框架 包含HTTP、WebSocket、TCP/UDP、数据序列化、数据缓存、依赖注入等功能。 本框架致力于简化集中式和微服务架构的开发,在增强开发敏捷性的同时保持高性能。
</p>
<strong>RedKale 有如下主要特点:</strong>
<ol>
<li>大量使用Java 8+新特性接口默认值、Stream、Lambda、内置的ASM、HttpClient等</li>
<li>提供HTTP服务同时内置JSON功能与限时缓存功能</li>
<li>TCP层完全使用NIO并统一TCP与UDP的接口换</li>
<li>提供分布式与集中式部署的无缝切换</li>
<li>提供类似JPA功能包含数据缓存自动同步、分表分库与简洁的数据层操作接口</li>
<li>可以动态修改已依赖注入的资源</li>
</ol>
# [Redkale 2.8](https://redkale.org) <img src="docs/images/logo.png" alt="redkale" width="100" align="right"/>
<strong>Redkale 设计理念</strong>
<p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;作为一个全新的微服务框架Redkale在接口定义上使用了Java 8以上版本的大量新特性接口有默认实现、接口带静态方法、重复注解等特性同时在设计上与主流框架有很大不同。Redkale是按组件形式设计的而非以容器为主几乎每个子包都是能提供独立功能的组件。如Tomcat是按容器设计的所有web资源/配置由Tomcat控制开发者很能难控制到Tomcat内部而Redkale的HTTP服务只是个组件开发者既可以自己启动和配置HttpServer也可以把Redkale当成容器通过Redkale进程来初始化服务。Spring的Ioc容器也是如此Redkale提供的依赖注入仅通过ResouceFactory一个类来控制非常轻量并且可动态更改已注入的资源。Spring提倡控制反转思想而自身的容器却让开发者很难控制。Redkale是一个既能以组件形式也能以容器形式存在的框架。从整体上看Redkale的架构分两层接口和默认实现。开发者若想替换掉Redkale内置的HTTP服务而使用符合JavaEE规范的HttpServlet, 可以采用自定义协议基于JSR 340(Servlet 3.1)来实现自己的HTTP服务若想使用Hibernate作为数据库操作可以写一个自己的DataSource实现类JSON的序列化和反序列化也可以使用第三方的实现Memcached或Redis也可以作为另一个CacheSource的实现替换Redkale的默认实现。这其实包含了控制反转的思想让框架里的各个组件均可让开发者控制。<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;与主流框架比功能上Redkale显得很简单这体现了Redkale的简易性而并非是不足从一个良好的设计习惯或架构上来看有些常用功能是不需要提供的如Redkale的HTTP服务不支持JSP, JSP其实算是一个落后的技术现在是一个多样化终端的时代终端不只局限于桌面程序和PC浏览器还有原生App、混合式App、微信端、移动H5、提供第三方接口等各种形式的终端这些都不是JSP能方便兼顾的而HTTP+JSON作为通用性接口可以避免重复开发模版引擎的功能加上各种强大的JS框架足以取代JSP。Redkale在功能上做了筛选不会为了迎合主流而提供而是以良好的设计思想为指导。这是Redkale的主导思维
</p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>详情请访问:&nbsp;&nbsp;&nbsp;&nbsp;<a href='https://redkale.org' target='_blank'>https://redkale.org</a></b>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>基本文档:&nbsp;&nbsp;&nbsp;&nbsp;<a href='https://redkale.org/articles.html' target='_blank'>https://redkale.org/articles.html</a></b>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>欢迎加入Redkale QQ群: 527523235</b>
&nbsp;
## 简介
&emsp;&emsp;Redkale (中文名: 红菜苔,一种湖北特产蔬菜) 是基于Java 11全新的微服务框架 包含HTTP、WebSocket、TCP/UDP、数据序列化、数据缓存、依赖注入等功能。 本框架致力于简化集中式和微服务架构的开发,在增强开发敏捷性的同时保持高性能
主要特点::
* 提供了动态依赖注入和动态字节码生成类功能
* 提供HTTP服务同时内置JSON功能与限时缓存功能
* TCP层完全使用NIO并统一TCP与UDP的接口换
* 提供分布式与集中式部署的无缝切换
* 提供类似JPA功能包含数据缓存自动同步、分表分库与简洁的数据层操作接口
* 提供了MQ消息消费与生产简洁化API
## 版本
```xml
<dependency>
<groupId>org.redkale</groupId>
<artifactId>redkale</artifactId>
<version>2.8.0</version>
</dependency>
```
## 开发文档
* [快速入门](docs/quick-start.md)
* [Service组件](docs/service.md)
* [序列化](docs/convert.md)
* [DB数据源组件](docs/datasource.md)
* [Cache数据源组件](docs/cachesource.md)
* [WebSocket](docs/websocket.md)
* [native-image](docs/native-image.md)
* [方法缓存Cached](docs/cached.md)
* [定时任务Scheduled](docs/scheduled.md)
* [消息队列MQ](docs/agent-message.md)
* [基本配置](docs/config.md)
* [FAQ](docs/faq.md)
## 设计理念
&emsp;&emsp;作为一个全新的微服务框架Redkale在接口定义上使用了默认实现、接口带静态方法、重复注解等特性同时在设计上与主流框架有很大不同。Redkale是按组件形式设计的而非以容器为主几乎每个子包都是能提供独立功能的组件。如Tomcat是按容器设计的所有web资源/配置由Tomcat控制开发者很能难控制到Tomcat内部而Redkale的HTTP服务只是个组件开发者既可以自己启动和配置HttpServer也可以把Redkale当成容器通过Redkale进程来初始化服务。Spring的Ioc容器也是如此Redkale提供的依赖注入仅通过ResouceFactory一个类来控制非常轻量并且可动态更改已注入的资源。Spring提倡控制反转思想而自身的容器却让开发者很难控制。Redkale是一个既能以组件形式也能以容器形式存在的框架。从整体上看Redkale的架构分两层接口和默认实现。开发者若想替换掉Redkale内置的HTTP服务而使用符合JavaEE规范的HttpServlet, 可以采用自定义协议基于JSR 340(Servlet 3.1)来实现自己的HTTP服务若想使用Hibernate作为数据库操作可以写一个自己的DataSource实现类JSON的序列化和反序列化也可以使用第三方的实现Memcached或Redis也可以作为另一个CacheSource的实现替换Redkale的默认实现。这其实包含了控制反转的思想让框架里的各个组件均可让开发者控制。
&emsp;&emsp;与主流框架比功能上Redkale显得很简单这体现了Redkale的简易性而并非是不足从一个良好的设计习惯或架构上来看有些常用功能是不需要提供的如Redkale的HTTP服务不支持JSP, JSP其实算是一个落后的技术现在是一个多样化终端的时代终端不只局限于桌面程序和PC浏览器还有原生App、混合式App、微信端、移动H5、提供第三方接口等各种形式的终端这些都不是JSP能方便兼顾的而HTTP+JSON作为通用性接口可以避免重复开发模版引擎的功能加上各种强大的JS框架足以取代JSP。Redkale在功能上做了筛选不会为了迎合主流而提供而是以良好的设计思想为指导。这是Redkale的主导思维。
&emsp;&emsp;&emsp;<b>详情请访问:&emsp;&emsp;<a href='https://redkale.org' target='_blank'>https://redkale.org</a></b>
&emsp;&emsp;&emsp;<b>基本文档:&emsp;&emsp;<a href='https://redkale.org/articles.html' target='_blank'>https://redkale.org/articles.html</a></b>
&emsp;&emsp;&emsp;<b>欢迎加入Redkale QQ群: 527523235</b>
&nbsp;

View File

@@ -2,11 +2,9 @@
<application nodeid="10000" port="2020">
<resources>
<properties load="config.properties">
<property name="system.property.redkale.convert.protobuf.enumtostring" value="true"/>
</properties>
</resources>
<properties load="config.properties">
<property name="system.property.redkale.convert.protobuf.enumtostring" value="true"/>
</properties>
<server protocol="HTTP" port="5050">
<request>

View File

@@ -6,6 +6,15 @@
### true: auto ddl;
#redkale.datasource[platf].table-autoddl = true
############ DataSource @Resource(name="user") ############
#redkale.datasource[user].read.url = jdbc:mysql://127.0.0.1:3306/user_r?allowPublicKeyRetrieval=true&amp;rewriteBatchedStatements=true&amp;serverTimezone=UTC&amp;characterEncoding=utf8
#redkale.datasource[user].read.user = root
#redkale.datasource[user].read.password = 12345678
#redkale.datasource[user].write.url = jdbc:mysql://127.0.0.1:3306/user_w?allowPublicKeyRetrieval=true&amp;rewriteBatchedStatements=true&amp;serverTimezone=UTC&amp;characterEncoding=utf8
#redkale.datasource[user].write.user = root
#redkale.datasource[user].write.password = 12345678
############ CacheSource @Resource(name="usersession") ############
#redkale.cachesource[usersession].node[0].url = redis://127.0.0.1:6363

2
docs/agent-cluster.md Normal file
View File

@@ -0,0 +1,2 @@
# 服务管理
文档完善中……

104
docs/agent-message.md Normal file
View File

@@ -0,0 +1,104 @@
# 消息队列
&emsp;&emsp; MessageAgent是消息中心抽象接口。
## 配置
```xml
<mq name="mymq" type="kafka">
<servers value="127.0.0.1:9092"/>
<consumer autoload="true"/>
</mq>
```
## 消费消息
&emsp;&emsp; 通过```@ResourceConsumer```和```MessageConsumer```接口实现消费
```java
@ResourceConsumer(mq = "mymq", topics = "test_bean_topic")
public class TestMessageConsumer implements MessageConsumer<TestBean> {
@Override
public void init(AnyValue config) {
System.out.println("执行 TestMessageConsumer.init");
}
@Override
public void onMessage(MessageEvent<TestBean>[] events) {
for (MessageEvent<TestBean> event : events) {
System.out.println("消费消息, message: " + event.getMessage());
}
}
@Override
public void destroy(AnyValue config) {
System.out.println("执行 TestMessageConsumer.destroy");
}
}
```
&emsp;&emsp;通过Service里标记```@Messaged```的方法实现消费, 方法只能是```protected```或```public``` 不能是```final```、```static```。
```java
public class TestMessageService extends AbstractService {
@Messaged(mq = "mymq", topics = "test_bean_topic")
protected void runMessage(MessageEvent<TestBean>[] events) {
for (MessageEvent<TestBean> event : events) {
System.out.println("消费消息, message: " + event.getMessage());
}
}
}
```
&emsp;&emsp;通过```@Component```的Service里标记```@Messaged```的方法实现消费, 方法只能是```public```。
```java
@Component
public final class TestMessageService extends AbstractService {
@Messaged(mq = "mymq", topics = "test_bean_topic")
public int runMessage(MessageEvent<TestBean>[] events) {
for (MessageEvent<TestBean> event : events) {
System.out.println("消费消息, message: " + event.getMessage());
}
return 0;
}
}
```
## 生产消息
&emsp;&emsp;通过```@Component```的Service里标记```@Messaged```的方法实现消费, 方法只能是```public```。
```java
@Component
public class TestMessageService extends AbstractService {
@ResourceProducer(mq = "mymq")
private MessageProducer producer;
public void sendMessage() {
TestBean bean = new TestBean(12345, "this is a message");
System.out.println("生产消息: " + bean);
producer.sendMessage("test_bean_topic", bean);
}
}
```
## Topic管理
&emsp;&emsp;通过```MessageManager```操作topic。
```java
public class TestMessageManager extends AbstractService {
@Resource(name = "mymq")
private MessageManager manager;
// 创建topic
public void initTopic() {
manager.createTopic("topic_1", "topic_2").join();
}
// 删除topic
public void deleteTopic() {
manager.deleteTopic("topic_1", "topic_2").join();
}
// 查询topic
public void printTopic() {
List<String> topics = manager.queryTopic().join();
}
}
```

2
docs/agent-properties.md Normal file
View File

@@ -0,0 +1,2 @@
# 配置中心
文档完善中……

123
docs/cached.md Normal file
View File

@@ -0,0 +1,123 @@
# 方法缓存
&emsp;&emsp;@Cached注解在Service的方法上,实现对方法结果进行缓存。
&emsp;&emsp;&emsp;&emsp; 1、返回类型不能是```void```/```CompletableFuture<Void>```<br>
&emsp;&emsp;&emsp;&emsp; 2、返回类型必须是可json序列化的 <br>
&emsp;&emsp;&emsp;&emsp; 3、修饰必须是```protected```/```public``` <br>
&emsp;&emsp;&emsp;&emsp; 4、修饰不能是```final```/```static``` <br>
&emsp;&emsp;本地缓存和远程缓存可同时设置,```expire```设置为0表示永不过期, 支持异步方法(返回类型为```CompletableFuture```)。
## 属性说明
|属性|默认值|说明|
| --- | --- | --- |
|name|未定义|缓存的名称|
|key|未定义|缓存的key支持参数动态组合比如"key_#{id}"|
|manager|空|缓存管理器名称, 不能含有':'、'#'、'@'字符|
|localLimit|-1|本地缓存数量上限, 小于1表示无上限。 <br> 参数值支持方式:<br> &emsp;100: 设置数值 <br> &emsp;${env.cache.limit}: 读取系统配置项 |
|localExpire|-1|本地缓存过期时长, 0表示永不过期 -1表示不作本地缓存。 <br> 参数值支持方式:<br> &emsp;100: 设置数值 <br> &emsp;${env.cache.expires}: 读取系统配置项 |
|remoteExpire|-1|远程缓存过期时长, 0表示永不过期 -1表示不作远程缓存。 <br> 参数值支持方式:<br> &emsp;100: 设置数值 <br> &emsp;${env.cache.expires}: 读取系统配置项 |
|nullable|false|是否可以缓存null值|
|timeUnit|```TimeUnit.SECONDS```|时间单位TimeUnit|
|comment|未定义|备注描述|
|mode|```LoadMode.ANY```|作用于Service模式默认值为ANY作用于所有模式Service<br> LOCAL: 表示远程模式的Service对象中的缓存功能不起作用|
## 基本用法
&emsp;&emsp;将结果进行本地缓存30秒且远程缓存60秒
```java
@Cached(name = "name", key = "name", localExpire = "30", remoteExpire = "60")
public String getName() {
return "haha";
}
```
&emsp;&emsp;以参数code为key将结果进行本地缓存(时长由环境变量```env.cache.expire```配置没配置采用默认值30秒)
```java
@Cached(name = "name", key = "#{code}", localExpire = "${env.cache.expire:30}")
public CompletableFuture<String> getNameAsync(String code) {
return redis.getStringAsync(code);
}
```
&emsp;&emsp;以参数code+map.id为key将结果进行远程缓存60毫秒
```java
@Resource
private CachedManager cachedManager;
//实时修改远程缓存的key值
public void updateName(String code, Map<String, Long> map) {
cachedManager.remoteSetString("name", code + "_" + map.get("id"), code + "-" + map, Duration.ofMillis(60));
}
@Cached(name = "name", key = "#{code}_#{map.id}", remoteExpire = "60", timeUnit = TimeUnit.MILLISECONDS)
public String getName(String code, Map<String, Long> map) {
return code + "-" + map;
}
```
## 动态调整缓存时长
&emsp;&emsp;使用```@Resource```注入多个```CachedManager```
```java
@Resource
private CachedManager cachedManager;
@Cached(name = "name", key = "#{code}_#{map.id}", remoteExpire = "60", timeUnit = TimeUnit.MILLISECONDS)
public String getName(String code, Map<String, Long> map) {
return code + "-" + map;
}
public void updateExpire() {
Duration expire = Duration.ofMillis(600);
cachedManager.acceptCachedAction("name", action -> {
//将缓存时长改成600毫秒并开启本地缓存
action.setLocalExpire(expire);
action.setRemoteExpire(expire);
});
}
```
## 缓存配置
```xml
<!--
全局Serivce的缓存设置没配置该节点将自动创建一个。
name: 缓存管理器的名称, 默认: ""
enabled 是否开启缓存功能。默认: true
remote: 远程CacheSource的资源名
broadcastable: 存在远程CacheSource时修改数据是否进行广播到其他集群服务中。默认: true
-->
<cached name="" enabled="true" remote="xxx" broadcastable="true"/>
```
## 多缓存器
```xml
<cached name="" enabled="true" remote="redis_1" broadcastable="true"/>
<cached name="backup" enabled="true" remote="redis_2" broadcastable="true"/>
```
&emsp;&emsp;使用```@Resource```注入多个```CachedManager```
```java
//第一个缓存器
@Resource
private CachedManager cachedManager;
//第二个缓存器
@Resource(name = "backup")
private CachedManager cachedManager2;
//第一个缓存器实时修改远程缓存的key值
public void updateName(String code, Map<String, Long> map) {
cachedManager.remoteSetString("name", code + "_" + map.get("id"), code + "-" + map, Duration.ofMillis(60));
}
//使用第一个缓存器
@Cached(name = "name", key = "#{code}_#{map.id}", remoteExpire = "60", timeUnit = TimeUnit.MILLISECONDS)
public String getName(String code, Map<String, Long> map) {
return code + "-" + map;
}
//使用第二个缓存器
@Cached(manager = "backup", name = "name", key = "#{code}_#{map.id}_2", remoteExpire = "60", timeUnit = TimeUnit.MILLISECONDS)
public String getName2(String code, Map<String, Long> map) {
return code + "-" + map;
}
```

58
docs/cachesource.md Normal file
View File

@@ -0,0 +1,58 @@
# 缓存组件 CacheSource
&emsp;&emsp;```CachedCacheSource```是框架主要的缓存组件主要提供redis和内存两大实现接口大部分与redis命令保持一致。
## 使用CacheSouce存放登录会话
```java
public class UserService implements Service {
//用户简单信息缓存
private final Map<Integer, UserInfo> users = new ConcurrentHashMap<>();
//使用CacheSource必须要指明泛型
@Resource(name = "usersessions")
protected CacheSource sessions;
//登录
public RetResult<UserInfo> login(LoginBean bean) { //bean.sessionid 在接入层进行赋值
UserInfo user = null;
// 登陆逻辑 user = ...
users.put(user.getUserid(), user);
sessions.setLong(600, bean.getSessionid(), user.getUserid()); //session过期时间设置为10分钟
return new RetResult<>(user);
}
//获取当前用户信息
public UserInfo current(String sessionid) { //给HTTP的BaseServlet用
Long userid = sessions.getexLong(sessionid, 600);
return userid == null ? null : users.get(userid.intValue());
}
//注销
public void logout(String sessionid) {
sessions.del(sessionid);
}
}
```
## source.properties 配置说明
```
# usersession为@Resource.name值
# type可以不用设置框架会根据url判断使用哪个CacheSource实现类
redkale.cachesource.usersession.type = org.redkalex.cache.redis.RedisCacheSource
# 最大连接数
redkale.cachesource.usersession.maxconns = 16
# 节点地址
redkale.cachesource.usersession.nodes = redis://127.0.0.1:6363
# 节点密码
redkale.cachesource.usersession.password = 12345678
# 节点db
redkale.cachesource.usersession.db = 0
#简化写法: 可以不用.node[0], 将参数都合并到url中
redkale.cachesource.usersession.url = redis://user:123456@127.0.0.1:6363?db=0
@Resource.name=""的CacheSource
redkale.cachesource.nodes = redis://127.0.0.1:6363
redkale.cachesource.password = 12345678
```

463
docs/config.md Normal file
View File

@@ -0,0 +1,463 @@
# 配置说明
# application.xml 配置:
```xml
<!--
文件说明:
${APP_HOME} 指当前程序的根目录APP_HOME
没注明唯一的节点可多个存在
required 被声明required的属性值不能为空
-->
<!--
nodeid: int 进程的节点ID用于分布式环境一个系统中节点ID必须全局唯一使用cluster时框架会进行唯一性校验
name: 进程的名称,用于监控识别,命名规则: 字母、数字、下划线、短横、点
address: 本地局域网的IP地址 默认值为默认网卡的ip当不使用默认值需要指定值如192.168.1.22
port: required 程序的管理Server的端口用于关闭或者与监管系统进行数据交互
lib: 加上额外的lib路径,多个路径用分号;隔开; 默认为空。 例如: ${APP_HOME}/lib/a.jar;${APP_HOME}/lib2/b.jar;
-->
<application nodeid="1000" port="6560" lib="">
<!--
【节点全局唯一】 @since 2.3.0
全局Serivce执行的线程池 Application.workExecutor, 没配置该节点将自动创建一个。
threads 线程数,默认值: CPU核数*10, 核数=2的情况下默认值为20。值为0表示不启用workExecutor都在IO线程中运行。
clients client回调函数运行的线程池大小 默认值: CPU核数*4
-->
<executor threads="4"/>
<!--
【节点全局唯一】 @since 2.8.0
全局Serivce的定时任务设置没配置该节点将自动创建一个。
enabled 是否开启缓存功能。默认: true
-->
<scheduled enabled="true"/>
<!--
@since 2.8.0
全局Serivce的缓存设置没配置该节点将自动创建一个。
name: 缓存管理器的名称, 默认: ""
enabled 是否开启缓存功能。默认: true
remote: 远程CacheSource的资源名
broadcastable: 存在远程CacheSource时修改数据是否进行广播到其他集群服务中。默认: true
-->
<cached name="" enabled="true" remote="xxx" broadcastable="true"/>
<!--
【节点全局唯一】
第三方服务发现管理接口
type 类名必须是org.redkale.cluster.ClusterAgent的子类
waits: 注销服务后是否需要等待检查周期时间后再进行Service销毁默认值为false
当一个Service进行服务注销后不能立刻销毁Service因为健康检测是有间隔时间差的
需要等待一个健康检测周期时间,让其他进程都更新完服务列表。
如果使用MQ可以设置为false如果对服务健壮性要求高建议设置为true
protocols: 服务发现可以处理的协议, 默认值为: SNCP, 多个协议用分号;隔开
ports: 服务发现可以处理的端口, 多个端口用分号;隔开
ttls: 心跳频率,多少秒一次
xxxx: 自定义的字段属性例如CacheClusterAgent有source字段; ConsulClusterAgent有apiurl字段;
-->
<cluster type="org.redkalex.cluster.consul.ConsulClusterAgent" waits="false" protocols="SNCP" ports="7070;7071" xxx="xxx" />
<!--
MQ管理接口配置
不同MQ节点所配置的MQ集群不能重复。
MQ跟着协议走所以mq的属性值需要被赋值在rest节点上, 由于SncpServlet是自动生成的故SNCP协议下mq属性值被赋值在service/services节点上
name: 服务的名称用于监控识别多个mq节点时只能有一个name为空的节点mq.name不能重复,命名规则: 字母、数字、下划线
type 实现类名必须是org.redkale.mq.MessageAgent的子类
threads 线程数为0表示使用workExecutor。默认: CPU核数, 核数=1的情况下默认值为2JDK 21以上版本默认使用虚拟线程池
rpcfirstcluster和mq同名组件时HttpRpcClient优先使用MQ默认不优先走MQ。
coder: MessageRecord的解析器类必须是org.redkale.mq.MessageCoder<MessageRecord>的实现类,
可对数据包进行加密解密默认值org.redkale.mq.MessageRecordCoder
MQ节点下的子节点配置没有固定格式, 根据MessageAgent实现方的定义来配置
-->
<mq name="" type="org.redkalex.mq.kafka.KafkaMessageAgent" rpcfirst="false" threads="4">
<servers value="127.0.0.1:9101"/>
<!--
加载所有的MessageConsumer实例;
autoload="true" 默认值. 自动加载classpath下所有的MessageConsumer类
autoload="false" 需要显著的指定MessageConsumer类
includes 当autoload="true" 拉取类名与includes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
excludes 当autoload="true" 排除类名与excludes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
-->
<consumer autoload="true" includes="" excludes=""/>
<!--
MQ实现方的配置项
type: 配置项类型值只能是consumer或producer
-->
<config type="consumer">
<property name="xxxxxx" value="XXXXXXXX"/>
</config>
<config type="producer">
<property name="xxxxxx" value="XXXXXXXX"/>
</config>
</mq>
<!--
一个组包含多个node 同一Service服务可以由多个进程提供这些进程称为一个GROUP且同一GROUP内的进程必须在同一机房或局域网内
name: 服务组ID长度不能超过11个字节. 默认为空字符串。 注意: name不能包含$符号。
protocol 值范围UDP TCP 默认TCP
nodes: 多个node节点值 例如:192.168.0.1:6060,192.168.0.2:6060
注意: 一个node只能所属一个group。只要存在protocol=SNCP的Server节点信息 就必须有group节点信息。
-->
<group name="" protocol="TCP" nodes="192.168.0.1:6060,192.168.0.2:6060">
<!--
需要将本地node的addr与port列在此处, 也可以直接用nodes属性。
同一个<node>节点值只能存在一个<group>节点内即同一个addr+port只能属于一个group。
addr: required IP地址
port: required 端口
-->
<node addr="127.0.0.1" port="7070"/>
</group>
<!--
Application启动的监听事件,可配置多个节点
value: 类名必须是ApplicationListener的子类
-->
<listener value="org.redkalex.xxx.XXXApplicationListener"/>
<!--
【节点全局唯一】
全局的参数配置, 可以通过@Resource(name="property.xxxxxx") 进行注入<property>的信息, 被注解的字段类型只能是String、primitive class
如果name是system.property.开头的值将会在进程启动时进行System.setProperty("yyyy", "YYYYYY")操作。
如果name是mimetype.property.开头的值将会在进程启动时进行MimeType.add("yyyy", "YYYYYY")操作。
先加载子节点property再加载load文件 最后加载agent的实现子类。
load: 加载文件,多个用;隔开。
其他属性: 供org.redkale.boot.PropertiesAgentProvider使用判断
默认置入的system.property.的有:
System.setProperty("redkale.convert.pool.size", "128");
System.setProperty("redkale.convert.writer.buffer.defsize", "4096");
<properties>节点下也可包含非<property>节点.
非<property>其节点可以通过@Resource(name="properties.xxxxxx")进行注入, 被注解的字段类型只能是AnyValue、AnyValue[]
-->
<properties load="config.properties">
<property name="system.property.yyyy" value="YYYYYY"/>
<property name="xxxxxx" value="XXXXXXXX"/>
<property name="xxxxxx" value="XXXXXXXX"/>
<property name="xxxxxx" value="XXXXXXXX"/>
</properties>
<!--
protocol: required server所启动的协议Redkale内置的有HTTP、SNCP、WATCH。协议均使用TCP实现; WATCH服务只能存在一个。
name: 服务的名称用于监控识别一个配置文件中的server.name不能重复,命名规则: 字母、数字、下划线
host: 服务所占address 默认: 0.0.0.0
port: required 服务所占端口
root: 如果是web类型服务则包含页面 默认:{APP_HOME}/root
lib: server额外的class目录 默认为${APP_HOME}/libs/*;
charset: 文本编码, 默认: UTF-8
backlog: 默认10K
maxconns 最大连接数, 小于1表示无限制 默认: 0
maxbody: request.body最大值 默认: 256K
bufferCapacity: ByteBuffer的初始化大小 TCP默认: 32K; (HTTP 2.0、WebSocket必须要16k以上); UDP默认: 8K
bufferPoolSize ByteBuffer池的大小默认: 线程数*4
responsePoolSize Response池的大小默认: 1024
aliveTimeoutSeconds: KeepAlive读操作超时秒数 默认30 0表示永久不超时; -1表示禁止KeepAlive
readTimeoutSeconds: 读操作超时秒数, 默认0 0表示永久不超时
writeTimeoutSeconds: 写操作超时秒数, 默认0 0表示永久不超时
interceptor: 启动/关闭NodeServer时被调用的拦截器实现类必须是org.redkale.boot.NodeInterceptor的子类默认为null
-->
<server protocol="HTTP" host="127.0.0.1" port="6060" root="root" lib="">
<!--
【节点在<server>中唯一】
builder: 创建SSLContext的实现类, 可自定义必须是org.redkale.net.SSLBuilder的子类
sslProvider: java.security.Provider自定义的实现类如第三方: org.conscrypt.OpenSSLProvider、org.bouncycastle.jce.provider.BouncyCastleProvider
jsseProvider: java.security.Provider自定义的实现类如第三方: org.conscrypt.JSSEProvider、 org.bouncycastle.jce.provider.BouncyCastleJsseProvider
protocol: TLS版本默认值: TLS
protocols: 设置setEnabledProtocols, 多个用,隔开 如: TLSv1.2,TLSv1.3
clientAuth: WANT/NEED/NONE, 默认值: NONE
ciphers: 设置setEnabledCipherSuites, 多个用,隔开 如: TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA256
keystorePass: KEY密码
keystoreFile: KEY文件 .jks
keystoreType: KEY类型 默认值为JKS
keystoreAlgorithm: KEY文件的algorithm 默认值为SunX509
truststorePass: TRUST密码
truststoreFile: TRUST文件
truststoreType: TRUST类型 默认值为JKS
truststoreAlgorithm: TRUST文件的algorithm 默认值为SunX509
-->
<ssl builder=""/>
<!--
加载所有的Service服务;
在同一个进程中同一个name同一类型的Service将共用同一个实例
autoload="true" 默认值. 自动加载classpath下所有的Service类
autoload="false" 需要显著的指定Service类
mq: 所属的MQ管理器当 protocol == SNCP 时该值才有效, 存在该属性表示Service的SNCP协议采用消息总线代理模式
includes 当autoload="true" 拉取类名与includes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
excludes 当autoload="true" 排除类名与excludes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
group: 所属组的节点, 不能指定多个group, 如果配置文件中存在多个SNCP协议的Server节点需要显式指定group属性.
当 protocol == SNCP 时 group表示当前Server与哪些节点组关联。
当 protocol != SNCP 时 group只能是空或者一个group的节点值。
特殊值"$remote", 视为通过第三方服务注册发现管理工具来获取远程模式的ip端口信息
-->
<services autoload="true" includes="" excludes="">
<!-- 显著加载指定的Service的接口类 -->
<service value="com.xxx.XXX1Service"/>
<!--
name: 显式指定name覆盖默认的空字符串值。 注意: name不能包含$符号。
mq: 所属的MQ管理器当 protocol == SNCP 时该值才有效, 存在该属性表示Service的SNCP协议采用消息总线代理模式
group: 显式指定group覆盖<services>节点的group默认值。
ignore: 是否禁用, 默认为false。
-->
<service value="com.xxx.XXX2Service" name="" group="xxx"/>
<!-- 给Service增加配置属性 -->
<service value="com.xxx.XXX1Service">
<!-- property值在public void init(AnyValue conf)方法中可以通过AnyValue properties=conf.getAnyValue("properties")获取 -->
<property name="xxxxxx" value="XXXXXXXX"/>
<property name="xxxxxx" value="XXXXXXXX"/>
</service>
</services>
<!--
加载所有的Filter服务;
autoload="true" 默认值.
autoload="false" 需要显著的指定Filter类
includes 当autoload="true" 拉取类名与includes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
excludes 当autoload="true" 排除类名与excludes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
-->
<filters autoload="true" includes="" excludes="">
<!--
显著加载指定的Filter类
value=: Filter类名。必须与Server的协议层相同HTTP必须是HttpFilter
ignore: 是否禁用, 默认为false。
-->
<!-- 显著加载指定的Filter类 -->
<filter value="com.xxx.XXX1Filter"/>
<!-- 给Filter增加配置属性 -->
<filter value="com.xxx.XXX12Filter">
<!-- property值在public void init(AnyValue conf)方法中可以通过AnyValue properties=conf.getAnyValue("properties")获取 -->
<property name="xxxxxx" value="XXXXXXXX"/>
<property name="xxxxxx" value="XXXXXXXX"/>
</filter>
</filters>
<!--
REST的核心配置项
当Server为HTTP协议时, rest节点才有效。存在[rest]节点则Server启动时会加载REST服务, 节点可以多个,(WATCH协议不需要设置系统会自动生成)
path: servlet的ContextPath前缀 默认为空 【注: 开启MQ时,该字段失效】
base: REST服务的BaseServlet必须是 org.redkale.net.http.HttpServlet 的子类,且子类必须标记@HttpUserType。
mq: 所属的MQ管理器, 存在该属性表示RestService的请求来自于消息总线 【注: 开启MQ时,path字段失效】
autoload默认值"true" 默认值. 加载当前server所能使用的Servce对象;
includes当autoload="true" 拉取类名与includes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
excludes当autoload="true" 排除类名与excludes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
-->
<rest path="/pipes" base="org.redkale.net.http.HttpServlet" autoload="true" includes="" excludes="">
<!--
value: Service类名列出的表示必须被加载的Service对象
ignore: 是否忽略设置为true则不会加载该Service对象默认值为false
-->
<service value="com.xxx.XXXXService"/>
<!--
value: WebSocket类名列出的表示必须被加载且标记为@RestWebSocket的WebSocket对象
ignore: 是否忽略设置为true则不会加载该RestWebSocket对象默认值为false
-->
<websocket value="com.xxx.XXXXRestWebSocket"/>
</rest>
<!--
【节点在<server>中唯一】
当Server为HTTP协议时, request节点才有效。
remoteaddr 节点: 替换请求方节点的IP地址 通常请求方是由nginx等web静态服务器转发过的则需要配置该节点。
且value值只能是以request.headers.开头表示从request.headers中获取对应的header值。
locale value值必须是request.headers.或request.parameters.开头。
例如下面例子获取request.getRemoteAddr()值如果header存在X-RemoteAddress值则返回X-RemoteAddress值不存在返回getRemoteAddress()。
-->
<request>
<remoteaddr value="request.headers.X-RemoteAddress"/>
<locale value="request.headers.locale" />
<rpc authenticator="org.redkale.net.http.HttpRpcAuthenticator的实现类"/>
</request>
<!--
【节点在<server>中唯一】
当Server为HTTP协议时, response节点才有效。
contenttype: plain值为调用finish时的ContentType; 默认值: text/plain; charset=utf-8
json值为调用finishJson时的ContentType; 默认值: application/json; charset=utf-8
defcookie 节点: 当response里输出的cookie没有指定domain 和path时使用该节点的默认值。
addheader、setheader 的value值以request.parameters.开头则表示从request.parameters中获取对应的parameter值
addheader、setheader 的value值以request.headers.开头则表示从request.headers中获取对应的header值
例如下面例子是在Response输出header时添加两个header一个addHeader 一个setHeader
options 节点: 设置了该节点且auto=true当request的method=OPTIONS自动设置addheader、setheader并返回200状态码
date 节点: 设置了该节点且period有值(单位:毫秒);返回response会包含Date头信息默认为period=0
period=0表示实时获取当前时间;
period<0表示不设置date;
period>0表示定时获取时间; 设置1000表示每秒刷新Date时间
-->
<response>
<content-type plain="text/plain; charset=utf-8" json="application/json; charset=utf-8"/>
<defcookie domain="" path=""/>
<addheader name="Access-Control-Allow-Origin" value="request.headers.Origin" /> <!-- 可多节点 -->
<setheader name="Access-Control-Allow-Headers" value="request.headers.Access-Control-Request-Headers"/> <!-- 可多节点 -->
<setheader name="Access-Control-Allow-Credentials" value="true"/>
<options auto="true" />
<date period="0" />
</response>
<!--
【节点在<server>中唯一】
当Server为HTTP协议时render才有效. 指定输出引擎的实现类
value: 输出引擎的实现类, 必须是org.redkale.net.http.HttpRender的子类
suffixs: 引擎文件名后缀,多个用;隔开,默认值为: .htel
-->
<render value="org.redkalex.htel.HttpTemplateRender" suffixs=".htel"/>
<!--
【节点在<server>中唯一】
当Server为HTTP协议时ResourceServlet才有效. 默认存在一个有默认属性的resource-servlet节点
webroot: web资源的根目录, 默认取server节点中的root值
servlet: 静态资源HttpServlet的实现默认使用HttpResourceServlet
index : 启始页默认值index.html
-->
<resource-servlet webroot="root" index="index.html">
<!--
【节点在<resource-servlet>中唯一】
资源缓存的配置, 默认存在一个含默认属性的caches节点
limit: 资源缓存最大容量, 默认: 0, 为0表示不缓存 单位可以是B、K、M、G不区分大小写
lengthmax: 可缓存的文件大小上限, 默认: 1M超过1M的文件不会被缓存
watch: 是否监控缓存文件的变化, 默认为false不监控
-->
<cache limit="0M" lengthmax="1M" watch="false"/>
<!--
支持类似nginx中的rewrite 目前只支持静态资源对静态资源的跳转。
type: 匹配的类型, 目前只支持location(匹配path), 默认: location
match: 匹配的正则表达式
forward: 需跳转后的资源链接
例如下面例子是将/xxx-yyy.html的页面全部跳转到/xxx.html
-->
<rewrite type="location" match="^/([^-]+)-[^-\.]+\.html(.*)" forward="/$1.html"/>
</resource-servlet>
<!--
加载所有的Servlet服务;
path: servlet的ContextPath前缀 默认为空
autoload="true" 默认值. 自动加载classpath下所有的Servlet类
autoload="false" 需要显著的指定Service类
includes 当autoload="true" 拉取类名与includes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
excludes 当autoload="true" 排除类名与excludes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
-->
<servlets path="/pipes" autoload="true" includes="" excludes="">
<!--
显著加载指定的Servlet类
value=: Servlet类名。必须与Server的协议层相同HTTP必须是HttpServlet
ignore: 是否禁用, 默认为false。
-->
<servlet value="com.xxx.XXX1Servlet" />
<servlet value="com.xxx.XXX2Servlet" />
<servlet value="com.xxx.XXX3Servlet" >
<property name="xxxxxx" value="XXXXXXXX"/>
<property name="yyyyyy" value="YYYYYYYY"/>
</servlet>
</servlets>
</server>
<server protocol="SNCP" host="127.0.0.1" port="7070" root="root" lib="">
<!-- 参数完全同上 -->
<services autoload="true" includes="" excludes="" />
</server>
</application>
```
# source.properties 配置:
```properties
# CacheSource @Resource(name="usersession")
# type可以不用设置框架会根据url判断使用哪个CacheSource实现类
redkale.cachesource.usersession.type = org.redkalex.cache.redis.RedisCacheSource
# 最大连接数
redkale.cachesource.usersession.maxconns = 16
# 节点地址
redkale.cachesource.usersession.nodes = redis://127.0.0.1:6363
# 节点密码
redkale.cachesource.usersession.password = 12345678
# 节点db
redkale.cachesource.usersession.db = 0
#简化写法: 可以不用.node[0], 将参数都合并到url中
redkale.cachesource.usersession.url = redis://user:123456@127.0.0.1:6363?db=0
# DataSource @Resource(name="platf")
# type可以不用设置框架会根据url判断使用哪个DataSource实现类默认值: org.redkale.source.DataJdbcSource
redkale.datasource.platf.type = org.redkale.source.DataJdbcSource
# 是否开启缓存(标记为@Cacheable的Entity类),值目前只支持两种: ALL: 所有开启缓存。 NONE: 关闭所有缓存, 非NONE字样统一视为ALL
redkale.datasource.platf.cachemode = ALL
# 是否自动建表当表不存在的时候, 目前只支持mysql、postgres 默认为false
redkale.datasource.platf.table-autoddl = false
# 用户
redkale.datasource.platf.user = root
# 密码
redkale.datasource.platf.password = 12345678
# 多个URL用;隔开如分布式SearchSource需要配多个URL
redkale.datasource.platf.url = jdbc:mysql://127.0.0.1:3306/platf?allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&serverTimezone=UTC&characterEncoding=utf8
# 最大连接数默认值CPU数
redkale.datasource.platf.maxconns = 16
# 包含的SQL模板相当于反向LIKE不同的JDBC驱动的SQL语句不一样Redkale内置了MySQL的语句
redkale.datasource.platf.contain-sqltemplate = LOCATE(#{keystr}, #{column}) > 0
# 包含的SQL模板相当于反向LIKE不同的JDBC驱动的SQL语句不一样Redkale内置了MySQL的语句
redkale.datasource.platf.notcontain-sqltemplate = LOCATE(#{keystr}, #{column}) = 0
# 复制表结构的SQL模板Redkale内置了MySQL的语句
redkale.datasource.platf.tablenotexist-sqlstates = 42000;42S02
# 复制表结构的SQL模板Redkale内置了MySQL的语句
redkale.datasource.platf.tablecopy-sqltemplate = CREATE TABLE IF NOT EXISTS #{newtable} LIKE #{oldtable}
# DataSource 读写分离
redkale.datasource.platf.read.url = jdbc:mysql://127.0.0.1:3306/platf_r?allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&serverTimezone=UTC&characterEncoding=utf8
redkale.datasource.platf.read.user = root
redkale.datasource.platf.read.password = 12345678
redkale.datasource.platf.write.url = jdbc:mysql://127.0.0.1:3306/platf_w?allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&serverTimezone=UTC&characterEncoding=utf8
redkale.datasource.platf.write.user = root
redkale.datasource.platf.write.password = 12345678
```
# logging.properties 配置:
```properties
handlers = java.util.logging.ConsoleHandler,java.util.logging.FileHandler
.handlers = java.util.logging.ConsoleHandler,java.util.logging.FileHandler
############################################################
.level = FINE
sun.level = INFO
java.level = INFO
javax.level = INFO
com.sun.level = INFO
#java.util.logging.FileHandler.level = FINE
java.util.logging.FileHandler.limit = 20M
java.util.logging.FileHandler.count = 100
java.util.logging.FileHandler.encoding = UTF-8
java.util.logging.FileHandler.pattern = ${APP_HOME}/logs-%tY%tm/log-%tY%tm%td.log
#java.util.logging.FileHandler.unusual 属性表示将 WARNING、SEVERE 级别的日志复制写入单独的文件中
java.util.logging.FileHandler.unusual = ${APP_HOME}/logs-%tY%tm/log-warnerr-%tY%tm%td.log
#需要屏蔽消息内容的正则表达式
java.util.logging.FileHandler.denyregx =
java.util.logging.FileHandler.append = true
#java.util.logging.ConsoleHandler.level = FINE
#将日志写进SearchSource, 必须指定source资源名在source.properties中定义
#java.util.logging.SearchHandler.source = platfsearch
#指定写进SearchSource的表名默认值为log-record
#java.util.logging.SearchHandler.tag = log-${APP_NAME}-%tY%tm%td
```
# yaml配置
&emsp;&emsp;application和source的配置文件支持yaml格式需要依赖第三方包 默认的yaml配置文件名为 application.yml、source.yml。
```xml
<dependency>
<groupId>org.redkalex</groupId>
<artifactId>redkale-plugins</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.2</version>
</dependency>
```

442
docs/convert.md Normal file
View File

@@ -0,0 +1,442 @@
# 序列化
&emsp;&emsp;Convert提供Java对象的序列化与反序列化功能。支持JSON、PROTOBUF两种格式化。 两种格式使用方式完全一样其性能都大幅度超过其他JSON框架。同时JSON内置于HTTP服务中PROTOBUF也是SNCP协议数据序列化的基础。
## 基本API
&emsp;&emsp;JSON序列化其操作类主要是JsonConvert配置类主要是JsonFactory、ConvertColumn。JsonFactory采用同ClassLoader类似的双亲委托方式设计。
JsonConvert 序列化encode方法
```java
public String convertTo(Object value);
public String convertTo(Type type, Object value);
public byte[] convertToBytes(Type type, Object value);
public void convertTo(OutputStream out, Type type, Object value);
public ByteBuffer[] convertTo(Supplier<ByteBuffer> supplier, Type type, Object value);
public void convertTo(JsonWriter writer, Type type, Object value);
```
JsonConvert 反序列化decode方法
```java
public <T> T convertFrom(Type type, String text);
public <T> T convertFrom(Type type, InputStream in);
public <T> T convertFrom(Type type, ByteBuffer... buffers);
public <T> T convertFrom(Type type, JsonReader reader);
public Object[] convertFrom(Type[] types, String text);
// 返回非null的值是由String、ArrayList、HashMap任意组合的对象
public <V> V convertFrom(final String text);
// 返回非null的值是由String、ArrayList、HashMap任意组合的对象
public <V> V convertFrom(final InputStream in);
```
## JSON基本用法
```java
@Data
public class UserRecord {
private int userid;
private String username = "";
private String password = "";
public UserRecord() {
}
}
public static void main(String[] args) throws Exception {
UserRecord user = new UserRecord();
user.setUserid(100);
user.setUsername("redkalename");
user.setPassword("123456");
final JsonConvert convert = JsonConvert.root();
String json = convert.convertTo(user);
System.out.println(json); //应该是 {"password":"123456","userid":100,"username":"redkalename"}
UserRecord user2 = convert.convertFrom(UserRecord.class, json);
//应该也是 {"password":"123456","userid":100,"username":"redkalename"}
System.out.println(convert.convertTo(user2));
/**
* 以下功能是为了屏蔽password字段。
* 等价于 public String getPassword() 加上 @ConvertColumn
*
* @ConvertColumn(ignore = true, type = ConvertType.JSON)
* public String getPassword() {
* return password;
* }
**/
final JsonFactory childFactory = JsonFactory.root().createChild();
childFactory.register(UserRecord.class, true, "password"); //屏蔽掉password字段使其不输出
childFactory.reloadCoder(UserRecord.class); //重新加载Coder使之覆盖父Factory的配置
final JsonConvert childConvert = childFactory.getConvert();
json = childConvert.convertTo(user);
System.out.println(json); //应该是 {"userid":100,"username":"redkalename"}
user2 = childConvert.convertFrom(UserRecord.class, json);
//应该也是 {"userid":100,"username":"redkalename"}
System.out.println(childConvert.convertTo(user2));
}
```
&emsp;&emsp;在Redkale里存在默认的JsonConvert、ProtobufConvert对象。 只需在所有Service、Servlet中增加依赖注入资源。
```java
public class XXXService implements Service {
@Resource
private JsonConvert jsonConvert;
@Resource
private ProtobufConvert protobufConvert;
}
public class XXXServlet extends HttpServlet {
@Resource
private JsonConvert jsonConvert;
@Resource
private ProtobufConvert protobufConvert;
}
```
&emsp;&emsp; 同一类型数据通过设置新的JsonFactory可以有不同的输出。
```java
@Data
public class UserSimpleInfo {
private int userid;
private String username = "";
@ConvertColumn(ignore = true, type = ConvertType.JSON)
private long regtime; //注册时间
@ConvertColumn(ignore = true, type = ConvertType.JSON)
private String regaddr = ""; //注册IP
}
public class UserInfoServlet extends HttpBaseServlet {
@Resource
private UserSerice service;
@Resource
private JsonFactory jsonRootFactory;
@Resource
private JsonConvert detailConvert;
@Override
public void init(HttpContext context, AnyValue config) {
final JsonFactory childFactory = jsonRootFactory.createChild();
childFactory.register(UserSimpleInfo.class, false, "regtime", "regaddr"); //允许输出注册时间与注册地址
childFactory.reloadCoder(UserSimpleInfo.class); //重新加载Coder使之覆盖父Factory的配置
this.detailConvert = childFactory.getConvert();
}
// 获取他人基本信息
@HttpMapping(url = "/user/info/")
public void info(HttpRequest req, HttpResponse resp) throws IOException {
int userid = Integer.parseInt(req.getRequstURILastPath());
UserSimpleInfo user = service.findUserInfo(userid);
resp.finishJson(user); // 不包含用户的注册时间和注册地址字段信息
}
//获取用户自己的信息
@HttpMapping(url = "/user/myinfo")
public void mydetail(HttpRequest req, HttpResponse resp) throws IOException {
int userid = req.currentUser().getUserid(); //获取当前用户ID
UserSimpleInfo user = service.findUserInfo(userid);
resp.finishJson(detailConvert, user); // 包含用户的注册时间和注册地址字段信息
}
}
```
&emsp;&emsp;Convert 支持带参数构造函数。
&emsp;&emsp;&emsp;&emsp;1. public 带参数的构造函数加上 @ConstructorParameters 注解:
```java
public class UserRecord {
private int userid;
private String username = "";
private String password = "";
@ConstructorParameters({"userid", "username", "password"})
public UserRecord(int userid, String username, String password) {
this.userid = userid;
this.username = username;
this.password = password;
}
public int getUserid() {
return userid;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
}
```
&emsp;&emsp;&emsp;&emsp;2. 自定义Creator
```java
public class UserRecord {
private int userid;
private String username = "";
private String password = "";
UserRecord(int userid, String username, String password) {
this.userid = userid;
this.username = username;
this.password = password;
}
public int getUserid() {
return userid;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
/**
* 自定义Creator方法。
* 1) 方法名可以随意。
* 2) 方法必须是static。
* 3方法的参数必须为空。
* 4方法的返回类型必须是Creator。
*
* @return
*/
private static Creator<UserRecord> creator() {
return new Creator<UserRecord>() {
@Override
@ConstructorParameters({"userid", "username", "password"}) //带参数的构造函数必须有ConstructorParameters注解
public UserRecord create(Object... params) {
int userid = (params[0] == null ? 0 : (Integer) params[0]);
return new UserRecord(userid, (String) params[1], (String) params[2]);
}
};
}
}
```
&emsp;&emsp;通常JavaBean类默认有个public空参数的构造函数因此大部分情况下不要自定义Creator其实只要不是private的空参数构造函数Convert都能自动支持(其他的框架都仅支持public的构造函数)只有仅含private的构造函数才需要自定义Creator。带参数的构造函数就需要标记@ConstructorParameters常见于Immutable Object。
## 自定义
&emsp;&emsp;Convert 支持自定义Decode、Encode。
&emsp;&emsp;&emsp;&emsp;1. 通过ConvertFactory显式的注册
```java
public class FileSimpleCoder<R extends Reader, W extends Writer> extends SimpledCoder<R, W, File> {
public static final FileSimpleCoder instance = new FileSimpleCoder();
@Override
public void convertTo(W out, File value) {
out.writeString(value == null ? null : value.getPath());
}
@Override
public File convertFrom(R in) {
String path = in.readString();
return path == null ? null : new File(path);
}
}
JsonFactory.root().register(File.class, FileSimpleCoder.instance);
ProtobufFactory.root().register(File.class, FileSimpleCoder.instance);
```
&emsp;&emsp;&emsp;&emsp;2. 通过JavaBean类自定义静态方法自动加载
```java
public class InnerCoderEntity {
private final String val;
private final int id;
private InnerCoderEntity(int id, String value) {
this.id = id;
this.val = value;
}
public static InnerCoderEntity create(int id, String value) {
return new InnerCoderEntity(id, value);
}
/**
* 该方法提供给Convert组件自动加载。
* 1) 方法名可以随意。
* 2) 方法必须是static
* 3方法的参数有且只能有一个 且必须是org.redkale.convert.ConvertFactory或子类。
* —3.1) 参数类型为org.redkale.convert.ConvertFactory 表示适合JSON,PROTOBUF。
* —3.2) 参数类型为org.redkale.convert.json.JsonFactory 表示仅适合JSON。
* —3.3) 参数类型为org.redkale.convert.pb.ProtobufFactory 表示仅适合PROTOBUF。
* 4方法的返回类型必须是 Decodeable/Encodeable/SimpledCoder
* 若返回类型不是SimpledCoder, 就必须提供两个方法: 一个返回Decodeable 一个返回 Encodeable。
*
* @param factory
* @return
*/
private static SimpledCoder<Reader, Writer, InnerCoderEntity> createConvertCoder(final ConvertFactory factory) {
return new SimpledCoder<Reader, Writer, InnerCoderEntity>() {
//必须与EnMember[] 顺序一致
private final DeMember[] deMembers = new DeMember[]{
DeMember.create(factory, InnerCoderEntity.class, "id"),
DeMember.create(factory, InnerCoderEntity.class, "val")};
//必须与DeMember[] 顺序一致
private final EnMember[] enMembers = new EnMember[]{
EnMember.create(factory, InnerCoderEntity.class, "id"),
EnMember.create(factory, InnerCoderEntity.class, "val")};
@Override
public void convertTo(Writer out, InnerCoderEntity value) {
if (value == null) {
out.writeObjectNull(InnerCoderEntity.class);
return;
}
out.writeObjectB(value);
for (EnMember member : enMembers) {
out.writeObjectField(member, value);
}
out.writeObjectE(value);
}
@Override
public InnerCoderEntity convertFrom(Reader in) {
if (!in.readObjectB(this)) {
return null;
}
int index = 0;
final Object[] params = new Object[deMembers.length];
while (in.hasNext()) {
DeMember member = in.readFieldName(deMembers); //读取字段名
in.readBlank(); //读取字段名与字段值之间的间隔符JSON则是跳过冒号:
if (member == null) {
in.skipValue(); //跳过不存在的字段的值, 一般不会发生
} else {
params[index++] = member.read(in);
}
}
in.readObjectE();
return InnerCoderEntity.create(params[0] == null ? 0 : (Integer) params[0], (String) params[1]);
}
};
}
public int getId() {
return id;
}
public String getVal() {
return val;
}
@Override
public String toString() {
return JsonConvert.root().convertTo(this);
}
}
```
## RestConvert
&emsp;&emsp;```@RestConvert```、```@RestConvertCoder```是针对```@RestService```接口进行自定义序列化注解
```java
@Data
public class RestConvertItem {
private long createTime;
@ConvertColumn(ignore = true)
private String aesKey;
}
@Data
public class RestConvertBean {
private int id;
private boolean enable;
private String name;
private RestConvertItem content;
}
//将boolean类型值转换成0/1的int值
public class RestConvertBoolCoder<R extends Reader, W extends Writer> extends SimpledCoder<R, W, Boolean> {
@Override
public void convertTo(W out, Boolean value) {
out.writeInt(value == null || !value ? 0 : 1);
}
@Override
public Boolean convertFrom(R in) {
return in.readInt() == 1;
}
}
@RestService(name = "test", autoMapping = true)
public class RestConvertService extends AbstractService {
//输出: {"content":{"createTime":100},"enable":true,"id":123,"name":"haha"}
public RestConvertBean load1() {
return createBean();
}
//输出: {"content":{"aesKey":"keykey","createTime":100},"enable":true,"id":123,"name":"haha"}
//aesKey字段也会被输出
@RestConvert(type = RestConvertItem.class, skipIgnore = true)
public RestConvertBean load2() {
return createBean();
}
//输出: {"id":123}
//只输出id字段
@RestConvert(type = RestConvertBean.class, onlyColumns = "id")
public RestConvertBean load3() {
return createBean();
}
//输出: {"content":{"createTime":100},"enable":1,"id":123,"name":"haha"}
//enable字段输出1而不是true
@RestConvertCoder(type = RestConvertBean.class, field = "enable", coder = RestConvertBoolCoder.class)
public RestConvertBean load4() {
return createBean();
}
private RestConvertBean createBean() {
RestConvertBean bean = new RestConvertBean();
bean.setId(123);
bean.setName("haha");
bean.setEnable(true);
RestConvertItem item = new RestConvertItem();
item.setCreateTime(100);
item.setAesKey("keykey");
bean.setContent(item);
return bean;
}
}
```

195
docs/datasource.md Normal file
View File

@@ -0,0 +1,195 @@
# DB数据源
&emsp;&emsp; DataSource是数据层操作的抽象接口不仅用于关系型数据库还支持内存、Mongodb、ElasticSearch等数据源redkale内置了内存版DataSource官方扩展包```redkale-plugins```提供了Mongodb、ElasticSearch的实现。<br>
&emsp;&emsp; DataSource几乎所有操作都提供同步与异步两种方法对性能要求高的可以采用异步方式例如使用vertx实现的DataSqlSource。
## 注解说明
|注解类名 | 功能描述|
| --- | --- |
|@Column |标记字段与JPA用法一致 |
|@Entity |标记实体类与JPA用法一致 |
|@Id |标记主键字段与JPA用法一致 |
|@Table |标记表的别名与JPA用法一致 |
|@Transient |标记是否为表对应的字段与JPA用法一致 |
|@VirtualEntity |用于非数据库表对应的Entity类且仅用于开启缓存模式的DataSource |
|@DistributeTable |标记表进行分表分库存储, 与DistributeTableStrategy接口结合使用 |
|@FilterColumn |用于FilterBean过滤类的字段设置 |
|@FilterJoinColumn |用于FilterBean过滤类的关联表字段设置 |
|@FilterGroup | 用于FilterBean过滤类的过滤条件分组设置 |
|@FilterOrs | 用于FilterBean字段间的与或关系 |
## 操作方法
|系列方法 | 功能描述|
| --- | --- |
|insert |插入实体 |
|delete |删除实体 |
|update |更新实体 |
|updateColumn |更新数据的部分字段 |
|find |查找单个对象 |
|queryList |查询对象的List集合 |
|querySheet |查询对象的Sheet页式集合 |
|getNumberXXX |统计查询,用于查询字段的总和、最大值、平均值等数据 |
|queryColumnXXX |单个字段数据查询和字段的统计查询 |
|nativeXXX |直接运行SQL语句用于复杂的关联查询与更新(仅限DataSqlSource) |
## 配置数据源
```properties
redkale.datasource.platf.url = jdbc:mysql://127.0.0.1:3306/platf?serverTimezone=UTC&characterEncoding=utf8
redkale.datasource.platf.user = root
redkale.datasource.platf.password = pwd123
```
## pom依赖
&emsp;&emsp; 使用jdbc驱动
```xml
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.2.0</version>
</dependency>
```
&emsp;&emsp; 异步场景可使用vertx-mysql-client实现, 需要依赖官方扩展包 ```redkale-plugins```
```xml
<dependency>
<groupId>org.redkalex</groupId>
<artifactId>redkale-plugins</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-mysql-client</artifactId>
<version>4.5.1</version>
</dependency>
```
## 增删改查
```java
@Data
@Table(name = "t_account")
public class Account {
//男
public static final short GENDER_MALE = 1;
//女
public static final short GENDER_FEMALE = 2;
@Id
@Column(name = "account_id")
private String accountid;
@Column(name = "account_name")
private String accountName;
private int age;
private short gender;
private String remark;
@Column(name = "create_time", updatable = false)
private long createTime;
}
```
&emsp;&emsp;新增实体对象:
```java
@Resource(name = "platf")
private DataSource source;
public void insertTest() {
//新增单个
Account account = new Account();
account.setAccountid("account1");
account.setAccountName("Hello");
account.setCreateTime(System.currentTimeMillis());
source.insert(account);
//异步新增多个
Account a1 = new Account();
a1.setAccountid("account1");
a1.setAccountName("Hello1");
a1.setCreateTime(System.currentTimeMillis());
Account a2 = new Account();
a2.setAccountid("account2");
a2.setAccountName("Hello2");
a2.setCreateTime(System.currentTimeMillis());
source.insertAsync(a1, a2);
}
```
&emsp;&emsp;删除实体:
```java
//根据主键值删除
Account account = new Account();
account.setAccountid("account1");
source.delete(account);
//过滤删除, 删除16以下男生
//等价sql: DELETE FROM t_account WHERE age < 16 AND gender = 1;
source.delete(Account.class, FilterNodes.lt(Account::getAge, 16).and("gender", GENDER_MALE));
```
&emsp;&emsp;修改实体对象:
```java
//Lambda方式根据主键更新单个字段
source.updateColumn(Account.class, "account1", Account::getRemark, "新备注");
//Lambda方式根据主键更新多个字段
//等价sql: UPDATE t_account SET account_name='新名称', remark='新备注', age=age+2 WHERE account_id='account1';
source.updateColumn(Account.class, "account1",
ColumnValue.set(Account::getAccountName, "新名称"),
ColumnValue.set(Account::getRemark, "新备注"),
ColumnValue.inc(Account::getAge, 2)); //年龄+2
//根据主键更新多个字段
Account account = new Account();
account.setAccountid("account1");
account.setAccountName("新名称");
account.setRemark("新备注");
source.updateColumn(account, "accountName", "remark");
//或者
//等价sql: UPDATE t_account SET account_name='新名称', remark='新备注' WHERE account_id='account1';
source.updateColumn(account, Account::getAccountName, Account::getRemark);
//根据主键更新整个对象
Account one = new Account();
one.setAccountid("account1");
one.setAccountName("Hello1");
one.setCreateTime(System.currentTimeMillis());
source.update(one); //createTime不会被更新因字段设置了@Column(updatable=false)
//过滤更新
//等价sql: UPDATE t_account SET remark = '不满16岁是青少年' WHERE age < 16;
source.updateColumn(Account.class, FilterNodes.lt(Account::getAge, 16),
ColumnValue.set(Account::getRemark, "不满16岁是青少年"));
```
&emsp;&emsp;批量操作:
```java
Account a1 = new Account();
a1.setAccountid("account1");
a1.setAccountName("Hello1");
a1.setCreateTime(System.currentTimeMillis());
//事务性批量操作
DataBatch batch = DataBatch.create()
.insert(a1)
.updateColumn(Account.class, "account1", ColumnValue.set(Account::getRemark, "不满16岁是青少年"))
.delete(Account.class, FilterNodes.lt(Account::getAge, 16).and("gender", GENDER_MALE));
source.batch(batch);
```
&emsp;&emsp;查询实体对象:
```java
//主键查询
//等价sql: SELECT * FROM t_account WHERE account_id = 'account1';
Account account = source.find(Account.class, "account1");
//等价sql: SELECT * FROM t_account WHERE account_name = 'Hello' AND age = 18 LIMIT 1;
Account one = source.find(Account.class, FilterNodes.eq(Account::getAccountName, "Hello").and(Account::getAge, 18));
//等价sql: SELECT * FROM t_account WHERE account_name = 'Hello' OR age = 18;
FilterNode filter = FilterNodes.eq(Account::getAccountName, "Hello").or(Account::getAge, 18);
List<Account> list = source.queryList(Account.class, filter);
```

2
docs/faq.md Normal file
View File

@@ -0,0 +1,2 @@
# FAQ
文档完善中……

1
docs/http.md Normal file
View File

@@ -0,0 +1 @@
文档完善中……

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

BIN
docs/images/home-dir.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
docs/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

1
docs/locked.md Normal file
View File

@@ -0,0 +1 @@
文档完善中……

40
docs/native-image.md Normal file
View File

@@ -0,0 +1,40 @@
# 使用native-image
&emsp;&emsp; Redkale支持GraalVM的native-image 由于Redkale使用了大量的asm动态生成代码而native-image不支持动态字节码因此需要使用```redkale-maven-plugin```执行预编译,提前生成动态字节码进行打包。
## 安装GraalVM
```
下载地址: https://www.graalvm.org/downloads/
```
## 安装native-image
```
install native-image
```
## 配置pom
```xml
<plugin>
<groupId>org.redkale.maven.plugins</groupId>
<artifactId>redkale-maven-plugin</artifactId>
<version>1.2.0</version>
<configuration>
<nativeimageArgs>
<arg>--no-fallback</arg>
</nativeimageArgs>
</configuration>
<executions>
<execution>
<id>redkale-compile</id>
<phase>process-classes</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
```
## native-image编译
```
native-image -H:+ReportExceptionStackTraces --report-unsupported-elements-at-runtime -jar xxx.jar
```

62
docs/quick-start.md Normal file
View File

@@ -0,0 +1,62 @@
# 安装
使用maven:
```xml
<dependency>
<groupId>org.redkale</groupId>
<artifactId>redkale</artifactId>
<version>2.8.0</version>
</dependency>
```
如果工程需要用到Redis、Kafka、Elasticsearch、SQL模板、模板引擎等可使用redkale的官方插件:
```xml
<dependency>
<groupId>org.redkalex</groupId>
<artifactId>redkale-plugins</artifactId>
<version>2.8.0</version>
</dependency>
```
# 创建工程
在IDE中使用ant或maven方式创建工程增加redkale的依赖。下载解压
&emsp;&emsp;![home](images/home-dir.png)
并覆盖到工程目录下。
* bin 存放启动/关闭脚本(start.sh、shutdown.sh、redkale.sh等)
* conf 存放服务器所需配置文件:
* &emsp;&emsp; application.xml &nbsp;&nbsp;服务配置文件 (必需)
* &emsp;&emsp; logging.properties日志配置文件 (可选)
* &emsp;&emsp; source.properties 数据库配置文件 (可选)
* lib 存放服务所依赖jar
* logs logging.properties配置中默认的日志存放目录。
# Hello World
演示工程, 编写HelloService:
```java
package org.redkalex.example;
import org.redkale.net.http.*;
import org.redkale.service.Service;
@RestService(autoMapping = true)
public class HelloService implements Service {
public String sayHello() {
return "Hello World!";
}
public String hi(String name) {
return "Hi, " + name + "!";
}
}
```
运行结果:
&emsp;&emsp;![console](images/hello-console.png)
# 进一步阅读
* 详细的配置说明看[这里](config.md)。
* 数据源[这里](source.md)

85
docs/scheduled.md Normal file
View File

@@ -0,0 +1,85 @@
# 定时任务
&emsp;&emsp;@Scheduled注解在Service的方法上,实现对方法结果进行定时运行。方法必须是无参数或者```ScheduledEvent```参数。
## 属性说明
|属性|默认值|说明|
| --- | --- | --- |
|name|未定义|名称, 可用于第三方实现的定时任务组件的key, 比如xxl-job的任务标识|
|cron|未定义|cron表达式也可以使用常量值: <br> &emsp;@yearly、@annually、@monthly、@weekly、<br> &emsp;@daily、@midnight、@hourly、@minutely <br> &emsp;@1m、@2m、@3m、@5m、@10m、@15m、@30m <br> &emsp;@1h、@2h、@3h、@6h <br> &emsp;${env.scheduled.cron}: 读取系统配置项|
|zone|未定义|时区,```cron```有值才有效, 例如: "Asia/Shanghai"|
|fixedDelay|-1|延迟时间,负数为无效值,支持参数配置、乘法表达式和对象字段值 <br> 参数值支持方式:<br> &emsp;100: 设置数值 <br> &emsp;${env.scheduled.fixedDelay}: 读取系统配置项 <br> 值大于0且fixedRate小于0则使用 ScheduledThreadPoolExecutor.scheduleWithFixedDelay |
|fixedRate|-1|周期时间,负数为无效值,支持参数配置、乘法表达式和对象字段值 <br> 参数值支持方式:<br> &emsp;100: 设置数值 <br> &emsp;${env.scheduled.fixedRate}: 读取系统配置项 <br> 值大于0且fixedRate小于0则使用 ScheduledThreadPoolExecutor.scheduleAtFixedRate |
|initialDelay|-1|起始延迟时间,负数为无效值,支持参数配置、乘法表达式和对象字段值 <br> 参数值支持方式:<br> &emsp;100: 设置数值 <br> &emsp;${env.scheduled.initialDelay}: 读取系统配置项 <br> 值大于0且fixedRate和fixedDelay小于0则使用 ScheduledThreadPoolExecutor.schedule |
|timeUnit|```TimeUnit.SECONDS```|时间单位TimeUnit|
|comment|未定义|备注描述|
|mode|```LoadMode.LOCAL```|作用于Service模式默认值为LOCAL<br> LOCAL: 表示远程模式的Service对象中的定时任务不起作用|
## 基本用法
&emsp;&emsp;每秒执行
```java
@Scheduled(cron = "0/1 * * * * ?")
public void task1() {
System.out.println(Times.nowMillis() + "执行一次");
}
```
&emsp;&emsp;<b>数值配置</b>, 系统启动后延迟10分钟后每60分钟执行一次
```java
@Scheduled(fixedDelay = "10", fixedRate = "60", timeUnit = TimeUnit.MINUTES)
private void task3() {
System.out.println(Times.nowMillis() + "执行一次");
}
```
&emsp;&emsp;<b>环境配置</b>, 定时间隔时间由环境变量```env.scheduled.fixedRate```配置没配置采用默认值60秒)
```java
@Scheduled(fixedRate = "${env.scheduled.fixedRate:60}")
public String task2() {
System.out.println(Times.nowMillis() + "执行一次");
return "";
}
```
## 基本配置
```xml
<!--
全局Serivce的定时任务设置没配置该节点将自动创建一个。
enabled 是否开启缓存功能。默认: true
-->
<scheduled enabled="true"/>
```
## 使用Xxl-Job
&emsp;&emsp;Scheduled可以采用第三方实现, 官方扩展包```redkale-plugins```提供了xxl-job实现且不依赖xxl-job包。
### pom依赖
```xml
<dependency>
<groupId>org.redkalex</groupId>
<artifactId>redkale-plugins</artifactId>
<version>2.8.0</version>
</dependency>
```
### 配置文件
```xml
<scheduled enabled="true">
<xxljob addresses="http://localhost:8080/xxl-job-admin"
executorName="redkale-examples"
ip="127.0.0.1" <!-- 可选 -->
port="5678" <!-- 可选 -->
accessToken="default_token" />
</scheduled>
```
### 使用方法
```java
@Scheduled(name = "testTask")
public void runTask(ScheduledEvent event) {
System.out.println("xxl-job参数param: " + event.getString("param"));
System.out.println("xxl-job参数index: " + event.getInteger("index"));
System.out.println("xxl-job参数total: " + event.getInteger("total"));
}
```

64
docs/service.md Normal file
View File

@@ -0,0 +1,64 @@
# Service组件
&emsp;&emsp;Service是Redkale最核心的组件主要处理业务逻辑和操作数据层。Service实例分两种模式: <b>本地模式</b><b>远程模式</b>。其模式由```conf/application.xml```文件来配置。开发人员在调用过程中通常不需要区分Service实例是哪种模式。 <br/>
&emsp;&emsp;并不是Sevice都能进行本地和远程模式切换 以下情况的Service不能转成远程模式:
&emsp;&emsp;&emsp;&emsp; 1、类被修饰为```final``` <br>
&emsp;&emsp;&emsp;&emsp; 2、类被标记```@Local``` <br>
&emsp;&emsp;&emsp;&emsp; 3、类被标记```@Component``` <br>
&emsp;&emsp;Redkale进程启动时扫描可加载的Service实现类根据配置文件配置的模式采用```ASM```技术动态生成相应的Service临时类进行实例化并注册到ResourceFactory同其他Service、Servlet依赖注入。
## Service使用类型
|类型|使用注解|场景说明|
| --- | --- | --- |
|默认加载|```@AutoLoad```或无注解|默认的Service会自动加载并初始化且会自动生成对应协议层Servlet|
|依赖加载|```@AutoLoad(false)```|此类Service只有被其他服务依赖或者显式的配置时才会被初始化<br> 主要用于工具类功能服务, <br> 比如```DataSource```、```CacheSource```|
|本地模式|```@Local```|此类Service无论配不配成远程模式都不会转成远程模式<br>主要用于功能依赖本地环境或者参数无法序列化的服务|
|组件模式|```@Component```|此类Service不会被动态生成协议层Servlet<br>主要用于无需提供对进程外提供接口的服务,<br> 比如```DataSource```、```CacheSource```的实现|
# 用法
```java
@RestService(comment = "用户服务模块")
public class UserService implements Service {
@Resource(name = "platf")
private DataSource source;
//请求url: /user/updatePwd?bean={}
@RestMapping(auth = true, methods = "POST", comment = "更改密码(只能POST请求)")
public RetResult<String> updatePwd(@RestUserid long userid, UserPwdBean bean) {
//逻辑处理
return RetResult.success();
}
//请求url: /user/updateIntro?intro=xxx
@RestMapping(auth = true, comment = "更新用户介绍")
public RetResult<String> updateIntro(@RestUserid long userid, String intro) {
intro = Utility.orElse(intro, ""); //为null则用""
//更新数据库
source.updateColumn(UserDetail.class, userid, UserDetail::getIntro, intro);
return RetResult.success();
}
//请求url: /user/updateGender?gender=1
@RestMapping(auth = true, comment = "修改用户性别(异步方法)")
public CompletableFuture<RetResult<String>> updateGender(@RestUserid long userid, short gender) {
if (gender != GENDER_MALE && gender != GENDER_FEMALE) {
return RetCodes.retResultFuture(RET_USER_GENDER_ILLEGAL);
}
//更新数据库
return source.updateColumnAsync(UserDetail.class, userid, UserDetail::getGender, gender)
.thenApply(v -> RetResult.success());
}
}
```
&emsp;&emsp;```@RestUserid int userid```为当前用户Id, 值是在BaseServlet里进行设置userid可以是String、long、int类型。
## 远程模式Service
&emsp;&emsp;远程Servie其实是提供RPC接口需要配置文件中显式配置才可使用远程模式。
```xml
<group name="remote-A" nodes="192.168.10.11:6060,192.168.10.22:7070"/>
<server protocol="HTTP" host="0.0.0.0" port="8080">
<services autoload="true" group="remote-A"/>
<service name="" value="org.redkale.demo.user.UserService" group="remote-A"/>
</server>
```

1
docs/sncp.md Normal file
View File

@@ -0,0 +1 @@
文档完善中……

108
docs/sqlsource.md Normal file
View File

@@ -0,0 +1,108 @@
# DataSqlSource数据源
&emsp;&emsp;```DataSqlSource```是```DataSource```的SQL扩展类增强了对原生SQL的操作。
## SQL模板
&emsp;&emsp;Redkale中的SQL模板与Mybatis里的SQL模板用法类似 最大区别在于不需要写很多```if/else```判断语句,也不用写xml文件 框架会根据参数存在与否动态生成sql语句 查询结果时下划线式sql字段名和驼峰式类字段名会自动匹配。
```sql
SELECT * FROM user WHERE user_id IN #{bean.userIds} OR user_name = #{bean.userName}
```
&emsp;&emsp;当bean.userIds=nullbean.userName='hello'时sql语句转换成:
```sql
SELECT * FROM user WHERE user_name = 'hello'
```
&emsp;&emsp;当bean.userIds=[1,2,3]bean.userName=null时sql语句转换成:
```sql
SELECT * FROM user WHERE user_id IN (1,2,3)
```
&emsp;&emsp;IN或者NOT IN语句当参数不为null而是空数组或者空List会进行特殊处理IN语句会转化成```1=1```, NOT IN语句会转化成```1=2```。 当bean.userIds=空数组bean.userName='hello'时sql语句转换成:
```sql
SELECT * FROM user WHERE 1=2 OR user_name = 'hello'
```
&emsp;&emsp;参数支持默认值,用逗号隔开,非String参数类型主要指定数据类型目前支持(int)、(long)、(short)、(float)、(double), 参数不存在会使用默认值aaa:
```sql
DELETE FROM user WHERE user_name = #{bean.userName,aaa}
```
&emsp;&emsp;IN参数也支持默认值:
```sql
DELETE FROM user WHERE type IN #{types,(1, 2, 3)}
DELETE FROM user WHERE type IN (1, 2, #{type, (int)3})
DELETE FROM user WHERE user_name IN #{name, ('aa','bb','cc')}
DELETE FROM user WHERE user_name ('aa', 'bb', #{type,cc})
```
&emsp;&emsp;有些场景要求参数是必需的,就需要使用##{}来校验参数是否必需。
```sql
DELETE FROM user WHERE user_name = ##{bean.userName}
```
&emsp;&emsp;当bean=null或者bean.userName=null时执行sql会报错 ```Missing parameter bean.userName```
&emsp;&emsp;Service调用原生SQL模板示例
```java
public class ForumInfoService extends AbstractService {
//查询单个记录的sql
private static final String findSql = "SELECT f.forum_groupid, s.forum_section_color "
+ "FROM forum_info f, forum_section s "
+ " WHERE f.forumid = s.forumid AND "
+ "s.forum_sectionid = #{bean.forumSectionid} AND "
+ "f.forumid = #{bean.forumid} AND s.forum_section_color = #{bean.forumSectionColor}";
//查询列表记录的sql
private static final String querySql = "SELECT f.forum_groupid, s.forum_section_color "
+ "FROM forum_info f, forum_section s "
+ " WHERE f.forumid = s.forumid AND "
+ "s.forum_sectionid = #{bean.forumSectionid} AND "
+ "f.forumid = #{bean.forumid} AND s.forum_section_color = #{bean.forumSectionColor}";
@Resource
private DataSqlSource source;
public ForumResult findForumResultOne(ForumBean bean) {
return source.nativeQueryOne(ForumResult.class, findSql, Map.of("bean", bean));
}
public CompletableFuture<List<ForumResult>> queryForumResultListAsync(ForumBean bean) {
return source.nativeQueryListAsync(ForumResult.class, querySql, Map.of("bean", bean));
}
//翻页查询
public Sheet<ForumResult> queryForumResult(RowBound bound, ForumBean bean){
return source.nativeQuerySheet(ForumResult.class, querySql, round, Map.of("bean", bean));
}
}
```
## DataSqlMapper
&emsp;&emsp;DataSqlMapper与MyBatis里的Mapper用法类似且都支持异步方法。
```java
public interface ForumInfoMapper extends BaseMapper<ForumInfo> {
@Sql("SELECT f.forum_groupid, s.forum_section_color "
+ "FROM forum_info f, forum_section s "
+ "WHERE f.forumid = s.forumid "
+ "AND s.forum_sectionid = #{bean.forumSectionid} "
+ "AND f.forumid = #{bean.forumid} "
+ "AND s.forum_section_color = #{bean.forumSectionColor}")
public ForumResult findForumResultOne(ForumBean bean);
@Sql("SELECT f.forum_groupid, s.forum_section_color "
+ "FROM forum_info f, forum_section s "
+ "WHERE f.forumid = s.forumid AND "
+ "s.forum_sectionid = #{bean.forumSectionid} "
+ "AND f.forumid = #{bean.forumid} "
+ "AND s.forum_section_color = #{bean.forumSectionColor}")
public CompletableFuture<ForumResult> findForumResultOneAsync(ForumBean bean);
//翻页查询
@Sql("SELECT f.forum_groupid, s.forum_section_color "
+ "FROM forum_info f, forum_section s "
+ " WHERE f.forumid = s.forumid AND "
+ "s.forum_sectionid = #{bean.forumSectionid} AND "
+ "f.forumid = #{bean.forumid} AND s.forum_section_color = #{bean.forumSectionColor}")
public Sheet<ForumResult> queryForumResult(RowBound bound, ForumBean bean);
@Sql("UPDATE forum_section s "
+ " SET s.forum_sectionid = '' "
+ " WHERE s.forum_section_color = ##{bean.forumSectionColor}")
public int updateForumResult(@Param("bean") ForumBean bean0);
}
```

1
docs/watch.md Normal file
View File

@@ -0,0 +1 @@
文档完善中……

1
docs/websocket.md Normal file
View File

@@ -0,0 +1 @@
文档完善中……

View File

@@ -1,35 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.redkale</groupId>
<artifactId>redkale</artifactId>
<packaging>jar</packaging>
<name>RedkaleProject</name>
<url>http://redkale.org</url>
<url>https://redkale.org</url>
<description>redkale -- java framework</description>
<version>2.7.0-SNAPSHOT</version>
<version>2.8.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<junit.version>5.7.0</junit.version>
<maven-plugin.version>3.2.0</maven-plugin.version>
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>3.0.0-M5</maven-failsafe-plugin.version>
<junit.version>5.9.0</junit.version>
<maven-jar-plugin.version>3.4.0</maven-jar-plugin.version>
<maven-gpg-plugin.version>3.2.4</maven-gpg-plugin.version>
<maven-source-plugin.version>3.2.0</maven-source-plugin.version>
<maven-assembly-plugin.version>3.7.0</maven-assembly-plugin.version>
<nexus-staging-plugin.version>1.7.0</nexus-staging-plugin.version>
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>3.2.5</maven-failsafe-plugin.version>
<spotless-maven-plugin.version>2.43.0</spotless-maven-plugin.version>
<palantir-java-format.version>2.46.0</palantir-java-format.version>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<licenses>
<license>
@@ -40,6 +38,28 @@
</license>
</licenses>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<developers>
<developer>
<id>Redkale</id>
@@ -58,16 +78,16 @@
<timezone>8</timezone>
</developer>
</developers>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<scm>
@@ -75,36 +95,71 @@
<connection>scm:git:git@github.com/redkale/redkale.git</connection>
<developerConnection>scm:git:git@github.com:redkale/redkale.git</developerConnection>
</scm>
<issueManagement>
<system>GitHub Issues</system>
<url>https://github.com/redkale/redkale/issues</url>
</issueManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<compilerArgument>-parameters</compilerArgument>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<encoding>UTF-8</encoding>
<compilerArguments>
<verbose />
</compilerArguments>
</configuration>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<!-- 需要注释掉, 否则会生成native-image配置信息
<plugin>
<groupId>org.redkale.maven.plugins</groupId>
<artifactId>redkale-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<id>redkale-compile</id>
<phase>process-classes</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-plugin.version}</version>
<version>${maven-jar-plugin.version}</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<addMavenDescriptor>false</addMavenDescriptor>
<manifest>
<mainClass>org.redkale.boot.Application</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<forkMode>once</forkMode>
<argLine>-Dfile.encoding=UTF-8</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
@@ -116,6 +171,9 @@
<goals>
<goal>sign</goal>
</goals>
<configuration>
<signer>bc</signer>
</configuration>
</execution>
</executions>
</plugin>
@@ -123,7 +181,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-plugin.version}</version>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<goals>
@@ -132,11 +190,11 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-plugin.version}</version>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<goals>
@@ -144,16 +202,16 @@
</goals>
</execution>
</executions>
</plugin>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven-plugin.version}</version>
<version>${maven-assembly-plugin.version}</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>assembly.xml</descriptor>
<descriptor>my/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
@@ -166,8 +224,56 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${nexus-staging-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless-maven-plugin.version}</version>
<configuration>
<lineEndings>UNIX</lineEndings>
<formats>
<format>
<includes>
<include>src/**/java/**/*.java</include>
</includes>
<trimTrailingWhitespace/>
<endWithNewline/>
<indent>
<spaces>true</spaces>
<spacesPerTab>4</spacesPerTab>
</indent>
</format>
</formats>
<java>
<palantirJavaFormat>
<version>${palantir-java-format.version}</version>
<style>PALANTIR</style>
<formatJavadoc>true</formatJavadoc>
</palantirJavaFormat>
</java>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
</project>

76
pom.xml
View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.redkale</groupId>
<artifactId>redkale</artifactId>
@@ -7,18 +8,22 @@
<name>RedkaleProject</name>
<url>https://redkale.org</url>
<description>redkale -- java framework</description>
<version>2.7.0</version>
<version>2.8.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<junit.version>5.7.0</junit.version>
<maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
<maven-compiler-plugin.version>3.9.0</maven-compiler-plugin.version>
<maven-surefire-plugin.version>3.0.0-M6</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>3.0.0-M6</maven-failsafe-plugin.version>
<junit.version>5.9.0</junit.version>
<jmh.version>1.37</jmh.version>
<maven-jar-plugin.version>3.4.0</maven-jar-plugin.version>
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>3.2.5</maven-failsafe-plugin.version>
<spotless-maven-plugin.version>2.43.0</spotless-maven-plugin.version>
<palantir-java-format.version>2.46.0</palantir-java-format.version>
</properties>
<licenses>
@@ -36,7 +41,19 @@
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
@@ -76,7 +93,7 @@
<connection>scm:git:git@github.com/redkale/redkale.git</connection>
<developerConnection>scm:git:git@github.com:redkale/redkale.git</developerConnection>
</scm>
<build>
<plugins>
@@ -91,7 +108,7 @@
</compilerArgs>
</configuration>
</plugin>
<!-- 需要注释掉, 否则会生成native-image配置信息
<!-- must commented, otherwise native-image information will be generated
<plugin>
<groupId>org.redkale.maven.plugins</groupId>
<artifactId>redkale-maven-plugin</artifactId>
@@ -136,7 +153,44 @@
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless-maven-plugin.version}</version>
<configuration>
<lineEndings>UNIX</lineEndings>
<formats>
<format>
<includes>
<include>src/**/java/**/*.java</include>
</includes>
<trimTrailingWhitespace/>
<endWithNewline/>
<indent>
<spaces>true</spaces>
<spacesPerTab>4</spacesPerTab>
</indent>
</format>
</formats>
<java>
<palantirJavaFormat>
<version>${palantir-java-format.version}</version>
<style>PALANTIR</style>
<formatJavadoc>true</formatJavadoc>
</palantirJavaFormat>
</java>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
</project>

View File

@@ -1,110 +1,110 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8"><title>接口文档(apidoc生成)</title>
<style type="text/css">
body {text-align: center;margin:auto;}
a{text-decoration: none;}
.table {margin: auto;border-collapse: collapse;border-spacing: 0;display: block;width: 100%;overflow: auto;word-break: normal;word-break: keep-all;}
.table td,.table th{padding: 0.2rem 0.8rem 0.2rem 0.8rem;border: 1px solid #aaa;}
.table td {text-align: left;}
.s {font-size: 0.8rem; vertical-align: middle;}
.subtable {border-spacing: 0;border: 0;margin:0;}
.subtable td{border: 0;padding: 0 0 0 10px;}
.typetable {border-spacing: 0;border: 0;margin:0;}
.typetable td{border: 0;padding: 2px 20px 2px 10px;}
.typetable .l{border-bottom: 1px solid red;}
</style>
</head>
<body>
<head>
<meta charset="UTF-8"><title>接口文档(apidoc生成)</title>
<style type="text/css">
body {text-align: center;margin:auto;}
a{text-decoration: none;}
.table {margin: auto;border-collapse: collapse;border-spacing: 0;display: block;width: 100%;overflow: auto;word-break: normal;word-break: keep-all;}
.table td,.table th{padding: 0.2rem 0.8rem 0.2rem 0.8rem;border: 1px solid #aaa;}
.table td {text-align: left;}
.s {font-size: 0.8rem; vertical-align: middle;}
.subtable {border-spacing: 0;border: 0;margin:0;}
.subtable td{border: 0;padding: 0 0 0 10px;}
.typetable {border-spacing: 0;border: 0;margin:0;}
.typetable td{border: 0;padding: 2px 20px 2px 10px;}
.typetable .l{border-bottom: 1px solid red;}
</style>
</head>
<body>
<script>
var createhtml = function (jsoncontent) {
var classmap = jsoncontent.types;
var html = [];
html.push('<div style="width:' + Math.floor(window.screen.width * 0.9) + 'px;margin:0 auto;text-align: center;">');
html.push('<br/><br/><table class="table" align="center">');
for (var i = 0; i < jsoncontent.servers.length; i++) {
var servlets = jsoncontent.servers[i].servlets;
if (servlets.length && (servlets[0].comment || "").indexOf("【") === 0) {
servlets.sort(function (a, b) {
return a.comment > b.comment ? -1 : (a.comment == b.comment ? 0 : 1);
});
}
for (var j = 0; j < servlets.length; j++) {
var servlet = servlets[j];
if (html.length > 2) html.push(' <tr><th colspan="5" style="border-bottom:0;">&nbsp;</th></tr>');
html.push(' <tr><th colspan="5" style="border-top:' + ((html.length > 2) ? 0 : 1) + ';">' + (servlet.comment || '未知模块') + '</th></tr>');
html.push(' <tr><th>请求URL</th><th>描 述</th><th>鉴 权</th><th>参 数 <span style="font-size:12px;">(粗体: 必填项; 红色: Header; 蓝色: Cookie)</span></th><th>输 出</th></tr>');
for (var k = 0; k < servlet.mappings.length; k++) {
var action = servlet.mappings[k];
html.push(' <tr>');
html.push('<td style="color:#ff00ff;">' + action.url + '</td>');
html.push('<td>' + action.comment + '</td>');
html.push('<td class="s" style="width:80px;">模块ID: ' + servlet.moduleid + '<br/>操作ID: ' + action.actionid + '<br/>需鉴权: ' + (action.auth ? '<font style="font-weight:bold;color:green;">true</font>' : '<font color=red>false</font>') + '</td>');
var paramshtml = [];
paramshtml.push('<table class="subtable">');
for (var p = 0; p < action.params.length; p++) {
var param = action.params[p];
var t = param.type.substring(param.type.lastIndexOf('.') + 1);
if (classmap[param.type.replace('[]', '')]) {
t = '<a href="#' + param.type.replace('[]', '') + '">' + t + '</a>';
}
if (param.name == '&') {
paramshtml.push('<tr><td style="font-size:12px;">内置 </td><td> ' + t + '</td><td> 当前用户</td></tr>');
} else {
var w = param.required ? "font-weight:bold;" : "";
var c = ' style="' + w + '"';
if (param.style == "HEADER") c = ' style="color:red;' + w + '"';
if (param.style == "COOKIE") c = ' style="color:blue;' + w + '"';
paramshtml.push('<tr><td ' + c + '> ' + param.name + ' </td><td> ' + t + '</td><td> ' + param.comment + '</td></tr>');
}
}
paramshtml.push('</table>');
html.push('<td class="s" style="padding:0 5px;">' + paramshtml.join('') + '</td>');
var rs = [];
rs.push(action.result.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/([a-zA-Z0-9_\$]+\.)+/g, ""));
var results = action.results || [];
for (var r = 0; r < results.length; r++) {
rs.push('<a href="#' + results[r].replace('[]', '') + '">' + results[r].replace(/([a-zA-Z0-9_\$]+\.)+/g, "") + '</a>');
}
html.push('<td>' + rs.join("<br/>") + '</td>');
html.push('</tr>');
}
}
}
for (var type in classmap) {
html.push(' <tr><th colspan="5" style="border-bottom:0;">&nbsp;</th></tr>');
html.push(' <tr id="' + type + '"><th colspan="5" style="border-top:0;">' + type + '</th></tr>');
html.push(' <tr><td colspan="5"><table class="typetable">');
for (var fieldname in classmap[type]) {
var field = classmap[type][fieldname];
var t = field.type.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\$/g, ".").replace(/([a-zA-Z0-9_\$]+\.)+/g, "");
if (t == 'boolean' || t == 'short' || t == 'int' || t == 'long' || t == 'float' || t == 'double'
|| t == 'boolean[]' || t == 'short[]' || t == 'int[]' || t == 'long[]' || t == 'float[]' || t == 'double[]') {
t = '<font color=blue>' + t + '</font>';
} else if (t == 'String' || t == 'String[]' || t == 'LongRange' || t.indexOf('Map&lt;') === 0) {
t = '<font color=red>' + t + '</font>';
}
var c = (field.comment || '');
if (field.primary) {
c = '【主键】 ' + c;
} else if (!field.updatable) {
c = '【只读】 ' + c;
}
html.push(' <tr class="l"><td>' + fieldname + '</td><td>' + t + '</td><td colspan="2">' + c + '</td></tr>');
}
html.push(' </table></td></tr>');
}
html.push('</table><br/><br/><br/>');
html.push('</div>');
return html.join('');
};
</script>
<script>
var createhtml = function (jsoncontent) {
var classmap = jsoncontent.types;
var html = [];
html.push('<div style="width:' + Math.floor(window.screen.width * 0.9) + 'px;margin:0 auto;text-align: center;">');
html.push('<br/><br/><table class="table" align="center">');
for (var i = 0; i < jsoncontent.servers.length; i++) {
var servlets = jsoncontent.servers[i].servlets;
if (servlets.length && (servlets[0].comment || "").indexOf("【") === 0) {
servlets.sort(function (a, b) {
return a.comment > b.comment ? -1 : (a.comment == b.comment ? 0 : 1);
});
}
for (var j = 0; j < servlets.length; j++) {
var servlet = servlets[j];
if (html.length > 2) html.push(' <tr><th colspan="5" style="border-bottom:0;">&nbsp;</th></tr>');
html.push(' <tr><th colspan="5" style="border-top:' + ((html.length > 2) ? 0 : 1) + ';">' + (servlet.comment || '未知模块') + '</th></tr>');
html.push(' <tr><th>请求URL</th><th>描 述</th><th>鉴 权</th><th>参 数 <span style="font-size:12px;">(粗体: 必填项; 红色: Header; 蓝色: Cookie)</span></th><th>输 出</th></tr>');
for (var k = 0; k < servlet.mappings.length; k++) {
var action = servlet.mappings[k];
html.push(' <tr>');
html.push('<td style="color:#ff00ff;">' + action.url + '</td>');
html.push('<td>' + action.comment + '</td>');
html.push('<td class="s" style="width:80px;">模块ID: ' + servlet.moduleid + '<br/>操作ID: ' + action.actionid + '<br/>需鉴权: ' + (action.auth ? '<font style="font-weight:bold;color:green;">true</font>' : '<font color=red>false</font>') + '</td>');
var paramshtml = [];
paramshtml.push('<table class="subtable">');
for (var p = 0; p < action.params.length; p++) {
var param = action.params[p];
var t = param.type.substring(param.type.lastIndexOf('.') + 1);
if (classmap[param.type.replace('[]', '')]) {
t = '<a href="#' + param.type.replace('[]', '') + '">' + t + '</a>';
}
if (param.name == '&') {
paramshtml.push('<tr><td style="font-size:12px;">内置 </td><td> ' + t + '</td><td> 当前用户</td></tr>');
} else {
var w = param.required ? "font-weight:bold;" : "";
var c = ' style="' + w + '"';
if (param.style == "HEADER") c = ' style="color:red;' + w + '"';
if (param.style == "COOKIE") c = ' style="color:blue;' + w + '"';
paramshtml.push('<tr><td ' + c + '> ' + param.name + ' </td><td> ' + t + '</td><td> ' + param.comment + '</td></tr>');
}
}
paramshtml.push('</table>');
html.push('<td class="s" style="padding:0 5px;">' + paramshtml.join('') + '</td>');
var rs = [];
rs.push(action.result.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/([a-zA-Z0-9_\$]+\.)+/g, ""));
var results = action.results || [];
for (var r = 0; r < results.length; r++) {
rs.push('<a href="#' + results[r].replace('[]', '') + '">' + results[r].replace(/([a-zA-Z0-9_\$]+\.)+/g, "") + '</a>');
}
html.push('<td>' + rs.join("<br/>") + '</td>');
html.push('</tr>');
}
}
}
for (var type in classmap) {
html.push(' <tr><th colspan="5" style="border-bottom:0;">&nbsp;</th></tr>');
html.push(' <tr id="' + type + '"><th colspan="5" style="border-top:0;">' + type + '</th></tr>');
html.push(' <tr><td colspan="5"><table class="typetable">');
for (var fieldname in classmap[type]) {
var field = classmap[type][fieldname];
var t = field.type.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\$/g, ".").replace(/([a-zA-Z0-9_\$]+\.)+/g, "");
if (t == 'boolean' || t == 'short' || t == 'int' || t == 'long' || t == 'float' || t == 'double'
|| t == 'boolean[]' || t == 'short[]' || t == 'int[]' || t == 'long[]' || t == 'float[]' || t == 'double[]') {
t = '<font color=blue>' + t + '</font>';
} else if (t == 'String' || t == 'String[]' || t == 'LongRange' || t.indexOf('Map&lt;') === 0) {
t = '<font color=red>' + t + '</font>';
}
var c = (field.comment || '');
if (field.primary) {
c = '【主键】 ' + c;
} else if (!field.updatable) {
c = '【只读】 ' + c;
}
html.push(' <tr class="l"><td>' + fieldname + '</td><td>' + t + '</td><td colspan="2">' + c + '</td></tr>');
}
html.push(' </table></td></tr>');
}
html.push('</table><br/><br/><br/>');
html.push('</div>');
return html.join('');
};
</script>
<script>
var jsoncontent = '${content}'; //这里必须要用单引号引起来
document.write(createhtml(jsoncontent));
</script>
</body>
<script>
var jsoncontent = '#{content}'; //这里必须要用单引号引起来
document.write(createhtml(jsoncontent));
</script>
</body>
</html>

View File

@@ -1,51 +1,43 @@
redkale.nodeid = 1000
redkale.port = 6560
redkale.lib = ./
#\u3010resources\u8282\u70b9\u5168\u5c40\u552f\u4e00\u3011
#\u3010executor\u8282\u70b9\u5168\u5c40\u552f\u4e00\u3011
redkale.resources.executor.threads = 4
redkale.resources.executor.hash = false
#\u3010transport\u8282\u70b9\u5168\u5c40\u552f\u4e00\u3011
redkale.resources.transport.bufferCapacity = 32k
redkale.resources.transport.bufferPoolSize = 32
#\u3010excludelibs\u8282\u70b9\u5168\u5c40\u552f\u4e00\u3011
redkale.resources.excludelibs.value = ^.*mysql.*$;^.*kafka.*$
#\u3010cluster\u8282\u70b9\u5168\u5c40\u552f\u4e00\u3011
redkale.resources.cluster.type = org.redkalex.cluster.consul.ConsulClusterAgent
redkale.resources.cluster.waits= = false
redkale.resources.cluster.protocols = SNCP
redkale.resources.cluster.ports = 7070;7071
redkale.resources.mq[0].name =
redkale.resources.mq[0].type = org.redkalex.mq.kafka.KafkaMessageAgent
redkale.resources.mq[0].servers.value = 127.0.0.1:9101
redkale.resources.group[0].name =
redkale.resources.group[0].protocol = TCP
redkale.resources.group[0].node[0].addr = 127.0.0.1
redkale.resources.group[0].node[0].port = 7070
#\u3010listener\u8282\u70b9\u5168\u5c40\u552f\u4e00\u3011
redkale.resources.listener.value = org.redkalex.xxx.XXXApplicationListener
#\u3010properties\u8282\u70b9\u5168\u5c40\u552f\u4e00\u3011
redkale.resources.properties.load = config.properties
redkale.resources.properties.property[0].name = system.property.yyyy
redkale.resources.properties.property[0].value = YYYYYY
redkale.resources.properties.property[1].name = xxxxxxx
redkale.resources.properties.property[1].value = YYYYYY
redkale.server[0].protocol = HTTP
redkale.server[0].host = 127.0.0.1
redkale.server[0].port = 6060
redkale.server[0].root = root
redkale.server[0].lib =
#\u3010\u8282\u70b9\u5728<server>\u4e2d\u552f\u4e00\u3011
redkale.server[0].ssl.build = org.redkale.net.SSLBuilder\u5b50\u7c7b
redkale.server[0].services[0].autoload = true
redkale.nodeid = 1000
redkale.port = 6560
redkale.lib = ./
#\u3010executor\u8282\u70b9\u5168\u5c40\u552f\u4e00\u3011
redkale.executor.threads = 4
redkale.executor.hash = false
#\u3010cluster\u8282\u70b9\u5168\u5c40\u552f\u4e00\u3011
redkale.cluster.type = org.redkalex.cluster.consul.ConsulClusterAgent
redkale.cluster.waits= = false
redkale.cluster.protocols = SNCP
redkale.cluster.ports = 7070;7071
redkale.mq[0].name =
redkale.mq[0].type = org.redkalex.mq.kafka.KafkaMessageAgent
redkale.mq[0].servers.value = 127.0.0.1:9101
redkale.group[0].name =
redkale.group[0].protocol = TCP
redkale.group[0].node[0].addr = 127.0.0.1
redkale.group[0].node[0].port = 7070
redkale.listener[0].value = org.redkalex.xxx.XXXApplicationListener
#\u3010properties\u8282\u70b9\u5168\u5c40\u552f\u4e00\u3011
redkale.properties.load = config.properties
redkale.properties.property[0].name = system.property.yyyy
redkale.properties.property[0].value = YYYYYY
redkale.properties.property[1].name = xxxxxxx
redkale.properties.property[1].value = YYYYYY
redkale.server[0].protocol = HTTP
redkale.server[0].host = 127.0.0.1
redkale.server[0].port = 6060
redkale.server[0].root = root
redkale.server[0].lib =
#\u3010ssl\u8282\u70b9\u5728<server>\u4e2d\u552f\u4e00\u3011
redkale.server[0].ssl.build = org.redkale.net.SSLBuilder\u5b50\u7c7b
redkale.server[0].services[0].autoload = true

View File

@@ -1,324 +1,324 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
<!--
文件说明:
${APP_HOME} 指当前程序的根目录APP_HOME
没注明唯一的节点可多个存在
required 被声明required的属性值不能为空
group
/ / \ \
/ / \ \
/ / \ \
node1 node2 node3 node4
/ \
/ \
/ \
/ / \ \
/ / \ \
/ / \ \
node1 node2 node3 node4
/ \
/ \
/ \
/ \
serviceid1 serviceid2
serviceid1 serviceid2
/ \ / \
serviceid1_name1 serviceid1_name2 serviceid2_name1 serviceid2_name2
serviceid1_name1 serviceid1_name2 serviceid2_name1 serviceid2_name2
-->
<!--
<!--
nodeid: int 进程的节点ID用于分布式环境一个系统中节点ID必须全局唯一使用cluster时框架会进行唯一性校验
name: 进程的名称,用于监控识别,命名规则: 字母、数字、下划线、短横、点
address: 本地局域网的IP地址 默认值为默认网卡的ip当不使用默认值需要指定值如192.168.1.22
port: required 程序的管理Server的端口用于关闭或者与监管系统进行数据交互
lib: 加上额外的lib路径,多个路径用分号;隔开; 默认为空。 例如: ${APP_HOME}/lib/a.jar;${APP_HOME}/lib2/b.jar;
-->
<application nodeid="1000" port="6560" lib="">
<!--
【节点全局唯一】
所有服务所需的资源
<application nodeid="1000" port="6560" lib="">
<!--
【节点全局唯一】 @since 2.3.0
全局Serivce执行的线程池 Application.workExecutor, 没配置该节点将自动创建一个。
threads 线程数,默认值: CPU核数*10, 核数=2的情况下默认值为20。值为0表示不启用workExecutor都在IO线程中运行。
clients client回调函数运行的线程池大小 默认值: CPU核数*4
-->
<resources>
<!--
【节点全局唯一】 @since 2.3.0
全局Serivce执行的线程池 Application.workExecutor, 没配置该节点将自动创建一个。
threads 线程数为0表示不启用workExecutor只用IO线程。默认: CPU核数, 核数=1的情况下默认值为2
hash: 是否使用ThreadHashExecutor作为线程池默认值为false
-->
<executor threads="4" hash="false"/>
<!--
【节点全局唯一】
transport节点只能有一个用于配置所有Transport的池参数没配置该节点将自动创建一个。
threads 线程总数, 默认: <group>节点数*CPU核数*2
bufferCapacity: ByteBuffer的初始化大小 默认: 32K;
bufferPoolSize ByteBuffer池的大小默认: 线程总数*4
readTimeoutSeconds: TCP读取超时秒数, 默认为6秒 为0表示无超时限制
writeTimeoutSeconds: TCP写入超时秒数, 默认为6秒 为0表示无超时限制
strategy: 远程请求的负载均衡策略, 必须是org.redkale.net.TransportStrategy的实现类
-->
<transport bufferCapacity="32K" bufferPoolSize="32" threads="32" readTimeoutSeconds="6" writeTimeoutSeconds="6"/>
<!--
【节点全局唯一】
自动扫描时排除部分包路径
value 排除lib.path与excludes中的正则表达式匹配的路径, 多个正则表达式用分号;隔开
-->
<excludelibs value="^.*mysql.*$;^.*kafka.*$"/>
<!--
【节点全局唯一】
第三方服务发现管理接口
type 类名必须是org.redkale.cluster.ClusterAgent的子类
waits: 注销服务后是否需要等待检查周期时间后再进行Service销毁默认值为false
当一个Service进行服务注销后不能立刻销毁Service因为健康检测是有间隔时间差的
需要等待一个健康检测周期时间,让其他进程都更新完服务列表。
如果使用MQ可以设置为false如果对服务健壮性要求高建议设置为true
protocols: 服务发现可以处理的协议, 默认值为: SNCP, 多个协议用分号;隔开
ports: 服务发现可以处理的端口, 多个端口用分号;隔开
ttls: 心跳频率,多少秒一次
xxxx: 自定义的字段属性例如CacheClusterAgent有source字段; ConsulClusterAgent有apiurl字段;
-->
<cluster type="org.redkalex.cluster.consul.ConsulClusterAgent" waits="false" protocols="SNCP" ports="7070;7071" xxx="xxx" />
<executor threads="4"/>
<!--
MQ管理接口配置
不同MQ节点所配置的MQ集群不能重复
MQ跟着协议走所以mq的属性值需要被赋值在rest节点上, 由于SncpServlet是自动生成的故SNCP协议下mq属性值被赋值在service/services节点上
name: 服务的名称用于监控识别多个mq节点时只能有一个name为空的节点mq.name不能重复,命名规则: 字母、数字、下划线
type 实现类名必须是org.redkale.mq.MessageAgent的子类
coder: MessageRecord的解析器类必须是org.redkale.mq.MessageCoder<MessageRecord>的实现类,
可对数据包进行加密解密默认值org.redkale.mq.MessageRecordCoder
MQ节点下的子节点配置没有固定格式, 根据MessageAgent实现方的定义来配置
-->
<mq name="" type="org.redkalex.mq.kafka.KafkaMessageAgent">
<servers value="127.0.0.1:9101"/>
<consumer>
<property name="xxxxxx" value="XXXXXXXX"/>
</consumer>
<producer>
<property name="xxxxxx" value="XXXXXXXX"/>
</producer>
</mq>
<!--
一个组包含多个node 同一Service服务可以由多个进程提供这些进程称为一个GROUP且同一GROUP内的进程必须在同一机房或局域网内
一个group节点对应一个 Transport 对象。
name: 服务组ID长度不能超过11个字节. 默认为空字符串。 注意: name不能包含$符号。
protocol 值范围UDP TCP 默认TCP
注意: 一个node只能所属一个group。只要存在protocol=SNCP的Server节点信息 就必须有group节点信息。
-->
<group name="" protocol="TCP">
<!--
需要将本地node的addr与port列在此处。
同一个<node>节点值只能存在一个<group>节点内即同一个addr+port只能属于一个group。
addr: required IP地址
port: required 端口
-->
<node addr="127.0.0.1" port="7070"/>
</group>
<!--
【节点全局唯一】 @since 2.8.0
全局Serivce的定时任务设置没配置该节点将自动创建一个
enabled 是否开启缓存功能。默认: true
-->
<scheduled enabled="true"/>
<!--
@since 2.8.0
全局Serivce的缓存设置没配置该节点将自动创建一个。
name: 缓存管理器的名称, 默认: ""
enabled 是否开启缓存功能。默认: true
remote: 远程CacheSource的资源名
broadcastable: 存在远程CacheSource时修改数据是否进行广播到其他集群服务中。默认: true
-->
<cached name="" enabled="true" remote="xxx" broadcastable="true"/>
<!--
【节点全局唯一】
第三方服务发现管理接口
type 类名必须是org.redkale.cluster.ClusterAgent的子类
waits: 注销服务后是否需要等待检查周期时间后再进行Service销毁默认值为false
当一个Service进行服务注销后不能立刻销毁Service因为健康检测是有间隔时间差的
需要等待一个健康检测周期时间,让其他进程都更新完服务列表。
如果使用MQ可以设置为false如果对服务健壮性要求高建议设置为true
protocols: 服务发现可以处理的协议, 默认值为: SNCP, 多个协议用分号;隔开
ports: 服务发现可以处理的端口, 多个端口用分号;隔开
ttls: 心跳频率,多少秒一次
xxxx: 自定义的字段属性例如CacheClusterAgent有source字段; ConsulClusterAgent有apiurl字段;
-->
<cluster type="org.redkalex.cluster.consul.ConsulClusterAgent" waits="false" protocols="SNCP" ports="7070;7071" xxx="xxx" />
<!--
MQ管理接口配置
不同MQ节点所配置的MQ集群不能重复。
MQ跟着协议走所以mq的属性值需要被赋值在rest节点上, 由于SncpServlet是自动生成的故SNCP协议下mq属性值被赋值在service/services节点上
name: 服务的名称用于监控识别多个mq节点时只能有一个name为空的节点mq.name不能重复,命名规则: 字母、数字、下划线
type 实现类名必须是org.redkale.mq.MessageAgent的子类
threads线程数为0表示使用workExecutor。默认: CPU核数, 核数=1的情况下默认值为2JDK 21以上版本默认使用虚拟线程池
rpccluster和mq同名组件时HttpRpcClient优先使用MQ默认不优先走MQ。
coder: MessageRecord的解析器类必须是org.redkale.mq.MessageCoder<MessageRecord>的实现类,
可对数据包进行加密解密默认值org.redkale.mq.MessageRecordCoder
MQ节点下的子节点配置没有固定格式, 根据MessageAgent实现方的定义来配置
-->
<mq name="" type="org.redkalex.mq.kafka.KafkaMessageAgent" rpc="false" threads="4">
<servers value="127.0.0.1:9101"/>
<!--
Application启动的监听事件,可配置多个节点
value: 类名必须是ApplicationListener的子
加载所有的MessageConsumer实例;
autoload="true" 默认值. 自动加载classpath下所有的MessageConsumer
autoload="false" 需要显著的指定MessageConsumer类
includes 当autoload="true" 拉取类名与includes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
excludes 当autoload="true" 排除类名与excludes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
-->
<listener value="org.redkalex.xxx.XXXApplicationListener"/>
<!--
【节点全局唯一】
全局的参数配置, 可以通过@Resource(name="property.xxxxxx") 进行注入<property>的信息, 被注解的字段类型只能是String、primitive class
如果name是system.property.开头的值将会在进程启动时进行System.setProperty("yyyy", "YYYYYY")操作。
如果name是mimetype.property.开头的值将会在进程启动时进行MimeType.add("yyyy", "YYYYYY")操作。
先加载子节点property再加载load文件 最后加载agent的实现子类。
agent: 实现类名必须是org.redkale.boot.PropertiesAgent的子类
load: 加载文件,多个用;隔开。
默认置入的system.property.的有:
System.setProperty("redkale.net.transport.poolmaxconns", "100");
System.setProperty("redkale.net.transport.pinginterval", "30");
System.setProperty("redkale.net.transport.checkinterval", "30");
System.setProperty("redkale.convert.tiny", "true");
System.setProperty("redkale.convert.pool.size", "128");
System.setProperty("redkale.convert.writer.buffer.defsize", "4096");
<properties>节点下也可包含非<property>节点.
非<property>其节点可以通过@Resource(name="properties.xxxxxx")进行注入, 被注解的字段类型只能是AnyValue、AnyValue[]
<consumer autoload="true" includes="" excludes=""/>
<!--
MQ实现方的配置项
type: 配置项类型值只能是consumer或producer
-->
<properties load="config.properties" agent="">
<property name="system.property.yyyy" value="YYYYYY"/>
<config type="consumer">
<property name="xxxxxx" value="XXXXXXXX"/>
</config>
<config type="producer">
<property name="xxxxxx" value="XXXXXXXX"/>
<property name="xxxxxx" value="XXXXXXXX"/>
</properties>
</resources>
</config>
</mq>
<!--
一个组包含多个node 同一Service服务可以由多个进程提供这些进程称为一个GROUP且同一GROUP内的进程必须在同一机房或局域网内
name: 服务组ID长度不能超过11个字节. 默认为空字符串。 注意: name不能包含$符号。
protocol 值范围UDP TCP 默认TCP
nodes: 多个node节点值 例如:192.168.0.1:6060,192.168.0.2:6060
注意: 一个node只能所属一个group。只要存在protocol=SNCP的Server节点信息 就必须有group节点信息。
-->
<group name="" protocol="TCP" nodes="192.168.0.1:6060,192.168.0.2:6060">
<!--
需要将本地node的addr与port列在此处, 也可以直接用nodes属性。
同一个<node>节点值只能存在一个<group>节点内即同一个addr+port只能属于一个group。
addr: required IP地址
port: required 端口
-->
<node addr="127.0.0.1" port="7070"/>
</group>
<!--
Application启动的监听事件,可配置多个节点
value: 类名必须是ApplicationListener的子类
-->
<listener value="org.redkalex.xxx.XXXApplicationListener"/>
<!--
【节点全局唯一】
全局的参数配置, 可以通过@Resource(name="property.xxxxxx") 进行注入<property>的信息, 被注解的字段类型只能是String、primitive class
如果name是system.property.开头的值将会在进程启动时进行System.setProperty("yyyy", "YYYYYY")操作。
如果name是mimetype.property.开头的值将会在进程启动时进行MimeType.add("yyyy", "YYYYYY")操作。
先加载子节点property再加载load文件 最后加载agent的实现子类。
load: 加载文件,多个用;隔开。
其他属性: 供org.redkale.boot.PropertiesAgentProvider使用判断
默认置入的system.property.的有:
System.setProperty("redkale.convert.pool.size", "128");
System.setProperty("redkale.convert.writer.buffer.defsize", "4096");
<properties>节点下也可包含非<property>节点.
非<property>其节点可以通过@Resource(name="properties.xxxxxx")进行注入, 被注解的字段类型只能是AnyValue、AnyValue[]
-->
<properties load="config.properties">
<property name="system.property.yyyy" value="YYYYYY"/>
<property name="xxxxxx" value="XXXXXXXX"/>
<property name="xxxxxx" value="XXXXXXXX"/>
<property name="xxxxxx" value="XXXXXXXX"/>
</properties>
<!--
protocol: required server所启动的协议Redkale内置的有HTTP、SNCP、WATCH。协议均使用TCP实现; WATCH服务只能存在一个。
name: 服务的名称用于监控识别一个配置文件中的server.name不能重复,命名规则: 字母、数字、下划线
host: 服务所占address 默认: 0.0.0.0
port: required 服务所占端口
port: required 服务所占端口
root: 如果是web类型服务则包含页面 默认:{APP_HOME}/root
lib: server额外的class目录 默认为${APP_HOME}/libs/*;
excludelibs: 排除lib.path与excludes中的正则表达式匹配的路径, 多个正则表达式用分号;隔开
lib: server额外的class目录 默认为${APP_HOME}/libs/*;
charset: 文本编码, 默认: UTF-8
backlog: 默认10K
threads【已废弃】 线程数, 默认: CPU核数*2最小8个【已废弃 @since 2.3.0】
maxconns 最大连接数, 小于1表示无限制 默认: 0
maxbody: request.body最大值 默认: 64K
bufferCapacity: ByteBuffer的初始化大小 TCP默认: 32K; (HTTP 2.0、WebSocket必须要16k以上); UDP默认: 1350B
maxConns 最大连接数, 小于1表示无限制 默认: 0
maxHeader: request.header最大值 默认: 16K
maxBody: request.body最大值 默认: 256K
bufferCapacity: ByteBuffer的初始化大小 TCP默认: 32K; (HTTP 2.0、WebSocket必须要16k以上); UDP默认: 8K
bufferPoolSize ByteBuffer池的大小默认: 线程数*4
responsePoolSize Response池的大小默认: 1024
aliveTimeoutSeconds: KeepAlive读操作超时秒数 默认30 0表示永久不超时; -1表示禁止KeepAlive
readTimeoutSeconds: 读操作超时秒数, 默认0 表示永久不超时
writeTimeoutSeconds: 写操作超时秒数, 默认0 表示永久不超时
readTimeoutSeconds: 读操作超时秒数, 默认0 0表示永久不超时
writeTimeoutSeconds: 写操作超时秒数, 默认0 0表示永久不超时
interceptor: 启动/关闭NodeServer时被调用的拦截器实现类必须是org.redkale.boot.NodeInterceptor的子类默认为null
-->
<server protocol="HTTP" host="127.0.0.1" port="6060" root="root" lib="">
<!--
【节点在<server>中唯一】
builder: 创建SSLContext的实现类, 可自定义必须是org.redkale.net.SSLBuilder的子类
sslProvider: java.security.Provider自定义的实现类如第三方: org.conscrypt.OpenSSLProvider、org.bouncycastle.jce.provider.BouncyCastleProvider
jsseProvider: java.security.Provider自定义的实现类如第三方: org.conscrypt.JSSEProvider、 org.bouncycastle.jce.provider.BouncyCastleJsseProvider
protocol: TLS版本默认值: TLS
protocols: 设置setEnabledProtocols, 多个用,隔开 如: TLSv1.2,TLSv1.3
clientAuth: WANT/NEED/NONE, 默认值: NONE
ciphers: 设置setEnabledCipherSuites, 多个用,隔开 如: TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA256
keystorePass: KEY密码
keystoreFile: KEY文件 .jks
keystoreType: KEY类型 默认值为JKS
keystoreAlgorithm: KEY文件的algorithm 默认值为SunX509
truststorePass: TRUST密码
truststoreFile: TRUST文件
truststoreType: TRUST类型 默认值为JKS
truststoreAlgorithm: TRUST文件的algorithm 默认值为SunX509
<server protocol="HTTP" host="127.0.0.1" port="6060" root="root" lib="">
<!--
【节点在<server>中唯一】
builder: 创建SSLContext的实现类, 可自定义必须是org.redkale.net.SSLBuilder的子类
sslProvider: java.security.Provider自定义的实现类如第三方: org.conscrypt.OpenSSLProvider、org.bouncycastle.jce.provider.BouncyCastleProvider
jsseProvider: java.security.Provider自定义的实现类如第三方: org.conscrypt.JSSEProvider、 org.bouncycastle.jce.provider.BouncyCastleJsseProvider
protocol: TLS版本默认值: TLS
protocols: 设置setEnabledProtocols, 多个用,隔开 如: TLSv1.2,TLSv1.3
clientAuth: WANT/NEED/NONE, 默认值: NONE
ciphers: 设置setEnabledCipherSuites, 多个用,隔开 如: TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA256
keystorePass: KEY密码
keystoreFile: KEY文件 .jks
keystoreType: KEY类型 默认值为JKS
keystoreAlgorithm: KEY文件的algorithm 默认值为SunX509
truststorePass: TRUST密码
truststoreFile: TRUST文件
truststoreType: TRUST类型 默认值为JKS
truststoreAlgorithm: TRUST文件的algorithm 默认值为SunX509
-->
<ssl builder=""/>
<!--
加载所有的Service服务;
在同一个进程中同一个name同一类型的Service将共用同一个实例
autoload="true" 默认值. 自动加载classpath下所有的Service类
autoload="false" 需要显著的指定Service类
mq: 所属的MQ管理器当 protocol == SNCP 时该值才有效, 存在该属性表示Service的SNCP协议采用消息总线代理模式
includes 当autoload="true" 拉取类名与includes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
excludes 当autoload="true" 排除类名与excludes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
groups: 所属组的节点,多个节点值用;隔开,如果配置文件中存在多个SNCP协议的Server节点需要显式指定group属性.
当 protocol == SNCP 时 group表示当前Server与哪些节点组关联。
当 protocol != SNCP 时 group只能是空或者一个group的节点值,不能为多个节点值
特殊值"$cluster", 视为通过第三方服务注册发现管理工具来获取远程模式的ip端口信息
<!--
加载所有的Service服务;
在同一个进程中同一个name同一类型的Service将共用同一个实例
autoload="true" 默认值. 自动加载classpath下所有的Service类
autoload="false" 需要显著的指定Service类
mq: 所属的MQ管理器当 protocol == SNCP 时该值才有效, 存在该属性表示Service的SNCP协议采用消息总线代理模式
includes 当autoload="true" 拉取类名与includes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
excludes 当autoload="true" 排除类名与excludes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
group: 所属组的节点, 不能指定多个group, 如果配置文件中存在多个SNCP协议的Server节点需要显式指定group属性.
当 protocol == SNCP 时 group表示当前Server与哪些节点组关联。
当 protocol != SNCP 时 group只能是空或者一个group的节点值。
特殊值"$remote", 视为通过第三方服务注册发现管理工具来获取远程模式的ip端口信息
-->
<services autoload="true" includes="" excludes="">
<!-- 显著加载指定的Service的接口类 -->
<service value="com.xxx.XXX1Service"/>
<!--
name: 显式指定name覆盖默认的空字符串值。 注意: name不能包含$符号。
mq: 所属的MQ管理器当 protocol == SNCP 时该值才有效, 存在该属性表示Service的SNCP协议采用消息总线代理模式
groups: 显式指定groups,覆盖<services>节点的groups默认值。
ignore: 是否禁用, 默认为false。
<!--
name: 显式指定name覆盖默认的空字符串值。 注意: name不能包含$符号。
mq: 所属的MQ管理器当 protocol == SNCP 时该值才有效, 存在该属性表示Service的SNCP协议采用消息总线代理模式
group: 显式指定group覆盖<services>节点的group默认值。
ignore: 是否禁用, 默认为false。
-->
<service value="com.xxx.XXX2Service" name="" groups="xxx;yyy"/>
<service value="com.xxx.XXX2Service" name="" group="xxx"/>
<!-- 给Service增加配置属性 -->
<service value="com.xxx.XXX1Service">
<service value="com.xxx.XXX1Service">
<!-- property值在public void init(AnyValue conf)方法中可以通过AnyValue properties=conf.getAnyValue("properties")获取 -->
<property name="xxxxxx" value="XXXXXXXX"/>
<property name="xxxxxx" value="XXXXXXXX"/>
<property name="xxxxxx" value="XXXXXXXX"/>
</service>
</services>
<!--
加载所有的Filter服务;
autoload="true" 默认值.
autoload="false" 需要显著的指定Filter类
includes 当autoload="true" 拉取类名与includes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
excludes 当autoload="true" 排除类名与excludes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
<!--
加载所有的Filter服务;
autoload="true" 默认值.
autoload="false" 需要显著的指定Filter类
includes 当autoload="true" 拉取类名与includes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
excludes 当autoload="true" 排除类名与excludes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
-->
<filters autoload="true" includes="" excludes="">
<!--
显著加载指定的Filter类
value=: Filter类名。必须与Server的协议层相同HTTP必须是HttpFilter
ignore: 是否禁用, 默认为false。
<!--
显著加载指定的Filter类
value=: Filter类名。必须与Server的协议层相同HTTP必须是HttpFilter
ignore: 是否禁用, 默认为false。
-->
<!-- 显著加载指定的Filter类 -->
<filter value="com.xxx.XXX1Filter"/>
<!-- 给Filter增加配置属性 -->
<filter value="com.xxx.XXX12Filter">
<filter value="com.xxx.XXX12Filter">
<!-- property值在public void init(AnyValue conf)方法中可以通过AnyValue properties=conf.getAnyValue("properties")获取 -->
<property name="xxxxxx" value="XXXXXXXX"/>
<property name="xxxxxx" value="XXXXXXXX"/>
<property name="xxxxxx" value="XXXXXXXX"/>
</filter>
</filters>
<!--
REST的核心配置项
当Server为HTTP协议时, rest节点才有效。存在[rest]节点则Server启动时会加载REST服务, 节点可以多个,(WATCH协议不需要设置系统会自动生成)
path: servlet的ContextPath前缀 默认为空 【注: 开启MQ时,该字段失效】
base: REST服务的BaseServlet必须是 org.redkale.net.http.HttpServlet 的子类,且子类必须标记@HttpUserType。
mq: 所属的MQ管理器, 存在该属性表示RestService的请求来自于消息总线 【注: 开启MQ时,path字段失效】
autoload默认值"true" 默认值. 加载当前server所能使用的Servce对象;
includes当autoload="true" 拉取类名与includes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
excludes当autoload="true" 排除类名与excludes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
<!--
REST的核心配置项
当Server为HTTP协议时, rest节点才有效。存在[rest]节点则Server启动时会加载REST服务, 节点可以多个,(WATCH协议不需要设置系统会自动生成)
path: servlet的ContextPath前缀 默认为空 【注: 开启MQ时,该字段失效】
base: REST服务的BaseServlet必须是 org.redkale.net.http.HttpServlet 的子类,且子类必须标记@HttpUserType。
mq: 所属的MQ管理器, 存在该属性表示RestService的请求来自于消息总线 【注: 开启MQ时,path字段失效】
autoload默认值"true" 默认值. 加载当前server所能使用的Servce对象;
includes当autoload="true" 拉取类名与includes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
excludes当autoload="true" 排除类名与excludes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
-->
<rest path="/pipes" base="org.redkale.net.http.HttpServlet" autoload="true" includes="" excludes="">
<!--
value: Service类名列出的表示必须被加载的Service对象
ignore: 是否忽略设置为true则不会加载该Service对象默认值为false
<!--
value: Service类名列出的表示必须被加载的Service对象
ignore: 是否忽略设置为true则不会加载该Service对象默认值为false
-->
<service value="com.xxx.XXXXService"/>
<!--
value: WebSocket类名列出的表示必须被加载且标记为@RestWebSocket的WebSocket对象
ignore: 是否忽略设置为true则不会加载该RestWebSocket对象默认值为false
<!--
value: WebSocket类名列出的表示必须被加载且标记为@RestWebSocket的WebSocket对象
ignore: 是否忽略设置为true则不会加载该RestWebSocket对象默认值为false
-->
<websocket value="com.xxx.XXXXRestWebSocket"/>
</rest>
<!--
【节点在<server>中唯一】
当Server为HTTP协议时, request节点才有效。
remoteaddr 节点: 替换请求方节点的IP地址 通常请求方是由nginx等web静态服务器转发过的则需要配置该节点。
且value值只能是以request.headers.开头表示从request.headers中获取对应的header值。
locale value值必须是request.headers.或request.parameters.开头。
例如下面例子获取request.getRemoteAddr()值如果header存在X-RemoteAddress值则返回X-RemoteAddress值不存在返回getRemoteAddress()。
【节点在<server>中唯一】
当Server为HTTP协议时, request节点才有效。
remoteaddr 节点: 替换请求方节点的IP地址 通常请求方是由nginx等web静态服务器转发过的则需要配置该节点。
且value值只能是以request.headers.开头表示从request.headers中获取对应的header值, 多个header用逗号隔开
locale value值必须是request.headers.或request.parameters.开头。
例如下面例子获取request.getRemoteAddr()值如果header存在X-RemoteAddress值则返回X-RemoteAddress值不存在返回getRemoteAddress()。
-->
<request>
<remoteaddr value="request.headers.X-RemoteAddress"/>
<locale value="request.headers.locale" />
<remoteaddr value="request.headers.X-RemoteAddress,X-Forwarded-For"/>
<locale value="request.headers.locale" />
<rpc authenticator="org.redkale.net.http.HttpRpcAuthenticator的实现类"/>
</request>
<!--
【节点在<server>中唯一】
当Server为HTTP协议时, response节点才有效。
contenttype: plain值为调用finish时的ContentType; 默认值: text/plain; charset=utf-8
【节点在<server>中唯一】
当Server为HTTP协议时, response节点才有效。
contenttype: plain值为调用finish时的ContentType; 默认值: text/plain; charset=utf-8
json值为调用finishJson时的ContentType; 默认值: application/json; charset=utf-8
defcookie 节点: 当response里输出的cookie没有指定domain 和path时使用该节点的默认值。
addheader、setheader 的value值以request.parameters.开头则表示从request.parameters中获取对应的parameter值
addheader、setheader 的value值以request.headers.开头则表示从request.headers中获取对应的header值
例如下面例子是在Response输出header时添加两个header一个addHeader 一个setHeader
options 节点: 设置了该节点且auto=true当request的method=OPTIONS自动设置addheader、setheader并返回200状态码
date 节点: 设置了该节点且period有值(单位:毫秒);返回response会包含Date头信息默认为period=0
period=0表示实时获取当前时间;
period<0表示不设置date;
period>0表示定时获取时间; 设置1000表示每秒刷新Date时间
defcookie 节点: 当response里输出的cookie没有指定domain 和path时使用该节点的默认值。
addheader、setheader 的value值以request.parameters.开头则表示从request.parameters中获取对应的parameter值
addheader、setheader 的value值以request.headers.开头则表示从request.headers中获取对应的header值
例如下面例子是在Response输出header时添加两个header一个addHeader 一个setHeader
options 节点: 设置了该节点且auto=true当request的method=OPTIONS自动设置addheader、setheader并返回200状态码
date 节点: 设置了该节点且period有值(单位:毫秒);返回response会包含Date头信息默认为period=0
period=0表示实时获取当前时间;
period<0表示不设置date;
period>0表示定时获取时间; 设置1000表示每秒刷新Date时间
-->
<response>
<content-type plain="text/plain; charset=utf-8" json="application/json; charset=utf-8"/>
<defcookie domain="" path=""/>
<addheader name="Access-Control-Allow-Origin" value="request.headers.Origin" />
<setheader name="Access-Control-Allow-Headers" value="request.headers.Access-Control-Request-Headers"/>
<content-type plain="text/plain; charset=utf-8" json="application/json; charset=utf-8"/>
<defcookie domain="" path=""/>
<addheader name="Access-Control-Allow-Origin" value="request.headers.Origin" /> <!-- 可多节点 -->
<setheader name="Access-Control-Allow-Headers" value="request.headers.Access-Control-Request-Headers"/> <!-- 可多节点 -->
<setheader name="Access-Control-Allow-Credentials" value="true"/>
<options auto="true" />
<date period="0" />
</response>
<!--
【节点在<server>中唯一】
当Server为HTTP协议时render才有效. 指定输出引擎的实现类
value: 输出引擎的实现类, 必须是org.redkale.net.http.HttpRender的子类
suffixs: 引擎文件名后缀,多个用;隔开,默认值为: .htel
<!--
【节点在<server>中唯一】
当Server为HTTP协议时render才有效. 指定输出引擎的实现类
value: 输出引擎的实现类, 必须是org.redkale.net.http.HttpRender的子类
suffixs: 引擎文件名后缀,多个用;隔开,默认值为: .htel
-->
<render value="org.redkalex.htel.HttpTemplateRender" suffixs=".htel"/>
<!--
【节点在<server>中唯一】
当Server为HTTP协议时ResourceServlet才有效. 默认存在一个有默认属性的resource-servlet节点
webroot: web资源的根目录, 默认取server节点中的root值
servlet: 静态资源HttpServlet的实现默认使用HttpResourceServlet
index : 启始页默认值index.html
<!--
【节点在<server>中唯一】
当Server为HTTP协议时ResourceServlet才有效. 默认存在一个有默认属性的resource-servlet节点
webroot: web资源的根目录, 默认取server节点中的root值
servlet: 静态资源HttpServlet的实现默认使用HttpResourceServlet
index : 启始页默认值index.html
-->
<resource-servlet webroot="root" index="index.html">
<!--
@@ -330,27 +330,27 @@
-->
<cache limit="0M" lengthmax="1M" watch="false"/>
<!--
支持类似nginx中的rewrite 目前只支持静态资源对静态资源的跳转。
type: 匹配的类型, 目前只支持location(匹配requestURI), 默认: location
match: 匹配的正则表达式
forward: 需跳转后的资源链接
例如下面例子是将/xxx-yyy.html的页面全部跳转到/xxx.html
支持类似nginx中的rewrite 目前只支持静态资源对静态资源的跳转。
type: 匹配的类型, 目前只支持location(匹配path), 默认: location
match: 匹配的正则表达式
forward: 需跳转后的资源链接
例如下面例子是将/xxx-yyy.html的页面全部跳转到/xxx.html
-->
<rewrite type="location" match="^/([^-]+)-[^-\.]+\.html(.*)" forward="/$1.html"/>
</resource-servlet>
<!--
加载所有的Servlet服务;
path: servlet的ContextPath前缀 默认为空
autoload="true" 默认值. 自动加载classpath下所有的Servlet类
autoload="false" 需要显著的指定Service类
includes 当autoload="true" 拉取类名与includes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
excludes 当autoload="true" 排除类名与excludes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
<!--
加载所有的Servlet服务;
path: servlet的ContextPath前缀 默认为空
autoload="true" 默认值. 自动加载classpath下所有的Servlet类
autoload="false" 需要显著的指定Service类
includes 当autoload="true" 拉取类名与includes中的正则表达式匹配的类, 多个正则表达式用分号;或者逗号,隔开
excludes 当autoload="true" 排除类名与excludes中的正则表达式匹配的类, 多个正则表达式用分号;或者逗号,隔开
-->
<servlets path="/pipes" autoload="true" includes="" excludes="">
<!--
显著加载指定的Servlet类
value=: Servlet类名。必须与Server的协议层相同HTTP必须是HttpServlet
ignore: 是否禁用, 默认为false。
<!--
显著加载指定的Servlet类
value=: Servlet类名。必须与Server的协议层相同HTTP必须是HttpServlet
ignore: 是否禁用, 默认为false。
-->
<servlet value="com.xxx.XXX1Servlet" />
<servlet value="com.xxx.XXX2Servlet" />
@@ -360,9 +360,10 @@
</servlet>
</servlets>
</server>
<server protocol="SNCP" host="127.0.0.1" port="7070" root="root" lib="">
<server protocol="SNCP" host="127.0.0.1" port="7070" root="root" lib="">
<!-- 参数完全同上 -->
<services autoload="true" includes="" excludes="" />
</server>
</application>

View File

@@ -19,7 +19,7 @@ java.util.logging.FileHandler.pattern = ${APP_HOME}/logs-%tY%tm/log-%tY%tm%td.lo
#java.util.logging.FileHandler.unusual \u5c5e\u6027\u8868\u793a\u5c06 WARNING\u3001SEVERE \u7ea7\u522b\u7684\u65e5\u5fd7\u590d\u5236\u5199\u5165\u5355\u72ec\u7684\u6587\u4ef6\u4e2d
java.util.logging.FileHandler.unusual = ${APP_HOME}/logs-%tY%tm/log-warnerr-%tY%tm%td.log
#\u9700\u8981\u5c4f\u853d\u6d88\u606f\u5185\u5bb9\u7684\u6b63\u5219\u8868\u8fbe\u5f0f
java.util.logging.FileHandler.denyreg =
java.util.logging.FileHandler.denyregex =
java.util.logging.FileHandler.append = true
#java.util.logging.ConsoleHandler.level = FINE

View File

@@ -1,50 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
【已废弃】,建议使用 source.properties
其配置算是标准的JPA配置文件的缩略版
-->
<persistence>
<!-- 系统基本库 -->
<persistence-unit name="demouser">
<properties>
<!--
DataSource的实现类没有设置默认为org.redkale.source.DataJdbcSource的实现使用常规基于JDBC的数据库驱动一般无需设置
-->
<property name="javax.persistence.datasource" value="org.redkale.source.DataJdbcSource"/>
<!--
是否开启缓存(标记为@Cacheable的Entity类),值目前只支持两种: ALL: 所有开启缓存。 NONE: 关闭所有缓存, 非NONE字样统一视为ALL
-->
<property name="javax.persistence.cachemode" value="ALL"/>
<!--
是否自动建表当表不存在的时候, 目前只支持mysql、postgres 默认为false
-->
<property name="javax.persistence.table.autoddl" value="false"/>
<!-- 多个URL用;隔开如分布式SearchSource需要配多个URL -->
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://127.0.0.1:3306/dbuser?characterEncoding=utf8"/>
<property name="javax.persistence.jdbc.user" value="root"/>
<property name="javax.persistence.jdbc.password" value="123456"/>
<!-- 最大连接数默认值CPU数 -->
<property name="javax.persistence.connections.limit" value="12"/>
<!-- 包含的SQL模板相当于反向LIKE不同的JDBC驱动的SQL语句不一样Redkale内置了MySQL的语句 -->
<property name="javax.persistence.contain.sqltemplate" value="LOCATE(${keystr}, ${column}) > 0"/>
<property name="javax.persistence.notcontain.sqltemplate" value="LOCATE(${keystr}, ${column}) = 0"/>
<!-- 复制表结构的SQL模板Redkale内置了MySQL的语句 -->
<property name="javax.persistence.tablenotexist.sqlstates" value="42000;42S02"/>
<property name="javax.persistence.tablecopy.sqltemplate" value="CREATE TABLE IF NOT EXISTS ${newtable} LIKE ${oldtable}"/>
</properties>
</persistence-unit>
<!-- IM消息库 -->
<persistence-unit name="demoim">
<properties>
<!-- jdbc:mysql://127.0.0.1:3306/dbim?allowPublicKeyRetrieval=true&amp;rewriteBatchedStatements=true&amp;serverTimezone=UTC&amp;characterEncoding=utf8 -->
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://127.0.0.1:3306/dbim?characterEncoding=utf8"/>
<property name="javax.persistence.jdbc.user" value="root"/>
<property name="javax.persistence.jdbc.password" value="123456"/>
</properties>
</persistence-unit>
</persistence>

View File

@@ -1,50 +1,50 @@
# CacheSource @Resource(name="usersession")
# type\u53ef\u4ee5\u4e0d\u7528\u8bbe\u7f6e\uff0c\u6846\u67b6\u4f1a\u6839\u636eurl\u5224\u65ad\u4f7f\u7528\u54ea\u4e2aCacheSource\u5b9e\u73b0\u7c7b
redkale.cachesource[usersession].type = org.redkalex.cache.redis.RedisCacheSource
# \u6700\u5927\u8fde\u63a5\u6570
redkale.cachesource[usersession].maxconns = 16
# \u8282\u70b9\u5730\u5740
redkale.cachesource[usersession].node[0].url = redis://127.0.0.1:6363
# \u8282\u70b9\u5bc6\u7801
redkale.cachesource[usersession].node[0].password = 12345678
# \u8282\u70b9db
redkale.cachesource[usersession].node[0].db = 0
#\u7b80\u5316\u5199\u6cd5: \u53ef\u4ee5\u4e0d\u7528.node[0], \u5c06\u53c2\u6570\u90fd\u5408\u5e76\u5230url\u4e2d
redkale.cachesource[usersession].url = redis://user:123456@127.0.0.1:6363?db=0
# DataSource @Resource(name="platf")
# type\u53ef\u4ee5\u4e0d\u7528\u8bbe\u7f6e\uff0c\u6846\u67b6\u4f1a\u6839\u636eurl\u5224\u65ad\u4f7f\u7528\u54ea\u4e2aDataSource\u5b9e\u73b0\u7c7b\uff0c\u9ed8\u8ba4\u503c: org.redkale.source.DataJdbcSource
redkale.datasource[platf].type = org.redkale.source.DataJdbcSource
# \u662f\u5426\u5f00\u542f\u7f13\u5b58(\u6807\u8bb0\u4e3a@Cacheable\u7684Entity\u7c7b)\uff0c\u503c\u76ee\u524d\u53ea\u652f\u6301\u4e24\u79cd\uff1a ALL: \u6240\u6709\u5f00\u542f\u7f13\u5b58\u3002 NONE: \u5173\u95ed\u6240\u6709\u7f13\u5b58\uff0c \u975eNONE\u5b57\u6837\u7edf\u4e00\u89c6\u4e3aALL
redkale.datasource[platf].cachemode = ALL
# \u662f\u5426\u81ea\u52a8\u5efa\u8868\u5f53\u8868\u4e0d\u5b58\u5728\u7684\u65f6\u5019\uff0c \u76ee\u524d\u53ea\u652f\u6301mysql\u3001postgres\uff0c \u9ed8\u8ba4\u4e3afalse
redkale.datasource[platf].table-autoddl = false
# \u7528\u6237
redkale.datasource[platf].user = root
# \u5bc6\u7801
redkale.datasource[platf].password = 12345678
# \u591a\u4e2aURL\u7528;\u9694\u5f00\uff0c\u5982\u5206\u5e03\u5f0fSearchSource\u9700\u8981\u914d\u591a\u4e2aURL
redkale.datasource[platf].url = jdbc:mysql://127.0.0.1:3306/platf?allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&serverTimezone=UTC&characterEncoding=utf8
# \u6700\u5927\u8fde\u63a5\u6570\uff0c\u9ed8\u8ba4\u503c\uff1aCPU\u6570
redkale.datasource[platf].maxconns = 16
# \u5305\u542b\u7684SQL\u6a21\u677f\uff0c\u76f8\u5f53\u4e8e\u53cd\u5411LIKE\uff0c\u4e0d\u540c\u7684JDBC\u9a71\u52a8\u7684SQL\u8bed\u53e5\u4e0d\u4e00\u6837\uff0cRedkale\u5185\u7f6e\u4e86MySQL\u7684\u8bed\u53e5
redkale.datasource[platf].contain-sqltemplate = LOCATE(${keystr}, ${column}) > 0
# \u5305\u542b\u7684SQL\u6a21\u677f\uff0c\u76f8\u5f53\u4e8e\u53cd\u5411LIKE\uff0c\u4e0d\u540c\u7684JDBC\u9a71\u52a8\u7684SQL\u8bed\u53e5\u4e0d\u4e00\u6837\uff0cRedkale\u5185\u7f6e\u4e86MySQL\u7684\u8bed\u53e5
redkale.datasource[platf].notcontain-sqltemplate = LOCATE(${keystr}, ${column}) = 0
# \u590d\u5236\u8868\u7ed3\u6784\u7684SQL\u6a21\u677f\uff0cRedkale\u5185\u7f6e\u4e86MySQL\u7684\u8bed\u53e5
redkale.datasource[platf].tablenotexist-sqlstates = 42000;42S02
# \u590d\u5236\u8868\u7ed3\u6784\u7684SQL\u6a21\u677f\uff0cRedkale\u5185\u7f6e\u4e86MySQL\u7684\u8bed\u53e5
redkale.datasource[platf].tablecopy-sqltemplate = CREATE TABLE IF NOT EXISTS ${newtable} LIKE ${oldtable}
# DataSource \u8bfb\u5199\u5206\u79bb
redkale.datasource[platf].read.url = jdbc:mysql://127.0.0.1:3306/platf_r?allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&serverTimezone=UTC&characterEncoding=utf8
redkale.datasource[platf].read.user = root
redkale.datasource[platf].read.password = 12345678
redkale.datasource[platf].write.url = jdbc:mysql://127.0.0.1:3306/platf_w?allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&serverTimezone=UTC&characterEncoding=utf8
redkale.datasource[platf].write.user = root
redkale.datasource[platf].write.password = 12345678
# CacheSource @Resource(name="usersession")
# type\u53ef\u4ee5\u4e0d\u7528\u8bbe\u7f6e\uff0c\u6846\u67b6\u4f1a\u6839\u636eurl\u5224\u65ad\u4f7f\u7528\u54ea\u4e2aCacheSource\u5b9e\u73b0\u7c7b
redkale.cachesource.usersession.type = org.redkalex.cache.redis.RedisCacheSource
# \u6700\u5927\u8fde\u63a5\u6570
redkale.cachesource.usersession.maxconns = 16
# \u8282\u70b9\u5730\u5740
redkale.cachesource.usersession.nodes = redis://127.0.0.1:6363
# \u8282\u70b9\u5bc6\u7801
redkale.cachesource.usersession.password = 12345678
# \u8282\u70b9db
redkale.cachesource.usersession.db = 0
#\u7b80\u5316\u5199\u6cd5: \u53ef\u4ee5\u4e0d\u7528.node[0], \u5c06\u53c2\u6570\u90fd\u5408\u5e76\u5230url\u4e2d
redkale.cachesource.usersession.url = redis://user:123456@127.0.0.1:6363?db=0
# DataSource @Resource(name="platf")
# type\u53ef\u4ee5\u4e0d\u7528\u8bbe\u7f6e\uff0c\u6846\u67b6\u4f1a\u6839\u636eurl\u5224\u65ad\u4f7f\u7528\u54ea\u4e2aDataSource\u5b9e\u73b0\u7c7b\uff0c\u9ed8\u8ba4\u503c: org.redkale.source.DataJdbcSource
redkale.datasource.platf.type = org.redkale.source.DataJdbcSource
# \u662f\u5426\u5f00\u542f\u7f13\u5b58(\u6807\u8bb0\u4e3a@Cacheable\u7684Entity\u7c7b)\uff0c\u503c\u76ee\u524d\u53ea\u652f\u6301\u4e24\u79cd\uff1a ALL: \u6240\u6709\u5f00\u542f\u7f13\u5b58\u3002 NONE: \u5173\u95ed\u6240\u6709\u7f13\u5b58\uff0c \u975eNONE\u5b57\u6837\u7edf\u4e00\u89c6\u4e3aALL
redkale.datasource.platf.cachemode = ALL
# \u662f\u5426\u81ea\u52a8\u5efa\u8868\u5f53\u8868\u4e0d\u5b58\u5728\u7684\u65f6\u5019\uff0c \u76ee\u524d\u53ea\u652f\u6301mysql\u3001postgres\uff0c \u9ed8\u8ba4\u4e3afalse
redkale.datasource.platf.table-autoddl = false
# \u7528\u6237
redkale.datasource.platf.user = root
# \u5bc6\u7801
redkale.datasource.platf.password = 12345678
# \u591a\u4e2aURL\u7528;\u9694\u5f00\uff0c\u5982\u5206\u5e03\u5f0fSearchSource\u9700\u8981\u914d\u591a\u4e2aURL
redkale.datasource.platf.url = jdbc:mysql://127.0.0.1:3306/platf?allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&serverTimezone=UTC&characterEncoding=utf8
# \u6700\u5927\u8fde\u63a5\u6570\uff0c\u9ed8\u8ba4\u503c\uff1aCPU\u6570
redkale.datasource.platf.maxconns = 16
# \u5305\u542b\u7684SQL\u6a21\u677f\uff0c\u76f8\u5f53\u4e8e\u53cd\u5411LIKE\uff0c\u4e0d\u540c\u7684JDBC\u9a71\u52a8\u7684SQL\u8bed\u53e5\u4e0d\u4e00\u6837\uff0cRedkale\u5185\u7f6e\u4e86MySQL\u7684\u8bed\u53e5
redkale.datasource.platf.contain-sqltemplate = LOCATE(#{keystr}, #{column}) > 0
# \u5305\u542b\u7684SQL\u6a21\u677f\uff0c\u76f8\u5f53\u4e8e\u53cd\u5411LIKE\uff0c\u4e0d\u540c\u7684JDBC\u9a71\u52a8\u7684SQL\u8bed\u53e5\u4e0d\u4e00\u6837\uff0cRedkale\u5185\u7f6e\u4e86MySQL\u7684\u8bed\u53e5
redkale.datasource.platf.notcontain-sqltemplate = LOCATE(#{keystr}, #{column}) = 0
# \u590d\u5236\u8868\u7ed3\u6784\u7684SQL\u6a21\u677f\uff0cRedkale\u5185\u7f6e\u4e86MySQL\u7684\u8bed\u53e5
redkale.datasource.platf.tablenotexist-sqlstates = 42000;42S02
# \u590d\u5236\u8868\u7ed3\u6784\u7684SQL\u6a21\u677f\uff0cRedkale\u5185\u7f6e\u4e86MySQL\u7684\u8bed\u53e5
redkale.datasource.platf.tablecopy-sqltemplate = CREATE TABLE IF NOT EXISTS #{newtable} LIKE #{oldtable}
# DataSource \u8bfb\u5199\u5206\u79bb
redkale.datasource.platf.read.url = jdbc:mysql://127.0.0.1:3306/platf_r?allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&serverTimezone=UTC&characterEncoding=utf8
redkale.datasource.platf.read.user = root
redkale.datasource.platf.read.password = 12345678
redkale.datasource.platf.write.url = jdbc:mysql://127.0.0.1:3306/platf_w?allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&serverTimezone=UTC&characterEncoding=utf8
redkale.datasource.platf.write.user = root
redkale.datasource.platf.write.password = 12345678

View File

@@ -1,39 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 javax.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 值越大,优先级越高
*
* @since Common Annotations 1.2
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Priority {
/**
* 优先级值
*
* @return int
*/
int value();
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 javax.annotation;
import java.lang.annotation.*;
/**
* 值越大,优先级越高
*
* @see org.redkale.annotation.Priority
* @since Common Annotations 1.2
* @deprecated replace by {@link org.redkale.annotation.Priority}
*/
@Deprecated(since = "2.8.0")
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Priority {
/**
* 优先级值
*
* @return int
*/
int value();
}

View File

@@ -1,83 +1,83 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javax.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @since Common Annotations 1.0
*/
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Resource {
// /**
// * AuthenticationType
// */
// @Deprecated
// public enum AuthenticationType {
// /**
// * @deprecated
// */
// CONTAINER,
// /**
// * @deprecated
// */
// APPLICATION
// }
/**
* 资源名称
*
* @return String
*/
public String name() default "";
/**
* 依赖注入的类型
*
* @return Class
*/
public Class<?> type() default Object.class;
//
// /**
// *
// * @return AuthenticationType
// */
// @Deprecated
// public AuthenticationType authenticationType() default AuthenticationType.CONTAINER;
//
// /**
// *
// * @return boolean
// */
// @Deprecated
// public boolean shareable() default true;
//
// /**
// *
// * @return String
// */
// @Deprecated
// public String description() default "";
//
// /**
// *
// * @return String
// */
// @Deprecated
// public String mappedName() default "";
//
// /**
// *
// * @return String
// */
// @Deprecated
// public String lookup() default "";
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javax.annotation;
import java.lang.annotation.*;
/**
* @since Common Annotations 1.0
* @see org.redkale.annotation.Resource
* @deprecated replace by {@link org.redkale.annotation.Resource}
*/
@Deprecated(since = "2.8.0")
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Resource {
// /**
// * AuthenticationType
// */
// @Deprecated
// public enum AuthenticationType {
// /**
// * @deprecated
// */
// CONTAINER,
// /**
// * @deprecated
// */
// APPLICATION
// }
//
/**
* 资源名称
*
* @return String
*/
public String name() default "";
/**
* 依赖注入的类型
*
* @return Class
*/
public Class<?> type() default Object.class;
//
// /**
// *
// * @return AuthenticationType
// */
// @Deprecated
// public AuthenticationType authenticationType() default AuthenticationType.CONTAINER;
//
// /**
// *
// * @return boolean
// */
// @Deprecated
// public boolean shareable() default true;
//
// /**
// *
// * @return String
// */
// @Deprecated
// public String description() default "";
//
// /**
// *
// * @return String
// */
// @Deprecated
// public String mappedName() default "";
//
// /**
// *
// * @return String
// */
// @Deprecated
// public String lookup() default "";
}

View File

@@ -1,62 +1,58 @@
/** *****************************************************************************
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Linda DeMichiel - Java Persistence 2.1
* Linda DeMichiel - Java Persistence 2.0
*
***************************************************************************** */
package javax.persistence;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* Specifies whether an entity should be cached if caching is enabled
* when the value of the <code>persistence.xml</code> caching element
* is <code>ENABLE_SELECTIVE</code> or <code>DISABLE_SELECTIVE</code>.
* The value of the <code>Cacheable</code> annotation is inherited by
* subclasses; it can be overridden by specifying
* <code>Cacheable</code> on a subclass.
*
* <p>
* <code>Cacheable(false)</code> means that the entity and its state must
* not be cached by the provider.
*
* @since Java Persistence 2.0
*/
@Target({TYPE})
@Retention(RUNTIME)
public @interface Cacheable {
/**
* (Optional) Whether or not the entity should be cached.
*
* @return boolean
*/
boolean value() default true;
/**
* (Optional) 定时自动更新缓存的周期秒数为0表示不做定时更新 大于0表示每经过interval秒后会自动从数据库中拉取数据更新Cache
*
* @return int
*/
int interval() default 0;
/**
* DataSource是否直接返回对象的真实引用 而不是copy一份
*
* @return boolean
*/
boolean direct() default false;
}
/**
* ***************************************************************************** Copyright (c) 2008 - 2013 Oracle
* Corporation. All rights reserved.
*
* <p>This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompanies this distribution. The Eclipse Public License is available
* at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* <p>Contributors: Linda DeMichiel - Java Persistence 2.1 Linda DeMichiel - Java Persistence 2.0
*
* <p>****************************************************************************
*/
package javax.persistence;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* Specifies whether an entity should be cached if caching is enabled when the value of the <code>persistence.xml</code>
* caching element is <code>ENABLE_SELECTIVE</code> or <code>DISABLE_SELECTIVE</code>. The value of the <code>Cacheable
* </code> annotation is inherited by subclasses; it can be overridden by specifying <code>Cacheable</code> on a
* subclass.
*
* <p><code>Cacheable(false)</code> means that the entity and its state must not be cached by the provider.
*
* @since Java Persistence 2.0
* @deprecated replace by {@link org.redkale.persistence.Cacheable}
* @see org.redkale.persistence.Cacheable
*/
@Deprecated(since = "2.8.0")
@Target({TYPE})
@Retention(RUNTIME)
public @interface Cacheable {
/**
* (Optional) Whether or not the entity should be cached.
*
* @return boolean
*/
boolean value() default true;
/**
* (Optional) 定时自动更新缓存的周期秒数为0表示不做定时更新 大于0表示每经过interval秒后会自动从数据库中拉取数据更新Cache
*
* @return int
*/
int interval() default 0;
/**
* DataSource是否直接返回对象的真实引用 而不是copy一份
*
* @return boolean
*/
boolean direct() default false;
}

View File

@@ -1,31 +1,30 @@
/** *****************************************************************************
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
/**
* ***************************************************************************** Copyright (c) 2008 - 2013 Oracle
* Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* <p>This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompanies this distribution. The Eclipse Public License is available
* at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Linda DeMichiel - Java Persistence 2.1
* Linda DeMichiel - Java Persistence 2.0
* <p>Contributors: Linda DeMichiel - Java Persistence 2.1 Linda DeMichiel - Java Persistence 2.0
*
***************************************************************************** */
* <p>****************************************************************************
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* Specifies the mapped column for a persistent property or field.
* If no <code>Column</code> annotation is specified, the default values apply.
* Specifies the mapped column for a persistent property or field. If no <code>Column</code> annotation is specified,
* the default values apply.
*
* <blockquote><pre>
* <blockquote>
*
* <pre>
* Example 1:
*
* &#064;Column(name="DESC", nullable=false, length=512)
@@ -44,18 +43,21 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* &#064;Column(name="ORDER_COST", updatable=false, precision=12, scale=2)
* public BigDecimal getCost() { return cost; }
*
* </pre></blockquote>
* </pre>
*
* </blockquote>
*
* @since Java Persistence 1.0
* @deprecated replace by {@link org.redkale.persistence.Column}
* @see org.redkale.persistence.Column
*/
@Deprecated(since = "2.8.0")
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Column {
/**
* (Optional) The name of the column. Defaults to
* the property or field name.
* (Optional) The name of the column. Defaults to the property or field name.
*
* @return String
*/
@@ -69,12 +71,10 @@ public @interface Column {
String comment() default "";
/**
* (Optional) Whether the column is a unique key. This is a
* shortcut for the <code>UniqueConstraint</code> annotation at the table
* level and is useful for when the unique key constraint
* corresponds to only a single column. This constraint applies
* in addition to any constraint entailed by primary key mapping and
* to constraints specified at the table level.
* (Optional) Whether the column is a unique key. This is a shortcut for the <code>UniqueConstraint</code>
* annotation at the table level and is useful for when the unique key constraint corresponds to only a single
* column. This constraint applies in addition to any constraint entailed by primary key mapping and to constraints
* specified at the table level.
*
* @return boolean
*/
@@ -95,24 +95,22 @@ public @interface Column {
String example() default "";
/**
* (Optional) Whether the column is included in SQL INSERT
* statements generated by the persistence provider.
* (Optional) Whether the column is included in SQL INSERT statements generated by the persistence provider.
*
* @return boolean
*/
boolean insertable() default true;
/**
* (Optional) Whether the column is included in SQL UPDATE
* statements generated by the persistence provider.
* (Optional) Whether the column is included in SQL UPDATE statements generated by the persistence provider.
*
* @return boolean
*/
boolean updatable() default true;
/**
* (Optional) The name of the table that contains the column.
* If absent the column is assumed to be in the primary table.
* (Optional) The name of the table that contains the column. If absent the column is assumed to be in the primary
* table.
*
* @return String
*/
@@ -120,32 +118,28 @@ public @interface Column {
String table() default "";
/**
* (Optional) The column length. (Applies only if a
* string-valued column is used.)
* if type==String and length == 65535 then sqltype is TEXT <br>
* if type==String and length &#60;= 16777215 then sqltype is MEDIUMTEXT <br>
* if type==String and length &#62; 16777215 then sqltype is LONGTEXT <br>
* if type==byte[] and length &#60;= 65535 then sqltype is BLOB <br>
* if type==byte[] and length &#60;= 16777215 then sqltype is MEDIUMBLOB <br>
* if type==byte[] and length &#62; 16777215 then sqltype is LONGBLOB <br>
* (Optional) The column length. (Applies only if a string-valued column is used.) if type==String and length ==
* 65535 then sqltype is TEXT <br>
* if type==String and length &#60;= 16777215 then sqltype is MEDIUMTEXT <br>
* if type==String and length &#62; 16777215 then sqltype is LONGTEXT <br>
* if type==byte[] and length &#60;= 65535 then sqltype is BLOB <br>
* if type==byte[] and length &#60;= 16777215 then sqltype is MEDIUMBLOB <br>
* if type==byte[] and length &#62; 16777215 then sqltype is LONGBLOB <br>
*
* @return int
*/
int length() default 255;
/**
* (Optional) The precision for a decimal (exact numeric)
* column. (Applies only if a decimal column is used.)
* Value must be set by developer if used when generating
* the DDL for the column.
* (Optional) The precision for a decimal (exact numeric) column. (Applies only if a decimal column is used.) Value
* must be set by developer if used when generating the DDL for the column.
*
* @return int
*/
int precision() default 0;
/**
* (Optional) The scale for a decimal (exact numeric) column.
* (Applies only if a decimal column is used.)
* (Optional) The scale for a decimal (exact numeric) column. (Applies only if a decimal column is used.)
*
* @return int
*/

View File

@@ -1,45 +1,45 @@
/*******************************************************************************
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
/**
* ***************************************************************************** Copyright (c) 2008 - 2013 Oracle
* Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* <p>This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompanies this distribution. The Eclipse Public License is available
* at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Linda DeMichiel - Java Persistence 2.1
* Linda DeMichiel - Java Persistence 2.0
* <p>Contributors: Linda DeMichiel - Java Persistence 2.1 Linda DeMichiel - Java Persistence 2.0
*
******************************************************************************/
* <p>****************************************************************************
*/
package javax.persistence;
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* Specifies that the class is an entity. This annotation is applied to the
* entity class.
*
* Specifies that the class is an entity. This annotation is applied to the entity class.
*
* @since Java Persistence 1.0
* @deprecated replace by {@link org.redkale.persistence.Entity}
* @see org.redkale.persistence.Entity
*/
@Deprecated(since = "2.8.0")
@Inherited
@Documented
@Target(TYPE)
@Retention(RUNTIME)
public @interface Entity {
/**
* (Optional) The entity name. Defaults to the unqualified
* name of the entity class. This name is used to refer to the
* entity in queries. The name must not be a reserved literal
* in the Java Persistence query language.
/**
* (Optional) The entity name. Defaults to the unqualified name of the entity class. This name is used to refer to
* the entity in queries. The name must not be a reserved literal in the Java Persistence query language.
*
* @return String
*/
String name() default "";
*/
String name() default "";
/**
* (Optional) The comment of the entity.
*

View File

@@ -1,41 +1,32 @@
/*******************************************************************************
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
/**
* ***************************************************************************** Copyright (c) 2008 - 2013 Oracle
* Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* <p>This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompanies this distribution. The Eclipse Public License is available
* at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Linda DeMichiel - Java Persistence 2.1
* Linda DeMichiel - Java Persistence 2.0
* <p>Contributors: Linda DeMichiel - Java Persistence 2.1 Linda DeMichiel - Java Persistence 2.0
*
******************************************************************************/
* <p>****************************************************************************
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* Specifies the primary key of an entity.
* The field or property to which the <code>Id</code> annotation is applied
* should be one of the following types: any Java primitive type;
* any primitive wrapper type;
* <code>String</code>;
* <code>java.util.Date</code>;
* <code>java.sql.Date</code>;
* <code>java.math.BigDecimal</code>;
* <code>java.math.BigInteger</code>.
* Specifies the primary key of an entity. The field or property to which the <code>Id</code> annotation is applied
* should be one of the following types: any Java primitive type; any primitive wrapper type; <code>String</code>;
* <code>java.util.Date</code>; <code>java.sql.Date</code>; <code>java.math.BigDecimal</code>; <code>
* java.math.BigInteger</code>.
*
* <p>The mapped column for the primary key of the entity is assumed
* to be the primary key of the primary table. If no <code>Column</code> annotation
* is specified, the primary key column name is assumed to be the name
* of the primary key property or field.
* <p>The mapped column for the primary key of the entity is assumed to be the primary key of the primary table. If no
* <code>Column</code> annotation is specified, the primary key column name is assumed to be the name of the primary key
* property or field.
*
* <pre>
* Example:
@@ -44,12 +35,12 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* public Long getId() { return id; }
* </pre>
*
* @see Column
* see GeneratedValue
*
* @see Column see GeneratedValue
* @since Java Persistence 1.0
* @deprecated replace by {@link org.redkale.persistence.Id}
* @see org.redkale.persistence.Id
*/
@Deprecated(since = "2.8.0")
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Id {}

View File

@@ -1,45 +1,42 @@
/** *****************************************************************************
* Copyright (c) 2011 - 2013 Oracle Corporation. All rights reserved.
/**
* ***************************************************************************** Copyright (c) 2011 - 2013 Oracle
* Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* <p>This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompanies this distribution. The Eclipse Public License is available
* at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Linda DeMichiel - Java Persistence 2.1
* <p>Contributors: Linda DeMichiel - Java Persistence 2.1
*
***************************************************************************** */
* <p>****************************************************************************
*/
package javax.persistence;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.annotation.*;
/**
* Used in schema generation to specify creation of an index.
* <p>
* Note that it is not necessary to specify an index for a primary key,
* as the primary key index will be created automatically.
*
* <p>
* The syntax of the <code>columnList</code> element is a
* <code>column_list</code>, as follows:
* <p>Note that it is not necessary to specify an index for a primary key, as the primary key index will be created
* automatically.
*
* <p>The syntax of the <code>columnList</code> element is a <code>column_list</code>, as follows:
*
* <pre>
* column::= index_column [,index_column]*
* index_column::= column_name [ASC | DESC]
* </pre>
*
* <p>
* If <code>ASC</code> or <code>DESC</code> is not specified,
* <code>ASC</code> (ascending order) is assumed.
* <p>If <code>ASC</code> or <code>DESC</code> is not specified, <code>ASC</code> (ascending order) is assumed.
*
* @since Java Persistence 2.1
*
* @deprecated replace by {@link org.redkale.persistence.Index}
* @see org.redkale.persistence.Index
*/
@Deprecated(since = "2.8.0")
@Target({})
@Retention(RUNTIME)
public @interface Index {
@@ -52,8 +49,7 @@ public @interface Index {
String name() default "";
/**
* (Required) The names of the columns to be included in the index,
* in order.
* (Required) The names of the columns to be included in the index, in order.
*
* @return String
*/
@@ -65,5 +61,4 @@ public @interface Index {
* @return boolean
*/
boolean unique() default false;
}

View File

@@ -1,32 +1,28 @@
/** *****************************************************************************
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
/**
* ***************************************************************************** Copyright (c) 2008 - 2013 Oracle
* Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* <p>This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompanies this distribution. The Eclipse Public License is available
* at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Linda DeMichiel - Java Persistence 2.1
* Linda DeMichiel - Java Persistence 2.0
* <p>Contributors: Linda DeMichiel - Java Persistence 2.1 Linda DeMichiel - Java Persistence 2.0
*
***************************************************************************** */
* <p>****************************************************************************
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* Specifies the primary table for the annotated entity. Additional
* tables may be specified using SecondaryTable or SecondaryTables annotation.
* Specifies the primary table for the annotated entity. Additional tables may be specified using SecondaryTable or
* SecondaryTables annotation.
*
* <p>
* If no <code>Table</code> annotation is specified for an entity
* class, the default values apply.
* <p>If no <code>Table</code> annotation is specified for an entity class, the default values apply.
*
* <pre>
* Example:
@@ -37,45 +33,46 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* </pre>
*
* @since Java Persistence 1.0
* @deprecated replace by {@link org.redkale.persistence.Table}
* @see org.redkale.persistence.Table
*/
@Deprecated(since = "2.8.0")
@Target(TYPE)
@Retention(RUNTIME)
public @interface Table {
/**
* (Optional) The name of the table.
* <p>
* Defaults to the entity name.
*
* <p>Defaults to the entity name.
*
* @return String
*/
String name() default "";
/** (Optional) The catalog of the table.
* <p>
* Defaults to the default catalog.
/**
* (Optional) The catalog of the table.
*
* <p>Defaults to the default catalog.
*
* @return String
*/
String catalog() default "";
/**
* (Optional) Unique constraints that are to be placed on
* the table. These are only used if table generation is in
* effect. These constraints apply in addition to any constraints
* specified by the <code>Column</code> and <code>JoinColumn</code>
* annotations and constraints entailed by primary key mappings.
* <p>
* Defaults to no additional constraints.
* (Optional) Unique constraints that are to be placed on the table. These are only used if table generation is in
* effect. These constraints apply in addition to any constraints specified by the <code>Column</code> and <code>
* JoinColumn</code> annotations and constraints entailed by primary key mappings.
*
* <p>Defaults to no additional constraints.
*
* @return UniqueConstraint[]
*/
UniqueConstraint[] uniqueConstraints() default {};
/**
* (Optional) Indexes for the table. These are only used if
* table generation is in effect. Note that it is not necessary
* to specify an index for a primary key, as the primary key
* index will be created automatically.
* (Optional) Indexes for the table. These are only used if table generation is in effect. Note that it is not
* necessary to specify an index for a primary key, as the primary key index will be created automatically.
*
* @return indexes
* @since Java Persistence 2.1
@@ -84,9 +81,8 @@ public @interface Table {
/**
* comment
*
*
* @return String
*/
String comment() default "";
}

View File

@@ -1,30 +1,26 @@
/*******************************************************************************
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
/**
* ***************************************************************************** Copyright (c) 2008 - 2013 Oracle
* Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* <p>This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompanies this distribution. The Eclipse Public License is available
* at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Linda DeMichiel - Java Persistence 2.1
* Linda DeMichiel - Java Persistence 2.0
* <p>Contributors: Linda DeMichiel - Java Persistence 2.1 Linda DeMichiel - Java Persistence 2.0
*
******************************************************************************/
* <p>****************************************************************************
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* Specifies that the property or field is not persistent. It is used
* to annotate a property or field of an entity class, mapped
* superclass, or embeddable class.
* Specifies that the property or field is not persistent. It is used to annotate a property or field of an entity
* class, mapped superclass, or embeddable class.
*
* <pre>
* Example:
@@ -38,8 +34,10 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* </pre>
*
* @since Java Persistence 1.0
* @deprecated replace by {@link org.redkale.persistence.Transient}
* @see org.redkale.persistence.Transient
*/
@Deprecated(since = "2.8.0")
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Transient {}

View File

@@ -1,27 +1,24 @@
/** *****************************************************************************
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
/**
* ***************************************************************************** Copyright (c) 2008 - 2013 Oracle
* Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* <p>This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompanies this distribution. The Eclipse Public License is available
* at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Linda DeMichiel - Java Persistence 2.1
* Linda DeMichiel - Java Persistence 2.0
* <p>Contributors: Linda DeMichiel - Java Persistence 2.1 Linda DeMichiel - Java Persistence 2.0
*
***************************************************************************** */
* <p>****************************************************************************
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* Specifies that a unique constraint is to be included in
* the generated DDL for a primary or secondary table.
* Specifies that a unique constraint is to be included in the generated DDL for a primary or secondary table.
*
* <pre>
* Example:
@@ -35,20 +32,24 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* </pre>
*
* @since Java Persistence 1.0
* @deprecated replace by {@link org.redkale.persistence.UniqueConstraint}
* @see org.redkale.persistence.UniqueConstraint
*/
@Deprecated(since = "2.8.0")
@Target({})
@Retention(RUNTIME)
public @interface UniqueConstraint {
/** (Optional) Constraint name. A provider-chosen name will be chosen
* if a name is not specified.
/**
* (Optional) Constraint name. A provider-chosen name will be chosen if a name is not specified.
*
* @return String
* @since Java Persistence 2.0
*/
String name() default "";
/** (Required) An array of the column names that make up the constraint.
/**
* (Required) An array of the column names that make up the constraint.
*
* @return String[]
*/

View File

@@ -1,44 +1,54 @@
/**
* <p>
* see: https://redkale.org
*
* @author zhangjx
*
*/
module redkale {
module org.redkale {
requires java.base;
requires java.logging;
requires java.logging;
requires java.net.http;
requires java.sql;
requires jdk.unsupported; //sun.misc.Unsafe
requires jdk.unsupported; // sun.misc.Unsafe
exports javax.annotation;
exports javax.persistence;
exports org.redkale.asm;
exports org.redkale.annotation;
exports org.redkale.boot;
exports org.redkale.boot.watch;
exports org.redkale.cached;
exports org.redkale.cached.spi;
exports org.redkale.cluster;
exports org.redkale.cluster.spi;
exports org.redkale.convert;
exports org.redkale.convert.bson;
exports org.redkale.convert.ext;
exports org.redkale.convert.json;
exports org.redkale.convert.pb;
exports org.redkale.convert.spi;
exports org.redkale.inject;
exports org.redkale.locked;
exports org.redkale.locked.spi;
exports org.redkale.mq;
exports org.redkale.mq.spi;
exports org.redkale.net;
exports org.redkale.net.client;
exports org.redkale.net.http;
exports org.redkale.net.sncp;
exports org.redkale.persistence;
exports org.redkale.props.spi;
exports org.redkale.scheduled;
exports org.redkale.scheduled.spi;
exports org.redkale.service;
exports org.redkale.source;
exports org.redkale.source.spi;
exports org.redkale.util;
exports org.redkale.watch;
uses org.redkale.mq.MessageAgent;
uses org.redkale.cluster.ClusterAgent;
uses org.redkale.convert.ConvertProvider;
uses org.redkale.source.CacheSourceProvider;
uses org.redkale.source.DataSourceProvider;
uses org.redkale.util.ResourceAnnotationProvider;
uses org.redkale.util.YamlProvider;
uses org.redkale.props.spi.PropertiesAgentProvider;
uses org.redkale.cached.spi.CachedManagerProvider;
uses org.redkale.cluster.spi.ClusterAgentProvider;
uses org.redkale.convert.spi.ConvertProvider;
uses org.redkale.mq.spi.MessageAgentProvider;
uses org.redkale.scheduled.spi.ScheduledManagerProvider;
uses org.redkale.source.spi.CacheSourceProvider;
uses org.redkale.source.spi.DataSourceProvider;
uses org.redkale.source.spi.DataNativeSqlParserProvider;
}

View File

@@ -0,0 +1,27 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.annotation;
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* 自动加载。 使用场景: <br>
* 1、被标记为&#64;AutoLoad(false)的Service类不会被自动加载, 当被依赖时才会被加载 <br>
* 2、被标记为&#64;AutoLoad(false)的Servlet类不会被自动加载 <br>
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
*/
@Documented
@Target({TYPE})
@Retention(RUNTIME)
public @interface AutoLoad {
boolean value() default true;
}

View File

@@ -0,0 +1,26 @@
/*
*
*/
package org.redkale.annotation;
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;
/**
* 被标记的元素表示会被动态字节码调用
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
* @since 2.8.0
*/
@Documented
@Target({TYPE, METHOD, FIELD, CONSTRUCTOR})
@Retention(SOURCE)
public @interface ClassDepends {
Class[] value() default {};
String comment() default "";
}

View File

@@ -0,0 +1,47 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.annotation;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* 接收命令的标记, 只能标记在本地模式下Service里参数为(String)或(String, String[])的public方法上
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
* @since 2.1.0
*/
@Documented
@Target({METHOD})
@Retention(RUNTIME)
public @interface Command {
/**
* 命令号,没有指定值则接收所有的命令
*
* @return String
*/
String value() default "";
/**
* 参数帮助说明在value不为空命令redkale --help时显示
*
* @return String
* @since 2.7.0
*/
String description() default "";
/**
* 描述
*
* @return String
*/
String comment() default "";
}

View File

@@ -1,25 +1,29 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.service;
import java.lang.annotation.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import org.redkale.util.*;
/**
* 参数回写, 当Service的方法需要更改参数对象内部的数据时需要使用RpcCall
*
* <p> 详情见: https://redkale.org
* @author zhangjx
*/
@Inherited
@Documented
@Target({ElementType.PARAMETER})
@Retention(RUNTIME)
public @interface RpcCall {
Class<? extends Attribute> value();
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.annotation;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* 标记注释备注
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
*/
@Inherited
@Documented
@Target({TYPE, METHOD, FIELD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, ANNOTATION_TYPE, TYPE_PARAMETER})
@Retention(RUNTIME)
public @interface Comment {
String name() default "";
String value();
}

View File

@@ -0,0 +1,22 @@
package org.redkale.annotation;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* 标记Component的Service类特点: <br>
* 1、直接构造, 不使用Sncp动态构建对象 <br>
* 2、不会生成对应协议的Servlet <br>
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
* @since 2.8.0
*/
@Inherited
@Documented
@Target({TYPE})
@Retention(RUNTIME)
public @interface Component {}

View File

@@ -0,0 +1,49 @@
/*
*/
package org.redkale.annotation;
import java.lang.annotation.Documented;
import static java.lang.annotation.ElementType.TYPE;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
/**
* 启动服务时的初始化配置,需要结合{@link org.redkale.annotation.Resource}使用
* <blockquote>
* <pre>
* &#064;Configuration
* public class MyConfiguration {
*
* &#064;Resource(name = "a")
* BeanA createBeanA() {
* System.out.println("创建一个Bean");
* BeanA bean = new BeanA();
* bean.desc = "auto";
* return bean;
* }
*
* &#064;Resource(name = "b")
* BeanA createBeanA(&#064;Resource(name = "dev.desc") String desc) {
* System.out.println("创建一个Bean");
* BeanA bean = new BeanA();
* bean.desc = name;
* return bean;
* }
* }
*
* </pre>
* </blockquote>
*
* <p>
* 详情见: https://redkale.org
*
* @author zhangjx
* @since 2.8.0
*/
@Documented
@Target({TYPE})
@Retention(RUNTIME)
public @interface Configuration {}

View File

@@ -0,0 +1,27 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.annotation;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* 类似java.beans.ConstructorProperties, 必须配合Creator使用
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
*/
@Documented
@Target({METHOD, CONSTRUCTOR})
@Retention(RUNTIME)
@ClassDepends
public @interface ConstructorParameters {
String[] value();
}

View File

@@ -0,0 +1,51 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.annotation;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* 等于level日志级别且包含keys字符串的日志才会被排除 <br>
*
* <blockquote>
*
* <pre>
* &#64;LogExcludeLevel(levels = {"FINEST"}, keys = {"SET username ="})
* public class UserRecord {
* public int userid;
* public String username = "";
* }
*
* 这样当调用DataSource对UserRecord对象进行操作时拼接的SQL语句含"SET username ="字样的都会在FINEST日志级别过滤掉
* </pre>
*
* </blockquote>
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
*/
@Documented
@Target({TYPE})
@Retention(RUNTIME)
@Repeatable(LogExcludeLevel.LogExcludeLevels.class)
public @interface LogExcludeLevel {
String[] levels();
String[] keys();
@Documented
@Target({TYPE})
@Retention(RUNTIME)
@interface LogExcludeLevels {
LogExcludeLevel[] value();
}
}

View File

@@ -0,0 +1,26 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.annotation;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* 被标记的日志级别以上的才会被记录
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
*/
@Documented
@Target({TYPE})
@Retention(RUNTIME)
public @interface LogLevel {
String value();
}

View File

@@ -0,0 +1,25 @@
/*
*
*/
package org.redkale.annotation;
import java.lang.annotation.*;
/**
* 非阻塞模式标记, 标记在Service类和方法、Filter类、HttpServlet类上 <br>
* 一般情况下,没有显注此注解的方法视为阻塞时, 以下两种情况除外: <br>
* 1、返回类型是CompletionStage <br>
* 2、返回类型是void且参数存在CompletionHandler类型 <br>
* 阻塞模式的方法会在work线程池中运行 非阻塞在IO线程中运行。
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
* @since 2.8.0
*/
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface NonBlocking { // 不可使用@Inherited防止被继承, 见HttpServlet.preExecute/authenticate/execute
boolean value() default true;
}

View File

@@ -0,0 +1,18 @@
/*
*
*/
package org.redkale.annotation;
import java.lang.annotation.*;
/**
* 标记值可以为null
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
* @since 2.8.0
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface Nonnull {}

View File

@@ -0,0 +1,18 @@
/*
*
*/
package org.redkale.annotation;
import java.lang.annotation.*;
/**
* 标记值可以为null
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
* @since 2.8.0
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface Nullable {}

View File

@@ -0,0 +1,29 @@
/*
*
*/
package org.redkale.annotation;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* 参数名注解,编译时加上 <b>-parameters</b> 参数可以不用此注解
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
* @since 2.8.0
*/
@Documented
@Target({PARAMETER})
@Retention(RUNTIME)
public @interface Param {
String value();
String comment() default "";
}

View File

@@ -0,0 +1,20 @@
/*
*
*/
package org.redkale.annotation;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* @since Common Annotations 1.0
* @since 2.8.0
*/
@Documented
@Retention(RUNTIME)
@Target(METHOD)
public @interface PostConstruct {}

View File

@@ -0,0 +1,18 @@
/*
*
*/
package org.redkale.annotation;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;
import java.lang.annotation.*;
/**
* @since Common Annotations 1.0
* @since 2.8.0
*/
@Documented
@Retention(RUNTIME)
@Target(METHOD)
public @interface PreDestroy {}

View File

@@ -0,0 +1,45 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.redkale.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 值越大,优先级越高
*
* @since Common Annotations 1.2
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Priority {
/** 最高优先级, 其他值必须比此值小 */
public static final int HIGHTEST = Integer.MAX_VALUE;
/** 最低优先级, 其他值必须比此值大 */
public static final int LOWEST = Integer.MIN_VALUE;
/**
* 优先级值
*
* @return int
*/
int value();
}

View File

@@ -0,0 +1,60 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.annotation;
import java.lang.annotation.*;
/**
* &#64;Resource(name = "@") 表示资源name采用所属对象的name <br>
* &#64;Resource(name = "#name") 表示资源对象自身的name <br>
* &#64;Resource(name = "#type") 表示资源对象自身的类型 <br>
*
* @since Common Annotations 1.0
* @since 2.8.0
*/
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface Resource {
public static final String PARENT_NAME = "@";
public static final String SELF_NAME = "#name";
public static final String SELF_TYPE = "#type";
/**
* 是否必须存在
*
* @return boolean
* @since 2.8.0
*/
public boolean required() default true;
/**
* 资源名称 <br>
*
* <blockquote>
*
* <pre>
* name规则:
* 1: "@"有特殊含义, 表示资源本身,"@"不能单独使用
* 2: "#name"、"#type"有特殊含义
* 3: 只能是字母、数字、(短横)-、(下划线)_、点(.)的组合
* </pre>
*
* </blockquote>
*
* @return String
*/
public String name() default "";
/**
* 依赖注入的类型
*
* @return Class
*/
public Class<?> type() default Object.class;
}

View File

@@ -0,0 +1,67 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.annotation;
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* &#64;Resource资源被更新时的监听事件, 本注解只能标记在方法参数为ResourceEvent[]上 <br>
* 注意: 一个类只能存在一个&#64;ResourceChanged的方法 多余的会被忽略 <br>
* 方法在资源被更新以后调用。
*
* <blockquote>
*
* <pre>
* public class RecordService implements Service {
*
* &#64;Resource(name = "record.id")
* private int id;
*
* &#64;Resource(name = "record.name")
* private String name;
*
* &#64;ResourceChanged
* private void changeResource(ResourceEvent[] events) {
* for(ResourceEvent event : events) {
* System.out .println("@Resource = " + event.name()
* + " 资源变更: newVal = " + event.newValue() + ", oldVal = " + event.oldValue());
* }
* }
*
* public static void main(String[] args) throws Exception {
* ResourceFactory factory = ResourceFactory.create();
* factory.register("record.id", "2345");
* factory.register("record.name", "my old name");
* Record record = new Record();
* factory.inject(record);
* factory.register("record.name", "my new name");
* }
* }
* </pre>
*
* </blockquote>
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
*/
@Documented
@Target({METHOD})
@Retention(RUNTIME)
public @interface ResourceChanged {
/**
* 新旧值是否不相同的情况下才回调方法 <br>
* true: 新值与旧值不相同才回调ResourceChanged方法 <br>
* false: 只要执行了ResourceFactory.register 就回调ResourceChanged方法
*
* @since 2.7.0
* @return boolean
*/
boolean different() default true;
}

View File

@@ -0,0 +1,64 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.annotation;
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* &#64;Resource资源被依赖注入时的监听事件。<br>
* 本注解只能标记在空参数或者(String、Object、java.lang.reflect.Field)三个参数类型的任意组合方法上 <br>
* 方法在资源被依赖注入后调用。
*
* <blockquote>
*
* <pre>
* public class ResourceService implements Service {
*
* &#64;Resource(name = "res.id")
* private int id;
*
* &#64;Resource(name = "res.name")
* private String name;
*
* &#64;ResourceInjected
* private void onInjected(Object dest, String fieldName) {
* System.out .println("资源被注入到对象(" + dest + ")的字段(" + fieldName + ")上");
* }
* }
*
* public class RecordService implements Service {
*
* &#64;Resource
* private ResourceService resService;
*
* public void test() {
* }
*
* public static void main(String[] args) throws Exception {
* ResourceFactory factory = ResourceFactory.create();
* factory.register("res.id", "2345");
* factory.register("res.name", "my old name");
* ResourceService res = new ResourceService();
* factory.inject(res);
* factory.register("", res);
* RecordService serice = new RecordService();
* factory.inject(record);
* }
* }
* </pre>
*
* </blockquote>
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
*/
@Documented
@Target({METHOD})
@Retention(RUNTIME)
public @interface ResourceInjected {}

View File

@@ -0,0 +1,28 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.annotation;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* 显式的指明资源类型。 调用ResourceFactory.register(Object rs)时通常执行的是ResourceFactory.register(rs.getClass(), Object rs);
* 若rs.getClass()的类标记了&#64;ResourceType, 则使用&#64;ResourceType.value()的class值进行注入。
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
*/
@Inherited
@Documented
@Target({TYPE})
@Retention(RUNTIME)
public @interface ResourceType {
Class value();
}

View File

@@ -0,0 +1,21 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.annotation;
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* 用于预编译时执行Convert.convertFrom方法
*
* @since 2.5.0
*/
@Inherited
@Documented
@Target(TYPE)
@Retention(RUNTIME)
public @interface Serial {}

View File

@@ -0,0 +1,2 @@
/** 提供基础注解包 */
package org.redkale.annotation;

View File

@@ -59,9 +59,9 @@
package org.redkale.asm;
/**
* A visitor to visit a Java annotation. The methods of this class must be
* called in the following order: ( &#60;tt&#62;visit&#60;/tt&#62; | &#60;tt&#62;visitEnum&#60;/tt&#62; |
* &#60;tt&#62;visitAnnotation&#60;/tt&#62; | &#60;tt&#62;visitArray&#60;/tt&#62; )* &#60;tt&#62;visitEnd&#60;/tt&#62;.
* A visitor to visit a Java annotation. The methods of this class must be called in the following order: (
* &#60;tt&#62;visit&#60;/tt&#62; | &#60;tt&#62;visitEnum&#60;/tt&#62; | &#60;tt&#62;visitAnnotation&#60;/tt&#62; |
* &#60;tt&#62;visitArray&#60;/tt&#62; )* &#60;tt&#62;visitEnd&#60;/tt&#62;.
*
* @author Eric Bruneton
* @author Eugene Kuleshov
@@ -69,23 +69,19 @@ package org.redkale.asm;
public abstract class AnnotationVisitor {
/**
* The ASM API version implemented by this visitor. The value of this field
* must be one of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* The ASM API version implemented by this visitor. The value of this field must be one of {@link Opcodes#ASM4},
* {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
*/
protected final int api;
/**
* The annotation visitor to which this visitor must delegate method calls.
* May be null.
*/
/** The annotation visitor to which this visitor must delegate method calls. May be null. */
protected AnnotationVisitor av;
/**
* Constructs a new {@link AnnotationVisitor}.
*
* @param api
* the ASM API version implemented by this visitor. Must be one
* of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* @param api the ASM API version implemented by this visitor. Must be one of {@link Opcodes#ASM4},
* {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
*/
public AnnotationVisitor(final int api) {
this(api, null);
@@ -94,12 +90,9 @@ public abstract class AnnotationVisitor {
/**
* Constructs a new {@link AnnotationVisitor}.
*
* @param api
* the ASM API version implemented by this visitor. Must be one
* of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* @param av
* the annotation visitor to which this visitor must delegate
* method calls. May be null.
* @param api the ASM API version implemented by this visitor. Must be one of {@link Opcodes#ASM4},
* {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* @param av the annotation visitor to which this visitor must delegate method calls. May be null.
*/
public AnnotationVisitor(final int api, final AnnotationVisitor av) {
this.api = api;
@@ -109,17 +102,12 @@ public abstract class AnnotationVisitor {
/**
* Visits a primitive value of the annotation.
*
* @param name
* the value name.
* @param value
* the actual value, whose type must be {@link Byte},
* {@link Boolean}, {@link Character}, {@link Short},
* {@link Integer} , {@link Long}, {@link Float}, {@link Double},
* {@link String} or {@link Type} of OBJECT or ARRAY sort. This
* value can also be an array of byte, boolean, short, char, int,
* long, float or double values (this is equivalent to using
* {@link #visitArray visitArray} and visiting each array element
* in turn, but is more convenient).
* @param name the value name.
* @param value the actual value, whose type must be {@link Byte}, {@link Boolean}, {@link Character},
* {@link Short}, {@link Integer} , {@link Long}, {@link Float}, {@link Double}, {@link String} or {@link Type}
* of OBJECT or ARRAY sort. This value can also be an array of byte, boolean, short, char, int, long, float or
* double values (this is equivalent to using {@link #visitArray visitArray} and visiting each array element in
* turn, but is more convenient).
*/
public void visit(String name, Object value) {
if (av != null) {
@@ -130,12 +118,9 @@ public abstract class AnnotationVisitor {
/**
* Visits an enumeration value of the annotation.
*
* @param name
* the value name.
* @param desc
* the class descriptor of the enumeration class.
* @param value
* the actual enumeration value.
* @param name the value name.
* @param desc the class descriptor of the enumeration class.
* @param value the actual enumeration value.
*/
public void visitEnum(String name, String desc, String value) {
if (av != null) {
@@ -146,15 +131,11 @@ public abstract class AnnotationVisitor {
/**
* Visits a nested annotation value of the annotation.
*
* @param name
* the value name.
* @param desc
* the class descriptor of the nested annotation class.
* @return a visitor to visit the actual nested annotation value, or
* &#60;tt&#62;null&#60;/tt&#62; if this visitor is not interested in visiting this
* nested annotation. <i>The nested annotation value must be fully
* visited before calling other methods on this annotation
* visitor</i>.
* @param name the value name.
* @param desc the class descriptor of the nested annotation class.
* @return a visitor to visit the actual nested annotation value, or &#60;tt&#62;null&#60;/tt&#62; if this visitor
* is not interested in visiting this nested annotation. <i>The nested annotation value must be fully visited
* before calling other methods on this annotation visitor</i>.
*/
public AnnotationVisitor visitAnnotation(String name, String desc) {
if (av != null) {
@@ -164,18 +145,14 @@ public abstract class AnnotationVisitor {
}
/**
* Visits an array value of the annotation. Note that arrays of primitive
* types (such as byte, boolean, short, char, int, long, float or double)
* can be passed as value to {@link #visit visit}. This is what
* {@link ClassReader} does.
* Visits an array value of the annotation. Note that arrays of primitive types (such as byte, boolean, short, char,
* int, long, float or double) can be passed as value to {@link #visit visit}. This is what {@link ClassReader}
* does.
*
* @param name
* the value name.
* @return a visitor to visit the actual array value elements, or
* &#60;tt&#62;null&#60;/tt&#62; if this visitor is not interested in visiting these
* values. The 'name' parameters passed to the methods of this
* visitor are ignored. <i>All the array values must be visited
* before calling other methods on this annotation visitor</i>.
* @param name the value name.
* @return a visitor to visit the actual array value elements, or &#60;tt&#62;null&#60;/tt&#62; if this visitor is
* not interested in visiting these values. The 'name' parameters passed to the methods of this visitor are
* ignored. <i>All the array values must be visited before calling other methods on this annotation visitor</i>.
*/
public AnnotationVisitor visitArray(String name) {
if (av != null) {
@@ -184,9 +161,7 @@ public abstract class AnnotationVisitor {
return null;
}
/**
* Visits the end of the annotation.
*/
/** Visits the end of the annotation. */
public void visitEnd() {
if (av != null) {
av.visitEnd();

View File

@@ -66,50 +66,34 @@ package org.redkale.asm;
*/
final class AnnotationWriter extends AnnotationVisitor {
/**
* The class writer to which this annotation must be added.
*/
/** The class writer to which this annotation must be added. */
private final ClassWriter cw;
/**
* The number of values in this annotation.
*/
/** The number of values in this annotation. */
private int size;
/**
* &#60;tt&#62;true&#60;tt&#62; if values are named, &#60;tt&#62;false&#60;/tt&#62; otherwise. Annotation
* writers used for annotation default and annotation arrays use unnamed
* values.
* &#60;tt&#62;true&#60;tt&#62; if values are named, &#60;tt&#62;false&#60;/tt&#62; otherwise. Annotation writers
* used for annotation default and annotation arrays use unnamed values.
*/
private final boolean named;
/**
* The annotation values in bytecode form. This byte vector only contains
* the values themselves, i.e. the number of values must be stored as a
* unsigned short just before these bytes.
* The annotation values in bytecode form. This byte vector only contains the values themselves, i.e. the number of
* values must be stored as a unsigned short just before these bytes.
*/
private final ByteVector bv;
/**
* The byte vector to be used to store the number of values of this
* annotation. See {@link #bv}.
*/
/** The byte vector to be used to store the number of values of this annotation. See {@link #bv}. */
private final ByteVector parent;
/**
* Where the number of values of this annotation must be stored in
* {@link #parent}.
*/
/** Where the number of values of this annotation must be stored in {@link #parent}. */
private final int offset;
/**
* Next annotation writer. This field is used to store annotation lists.
*/
/** Next annotation writer. This field is used to store annotation lists. */
AnnotationWriter next;
/**
* Previous annotation writer. This field is used to store annotation lists.
*/
/** Previous annotation writer. This field is used to store annotation lists. */
AnnotationWriter prev;
// ------------------------------------------------------------------------
@@ -119,20 +103,14 @@ final class AnnotationWriter extends AnnotationVisitor {
/**
* Constructs a new {@link AnnotationWriter}.
*
* @param cw
* the class writer to which this annotation must be added.
* @param named
* &#60;tt&#62;true&#60;tt&#62; if values are named, &#60;tt&#62;false&#60;/tt&#62; otherwise.
* @param bv
* where the annotation values must be stored.
* @param parent
* where the number of annotation values must be stored.
* @param offset
* where in &#60;tt&#62;parent&#60;/tt&#62; the number of annotation values must
* be stored.
* @param cw the class writer to which this annotation must be added.
* @param named &#60;tt&#62;true&#60;tt&#62; if values are named, &#60;tt&#62;false&#60;/tt&#62; otherwise.
* @param bv where the annotation values must be stored.
* @param parent where the number of annotation values must be stored.
* @param offset where in &#60;tt&#62;parent&#60;/tt&#62; the number of annotation values must be stored.
*/
AnnotationWriter(final ClassWriter cw, final boolean named,
final ByteVector bv, final ByteVector parent, final int offset) {
AnnotationWriter(
final ClassWriter cw, final boolean named, final ByteVector bv, final ByteVector parent, final int offset) {
super(Opcodes.ASM6);
this.cw = cw;
this.named = named;
@@ -219,8 +197,7 @@ final class AnnotationWriter extends AnnotationVisitor {
}
@Override
public void visitEnum(final String name, final String desc,
final String value) {
public void visitEnum(final String name, final String desc, final String value) {
++size;
if (named) {
bv.putShort(cw.newUTF8(name));
@@ -229,8 +206,7 @@ final class AnnotationWriter extends AnnotationVisitor {
}
@Override
public AnnotationVisitor visitAnnotation(final String name,
final String desc) {
public AnnotationVisitor visitAnnotation(final String name, final String desc) {
++size;
if (named) {
bv.putShort(cw.newUTF8(name));
@@ -280,11 +256,9 @@ final class AnnotationWriter extends AnnotationVisitor {
}
/**
* Puts the annotations of this annotation writer list into the given byte
* vector.
* Puts the annotations of this annotation writer list into the given byte vector.
*
* @param out
* where the annotations must be put.
* @param out where the annotations must be put.
*/
void put(final ByteVector out) {
int n = 0;
@@ -311,15 +285,11 @@ final class AnnotationWriter extends AnnotationVisitor {
/**
* Puts the given annotation lists into the given byte vector.
*
* @param panns
* an array of annotation writer lists.
* @param off
* index of the first annotation to be written.
* @param out
* where the annotations must be put.
* @param panns an array of annotation writer lists.
* @param off index of the first annotation to be written.
* @param out where the annotations must be put.
*/
static void put(final AnnotationWriter[] panns, final int off,
final ByteVector out) {
static void put(final AnnotationWriter[] panns, final int off, final ByteVector out) {
int size = 1 + 2 * (panns.length - off);
for (int i = off; i < panns.length; ++i) {
size += panns[i] == null ? 0 : panns[i].getSize();
@@ -346,49 +316,45 @@ final class AnnotationWriter extends AnnotationVisitor {
}
/**
* Puts the given type reference and type path into the given bytevector.
* LOCAL_VARIABLE and RESOURCE_VARIABLE target types are not supported.
* Puts the given type reference and type path into the given bytevector. LOCAL_VARIABLE and RESOURCE_VARIABLE
* target types are not supported.
*
* @param typeRef
* a reference to the annotated type. See {@link TypeReference}.
* @param typePath
* the path to the annotated type argument, wildcard bound, array
* element type, or static inner type within 'typeRef'. May be
* &#60;tt&#62;null&#60;/tt&#62; if the annotation targets 'typeRef' as a whole.
* @param out
* where the type reference and type path must be put.
* @param typeRef a reference to the annotated type. See {@link TypeReference}.
* @param typePath the path to the annotated type argument, wildcard bound, array element type, or static inner type
* within 'typeRef'. May be &#60;tt&#62;null&#60;/tt&#62; if the annotation targets 'typeRef' as a whole.
* @param out where the type reference and type path must be put.
*/
static void putTarget(int typeRef, TypePath typePath, ByteVector out) {
switch (typeRef >>> 24) {
case 0x00: // CLASS_TYPE_PARAMETER
case 0x01: // METHOD_TYPE_PARAMETER
case 0x16: // METHOD_FORMAL_PARAMETER
out.putShort(typeRef >>> 16);
break;
case 0x13: // FIELD
case 0x14: // METHOD_RETURN
case 0x15: // METHOD_RECEIVER
out.putByte(typeRef >>> 24);
break;
case 0x47: // CAST
case 0x48: // CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
case 0x49: // METHOD_INVOCATION_TYPE_ARGUMENT
case 0x4A: // CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
case 0x4B: // METHOD_REFERENCE_TYPE_ARGUMENT
out.putInt(typeRef);
break;
// case 0x10: // CLASS_EXTENDS
// case 0x11: // CLASS_TYPE_PARAMETER_BOUND
// case 0x12: // METHOD_TYPE_PARAMETER_BOUND
// case 0x17: // THROWS
// case 0x42: // EXCEPTION_PARAMETER
// case 0x43: // INSTANCEOF
// case 0x44: // NEW
// case 0x45: // CONSTRUCTOR_REFERENCE
// case 0x46: // METHOD_REFERENCE
default:
out.put12(typeRef >>> 24, (typeRef & 0xFFFF00) >> 8);
break;
case 0x00: // CLASS_TYPE_PARAMETER
case 0x01: // METHOD_TYPE_PARAMETER
case 0x16: // METHOD_FORMAL_PARAMETER
out.putShort(typeRef >>> 16);
break;
case 0x13: // FIELD
case 0x14: // METHOD_RETURN
case 0x15: // METHOD_RECEIVER
out.putByte(typeRef >>> 24);
break;
case 0x47: // CAST
case 0x48: // CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
case 0x49: // METHOD_INVOCATION_TYPE_ARGUMENT
case 0x4A: // CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
case 0x4B: // METHOD_REFERENCE_TYPE_ARGUMENT
out.putInt(typeRef);
break;
// case 0x10: // CLASS_EXTENDS
// case 0x11: // CLASS_TYPE_PARAMETER_BOUND
// case 0x12: // METHOD_TYPE_PARAMETER_BOUND
// case 0x17: // THROWS
// case 0x42: // EXCEPTION_PARAMETER
// case 0x43: // INSTANCEOF
// case 0x44: // NEW
// case 0x45: // CONSTRUCTOR_REFERENCE
// case 0x46: // METHOD_REFERENCE
default:
out.put12(typeRef >>> 24, (typeRef & 0xFFFF00) >> 8);
break;
}
if (typePath == null) {
out.putByte(0);

View File

@@ -0,0 +1,157 @@
/*
*
*/
package org.redkale.asm;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.redkale.annotation.Param;
/**
* 存放方法的字节信息
*
* @see org.redkale.asm.AsmMethodBoost
* @since 2.8.0
*/
public class AsmMethodBean {
private List<AsmMethodParam> params;
private int access;
private String name;
private String desc;
private String signature;
private String[] exceptions;
public AsmMethodBean() {}
public AsmMethodBean(int access, String name, String desc, String signature, String[] exceptions) {
this.access = access;
this.name = name;
this.desc = desc;
this.signature = signature;
this.exceptions = exceptions;
this.params = new ArrayList<>();
}
public static AsmMethodBean get(Map<String, AsmMethodBean> map, Method method) {
return map == null ? null : map.get(method.getName() + ":" + Type.getMethodDescriptor(method));
}
void removeEmptyNames() {
if (params != null) {
List<AsmMethodParam> dels = null;
for (AsmMethodParam p : params) {
if (" ".equals(p.getName())) {
if (dels == null) {
dels = new ArrayList<>();
}
dels.add(p);
}
}
if (dels != null) {
for (AsmMethodParam p : dels) {
params.remove(p);
}
}
}
}
public List<String> fieldNameList() {
return paramNameList(null);
}
public List<String> paramNameList(Method method) {
if (params == null) {
return new ArrayList<>();
}
int index = 0;
Parameter[] ps = method == null ? null : method.getParameters();
List<String> rs = new ArrayList<>(params.size());
for (AsmMethodParam p : params) {
Param pann = ps == null ? null : ps[index].getAnnotation(Param.class);
rs.add(pann == null ? p.getName() : pann.value());
index++;
}
return rs;
}
public String[] fieldNameArray() {
return paramNameArray(null);
}
public String[] paramNameArray(Method method) {
if (params == null) {
return null;
}
Parameter[] ps = method == null ? null : method.getParameters();
// params包含了throws, size()可能比ps.length大
String[] rs = new String[ps == null ? params.size() : ps.length];
for (int i = 0; i < rs.length; i++) {
Param pann = ps == null ? null : ps[i].getAnnotation(Param.class);
rs[i] = pann == null ? params.get(i).getName() : pann.value();
}
return rs;
}
public List<AsmMethodParam> getParams() {
return params;
}
public void setParams(List<AsmMethodParam> params) {
this.params = params;
}
public int getAccess() {
return access;
}
public void setAccess(int access) {
this.access = access;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getSignature() {
return signature;
}
public void setSignature(String signature) {
this.signature = signature;
}
public String[] getExceptions() {
return exceptions;
}
public void setExceptions(String[] exceptions) {
this.exceptions = exceptions;
}
@Override
public String toString() {
return "{params:" + params + ", access:" + access + ", name:" + name + ", desc:" + desc + ", signature:"
+ signature + ", exceptions:" + exceptions + '}';
}
}

View File

@@ -0,0 +1,464 @@
/*
*
*/
package org.redkale.asm;
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import org.redkale.annotation.Nullable;
import static org.redkale.asm.Opcodes.ACC_PRIVATE;
import static org.redkale.asm.Opcodes.ACC_PROTECTED;
import static org.redkale.asm.Opcodes.ACC_PUBLIC;
import static org.redkale.asm.Opcodes.ALOAD;
import static org.redkale.asm.Opcodes.ARETURN;
import static org.redkale.asm.Opcodes.DLOAD;
import static org.redkale.asm.Opcodes.DRETURN;
import static org.redkale.asm.Opcodes.FLOAD;
import static org.redkale.asm.Opcodes.FRETURN;
import static org.redkale.asm.Opcodes.ILOAD;
import static org.redkale.asm.Opcodes.IRETURN;
import static org.redkale.asm.Opcodes.LLOAD;
import static org.redkale.asm.Opcodes.LRETURN;
import static org.redkale.asm.Opcodes.RETURN;
import org.redkale.inject.ResourceFactory;
import org.redkale.util.RedkaleClassLoader;
import org.redkale.util.Utility;
/**
* 生产动态字节码的方法扩展器, 可以进行方法加强动作
*
* <p>详情见: https://redkale.org
*
* @param <T> 泛型
* @author zhangjx
* @since 2.8.0
*/
public abstract class AsmMethodBoost<T> {
protected final AtomicInteger fieldIndex = new AtomicInteger();
protected final boolean remote;
protected final Class serviceType;
protected AsmMethodBoost(boolean remote, Class serviceType) {
this.remote = remote;
this.serviceType = serviceType;
}
public static AsmMethodBoost create(boolean remote, Collection<AsmMethodBoost> list) {
return new AsmMethodBoosts(remote, list);
}
public static AsmMethodBoost create(boolean remote, AsmMethodBoost... items) {
return new AsmMethodBoosts(remote, items);
}
/**
* 返回一个类所有方法的字节信息, key为: method.getName+':'+Type.getMethodDescriptor(method)
*
* @param clazz Class
* @return Map
*/
public static Map<String, AsmMethodBean> getMethodBeans(Class clazz) {
Map<String, AsmMethodBean> rs = MethodParamClassVisitor.getMethodParamNames(new HashMap<>(), clazz);
// 返回的List中参数列表可能会比方法参数量多因为方法内的临时变量也会存入list中 所以需要list的元素集合比方法的参数多
rs.values().forEach(AsmMethodBean::removeEmptyNames);
return rs;
}
public static String getMethodBeanKey(Method method) {
return method.getName() + ":" + Type.getMethodDescriptor(method);
}
/**
* 获取需屏蔽的方法上的注解
*
* @param method 方法
* @return 需要屏蔽的注解
*/
public abstract List<Class<? extends Annotation>> filterMethodAnnotations(Method method);
/**
* 对方法进行动态加强处理
*
* @param classLoader ClassLoader
* @param cw 动态字节码Writer
* @param serviceImplClass 原始实现类
* @param newDynName 动态新类名
* @param fieldPrefix 动态字段的前缀
* @param filterAnns 需要过滤的注解
* @param method 操作的方法
* @param newMethod 新的方法名, 可能为null
* @return 下一个新的方法名不做任何处理应返回参数newMethodName
*/
public abstract AsmNewMethod doMethod(
RedkaleClassLoader classLoader,
ClassWriter cw,
Class serviceImplClass,
String newDynName,
String fieldPrefix,
List<Class<? extends Annotation>> filterAnns,
Method method,
@Nullable AsmNewMethod newMethod);
/**
* 处理所有动态方法后调用
*
* @param classLoader ClassLoader
* @param cw 动态字节码Writer
* @param newDynName 动态新类名
* @param fieldPrefix 动态字段的前缀
*/
public void doAfterMethods(RedkaleClassLoader classLoader, ClassWriter cw, String newDynName, String fieldPrefix) {}
/**
* 处理所有动态方法后调用
*
* @param classLoader ClassLoader
* @param cw 动态字节码Writer
* @param mv 构造函数MethodVisitor
* @param newDynName 动态新类名
* @param fieldPrefix 动态字段的前缀
* @param remote 是否远程模式
*/
public void doConstructorMethod(
RedkaleClassLoader classLoader,
ClassWriter cw,
MethodVisitor mv,
String newDynName,
String fieldPrefix,
boolean remote) {}
/**
* 实例对象进行操作,通常用于给动态的字段赋值
*
* @param classLoader ClassLoader
* @param resourceFactory ResourceFactory
* @param service 实例对象
*/
public abstract void doInstance(RedkaleClassLoader classLoader, ResourceFactory resourceFactory, T service);
protected AsmMethodBean getMethodBean(Method method) {
Map<String, AsmMethodBean> methodBeans = AsmMethodBoost.getMethodBeans(serviceType);
return AsmMethodBean.get(methodBeans, method);
}
protected MethodVisitor createMethodVisitor(
ClassWriter cw, Method method, AsmNewMethod newMethod, AsmMethodBean methodBean) {
return new MethodDebugVisitor(cw.visitMethod(
getAcc(method, newMethod),
getNowMethodName(method, newMethod),
Type.getMethodDescriptor(method),
getMethodSignature(method, methodBean),
getMethodExceptions(method, methodBean)));
}
protected final int getAcc(Method method, AsmNewMethod newMethod) {
if (newMethod != null) {
return ACC_PRIVATE;
}
return Modifier.isProtected(method.getModifiers()) ? ACC_PROTECTED : ACC_PUBLIC;
}
protected String getNowMethodName(Method method, AsmNewMethod newMethod) {
return newMethod == null ? method.getName() : newMethod.getMethodName();
}
protected String getMethodSignature(Method method, AsmMethodBean methodBean) {
return methodBean != null ? methodBean.getSignature() : null;
}
protected String[] getMethodExceptions(Method method, AsmMethodBean methodBean) {
if (methodBean == null) {
String[] exceptions = null;
Class<?>[] expTypes = method.getExceptionTypes();
if (expTypes.length > 0) {
exceptions = new String[expTypes.length];
for (int i = 0; i < expTypes.length; i++) {
exceptions[i] = expTypes[i].getName().replace('.', '/');
}
}
return exceptions;
} else {
return methodBean.getExceptions();
}
}
protected void visitRawAnnotation(
Method method, AsmNewMethod newMethod, MethodVisitor mv, Class skipAnnType, List skipAnns) {
if (newMethod == null) {
// 给方法加上原有的Annotation
final Annotation[] anns = method.getAnnotations();
for (Annotation ann : anns) {
if (ann.annotationType() != skipAnnType
&& (skipAnns == null || !skipAnns.contains(ann.annotationType()))) {
Asms.visitAnnotation(
mv.visitAnnotation(Type.getDescriptor(ann.annotationType()), true),
ann.annotationType(),
ann);
}
}
// 给参数加上原有的Annotation
final Annotation[][] annss = method.getParameterAnnotations();
for (int k = 0; k < annss.length; k++) {
for (Annotation ann : annss[k]) {
Asms.visitAnnotation(
mv.visitParameterAnnotation(k, Type.getDescriptor(ann.annotationType()), true),
ann.annotationType(),
ann);
}
}
}
}
protected List<Integer> visitVarInsnParamTypes(MethodVisitor mv, Method method, int insn) {
// 传参数
Class[] paramTypes = method.getParameterTypes();
List<Integer> insns = new ArrayList<>();
for (Class pt : paramTypes) {
insn++;
if (pt.isPrimitive()) {
if (pt == long.class) {
mv.visitVarInsn(LLOAD, insn++);
} else if (pt == float.class) {
mv.visitVarInsn(FLOAD, insn++);
} else if (pt == double.class) {
mv.visitVarInsn(DLOAD, insn++);
} else {
mv.visitVarInsn(ILOAD, insn);
}
} else {
mv.visitVarInsn(ALOAD, insn);
}
insns.add(insn);
}
return insns;
}
protected void visitParamTypesLocalVariable(
MethodVisitor mv, Method method, Label l0, Label l2, List<Integer> insns, AsmMethodBean methodBean) {
Class[] paramTypes = method.getParameterTypes();
if (methodBean != null && paramTypes.length > 0) {
mv.visitLabel(l2);
List<AsmMethodParam> params = methodBean.getParams();
for (int i = 0; i < paramTypes.length; i++) {
AsmMethodParam param = params.get(i);
mv.visitLocalVariable(
param.getName(),
param.description(paramTypes[i]),
param.signature(paramTypes[i]),
l0,
l2,
insns.get(i));
}
}
}
protected void visitInsnReturn(
MethodVisitor mv, Method method, Label l0, List<Integer> insns, AsmMethodBean methodBean) {
if (method.getGenericReturnType() == void.class) {
mv.visitInsn(RETURN);
} else {
Class returnclz = method.getReturnType();
if (returnclz.isPrimitive()) {
if (returnclz == long.class) {
mv.visitInsn(LRETURN);
} else if (returnclz == float.class) {
mv.visitInsn(FRETURN);
} else if (returnclz == double.class) {
mv.visitInsn(DRETURN);
} else {
mv.visitInsn(IRETURN);
}
} else {
mv.visitInsn(ARETURN);
}
}
visitParamTypesLocalVariable(mv, method, l0, new Label(), insns, methodBean);
}
/**
* 生产动态字节码的方法扩展器, 可以进行方法加强动作
*
* @param <T> 泛型
* @since 2.8.0
*/
static class AsmMethodBoosts<T> extends AsmMethodBoost<T> {
private final AsmMethodBoost[] items;
public AsmMethodBoosts(boolean remote, Collection<AsmMethodBoost> list) {
super(remote, null);
this.items = list.toArray(new AsmMethodBoost[list.size()]);
}
public AsmMethodBoosts(boolean remote, AsmMethodBoost... items) {
super(remote, null);
this.items = items;
}
@Override
public List<Class<? extends Annotation>> filterMethodAnnotations(Method method) {
List<Class<? extends Annotation>> list = null;
for (AsmMethodBoost item : items) {
if (item != null) {
List<Class<? extends Annotation>> sub = item.filterMethodAnnotations(method);
if (sub != null) {
if (list == null) {
list = new ArrayList<>();
}
list.addAll(sub);
}
}
}
return list;
}
@Override
public AsmNewMethod doMethod(
RedkaleClassLoader classLoader,
ClassWriter cw,
Class serviceImplClass,
String newDynName,
String fieldPrefix,
List<Class<? extends Annotation>> filterAnns,
Method method,
AsmNewMethod newMethod) {
AsmNewMethod newResult = newMethod;
for (AsmMethodBoost item : items) {
if (item != null) {
newResult = item.doMethod(
classLoader, cw, serviceImplClass, newDynName, fieldPrefix, filterAnns, method, newResult);
}
}
return newResult;
}
@Override
public void doAfterMethods(
RedkaleClassLoader classLoader, ClassWriter cw, String newDynName, String fieldPrefix) {
for (AsmMethodBoost item : items) {
if (item != null) {
item.doAfterMethods(classLoader, cw, newDynName, fieldPrefix);
}
}
}
@Override
public void doConstructorMethod(
RedkaleClassLoader classLoader,
ClassWriter cw,
MethodVisitor mv,
String newDynName,
String fieldPrefix,
boolean remote) {
for (AsmMethodBoost item : items) {
if (item != null) {
item.doConstructorMethod(classLoader, cw, mv, newDynName, fieldPrefix, remote);
}
}
}
@Override
public void doInstance(RedkaleClassLoader classLoader, ResourceFactory resourceFactory, T service) {
for (AsmMethodBoost item : items) {
if (item != null) {
item.doInstance(classLoader, resourceFactory, service);
}
}
}
}
static class MethodParamClassVisitor extends ClassVisitor {
private Class serviceType;
private final Map<String, AsmMethodBean> methodBeanMap;
public MethodParamClassVisitor(int api, Class serviceType, final Map<String, AsmMethodBean> methodBeanMap) {
super(api);
this.serviceType = serviceType;
this.methodBeanMap = methodBeanMap;
}
@Override
public MethodVisitor visitMethod(
int methodAccess,
String methodName,
String methodDesc,
String methodSignature,
String[] methodExceptions) {
super.visitMethod(api, methodName, methodDesc, methodSignature, methodExceptions);
if (java.lang.reflect.Modifier.isStatic(methodAccess)) {
return null;
}
String key = methodName + ":" + methodDesc;
if (methodBeanMap.containsKey(key)) {
return null;
}
AsmMethodBean bean =
new AsmMethodBean(methodAccess, methodName, methodDesc, methodSignature, methodExceptions);
List<AsmMethodParam> paramList = bean.getParams();
methodBeanMap.put(key, bean);
return new MethodVisitor(Opcodes.ASM6) {
@Override
public void visitParameter(String paramName, int paramAccess) {
paramList.add(new AsmMethodParam(paramName));
}
@Override
public void visitLocalVariable(
String varName, String varDesc, String varSignature, Label start, Label end, int varIndex) {
if (varIndex < 1) {
return;
}
int size = paramList.size();
// index并不会按顺序执行
if (varIndex > size) {
for (int i = size; i < varIndex; i++) {
paramList.add(new AsmMethodParam(" ", varDesc, varSignature));
}
paramList.set(varIndex - 1, new AsmMethodParam(varName, varDesc, varSignature));
}
paramList.set(varIndex - 1, new AsmMethodParam(varName, varDesc, varSignature));
}
};
}
// 返回的List中参数列表可能会比方法参数量多因为方法内的临时变量也会存入list中 所以需要list的元素集合比方法的参数多
static Map<String, AsmMethodBean> getMethodParamNames(Map<String, AsmMethodBean> map, Class clazz) {
String n = clazz.getName();
byte[] bs = RedkaleClassLoader.getDynClassBytes(n);
if (bs == null) {
InputStream in = clazz.getResourceAsStream(n.substring(n.lastIndexOf('.') + 1) + ".class");
if (in == null) {
return map;
}
try {
bs = Utility.readBytesThenClose(in);
} catch (Exception e) {
// do nothing
}
}
try {
new ClassReader(bs).accept(new MethodParamClassVisitor(Opcodes.ASM6, clazz, map), 0);
} catch (Exception e) {
e.printStackTrace();
// do nothing
}
Class superClass = clazz.getSuperclass();
if (superClass == null || superClass == Object.class) { // 接口的getSuperclass为null
return map;
}
return getMethodParamNames(map, superClass);
}
}
}

View File

@@ -0,0 +1,71 @@
/*
*
*/
package org.redkale.asm;
import org.redkale.util.TypeToken;
/**
* 存放方法参数的字节信息
*
* @see org.redkale.asm.AsmMethodBean
* @see org.redkale.asm.AsmMethodBoost
* @since 2.8.0
*/
public class AsmMethodParam {
private String name;
private String description;
private String signature;
public AsmMethodParam() {}
public AsmMethodParam(String name) {
this.name = name;
}
public AsmMethodParam(String name, String description, String signature) {
this.name = name;
this.description = description;
this.signature = signature;
}
public String description(java.lang.reflect.Type type) {
return description == null ? Type.getDescriptor(TypeToken.typeToClass(type)) : description;
}
public String signature(java.lang.reflect.Type type) {
return signature;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getSignature() {
return signature;
}
public void setSignature(String signature) {
this.signature = signature;
}
@Override
public String toString() {
return "{name:" + name + ", description:" + description + ", signature:" + signature + '}';
}
}

View File

@@ -0,0 +1,47 @@
/*
*/
package org.redkale.asm;
import org.redkale.convert.json.JsonConvert;
/**
* 存放新方法的信息
*
* @since 2.8.0
*/
public class AsmNewMethod {
private String methodName;
private int methodAccs;
public AsmNewMethod() {}
public AsmNewMethod(String newName, int newAccs) {
this.methodName = newName;
this.methodAccs = newAccs;
}
public String getMethodName() {
return methodName;
}
public void setMethodName(String methodName) {
this.methodName = methodName;
}
public int getMethodAccs() {
return methodAccs;
}
public void setMethodAccs(int methodAccs) {
this.methodAccs = methodAccs;
}
@Override
public String toString() {
return JsonConvert.root().convertTo(this);
}
}

View File

@@ -0,0 +1,230 @@
/*
*
*/
package org.redkale.asm;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Set;
import static org.redkale.asm.Opcodes.BIPUSH;
import static org.redkale.asm.Opcodes.CHECKCAST;
import static org.redkale.asm.Opcodes.GETSTATIC;
import static org.redkale.asm.Opcodes.ICONST_0;
import static org.redkale.asm.Opcodes.INVOKESTATIC;
import static org.redkale.asm.Opcodes.INVOKEVIRTUAL;
import static org.redkale.asm.Opcodes.SIPUSH;
import org.redkale.util.RedkaleException;
/**
* ASM简单的工具方法 <br>
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
* @since 2.8.0
*/
public final class Asms {
private Asms() {}
public static Handle createLambdaMetaHandle() {
return new Handle(
Opcodes.H_INVOKESTATIC,
"java/lang/invoke/LambdaMetafactory",
"metafactory",
"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;",
false);
}
// annType与annValue不一定是同一类型
public static <T extends Annotation> void visitAnnotation(
final AnnotationVisitor av, final Class<T> annType, final Annotation annValue) {
try {
Set<String> methods = null;
if (annType != annValue.annotationType()) {
methods = new HashSet<>();
for (Method anm : annType.getMethods()) {
methods.add(anm.getName());
}
}
for (Method anm : annValue.annotationType().getMethods()) {
final String mname = anm.getName();
if ("equals".equals(mname)
|| "hashCode".equals(mname)
|| "toString".equals(mname)
|| "annotationType".equals(mname)) {
continue;
}
if (methods != null && !methods.contains(mname)) {
continue;
}
final Object r = anm.invoke(annValue);
if (r instanceof String[]) {
AnnotationVisitor av1 = av.visitArray(mname);
for (String item : (String[]) r) {
av1.visit(null, item);
}
av1.visitEnd();
} else if (r instanceof Class[]) {
AnnotationVisitor av1 = av.visitArray(mname);
for (Class item : (Class[]) r) {
av1.visit(null, Type.getType(item));
}
av1.visitEnd();
} else if (r instanceof Enum[]) {
AnnotationVisitor av1 = av.visitArray(mname);
for (Enum item : (Enum[]) r) {
av1.visitEnum(null, Type.getDescriptor(item.getClass()), item.name());
}
av1.visitEnd();
} else if (r instanceof Annotation[]) {
AnnotationVisitor av1 = av.visitArray(mname);
for (Annotation item : (Annotation[]) r) {
visitAnnotation(
av1.visitAnnotation(null, Type.getDescriptor(((Annotation) r).annotationType())),
item.annotationType(),
item);
}
av1.visitEnd();
} else if (r instanceof Class) {
av.visit(mname, Type.getType((Class) r));
} else if (r instanceof Enum) {
av.visitEnum(mname, Type.getDescriptor(r.getClass()), ((Enum) r).name());
} else if (r instanceof Annotation) {
visitAnnotation(
av.visitAnnotation(null, Type.getDescriptor(((Annotation) r).annotationType())),
((Annotation) r).annotationType(),
(Annotation) r);
} else {
av.visit(mname, r);
}
}
av.visitEnd();
} catch (Exception e) {
throw new RedkaleException(e);
}
}
public static void visitInsn(MethodVisitor mv, int num) {
if (num < 6) {
mv.visitInsn(ICONST_0 + num);
} else if (num <= Byte.MAX_VALUE) {
mv.visitIntInsn(BIPUSH, num);
} else if (num <= Short.MAX_VALUE) {
mv.visitIntInsn(SIPUSH, num);
} else {
mv.visitLdcInsn(num);
}
}
public static void visitFieldInsn(MethodVisitor mv, Class clazz) {
if (clazz == boolean.class) {
mv.visitFieldInsn(GETSTATIC, "java/lang/Boolean", "TYPE", "Ljava/lang/Class;");
} else if (clazz == byte.class) {
mv.visitFieldInsn(GETSTATIC, "java/lang/Byte", "TYPE", "Ljava/lang/Class;");
} else if (clazz == char.class) {
mv.visitFieldInsn(GETSTATIC, "java/lang/Character", "TYPE", "Ljava/lang/Class;");
} else if (clazz == short.class) {
mv.visitFieldInsn(GETSTATIC, "java/lang/Short", "TYPE", "Ljava/lang/Class;");
} else if (clazz == int.class) {
mv.visitFieldInsn(GETSTATIC, "java/lang/Integer", "TYPE", "Ljava/lang/Class;");
} else if (clazz == float.class) {
mv.visitFieldInsn(GETSTATIC, "java/lang/Float", "TYPE", "Ljava/lang/Class;");
} else if (clazz == long.class) {
mv.visitFieldInsn(GETSTATIC, "java/lang/Long", "TYPE", "Ljava/lang/Class;");
} else if (clazz == double.class) {
mv.visitFieldInsn(GETSTATIC, "java/lang/Double", "TYPE", "Ljava/lang/Class;");
} else {
mv.visitLdcInsn(Type.getType(Type.getDescriptor(clazz)));
}
}
public static void visitPrimitiveValueOf(MethodVisitor mv, Class clazz) {
if (clazz == boolean.class) {
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;", false);
} else if (clazz == byte.class) {
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;", false);
} else if (clazz == short.class) {
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;", false);
} else if (clazz == char.class) {
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "valueOf", "(C)Ljava/lang/Character;", false);
} else if (clazz == int.class) {
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;", false);
} else if (clazz == float.class) {
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;", false);
} else if (clazz == long.class) {
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;", false);
} else if (clazz == double.class) {
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;", false);
}
}
public static void visitCheckCast(MethodVisitor mv, Class clazz) {
if (clazz == boolean.class) {
mv.visitTypeInsn(CHECKCAST, "java/lang/Boolean");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false);
} else if (clazz == byte.class) {
mv.visitTypeInsn(CHECKCAST, "java/lang/Byte");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Byte", "byteValue", "()B", false);
} else if (clazz == short.class) {
mv.visitTypeInsn(CHECKCAST, "java/lang/Short");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Short", "shortValue", "()S", false);
} else if (clazz == char.class) {
mv.visitTypeInsn(CHECKCAST, "java/lang/Character");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Character", "charValue", "()C", false);
} else if (clazz == int.class) {
mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I", false);
} else if (clazz == float.class) {
mv.visitTypeInsn(CHECKCAST, "java/lang/Float");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Float", "floatValue", "()F", false);
} else if (clazz == long.class) {
mv.visitTypeInsn(CHECKCAST, "java/lang/Long");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J", false);
} else if (clazz == double.class) {
mv.visitTypeInsn(CHECKCAST, "java/lang/Double");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Double", "doubleValue", "()D", false);
} else if (clazz == boolean[].class) {
mv.visitTypeInsn(CHECKCAST, "[Z");
} else if (clazz == byte[].class) {
mv.visitTypeInsn(CHECKCAST, "[B");
} else if (clazz == short[].class) {
mv.visitTypeInsn(CHECKCAST, "[S");
} else if (clazz == char[].class) {
mv.visitTypeInsn(CHECKCAST, "[C");
} else if (clazz == int[].class) {
mv.visitTypeInsn(CHECKCAST, "[I");
} else if (clazz == float[].class) {
mv.visitTypeInsn(CHECKCAST, "[F");
} else if (clazz == long[].class) {
mv.visitTypeInsn(CHECKCAST, "[J");
} else if (clazz == double[].class) {
mv.visitTypeInsn(CHECKCAST, "[D");
} else if (clazz.isArray()) {
mv.visitTypeInsn(CHECKCAST, Type.getDescriptor(clazz));
} else {
mv.visitTypeInsn(CHECKCAST, clazz.getName().replace('.', '/'));
}
}
public static void visitPrimitiveVirtual(MethodVisitor mv, Class clazz) {
if (clazz == boolean.class) {
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false);
} else if (clazz == byte.class) {
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Byte", "byteValue", "()B", false);
} else if (clazz == short.class) {
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Short", "shortValue", "()S", false);
} else if (clazz == char.class) {
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Character", "charValue", "()C", false);
} else if (clazz == int.class) {
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I", false);
} else if (clazz == float.class) {
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Float", "floatValue", "()F", false);
} else if (clazz == long.class) {
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J", false);
} else if (clazz == double.class) {
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Double", "doubleValue", "()D", false);
}
}
}

View File

@@ -68,34 +68,27 @@ import java.util.Arrays;
*/
public class Attribute {
/**
* The type of this attribute.
*/
/** The type of this attribute. */
public final String type;
/**
* The raw value of this attribute, used only for unknown attributes.
*/
/** The raw value of this attribute, used only for unknown attributes. */
byte[] value;
/**
* The next attribute in this attribute list. May be &#60;tt&#62;null&#60;/tt&#62;.
*/
/** The next attribute in this attribute list. May be &#60;tt&#62;null&#60;/tt&#62;. */
Attribute next;
/**
* Constructs a new empty attribute.
*
* @param type
* the type of the attribute.
* @param type the type of the attribute.
*/
protected Attribute(final String type) {
this.type = type;
}
/**
* Returns &#60;tt&#62;true&#60;/tt&#62; if this type of attribute is unknown. The default
* implementation of this method always returns &#60;tt&#62;true&#60;/tt&#62;.
* Returns &#60;tt&#62;true&#60;/tt&#62; if this type of attribute is unknown. The default implementation of this
* method always returns &#60;tt&#62;true&#60;/tt&#62;.
*
* @return &#60;tt&#62;true&#60;/tt&#62; if this type of attribute is unknown.
*/
@@ -115,46 +108,37 @@ public class Attribute {
/**
* Returns the labels corresponding to this attribute.
*
* @return the labels corresponding to this attribute, or &#60;tt&#62;null&#60;/tt&#62; if
* this attribute is not a code attribute that contains labels.
* @return the labels corresponding to this attribute, or &#60;tt&#62;null&#60;/tt&#62; if this attribute is not a
* code attribute that contains labels.
*/
protected Label[] getLabels() {
return null;
}
/**
* Reads a {@link #type type} attribute. This method must return a
* <i>new</i> {@link Attribute} object, of type {@link #type type},
* corresponding to the &#60;tt&#62;len&#60;/tt&#62; bytes starting at the given offset, in
* the given class reader.
* Reads a {@link #type type} attribute. This method must return a <i>new</i> {@link Attribute} object, of type
* {@link #type type}, corresponding to the &#60;tt&#62;len&#60;/tt&#62; bytes starting at the given offset, in the
* given class reader.
*
* @param cr
* the class that contains the attribute to be read.
* @param off
* index of the first byte of the attribute's content in
* {@link ClassReader#b cr.b}. The 6 attribute header bytes,
* containing the type and the length of the attribute, are not
* taken into account here.
* @param len
* the length of the attribute's content.
* @param buf
* buffer to be used to call {@link ClassReader#readUTF8
* readUTF8}, {@link ClassReader#readClass(int,char[]) readClass}
* or {@link ClassReader#readConst readConst}.
* @param codeOff
* index of the first byte of code's attribute content in
* {@link ClassReader#b cr.b}, or -1 if the attribute to be read
* is not a code attribute. The 6 attribute header bytes,
* containing the type and the length of the attribute, are not
* taken into account here.
* @param labels
* the labels of the method's code, or &#60;tt&#62;null&#60;/tt&#62; if the
* attribute to be read is not a code attribute.
* @return a <i>new</i> {@link Attribute} object corresponding to the given
* bytes.
* @param cr the class that contains the attribute to be read.
* @param off index of the first byte of the attribute's content in {@link ClassReader#b cr.b}. The 6 attribute
* header bytes, containing the type and the length of the attribute, are not taken into account here.
* @param len the length of the attribute's content.
* @param buf buffer to be used to call {@link ClassReader#readUTF8 readUTF8},
* {@link ClassReader#readClass(int,char[]) readClass} or {@link ClassReader#readConst readConst}.
* @param codeOff index of the first byte of code's attribute content in {@link ClassReader#b cr.b}, or -1 if the
* attribute to be read is not a code attribute. The 6 attribute header bytes, containing the type and the
* length of the attribute, are not taken into account here.
* @param labels the labels of the method's code, or &#60;tt&#62;null&#60;/tt&#62; if the attribute to be read is
* not a code attribute.
* @return a <i>new</i> {@link Attribute} object corresponding to the given bytes.
*/
protected Attribute read(final ClassReader cr, final int off,
final int len, final char[] buf, final int codeOff,
protected Attribute read(
final ClassReader cr,
final int off,
final int len,
final char[] buf,
final int codeOff,
final Label[] labels) {
Attribute attr = new Attribute(type);
attr.value = new byte[len];
@@ -165,30 +149,20 @@ public class Attribute {
/**
* Returns the byte array form of this attribute.
*
* @param cw
* the class to which this attribute must be added. This
* parameter can be used to add to the constant pool of this
* class the items that corresponds to this attribute.
* @param code
* the bytecode of the method corresponding to this code
* attribute, or &#60;tt&#62;null&#60;/tt&#62; if this attribute is not a code
* attributes.
* @param len
* the length of the bytecode of the method corresponding to this
* code attribute, or &#60;tt&#62;null&#60;/tt&#62; if this attribute is not a
* code attribute.
* @param maxStack
* the maximum stack size of the method corresponding to this
* code attribute, or -1 if this attribute is not a code
* attribute.
* @param maxLocals
* the maximum number of local variables of the method
* corresponding to this code attribute, or -1 if this attribute
* is not a code attribute.
* @param cw the class to which this attribute must be added. This parameter can be used to add to the constant pool
* of this class the items that corresponds to this attribute.
* @param code the bytecode of the method corresponding to this code attribute, or &#60;tt&#62;null&#60;/tt&#62; if
* this attribute is not a code attributes.
* @param len the length of the bytecode of the method corresponding to this code attribute, or
* &#60;tt&#62;null&#60;/tt&#62; if this attribute is not a code attribute.
* @param maxStack the maximum stack size of the method corresponding to this code attribute, or -1 if this
* attribute is not a code attribute.
* @param maxLocals the maximum number of local variables of the method corresponding to this code attribute, or -1
* if this attribute is not a code attribute.
* @return the byte array form of this attribute.
*/
protected ByteVector write(final ClassWriter cw, final byte[] code,
final int len, final int maxStack, final int maxLocals) {
protected ByteVector write(
final ClassWriter cw, final byte[] code, final int len, final int maxStack, final int maxLocals) {
ByteVector v = new ByteVector();
v.data = value;
v.length = value.length;
@@ -213,30 +187,20 @@ public class Attribute {
/**
* Returns the size of all the attributes in this attribute list.
*
* @param cw
* the class writer to be used to convert the attributes into
* byte arrays, with the {@link #write write} method.
* @param code
* the bytecode of the method corresponding to these code
* attributes, or &#60;tt&#62;null&#60;/tt&#62; if these attributes are not code
* attributes.
* @param len
* the length of the bytecode of the method corresponding to
* these code attributes, or &#60;tt&#62;null&#60;/tt&#62; if these attributes
* are not code attributes.
* @param maxStack
* the maximum stack size of the method corresponding to these
* code attributes, or -1 if these attributes are not code
* attributes.
* @param maxLocals
* the maximum number of local variables of the method
* corresponding to these code attributes, or -1 if these
* attributes are not code attributes.
* @return the size of all the attributes in this attribute list. This size
* includes the size of the attribute headers.
* @param cw the class writer to be used to convert the attributes into byte arrays, with the {@link #write write}
* method.
* @param code the bytecode of the method corresponding to these code attributes, or &#60;tt&#62;null&#60;/tt&#62;
* if these attributes are not code attributes.
* @param len the length of the bytecode of the method corresponding to these code attributes, or
* &#60;tt&#62;null&#60;/tt&#62; if these attributes are not code attributes.
* @param maxStack the maximum stack size of the method corresponding to these code attributes, or -1 if these
* attributes are not code attributes.
* @param maxLocals the maximum number of local variables of the method corresponding to these code attributes, or
* -1 if these attributes are not code attributes.
* @return the size of all the attributes in this attribute list. This size includes the size of the attribute
* headers.
*/
final int getSize(final ClassWriter cw, final byte[] code, final int len,
final int maxStack, final int maxLocals) {
final int getSize(final ClassWriter cw, final byte[] code, final int len, final int maxStack, final int maxLocals) {
Attribute attr = this;
int size = 0;
while (attr != null) {
@@ -248,33 +212,27 @@ public class Attribute {
}
/**
* Writes all the attributes of this attribute list in the given byte
* vector.
* Writes all the attributes of this attribute list in the given byte vector.
*
* @param cw
* the class writer to be used to convert the attributes into
* byte arrays, with the {@link #write write} method.
* @param code
* the bytecode of the method corresponding to these code
* attributes, or &#60;tt&#62;null&#60;/tt&#62; if these attributes are not code
* attributes.
* @param len
* the length of the bytecode of the method corresponding to
* these code attributes, or &#60;tt&#62;null&#60;/tt&#62; if these attributes
* are not code attributes.
* @param maxStack
* the maximum stack size of the method corresponding to these
* code attributes, or -1 if these attributes are not code
* attributes.
* @param maxLocals
* the maximum number of local variables of the method
* corresponding to these code attributes, or -1 if these
* attributes are not code attributes.
* @param out
* where the attributes must be written.
* @param cw the class writer to be used to convert the attributes into byte arrays, with the {@link #write write}
* method.
* @param code the bytecode of the method corresponding to these code attributes, or &#60;tt&#62;null&#60;/tt&#62;
* if these attributes are not code attributes.
* @param len the length of the bytecode of the method corresponding to these code attributes, or
* &#60;tt&#62;null&#60;/tt&#62; if these attributes are not code attributes.
* @param maxStack the maximum stack size of the method corresponding to these code attributes, or -1 if these
* attributes are not code attributes.
* @param maxLocals the maximum number of local variables of the method corresponding to these code attributes, or
* -1 if these attributes are not code attributes.
* @param out where the attributes must be written.
*/
final void put(final ClassWriter cw, final byte[] code, final int len,
final int maxStack, final int maxLocals, final ByteVector out) {
final void put(
final ClassWriter cw,
final byte[] code,
final int len,
final int maxStack,
final int maxLocals,
final ByteVector out) {
Attribute attr = this;
while (attr != null) {
ByteVector b = attr.write(cw, code, len, maxStack, maxLocals);
@@ -284,15 +242,12 @@ public class Attribute {
}
}
//The stuff below is temporary - once proper support for nestmate attribute has been added, it can be safely removed.
//see also changes in ClassReader.accept.
/**
*
*/
// The stuff below is temporary - once proper support for nestmate attribute has been added, it can be safely
// removed.
// see also changes in ClassReader.accept.
/** */
public static class NestMembers extends Attribute {
/**
*
*/
/** */
public NestMembers() {
super("NestMembers");
}
@@ -307,7 +262,7 @@ public class Attribute {
int size = cr.readShort(off);
a.classes = new String[size];
off += 2;
for (int i = 0; i < size ; i++) {
for (int i = 0; i < size; i++) {
a.classes[i] = cr.readClass(off, buf);
off += 2;
}
@@ -326,16 +281,12 @@ public class Attribute {
}
}
/**
*
*/
/** */
public static class NestHost extends Attribute {
byte[] bytes;
String clazz;
/**
*
*/
/** */
public NestHost() {
super("NestHost");
}
@@ -357,8 +308,5 @@ public class Attribute {
}
}
static final Attribute[] DEFAULT_ATTRIBUTE_PROTOS = new Attribute[] {
new NestMembers(),
new NestHost()
};
static final Attribute[] DEFAULT_ATTRIBUTE_PROTOS = new Attribute[] {new NestMembers(), new NestHost()};
}

View File

@@ -59,48 +59,37 @@
package org.redkale.asm;
/**
* A dynamically extensible vector of bytes. This class is roughly equivalent to
* a DataOutputStream on top of a ByteArrayOutputStream, but is more efficient.
* A dynamically extensible vector of bytes. This class is roughly equivalent to a DataOutputStream on top of a
* ByteArrayOutputStream, but is more efficient.
*
* @author Eric Bruneton
*/
public class ByteVector {
/**
* The content of this vector.
*/
/** The content of this vector. */
byte[] data;
/**
* Actual number of bytes in this vector.
*/
/** Actual number of bytes in this vector. */
int length;
/**
* Constructs a new {@link ByteVector ByteVector} with a default initial
* size.
*/
/** Constructs a new {@link ByteVector ByteVector} with a default initial size. */
public ByteVector() {
data = new byte[64];
}
/**
* Constructs a new {@link ByteVector ByteVector} with the given initial
* size.
* Constructs a new {@link ByteVector ByteVector} with the given initial size.
*
* @param initialSize
* the initial size of the byte vector to be constructed.
* @param initialSize the initial size of the byte vector to be constructed.
*/
public ByteVector(final int initialSize) {
data = new byte[initialSize];
}
/**
* Puts a byte into this byte vector. The byte vector is automatically
* enlarged if necessary.
* Puts a byte into this byte vector. The byte vector is automatically enlarged if necessary.
*
* @param b
* a byte.
* @param b a byte.
* @return this byte vector.
*/
public ByteVector putByte(final int b) {
@@ -114,13 +103,10 @@ public class ByteVector {
}
/**
* Puts two bytes into this byte vector. The byte vector is automatically
* enlarged if necessary.
* Puts two bytes into this byte vector. The byte vector is automatically enlarged if necessary.
*
* @param b1
* a byte.
* @param b2
* another byte.
* @param b1 a byte.
* @param b2 another byte.
* @return this byte vector.
*/
ByteVector put11(final int b1, final int b2) {
@@ -136,11 +122,9 @@ public class ByteVector {
}
/**
* Puts a short into this byte vector. The byte vector is automatically
* enlarged if necessary.
* Puts a short into this byte vector. The byte vector is automatically enlarged if necessary.
*
* @param s
* a short.
* @param s a short.
* @return this byte vector.
*/
public ByteVector putShort(final int s) {
@@ -156,13 +140,10 @@ public class ByteVector {
}
/**
* Puts a byte and a short into this byte vector. The byte vector is
* automatically enlarged if necessary.
* Puts a byte and a short into this byte vector. The byte vector is automatically enlarged if necessary.
*
* @param b
* a byte.
* @param s
* a short.
* @param b a byte.
* @param s a short.
* @return this byte vector.
*/
ByteVector put12(final int b, final int s) {
@@ -179,11 +160,9 @@ public class ByteVector {
}
/**
* Puts an int into this byte vector. The byte vector is automatically
* enlarged if necessary.
* Puts an int into this byte vector. The byte vector is automatically enlarged if necessary.
*
* @param i
* an int.
* @param i an int.
* @return this byte vector.
*/
public ByteVector putInt(final int i) {
@@ -201,11 +180,9 @@ public class ByteVector {
}
/**
* Puts a long into this byte vector. The byte vector is automatically
* enlarged if necessary.
* Puts a long into this byte vector. The byte vector is automatically enlarged if necessary.
*
* @param l
* a long.
* @param l a long.
* @return this byte vector.
*/
public ByteVector putLong(final long l) {
@@ -229,11 +206,9 @@ public class ByteVector {
}
/**
* Puts an UTF8 string into this byte vector. The byte vector is
* automatically enlarged if necessary.
* Puts an UTF8 string into this byte vector. The byte vector is automatically enlarged if necessary.
*
* @param s
* a String whose UTF8 encoded length must be less than 65536.
* @param s a String whose UTF8 encoded length must be less than 65536.
* @return this byte vector.
*/
public ByteVector putUTF8(final String s) {
@@ -268,20 +243,14 @@ public class ByteVector {
}
/**
* Puts an UTF8 string into this byte vector. The byte vector is
* automatically enlarged if necessary. The string length is encoded in two
* bytes before the encoded characters, if there is space for that (i.e. if
* this.length - i - 2 >= 0).
* Puts an UTF8 string into this byte vector. The byte vector is automatically enlarged if necessary. The string
* length is encoded in two bytes before the encoded characters, if there is space for that (i.e. if this.length - i
* - 2 >= 0).
*
* @param s
* the String to encode.
* @param i
* the index of the first character to encode. The previous
* characters are supposed to have already been encoded, using
* only one byte per character.
* @param maxByteLength
* the maximum byte length of the encoded string, including the
* already encoded characters.
* @param s the String to encode.
* @param i the index of the first character to encode. The previous characters are supposed to have already been
* encoded, using only one byte per character.
* @param maxByteLength the maximum byte length of the encoded string, including the already encoded characters.
* @return this byte vector.
*/
ByteVector encodeUTF8(final String s, int i, int maxByteLength) {
@@ -303,8 +272,8 @@ public class ByteVector {
}
int start = length - i - 2;
if (start >= 0) {
data[start] = (byte) (byteLength >>> 8);
data[start + 1] = (byte) byteLength;
data[start] = (byte) (byteLength >>> 8);
data[start + 1] = (byte) byteLength;
}
if (length + byteLength - i > data.length) {
enlarge(byteLength - i);
@@ -328,16 +297,12 @@ public class ByteVector {
}
/**
* Puts an array of bytes into this byte vector. The byte vector is
* automatically enlarged if necessary.
* Puts an array of bytes into this byte vector. The byte vector is automatically enlarged if necessary.
*
* @param b
* an array of bytes. May be &#60;tt&#62;null&#60;/tt&#62; to put &#60;tt&#62;len&#60;/tt&#62;
* null bytes into this byte vector.
* @param off
* index of the fist byte of b that must be copied.
* @param len
* number of bytes of b that must be copied.
* @param b an array of bytes. May be &#60;tt&#62;null&#60;/tt&#62; to put &#60;tt&#62;len&#60;/tt&#62; null bytes
* into this byte vector.
* @param off index of the fist byte of b that must be copied.
* @param len number of bytes of b that must be copied.
* @return this byte vector.
*/
public ByteVector putByteArray(final byte[] b, final int off, final int len) {
@@ -354,9 +319,7 @@ public class ByteVector {
/**
* Enlarge this byte vector so that it can receive n more bytes.
*
* @param size
* number of additional bytes that this byte vector should be
* able to receive.
* @param size number of additional bytes that this byte vector should be able to receive.
*/
private void enlarge(final int size) {
int length1 = 2 * data.length;

File diff suppressed because it is too large Load Diff

View File

@@ -59,35 +59,31 @@
package org.redkale.asm;
/**
* A visitor to visit a Java class. The methods of this class must be called in
* the following order: &#60;tt&#62;visit&#60;/tt&#62; [ &#60;tt&#62;visitSource&#60;/tt&#62; ] [
* &#60;tt&#62;visitModule&#60;/tt&#62; ][ &#60;tt&#62;visitOuterClass&#60;/tt&#62; ] ( &#60;tt&#62;visitAnnotation&#60;/tt&#62; |
* A visitor to visit a Java class. The methods of this class must be called in the following order:
* &#60;tt&#62;visit&#60;/tt&#62; [ &#60;tt&#62;visitSource&#60;/tt&#62; ] [ &#60;tt&#62;visitModule&#60;/tt&#62; ][
* &#60;tt&#62;visitOuterClass&#60;/tt&#62; ] ( &#60;tt&#62;visitAnnotation&#60;/tt&#62; |
* &#60;tt&#62;visitTypeAnnotation&#60;/tt&#62; | &#60;tt&#62;visitAttribute&#60;/tt&#62; )* (
* &#60;tt&#62;visitInnerClass&#60;/tt&#62; | &#60;tt&#62;visitField&#60;/tt&#62; | &#60;tt&#62;visitMethod&#60;/tt&#62; )*
* &#60;tt&#62;visitEnd&#60;/tt&#62;.
* &#60;tt&#62;visitInnerClass&#60;/tt&#62; | &#60;tt&#62;visitField&#60;/tt&#62; | &#60;tt&#62;visitMethod&#60;/tt&#62;
* )* &#60;tt&#62;visitEnd&#60;/tt&#62;.
*
* @author Eric Bruneton
*/
public abstract class ClassVisitor {
/**
* The ASM API version implemented by this visitor. The value of this field
* must be one of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* The ASM API version implemented by this visitor. The value of this field must be one of {@link Opcodes#ASM4},
* {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
*/
protected final int api;
/**
* The class visitor to which this visitor must delegate method calls. May
* be null.
*/
/** The class visitor to which this visitor must delegate method calls. May be null. */
protected ClassVisitor cv;
/**
* Constructs a new {@link ClassVisitor}.
*
* @param api
* the ASM API version implemented by this visitor. Must be one
* of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* @param api the ASM API version implemented by this visitor. Must be one of {@link Opcodes#ASM4},
* {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
*/
public ClassVisitor(final int api) {
this(api, null);
@@ -96,12 +92,9 @@ public abstract class ClassVisitor {
/**
* Constructs a new {@link ClassVisitor}.
*
* @param api
* the ASM API version implemented by this visitor. Must be one
* of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* @param cv
* the class visitor to which this visitor must delegate method
* calls. May be null.
* @param api the ASM API version implemented by this visitor. Must be one of {@link Opcodes#ASM4},
* {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* @param cv the class visitor to which this visitor must delegate method calls. May be null.
*/
public ClassVisitor(final int api, final ClassVisitor cv) {
this.api = api;
@@ -111,30 +104,19 @@ public abstract class ClassVisitor {
/**
* Visits the header of the class.
*
* @param version
* the class version.
* @param access
* the class's access flags (see {@link Opcodes}). This parameter
* also indicates if the class is deprecated.
* @param name
* the internal name of the class (see
* {@link Type#getInternalName() getInternalName}).
* @param signature
* the signature of this class. May be &#60;tt&#62;null&#60;/tt&#62; if the class
* is not a generic one, and does not extend or implement generic
* classes or interfaces.
* @param superName
* the internal of name of the super class (see
* {@link Type#getInternalName() getInternalName}). For
* interfaces, the super class is {@link Object}. May be
* &#60;tt&#62;null&#60;/tt&#62;, but only for the {@link Object} class.
* @param interfaces
* the internal names of the class's interfaces (see
* {@link Type#getInternalName() getInternalName}). May be
* &#60;tt&#62;null&#60;/tt&#62;.
* @param version the class version.
* @param access the class's access flags (see {@link Opcodes}). This parameter also indicates if the class is
* deprecated.
* @param name the internal name of the class (see {@link Type#getInternalName() getInternalName}).
* @param signature the signature of this class. May be &#60;tt&#62;null&#60;/tt&#62; if the class is not a generic
* one, and does not extend or implement generic classes or interfaces.
* @param superName the internal of name of the super class (see {@link Type#getInternalName() getInternalName}).
* For interfaces, the super class is {@link Object}. May be &#60;tt&#62;null&#60;/tt&#62;, but only for the
* {@link Object} class.
* @param interfaces the internal names of the class's interfaces (see {@link Type#getInternalName()
* getInternalName}). May be &#60;tt&#62;null&#60;/tt&#62;.
*/
public void visit(int version, int access, String name, String signature,
String superName, String[] interfaces) {
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
if (cv != null) {
cv.visit(version, access, name, signature, superName, interfaces);
}
@@ -143,13 +125,10 @@ public abstract class ClassVisitor {
/**
* Visits the source of the class.
*
* @param source
* the name of the source file from which the class was compiled.
* May be &#60;tt&#62;null&#60;/tt&#62;.
* @param debug
* additional debug information to compute the correspondance
* between source and compiled elements of the class. May be
* &#60;tt&#62;null&#60;/tt&#62;.
* @param source the name of the source file from which the class was compiled. May be
* &#60;tt&#62;null&#60;/tt&#62;.
* @param debug additional debug information to compute the correspondance between source and compiled elements of
* the class. May be &#60;tt&#62;null&#60;/tt&#62;.
*/
public void visitSource(String source, String debug) {
if (cv != null) {
@@ -159,15 +138,12 @@ public abstract class ClassVisitor {
/**
* Visit the module corresponding to the class.
* @param name
* module name
* @param access
* module flags, among {@code ACC_OPEN}, {@code ACC_SYNTHETIC}
* and {@code ACC_MANDATED}.
* @param version
* module version or null.
* @return a visitor to visit the module values, or &#60;tt&#62;null&#60;/tt&#62; if
* this visitor is not interested in visiting this module.
*
* @param name module name
* @param access module flags, among {@code ACC_OPEN}, {@code ACC_SYNTHETIC} and {@code ACC_MANDATED}.
* @param version module version or null.
* @return a visitor to visit the module values, or &#60;tt&#62;null&#60;/tt&#62; if this visitor is not interested
* in visiting this module.
*/
public ModuleVisitor visitModule(String name, int access, String version) {
if (api < Opcodes.ASM6) {
@@ -180,19 +156,13 @@ public abstract class ClassVisitor {
}
/**
* Visits the enclosing class of the class. This method must be called only
* if the class has an enclosing class.
* Visits the enclosing class of the class. This method must be called only if the class has an enclosing class.
*
* @param owner
* internal name of the enclosing class of the class.
* @param name
* the name of the method that contains the class, or
* &#60;tt&#62;null&#60;/tt&#62; if the class is not enclosed in a method of its
* enclosing class.
* @param desc
* the descriptor of the method that contains the class, or
* &#60;tt&#62;null&#60;/tt&#62; if the class is not enclosed in a method of its
* enclosing class.
* @param owner internal name of the enclosing class of the class.
* @param name the name of the method that contains the class, or &#60;tt&#62;null&#60;/tt&#62; if the class is not
* enclosed in a method of its enclosing class.
* @param desc the descriptor of the method that contains the class, or &#60;tt&#62;null&#60;/tt&#62; if the class
* is not enclosed in a method of its enclosing class.
*/
public void visitOuterClass(String owner, String name, String desc) {
if (cv != null) {
@@ -203,12 +173,10 @@ public abstract class ClassVisitor {
/**
* Visits an annotation of the class.
*
* @param desc
* the class descriptor of the annotation class.
* @param visible
* &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if
* this visitor is not interested in visiting this annotation.
* @param desc the class descriptor of the annotation class.
* @param visible &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if this visitor is not
* interested in visiting this annotation.
*/
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
if (cv != null) {
@@ -220,27 +188,18 @@ public abstract class ClassVisitor {
/**
* Visits an annotation on a type in the class signature.
*
* @param typeRef
* a reference to the annotated type. The sort of this type
* reference must be {@link TypeReference#CLASS_TYPE_PARAMETER
* CLASS_TYPE_PARAMETER},
* {@link TypeReference#CLASS_TYPE_PARAMETER_BOUND
* CLASS_TYPE_PARAMETER_BOUND} or
* {@link TypeReference#CLASS_EXTENDS CLASS_EXTENDS}. See
* {@link TypeReference}.
* @param typePath
* the path to the annotated type argument, wildcard bound, array
* element type, or static inner type within 'typeRef'. May be
* &#60;tt&#62;null&#60;/tt&#62; if the annotation targets 'typeRef' as a whole.
* @param desc
* the class descriptor of the annotation class.
* @param visible
* &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if
* this visitor is not interested in visiting this annotation.
* @param typeRef a reference to the annotated type. The sort of this type reference must be
* {@link TypeReference#CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER},
* {@link TypeReference#CLASS_TYPE_PARAMETER_BOUND CLASS_TYPE_PARAMETER_BOUND} or
* {@link TypeReference#CLASS_EXTENDS CLASS_EXTENDS}. See {@link TypeReference}.
* @param typePath the path to the annotated type argument, wildcard bound, array element type, or static inner type
* within 'typeRef'. May be &#60;tt&#62;null&#60;/tt&#62; if the annotation targets 'typeRef' as a whole.
* @param desc the class descriptor of the annotation class.
* @param visible &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if this visitor is not
* interested in visiting this annotation.
*/
public AnnotationVisitor visitTypeAnnotation(int typeRef,
TypePath typePath, String desc, boolean visible) {
public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) {
if (cv != null) {
return cv.visitTypeAnnotation(typeRef, typePath, desc, visible);
}
@@ -250,8 +209,7 @@ public abstract class ClassVisitor {
/**
* Visits a non standard attribute of the class.
*
* @param attr
* an attribute.
* @param attr an attribute.
*/
public void visitAttribute(Attribute attr) {
if (cv != null) {
@@ -260,25 +218,16 @@ public abstract class ClassVisitor {
}
/**
* Visits information about an inner class. This inner class is not
* necessarily a member of the class being visited.
* Visits information about an inner class. This inner class is not necessarily a member of the class being visited.
*
* @param name
* the internal name of an inner class (see
* {@link Type#getInternalName() getInternalName}).
* @param outerName
* the internal name of the class to which the inner class
* belongs (see {@link Type#getInternalName() getInternalName}).
* May be &#60;tt&#62;null&#60;/tt&#62; for not member classes.
* @param innerName
* the (simple) name of the inner class inside its enclosing
* class. May be &#60;tt&#62;null&#60;/tt&#62; for anonymous inner classes.
* @param access
* the access flags of the inner class as originally declared in
* the enclosing class.
* @param name the internal name of an inner class (see {@link Type#getInternalName() getInternalName}).
* @param outerName the internal name of the class to which the inner class belongs (see
* {@link Type#getInternalName() getInternalName}). May be &#60;tt&#62;null&#60;/tt&#62; for not member classes.
* @param innerName the (simple) name of the inner class inside its enclosing class. May be
* &#60;tt&#62;null&#60;/tt&#62; for anonymous inner classes.
* @param access the access flags of the inner class as originally declared in the enclosing class.
*/
public void visitInnerClass(String name, String outerName,
String innerName, int access) {
public void visitInnerClass(String name, String outerName, String innerName, int access) {
if (cv != null) {
cv.visitInnerClass(name, outerName, innerName, access);
}
@@ -287,32 +236,22 @@ public abstract class ClassVisitor {
/**
* Visits a field of the class.
*
* @param access
* the field's access flags (see {@link Opcodes}). This parameter
* also indicates if the field is synthetic and/or deprecated.
* @param name
* the field's name.
* @param desc
* the field's descriptor (see {@link Type Type}).
* @param signature
* the field's signature. May be &#60;tt&#62;null&#60;/tt&#62; if the field's
* type does not use generic types.
* @param value
* the field's initial value. This parameter, which may be
* &#60;tt&#62;null&#60;/tt&#62; if the field does not have an initial value,
* must be an {@link Integer}, a {@link Float}, a {@link Long}, a
* {@link Double} or a {@link String} (for &#60;tt&#62;int&#60;/tt&#62;,
* &#60;tt&#62;float&#60;/tt&#62;, &#60;tt&#62;long&#60;/tt&#62; or &#60;tt&#62;String&#60;/tt&#62; fields
* respectively). <i>This parameter is only used for static
* fields</i>. Its value is ignored for non static fields, which
* must be initialized through bytecode instructions in
* constructors or methods.
* @return a visitor to visit field annotations and attributes, or
* &#60;tt&#62;null&#60;/tt&#62; if this class visitor is not interested in visiting
* these annotations and attributes.
* @param access the field's access flags (see {@link Opcodes}). This parameter also indicates if the field is
* synthetic and/or deprecated.
* @param name the field's name.
* @param desc the field's descriptor (see {@link Type Type}).
* @param signature the field's signature. May be &#60;tt&#62;null&#60;/tt&#62; if the field's type does not use
* generic types.
* @param value the field's initial value. This parameter, which may be &#60;tt&#62;null&#60;/tt&#62; if the field
* does not have an initial value, must be an {@link Integer}, a {@link Float}, a {@link Long}, a {@link Double}
* or a {@link String} (for &#60;tt&#62;int&#60;/tt&#62;, &#60;tt&#62;float&#60;/tt&#62;,
* &#60;tt&#62;long&#60;/tt&#62; or &#60;tt&#62;String&#60;/tt&#62; fields respectively). <i>This parameter is
* only used for static fields</i>. Its value is ignored for non static fields, which must be initialized
* through bytecode instructions in constructors or methods.
* @return a visitor to visit field annotations and attributes, or &#60;tt&#62;null&#60;/tt&#62; if this class
* visitor is not interested in visiting these annotations and attributes.
*/
public FieldVisitor visitField(int access, String name, String desc,
String signature, Object value) {
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
if (cv != null) {
return cv.visitField(access, name, desc, signature, value);
}
@@ -320,32 +259,21 @@ public abstract class ClassVisitor {
}
/**
* Visits a method of the class. This method <i>must</i> return a new
* {@link MethodVisitor} instance (or &#60;tt&#62;null&#60;/tt&#62;) each time it is called,
* i.e., it should not return a previously returned visitor.
* Visits a method of the class. This method <i>must</i> return a new {@link MethodVisitor} instance (or
* &#60;tt&#62;null&#60;/tt&#62;) each time it is called, i.e., it should not return a previously returned visitor.
*
* @param access
* the method's access flags (see {@link Opcodes}). This
* parameter also indicates if the method is synthetic and/or
* deprecated.
* @param name
* the method's name.
* @param desc
* the method's descriptor (see {@link Type Type}).
* @param signature
* the method's signature. May be &#60;tt&#62;null&#60;/tt&#62; if the method
* parameters, return type and exceptions do not use generic
* types.
* @param exceptions
* the internal names of the method's exception classes (see
* {@link Type#getInternalName() getInternalName}). May be
* &#60;tt&#62;null&#60;/tt&#62;.
* @return an object to visit the byte code of the method, or &#60;tt&#62;null&#60;/tt&#62;
* if this class visitor is not interested in visiting the code of
* this method.
* @param access the method's access flags (see {@link Opcodes}). This parameter also indicates if the method is
* synthetic and/or deprecated.
* @param name the method's name.
* @param desc the method's descriptor (see {@link Type Type}).
* @param signature the method's signature. May be &#60;tt&#62;null&#60;/tt&#62; if the method parameters, return
* type and exceptions do not use generic types.
* @param exceptions the internal names of the method's exception classes (see {@link Type#getInternalName()
* getInternalName}). May be &#60;tt&#62;null&#60;/tt&#62;.
* @return an object to visit the byte code of the method, or &#60;tt&#62;null&#60;/tt&#62; if this class visitor is
* not interested in visiting the code of this method.
*/
public MethodVisitor visitMethod(int access, String name, String desc,
String signature, String[] exceptions) {
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
if (cv != null) {
return cv.visitMethod(access, name, desc, signature, exceptions);
}
@@ -353,9 +281,8 @@ public abstract class ClassVisitor {
}
/**
* Visits the end of the class. This method, which is the last one to be
* called, is used to inform the visitor that all the fields and methods of
* the class have been visited.
* Visits the end of the class. This method, which is the last one to be called, is used to inform the visitor that
* all the fields and methods of the class have been visited.
*/
public void visitEnd() {
if (cv != null) {

File diff suppressed because it is too large Load Diff

View File

@@ -66,109 +66,78 @@ package org.redkale.asm;
*/
class Context {
/**
* Prototypes of the attributes that must be parsed for this class.
*/
/** Prototypes of the attributes that must be parsed for this class. */
Attribute[] attrs;
/**
* The {@link ClassReader} option flags for the parsing of this class.
*/
/** The {@link ClassReader} option flags for the parsing of this class. */
int flags;
/**
* The buffer used to read strings.
*/
/** The buffer used to read strings. */
char[] buffer;
/**
* The start index of each bootstrap method.
*/
/** The start index of each bootstrap method. */
int[] bootstrapMethods;
/**
* The access flags of the method currently being parsed.
*/
/** The access flags of the method currently being parsed. */
int access;
/**
* The name of the method currently being parsed.
*/
/** The name of the method currently being parsed. */
String name;
/**
* The descriptor of the method currently being parsed.
*/
/** The descriptor of the method currently being parsed. */
String desc;
/**
* The label objects, indexed by bytecode offset, of the method currently
* being parsed (only bytecode offsets for which a label is needed have a
* non null associated Label object).
* The label objects, indexed by bytecode offset, of the method currently being parsed (only bytecode offsets for
* which a label is needed have a non null associated Label object).
*/
Label[] labels;
/**
* The target of the type annotation currently being parsed.
*/
/** The target of the type annotation currently being parsed. */
int typeRef;
/**
* The path of the type annotation currently being parsed.
*/
/** The path of the type annotation currently being parsed. */
TypePath typePath;
/**
* The offset of the latest stack map frame that has been parsed.
*/
/** The offset of the latest stack map frame that has been parsed. */
int offset;
/**
* The labels corresponding to the start of the local variable ranges in the
* local variable type annotation currently being parsed.
* The labels corresponding to the start of the local variable ranges in the local variable type annotation
* currently being parsed.
*/
Label[] start;
/**
* The labels corresponding to the end of the local variable ranges in the
* local variable type annotation currently being parsed.
* The labels corresponding to the end of the local variable ranges in the local variable type annotation currently
* being parsed.
*/
Label[] end;
/**
* The local variable indices for each local variable range in the local
* variable type annotation currently being parsed.
* The local variable indices for each local variable range in the local variable type annotation currently being
* parsed.
*/
int[] index;
/**
* The encoding of the latest stack map frame that has been parsed.
*/
/** The encoding of the latest stack map frame that has been parsed. */
int mode;
/**
* The number of locals in the latest stack map frame that has been parsed.
*/
/** The number of locals in the latest stack map frame that has been parsed. */
int localCount;
/**
* The number locals in the latest stack map frame that has been parsed,
* minus the number of locals in the previous frame.
* The number locals in the latest stack map frame that has been parsed, minus the number of locals in the previous
* frame.
*/
int localDiff;
/**
* The local values of the latest stack map frame that has been parsed.
*/
/** The local values of the latest stack map frame that has been parsed. */
Object[] local;
/**
* The stack size of the latest stack map frame that has been parsed.
*/
/** The stack size of the latest stack map frame that has been parsed. */
int stackCount;
/**
* The stack values of the latest stack map frame that has been parsed.
*/
/** The stack values of the latest stack map frame that has been parsed. */
Object[] stack;
}

View File

@@ -60,18 +60,16 @@
package org.redkale.asm;
/**
* Information about the input stack map frame at the "current" instruction of a
* method. This is implemented as a Frame subclass for a "basic block"
* containing only one instruction.
* Information about the input stack map frame at the "current" instruction of a method. This is implemented as a Frame
* subclass for a "basic block" containing only one instruction.
*
* @author Eric Bruneton
*/
class CurrentFrame extends Frame {
/**
* Sets this CurrentFrame to the input stack map frame of the next "current"
* instruction, i.e. the instruction just after the given one. It is assumed
* that the value of this object when this method is called is the stack map
* Sets this CurrentFrame to the input stack map frame of the next "current" instruction, i.e. the instruction just
* after the given one. It is assumed that the value of this object when this method is called is the stack map
* frame status just before the given instruction is executed.
*/
@Override

View File

@@ -65,40 +65,30 @@ package org.redkale.asm;
*/
class Edge {
/**
* Denotes a normal control flow graph edge.
*/
/** Denotes a normal control flow graph edge. */
static final int NORMAL = 0;
/**
* Denotes a control flow graph edge corresponding to an exception handler.
* More precisely any {@link Edge} whose {@link #info} is strictly positive
* corresponds to an exception handler. The actual value of {@link #info} is
* the index, in the {@link ClassWriter} type table, of the exception that
* is catched.
* Denotes a control flow graph edge corresponding to an exception handler. More precisely any {@link Edge} whose
* {@link #info} is strictly positive corresponds to an exception handler. The actual value of {@link #info} is the
* index, in the {@link ClassWriter} type table, of the exception that is catched.
*/
static final int EXCEPTION = 0x7FFFFFFF;
/**
* Information about this control flow graph edge. If
* {@link ClassWriter#COMPUTE_MAXS} is used this field is the (relative)
* stack size in the basic block from which this edge originates. This size
* is equal to the stack size at the "jump" instruction to which this edge
* corresponds, relatively to the stack size at the beginning of the
* originating basic block. If {@link ClassWriter#COMPUTE_FRAMES} is used,
* this field is the kind of this control flow graph edge (i.e. NORMAL or
* EXCEPTION).
* Information about this control flow graph edge. If {@link ClassWriter#COMPUTE_MAXS} is used this field is the
* (relative) stack size in the basic block from which this edge originates. This size is equal to the stack size at
* the "jump" instruction to which this edge corresponds, relatively to the stack size at the beginning of the
* originating basic block. If {@link ClassWriter#COMPUTE_FRAMES} is used, this field is the kind of this control
* flow graph edge (i.e. NORMAL or EXCEPTION).
*/
int info;
/**
* The successor block of the basic block from which this edge originates.
*/
/** The successor block of the basic block from which this edge originates. */
Label successor;
/**
* The next edge in the list of successors of the originating basic block.
* See {@link Label#successors successors}.
* The next edge in the list of successors of the originating basic block. See {@link Label#successors successors}.
*/
Edge next;
}

View File

@@ -59,32 +59,28 @@
package org.redkale.asm;
/**
* A visitor to visit a Java field. The methods of this class must be called in
* the following order: ( &#60;tt&#62;visitAnnotation&#60;/tt&#62; |
* &#60;tt&#62;visitTypeAnnotation&#60;/tt&#62; | &#60;tt&#62;visitAttribute&#60;/tt&#62; )* &#60;tt&#62;visitEnd&#60;/tt&#62;.
* A visitor to visit a Java field. The methods of this class must be called in the following order: (
* &#60;tt&#62;visitAnnotation&#60;/tt&#62; | &#60;tt&#62;visitTypeAnnotation&#60;/tt&#62; |
* &#60;tt&#62;visitAttribute&#60;/tt&#62; )* &#60;tt&#62;visitEnd&#60;/tt&#62;.
*
* @author Eric Bruneton
*/
public abstract class FieldVisitor {
/**
* The ASM API version implemented by this visitor. The value of this field
* must be one of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* The ASM API version implemented by this visitor. The value of this field must be one of {@link Opcodes#ASM4},
* {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
*/
protected final int api;
/**
* The field visitor to which this visitor must delegate method calls. May
* be null.
*/
/** The field visitor to which this visitor must delegate method calls. May be null. */
protected FieldVisitor fv;
/**
* Constructs a new {@link FieldVisitor}.
*
* @param api
* the ASM API version implemented by this visitor. Must be one
* of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* @param api the ASM API version implemented by this visitor. Must be one of {@link Opcodes#ASM4},
* {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
*/
public FieldVisitor(final int api) {
this(api, null);
@@ -93,12 +89,9 @@ public abstract class FieldVisitor {
/**
* Constructs a new {@link FieldVisitor}.
*
* @param api
* the ASM API version implemented by this visitor. Must be one
* of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* @param fv
* the field visitor to which this visitor must delegate method
* calls. May be null.
* @param api the ASM API version implemented by this visitor. Must be one of {@link Opcodes#ASM4},
* {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* @param fv the field visitor to which this visitor must delegate method calls. May be null.
*/
public FieldVisitor(final int api, final FieldVisitor fv) {
this.api = api;
@@ -108,12 +101,10 @@ public abstract class FieldVisitor {
/**
* Visits an annotation of the field.
*
* @param desc
* the class descriptor of the annotation class.
* @param visible
* &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if
* this visitor is not interested in visiting this annotation.
* @param desc the class descriptor of the annotation class.
* @param visible &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if this visitor is not
* interested in visiting this annotation.
*/
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
if (fv != null) {
@@ -125,23 +116,16 @@ public abstract class FieldVisitor {
/**
* Visits an annotation on the type of the field.
*
* @param typeRef
* a reference to the annotated type. The sort of this type
* reference must be {@link TypeReference#FIELD FIELD}. See
* {@link TypeReference}.
* @param typePath
* the path to the annotated type argument, wildcard bound, array
* element type, or static inner type within 'typeRef'. May be
* &#60;tt&#62;null&#60;/tt&#62; if the annotation targets 'typeRef' as a whole.
* @param desc
* the class descriptor of the annotation class.
* @param visible
* &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if
* this visitor is not interested in visiting this annotation.
* @param typeRef a reference to the annotated type. The sort of this type reference must be
* {@link TypeReference#FIELD FIELD}. See {@link TypeReference}.
* @param typePath the path to the annotated type argument, wildcard bound, array element type, or static inner type
* within 'typeRef'. May be &#60;tt&#62;null&#60;/tt&#62; if the annotation targets 'typeRef' as a whole.
* @param desc the class descriptor of the annotation class.
* @param visible &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if this visitor is not
* interested in visiting this annotation.
*/
public AnnotationVisitor visitTypeAnnotation(int typeRef,
TypePath typePath, String desc, boolean visible) {
public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) {
if (fv != null) {
return fv.visitTypeAnnotation(typeRef, typePath, desc, visible);
}
@@ -151,8 +135,7 @@ public abstract class FieldVisitor {
/**
* Visits a non standard attribute of the field.
*
* @param attr
* an attribute.
* @param attr an attribute.
*/
public void visitAttribute(Attribute attr) {
if (fv != null) {
@@ -161,9 +144,8 @@ public abstract class FieldVisitor {
}
/**
* Visits the end of the field. This method, which is the last one to be
* called, is used to inform the visitor that all the annotations and
* attributes of the field have been visited.
* Visits the end of the field. This method, which is the last one to be called, is used to inform the visitor that
* all the annotations and attributes of the field have been visited.
*/
public void visitEnd() {
if (fv != null) {

View File

@@ -65,64 +65,37 @@ package org.redkale.asm;
*/
final class FieldWriter extends FieldVisitor {
/**
* The class writer to which this field must be added.
*/
/** The class writer to which this field must be added. */
private final ClassWriter cw;
/**
* Access flags of this field.
*/
/** Access flags of this field. */
private final int access;
/**
* The index of the constant pool item that contains the name of this
* method.
*/
/** The index of the constant pool item that contains the name of this method. */
private final int name;
/**
* The index of the constant pool item that contains the descriptor of this
* field.
*/
/** The index of the constant pool item that contains the descriptor of this field. */
private final int desc;
/**
* The index of the constant pool item that contains the signature of this
* field.
*/
/** The index of the constant pool item that contains the signature of this field. */
private int signature;
/**
* The index of the constant pool item that contains the constant value of
* this field.
*/
/** The index of the constant pool item that contains the constant value of this field. */
private int value;
/**
* The runtime visible annotations of this field. May be &#60;tt&#62;null&#60;/tt&#62;.
*/
/** The runtime visible annotations of this field. May be &#60;tt&#62;null&#60;/tt&#62;. */
private AnnotationWriter anns;
/**
* The runtime invisible annotations of this field. May be &#60;tt&#62;null&#60;/tt&#62;.
*/
/** The runtime invisible annotations of this field. May be &#60;tt&#62;null&#60;/tt&#62;. */
private AnnotationWriter ianns;
/**
* The runtime visible type annotations of this field. May be &#60;tt&#62;null&#60;/tt&#62;.
*/
/** The runtime visible type annotations of this field. May be &#60;tt&#62;null&#60;/tt&#62;. */
private AnnotationWriter tanns;
/**
* The runtime invisible type annotations of this field. May be
* &#60;tt&#62;null&#60;/tt&#62;.
*/
/** The runtime invisible type annotations of this field. May be &#60;tt&#62;null&#60;/tt&#62;. */
private AnnotationWriter itanns;
/**
* The non standard attributes of this field. May be &#60;tt&#62;null&#60;/tt&#62;.
*/
/** The non standard attributes of this field. May be &#60;tt&#62;null&#60;/tt&#62;. */
private Attribute attrs;
// ------------------------------------------------------------------------
@@ -132,21 +105,20 @@ final class FieldWriter extends FieldVisitor {
/**
* Constructs a new {@link FieldWriter}.
*
* @param cw
* the class writer to which this field must be added.
* @param access
* the field's access flags (see {@link Opcodes}).
* @param name
* the field's name.
* @param desc
* the field's descriptor (see {@link Type}).
* @param signature
* the field's signature. May be &#60;tt&#62;null&#60;/tt&#62;.
* @param value
* the field's constant value. May be &#60;tt&#62;null&#60;/tt&#62;.
* @param cw the class writer to which this field must be added.
* @param access the field's access flags (see {@link Opcodes}).
* @param name the field's name.
* @param desc the field's descriptor (see {@link Type}).
* @param signature the field's signature. May be &#60;tt&#62;null&#60;/tt&#62;.
* @param value the field's constant value. May be &#60;tt&#62;null&#60;/tt&#62;.
*/
FieldWriter(final ClassWriter cw, final int access, final String name,
final String desc, final String signature, final Object value) {
FieldWriter(
final ClassWriter cw,
final int access,
final String name,
final String desc,
final String signature,
final Object value) {
super(Opcodes.ASM6);
if (cw.firstField == null) {
cw.firstField = this;
@@ -171,8 +143,7 @@ final class FieldWriter extends FieldVisitor {
// ------------------------------------------------------------------------
@Override
public AnnotationVisitor visitAnnotation(final String desc,
final boolean visible) {
public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
ByteVector bv = new ByteVector();
// write type, and reserve space for values count
bv.putShort(cw.newUTF8(desc)).putShort(0);
@@ -188,15 +159,14 @@ final class FieldWriter extends FieldVisitor {
}
@Override
public AnnotationVisitor visitTypeAnnotation(final int typeRef,
final TypePath typePath, final String desc, final boolean visible) {
public AnnotationVisitor visitTypeAnnotation(
final int typeRef, final TypePath typePath, final String desc, final boolean visible) {
ByteVector bv = new ByteVector();
// write target_type and target_info
AnnotationWriter.putTarget(typeRef, typePath, bv);
// write type, and reserve space for values count
bv.putShort(cw.newUTF8(desc)).putShort(0);
AnnotationWriter aw = new AnnotationWriter(cw, true, bv, bv,
bv.length - 2);
AnnotationWriter aw = new AnnotationWriter(cw, true, bv, bv, bv.length - 2);
if (visible) {
aw.next = tanns;
tanns = aw;
@@ -215,6 +185,7 @@ final class FieldWriter extends FieldVisitor {
@Override
public void visitEnd() {
// do nothing
}
// ------------------------------------------------------------------------
@@ -233,8 +204,7 @@ final class FieldWriter extends FieldVisitor {
size += 8;
}
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
if ((cw.version & 0xFFFF) < Opcodes.V1_5
|| (access & ClassWriter.ACC_SYNTHETIC_ATTRIBUTE) != 0) {
if ((cw.version & 0xFFFF) < Opcodes.V1_5 || (access & ClassWriter.ACC_SYNTHETIC_ATTRIBUTE) != 0) {
cw.newUTF8("Synthetic");
size += 6;
}
@@ -272,12 +242,12 @@ final class FieldWriter extends FieldVisitor {
/**
* Puts the content of this field into the given byte vector.
*
* @param out
* where the content of this field must be put.
* @param out where the content of this field must be put.
*/
void put(final ByteVector out) {
final int FACTOR = ClassWriter.TO_ACC_SYNTHETIC;
int mask = Opcodes.ACC_DEPRECATED | ClassWriter.ACC_SYNTHETIC_ATTRIBUTE
int mask = Opcodes.ACC_DEPRECATED
| ClassWriter.ACC_SYNTHETIC_ATTRIBUTE
| ((access & ClassWriter.ACC_SYNTHETIC_ATTRIBUTE) / FACTOR);
out.putShort(access & ~mask).putShort(name).putShort(desc);
int attributeCount = 0;
@@ -285,8 +255,7 @@ final class FieldWriter extends FieldVisitor {
++attributeCount;
}
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
if ((cw.version & 0xFFFF) < Opcodes.V1_5
|| (access & ClassWriter.ACC_SYNTHETIC_ATTRIBUTE) != 0) {
if ((cw.version & 0xFFFF) < Opcodes.V1_5 || (access & ClassWriter.ACC_SYNTHETIC_ATTRIBUTE) != 0) {
++attributeCount;
}
}
@@ -317,8 +286,7 @@ final class FieldWriter extends FieldVisitor {
out.putInt(2).putShort(value);
}
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
if ((cw.version & 0xFFFF) < Opcodes.V1_5
|| (access & ClassWriter.ACC_SYNTHETIC_ATTRIBUTE) != 0) {
if ((cw.version & 0xFFFF) < Opcodes.V1_5 || (access & ClassWriter.ACC_SYNTHETIC_ATTRIBUTE) != 0) {
out.putShort(cw.newUTF8("Synthetic")).putInt(0);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -68,59 +68,36 @@ package org.redkale.asm;
public final class Handle {
/**
* The kind of field or method designated by this Handle. Should be
* {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC},
* {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC},
* {@link Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC},
* {@link Opcodes#H_INVOKESPECIAL}, {@link Opcodes#H_NEWINVOKESPECIAL} or
* {@link Opcodes#H_INVOKEINTERFACE}.
* The kind of field or method designated by this Handle. Should be {@link Opcodes#H_GETFIELD},
* {@link Opcodes#H_GETSTATIC}, {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC},
* {@link Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC}, {@link Opcodes#H_INVOKESPECIAL},
* {@link Opcodes#H_NEWINVOKESPECIAL} or {@link Opcodes#H_INVOKEINTERFACE}.
*/
final int tag;
/**
* The internal name of the class that owns the field or method designated
* by this handle.
*/
/** The internal name of the class that owns the field or method designated by this handle. */
final String owner;
/**
* The name of the field or method designated by this handle.
*/
/** The name of the field or method designated by this handle. */
final String name;
/**
* The descriptor of the field or method designated by this handle.
*/
/** The descriptor of the field or method designated by this handle. */
final String desc;
/**
* Indicate if the owner is an interface or not.
*/
/** Indicate if the owner is an interface or not. */
final boolean itf;
/**
* Constructs a new field or method handle.
*
* @param tag
* the kind of field or method designated by this Handle. Must be
* {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC},
* {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC},
* {@link Opcodes#H_INVOKEVIRTUAL},
* {@link Opcodes#H_INVOKESTATIC},
* {@link Opcodes#H_INVOKESPECIAL},
* {@link Opcodes#H_NEWINVOKESPECIAL} or
* {@link Opcodes#H_INVOKEINTERFACE}.
* @param owner
* the internal name of the class that owns the field or method
* designated by this handle.
* @param name
* the name of the field or method designated by this handle.
* @param desc
* the descriptor of the field or method designated by this
* handle.
* @param itf
* true if the owner is an interface.
* @param tag the kind of field or method designated by this Handle. Must be {@link Opcodes#H_GETFIELD},
* {@link Opcodes#H_GETSTATIC}, {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC},
* {@link Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC}, {@link Opcodes#H_INVOKESPECIAL},
* {@link Opcodes#H_NEWINVOKESPECIAL} or {@link Opcodes#H_INVOKEINTERFACE}.
* @param owner the internal name of the class that owns the field or method designated by this handle.
* @param name the name of the field or method designated by this handle.
* @param desc the descriptor of the field or method designated by this handle.
* @param itf true if the owner is an interface.
*/
public Handle(int tag, String owner, String name, String desc, boolean itf) {
this.tag = tag;
@@ -133,23 +110,18 @@ public final class Handle {
/**
* Returns the kind of field or method designated by this handle.
*
* @return {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC},
* {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC},
* {@link Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC},
* {@link Opcodes#H_INVOKESPECIAL},
* {@link Opcodes#H_NEWINVOKESPECIAL} or
* {@link Opcodes#H_INVOKEINTERFACE}.
* @return {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC}, {@link Opcodes#H_PUTFIELD},
* {@link Opcodes#H_PUTSTATIC}, {@link Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC},
* {@link Opcodes#H_INVOKESPECIAL}, {@link Opcodes#H_NEWINVOKESPECIAL} or {@link Opcodes#H_INVOKEINTERFACE}.
*/
public int getTag() {
return tag;
}
/**
* Returns the internal name of the class that owns the field or method
* designated by this handle.
* Returns the internal name of the class that owns the field or method designated by this handle.
*
* @return the internal name of the class that owns the field or method
* designated by this handle.
* @return the internal name of the class that owns the field or method designated by this handle.
*/
public String getOwner() {
return owner;
@@ -174,11 +146,9 @@ public final class Handle {
}
/**
* Returns true if the owner of the field or method designated
* by this handle is an interface.
* Returns true if the owner of the field or method designated by this handle is an interface.
*
* @return true if the owner of the field or method designated
* by this handle is an interface.
* @return true if the owner of the field or method designated by this handle is an interface.
*/
public boolean isInterface() {
return itf;
@@ -193,18 +163,16 @@ public final class Handle {
return false;
}
Handle h = (Handle) obj;
return tag == h.tag && itf == h.itf && owner.equals(h.owner)
&& name.equals(h.name) && desc.equals(h.desc);
return tag == h.tag && itf == h.itf && owner.equals(h.owner) && name.equals(h.name) && desc.equals(h.desc);
}
@Override
public int hashCode() {
return tag + (itf? 64: 0) + owner.hashCode() * name.hashCode() * desc.hashCode();
return tag + (itf ? 64 : 0) + owner.hashCode() * name.hashCode() * desc.hashCode();
}
/**
* Returns the textual representation of this handle. The textual
* representation is:
* Returns the textual representation of this handle. The textual representation is:
*
* <pre>
* for a reference to a class:
@@ -217,6 +185,6 @@ public final class Handle {
*/
@Override
public String toString() {
return owner + '.' + name + desc + " (" + tag + (itf? " itf": "") + ')';
return owner + '.' + name + desc + " (" + tag + (itf ? " itf" : "") + ')';
}
}

View File

@@ -65,48 +65,36 @@ package org.redkale.asm;
*/
class Handler {
/**
* Beginning of the exception handler's scope (inclusive).
*/
/** Beginning of the exception handler's scope (inclusive). */
Label start;
/**
* End of the exception handler's scope (exclusive).
*/
/** End of the exception handler's scope (exclusive). */
Label end;
/**
* Beginning of the exception handler's code.
*/
/** Beginning of the exception handler's code. */
Label handler;
/**
* Internal name of the type of exceptions handled by this handler, or
* &#60;tt&#62;null&#60;/tt&#62; to catch any exceptions.
* Internal name of the type of exceptions handled by this handler, or &#60;tt&#62;null&#60;/tt&#62; to catch any
* exceptions.
*/
String desc;
/**
* Constant pool index of the internal name of the type of exceptions
* handled by this handler, or 0 to catch any exceptions.
* Constant pool index of the internal name of the type of exceptions handled by this handler, or 0 to catch any
* exceptions.
*/
int type;
/**
* Next exception handler block info.
*/
/** Next exception handler block info. */
Handler next;
/**
* Removes the range between start and end from the given exception
* handlers.
* Removes the range between start and end from the given exception handlers.
*
* @param h
* an exception handler list.
* @param start
* the start of the range to be removed.
* @param end
* the end of the range to be removed. Maybe null.
* @param h an exception handler list.
* @param start the start of the range to be removed.
* @param end the end of the range to be removed. Maybe null.
* @return the exception handler list with the start-end range removed.
*/
static Handler remove(Handler h, Label start, Label end) {

View File

@@ -59,94 +59,61 @@
package org.redkale.asm;
/**
* A constant pool item. Constant pool items can be created with the 'newXXX'
* methods in the {@link ClassWriter} class.
* A constant pool item. Constant pool items can be created with the 'newXXX' methods in the {@link ClassWriter} class.
*
* @author Eric Bruneton
*/
final class Item {
/**
* Index of this item in the constant pool.
*/
/** Index of this item in the constant pool. */
int index;
/**
* Type of this constant pool item. A single class is used to represent all
* constant pool item types, in order to minimize the bytecode size of this
* package. The value of this field is one of {@link ClassWriter#INT},
* {@link ClassWriter#LONG}, {@link ClassWriter#FLOAT},
* {@link ClassWriter#DOUBLE}, {@link ClassWriter#UTF8},
* {@link ClassWriter#STR}, {@link ClassWriter#CLASS},
* {@link ClassWriter#NAME_TYPE}, {@link ClassWriter#FIELD},
* {@link ClassWriter#METH}, {@link ClassWriter#IMETH},
* {@link ClassWriter#MODULE}, {@link ClassWriter#PACKAGE},
* Type of this constant pool item. A single class is used to represent all constant pool item types, in order to
* minimize the bytecode size of this package. The value of this field is one of {@link ClassWriter#INT},
* {@link ClassWriter#LONG}, {@link ClassWriter#FLOAT}, {@link ClassWriter#DOUBLE}, {@link ClassWriter#UTF8},
* {@link ClassWriter#STR}, {@link ClassWriter#CLASS}, {@link ClassWriter#NAME_TYPE}, {@link ClassWriter#FIELD},
* {@link ClassWriter#METH}, {@link ClassWriter#IMETH}, {@link ClassWriter#MODULE}, {@link ClassWriter#PACKAGE},
* {@link ClassWriter#MTYPE}, {@link ClassWriter#INDY}.
*
* MethodHandle constant 9 variations are stored using a range of 9 values
* from {@link ClassWriter#HANDLE_BASE} + 1 to
* {@link ClassWriter#HANDLE_BASE} + 9.
* <p>MethodHandle constant 9 variations are stored using a range of 9 values from {@link ClassWriter#HANDLE_BASE} +
* 1 to {@link ClassWriter#HANDLE_BASE} + 9.
*
* Special Item types are used for Items that are stored in the ClassWriter
* {@link ClassWriter#typeTable}, instead of the constant pool, in order to
* avoid clashes with normal constant pool items in the ClassWriter constant
* pool's hash table. These special item types are
* {@link ClassWriter#TYPE_NORMAL}, {@link ClassWriter#TYPE_UNINIT} and
* {@link ClassWriter#TYPE_MERGED}.
* <p>Special Item types are used for Items that are stored in the ClassWriter {@link ClassWriter#typeTable},
* instead of the constant pool, in order to avoid clashes with normal constant pool items in the ClassWriter
* constant pool's hash table. These special item types are {@link ClassWriter#TYPE_NORMAL},
* {@link ClassWriter#TYPE_UNINIT} and {@link ClassWriter#TYPE_MERGED}.
*/
int type;
/**
* Value of this item, for an integer item.
*/
/** Value of this item, for an integer item. */
int intVal;
/**
* Value of this item, for a long item.
*/
/** Value of this item, for a long item. */
long longVal;
/**
* First part of the value of this item, for items that do not hold a
* primitive value.
*/
/** First part of the value of this item, for items that do not hold a primitive value. */
String strVal1;
/**
* Second part of the value of this item, for items that do not hold a
* primitive value.
*/
/** Second part of the value of this item, for items that do not hold a primitive value. */
String strVal2;
/**
* Third part of the value of this item, for items that do not hold a
* primitive value.
*/
/** Third part of the value of this item, for items that do not hold a primitive value. */
String strVal3;
/**
* The hash code value of this constant pool item.
*/
/** The hash code value of this constant pool item. */
int hashCode;
/**
* Link to another constant pool item, used for collision lists in the
* constant pool's hash table.
*/
/** Link to another constant pool item, used for collision lists in the constant pool's hash table. */
Item next;
/**
* Constructs an uninitialized {@link Item}.
*/
Item() {
}
/** Constructs an uninitialized {@link Item}. */
Item() {}
/**
* Constructs an uninitialized {@link Item} for constant pool element at
* given position.
* Constructs an uninitialized {@link Item} for constant pool element at given position.
*
* @param index
* index of the item to be constructed.
* @param index index of the item to be constructed.
*/
Item(final int index) {
this.index = index;
@@ -155,10 +122,8 @@ final class Item {
/**
* Constructs a copy of the given item.
*
* @param index
* index of the item to be constructed.
* @param i
* the item that must be copied into the item to be constructed.
* @param index index of the item to be constructed.
* @param i the item that must be copied into the item to be constructed.
*/
Item(final int index, final Item i) {
this.index = index;
@@ -174,8 +139,7 @@ final class Item {
/**
* Sets this item to an integer item.
*
* @param intVal
* the value of this item.
* @param intVal the value of this item.
*/
void set(final int intVal) {
this.type = ClassWriter.INT;
@@ -186,8 +150,7 @@ final class Item {
/**
* Sets this item to a long item.
*
* @param longVal
* the value of this item.
* @param longVal the value of this item.
*/
void set(final long longVal) {
this.type = ClassWriter.LONG;
@@ -198,8 +161,7 @@ final class Item {
/**
* Sets this item to a float item.
*
* @param floatVal
* the value of this item.
* @param floatVal the value of this item.
*/
void set(final float floatVal) {
this.type = ClassWriter.FLOAT;
@@ -210,8 +172,7 @@ final class Item {
/**
* Sets this item to a double item.
*
* @param doubleVal
* the value of this item.
* @param doubleVal the value of this item.
*/
void set(final double doubleVal) {
this.type = ClassWriter.DOUBLE;
@@ -222,76 +183,62 @@ final class Item {
/**
* Sets this item to an item that do not hold a primitive value.
*
* @param type
* the type of this item.
* @param strVal1
* first part of the value of this item.
* @param strVal2
* second part of the value of this item.
* @param strVal3
* third part of the value of this item.
* @param type the type of this item.
* @param strVal1 first part of the value of this item.
* @param strVal2 second part of the value of this item.
* @param strVal3 third part of the value of this item.
*/
@SuppressWarnings("fallthrough")
void set(final int type, final String strVal1, final String strVal2,
final String strVal3) {
void set(final int type, final String strVal1, final String strVal2, final String strVal3) {
this.type = type;
this.strVal1 = strVal1;
this.strVal2 = strVal2;
this.strVal3 = strVal3;
switch (type) {
case ClassWriter.CLASS:
this.intVal = 0; // intVal of a class must be zero, see visitInnerClass
case ClassWriter.UTF8:
case ClassWriter.STR:
case ClassWriter.MTYPE:
case ClassWriter.MODULE:
case ClassWriter.PACKAGE:
case ClassWriter.TYPE_NORMAL:
hashCode = 0x7FFFFFFF & (type + strVal1.hashCode());
return;
case ClassWriter.NAME_TYPE: {
hashCode = 0x7FFFFFFF & (type + strVal1.hashCode()
* strVal2.hashCode());
return;
}
// ClassWriter.FIELD:
// ClassWriter.METH:
// ClassWriter.IMETH:
// ClassWriter.HANDLE_BASE + 1..9
default:
hashCode = 0x7FFFFFFF & (type + strVal1.hashCode()
* strVal2.hashCode() * strVal3.hashCode());
case ClassWriter.CLASS:
this.intVal = 0; // intVal of a class must be zero, see visitInnerClass
case ClassWriter.UTF8:
case ClassWriter.STR:
case ClassWriter.MTYPE:
case ClassWriter.MODULE:
case ClassWriter.PACKAGE:
case ClassWriter.TYPE_NORMAL:
hashCode = 0x7FFFFFFF & (type + strVal1.hashCode());
return;
case ClassWriter.NAME_TYPE: {
hashCode = 0x7FFFFFFF & (type + strVal1.hashCode() * strVal2.hashCode());
return;
}
// ClassWriter.FIELD:
// ClassWriter.METH:
// ClassWriter.IMETH:
// ClassWriter.HANDLE_BASE + 1..9
default:
hashCode = 0x7FFFFFFF & (type + strVal1.hashCode() * strVal2.hashCode() * strVal3.hashCode());
}
}
/**
* Sets the item to an InvokeDynamic item.
*
* @param name
* invokedynamic's name.
* @param desc
* invokedynamic's desc.
* @param bsmIndex
* zero based index into the class attribute BootrapMethods.
* @param name invokedynamic's name.
* @param desc invokedynamic's desc.
* @param bsmIndex zero based index into the class attribute BootrapMethods.
*/
void set(String name, String desc, int bsmIndex) {
this.type = ClassWriter.INDY;
this.longVal = bsmIndex;
this.strVal1 = name;
this.strVal2 = desc;
this.hashCode = 0x7FFFFFFF & (ClassWriter.INDY + bsmIndex
* strVal1.hashCode() * strVal2.hashCode());
this.hashCode = 0x7FFFFFFF & (ClassWriter.INDY + bsmIndex * strVal1.hashCode() * strVal2.hashCode());
}
/**
* Sets the item to a BootstrapMethod item.
*
* @param position
* position in byte in the class attribute BootrapMethods.
* @param hashCode
* hashcode of the item. This hashcode is processed from the
* hashcode of the bootstrap method and the hashcode of all
* bootstrap arguments.
* @param position position in byte in the class attribute BootrapMethods.
* @param hashCode hashcode of the item. This hashcode is processed from the hashcode of the bootstrap method and
* the hashcode of all bootstrap arguments.
*/
void set(int position, int hashCode) {
this.type = ClassWriter.BSM;
@@ -300,48 +247,43 @@ final class Item {
}
/**
* Indicates if the given item is equal to this one. <i>This method assumes
* that the two items have the same {@link #type}</i>.
* Indicates if the given item is equal to this one. <i>This method assumes that the two items have the same
* {@link #type}</i>.
*
* @param i
* the item to be compared to this one. Both items must have the
* same {@link #type}.
* @return &#60;tt&#62;true&#60;/tt&#62; if the given item if equal to this one,
* &#60;tt&#62;false&#60;/tt&#62; otherwise.
* @param i the item to be compared to this one. Both items must have the same {@link #type}.
* @return &#60;tt&#62;true&#60;/tt&#62; if the given item if equal to this one, &#60;tt&#62;false&#60;/tt&#62;
* otherwise.
*/
boolean isEqualTo(final Item i) {
switch (type) {
case ClassWriter.UTF8:
case ClassWriter.STR:
case ClassWriter.CLASS:
case ClassWriter.MODULE:
case ClassWriter.PACKAGE:
case ClassWriter.MTYPE:
case ClassWriter.TYPE_NORMAL:
return i.strVal1.equals(strVal1);
case ClassWriter.TYPE_MERGED:
case ClassWriter.LONG:
case ClassWriter.DOUBLE:
return i.longVal == longVal;
case ClassWriter.INT:
case ClassWriter.FLOAT:
return i.intVal == intVal;
case ClassWriter.TYPE_UNINIT:
return i.intVal == intVal && i.strVal1.equals(strVal1);
case ClassWriter.NAME_TYPE:
return i.strVal1.equals(strVal1) && i.strVal2.equals(strVal2);
case ClassWriter.INDY: {
return i.longVal == longVal && i.strVal1.equals(strVal1)
&& i.strVal2.equals(strVal2);
}
// case ClassWriter.FIELD:
// case ClassWriter.METH:
// case ClassWriter.IMETH:
// case ClassWriter.HANDLE_BASE + 1..9
default:
return i.strVal1.equals(strVal1) && i.strVal2.equals(strVal2)
&& i.strVal3.equals(strVal3);
case ClassWriter.UTF8:
case ClassWriter.STR:
case ClassWriter.CLASS:
case ClassWriter.MODULE:
case ClassWriter.PACKAGE:
case ClassWriter.MTYPE:
case ClassWriter.TYPE_NORMAL:
return i.strVal1.equals(strVal1);
case ClassWriter.TYPE_MERGED:
case ClassWriter.LONG:
case ClassWriter.DOUBLE:
return i.longVal == longVal;
case ClassWriter.INT:
case ClassWriter.FLOAT:
return i.intVal == intVal;
case ClassWriter.TYPE_UNINIT:
return i.intVal == intVal && i.strVal1.equals(strVal1);
case ClassWriter.NAME_TYPE:
return i.strVal1.equals(strVal1) && i.strVal2.equals(strVal2);
case ClassWriter.INDY: {
return i.longVal == longVal && i.strVal1.equals(strVal1) && i.strVal2.equals(strVal2);
}
// case ClassWriter.FIELD:
// case ClassWriter.METH:
// case ClassWriter.IMETH:
// case ClassWriter.HANDLE_BASE + 1..9
default:
return i.strVal1.equals(strVal1) && i.strVal2.equals(strVal2) && i.strVal3.equals(strVal3);
}
}
}

View File

@@ -59,88 +59,61 @@
package org.redkale.asm;
/**
* A label represents a position in the bytecode of a method. Labels are used
* for jump, goto, and switch instructions, and for try catch blocks. A label
* designates the <i>instruction</i> that is just after. Note however that there
* can be other elements between a label and the instruction it designates (such
* as other labels, stack map frames, line numbers, etc.).
* A label represents a position in the bytecode of a method. Labels are used for jump, goto, and switch instructions,
* and for try catch blocks. A label designates the <i>instruction</i> that is just after. Note however that there can
* be other elements between a label and the instruction it designates (such as other labels, stack map frames, line
* numbers, etc.).
*
* @author Eric Bruneton
*/
public class Label {
/**
* Indicates if this label is only used for debug attributes. Such a label
* is not the start of a basic block, the target of a jump instruction, or
* an exception handler. It can be safely ignored in control flow graph
* analysis algorithms (for optimization purposes).
* Indicates if this label is only used for debug attributes. Such a label is not the start of a basic block, the
* target of a jump instruction, or an exception handler. It can be safely ignored in control flow graph analysis
* algorithms (for optimization purposes).
*/
static final int DEBUG = 1;
/**
* Indicates if the position of this label is known.
*/
/** Indicates if the position of this label is known. */
static final int RESOLVED = 2;
/**
* Indicates if this label has been updated, after instruction resizing.
*/
/** Indicates if this label has been updated, after instruction resizing. */
static final int RESIZED = 4;
/**
* Indicates if this basic block has been pushed in the basic block stack.
* See {@link MethodWriter#visitMaxs visitMaxs}.
* Indicates if this basic block has been pushed in the basic block stack. See {@link MethodWriter#visitMaxs
* visitMaxs}.
*/
static final int PUSHED = 8;
/**
* Indicates if this label is the target of a jump instruction, or the start
* of an exception handler.
*/
/** Indicates if this label is the target of a jump instruction, or the start of an exception handler. */
static final int TARGET = 16;
/**
* Indicates if a stack map frame must be stored for this label.
*/
/** Indicates if a stack map frame must be stored for this label. */
static final int STORE = 32;
/**
* Indicates if this label corresponds to a reachable basic block.
*/
/** Indicates if this label corresponds to a reachable basic block. */
static final int REACHABLE = 64;
/**
* Indicates if this basic block ends with a JSR instruction.
*/
/** Indicates if this basic block ends with a JSR instruction. */
static final int JSR = 128;
/**
* Indicates if this basic block ends with a RET instruction.
*/
/** Indicates if this basic block ends with a RET instruction. */
static final int RET = 256;
/**
* Indicates if this basic block is the start of a subroutine.
*/
/** Indicates if this basic block is the start of a subroutine. */
static final int SUBROUTINE = 512;
/**
* Indicates if this subroutine basic block has been visited by a
* visitSubroutine(null, ...) call.
*/
/** Indicates if this subroutine basic block has been visited by a visitSubroutine(null, ...) call. */
static final int VISITED = 1024;
/**
* Indicates if this subroutine basic block has been visited by a
* visitSubroutine(!null, ...) call.
*/
/** Indicates if this subroutine basic block has been visited by a visitSubroutine(!null, ...) call. */
static final int VISITED2 = 2048;
/**
* Field used to associate user information to a label. Warning: this field
* is used by the ASM tree package. In order to use it with the ASM tree
* package you must override the
*
* Field used to associate user information to a label. Warning: this field is used by the ASM tree package. In
* order to use it with the ASM tree package you must override the
*/
public Object info;
@@ -160,36 +133,26 @@ public class Label {
int status;
/**
* The line number corresponding to this label, if known. If there are
* several lines, each line is stored in a separate label, all linked via
* their next field (these links are created in ClassReader and removed just
* before visitLabel is called, so that this does not impact the rest of the
* code).
* The line number corresponding to this label, if known. If there are several lines, each line is stored in a
* separate label, all linked via their next field (these links are created in ClassReader and removed just before
* visitLabel is called, so that this does not impact the rest of the code).
*/
int line;
/**
* The position of this label in the code, if known.
*/
/** The position of this label in the code, if known. */
int position;
/**
* Number of forward references to this label, times two.
*/
/** Number of forward references to this label, times two. */
private int referenceCount;
/**
* Informations about forward references. Each forward reference is
* described by two consecutive integers in this array: the first one is the
* position of the first byte of the bytecode instruction that contains the
* forward reference, while the second is the position of the first byte of
* the forward reference itself. In fact the sign of the first integer
* indicates if this reference uses 2 or 4 bytes, and its absolute value
* gives the position of the bytecode instruction. This array is also used
* as a bitset to store the subroutines to which a basic block belongs. This
* information is needed in {@linked MethodWriter#visitMaxs}, after all
* forward references have been resolved. Hence the same array can be used
* for both purposes without problems.
* Informations about forward references. Each forward reference is described by two consecutive integers in this
* array: the first one is the position of the first byte of the bytecode instruction that contains the forward
* reference, while the second is the position of the first byte of the forward reference itself. In fact the sign
* of the first integer indicates if this reference uses 2 or 4 bytes, and its absolute value gives the position of
* the bytecode instruction. This array is also used as a bitset to store the subroutines to which a basic block
* belongs. This information is needed in {@linked MethodWriter#visitMaxs}, after all forward references have been
* resolved. Hence the same array can be used for both purposes without problems.
*/
private int[] srcAndRefPositions;
@@ -223,57 +186,48 @@ public class Label {
*/
/**
* Start of the output stack relatively to the input stack. The exact
* semantics of this field depends on the algorithm that is used.
* Start of the output stack relatively to the input stack. The exact semantics of this field depends on the
* algorithm that is used.
*
* When only the maximum stack size is computed, this field is the number of
* elements in the input stack.
* <p>When only the maximum stack size is computed, this field is the number of elements in the input stack.
*
* When the stack map frames are completely computed, this field is the
* offset of the first output stack element relatively to the top of the
* input stack. This offset is always negative or null. A null offset means
* that the output stack must be appended to the input stack. A -n offset
* means that the first n output stack elements must replace the top n input
* stack elements, and that the other elements must be appended to the input
* stack.
* <p>When the stack map frames are completely computed, this field is the offset of the first output stack element
* relatively to the top of the input stack. This offset is always negative or null. A null offset means that the
* output stack must be appended to the input stack. A -n offset means that the first n output stack elements must
* replace the top n input stack elements, and that the other elements must be appended to the input stack.
*/
int inputStackTop;
/**
* Maximum height reached by the output stack, relatively to the top of the
* input stack. This maximum is always positive or null.
* Maximum height reached by the output stack, relatively to the top of the input stack. This maximum is always
* positive or null.
*/
int outputStackMax;
/**
* Information about the input and output stack map frames of this basic
* block. This field is only used when {@link ClassWriter#COMPUTE_FRAMES}
* option is used.
* Information about the input and output stack map frames of this basic block. This field is only used when
* {@link ClassWriter#COMPUTE_FRAMES} option is used.
*/
Frame frame;
/**
* The successor of this label, in the order they are visited. This linked
* list does not include labels used for debug info only. If
* {@link ClassWriter#COMPUTE_FRAMES} option is used then, in addition, it
* does not contain successive labels that denote the same bytecode position
* (in this case only the first label appears in this list).
* The successor of this label, in the order they are visited. This linked list does not include labels used for
* debug info only. If {@link ClassWriter#COMPUTE_FRAMES} option is used then, in addition, it does not contain
* successive labels that denote the same bytecode position (in this case only the first label appears in this
* list).
*/
Label successor;
/**
* The successors of this node in the control flow graph. These successors
* are stored in a linked list of {@link Edge Edge} objects, linked to each
* other by their {@link Edge#next} field.
* The successors of this node in the control flow graph. These successors are stored in a linked list of
* {@link Edge Edge} objects, linked to each other by their {@link Edge#next} field.
*/
Edge successors;
/**
* The next basic block in the basic block stack. This stack is used in the
* main loop of the fix point algorithm used in the second step of the
* control flow analysis algorithms. It is also used in
* {@link #visitSubroutine} to avoid using a recursive method, and in
* ClassReader to temporarily store multiple source lines for a label.
* The next basic block in the basic block stack. This stack is used in the main loop of the fix point algorithm
* used in the second step of the control flow analysis algorithms. It is also used in {@link #visitSubroutine} to
* avoid using a recursive method, and in ClassReader to temporarily store multiple source lines for a label.
*
* @see MethodWriter#visitMaxs
*/
@@ -283,10 +237,9 @@ public class Label {
// Constructor
// ------------------------------------------------------------------------
/**
* Constructs a new label.
*/
/** Constructs a new label. */
public Label() {
// do nothing
}
// ------------------------------------------------------------------------
@@ -294,44 +247,33 @@ public class Label {
// ------------------------------------------------------------------------
/**
* Returns the offset corresponding to this label. This offset is computed
* from the start of the method's bytecode. <i>This method is intended for
* {@link Attribute} sub classes, and is normally not needed by class
* generators or adapters.</i>
* Returns the offset corresponding to this label. This offset is computed from the start of the method's bytecode.
* <i>This method is intended for {@link Attribute} sub classes, and is normally not needed by class generators or
* adapters.</i>
*
* @return the offset corresponding to this label.
* @throws IllegalStateException
* if this label is not resolved yet.
* @throws IllegalStateException if this label is not resolved yet.
*/
public int getOffset() {
if ((status & RESOLVED) == 0) {
throw new IllegalStateException(
"Label offset position has not been resolved yet");
throw new IllegalStateException("Label offset position has not been resolved yet");
}
return position;
}
/**
* Puts a reference to this label in the bytecode of a method. If the
* position of the label is known, the offset is computed and written
* directly. Otherwise, a null offset is written and a new forward reference
* is declared for this label.
* Puts a reference to this label in the bytecode of a method. If the position of the label is known, the offset is
* computed and written directly. Otherwise, a null offset is written and a new forward reference is declared for
* this label.
*
* @param owner
* the code writer that calls this method.
* @param out
* the bytecode of the method.
* @param source
* the position of first byte of the bytecode instruction that
* contains this label.
* @param wideOffset
* &#60;tt&#62;true&#60;/tt&#62; if the reference must be stored in 4 bytes, or
* &#60;tt&#62;false&#60;/tt&#62; if it must be stored with 2 bytes.
* @throws IllegalArgumentException
* if this label has not been created by the given code writer.
* @param owner the code writer that calls this method.
* @param out the bytecode of the method.
* @param source the position of first byte of the bytecode instruction that contains this label.
* @param wideOffset &#60;tt&#62;true&#60;/tt&#62; if the reference must be stored in 4 bytes, or
* &#60;tt&#62;false&#60;/tt&#62; if it must be stored with 2 bytes.
* @throws IllegalArgumentException if this label has not been created by the given code writer.
*/
void put(final MethodWriter owner, final ByteVector out, final int source,
final boolean wideOffset) {
void put(final MethodWriter owner, final ByteVector out, final int source, final boolean wideOffset) {
if ((status & RESOLVED) == 0) {
if (wideOffset) {
addReference(-1 - source, out.length);
@@ -350,27 +292,21 @@ public class Label {
}
/**
* Adds a forward reference to this label. This method must be called only
* for a true forward reference, i.e. only if this label is not resolved
* yet. For backward references, the offset of the reference can be, and
* must be, computed and stored directly.
* Adds a forward reference to this label. This method must be called only for a true forward reference, i.e. only
* if this label is not resolved yet. For backward references, the offset of the reference can be, and must be,
* computed and stored directly.
*
* @param sourcePosition
* the position of the referencing instruction. This position
* will be used to compute the offset of this forward reference.
* @param referencePosition
* the position where the offset for this forward reference must
* be stored.
* @param sourcePosition the position of the referencing instruction. This position will be used to compute the
* offset of this forward reference.
* @param referencePosition the position where the offset for this forward reference must be stored.
*/
private void addReference(final int sourcePosition,
final int referencePosition) {
private void addReference(final int sourcePosition, final int referencePosition) {
if (srcAndRefPositions == null) {
srcAndRefPositions = new int[6];
}
if (referenceCount >= srcAndRefPositions.length) {
int[] a = new int[srcAndRefPositions.length + 6];
System.arraycopy(srcAndRefPositions, 0, a, 0,
srcAndRefPositions.length);
System.arraycopy(srcAndRefPositions, 0, a, 0, srcAndRefPositions.length);
srcAndRefPositions = a;
}
srcAndRefPositions[referenceCount++] = sourcePosition;
@@ -378,29 +314,21 @@ public class Label {
}
/**
* Resolves all forward references to this label. This method must be called
* when this label is added to the bytecode of the method, i.e. when its
* position becomes known. This method fills in the blanks that where left
* in the bytecode by each forward reference previously added to this label.
* Resolves all forward references to this label. This method must be called when this label is added to the
* bytecode of the method, i.e. when its position becomes known. This method fills in the blanks that where left in
* the bytecode by each forward reference previously added to this label.
*
* @param owner
* the code writer that calls this method.
* @param position
* the position of this label in the bytecode.
* @param data
* the bytecode of the method.
* @return &#60;tt&#62;true&#60;/tt&#62; if a blank that was left for this label was too
* small to store the offset. In such a case the corresponding jump
* instruction is replaced with a pseudo instruction (using unused
* opcodes) using an unsigned two bytes offset. These pseudo
* instructions will be replaced with standard bytecode instructions
* with wider offsets (4 bytes instead of 2), in ClassReader.
* @throws IllegalArgumentException
* if this label has already been resolved, or if it has not
* been created by the given code writer.
* @param owner the code writer that calls this method.
* @param position the position of this label in the bytecode.
* @param data the bytecode of the method.
* @return &#60;tt&#62;true&#60;/tt&#62; if a blank that was left for this label was too small to store the offset.
* In such a case the corresponding jump instruction is replaced with a pseudo instruction (using unused
* opcodes) using an unsigned two bytes offset. These pseudo instructions will be replaced with standard
* bytecode instructions with wider offsets (4 bytes instead of 2), in ClassReader.
* @throws IllegalArgumentException if this label has already been resolved, or if it has not been created by the
* given code writer.
*/
boolean resolve(final MethodWriter owner, final int position,
final byte[] data) {
boolean resolve(final MethodWriter owner, final int position, final byte[] data) {
boolean needUpdate = false;
this.status |= RESOLVED;
this.position = position;
@@ -445,10 +373,9 @@ public class Label {
}
/**
* Returns the first label of the series to which this label belongs. For an
* isolated label or for the first label in a series of successive labels,
* this method returns the label itself. For other labels it returns the
* first label of the series.
* Returns the first label of the series to which this label belongs. For an isolated label or for the first label
* in a series of successive labels, this method returns the label itself. For other labels it returns the first
* label of the series.
*
* @return the first label of the series to which this label belongs.
*/
@@ -463,8 +390,7 @@ public class Label {
/**
* Returns true is this basic block belongs to the given subroutine.
*
* @param id
* a subroutine id.
* @param id a subroutine id.
* @return true is this basic block belongs to the given subroutine.
*/
boolean inSubroutine(final long id) {
@@ -475,13 +401,10 @@ public class Label {
}
/**
* Returns true if this basic block and the given one belong to a common
* subroutine.
* Returns true if this basic block and the given one belong to a common subroutine.
*
* @param block
* another basic block.
* @return true if this basic block and the given one belong to a common
* subroutine.
* @param block another basic block.
* @return true if this basic block and the given one belong to a common subroutine.
*/
boolean inSameSubroutine(final Label block) {
if ((status & VISITED) == 0 || (block.status & VISITED) == 0) {
@@ -498,10 +421,8 @@ public class Label {
/**
* Marks this basic block as belonging to the given subroutine.
*
* @param id
* a subroutine id.
* @param nbSubroutines
* the total number of subroutines in the method.
* @param id a subroutine id.
* @param nbSubroutines the total number of subroutines in the method.
*/
void addToSubroutine(final long id, final int nbSubroutines) {
if ((status & VISITED) == 0) {
@@ -512,19 +433,14 @@ public class Label {
}
/**
* Finds the basic blocks that belong to a given subroutine, and marks these
* blocks as belonging to this subroutine. This method follows the control
* flow graph to find all the blocks that are reachable from the current
* block WITHOUT following any JSR target.
* Finds the basic blocks that belong to a given subroutine, and marks these blocks as belonging to this subroutine.
* This method follows the control flow graph to find all the blocks that are reachable from the current block
* WITHOUT following any JSR target.
*
* @param JSR
* a JSR block that jumps to this subroutine. If this JSR is not
* null it is added to the successor of the RET blocks found in
* the subroutine.
* @param id
* the id of this subroutine.
* @param nbSubroutines
* the total number of subroutines in the method.
* @param JSR a JSR block that jumps to this subroutine. If this JSR is not null it is added to the successor of the
* RET blocks found in the subroutine.
* @param id the id of this subroutine.
* @param nbSubroutines the total number of subroutines in the method.
*/
void visitSubroutine(final Label JSR, final long id, final int nbSubroutines) {
// user managed stack of labels, to avoid using a recursive method

View File

@@ -1,274 +1,264 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.asm;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.*;
import static org.redkale.asm.Opcodes.*;
/**
* MethodVisitor 的调试类
* <p>
* 详情见: https://redkale.org
*
* @author zhangjx
*/
public class MethodDebugVisitor {
private final MethodVisitor visitor;
private boolean debug = false;
public MethodDebugVisitor setDebug(boolean d) {
debug = d;
return this;
}
public void debugLine() {
if (!debug) return;
System.out.println();
System.out.println();
System.out.println();
}
private final Map<Label, Integer> labels = new LinkedHashMap<>();
private static final String[] opcodes = new String[200]; //0 -18
static {
try {
for (java.lang.reflect.Field field : Opcodes.class.getFields()) {
String name = field.getName();
if (name.startsWith("ASM")) continue;
if (name.startsWith("V1_")) continue;
if (name.startsWith("ACC_")) continue;
if (name.startsWith("T_")) continue;
if (name.startsWith("H_")) continue;
if (name.startsWith("F_")) continue;
if (field.getType() != int.class) continue;
opcodes[(int) (Integer) field.get(null)] = name;
}
} catch (Exception ex) {
throw new RuntimeException(ex); //不可能会发生
}
}
/**
*
* @param visitor MethodVisitor
*/
public MethodDebugVisitor(MethodVisitor visitor) {
//super(Opcodes.ASM5, visitor);
this.visitor = visitor;
}
public void visitTryCatchBlock(Label start, Label end, Label handler, String type) {
visitor.visitTryCatchBlock(start, end, handler, type);
if (debug) System.out.println("mv.visitTryCatchBlock(label0, label1, label2, \"" + type + "\");");
}
public AnnotationVisitor visitParameterAnnotation(int i, String string, boolean bln) {
AnnotationVisitor av = visitor.visitParameterAnnotation(i, string, bln);
if (debug) System.out.println("mv.visitParameterAnnotation(" + i + ", \"" + string + "\", " + bln + ");");
return av;
}
public AnnotationVisitor visitAnnotation(String desc, boolean flag) {
AnnotationVisitor av = visitor.visitAnnotation(desc, flag);
if (debug) System.out.println("mv.visitAnnotation(\"" + desc + "\", " + flag + ");");
return av;
}
public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) {
AnnotationVisitor av = visitor.visitTypeAnnotation(typeRef, typePath, desc, visible);
if (debug) System.out.println("mv.visitTypeAnnotation(" + typeRef + ", " + typePath + ", \"" + desc + "\", " + visible + ");");
return av;
}
public void visitParameter(String name, int access) {
visitor.visitParameter(name, access);
if (debug) System.out.println("mv.visitParameter(" + name + ", " + access + ");");
}
public void visitVarInsn(int opcode, int var) {
visitor.visitVarInsn(opcode, var);
if (debug) System.out.println("mv.visitVarInsn(" + opcodes[opcode] + ", " + var + ");");
}
public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack) {
visitor.visitFrame(type, nLocal, local, nStack, stack);
if (debug) {
String typestr = "" + type;
if (type == -1) {
typestr = "Opcodes.F_NEW";
} else if (type == 1) {
typestr = "Opcodes.F_APPEND";
} else if (type == 2) {
typestr = "Opcodes.F_CHOP";
} else if (type == 3) {
typestr = "Opcodes.F_SAME";
} else if (type == 4) {
typestr = "Opcodes.F_SAME1";
}
System.out.println("mv.visitFrame(" + typestr + ", " + nLocal + ", " + Arrays.toString(local) + ", " + nStack + ", " + Arrays.toString(stack) + ");");
}
}
public void visitJumpInsn(int opcode, Label var) { //调用此方法的 ClassWriter 必须由 COMPUTE_FRAMES 构建
visitor.visitJumpInsn(opcode, var);
if (debug) {
Integer index = labels.get(var);
if (index == null) {
index = labels.size();
labels.put(var, index);
System.out.println("Label l" + index + " = new Label();");
}
System.out.println("mv.visitJumpInsn(" + opcodes[opcode] + ", l" + index + ");");
}
}
public void visitCode() {
visitor.visitCode();
if (debug) System.out.println("mv.visitCode();");
}
public void visitLabel(Label var) {
visitor.visitLabel(var);
if (debug) {
Integer index = labels.get(var);
if (index == null) {
index = labels.size();
labels.put(var, index);
System.out.println("Label l" + index + " = new Label();");
}
System.out.println("mv.visitLabel(l" + index + ");");
}
}
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
visitor.visitMethodInsn(opcode, owner, name, desc, itf);
if (debug) System.out.println("mv.visitMethodInsn(" + opcodes[opcode] + ", \"" + owner + "\", \"" + name + "\", \"" + desc + "\", " + itf + ");");
}
public void visitFieldInsn(int opcode, String owner, String name, String desc) {
visitor.visitFieldInsn(opcode, owner, name, desc);
if (debug) System.out.println("mv.visitFieldInsn(" + opcodes[opcode] + ", \"" + owner + "\", \"" + name + "\", \"" + desc + "\");");
}
public void visitTypeInsn(int opcode, String type) {
visitor.visitTypeInsn(opcode, type);
if (debug) System.out.println("mv.visitTypeInsn(" + opcodes[opcode] + ", \"" + type + "\");");
}
public void visitInsn(int opcode) {
visitor.visitInsn(opcode);
if (debug) System.out.println("mv.visitInsn(" + opcodes[opcode] + ");");
}
public void visitIntInsn(int opcode, int value) {
visitor.visitIntInsn(opcode, value);
if (debug) System.out.println("mv.visitIntInsn(" + opcodes[opcode] + ", " + value + ");");
}
public void visitIincInsn(int opcode, int value) {
visitor.visitIincInsn(opcode, value);
if (debug) System.out.println("mv.visitIincInsn(" + opcode + ", " + value + ");");
}
public void visitLdcInsn(Object o) {
visitor.visitLdcInsn(o);
if (debug) {
if (o instanceof CharSequence) {
System.out.println("mv.visitLdcInsn(\"" + o + "\");");
} else if (o instanceof org.redkale.asm.Type) {
System.out.println("mv.visitLdcInsn(Type.getType(\"" + o + "\"));");
} else {
System.out.println("mv.visitLdcInsn(" + o + ");");
}
}
}
public void visitMaxs(int maxStack, int maxLocals) {
visitor.visitMaxs(maxStack, maxLocals);
if (debug) System.out.println("mv.visitMaxs(" + maxStack + ", " + maxLocals + ");");
}
public void visitEnd() {
visitor.visitEnd();
if (debug) System.out.println("mv.visitEnd();\r\n\r\n\r\n");
}
public static void pushInt(MethodDebugVisitor mv, int num) {
if (num < 6) {
mv.visitInsn(ICONST_0 + num);
} else if (num <= Byte.MAX_VALUE) {
mv.visitIntInsn(BIPUSH, num);
} else if (num <= Short.MAX_VALUE) {
mv.visitIntInsn(SIPUSH, num);
} else {
mv.visitLdcInsn(num);
}
}
public static void pushInt(MethodVisitor mv, int num) {
if (num < 6) {
mv.visitInsn(ICONST_0 + num);
} else if (num <= Byte.MAX_VALUE) {
mv.visitIntInsn(BIPUSH, num);
} else if (num <= Short.MAX_VALUE) {
mv.visitIntInsn(SIPUSH, num);
} else {
mv.visitLdcInsn(num);
}
}
public static void visitAnnotation(final AnnotationVisitor av, final Annotation ann) {
try {
for (Method anm : ann.annotationType().getMethods()) {
final String mname = anm.getName();
if ("equals".equals(mname) || "hashCode".equals(mname) || "toString".equals(mname) || "annotationType".equals(mname)) continue;
final Object r = anm.invoke(ann);
if (r instanceof String[]) {
AnnotationVisitor av1 = av.visitArray(mname);
for (String item : (String[]) r) {
av1.visit(null, item);
}
av1.visitEnd();
} else if (r instanceof Class[]) {
AnnotationVisitor av1 = av.visitArray(mname);
for (Class item : (Class[]) r) {
av1.visit(null, Type.getType(item));
}
av1.visitEnd();
} else if (r instanceof Enum[]) {
AnnotationVisitor av1 = av.visitArray(mname);
for (Enum item : (Enum[]) r) {
av1.visitEnum(null, Type.getDescriptor(item.getClass()), ((Enum) item).name());
}
av1.visitEnd();
} else if (r instanceof Annotation[]) {
AnnotationVisitor av1 = av.visitArray(mname);
for (Annotation item : (Annotation[]) r) {
visitAnnotation(av1.visitAnnotation(null, Type.getDescriptor(((Annotation) item).annotationType())), item);
}
av1.visitEnd();
} else if (r instanceof Class) {
av.visit(mname, Type.getType((Class) r));
} else if (r instanceof Enum) {
av.visitEnum(mname, Type.getDescriptor(r.getClass()), ((Enum) r).name());
} else if (r instanceof Annotation) {
visitAnnotation(av.visitAnnotation(null, Type.getDescriptor(((Annotation) r).annotationType())), (Annotation) r);
} else {
av.visit(mname, r);
}
}
av.visitEnd();
} catch (Exception e) {
e.printStackTrace();
}
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.asm;
import java.util.*;
/**
* MethodVisitor 的调试类
*
* <p>详情见: https://redkale.org
*
* @author zhangjx
*/
public class MethodDebugVisitor extends MethodVisitor {
private final MethodVisitor visitor;
private boolean debug = false;
public MethodDebugVisitor setDebug(boolean d) {
debug = d;
return this;
}
public void debugLine() {
if (!debug) {
return;
}
System.out.println();
System.out.println();
System.out.println();
}
private final Map<Label, Integer> labels = new LinkedHashMap<>();
private static final String[] opcodes = new String[200]; // 0 -18
static {
try {
for (java.lang.reflect.Field field : Opcodes.class.getFields()) {
String name = field.getName();
if (name.startsWith("ASM")) {
continue;
}
if (name.startsWith("V1_")) {
continue;
}
if (name.startsWith("ACC_")) {
continue;
}
if (name.startsWith("T_")) {
continue;
}
if (name.startsWith("H_")) {
continue;
}
if (name.startsWith("F_")) {
continue;
}
if (field.getType() != int.class) {
continue;
}
opcodes[(int) (Integer) field.get(null)] = name;
}
} catch (Exception ex) {
throw new RuntimeException(ex); // 不可能会发生
}
}
/** @param visitor MethodVisitor */
public MethodDebugVisitor(MethodVisitor visitor) {
super(Opcodes.ASM6, visitor);
this.visitor = visitor;
}
public void visitTryCatchBlock(Label start, Label end, Label handler, String type) {
visitor.visitTryCatchBlock(start, end, handler, type);
if (debug) {
System.out.println("mv.visitTryCatchBlock(label0, label1, label2, \"" + type + "\");");
}
}
public AnnotationVisitor visitParameterAnnotation(int i, String string, boolean bln) {
AnnotationVisitor av = visitor.visitParameterAnnotation(i, string, bln);
if (debug) {
System.out.println("mv.visitParameterAnnotation(" + i + ", \"" + string + "\", " + bln + ");");
}
return av;
}
public AnnotationVisitor visitAnnotation(String desc, boolean flag) {
AnnotationVisitor av = visitor.visitAnnotation(desc, flag);
if (debug) {
System.out.println("mv.visitAnnotation(\"" + desc + "\", " + flag + ");");
}
return av;
}
public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) {
AnnotationVisitor av = visitor.visitTypeAnnotation(typeRef, typePath, desc, visible);
if (debug) {
System.out.println(
"mv.visitTypeAnnotation(" + typeRef + ", " + typePath + ", \"" + desc + "\", " + visible + ");");
}
return av;
}
public void visitParameter(String name, int access) {
visitor.visitParameter(name, access);
if (debug) {
System.out.println("mv.visitParameter(" + name + ", " + access + ");");
}
}
public void visitVarInsn(int opcode, int var) {
visitor.visitVarInsn(opcode, var);
if (debug) {
System.out.println("mv.visitVarInsn(" + opcodes[opcode] + ", " + var + ");");
}
}
public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack) {
visitor.visitFrame(type, nLocal, local, nStack, stack);
if (debug) {
String typestr = "" + type;
if (type == -1) {
typestr = "Opcodes.F_NEW";
} else if (type == 1) {
typestr = "Opcodes.F_APPEND";
} else if (type == 2) {
typestr = "Opcodes.F_CHOP";
} else if (type == 3) {
typestr = "Opcodes.F_SAME";
} else if (type == 4) {
typestr = "Opcodes.F_SAME1";
}
System.out.println("mv.visitFrame(" + typestr + ", " + nLocal + ", " + Arrays.toString(local) + ", "
+ nStack + ", " + Arrays.toString(stack) + ");");
}
}
public void visitJumpInsn(int opcode, Label var) { // 调用此方法的 ClassWriter 必须由 COMPUTE_FRAMES 构建
visitor.visitJumpInsn(opcode, var);
if (debug) {
Integer index = labels.get(var);
if (index == null) {
index = labels.size();
labels.put(var, index);
System.out.println("Label l" + index + " = new Label();");
}
System.out.println("mv.visitJumpInsn(" + opcodes[opcode] + ", l" + index + ");");
}
}
public void visitCode() {
visitor.visitCode();
if (debug) {
System.out.println("mv.visitCode();");
}
}
public void visitLabel(Label var) {
visitor.visitLabel(var);
if (debug) {
Integer index = labels.get(var);
if (index == null) {
index = labels.size();
labels.put(var, index);
System.out.println("Label label" + index + " = new Label();");
}
System.out.println("mv.visitLabel(label" + index + ");");
}
}
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
visitor.visitMethodInsn(opcode, owner, name, desc, itf);
if (debug) {
System.out.println("mv.visitMethodInsn(" + opcodes[opcode] + ", \"" + owner + "\", \"" + name + "\", \""
+ desc + "\", " + itf + ");");
}
}
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm, Object... bsmArgs) {
visitor.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
if (debug) {
System.out.println("mv.visitInvokeDynamicInsn(\"" + name + "\", \"" + desc + "\", null, null);");
}
}
public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) {
visitor.visitLocalVariable(name, desc, signature, start, end, index);
if (debug) {
String s = signature == null ? null : ("\"" + signature + "\"");
System.out.println(
"mv.visitLocalVariable(\"" + name + "\", \"" + desc + "\", " + s + ", null, null, " + index + ");");
}
}
public void visitFieldInsn(int opcode, String owner, String name, String desc) {
visitor.visitFieldInsn(opcode, owner, name, desc);
if (debug) {
System.out.println("mv.visitFieldInsn(" + opcodes[opcode] + ", \"" + owner + "\", \"" + name + "\", \""
+ desc + "\");");
}
}
public void visitTypeInsn(int opcode, String type) {
visitor.visitTypeInsn(opcode, type);
if (debug) {
System.out.println("mv.visitTypeInsn(" + opcodes[opcode] + ", \"" + type + "\");");
}
}
public void visitInsn(int opcode) {
visitor.visitInsn(opcode);
if (debug) {
System.out.println("mv.visitInsn(" + opcodes[opcode] + ");");
}
}
public void visitIntInsn(int opcode, int value) {
visitor.visitIntInsn(opcode, value);
if (debug) {
System.out.println("mv.visitIntInsn(" + opcodes[opcode] + ", " + value + ");");
}
}
public void visitIincInsn(int opcode, int value) {
visitor.visitIincInsn(opcode, value);
if (debug) {
System.out.println("mv.visitIincInsn(" + opcode + ", " + value + ");");
}
}
public void visitLdcInsn(Object o) {
visitor.visitLdcInsn(o);
if (debug) {
if (o instanceof CharSequence) {
System.out.println("mv.visitLdcInsn(\"" + o + "\");");
} else if (o instanceof org.redkale.asm.Type) {
System.out.println("mv.visitLdcInsn(Type.getType(\"" + o + "\"));");
} else {
System.out.println("mv.visitLdcInsn(" + o + ");");
}
}
}
public void visitMaxs(int maxStack, int maxLocals) {
visitor.visitMaxs(maxStack, maxLocals);
if (debug) {
System.out.println("mv.visitMaxs(" + maxStack + ", " + maxLocals + ");");
}
}
public void visitEnd() {
visitor.visitEnd();
if (debug) {
System.out.println("mv.visitEnd();\r\n\r\n\r\n");
}
}
}

View File

@@ -59,49 +59,42 @@
package org.redkale.asm;
/**
* A visitor to visit a Java method. The methods of this class must be called in
* the following order: ( &#60;tt&#62;visitParameter&#60;/tt&#62; )* [
* &#60;tt&#62;visitAnnotationDefault&#60;/tt&#62; ] ( &#60;tt&#62;visitAnnotation&#60;/tt&#62; |
* &#60;tt&#62;visitParameterAnnotation&#60;/tt&#62; &#60;tt&#62;visitTypeAnnotation&#60;/tt&#62; |
* &#60;tt&#62;visitAttribute&#60;/tt&#62; )* [ &#60;tt&#62;visitCode&#60;/tt&#62; ( &#60;tt&#62;visitFrame&#60;/tt&#62; |
* &#60;tt&#62;visit<i>X</i>Insn&#60;/tt&#62; | &#60;tt&#62;visitLabel&#60;/tt&#62; |
* &#60;tt&#62;visitInsnAnnotation&#60;/tt&#62; | &#60;tt&#62;visitTryCatchBlock&#60;/tt&#62; |
* &#60;tt&#62;visitTryCatchAnnotation&#60;/tt&#62; | &#60;tt&#62;visitLocalVariable&#60;/tt&#62; |
* &#60;tt&#62;visitLocalVariableAnnotation&#60;/tt&#62; | &#60;tt&#62;visitLineNumber&#60;/tt&#62; )*
* &#60;tt&#62;visitMaxs&#60;/tt&#62; ] &#60;tt&#62;visitEnd&#60;/tt&#62;. In addition, the
* &#60;tt&#62;visit<i>X</i>Insn&#60;/tt&#62; and &#60;tt&#62;visitLabel&#60;/tt&#62; methods must be called in
* the sequential order of the bytecode instructions of the visited code,
* &#60;tt&#62;visitInsnAnnotation&#60;/tt&#62; must be called <i>after</i> the annotated
* instruction, &#60;tt&#62;visitTryCatchBlock&#60;/tt&#62; must be called <i>before</i> the
* labels passed as arguments have been visited,
* &#60;tt&#62;visitTryCatchBlockAnnotation&#60;/tt&#62; must be called <i>after</i> the
* corresponding try catch block has been visited, and the
* &#60;tt&#62;visitLocalVariable&#60;/tt&#62;, &#60;tt&#62;visitLocalVariableAnnotation&#60;/tt&#62; and
* &#60;tt&#62;visitLineNumber&#60;/tt&#62; methods must be called <i>after</i> the labels
* passed as arguments have been visited.
* A visitor to visit a Java method. The methods of this class must be called in the following order: (
* &#60;tt&#62;visitParameter&#60;/tt&#62; )* [ &#60;tt&#62;visitAnnotationDefault&#60;/tt&#62; ] (
* &#60;tt&#62;visitAnnotation&#60;/tt&#62; | &#60;tt&#62;visitParameterAnnotation&#60;/tt&#62;
* &#60;tt&#62;visitTypeAnnotation&#60;/tt&#62; | &#60;tt&#62;visitAttribute&#60;/tt&#62; )* [
* &#60;tt&#62;visitCode&#60;/tt&#62; ( &#60;tt&#62;visitFrame&#60;/tt&#62; | &#60;tt&#62;visit<i>X</i>Insn&#60;/tt&#62;
* | &#60;tt&#62;visitLabel&#60;/tt&#62; | &#60;tt&#62;visitInsnAnnotation&#60;/tt&#62; |
* &#60;tt&#62;visitTryCatchBlock&#60;/tt&#62; | &#60;tt&#62;visitTryCatchAnnotation&#60;/tt&#62; |
* &#60;tt&#62;visitLocalVariable&#60;/tt&#62; | &#60;tt&#62;visitLocalVariableAnnotation&#60;/tt&#62; |
* &#60;tt&#62;visitLineNumber&#60;/tt&#62; )* &#60;tt&#62;visitMaxs&#60;/tt&#62; ] &#60;tt&#62;visitEnd&#60;/tt&#62;.
* In addition, the &#60;tt&#62;visit<i>X</i>Insn&#60;/tt&#62; and &#60;tt&#62;visitLabel&#60;/tt&#62; methods must be
* called in the sequential order of the bytecode instructions of the visited code,
* &#60;tt&#62;visitInsnAnnotation&#60;/tt&#62; must be called <i>after</i> the annotated instruction,
* &#60;tt&#62;visitTryCatchBlock&#60;/tt&#62; must be called <i>before</i> the labels passed as arguments have been
* visited, &#60;tt&#62;visitTryCatchBlockAnnotation&#60;/tt&#62; must be called <i>after</i> the corresponding try
* catch block has been visited, and the &#60;tt&#62;visitLocalVariable&#60;/tt&#62;,
* &#60;tt&#62;visitLocalVariableAnnotation&#60;/tt&#62; and &#60;tt&#62;visitLineNumber&#60;/tt&#62; methods must be
* called <i>after</i> the labels passed as arguments have been visited.
*
* @author Eric Bruneton
*/
public abstract class MethodVisitor {
/**
* The ASM API version implemented by this visitor. The value of this field
* must be one of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* The ASM API version implemented by this visitor. The value of this field must be one of {@link Opcodes#ASM4},
* {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
*/
protected final int api;
/**
* The method visitor to which this visitor must delegate method calls. May
* be null.
*/
/** The method visitor to which this visitor must delegate method calls. May be null. */
protected MethodVisitor mv;
/**
* Constructs a new {@link MethodVisitor}.
*
* @param api
* the ASM API version implemented by this visitor. Must be one
* of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* @param api the ASM API version implemented by this visitor. Must be one of {@link Opcodes#ASM4},
* {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
*/
public MethodVisitor(final int api) {
this(api, null);
@@ -110,12 +103,9 @@ public abstract class MethodVisitor {
/**
* Constructs a new {@link MethodVisitor}.
*
* @param api
* the ASM API version implemented by this visitor. Must be one
* of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* @param mv
* the method visitor to which this visitor must delegate method
* calls. May be null.
* @param api the ASM API version implemented by this visitor. Must be one of {@link Opcodes#ASM4},
* {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* @param mv the method visitor to which this visitor must delegate method calls. May be null.
*/
public MethodVisitor(final int api, final MethodVisitor mv) {
this.api = api;
@@ -129,12 +119,10 @@ public abstract class MethodVisitor {
/**
* Visits a parameter of this method.
*
* @param name
* parameter name or null if none is provided.
* @param access
* the parameter's access flags, only &#60;tt&#62;ACC_FINAL&#60;/tt&#62;,
* &#60;tt&#62;ACC_SYNTHETIC&#60;/tt&#62; or/and &#60;tt&#62;ACC_MANDATED&#60;/tt&#62; are
* allowed (see {@link Opcodes}).
* @param name parameter name or null if none is provided.
* @param access the parameter's access flags, only &#60;tt&#62;ACC_FINAL&#60;/tt&#62;,
* &#60;tt&#62;ACC_SYNTHETIC&#60;/tt&#62; or/and &#60;tt&#62;ACC_MANDATED&#60;/tt&#62; are allowed (see
* {@link Opcodes}).
*/
public void visitParameter(String name, int access) {
if (mv != null) {
@@ -145,12 +133,10 @@ public abstract class MethodVisitor {
/**
* Visits the default value of this annotation interface method.
*
* @return a visitor to the visit the actual default value of this
* annotation interface method, or &#60;tt&#62;null&#60;/tt&#62; if this visitor is
* not interested in visiting this default value. The 'name'
* parameters passed to the methods of this annotation visitor are
* ignored. Moreover, exacly one visit method must be called on this
* annotation visitor, followed by visitEnd.
* @return a visitor to the visit the actual default value of this annotation interface method, or
* &#60;tt&#62;null&#60;/tt&#62; if this visitor is not interested in visiting this default value. The 'name'
* parameters passed to the methods of this annotation visitor are ignored. Moreover, exacly one visit method
* must be called on this annotation visitor, followed by visitEnd.
*/
public AnnotationVisitor visitAnnotationDefault() {
if (mv != null) {
@@ -162,12 +148,10 @@ public abstract class MethodVisitor {
/**
* Visits an annotation of this method.
*
* @param desc
* the class descriptor of the annotation class.
* @param visible
* &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if
* this visitor is not interested in visiting this annotation.
* @param desc the class descriptor of the annotation class.
* @param visible &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if this visitor is not
* interested in visiting this annotation.
*/
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
if (mv != null) {
@@ -179,30 +163,20 @@ public abstract class MethodVisitor {
/**
* Visits an annotation on a type in the method signature.
*
* @param typeRef
* a reference to the annotated type. The sort of this type
* reference must be {@link TypeReference#METHOD_TYPE_PARAMETER
* METHOD_TYPE_PARAMETER},
* {@link TypeReference#METHOD_TYPE_PARAMETER_BOUND
* METHOD_TYPE_PARAMETER_BOUND},
* {@link TypeReference#METHOD_RETURN METHOD_RETURN},
* {@link TypeReference#METHOD_RECEIVER METHOD_RECEIVER},
* {@link TypeReference#METHOD_FORMAL_PARAMETER
* METHOD_FORMAL_PARAMETER} or {@link TypeReference#THROWS
* THROWS}. See {@link TypeReference}.
* @param typePath
* the path to the annotated type argument, wildcard bound, array
* element type, or static inner type within 'typeRef'. May be
* &#60;tt&#62;null&#60;/tt&#62; if the annotation targets 'typeRef' as a whole.
* @param desc
* the class descriptor of the annotation class.
* @param visible
* &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if
* this visitor is not interested in visiting this annotation.
* @param typeRef a reference to the annotated type. The sort of this type reference must be
* {@link TypeReference#METHOD_TYPE_PARAMETER METHOD_TYPE_PARAMETER},
* {@link TypeReference#METHOD_TYPE_PARAMETER_BOUND METHOD_TYPE_PARAMETER_BOUND},
* {@link TypeReference#METHOD_RETURN METHOD_RETURN}, {@link TypeReference#METHOD_RECEIVER METHOD_RECEIVER},
* {@link TypeReference#METHOD_FORMAL_PARAMETER METHOD_FORMAL_PARAMETER} or {@link TypeReference#THROWS THROWS}.
* See {@link TypeReference}.
* @param typePath the path to the annotated type argument, wildcard bound, array element type, or static inner type
* within 'typeRef'. May be &#60;tt&#62;null&#60;/tt&#62; if the annotation targets 'typeRef' as a whole.
* @param desc the class descriptor of the annotation class.
* @param visible &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if this visitor is not
* interested in visiting this annotation.
*/
public AnnotationVisitor visitTypeAnnotation(int typeRef,
TypePath typePath, String desc, boolean visible) {
public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) {
if (mv != null) {
return mv.visitTypeAnnotation(typeRef, typePath, desc, visible);
}
@@ -212,17 +186,13 @@ public abstract class MethodVisitor {
/**
* Visits an annotation of a parameter this method.
*
* @param parameter
* the parameter index.
* @param desc
* the class descriptor of the annotation class.
* @param visible
* &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if
* this visitor is not interested in visiting this annotation.
* @param parameter the parameter index.
* @param desc the class descriptor of the annotation class.
* @param visible &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if this visitor is not
* interested in visiting this annotation.
*/
public AnnotationVisitor visitParameterAnnotation(int parameter,
String desc, boolean visible) {
public AnnotationVisitor visitParameterAnnotation(int parameter, String desc, boolean visible) {
if (mv != null) {
return mv.visitParameterAnnotation(parameter, desc, visible);
}
@@ -232,8 +202,7 @@ public abstract class MethodVisitor {
/**
* Visits a non standard attribute of this method.
*
* @param attr
* an attribute.
* @param attr an attribute.
*/
public void visitAttribute(Attribute attr) {
if (mv != null) {
@@ -241,9 +210,7 @@ public abstract class MethodVisitor {
}
}
/**
* Starts the visit of the method's code, if any (i.e. non abstract method).
*/
/** Starts the visit of the method's code, if any (i.e. non abstract method). */
public void visitCode() {
if (mv != null) {
mv.visitCode();
@@ -251,82 +218,57 @@ public abstract class MethodVisitor {
}
/**
* Visits the current state of the local variables and operand stack
* elements. This method must(*) be called <i>just before</i> any
* instruction <b>i</b> that follows an unconditional branch instruction
* such as GOTO or THROW, that is the target of a jump instruction, or that
* starts an exception handler block. The visited types must describe the
* values of the local variables and of the operand stack elements <i>just
* before</i> <b>i</b> is executed.<br>
* Visits the current state of the local variables and operand stack elements. This method must(*) be called <i>just
* before</i> any instruction <b>i</b> that follows an unconditional branch instruction such as GOTO or THROW, that
* is the target of a jump instruction, or that starts an exception handler block. The visited types must describe
* the values of the local variables and of the operand stack elements <i>just before</i> <b>i</b> is executed.<br>
* <br>
* (*) this is mandatory only for classes whose version is greater than or
* equal to {@link Opcodes#V1_6 V1_6}. <br>
* (*) this is mandatory only for classes whose version is greater than or equal to {@link Opcodes#V1_6 V1_6}. <br>
* <br>
* The frames of a method must be given either in expanded form, or in
* compressed form (all frames must use the same format, i.e. you must not
* mix expanded and compressed frames within a single method):
* <ul>
* <li>In expanded form, all frames must have the F_NEW type.</li>
* <li>In compressed form, frames are basically "deltas" from the state of
* the previous frame:
* <ul>
* <li>{@link Opcodes#F_SAME} representing frame with exactly the same
* locals as the previous frame and with the empty stack.</li>
* <li>{@link Opcodes#F_SAME1} representing frame with exactly the same
* locals as the previous frame and with single value on the stack (
* <code>nStack</code> is 1 and <code>stack[0]</code> contains value for the
* type of the stack item).</li>
* <li>{@link Opcodes#F_APPEND} representing frame with current locals are
* the same as the locals in the previous frame, except that additional
* locals are defined (<code>nLocal</code> is 1, 2 or 3 and
* <code>local</code> elements contains values representing added types).</li>
* <li>{@link Opcodes#F_CHOP} representing frame with current locals are the
* same as the locals in the previous frame, except that the last 1-3 locals
* are absent and with the empty stack (<code>nLocals</code> is 1, 2 or 3).</li>
* <li>{@link Opcodes#F_FULL} representing complete frame data.</li>
* </ul>
* </li>
* </ul>
* <br>
* In both cases the first frame, corresponding to the method's parameters
* and access flags, is implicit and must not be visited. Also, it is
* illegal to visit two or more frames for the same code location (i.e., at
* least one instruction must be visited between two calls to visitFrame).
* The frames of a method must be given either in expanded form, or in compressed form (all frames must use the same
* format, i.e. you must not mix expanded and compressed frames within a single method):
*
* @param type
* the type of this stack map frame. Must be
* {@link Opcodes#F_NEW} for expanded frames, or
* {@link Opcodes#F_FULL}, {@link Opcodes#F_APPEND},
* {@link Opcodes#F_CHOP}, {@link Opcodes#F_SAME} or
* {@link Opcodes#F_APPEND}, {@link Opcodes#F_SAME1} for
* compressed frames.
* @param nLocal
* the number of local variables in the visited frame.
* @param local
* the local variable types in this frame. This array must not be
* modified. Primitive types are represented by
* {@link Opcodes#TOP}, {@link Opcodes#INTEGER},
* {@link Opcodes#FLOAT}, {@link Opcodes#LONG},
* {@link Opcodes#DOUBLE},{@link Opcodes#NULL} or
* {@link Opcodes#UNINITIALIZED_THIS} (long and double are
* represented by a single element). Reference types are
* represented by String objects (representing internal names),
* and uninitialized types by Label objects (this label
* designates the NEW instruction that created this uninitialized
* value).
* @param nStack
* the number of operand stack elements in the visited frame.
* @param stack
* the operand stack types in this frame. This array must not be
* modified. Its content has the same format as the "local"
* array.
* @throws IllegalStateException
* if a frame is visited just after another one, without any
* instruction between the two (unless this frame is a
* Opcodes#F_SAME frame, in which case it is silently ignored).
* <ul>
* <li>In expanded form, all frames must have the F_NEW type.
* <li>In compressed form, frames are basically "deltas" from the state of the previous frame:
* <ul>
* <li>{@link Opcodes#F_SAME} representing frame with exactly the same locals as the previous frame and with
* the empty stack.
* <li>{@link Opcodes#F_SAME1} representing frame with exactly the same locals as the previous frame and
* with single value on the stack ( <code>nStack</code> is 1 and <code>stack[0]</code> contains value
* for the type of the stack item).
* <li>{@link Opcodes#F_APPEND} representing frame with current locals are the same as the locals in the
* previous frame, except that additional locals are defined (<code>nLocal</code> is 1, 2 or 3 and
* <code>local</code> elements contains values representing added types).
* <li>{@link Opcodes#F_CHOP} representing frame with current locals are the same as the locals in the
* previous frame, except that the last 1-3 locals are absent and with the empty stack (<code>nLocals
* </code> is 1, 2 or 3).
* <li>{@link Opcodes#F_FULL} representing complete frame data.
* </ul>
* </ul>
*
* <br>
* In both cases the first frame, corresponding to the method's parameters and access flags, is implicit and must
* not be visited. Also, it is illegal to visit two or more frames for the same code location (i.e., at least one
* instruction must be visited between two calls to visitFrame).
*
* @param type the type of this stack map frame. Must be {@link Opcodes#F_NEW} for expanded frames, or
* {@link Opcodes#F_FULL}, {@link Opcodes#F_APPEND}, {@link Opcodes#F_CHOP}, {@link Opcodes#F_SAME} or
* {@link Opcodes#F_APPEND}, {@link Opcodes#F_SAME1} for compressed frames.
* @param nLocal the number of local variables in the visited frame.
* @param local the local variable types in this frame. This array must not be modified. Primitive types are
* represented by {@link Opcodes#TOP}, {@link Opcodes#INTEGER}, {@link Opcodes#FLOAT}, {@link Opcodes#LONG},
* {@link Opcodes#DOUBLE},{@link Opcodes#NULL} or {@link Opcodes#UNINITIALIZED_THIS} (long and double are
* represented by a single element). Reference types are represented by String objects (representing internal
* names), and uninitialized types by Label objects (this label designates the NEW instruction that created this
* uninitialized value).
* @param nStack the number of operand stack elements in the visited frame.
* @param stack the operand stack types in this frame. This array must not be modified. Its content has the same
* format as the "local" array.
* @throws IllegalStateException if a frame is visited just after another one, without any instruction between the
* two (unless this frame is a Opcodes#F_SAME frame, in which case it is silently ignored).
*/
public void visitFrame(int type, int nLocal, Object[] local, int nStack,
Object[] stack) {
public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack) {
if (mv != null) {
mv.visitFrame(type, nLocal, local, nStack, stack);
}
@@ -339,22 +281,15 @@ public abstract class MethodVisitor {
/**
* Visits a zero operand instruction.
*
* @param opcode
* the opcode of the instruction to be visited. This opcode is
* either NOP, ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1,
* ICONST_2, ICONST_3, ICONST_4, ICONST_5, LCONST_0, LCONST_1,
* FCONST_0, FCONST_1, FCONST_2, DCONST_0, DCONST_1, IALOAD,
* LALOAD, FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD,
* IASTORE, LASTORE, FASTORE, DASTORE, AASTORE, BASTORE, CASTORE,
* SASTORE, POP, POP2, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1,
* DUP2_X2, SWAP, IADD, LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB,
* IMUL, LMUL, FMUL, DMUL, IDIV, LDIV, FDIV, DDIV, IREM, LREM,
* FREM, DREM, INEG, LNEG, FNEG, DNEG, ISHL, LSHL, ISHR, LSHR,
* IUSHR, LUSHR, IAND, LAND, IOR, LOR, IXOR, LXOR, I2L, I2F, I2D,
* L2I, L2F, L2D, F2I, F2L, F2D, D2I, D2L, D2F, I2B, I2C, I2S,
* LCMP, FCMPL, FCMPG, DCMPL, DCMPG, IRETURN, LRETURN, FRETURN,
* DRETURN, ARETURN, RETURN, ARRAYLENGTH, ATHROW, MONITORENTER,
* or MONITOREXIT.
* @param opcode the opcode of the instruction to be visited. This opcode is either NOP, ACONST_NULL, ICONST_M1,
* ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, LCONST_0, LCONST_1, FCONST_0, FCONST_1, FCONST_2,
* DCONST_0, DCONST_1, IALOAD, LALOAD, FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, IASTORE, LASTORE,
* FASTORE, DASTORE, AASTORE, BASTORE, CASTORE, SASTORE, POP, POP2, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2,
* SWAP, IADD, LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB, IMUL, LMUL, FMUL, DMUL, IDIV, LDIV, FDIV, DDIV, IREM,
* LREM, FREM, DREM, INEG, LNEG, FNEG, DNEG, ISHL, LSHL, ISHR, LSHR, IUSHR, LUSHR, IAND, LAND, IOR, LOR, IXOR,
* LXOR, I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L, F2D, D2I, D2L, D2F, I2B, I2C, I2S, LCMP, FCMPL, FCMPG, DCMPL,
* DCMPG, IRETURN, LRETURN, FRETURN, DRETURN, ARETURN, RETURN, ARRAYLENGTH, ATHROW, MONITORENTER, or
* MONITOREXIT.
*/
public void visitInsn(int opcode) {
if (mv != null) {
@@ -365,20 +300,13 @@ public abstract class MethodVisitor {
/**
* Visits an instruction with a single int operand.
*
* @param opcode
* the opcode of the instruction to be visited. This opcode is
* either BIPUSH, SIPUSH or NEWARRAY.
* @param operand
* the operand of the instruction to be visited.<br>
* When opcode is BIPUSH, operand value should be between
* Byte.MIN_VALUE and Byte.MAX_VALUE.<br>
* When opcode is SIPUSH, operand value should be between
* Short.MIN_VALUE and Short.MAX_VALUE.<br>
* When opcode is NEWARRAY, operand value should be one of
* {@link Opcodes#T_BOOLEAN}, {@link Opcodes#T_CHAR},
* {@link Opcodes#T_FLOAT}, {@link Opcodes#T_DOUBLE},
* {@link Opcodes#T_BYTE}, {@link Opcodes#T_SHORT},
* {@link Opcodes#T_INT} or {@link Opcodes#T_LONG}.
* @param opcode the opcode of the instruction to be visited. This opcode is either BIPUSH, SIPUSH or NEWARRAY.
* @param operand the operand of the instruction to be visited.<br>
* When opcode is BIPUSH, operand value should be between Byte.MIN_VALUE and Byte.MAX_VALUE.<br>
* When opcode is SIPUSH, operand value should be between Short.MIN_VALUE and Short.MAX_VALUE.<br>
* When opcode is NEWARRAY, operand value should be one of {@link Opcodes#T_BOOLEAN}, {@link Opcodes#T_CHAR},
* {@link Opcodes#T_FLOAT}, {@link Opcodes#T_DOUBLE}, {@link Opcodes#T_BYTE}, {@link Opcodes#T_SHORT},
* {@link Opcodes#T_INT} or {@link Opcodes#T_LONG}.
*/
public void visitIntInsn(int opcode, int operand) {
if (mv != null) {
@@ -387,16 +315,12 @@ public abstract class MethodVisitor {
}
/**
* Visits a local variable instruction. A local variable instruction is an
* instruction that loads or stores the value of a local variable.
* Visits a local variable instruction. A local variable instruction is an instruction that loads or stores the
* value of a local variable.
*
* @param opcode
* the opcode of the local variable instruction to be visited.
* This opcode is either ILOAD, LLOAD, FLOAD, DLOAD, ALOAD,
* ISTORE, LSTORE, FSTORE, DSTORE, ASTORE or RET.
* @param var
* the operand of the instruction to be visited. This operand is
* the index of a local variable.
* @param opcode the opcode of the local variable instruction to be visited. This opcode is either ILOAD, LLOAD,
* FLOAD, DLOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE, ASTORE or RET.
* @param var the operand of the instruction to be visited. This operand is the index of a local variable.
*/
public void visitVarInsn(int opcode, int var) {
if (mv != null) {
@@ -405,16 +329,13 @@ public abstract class MethodVisitor {
}
/**
* Visits a type instruction. A type instruction is an instruction that
* takes the internal name of a class as parameter.
* Visits a type instruction. A type instruction is an instruction that takes the internal name of a class as
* parameter.
*
* @param opcode
* the opcode of the type instruction to be visited. This opcode
* is either NEW, ANEWARRAY, CHECKCAST or INSTANCEOF.
* @param type
* the operand of the instruction to be visited. This operand
* must be the internal name of an object or array class (see
* {@link Type#getInternalName() getInternalName}).
* @param opcode the opcode of the type instruction to be visited. This opcode is either NEW, ANEWARRAY, CHECKCAST
* or INSTANCEOF.
* @param type the operand of the instruction to be visited. This operand must be the internal name of an object or
* array class (see {@link Type#getInternalName() getInternalName}).
*/
public void visitTypeInsn(int opcode, String type) {
if (mv != null) {
@@ -423,47 +344,32 @@ public abstract class MethodVisitor {
}
/**
* Visits a field instruction. A field instruction is an instruction that
* loads or stores the value of a field of an object.
* Visits a field instruction. A field instruction is an instruction that loads or stores the value of a field of an
* object.
*
* @param opcode
* the opcode of the type instruction to be visited. This opcode
* is either GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD.
* @param owner
* the internal name of the field's owner class (see
* {@link Type#getInternalName() getInternalName}).
* @param name
* the field's name.
* @param desc
* the field's descriptor (see {@link Type Type}).
* @param opcode the opcode of the type instruction to be visited. This opcode is either GETSTATIC, PUTSTATIC,
* GETFIELD or PUTFIELD.
* @param owner the internal name of the field's owner class (see {@link Type#getInternalName() getInternalName}).
* @param name the field's name.
* @param desc the field's descriptor (see {@link Type Type}).
*/
public void visitFieldInsn(int opcode, String owner, String name,
String desc) {
public void visitFieldInsn(int opcode, String owner, String name, String desc) {
if (mv != null) {
mv.visitFieldInsn(opcode, owner, name, desc);
}
}
/**
* Visits a method instruction. A method instruction is an instruction that
* invokes a method.
* Visits a method instruction. A method instruction is an instruction that invokes a method.
*
* @param opcode
* the opcode of the type instruction to be visited. This opcode
* is either INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or
* INVOKEINTERFACE.
* @param owner
* the internal name of the method's owner class (see
* {@link Type#getInternalName() getInternalName}).
* @param name
* the method's name.
* @param desc
* the method's descriptor (see {@link Type Type}).
* @param itf
* if the method's owner class is an interface.
* @param opcode the opcode of the type instruction to be visited. This opcode is either INVOKEVIRTUAL,
* INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE.
* @param owner the internal name of the method's owner class (see {@link Type#getInternalName() getInternalName}).
* @param name the method's name.
* @param desc the method's descriptor (see {@link Type Type}).
* @param itf if the method's owner class is an interface.
*/
public void visitMethodInsn(int opcode, String owner, String name,
String desc, boolean itf) {
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
if (mv != null) {
mv.visitMethodInsn(opcode, owner, name, desc, itf);
}
@@ -472,39 +378,27 @@ public abstract class MethodVisitor {
/**
* Visits an invokedynamic instruction.
*
* @param name
* the method's name.
* @param desc
* the method's descriptor (see {@link Type Type}).
* @param bsm
* the bootstrap method.
* @param bsmArgs
* the bootstrap method constant arguments. Each argument must be
* an {@link Integer}, {@link Float}, {@link Long},
* {@link Double}, {@link String}, {@link Type} or {@link Handle}
* value. This method is allowed to modify the content of the
* array so a caller should expect that this array may change.
* @param name the method's name.
* @param desc the method's descriptor (see {@link Type Type}).
* @param bsm the bootstrap method.
* @param bsmArgs the bootstrap method constant arguments. Each argument must be an {@link Integer}, {@link Float},
* {@link Long}, {@link Double}, {@link String}, {@link Type} or {@link Handle} value. This method is allowed to
* modify the content of the array so a caller should expect that this array may change.
*/
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm,
Object... bsmArgs) {
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm, Object... bsmArgs) {
if (mv != null) {
mv.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
}
}
/**
* Visits a jump instruction. A jump instruction is an instruction that may
* jump to another instruction.
* Visits a jump instruction. A jump instruction is an instruction that may jump to another instruction.
*
* @param opcode
* the opcode of the type instruction to be visited. This opcode
* is either IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ,
* IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE,
* IF_ACMPEQ, IF_ACMPNE, GOTO, JSR, IFNULL or IFNONNULL.
* @param label
* the operand of the instruction to be visited. This operand is
* a label that designates the instruction to which the jump
* instruction may jump.
* @param opcode the opcode of the type instruction to be visited. This opcode is either IFEQ, IFNE, IFLT, IFGE,
* IFGT, IFLE, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE, GOTO,
* JSR, IFNULL or IFNONNULL.
* @param label the operand of the instruction to be visited. This operand is a label that designates the
* instruction to which the jump instruction may jump.
*/
public void visitJumpInsn(int opcode, Label label) {
if (mv != null) {
@@ -513,11 +407,9 @@ public abstract class MethodVisitor {
}
/**
* Visits a label. A label designates the instruction that will be visited
* just after it.
* Visits a label. A label designates the instruction that will be visited just after it.
*
* @param label
* a {@link Label Label} object.
* @param label a {@link Label Label} object.
*/
public void visitLabel(Label label) {
if (mv != null) {
@@ -530,10 +422,9 @@ public abstract class MethodVisitor {
// -------------------------------------------------------------------------
/**
* Visits a LDC instruction. Note that new constant types may be added in
* future versions of the Java Virtual Machine. To easily detect new
* constant types, implementations of this method should check for
* unexpected constant types, like this:
* Visits a LDC instruction. Note that new constant types may be added in future versions of the Java Virtual
* Machine. To easily detect new constant types, implementations of this method should check for unexpected constant
* types, like this:
*
* <pre>
* if (cst instanceof Integer) {
@@ -564,14 +455,10 @@ public abstract class MethodVisitor {
* }
* </pre>
*
* @param cst
* the constant to be loaded on the stack. This parameter must be
* a non null {@link Integer}, a {@link Float}, a {@link Long}, a
* {@link Double}, a {@link String}, a {@link Type} of OBJECT or
* ARRAY sort for &#60;tt&#62;.class&#60;/tt&#62; constants, for classes whose
* version is 49.0, a {@link Type} of METHOD sort or a
* {@link Handle} for MethodType and MethodHandle constants, for
* classes whose version is 51.0.
* @param cst the constant to be loaded on the stack. This parameter must be a non null {@link Integer}, a
* {@link Float}, a {@link Long}, a {@link Double}, a {@link String}, a {@link Type} of OBJECT or ARRAY sort for
* &#60;tt&#62;.class&#60;/tt&#62; constants, for classes whose version is 49.0, a {@link Type} of METHOD sort
* or a {@link Handle} for MethodType and MethodHandle constants, for classes whose version is 51.0.
*/
public void visitLdcInsn(Object cst) {
if (mv != null) {
@@ -582,10 +469,8 @@ public abstract class MethodVisitor {
/**
* Visits an IINC instruction.
*
* @param var
* index of the local variable to be incremented.
* @param increment
* amount to increment the local variable by.
* @param var index of the local variable to be incremented.
* @param increment amount to increment the local variable by.
*/
public void visitIincInsn(int var, int increment) {
if (mv != null) {
@@ -596,18 +481,13 @@ public abstract class MethodVisitor {
/**
* Visits a TABLESWITCH instruction.
*
* @param min
* the minimum key value.
* @param max
* the maximum key value.
* @param dflt
* beginning of the default handler block.
* @param labels
* beginnings of the handler blocks. &#60;tt&#62;labels[i]&#60;/tt&#62; is the
* beginning of the handler block for the &#60;tt&#62;min + i&#60;/tt&#62; key.
* @param min the minimum key value.
* @param max the maximum key value.
* @param dflt beginning of the default handler block.
* @param labels beginnings of the handler blocks. &#60;tt&#62;labels[i]&#60;/tt&#62; is the beginning of the
* handler block for the &#60;tt&#62;min + i&#60;/tt&#62; key.
*/
public void visitTableSwitchInsn(int min, int max, Label dflt,
Label... labels) {
public void visitTableSwitchInsn(int min, int max, Label dflt, Label... labels) {
if (mv != null) {
mv.visitTableSwitchInsn(min, max, dflt, labels);
}
@@ -616,13 +496,10 @@ public abstract class MethodVisitor {
/**
* Visits a LOOKUPSWITCH instruction.
*
* @param dflt
* beginning of the default handler block.
* @param keys
* the values of the keys.
* @param labels
* beginnings of the handler blocks. &#60;tt&#62;labels[i]&#60;/tt&#62; is the
* beginning of the handler block for the &#60;tt&#62;keys[i]&#60;/tt&#62; key.
* @param dflt beginning of the default handler block.
* @param keys the values of the keys.
* @param labels beginnings of the handler blocks. &#60;tt&#62;labels[i]&#60;/tt&#62; is the beginning of the
* handler block for the &#60;tt&#62;keys[i]&#60;/tt&#62; key.
*/
public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) {
if (mv != null) {
@@ -633,10 +510,8 @@ public abstract class MethodVisitor {
/**
* Visits a MULTIANEWARRAY instruction.
*
* @param desc
* an array type descriptor (see {@link Type Type}).
* @param dims
* number of dimensions of the array to allocate.
* @param desc an array type descriptor (see {@link Type Type}).
* @param dims number of dimensions of the array to allocate.
*/
public void visitMultiANewArrayInsn(String desc, int dims) {
if (mv != null) {
@@ -645,38 +520,25 @@ public abstract class MethodVisitor {
}
/**
* Visits an annotation on an instruction. This method must be called just
* <i>after</i> the annotated instruction. It can be called several times
* for the same instruction.
* Visits an annotation on an instruction. This method must be called just <i>after</i> the annotated instruction.
* It can be called several times for the same instruction.
*
* @param typeRef
* a reference to the annotated type. The sort of this type
* reference must be {@link TypeReference#INSTANCEOF INSTANCEOF},
* {@link TypeReference#NEW NEW},
* {@link TypeReference#CONSTRUCTOR_REFERENCE
* CONSTRUCTOR_REFERENCE}, {@link TypeReference#METHOD_REFERENCE
* METHOD_REFERENCE}, {@link TypeReference#CAST CAST},
* {@link TypeReference#CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
* CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT},
* {@link TypeReference#METHOD_INVOCATION_TYPE_ARGUMENT
* METHOD_INVOCATION_TYPE_ARGUMENT},
* {@link TypeReference#CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
* CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or
* {@link TypeReference#METHOD_REFERENCE_TYPE_ARGUMENT
* METHOD_REFERENCE_TYPE_ARGUMENT}. See {@link TypeReference}.
* @param typePath
* the path to the annotated type argument, wildcard bound, array
* element type, or static inner type within 'typeRef'. May be
* &#60;tt&#62;null&#60;/tt&#62; if the annotation targets 'typeRef' as a whole.
* @param desc
* the class descriptor of the annotation class.
* @param visible
* &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if
* this visitor is not interested in visiting this annotation.
* @param typeRef a reference to the annotated type. The sort of this type reference must be
* {@link TypeReference#INSTANCEOF INSTANCEOF}, {@link TypeReference#NEW NEW},
* {@link TypeReference#CONSTRUCTOR_REFERENCE CONSTRUCTOR_REFERENCE}, {@link TypeReference#METHOD_REFERENCE
* METHOD_REFERENCE}, {@link TypeReference#CAST CAST}, {@link TypeReference#CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
* CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT}, {@link TypeReference#METHOD_INVOCATION_TYPE_ARGUMENT
* METHOD_INVOCATION_TYPE_ARGUMENT}, {@link TypeReference#CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
* CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or {@link TypeReference#METHOD_REFERENCE_TYPE_ARGUMENT
* METHOD_REFERENCE_TYPE_ARGUMENT}. See {@link TypeReference}.
* @param typePath the path to the annotated type argument, wildcard bound, array element type, or static inner type
* within 'typeRef'. May be &#60;tt&#62;null&#60;/tt&#62; if the annotation targets 'typeRef' as a whole.
* @param desc the class descriptor of the annotation class.
* @param visible &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if this visitor is not
* interested in visiting this annotation.
*/
public AnnotationVisitor visitInsnAnnotation(int typeRef,
TypePath typePath, String desc, boolean visible) {
public AnnotationVisitor visitInsnAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) {
if (mv != null) {
return mv.visitInsnAnnotation(typeRef, typePath, desc, visible);
}
@@ -690,50 +552,35 @@ public abstract class MethodVisitor {
/**
* Visits a try catch block.
*
* @param start
* beginning of the exception handler's scope (inclusive).
* @param end
* end of the exception handler's scope (exclusive).
* @param handler
* beginning of the exception handler's code.
* @param type
* internal name of the type of exceptions handled by the
* handler, or &#60;tt&#62;null&#60;/tt&#62; to catch any exceptions (for
* "finally" blocks).
* @throws IllegalArgumentException
* if one of the labels has already been visited by this visitor
* (by the {@link #visitLabel visitLabel} method).
* @param start beginning of the exception handler's scope (inclusive).
* @param end end of the exception handler's scope (exclusive).
* @param handler beginning of the exception handler's code.
* @param type internal name of the type of exceptions handled by the handler, or &#60;tt&#62;null&#60;/tt&#62; to
* catch any exceptions (for "finally" blocks).
* @throws IllegalArgumentException if one of the labels has already been visited by this visitor (by the
* {@link #visitLabel visitLabel} method).
*/
public void visitTryCatchBlock(Label start, Label end, Label handler,
String type) {
public void visitTryCatchBlock(Label start, Label end, Label handler, String type) {
if (mv != null) {
mv.visitTryCatchBlock(start, end, handler, type);
}
}
/**
* Visits an annotation on an exception handler type. This method must be
* called <i>after</i> the {@link #visitTryCatchBlock} for the annotated
* exception handler. It can be called several times for the same exception
* handler.
* Visits an annotation on an exception handler type. This method must be called <i>after</i> the
* {@link #visitTryCatchBlock} for the annotated exception handler. It can be called several times for the same
* exception handler.
*
* @param typeRef
* a reference to the annotated type. The sort of this type
* reference must be {@link TypeReference#EXCEPTION_PARAMETER
* EXCEPTION_PARAMETER}. See {@link TypeReference}.
* @param typePath
* the path to the annotated type argument, wildcard bound, array
* element type, or static inner type within 'typeRef'. May be
* &#60;tt&#62;null&#60;/tt&#62; if the annotation targets 'typeRef' as a whole.
* @param desc
* the class descriptor of the annotation class.
* @param visible
* &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if
* this visitor is not interested in visiting this annotation.
* @param typeRef a reference to the annotated type. The sort of this type reference must be
* {@link TypeReference#EXCEPTION_PARAMETER EXCEPTION_PARAMETER}. See {@link TypeReference}.
* @param typePath the path to the annotated type argument, wildcard bound, array element type, or static inner type
* within 'typeRef'. May be &#60;tt&#62;null&#60;/tt&#62; if the annotation targets 'typeRef' as a whole.
* @param desc the class descriptor of the annotation class.
* @param visible &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if this visitor is not
* interested in visiting this annotation.
*/
public AnnotationVisitor visitTryCatchAnnotation(int typeRef,
TypePath typePath, String desc, boolean visible) {
public AnnotationVisitor visitTryCatchAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) {
if (mv != null) {
return mv.visitTryCatchAnnotation(typeRef, typePath, desc, visible);
}
@@ -743,28 +590,17 @@ public abstract class MethodVisitor {
/**
* Visits a local variable declaration.
*
* @param name
* the name of a local variable.
* @param desc
* the type descriptor of this local variable.
* @param signature
* the type signature of this local variable. May be
* &#60;tt&#62;null&#60;/tt&#62; if the local variable type does not use generic
* types.
* @param start
* the first instruction corresponding to the scope of this local
* variable (inclusive).
* @param end
* the last instruction corresponding to the scope of this local
* variable (exclusive).
* @param index
* the local variable's index.
* @throws IllegalArgumentException
* if one of the labels has not already been visited by this
* visitor (by the {@link #visitLabel visitLabel} method).
* @param name the name of a local variable.
* @param desc the type descriptor of this local variable.
* @param signature the type signature of this local variable. May be &#60;tt&#62;null&#60;/tt&#62; if the local
* variable type does not use generic types.
* @param start the first instruction corresponding to the scope of this local variable (inclusive).
* @param end the last instruction corresponding to the scope of this local variable (exclusive).
* @param index the local variable's index.
* @throws IllegalArgumentException if one of the labels has not already been visited by this visitor (by the
* {@link #visitLabel visitLabel} method).
*/
public void visitLocalVariable(String name, String desc, String signature,
Label start, Label end, int index) {
public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) {
if (mv != null) {
mv.visitLocalVariable(name, desc, signature, start, end, index);
}
@@ -773,38 +609,25 @@ public abstract class MethodVisitor {
/**
* Visits an annotation on a local variable type.
*
* @param typeRef
* a reference to the annotated type. The sort of this type
* reference must be {@link TypeReference#LOCAL_VARIABLE
* LOCAL_VARIABLE} or {@link TypeReference#RESOURCE_VARIABLE
* RESOURCE_VARIABLE}. See {@link TypeReference}.
* @param typePath
* the path to the annotated type argument, wildcard bound, array
* element type, or static inner type within 'typeRef'. May be
* &#60;tt&#62;null&#60;/tt&#62; if the annotation targets 'typeRef' as a whole.
* @param start
* the fist instructions corresponding to the continuous ranges
* that make the scope of this local variable (inclusive).
* @param end
* the last instructions corresponding to the continuous ranges
* that make the scope of this local variable (exclusive). This
* array must have the same size as the 'start' array.
* @param index
* the local variable's index in each range. This array must have
* the same size as the 'start' array.
* @param desc
* the class descriptor of the annotation class.
* @param visible
* &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if
* this visitor is not interested in visiting this annotation.
* @param typeRef a reference to the annotated type. The sort of this type reference must be
* {@link TypeReference#LOCAL_VARIABLE LOCAL_VARIABLE} or {@link TypeReference#RESOURCE_VARIABLE
* RESOURCE_VARIABLE}. See {@link TypeReference}.
* @param typePath the path to the annotated type argument, wildcard bound, array element type, or static inner type
* within 'typeRef'. May be &#60;tt&#62;null&#60;/tt&#62; if the annotation targets 'typeRef' as a whole.
* @param start the fist instructions corresponding to the continuous ranges that make the scope of this local
* variable (inclusive).
* @param end the last instructions corresponding to the continuous ranges that make the scope of this local
* variable (exclusive). This array must have the same size as the 'start' array.
* @param index the local variable's index in each range. This array must have the same size as the 'start' array.
* @param desc the class descriptor of the annotation class.
* @param visible &#60;tt&#62;true&#60;/tt&#62; if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or &#60;tt&#62;null&#60;/tt&#62; if this visitor is not
* interested in visiting this annotation.
*/
public AnnotationVisitor visitLocalVariableAnnotation(int typeRef,
TypePath typePath, Label[] start, Label[] end, int[] index,
String desc, boolean visible) {
public AnnotationVisitor visitLocalVariableAnnotation(
int typeRef, TypePath typePath, Label[] start, Label[] end, int[] index, String desc, boolean visible) {
if (mv != null) {
return mv.visitLocalVariableAnnotation(typeRef, typePath, start,
end, index, desc, visible);
return mv.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, desc, visible);
}
return null;
}
@@ -812,14 +635,10 @@ public abstract class MethodVisitor {
/**
* Visits a line number declaration.
*
* @param line
* a line number. This number refers to the source file from
* which the class was compiled.
* @param start
* the first instruction corresponding to this line number.
* @throws IllegalArgumentException
* if &#60;tt&#62;start&#60;/tt&#62; has not already been visited by this
* visitor (by the {@link #visitLabel visitLabel} method).
* @param line a line number. This number refers to the source file from which the class was compiled.
* @param start the first instruction corresponding to this line number.
* @throws IllegalArgumentException if &#60;tt&#62;start&#60;/tt&#62; has not already been visited by this visitor
* (by the {@link #visitLabel visitLabel} method).
*/
public void visitLineNumber(int line, Label start) {
if (mv != null) {
@@ -828,13 +647,10 @@ public abstract class MethodVisitor {
}
/**
* Visits the maximum stack size and the maximum number of local variables
* of the method.
* Visits the maximum stack size and the maximum number of local variables of the method.
*
* @param maxStack
* maximum stack size of the method.
* @param maxLocals
* maximum number of local variables for the method.
* @param maxStack maximum stack size of the method.
* @param maxLocals maximum number of local variables for the method.
*/
public void visitMaxs(int maxStack, int maxLocals) {
if (mv != null) {
@@ -843,9 +659,8 @@ public abstract class MethodVisitor {
}
/**
* Visits the end of the method. This method, which is the last one to be
* called, is used to inform the visitor that all the annotations and
* attributes of the method have been visited.
* Visits the end of the method. This method, which is the last one to be called, is used to inform the visitor that
* all the annotations and attributes of the method have been visited.
*/
public void visitEnd() {
if (mv != null) {

File diff suppressed because it is too large Load Diff

View File

@@ -59,36 +59,29 @@
package org.redkale.asm;
/**
* A visitor to visit a Java module. The methods of this class must be called in
* the following order: &#60;tt&#62;visitMainClass&#60;/tt&#62; | ( &#60;tt&#62;visitPackage&#60;/tt&#62; |
* A visitor to visit a Java module. The methods of this class must be called in the following order:
* &#60;tt&#62;visitMainClass&#60;/tt&#62; | ( &#60;tt&#62;visitPackage&#60;/tt&#62; |
* &#60;tt&#62;visitRequire&#60;/tt&#62; | &#60;tt&#62;visitExport&#60;/tt&#62; | &#60;tt&#62;visitOpen&#60;/tt&#62; |
* &#60;tt&#62;visitUse&#60;/tt&#62; | &#60;tt&#62;visitProvide&#60;/tt&#62; )* &#60;tt&#62;visitEnd&#60;/tt&#62;.
*
* The methods {@link #visitRequire(String, int, String)}, {@link #visitExport(String, int, String...)},
* {@link #visitOpen(String, int, String...)} and {@link #visitPackage(String)}
* take as parameter a package name or a module name. Unlike the other names which are internal names
* (names separated by slash), module and package names are qualified names (names separated by dot).
* <p>The methods {@link #visitRequire(String, int, String)}, {@link #visitExport(String, int, String...)},
* {@link #visitOpen(String, int, String...)} and {@link #visitPackage(String)} take as parameter a package name or a
* module name. Unlike the other names which are internal names (names separated by slash), module and package names are
* qualified names (names separated by dot).
*
* @author Remi Forax
*/
public abstract class ModuleVisitor {
/**
* The ASM API version implemented by this visitor. The value of this field
* must be {@link Opcodes#ASM6}.
*/
/** The ASM API version implemented by this visitor. The value of this field must be {@link Opcodes#ASM6}. */
protected final int api;
/**
* The module visitor to which this visitor must delegate method calls. May
* be null.
*/
/** The module visitor to which this visitor must delegate method calls. May be null. */
protected ModuleVisitor mv;
/**
* Constructs a new {@link ModuleVisitor}.
*
* @param api
* the ASM API version implemented by this visitor. Must be {@link Opcodes#ASM6}.
* @param api the ASM API version implemented by this visitor. Must be {@link Opcodes#ASM6}.
*/
public ModuleVisitor(final int api) {
this(api, null);
@@ -97,11 +90,8 @@ public abstract class ModuleVisitor {
/**
* Constructs a new {@link ModuleVisitor}.
*
* @param api
* the ASM API version implemented by this visitor. Must be {@link Opcodes#ASM6}.
* @param mv
* the module visitor to which this visitor must delegate method
* calls. May be null.
* @param api the ASM API version implemented by this visitor. Must be {@link Opcodes#ASM6}.
* @param mv the module visitor to which this visitor must delegate method calls. May be null.
*/
public ModuleVisitor(final int api, final ModuleVisitor mv) {
if (api != Opcodes.ASM6) {
@@ -137,9 +127,8 @@ public abstract class ModuleVisitor {
* Visits a dependence of the current module.
*
* @param module the qualified name of the dependence.
* @param access the access flag of the dependence among
* ACC_TRANSITIVE, ACC_STATIC_PHASE, ACC_SYNTHETIC
* and ACC_MANDATED.
* @param access the access flag of the dependence among ACC_TRANSITIVE, ACC_STATIC_PHASE, ACC_SYNTHETIC and
* ACC_MANDATED.
* @param version the module version at compile time or null.
*/
public void visitRequire(String module, int access, String version) {
@@ -152,12 +141,10 @@ public abstract class ModuleVisitor {
* Visit an exported package of the current module.
*
* @param packaze the qualified name of the exported package.
* @param access the access flag of the exported package,
* valid values are among {@code ACC_SYNTHETIC} and
* {@code ACC_MANDATED}.
* @param modules the qualified names of the modules that can access to
* the public classes of the exported package or
* &#60;tt&#62;null&#60;/tt&#62;.
* @param access the access flag of the exported package, valid values are among {@code ACC_SYNTHETIC} and
* {@code ACC_MANDATED}.
* @param modules the qualified names of the modules that can access to the public classes of the exported package
* or &#60;tt&#62;null&#60;/tt&#62;.
*/
public void visitExport(String packaze, int access, String... modules) {
if (mv != null) {
@@ -169,12 +156,10 @@ public abstract class ModuleVisitor {
* Visit an open package of the current module.
*
* @param packaze the qualified name of the opened package.
* @param access the access flag of the opened package,
* valid values are among {@code ACC_SYNTHETIC} and
* {@code ACC_MANDATED}.
* @param modules the qualified names of the modules that can use deep
* reflection to the classes of the open package or
* &#60;tt&#62;null&#60;/tt&#62;.
* @param access the access flag of the opened package, valid values are among {@code ACC_SYNTHETIC} and
* {@code ACC_MANDATED}.
* @param modules the qualified names of the modules that can use deep reflection to the classes of the open package
* or &#60;tt&#62;null&#60;/tt&#62;.
*/
public void visitOpen(String packaze, int access, String... modules) {
if (mv != null) {
@@ -183,8 +168,7 @@ public abstract class ModuleVisitor {
}
/**
* Visit a service used by the current module.
* The name must be the internal name of an interface or a class.
* Visit a service used by the current module. The name must be the internal name of an interface or a class.
*
* @param service the internal name of the service.
*/
@@ -198,8 +182,7 @@ public abstract class ModuleVisitor {
* Visit an implementation of a service.
*
* @param service the internal name of the service
* @param providers the internal names of the implementations
* of the service (there is at least one provider).
* @param providers the internal names of the implementations of the service (there is at least one provider).
*/
public void visitProvide(String service, String... providers) {
if (mv != null) {
@@ -208,8 +191,8 @@ public abstract class ModuleVisitor {
}
/**
* Visits the end of the module. This method, which is the last one to be
* called, is used to inform the visitor that everything have been visited.
* Visits the end of the module. This method, which is the last one to be called, is used to inform the visitor that
* everything have been visited.
*/
public void visitEnd() {
if (mv != null) {

View File

@@ -59,122 +59,90 @@
package org.redkale.asm;
/**
* @author Remi Forax
*/
/** @author Remi Forax */
final class ModuleWriter extends ModuleVisitor {
/**
* The class writer to which this Module attribute must be added.
*/
/** The class writer to which this Module attribute must be added. */
private final ClassWriter cw;
/**
* size in byte of the Module attribute.
*/
/** size in byte of the Module attribute. */
int size;
/**
* Number of attributes associated with the current module
* (Version, ConcealPackages, etc)
*/
/** Number of attributes associated with the current module (Version, ConcealPackages, etc) */
int attributeCount;
/**
* Size in bytes of the attributes associated with the current module
*/
/** Size in bytes of the attributes associated with the current module */
int attributesSize;
/**
* module name index in the constant pool
*/
/** module name index in the constant pool */
private final int name;
/**
* module access flags
*/
/** module access flags */
private final int access;
/**
* module version index in the constant pool or 0
*/
/** module version index in the constant pool or 0 */
private final int version;
/**
* module main class index in the constant pool or 0
*/
/** module main class index in the constant pool or 0 */
private int mainClass;
/**
* number of packages
*/
/** number of packages */
private int packageCount;
/**
* The packages in bytecode form. This byte vector only contains
* the items themselves, the number of items is store in packageCount
* The packages in bytecode form. This byte vector only contains the items themselves, the number of items is store
* in packageCount
*/
private ByteVector packages;
/**
* number of requires items
*/
/** number of requires items */
private int requireCount;
/**
* The requires items in bytecode form. This byte vector only contains
* the items themselves, the number of items is store in requireCount
* The requires items in bytecode form. This byte vector only contains the items themselves, the number of items is
* store in requireCount
*/
private ByteVector requires;
/**
* number of exports items
*/
/** number of exports items */
private int exportCount;
/**
* The exports items in bytecode form. This byte vector only contains
* the items themselves, the number of items is store in exportCount
* The exports items in bytecode form. This byte vector only contains the items themselves, the number of items is
* store in exportCount
*/
private ByteVector exports;
/**
* number of opens items
*/
/** number of opens items */
private int openCount;
/**
* The opens items in bytecode form. This byte vector only contains
* the items themselves, the number of items is store in openCount
* The opens items in bytecode form. This byte vector only contains the items themselves, the number of items is
* store in openCount
*/
private ByteVector opens;
/**
* number of uses items
*/
/** number of uses items */
private int useCount;
/**
* The uses items in bytecode form. This byte vector only contains
* the items themselves, the number of items is store in useCount
* The uses items in bytecode form. This byte vector only contains the items themselves, the number of items is
* store in useCount
*/
private ByteVector uses;
/**
* number of provides items
*/
/** number of provides items */
private int provideCount;
/**
* The uses provides in bytecode form. This byte vector only contains
* the items themselves, the number of items is store in provideCount
* The uses provides in bytecode form. This byte vector only contains the items themselves, the number of items is
* store in provideCount
*/
private ByteVector provides;
ModuleWriter(final ClassWriter cw, final int name,
final int access, final int version) {
ModuleWriter(final ClassWriter cw, final int name, final int access, final int version) {
super(Opcodes.ASM6);
this.cw = cw;
this.size = 16; // name + access + version + 5 counts
this.size = 16; // name + access + version + 5 counts
this.name = name;
this.access = access;
this.version = version;
@@ -209,9 +177,7 @@ final class ModuleWriter extends ModuleVisitor {
if (requires == null) {
requires = new ByteVector();
}
requires.putShort(cw.newModule(module))
.putShort(access)
.putShort(version == null? 0: cw.newUTF8(version));
requires.putShort(cw.newModule(module)).putShort(access).putShort(version == null ? 0 : cw.newUTF8(version));
requireCount++;
size += 6;
}
@@ -227,7 +193,7 @@ final class ModuleWriter extends ModuleVisitor {
size += 6;
} else {
exports.putShort(modules.length);
for(String module: modules) {
for (String module : modules) {
exports.putShort(cw.newModule(module));
}
size += 6 + 2 * modules.length;
@@ -246,7 +212,7 @@ final class ModuleWriter extends ModuleVisitor {
size += 6;
} else {
opens.putShort(modules.length);
for(String module: modules) {
for (String module : modules) {
opens.putShort(cw.newModule(module));
}
size += 6 + 2 * modules.length;
@@ -271,7 +237,7 @@ final class ModuleWriter extends ModuleVisitor {
}
provides.putShort(cw.newClass(service));
provides.putShort(providers.length);
for(String provider: providers) {
for (String provider : providers) {
provides.putShort(cw.newClass(provider));
}
provideCount++;
@@ -289,9 +255,9 @@ final class ModuleWriter extends ModuleVisitor {
}
if (packages != null) {
out.putShort(cw.newUTF8("ModulePackages"))
.putInt(2 + 2 * packageCount)
.putShort(packageCount)
.putByteArray(packages.data, 0, packages.length);
.putInt(2 + 2 * packageCount)
.putShort(packageCount)
.putByteArray(packages.data, 0, packages.length);
}
}

View File

@@ -59,13 +59,10 @@
package org.redkale.asm;
/**
* Defines the JVM opcodes, access flags and array type codes. This interface
* does not define all the JVM opcodes because some opcodes are automatically
* handled. For example, the xLOAD and xSTORE opcodes are automatically replaced
* by xLOAD_n and xSTORE_n opcodes when possible. The xLOAD_n and xSTORE_n
* opcodes are therefore not defined in this interface. Likewise for LDC,
* automatically replaced by LDC_W or LDC2_W when necessary, WIDE, GOTO_W and
* JSR_W.
* Defines the JVM opcodes, access flags and array type codes. This interface does not define all the JVM opcodes
* because some opcodes are automatically handled. For example, the xLOAD and xSTORE opcodes are automatically replaced
* by xLOAD_n and xSTORE_n opcodes when possible. The xLOAD_n and xSTORE_n opcodes are therefore not defined in this
* interface. Likewise for LDC, automatically replaced by LDC_W or LDC2_W when necessary, WIDE, GOTO_W and JSR_W.
*
* @author Eric Bruneton
* @author Eugene Kuleshov
@@ -117,7 +114,6 @@ public interface Opcodes {
int ACC_MANDATED = 0x8000; // parameter, module, module *
int ACC_MODULE = 0x8000; // class
// ASM specific pseudo access flags
int ACC_DEPRECATED = 0x20000; // class, field, method
@@ -147,39 +143,30 @@ public interface Opcodes {
// stack map frame types
/**
* Represents an expanded frame. See {@link ClassReader#EXPAND_FRAMES}.
*/
/** Represents an expanded frame. See {@link ClassReader#EXPAND_FRAMES}. */
int F_NEW = -1;
/**
* Represents a compressed frame with complete frame data.
*/
/** Represents a compressed frame with complete frame data. */
int F_FULL = 0;
/**
* Represents a compressed frame where locals are the same as the locals in
* the previous frame, except that additional 1-3 locals are defined, and
* with an empty stack.
* Represents a compressed frame where locals are the same as the locals in the previous frame, except that
* additional 1-3 locals are defined, and with an empty stack.
*/
int F_APPEND = 1;
/**
* Represents a compressed frame where locals are the same as the locals in
* the previous frame, except that the last 1-3 locals are absent and with
* an empty stack.
* Represents a compressed frame where locals are the same as the locals in the previous frame, except that the last
* 1-3 locals are absent and with an empty stack.
*/
int F_CHOP = 2;
/**
* Represents a compressed frame with exactly the same locals as the
* previous frame and with an empty stack.
*/
/** Represents a compressed frame with exactly the same locals as the previous frame and with an empty stack. */
int F_SAME = 3;
/**
* Represents a compressed frame with exactly the same locals as the
* previous frame and with a single value on the stack.
* Represents a compressed frame with exactly the same locals as the previous frame and with a single value on the
* stack.
*/
int F_SAME1 = 4;
@@ -187,13 +174,26 @@ public interface Opcodes {
// these values are compared by reference and not by value
// The constructor of Integer was deprecated in 9
// but we are stuck with it by backward compatibility
@SuppressWarnings("deprecation") Integer TOP = new Integer(0);
@SuppressWarnings("deprecation") Integer INTEGER = new Integer(1);
@SuppressWarnings("deprecation") Integer FLOAT = new Integer(2);
@SuppressWarnings("deprecation") Integer DOUBLE = new Integer(3);
@SuppressWarnings("deprecation") Integer LONG = new Integer(4);
@SuppressWarnings("deprecation") Integer NULL = new Integer(5);
@SuppressWarnings("deprecation") Integer UNINITIALIZED_THIS = new Integer(6);
@SuppressWarnings("deprecation")
Integer TOP = Integer.valueOf(0);
@SuppressWarnings("deprecation")
Integer INTEGER = Integer.valueOf(1);
@SuppressWarnings("deprecation")
Integer FLOAT = Integer.valueOf(2);
@SuppressWarnings("deprecation")
Integer DOUBLE = Integer.valueOf(3);
@SuppressWarnings("deprecation")
Integer LONG = Integer.valueOf(4);
@SuppressWarnings("deprecation")
Integer NULL = Integer.valueOf(5);
@SuppressWarnings("deprecation")
Integer UNINITIALIZED_THIS = Integer.valueOf(6);
// opcodes // visit method (- = idem)

View File

@@ -62,154 +62,94 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
/**
* A Java field or method type. This class can be used to make it easier to
* manipulate type and method descriptors.
* A Java field or method type. This class can be used to make it easier to manipulate type and method descriptors.
*
* @author Eric Bruneton
* @author Chris Nokleberg
*/
public class Type {
/**
* The sort of the &#60;tt&#62;void&#60;/tt&#62; type. See {@link #getSort getSort}.
*/
/** The sort of the &#60;tt&#62;void&#60;/tt&#62; type. See {@link #getSort getSort}. */
public static final int VOID = 0;
/**
* The sort of the &#60;tt&#62;boolean&#60;/tt&#62; type. See {@link #getSort getSort}.
*/
/** The sort of the &#60;tt&#62;boolean&#60;/tt&#62; type. See {@link #getSort getSort}. */
public static final int BOOLEAN = 1;
/**
* The sort of the &#60;tt&#62;char&#60;/tt&#62; type. See {@link #getSort getSort}.
*/
/** The sort of the &#60;tt&#62;char&#60;/tt&#62; type. See {@link #getSort getSort}. */
public static final int CHAR = 2;
/**
* The sort of the &#60;tt&#62;byte&#60;/tt&#62; type. See {@link #getSort getSort}.
*/
/** The sort of the &#60;tt&#62;byte&#60;/tt&#62; type. See {@link #getSort getSort}. */
public static final int BYTE = 3;
/**
* The sort of the &#60;tt&#62;short&#60;/tt&#62; type. See {@link #getSort getSort}.
*/
/** The sort of the &#60;tt&#62;short&#60;/tt&#62; type. See {@link #getSort getSort}. */
public static final int SHORT = 4;
/**
* The sort of the &#60;tt&#62;int&#60;/tt&#62; type. See {@link #getSort getSort}.
*/
/** The sort of the &#60;tt&#62;int&#60;/tt&#62; type. See {@link #getSort getSort}. */
public static final int INT = 5;
/**
* The sort of the &#60;tt&#62;float&#60;/tt&#62; type. See {@link #getSort getSort}.
*/
/** The sort of the &#60;tt&#62;float&#60;/tt&#62; type. See {@link #getSort getSort}. */
public static final int FLOAT = 6;
/**
* The sort of the &#60;tt&#62;long&#60;/tt&#62; type. See {@link #getSort getSort}.
*/
/** The sort of the &#60;tt&#62;long&#60;/tt&#62; type. See {@link #getSort getSort}. */
public static final int LONG = 7;
/**
* The sort of the &#60;tt&#62;double&#60;/tt&#62; type. See {@link #getSort getSort}.
*/
/** The sort of the &#60;tt&#62;double&#60;/tt&#62; type. See {@link #getSort getSort}. */
public static final int DOUBLE = 8;
/**
* The sort of array reference types. See {@link #getSort getSort}.
*/
/** The sort of array reference types. See {@link #getSort getSort}. */
public static final int ARRAY = 9;
/**
* The sort of object reference types. See {@link #getSort getSort}.
*/
/** The sort of object reference types. See {@link #getSort getSort}. */
public static final int OBJECT = 10;
/**
* The sort of method types. See {@link #getSort getSort}.
*/
/** The sort of method types. See {@link #getSort getSort}. */
public static final int METHOD = 11;
/**
* The &#60;tt&#62;void&#60;/tt&#62; type.
*/
public static final Type VOID_TYPE = new Type(VOID, null, ('V' << 24)
| (5 << 16) | (0 << 8) | 0, 1);
/** The &#60;tt&#62;void&#60;/tt&#62; type. */
public static final Type VOID_TYPE = new Type(VOID, null, ('V' << 24) | (5 << 16) | (0 << 8) | 0, 1);
/**
* The &#60;tt&#62;boolean&#60;/tt&#62; type.
*/
public static final Type BOOLEAN_TYPE = new Type(BOOLEAN, null, ('Z' << 24)
| (0 << 16) | (5 << 8) | 1, 1);
/** The &#60;tt&#62;boolean&#60;/tt&#62; type. */
public static final Type BOOLEAN_TYPE = new Type(BOOLEAN, null, ('Z' << 24) | (0 << 16) | (5 << 8) | 1, 1);
/**
* The &#60;tt&#62;char&#60;/tt&#62; type.
*/
public static final Type CHAR_TYPE = new Type(CHAR, null, ('C' << 24)
| (0 << 16) | (6 << 8) | 1, 1);
/** The &#60;tt&#62;char&#60;/tt&#62; type. */
public static final Type CHAR_TYPE = new Type(CHAR, null, ('C' << 24) | (0 << 16) | (6 << 8) | 1, 1);
/**
* The &#60;tt&#62;byte&#60;/tt&#62; type.
*/
public static final Type BYTE_TYPE = new Type(BYTE, null, ('B' << 24)
| (0 << 16) | (5 << 8) | 1, 1);
/** The &#60;tt&#62;byte&#60;/tt&#62; type. */
public static final Type BYTE_TYPE = new Type(BYTE, null, ('B' << 24) | (0 << 16) | (5 << 8) | 1, 1);
/**
* The &#60;tt&#62;short&#60;/tt&#62; type.
*/
public static final Type SHORT_TYPE = new Type(SHORT, null, ('S' << 24)
| (0 << 16) | (7 << 8) | 1, 1);
/** The &#60;tt&#62;short&#60;/tt&#62; type. */
public static final Type SHORT_TYPE = new Type(SHORT, null, ('S' << 24) | (0 << 16) | (7 << 8) | 1, 1);
/**
* The &#60;tt&#62;int&#60;/tt&#62; type.
*/
public static final Type INT_TYPE = new Type(INT, null, ('I' << 24)
| (0 << 16) | (0 << 8) | 1, 1);
/** The &#60;tt&#62;int&#60;/tt&#62; type. */
public static final Type INT_TYPE = new Type(INT, null, ('I' << 24) | (0 << 16) | (0 << 8) | 1, 1);
/**
* The &#60;tt&#62;float&#60;/tt&#62; type.
*/
public static final Type FLOAT_TYPE = new Type(FLOAT, null, ('F' << 24)
| (2 << 16) | (2 << 8) | 1, 1);
/** The &#60;tt&#62;float&#60;/tt&#62; type. */
public static final Type FLOAT_TYPE = new Type(FLOAT, null, ('F' << 24) | (2 << 16) | (2 << 8) | 1, 1);
/**
* The &#60;tt&#62;long&#60;/tt&#62; type.
*/
public static final Type LONG_TYPE = new Type(LONG, null, ('J' << 24)
| (1 << 16) | (1 << 8) | 2, 1);
/** The &#60;tt&#62;long&#60;/tt&#62; type. */
public static final Type LONG_TYPE = new Type(LONG, null, ('J' << 24) | (1 << 16) | (1 << 8) | 2, 1);
/**
* The &#60;tt&#62;double&#60;/tt&#62; type.
*/
public static final Type DOUBLE_TYPE = new Type(DOUBLE, null, ('D' << 24)
| (3 << 16) | (3 << 8) | 2, 1);
/** The &#60;tt&#62;double&#60;/tt&#62; type. */
public static final Type DOUBLE_TYPE = new Type(DOUBLE, null, ('D' << 24) | (3 << 16) | (3 << 8) | 2, 1);
// ------------------------------------------------------------------------
// Fields
// ------------------------------------------------------------------------
/**
* The sort of this Java type.
*/
/** The sort of this Java type. */
private final int sort;
/**
* A buffer containing the internal name of this Java type. This field is
* only used for reference types.
*/
/** A buffer containing the internal name of this Java type. This field is only used for reference types. */
private final char[] buf;
/**
* The offset of the internal name of this Java type in {@link #buf buf} or,
* for primitive types, the size, descriptor and getOpcode offsets for this
* type (byte 0 contains the size, byte 1 the descriptor, byte 2 the offset
* for IALOAD or IASTORE, byte 3 the offset for all other instructions).
* The offset of the internal name of this Java type in {@link #buf buf} or, for primitive types, the size,
* descriptor and getOpcode offsets for this type (byte 0 contains the size, byte 1 the descriptor, byte 2 the
* offset for IALOAD or IASTORE, byte 3 the offset for all other instructions).
*/
private final int off;
/**
* The length of the internal name of this Java type.
*/
/** The length of the internal name of this Java type. */
private final int len;
// ------------------------------------------------------------------------
@@ -219,14 +159,10 @@ public class Type {
/**
* Constructs a reference type.
*
* @param sort
* the sort of the reference type to be constructed.
* @param buf
* a buffer containing the descriptor of the previous type.
* @param off
* the offset of this descriptor in the previous buffer.
* @param len
* the length of this descriptor.
* @param sort the sort of the reference type to be constructed.
* @param buf a buffer containing the descriptor of the previous type.
* @param off the offset of this descriptor in the previous buffer.
* @param len the length of this descriptor.
*/
private Type(final int sort, final char[] buf, final int off, final int len) {
this.sort = sort;
@@ -238,8 +174,7 @@ public class Type {
/**
* Returns the Java type corresponding to the given type descriptor.
*
* @param typeDescriptor
* a field or method type descriptor.
* @param typeDescriptor a field or method type descriptor.
* @return the Java type corresponding to the given type descriptor.
*/
public static Type getType(final String typeDescriptor) {
@@ -249,8 +184,7 @@ public class Type {
/**
* Returns the Java type corresponding to the given internal name.
*
* @param internalName
* an internal name.
* @param internalName an internal name.
* @return the Java type corresponding to the given internal name.
*/
public static Type getObjectType(final String internalName) {
@@ -259,11 +193,10 @@ public class Type {
}
/**
* Returns the Java type corresponding to the given method descriptor.
* Equivalent to <code>Type.getType(methodDescriptor)</code>.
* Returns the Java type corresponding to the given method descriptor. Equivalent to <code>
* Type.getType(methodDescriptor)</code>.
*
* @param methodDescriptor
* a method descriptor.
* @param methodDescriptor a method descriptor.
* @return the Java type corresponding to the given method descriptor.
*/
public static Type getMethodType(final String methodDescriptor) {
@@ -271,26 +204,20 @@ public class Type {
}
/**
* Returns the Java method type corresponding to the given argument and
* return types.
* Returns the Java method type corresponding to the given argument and return types.
*
* @param returnType
* the return type of the method.
* @param argumentTypes
* the argument types of the method.
* @return the Java type corresponding to the given argument and return
* types.
* @param returnType the return type of the method.
* @param argumentTypes the argument types of the method.
* @return the Java type corresponding to the given argument and return types.
*/
public static Type getMethodType(final Type returnType,
final Type... argumentTypes) {
public static Type getMethodType(final Type returnType, final Type... argumentTypes) {
return getType(getMethodDescriptor(returnType, argumentTypes));
}
/**
* Returns the Java type corresponding to the given class.
*
* @param c
* a class.
* @param c a class.
* @return the Java type corresponding to the given class.
*/
public static Type getType(final Class<?> c) {
@@ -311,7 +238,7 @@ public class Type {
return DOUBLE_TYPE;
} else if (c == Float.TYPE) {
return FLOAT_TYPE;
} else /* if (c == Long.TYPE) */{
} else /* if (c == Long.TYPE) */ {
return LONG_TYPE;
}
} else {
@@ -322,8 +249,7 @@ public class Type {
/**
* Returns the Java method type corresponding to the given constructor.
*
* @param c
* a {@link Constructor Constructor} object.
* @param c a {@link Constructor Constructor} object.
* @return the Java method type corresponding to the given constructor.
*/
public static Type getType(final Constructor<?> c) {
@@ -333,8 +259,7 @@ public class Type {
/**
* Returns the Java method type corresponding to the given method.
*
* @param m
* a {@link Method Method} object.
* @param m a {@link Method Method} object.
* @return the Java method type corresponding to the given method.
*/
public static Type getType(final Method m) {
@@ -342,13 +267,10 @@ public class Type {
}
/**
* Returns the Java types corresponding to the argument types of the given
* method descriptor.
* Returns the Java types corresponding to the argument types of the given method descriptor.
*
* @param methodDescriptor
* a method descriptor.
* @return the Java types corresponding to the argument types of the given
* method descriptor.
* @param methodDescriptor a method descriptor.
* @return the Java types corresponding to the argument types of the given method descriptor.
*/
public static Type[] getArgumentTypes(final String methodDescriptor) {
char[] buf = methodDescriptor.toCharArray();
@@ -360,6 +282,7 @@ public class Type {
break;
} else if (car == 'L') {
while (buf[off++] != ';') {
// do nothing
}
++size;
} else if (car != '[') {
@@ -378,13 +301,10 @@ public class Type {
}
/**
* Returns the Java types corresponding to the argument types of the given
* method.
* Returns the Java types corresponding to the argument types of the given method.
*
* @param method
* a method.
* @return the Java types corresponding to the argument types of the given
* method.
* @param method a method.
* @return the Java types corresponding to the argument types of the given method.
*/
public static Type[] getArgumentTypes(final Method method) {
Class<?>[] classes = method.getParameterTypes();
@@ -396,13 +316,10 @@ public class Type {
}
/**
* Returns the Java type corresponding to the return type of the given
* method descriptor.
* Returns the Java type corresponding to the return type of the given method descriptor.
*
* @param methodDescriptor
* a method descriptor.
* @return the Java type corresponding to the return type of the given
* method descriptor.
* @param methodDescriptor a method descriptor.
* @return the Java type corresponding to the return type of the given method descriptor.
*/
public static Type getReturnType(final String methodDescriptor) {
char[] buf = methodDescriptor.toCharArray();
@@ -413,19 +330,17 @@ public class Type {
return getType(buf, off);
} else if (car == 'L') {
while (buf[off++] != ';') {
// do nothing
}
}
}
}
/**
* Returns the Java type corresponding to the return type of the given
* method.
* Returns the Java type corresponding to the return type of the given method.
*
* @param method
* a method.
* @return the Java type corresponding to the return type of the given
* method.
* @param method a method.
* @return the Java type corresponding to the return type of the given method.
*/
public static Type getReturnType(final Method method) {
return getType(method.getReturnType());
@@ -434,13 +349,11 @@ public class Type {
/**
* Computes the size of the arguments and of the return value of a method.
*
* @param desc
* the descriptor of a method.
* @return the size of the arguments of the method (plus one for the
* implicit this argument), argSize, and the size of its return
* value, retSize, packed into a single int i =
* &#60;tt&#62;(argSize &lt;&lt; 2) | retSize&#60;/tt&#62; (argSize is therefore equal to
* &#60;tt&#62;i &gt;&gt; 2&#60;/tt&#62;, and retSize to &#60;tt&#62;i &amp; 0x03&#60;/tt&#62;).
* @param desc the descriptor of a method.
* @return the size of the arguments of the method (plus one for the implicit this argument), argSize, and the size
* of its return value, retSize, packed into a single int i = &#60;tt&#62;(argSize &lt;&lt; 2) |
* retSize&#60;/tt&#62; (argSize is therefore equal to &#60;tt&#62;i &gt;&gt; 2&#60;/tt&#62;, and retSize to
* &#60;tt&#62;i &amp; 0x03&#60;/tt&#62;).
*/
public static int getArgumentsAndReturnSizes(final String desc) {
int n = 1;
@@ -449,10 +362,10 @@ public class Type {
char car = desc.charAt(c++);
if (car == ')') {
car = desc.charAt(c);
return n << 2
| (car == 'V' ? 0 : (car == 'D' || car == 'J' ? 2 : 1));
return n << 2 | (car == 'V' ? 0 : (car == 'D' || car == 'J' ? 2 : 1));
} else if (car == 'L') {
while (desc.charAt(c++) != ';') {
// do nothing
}
n += 1;
} else if (car == '[') {
@@ -471,58 +384,55 @@ public class Type {
}
/**
* Returns the Java type corresponding to the given type descriptor. For
* method descriptors, buf is supposed to contain nothing more than the
* descriptor itself.
* Returns the Java type corresponding to the given type descriptor. For method descriptors, buf is supposed to
* contain nothing more than the descriptor itself.
*
* @param buf
* a buffer containing a type descriptor.
* @param off
* the offset of this descriptor in the previous buffer.
* @param buf a buffer containing a type descriptor.
* @param off the offset of this descriptor in the previous buffer.
* @return the Java type corresponding to the given type descriptor.
*/
private static Type getType(final char[] buf, final int off) {
int len;
switch (buf[off]) {
case 'V':
return VOID_TYPE;
case 'Z':
return BOOLEAN_TYPE;
case 'C':
return CHAR_TYPE;
case 'B':
return BYTE_TYPE;
case 'S':
return SHORT_TYPE;
case 'I':
return INT_TYPE;
case 'F':
return FLOAT_TYPE;
case 'J':
return LONG_TYPE;
case 'D':
return DOUBLE_TYPE;
case '[':
len = 1;
while (buf[off + len] == '[') {
++len;
}
if (buf[off + len] == 'L') {
++len;
case 'V':
return VOID_TYPE;
case 'Z':
return BOOLEAN_TYPE;
case 'C':
return CHAR_TYPE;
case 'B':
return BYTE_TYPE;
case 'S':
return SHORT_TYPE;
case 'I':
return INT_TYPE;
case 'F':
return FLOAT_TYPE;
case 'J':
return LONG_TYPE;
case 'D':
return DOUBLE_TYPE;
case '[':
len = 1;
while (buf[off + len] == '[') {
++len;
}
if (buf[off + len] == 'L') {
++len;
while (buf[off + len] != ';') {
++len;
}
}
return new Type(ARRAY, buf, off, len + 1);
case 'L':
len = 1;
while (buf[off + len] != ';') {
++len;
}
}
return new Type(ARRAY, buf, off, len + 1);
case 'L':
len = 1;
while (buf[off + len] != ';') {
++len;
}
return new Type(OBJECT, buf, off + 1, len - 1);
// case '(':
default:
return new Type(METHOD, buf, off, buf.length - off);
return new Type(OBJECT, buf, off + 1, len - 1);
// case '(':
default:
return new Type(METHOD, buf, off, buf.length - off);
}
}
@@ -533,19 +443,16 @@ public class Type {
/**
* Returns the sort of this Java type.
*
* @return {@link #VOID VOID}, {@link #BOOLEAN BOOLEAN}, {@link #CHAR CHAR},
* {@link #BYTE BYTE}, {@link #SHORT SHORT}, {@link #INT INT},
* {@link #FLOAT FLOAT}, {@link #LONG LONG}, {@link #DOUBLE DOUBLE},
* {@link #ARRAY ARRAY}, {@link #OBJECT OBJECT} or {@link #METHOD
* METHOD}.
* @return {@link #VOID VOID}, {@link #BOOLEAN BOOLEAN}, {@link #CHAR CHAR}, {@link #BYTE BYTE}, {@link #SHORT
* SHORT}, {@link #INT INT}, {@link #FLOAT FLOAT}, {@link #LONG LONG}, {@link #DOUBLE DOUBLE}, {@link #ARRAY
* ARRAY}, {@link #OBJECT OBJECT} or {@link #METHOD METHOD}.
*/
public int getSort() {
return sort;
}
/**
* Returns the number of dimensions of this array type. This method should
* only be used for an array type.
* Returns the number of dimensions of this array type. This method should only be used for an array type.
*
* @return the number of dimensions of this array type.
*/
@@ -558,8 +465,7 @@ public class Type {
}
/**
* Returns the type of the elements of this array type. This method should
* only be used for an array type.
* Returns the type of the elements of this array type. This method should only be used for an array type.
*
* @return Returns the type of the elements of this array type.
*/
@@ -568,49 +474,47 @@ public class Type {
}
/**
* Returns the binary name of the class corresponding to this type. This
* method must not be used on method types.
* Returns the binary name of the class corresponding to this type. This method must not be used on method types.
*
* @return the binary name of the class corresponding to this type.
*/
public String getClassName() {
switch (sort) {
case VOID:
return "void";
case BOOLEAN:
return "boolean";
case CHAR:
return "char";
case BYTE:
return "byte";
case SHORT:
return "short";
case INT:
return "int";
case FLOAT:
return "float";
case LONG:
return "long";
case DOUBLE:
return "double";
case ARRAY:
StringBuilder sb = new StringBuilder(getElementType().getClassName());
for (int i = getDimensions(); i > 0; --i) {
sb.append("[]");
}
return sb.toString();
case OBJECT:
return new String(buf, off, len).replace('/', '.');
default:
return null;
case VOID:
return "void";
case BOOLEAN:
return "boolean";
case CHAR:
return "char";
case BYTE:
return "byte";
case SHORT:
return "short";
case INT:
return "int";
case FLOAT:
return "float";
case LONG:
return "long";
case DOUBLE:
return "double";
case ARRAY:
StringBuilder sb = new StringBuilder(getElementType().getClassName());
for (int i = getDimensions(); i > 0; --i) {
sb.append("[]");
}
return sb.toString();
case OBJECT:
return new String(buf, off, len).replace('/', '.');
default:
return null;
}
}
/**
* Returns the internal name of the class corresponding to this object or
* array type. The internal name of a class is its fully qualified name (as
* returned by Class.getName(), where '.' are replaced by '/'. This method
* should only be used for an object or array type.
* Returns the internal name of the class corresponding to this object or array type. The internal name of a class
* is its fully qualified name (as returned by Class.getName(), where '.' are replaced by '/'. This method should
* only be used for an object or array type.
*
* @return the internal name of the class corresponding to this object type.
*/
@@ -619,8 +523,7 @@ public class Type {
}
/**
* Returns the argument types of methods of this type. This method should
* only be used for method types.
* Returns the argument types of methods of this type. This method should only be used for method types.
*
* @return the argument types of methods of this type.
*/
@@ -629,8 +532,7 @@ public class Type {
}
/**
* Returns the return type of methods of this type. This method should only
* be used for method types.
* Returns the return type of methods of this type. This method should only be used for method types.
*
* @return the return type of methods of this type.
*/
@@ -639,15 +541,13 @@ public class Type {
}
/**
* Returns the size of the arguments and of the return value of methods of
* this type. This method should only be used for method types.
* Returns the size of the arguments and of the return value of methods of this type. This method should only be
* used for method types.
*
* @return the size of the arguments (plus one for the implicit this
* argument), argSize, and the size of the return value, retSize,
* packed into a single
* int i = &#60;tt&#62;(argSize &lt;&lt; 2) | retSize&#60;/tt&#62;
* (argSize is therefore equal to &#60;tt&#62;i &gt;&gt; 2&#60;/tt&#62;,
* and retSize to &#60;tt&#62;i &amp; 0x03&#60;/tt&#62;).
* @return the size of the arguments (plus one for the implicit this argument), argSize, and the size of the return
* value, retSize, packed into a single int i = &#60;tt&#62;(argSize &lt;&lt; 2) | retSize&#60;/tt&#62; (argSize
* is therefore equal to &#60;tt&#62;i &gt;&gt; 2&#60;/tt&#62;, and retSize to &#60;tt&#62;i &amp;
* 0x03&#60;/tt&#62;).
*/
public int getArgumentsAndReturnSizes() {
return getArgumentsAndReturnSizes(getDescriptor());
@@ -669,18 +569,13 @@ public class Type {
}
/**
* Returns the descriptor corresponding to the given argument and return
* types.
* Returns the descriptor corresponding to the given argument and return types.
*
* @param returnType
* the return type of the method.
* @param argumentTypes
* the argument types of the method.
* @return the descriptor corresponding to the given argument and return
* types.
* @param returnType the return type of the method.
* @param argumentTypes the argument types of the method.
* @return the descriptor corresponding to the given argument and return types.
*/
public static String getMethodDescriptor(final Type returnType,
final Type... argumentTypes) {
public static String getMethodDescriptor(final Type returnType, final Type... argumentTypes) {
StringBuilder buf = new StringBuilder();
buf.append('(');
for (int i = 0; i < argumentTypes.length; ++i) {
@@ -692,11 +587,9 @@ public class Type {
}
/**
* Appends the descriptor corresponding to this Java type to the given
* string buffer.
* Appends the descriptor corresponding to this Java type to the given string buffer.
*
* @param buf
* the string buffer to which the descriptor must be appended.
* @param buf the string buffer to which the descriptor must be appended.
*/
private void getDescriptor(final StringBuilder buf) {
if (this.buf == null) {
@@ -718,12 +611,10 @@ public class Type {
// ------------------------------------------------------------------------
/**
* Returns the internal name of the given class. The internal name of a
* class is its fully qualified name, as returned by Class.getName(), where
* '.' are replaced by '/'.
* Returns the internal name of the given class. The internal name of a class is its fully qualified name, as
* returned by Class.getName(), where '.' are replaced by '/'.
*
* @param c
* an object or array class.
* @param c an object or array class.
* @return the internal name of the given class.
*/
public static String getInternalName(final Class<?> c) {
@@ -733,8 +624,7 @@ public class Type {
/**
* Returns the descriptor corresponding to the given Java type.
*
* @param c
* an object class, a primitive class or an array class.
* @param c an object class, a primitive class or an array class.
* @return the descriptor corresponding to the given class.
*/
public static String getDescriptor(final Class<?> c) {
@@ -746,8 +636,7 @@ public class Type {
/**
* Returns the descriptor corresponding to the given constructor.
*
* @param c
* a {@link Constructor Constructor} object.
* @param c a {@link Constructor Constructor} object.
* @return the descriptor of the given constructor.
*/
public static String getConstructorDescriptor(final Constructor<?> c) {
@@ -763,8 +652,7 @@ public class Type {
/**
* Returns the descriptor corresponding to the given method.
*
* @param m
* a {@link Method Method} object.
* @param m a {@link Method Method} object.
* @return the descriptor of the given method.
*/
public static String getMethodDescriptor(final Method m) {
@@ -782,10 +670,8 @@ public class Type {
/**
* Appends the descriptor of the given class to the given string buffer.
*
* @param buf
* the string buffer to which the descriptor must be appended.
* @param c
* the class whose descriptor must be computed.
* @param buf the string buffer to which the descriptor must be appended.
* @param c the class whose descriptor must be computed.
*/
private static void getDescriptor(final StringBuilder buf, final Class<?> c) {
Class<?> d = c;
@@ -808,7 +694,7 @@ public class Type {
car = 'D';
} else if (d == Float.TYPE) {
car = 'F';
} else /* if (d == Long.TYPE) */{
} else /* if (d == Long.TYPE) */ {
car = 'J';
}
buf.append(car);
@@ -835,11 +721,10 @@ public class Type {
// ------------------------------------------------------------------------
/**
* Returns the size of values of this type. This method must not be used for
* method types.
* Returns the size of values of this type. This method must not be used for method types.
*
* @return the size of values of this type, i.e., 2 for &#60;tt&#62;long&#60;/tt&#62; and
* &#60;tt&#62;double&#60;/tt&#62;, 0 for &#60;tt&#62;void&#60;/tt&#62; and 1 otherwise.
* &#60;tt&#62;double&#60;/tt&#62;, 0 for &#60;tt&#62;void&#60;/tt&#62; and 1 otherwise.
*/
public int getSize() {
// the size is in byte 0 of 'off' for primitive types (buf == null)
@@ -847,16 +732,13 @@ public class Type {
}
/**
* Returns a JVM instruction opcode adapted to this Java type. This method
* must not be used for method types.
* Returns a JVM instruction opcode adapted to this Java type. This method must not be used for method types.
*
* @param opcode
* a JVM instruction opcode. This opcode must be one of ILOAD,
* ISTORE, IALOAD, IASTORE, IADD, ISUB, IMUL, IDIV, IREM, INEG,
* ISHL, ISHR, IUSHR, IAND, IOR, IXOR and IRETURN.
* @return an opcode that is similar to the given opcode, but adapted to
* this Java type. For example, if this type is &#60;tt&#62;float&#60;/tt&#62; and
* &#60;tt&#62;opcode&#60;/tt&#62; is IRETURN, this method returns FRETURN.
* @param opcode a JVM instruction opcode. This opcode must be one of ILOAD, ISTORE, IALOAD, IASTORE, IADD, ISUB,
* IMUL, IDIV, IREM, INEG, ISHL, ISHR, IUSHR, IAND, IOR, IXOR and IRETURN.
* @return an opcode that is similar to the given opcode, but adapted to this Java type. For example, if this type
* is &#60;tt&#62;float&#60;/tt&#62; and &#60;tt&#62;opcode&#60;/tt&#62; is IRETURN, this method returns
* FRETURN.
*/
public int getOpcode(final int opcode) {
if (opcode == Opcodes.IALOAD || opcode == Opcodes.IASTORE) {
@@ -877,8 +759,7 @@ public class Type {
/**
* Tests if the given object is equal to this type.
*
* @param o
* the object to be compared to this type.
* @param o the object to be compared to this type.
* @return &#60;tt&#62;true&#60;/tt&#62; if the given object is equal to this type.
*/
@Override

View File

@@ -60,55 +60,35 @@
package org.redkale.asm;
/**
* The path to a type argument, wildcard bound, array element type, or static
* inner type within an enclosing type.
* The path to a type argument, wildcard bound, array element type, or static inner type within an enclosing type.
*
* @author Eric Bruneton
*/
public class TypePath {
/**
* A type path step that steps into the element type of an array type. See
* {@link #getStep getStep}.
*/
public final static int ARRAY_ELEMENT = 0;
/** A type path step that steps into the element type of an array type. See {@link #getStep getStep}. */
public static final int ARRAY_ELEMENT = 0;
/**
* A type path step that steps into the nested type of a class type. See
* {@link #getStep getStep}.
*/
public final static int INNER_TYPE = 1;
/** A type path step that steps into the nested type of a class type. See {@link #getStep getStep}. */
public static final int INNER_TYPE = 1;
/**
* A type path step that steps into the bound of a wildcard type. See
* {@link #getStep getStep}.
*/
public final static int WILDCARD_BOUND = 2;
/** A type path step that steps into the bound of a wildcard type. See {@link #getStep getStep}. */
public static final int WILDCARD_BOUND = 2;
/**
* A type path step that steps into a type argument of a generic type. See
* {@link #getStep getStep}.
*/
public final static int TYPE_ARGUMENT = 3;
/** A type path step that steps into a type argument of a generic type. See {@link #getStep getStep}. */
public static final int TYPE_ARGUMENT = 3;
/**
* The byte array where the path is stored, in Java class file format.
*/
/** The byte array where the path is stored, in Java class file format. */
byte[] b;
/**
* The offset of the first byte of the type path in 'b'.
*/
/** The offset of the first byte of the type path in 'b'. */
int offset;
/**
* Creates a new type path.
*
* @param b
* the byte array containing the type path in Java class file
* format.
* @param offset
* the offset of the first byte of the type path in 'b'.
* @param b the byte array containing the type path in Java class file format.
* @param offset the offset of the first byte of the type path in 'b'.
*/
TypePath(byte[] b, int offset) {
this.b = b;
@@ -127,37 +107,29 @@ public class TypePath {
/**
* Returns the value of the given step of this path.
*
* @param index
* an index between 0 and {@link #getLength()}, exclusive.
* @return {@link #ARRAY_ELEMENT ARRAY_ELEMENT}, {@link #INNER_TYPE
* INNER_TYPE}, {@link #WILDCARD_BOUND WILDCARD_BOUND}, or
* {@link #TYPE_ARGUMENT TYPE_ARGUMENT}.
* @param index an index between 0 and {@link #getLength()}, exclusive.
* @return {@link #ARRAY_ELEMENT ARRAY_ELEMENT}, {@link #INNER_TYPE INNER_TYPE}, {@link #WILDCARD_BOUND
* WILDCARD_BOUND}, or {@link #TYPE_ARGUMENT TYPE_ARGUMENT}.
*/
public int getStep(int index) {
return b[offset + 2 * index + 1];
}
/**
* Returns the index of the type argument that the given step is stepping
* into. This method should only be used for steps whose value is
* {@link #TYPE_ARGUMENT TYPE_ARGUMENT}.
* Returns the index of the type argument that the given step is stepping into. This method should only be used for
* steps whose value is {@link #TYPE_ARGUMENT TYPE_ARGUMENT}.
*
* @param index
* an index between 0 and {@link #getLength()}, exclusive.
* @return the index of the type argument that the given step is stepping
* into.
* @param index an index between 0 and {@link #getLength()}, exclusive.
* @return the index of the type argument that the given step is stepping into.
*/
public int getStepArgument(int index) {
return b[offset + 2 * index + 2];
}
/**
* Converts a type path in string form, in the format used by
* {@link #toString()}, into a TypePath object.
* Converts a type path in string form, in the format used by {@link #toString()}, into a TypePath object.
*
* @param typePath
* a type path in string form, in the format used by
* {@link #toString()}. May be null or empty.
* @param typePath a type path in string form, in the format used by {@link #toString()}. May be null or empty.
* @return the corresponding TypePath object, or null if the path is empty.
*/
public static TypePath fromString(final String typePath) {
@@ -167,7 +139,7 @@ public class TypePath {
int n = typePath.length();
ByteVector out = new ByteVector(n);
out.putByte(0);
for (int i = 0; i < n;) {
for (int i = 0; i < n; ) {
char c = typePath.charAt(i++);
if (c == '[') {
out.put11(ARRAY_ELEMENT, 0);
@@ -192,11 +164,9 @@ public class TypePath {
}
/**
* Returns a string representation of this type path. {@link #ARRAY_ELEMENT
* ARRAY_ELEMENT} steps are represented with '[', {@link #INNER_TYPE
* INNER_TYPE} steps with '.', {@link #WILDCARD_BOUND WILDCARD_BOUND} steps
* with '*' and {@link #TYPE_ARGUMENT TYPE_ARGUMENT} steps with their type
* argument index in decimal form followed by ';'.
* Returns a string representation of this type path. {@link #ARRAY_ELEMENT ARRAY_ELEMENT} steps are represented
* with '[', {@link #INNER_TYPE INNER_TYPE} steps with '.', {@link #WILDCARD_BOUND WILDCARD_BOUND} steps with '*'
* and {@link #TYPE_ARGUMENT TYPE_ARGUMENT} steps with their type argument index in decimal form followed by ';'.
*/
@Override
public String toString() {
@@ -204,20 +174,20 @@ public class TypePath {
StringBuilder result = new StringBuilder(length * 2);
for (int i = 0; i < length; ++i) {
switch (getStep(i)) {
case ARRAY_ELEMENT:
result.append('[');
break;
case INNER_TYPE:
result.append('.');
break;
case WILDCARD_BOUND:
result.append('*');
break;
case TYPE_ARGUMENT:
result.append(getStepArgument(i)).append(';');
break;
default:
result.append('_');
case ARRAY_ELEMENT:
result.append('[');
break;
case INNER_TYPE:
result.append('.');
break;
case WILDCARD_BOUND:
result.append('*');
break;
case TYPE_ARGUMENT:
result.append(getStepArgument(i)).append(';');
break;
default:
result.append('_');
}
}
return result.toString();

View File

@@ -60,160 +60,136 @@
package org.redkale.asm;
/**
* A reference to a type appearing in a class, field or method declaration, or
* on an instruction. Such a reference designates the part of the class where
* the referenced type is appearing (e.g. an 'extends', 'implements' or 'throws'
* clause, a 'new' instruction, a 'catch' clause, a type cast, a local variable
* declaration, etc).
* A reference to a type appearing in a class, field or method declaration, or on an instruction. Such a reference
* designates the part of the class where the referenced type is appearing (e.g. an 'extends', 'implements' or 'throws'
* clause, a 'new' instruction, a 'catch' clause, a type cast, a local variable declaration, etc).
*
* @author Eric Bruneton
*/
public class TypeReference {
/**
* The sort of type references that target a type parameter of a generic
* class. See {@link #getSort getSort}.
*/
public final static int CLASS_TYPE_PARAMETER = 0x00;
/** The sort of type references that target a type parameter of a generic class. See {@link #getSort getSort}. */
public static final int CLASS_TYPE_PARAMETER = 0x00;
/** The sort of type references that target a type parameter of a generic method. See {@link #getSort getSort}. */
public static final int METHOD_TYPE_PARAMETER = 0x01;
/**
* The sort of type references that target a type parameter of a generic
* method. See {@link #getSort getSort}.
*/
public final static int METHOD_TYPE_PARAMETER = 0x01;
/**
* The sort of type references that target the super class of a class or one
* of the interfaces it implements. See {@link #getSort getSort}.
*/
public final static int CLASS_EXTENDS = 0x10;
/**
* The sort of type references that target a bound of a type parameter of a
* generic class. See {@link #getSort getSort}.
*/
public final static int CLASS_TYPE_PARAMETER_BOUND = 0x11;
/**
* The sort of type references that target a bound of a type parameter of a
* generic method. See {@link #getSort getSort}.
*/
public final static int METHOD_TYPE_PARAMETER_BOUND = 0x12;
/**
* The sort of type references that target the type of a field. See
* The sort of type references that target the super class of a class or one of the interfaces it implements. See
* {@link #getSort getSort}.
*/
public final static int FIELD = 0x13;
public static final int CLASS_EXTENDS = 0x10;
/**
* The sort of type references that target the return type of a method. See
* The sort of type references that target a bound of a type parameter of a generic class. See {@link #getSort
* getSort}.
*/
public static final int CLASS_TYPE_PARAMETER_BOUND = 0x11;
/**
* The sort of type references that target a bound of a type parameter of a generic method. See {@link #getSort
* getSort}.
*/
public static final int METHOD_TYPE_PARAMETER_BOUND = 0x12;
/** The sort of type references that target the type of a field. See {@link #getSort getSort}. */
public static final int FIELD = 0x13;
/** The sort of type references that target the return type of a method. See {@link #getSort getSort}. */
public static final int METHOD_RETURN = 0x14;
/** The sort of type references that target the receiver type of a method. See {@link #getSort getSort}. */
public static final int METHOD_RECEIVER = 0x15;
/**
* The sort of type references that target the type of a formal parameter of a method. See {@link #getSort getSort}.
*/
public static final int METHOD_FORMAL_PARAMETER = 0x16;
/**
* The sort of type references that target the type of an exception declared in the throws clause of a method. See
* {@link #getSort getSort}.
*/
public final static int METHOD_RETURN = 0x14;
public static final int THROWS = 0x17;
/**
* The sort of type references that target the receiver type of a method.
* See {@link #getSort getSort}.
* The sort of type references that target the type of a local variable in a method. See {@link #getSort getSort}.
*/
public final static int METHOD_RECEIVER = 0x15;
public static final int LOCAL_VARIABLE = 0x40;
/**
* The sort of type references that target the type of a formal parameter of
* a method. See {@link #getSort getSort}.
* The sort of type references that target the type of a resource variable in a method. See {@link #getSort
* getSort}.
*/
public final static int METHOD_FORMAL_PARAMETER = 0x16;
public static final int RESOURCE_VARIABLE = 0x41;
/**
* The sort of type references that target the type of an exception declared
* in the throws clause of a method. See {@link #getSort getSort}.
* The sort of type references that target the type of the exception of a 'catch' clause in a method. See
* {@link #getSort getSort}.
*/
public final static int THROWS = 0x17;
public static final int EXCEPTION_PARAMETER = 0x42;
/**
* The sort of type references that target the type of a local variable in a
* method. See {@link #getSort getSort}.
* The sort of type references that target the type declared in an 'instanceof' instruction. See {@link #getSort
* getSort}.
*/
public final static int LOCAL_VARIABLE = 0x40;
public static final int INSTANCEOF = 0x43;
/**
* The sort of type references that target the type of a resource variable
* in a method. See {@link #getSort getSort}.
* The sort of type references that target the type of the object created by a 'new' instruction. See
* {@link #getSort getSort}.
*/
public final static int RESOURCE_VARIABLE = 0x41;
public static final int NEW = 0x44;
/**
* The sort of type references that target the type of the exception of a
* 'catch' clause in a method. See {@link #getSort getSort}.
* The sort of type references that target the receiver type of a constructor reference. See {@link #getSort
* getSort}.
*/
public final static int EXCEPTION_PARAMETER = 0x42;
public static final int CONSTRUCTOR_REFERENCE = 0x45;
/**
* The sort of type references that target the type declared in an
* 'instanceof' instruction. See {@link #getSort getSort}.
* The sort of type references that target the receiver type of a method reference. See {@link #getSort getSort}.
*/
public final static int INSTANCEOF = 0x43;
public static final int METHOD_REFERENCE = 0x46;
/**
* The sort of type references that target the type of the object created by
* a 'new' instruction. See {@link #getSort getSort}.
* The sort of type references that target the type declared in an explicit or implicit cast instruction. See
* {@link #getSort getSort}.
*/
public final static int NEW = 0x44;
public static final int CAST = 0x47;
/**
* The sort of type references that target the receiver type of a
* constructor reference. See {@link #getSort getSort}.
* The sort of type references that target a type parameter of a generic constructor in a constructor call. See
* {@link #getSort getSort}.
*/
public final static int CONSTRUCTOR_REFERENCE = 0x45;
public static final int CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT = 0x48;
/**
* The sort of type references that target the receiver type of a method
* reference. See {@link #getSort getSort}.
* The sort of type references that target a type parameter of a generic method in a method call. See
* {@link #getSort getSort}.
*/
public final static int METHOD_REFERENCE = 0x46;
public static final int METHOD_INVOCATION_TYPE_ARGUMENT = 0x49;
/**
* The sort of type references that target the type declared in an explicit
* or implicit cast instruction. See {@link #getSort getSort}.
* The sort of type references that target a type parameter of a generic constructor in a constructor reference. See
* {@link #getSort getSort}.
*/
public final static int CAST = 0x47;
public static final int CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT = 0x4A;
/**
* The sort of type references that target a type parameter of a generic
* constructor in a constructor call. See {@link #getSort getSort}.
* The sort of type references that target a type parameter of a generic method in a method reference. See
* {@link #getSort getSort}.
*/
public final static int CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT = 0x48;
public static final int METHOD_REFERENCE_TYPE_ARGUMENT = 0x4B;
/**
* The sort of type references that target a type parameter of a generic
* method in a method call. See {@link #getSort getSort}.
*/
public final static int METHOD_INVOCATION_TYPE_ARGUMENT = 0x49;
/**
* The sort of type references that target a type parameter of a generic
* constructor in a constructor reference. See {@link #getSort getSort}.
*/
public final static int CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT = 0x4A;
/**
* The sort of type references that target a type parameter of a generic
* method in a method reference. See {@link #getSort getSort}.
*/
public final static int METHOD_REFERENCE_TYPE_ARGUMENT = 0x4B;
/**
* The type reference value in Java class file format.
*/
/** The type reference value in Java class file format. */
private int value;
/**
* Creates a new TypeReference.
*
* @param typeRef
* the int encoded value of the type reference, as received in a
* visit method related to type annotations, like
* visitTypeAnnotation.
* @param typeRef the int encoded value of the type reference, as received in a visit method related to type
* annotations, like visitTypeAnnotation.
*/
public TypeReference(int typeRef) {
this.value = typeRef;
@@ -222,14 +198,10 @@ public class TypeReference {
/**
* Returns a type reference of the given sort.
*
* @param sort
* {@link #FIELD FIELD}, {@link #METHOD_RETURN METHOD_RETURN},
* {@link #METHOD_RECEIVER METHOD_RECEIVER},
* {@link #LOCAL_VARIABLE LOCAL_VARIABLE},
* {@link #RESOURCE_VARIABLE RESOURCE_VARIABLE},
* {@link #INSTANCEOF INSTANCEOF}, {@link #NEW NEW},
* {@link #CONSTRUCTOR_REFERENCE CONSTRUCTOR_REFERENCE}, or
* {@link #METHOD_REFERENCE METHOD_REFERENCE}.
* @param sort {@link #FIELD FIELD}, {@link #METHOD_RETURN METHOD_RETURN}, {@link #METHOD_RECEIVER METHOD_RECEIVER},
* {@link #LOCAL_VARIABLE LOCAL_VARIABLE}, {@link #RESOURCE_VARIABLE RESOURCE_VARIABLE}, {@link #INSTANCEOF
* INSTANCEOF}, {@link #NEW NEW}, {@link #CONSTRUCTOR_REFERENCE CONSTRUCTOR_REFERENCE}, or
* {@link #METHOD_REFERENCE METHOD_REFERENCE}.
* @return a type reference of the given sort.
*/
public static TypeReference newTypeReference(int sort) {
@@ -239,45 +211,33 @@ public class TypeReference {
/**
* Returns a reference to a type parameter of a generic class or method.
*
* @param sort
* {@link #CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER} or
* {@link #METHOD_TYPE_PARAMETER METHOD_TYPE_PARAMETER}.
* @param paramIndex
* the type parameter index.
* @param sort {@link #CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER} or {@link #METHOD_TYPE_PARAMETER
* METHOD_TYPE_PARAMETER}.
* @param paramIndex the type parameter index.
* @return a reference to the given generic class or method type parameter.
*/
public static TypeReference newTypeParameterReference(int sort,
int paramIndex) {
public static TypeReference newTypeParameterReference(int sort, int paramIndex) {
return new TypeReference((sort << 24) | (paramIndex << 16));
}
/**
* Returns a reference to a type parameter bound of a generic class or
* method.
* Returns a reference to a type parameter bound of a generic class or method.
*
* @param sort
* {@link #CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER} or
* {@link #METHOD_TYPE_PARAMETER METHOD_TYPE_PARAMETER}.
* @param paramIndex
* the type parameter index.
* @param boundIndex
* the type bound index within the above type parameters.
* @return a reference to the given generic class or method type parameter
* bound.
* @param sort {@link #CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER} or {@link #METHOD_TYPE_PARAMETER
* METHOD_TYPE_PARAMETER}.
* @param paramIndex the type parameter index.
* @param boundIndex the type bound index within the above type parameters.
* @return a reference to the given generic class or method type parameter bound.
*/
public static TypeReference newTypeParameterBoundReference(int sort,
int paramIndex, int boundIndex) {
return new TypeReference((sort << 24) | (paramIndex << 16)
| (boundIndex << 8));
public static TypeReference newTypeParameterBoundReference(int sort, int paramIndex, int boundIndex) {
return new TypeReference((sort << 24) | (paramIndex << 16) | (boundIndex << 8));
}
/**
* Returns a reference to the super class or to an interface of the
* 'implements' clause of a class.
* Returns a reference to the super class or to an interface of the 'implements' clause of a class.
*
* @param itfIndex
* the index of an interface in the 'implements' clause of a
* class, or -1 to reference the super class of the class.
* @param itfIndex the index of an interface in the 'implements' clause of a class, or -1 to reference the super
* class of the class.
* @return a reference to the given super type of a class.
*/
public static TypeReference newSuperTypeReference(int itfIndex) {
@@ -288,23 +248,17 @@ public class TypeReference {
/**
* Returns a reference to the type of a formal parameter of a method.
*
* @param paramIndex
* the formal parameter index.
*
* @param paramIndex the formal parameter index.
* @return a reference to the type of the given method formal parameter.
*/
public static TypeReference newFormalParameterReference(int paramIndex) {
return new TypeReference((METHOD_FORMAL_PARAMETER << 24)
| (paramIndex << 16));
return new TypeReference((METHOD_FORMAL_PARAMETER << 24) | (paramIndex << 16));
}
/**
* Returns a reference to the type of an exception, in a 'throws' clause of
* a method.
*
* @param exceptionIndex
* the index of an exception in a 'throws' clause of a method.
* Returns a reference to the type of an exception, in a 'throws' clause of a method.
*
* @param exceptionIndex the index of an exception in a 'throws' clause of a method.
* @return a reference to the type of the given exception.
*/
public static TypeReference newExceptionReference(int exceptionIndex) {
@@ -312,37 +266,25 @@ public class TypeReference {
}
/**
* Returns a reference to the type of the exception declared in a 'catch'
* clause of a method.
*
* @param tryCatchBlockIndex
* the index of a try catch block (using the order in which they
* are visited with visitTryCatchBlock).
* Returns a reference to the type of the exception declared in a 'catch' clause of a method.
*
* @param tryCatchBlockIndex the index of a try catch block (using the order in which they are visited with
* visitTryCatchBlock).
* @return a reference to the type of the given exception.
*/
public static TypeReference newTryCatchReference(int tryCatchBlockIndex) {
return new TypeReference((EXCEPTION_PARAMETER << 24)
| (tryCatchBlockIndex << 8));
return new TypeReference((EXCEPTION_PARAMETER << 24) | (tryCatchBlockIndex << 8));
}
/**
* Returns a reference to the type of a type argument in a constructor or
* method call or reference.
*
* @param sort
* {@link #CAST CAST},
* {@link #CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
* CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT},
* {@link #METHOD_INVOCATION_TYPE_ARGUMENT
* METHOD_INVOCATION_TYPE_ARGUMENT},
* {@link #CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
* CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or
* {@link #METHOD_REFERENCE_TYPE_ARGUMENT
* METHOD_REFERENCE_TYPE_ARGUMENT}.
* @param argIndex
* the type argument index.
* Returns a reference to the type of a type argument in a constructor or method call or reference.
*
* @param sort {@link #CAST CAST}, {@link #CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
* CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT}, {@link #METHOD_INVOCATION_TYPE_ARGUMENT
* METHOD_INVOCATION_TYPE_ARGUMENT}, {@link #CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
* CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or {@link #METHOD_REFERENCE_TYPE_ARGUMENT
* METHOD_REFERENCE_TYPE_ARGUMENT}.
* @param argIndex the type argument index.
* @return a reference to the type of the given type argument.
*/
public static TypeReference newTypeArgumentReference(int sort, int argIndex) {
@@ -352,39 +294,27 @@ public class TypeReference {
/**
* Returns the sort of this type reference.
*
* @return {@link #CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER},
* {@link #METHOD_TYPE_PARAMETER METHOD_TYPE_PARAMETER},
* {@link #CLASS_EXTENDS CLASS_EXTENDS},
* {@link #CLASS_TYPE_PARAMETER_BOUND CLASS_TYPE_PARAMETER_BOUND},
* {@link #METHOD_TYPE_PARAMETER_BOUND METHOD_TYPE_PARAMETER_BOUND},
* {@link #FIELD FIELD}, {@link #METHOD_RETURN METHOD_RETURN},
* {@link #METHOD_RECEIVER METHOD_RECEIVER},
* {@link #METHOD_FORMAL_PARAMETER METHOD_FORMAL_PARAMETER},
* {@link #THROWS THROWS}, {@link #LOCAL_VARIABLE LOCAL_VARIABLE},
* {@link #RESOURCE_VARIABLE RESOURCE_VARIABLE},
* {@link #EXCEPTION_PARAMETER EXCEPTION_PARAMETER},
* {@link #INSTANCEOF INSTANCEOF}, {@link #NEW NEW},
* {@link #CONSTRUCTOR_REFERENCE CONSTRUCTOR_REFERENCE},
* {@link #METHOD_REFERENCE METHOD_REFERENCE}, {@link #CAST CAST},
* {@link #CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
* CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT},
* {@link #METHOD_INVOCATION_TYPE_ARGUMENT
* METHOD_INVOCATION_TYPE_ARGUMENT},
* {@link #CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
* CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or
* {@link #METHOD_REFERENCE_TYPE_ARGUMENT
* METHOD_REFERENCE_TYPE_ARGUMENT}.
* @return {@link #CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER}, {@link #METHOD_TYPE_PARAMETER METHOD_TYPE_PARAMETER},
* {@link #CLASS_EXTENDS CLASS_EXTENDS}, {@link #CLASS_TYPE_PARAMETER_BOUND CLASS_TYPE_PARAMETER_BOUND},
* {@link #METHOD_TYPE_PARAMETER_BOUND METHOD_TYPE_PARAMETER_BOUND}, {@link #FIELD FIELD}, {@link #METHOD_RETURN
* METHOD_RETURN}, {@link #METHOD_RECEIVER METHOD_RECEIVER}, {@link #METHOD_FORMAL_PARAMETER
* METHOD_FORMAL_PARAMETER}, {@link #THROWS THROWS}, {@link #LOCAL_VARIABLE LOCAL_VARIABLE},
* {@link #RESOURCE_VARIABLE RESOURCE_VARIABLE}, {@link #EXCEPTION_PARAMETER EXCEPTION_PARAMETER},
* {@link #INSTANCEOF INSTANCEOF}, {@link #NEW NEW}, {@link #CONSTRUCTOR_REFERENCE CONSTRUCTOR_REFERENCE},
* {@link #METHOD_REFERENCE METHOD_REFERENCE}, {@link #CAST CAST}, {@link #CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
* CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT}, {@link #METHOD_INVOCATION_TYPE_ARGUMENT
* METHOD_INVOCATION_TYPE_ARGUMENT}, {@link #CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
* CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or {@link #METHOD_REFERENCE_TYPE_ARGUMENT
* METHOD_REFERENCE_TYPE_ARGUMENT}.
*/
public int getSort() {
return value >>> 24;
}
/**
* Returns the index of the type parameter referenced by this type
* reference. This method must only be used for type references whose sort
* is {@link #CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER},
* {@link #METHOD_TYPE_PARAMETER METHOD_TYPE_PARAMETER},
* {@link #CLASS_TYPE_PARAMETER_BOUND CLASS_TYPE_PARAMETER_BOUND} or
* Returns the index of the type parameter referenced by this type reference. This method must only be used for type
* references whose sort is {@link #CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER}, {@link #METHOD_TYPE_PARAMETER
* METHOD_TYPE_PARAMETER}, {@link #CLASS_TYPE_PARAMETER_BOUND CLASS_TYPE_PARAMETER_BOUND} or
* {@link #METHOD_TYPE_PARAMETER_BOUND METHOD_TYPE_PARAMETER_BOUND}.
*
* @return a type parameter index.
@@ -394,11 +324,10 @@ public class TypeReference {
}
/**
* Returns the index of the type parameter bound, within the type parameter
* {@link #getTypeParameterIndex}, referenced by this type reference. This
* method must only be used for type references whose sort is
* {@link #CLASS_TYPE_PARAMETER_BOUND CLASS_TYPE_PARAMETER_BOUND} or
* {@link #METHOD_TYPE_PARAMETER_BOUND METHOD_TYPE_PARAMETER_BOUND}.
* Returns the index of the type parameter bound, within the type parameter {@link #getTypeParameterIndex},
* referenced by this type reference. This method must only be used for type references whose sort is
* {@link #CLASS_TYPE_PARAMETER_BOUND CLASS_TYPE_PARAMETER_BOUND} or {@link #METHOD_TYPE_PARAMETER_BOUND
* METHOD_TYPE_PARAMETER_BOUND}.
*
* @return a type parameter bound index.
*/
@@ -407,22 +336,19 @@ public class TypeReference {
}
/**
* Returns the index of the "super type" of a class that is referenced by
* this type reference. This method must only be used for type references
* whose sort is {@link #CLASS_EXTENDS CLASS_EXTENDS}.
* Returns the index of the "super type" of a class that is referenced by this type reference. This method must only
* be used for type references whose sort is {@link #CLASS_EXTENDS CLASS_EXTENDS}.
*
* @return the index of an interface in the 'implements' clause of a class,
* or -1 if this type reference references the type of the super
* class.
* @return the index of an interface in the 'implements' clause of a class, or -1 if this type reference references
* the type of the super class.
*/
public int getSuperTypeIndex() {
return (short) ((value & 0x00FFFF00) >> 8);
}
/**
* Returns the index of the formal parameter whose type is referenced by
* this type reference. This method must only be used for type references
* whose sort is {@link #METHOD_FORMAL_PARAMETER METHOD_FORMAL_PARAMETER}.
* Returns the index of the formal parameter whose type is referenced by this type reference. This method must only
* be used for type references whose sort is {@link #METHOD_FORMAL_PARAMETER METHOD_FORMAL_PARAMETER}.
*
* @return a formal parameter index.
*/
@@ -431,9 +357,8 @@ public class TypeReference {
}
/**
* Returns the index of the exception, in a 'throws' clause of a method,
* whose type is referenced by this type reference. This method must only be
* used for type references whose sort is {@link #THROWS THROWS}.
* Returns the index of the exception, in a 'throws' clause of a method, whose type is referenced by this type
* reference. This method must only be used for type references whose sort is {@link #THROWS THROWS}.
*
* @return the index of an exception in the 'throws' clause of a method.
*/
@@ -442,10 +367,9 @@ public class TypeReference {
}
/**
* Returns the index of the try catch block (using the order in which they
* are visited with visitTryCatchBlock), whose 'catch' type is referenced by
* this type reference. This method must only be used for type references
* whose sort is {@link #EXCEPTION_PARAMETER EXCEPTION_PARAMETER} .
* Returns the index of the try catch block (using the order in which they are visited with visitTryCatchBlock),
* whose 'catch' type is referenced by this type reference. This method must only be used for type references whose
* sort is {@link #EXCEPTION_PARAMETER EXCEPTION_PARAMETER} .
*
* @return the index of an exception in the 'throws' clause of a method.
*/
@@ -454,13 +378,10 @@ public class TypeReference {
}
/**
* Returns the index of the type argument referenced by this type reference.
* This method must only be used for type references whose sort is
* {@link #CAST CAST}, {@link #CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
* CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT},
* {@link #METHOD_INVOCATION_TYPE_ARGUMENT METHOD_INVOCATION_TYPE_ARGUMENT},
* {@link #CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
* CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or
* Returns the index of the type argument referenced by this type reference. This method must only be used for type
* references whose sort is {@link #CAST CAST}, {@link #CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
* CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT}, {@link #METHOD_INVOCATION_TYPE_ARGUMENT METHOD_INVOCATION_TYPE_ARGUMENT},
* {@link #CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or
* {@link #METHOD_REFERENCE_TYPE_ARGUMENT METHOD_REFERENCE_TYPE_ARGUMENT}.
*
* @return a type parameter index.
@@ -470,8 +391,8 @@ public class TypeReference {
}
/**
* Returns the int encoded value of this type reference, suitable for use in
* visit methods related to type annotations, like visitTypeAnnotation.
* Returns the int encoded value of this type reference, suitable for use in visit methods related to type
* annotations, like visitTypeAnnotation.
*
* @return the int encoded value of this type reference.
*/

Some files were not shown because too many files have changed in this diff Show More