/kotlin-enumerize

:minibus: Generate enum class and some extensions in Kotlin

Primary LanguageJavaMIT LicenseMIT

Enumerize

Generate enum class and some extensions in Kotlin

module version
enumerize Download
enumerize-processor Download

Settings

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.

Usage

@Enumerize

Add @Enumerize to String property with enum constants.
Then enum class and some extension properties

  • enum<AnnotatedProperty>
  • is<EnumConstatnt>

will be generated.

@EnumExt

Add @EnumExt to Enum property. Then some extension properties(is<EnumConstatnt>) will be generated.

Examples

$ # 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

License

MIT © Jaewe Heo