Skip to content

Commit 17208da

Browse files
committed
feat: parmas
1 parent ac5f540 commit 17208da

File tree

17 files changed

+333
-121
lines changed

17 files changed

+333
-121
lines changed

build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ allprojects {
3737
mavenCentral()
3838
maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
3939
}
40+
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
41+
kotlinOptions {
42+
freeCompilerArgs = ['-Xjvm-default=all']
43+
jvmTarget = "11"
44+
}
45+
}
4046
}
4147

4248
task clean(type: Delete) {

rudolph-annotations/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ PROJ_GROUP=cn.wzbos.android
99
# 组件ID
1010
PROJ_ARTIFACTID=rudolph-annotations
1111
# 组件版本名称
12-
PROJ_VERSION=2.1.1
12+
PROJ_VERSION=2.1.2-SNAPSHOT
1313
# 组件版本号
1414
PROJ_VERSION_CODE=1
1515
# 工程名称
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package cn.wzbos.android.rudolph
2+
3+
import java.lang.reflect.Type
4+
5+
open class ExtraInfo @JvmOverloads constructor(
6+
var type: Type,
7+
val base64: Boolean = false,
8+
val json: Boolean = false
9+
)
10+
11+
class UnknownExtraType(
12+
val className: String,
13+
) : ExtraInfo(type = Any::class.java, json = true, base64 = true)
Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
package cn.wzbos.android.rudolph
22

3-
import java.lang.reflect.Type
4-
5-
open class ExtraType @JvmOverloads constructor(
6-
var type: Type,
7-
val base64: Boolean = false,
8-
val json: Boolean = false
9-
)
10-
11-
class UnknownExtraType(
12-
val className: String,
13-
) : ExtraType(type = Any::class.java, json = true, base64 = true)
3+
enum class ExtraType {
4+
Default,
5+
Serializable,
6+
Parcelable,
7+
Base64,
8+
Base64Json,
9+
Json,
10+
CharSequenceArray,
11+
CharSequenceArrayList,
12+
StringArray,
13+
StringArrayList,
14+
IntegerArray,
15+
IntegerArrayList,
16+
ParcelableArray,
17+
ParcelableArrayList,
18+
}

rudolph-annotations/src/main/java/cn/wzbos/android/rudolph/RouteInfo.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class RouteInfo(builder: Builder) {
1313
@Deprecated("请使用targetClass", replaceWith = ReplaceWith("targetClass"))
1414
val target: String?
1515
val targetClass: Class<*>?
16-
val extras: MutableMap<String, ExtraType>?
16+
val extras: MutableMap<String, ExtraInfo>?
1717
var type: RouteType?
1818
private set
1919

@@ -32,7 +32,7 @@ class RouteInfo(builder: Builder) {
3232
var url: MutableList<String>? = null
3333
var target: String? = null
3434
var targetClass: Class<*>? = null
35-
var extras: MutableMap<String, ExtraType>? = null
35+
var extras: MutableMap<String, ExtraInfo>? = null
3636
var routeType: RouteType? = null
3737
var tag: String? = null
3838
var interceptors: MutableList<Class<out RouteInterceptor>>? = null
@@ -74,7 +74,7 @@ class RouteInfo(builder: Builder) {
7474
Void::class.java.name -> Void::class.java
7575
else -> Class.forName(className)
7676
}
77-
extra(key, ExtraType(type))
77+
extra(key, ExtraInfo(type))
7878
} catch (e: Exception) {
7979
println("类型转换失败! (target=${target}, key:${key}, className:${className})")
8080
e.printStackTrace()
@@ -90,10 +90,10 @@ class RouteInfo(builder: Builder) {
9090
base64: Boolean = false,
9191
json: Boolean = false
9292
): Builder {
93-
return extra(key, ExtraType(type, base64 = base64, json = json))
93+
return extra(key, ExtraInfo(type, base64 = base64, json = json))
9494
}
9595

96-
fun extra(key: String, extraType: ExtraType): Builder {
96+
fun extra(key: String, extraType: ExtraInfo): Builder {
9797
if (extras == null) {
9898
extras = LinkedHashMap()
9999
}
Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
11
package cn.wzbos.android.rudolph.annotations
22

3+
import cn.wzbos.android.rudolph.ExtraType
4+
35
/**
46
* Created by wuzongbo on 2017/5/30.
57
*/
68
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FIELD)
79
@Retention(AnnotationRetention.RUNTIME)
810
annotation class Extra(
11+
/**
12+
* 参数名称
13+
*/
914
val value: String = "",
15+
/**
16+
* 是否导出,false不生成参数传递方法
17+
*/
1018
val export: Boolean = true,
19+
@Deprecated(
20+
"请使用objectType=ExtraObjectType.json",
21+
replaceWith = ReplaceWith("paramType=ExtraObjectType.json")
22+
)
1123
val json: Boolean = false,
12-
val base64: Boolean = false
24+
@Deprecated(
25+
"请使用objectType=ExtraObjectType.base64",
26+
replaceWith = ReplaceWith("paramType=ExtraObjectType.base64")
27+
)
28+
val base64: Boolean = false,
29+
/**
30+
* 序列化类型
31+
*/
32+
val paramsType: ExtraType = ExtraType.Default
1333
)

rudolph-compiler/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ PROJ_GROUP=cn.wzbos.android
99
# 组件ID
1010
PROJ_ARTIFACTID=rudolph-compiler
1111
# 组件版本名称
12-
PROJ_VERSION=2.1.1
12+
PROJ_VERSION=2.1.2-SNAPSHOT
1313
# 组件版本号
1414
PROJ_VERSION_CODE=1
1515
# 工程名称

0 commit comments

Comments
 (0)