Skip to content

Commit

Permalink
feat: 增加几个注解
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaojinzi123 committed Nov 2, 2023
1 parent 4de2c18 commit 942cc7f
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ annotation class Model
*/
typealias ModelForNetwork = Model

/**
* 表示和 Json 之间序列化的模型
*/
typealias ModelForJson = Model

/**
* 用于逻辑处理
*/
Expand Down
133 changes: 126 additions & 7 deletions lib-annotation/src/main/java/com/xiaojinzi/support/annotation/Times.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
package com.xiaojinzi.support.annotation

/**
* 表示毫秒
* 表示毫秒的值
*/
@Retention(value = AnnotationRetention.SOURCE)
@Target(
AnnotationTarget.PROPERTY,
AnnotationTarget.FIELD,
AnnotationTarget.PROPERTY_GETTER,
AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.TYPE_PARAMETER,
AnnotationTarget.VALUE_PARAMETER,
AnnotationTarget.LOCAL_VARIABLE,
AnnotationTarget.TYPE,
AnnotationTarget.FUNCTION,
)
annotation class MillisecondValue

/**
* 表示毫秒的时间
*/
@Retention(value = AnnotationRetention.SOURCE)
@Target(
Expand All @@ -18,7 +35,24 @@ package com.xiaojinzi.support.annotation
annotation class MillisecondTime

/**
* 表示秒
* 表示秒的值
*/
@Retention(value = AnnotationRetention.SOURCE)
@Target(
AnnotationTarget.PROPERTY,
AnnotationTarget.FIELD,
AnnotationTarget.PROPERTY_GETTER,
AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.TYPE_PARAMETER,
AnnotationTarget.VALUE_PARAMETER,
AnnotationTarget.LOCAL_VARIABLE,
AnnotationTarget.TYPE,
AnnotationTarget.FUNCTION,
)
annotation class SecondValue

/**
* 表示秒的时间
*/
@Retention(value = AnnotationRetention.SOURCE)
@Target(
Expand All @@ -35,7 +69,24 @@ annotation class MillisecondTime
annotation class SecondTime

/**
* 表示分钟
* 表示分钟的值
*/
@Retention(value = AnnotationRetention.SOURCE)
@Target(
AnnotationTarget.PROPERTY,
AnnotationTarget.FIELD,
AnnotationTarget.PROPERTY_GETTER,
AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.TYPE_PARAMETER,
AnnotationTarget.VALUE_PARAMETER,
AnnotationTarget.LOCAL_VARIABLE,
AnnotationTarget.TYPE,
AnnotationTarget.FUNCTION,
)
annotation class MinuteValue

/**
* 表示分钟的时间
*/
@Retention(value = AnnotationRetention.SOURCE)
@Target(
Expand All @@ -52,7 +103,24 @@ annotation class SecondTime
annotation class MinuteTime

/**
* 表示小时
* 表示小时的值
*/
@Retention(value = AnnotationRetention.SOURCE)
@Target(
AnnotationTarget.PROPERTY,
AnnotationTarget.FIELD,
AnnotationTarget.PROPERTY_GETTER,
AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.TYPE_PARAMETER,
AnnotationTarget.VALUE_PARAMETER,
AnnotationTarget.LOCAL_VARIABLE,
AnnotationTarget.TYPE,
AnnotationTarget.FUNCTION,
)
annotation class HourValue

/**
* 表示小时的时间
*/
@Retention(value = AnnotationRetention.SOURCE)
@Target(
Expand All @@ -69,7 +137,24 @@ annotation class MinuteTime
annotation class HourTime

/**
* 表示天
* 表示天的值
*/
@Retention(value = AnnotationRetention.SOURCE)
@Target(
AnnotationTarget.PROPERTY,
AnnotationTarget.FIELD,
AnnotationTarget.PROPERTY_GETTER,
AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.TYPE_PARAMETER,
AnnotationTarget.VALUE_PARAMETER,
AnnotationTarget.LOCAL_VARIABLE,
AnnotationTarget.TYPE,
AnnotationTarget.FUNCTION,
)
annotation class DayValue

/**
* 表示天的时间
*/
@Retention(value = AnnotationRetention.SOURCE)
@Target(
Expand All @@ -86,7 +171,24 @@ annotation class HourTime
annotation class DayTime

/**
* 表示月
* 表示月的值
*/
@Retention(value = AnnotationRetention.SOURCE)
@Target(
AnnotationTarget.PROPERTY,
AnnotationTarget.FIELD,
AnnotationTarget.PROPERTY_GETTER,
AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.TYPE_PARAMETER,
AnnotationTarget.VALUE_PARAMETER,
AnnotationTarget.LOCAL_VARIABLE,
AnnotationTarget.TYPE,
AnnotationTarget.FUNCTION,
)
annotation class MonthValue

/**
* 表示月的时间
*/
@Retention(value = AnnotationRetention.SOURCE)
@Target(
Expand All @@ -103,7 +205,24 @@ annotation class DayTime
annotation class MonthTime

/**
* 表示年
* 表示年的值
*/
@Retention(value = AnnotationRetention.SOURCE)
@Target(
AnnotationTarget.PROPERTY,
AnnotationTarget.FIELD,
AnnotationTarget.PROPERTY_GETTER,
AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.TYPE_PARAMETER,
AnnotationTarget.VALUE_PARAMETER,
AnnotationTarget.LOCAL_VARIABLE,
AnnotationTarget.TYPE,
AnnotationTarget.FUNCTION,
)
annotation class YearValue

/**
* 表示年的时间
*/
@Retention(value = AnnotationRetention.SOURCE)
@Target(
Expand Down

0 comments on commit 942cc7f

Please sign in to comment.