Generate
enum class
and some extensions in Kotlin
module | version |
---|---|
enumerize | |
enumerize-processor |
repositories {
jcenter()
}
dependencies {
implementation "com.importre.kotlin:enumerize:${VERSION_NAME}"
kapt "com.importre.kotlin:enumerize-processor:${VERSION_NAME}"
}
⚠️ It works on Kotlin project only. But you can use it in Java.
Add @Enumerize
to String
property with enum constants.
Then enum class
and some extension properties
enum<AnnotatedProperty>
is<EnumConstatnt>
will be generated.
Add @EnumExt
to Enum
property.
Then some extension properties
(is<EnumConstatnt>
) will be generated.
$ # run Main.kt
$ ./gradlew clean run
$ # check generated files
$ tree sample/build/generated/source/kaptKotlin
sample/build/generated/source/kaptKotlin
└── main
└── com
└── importre
└── kotlin
└── enumerize
└── example
└── model
├── LogExt.kt
└── TriggerType.kt
7 directories, 2 files
- Definition
- Usage: