This is the initial implementation of the `codegen` cli utility for in-place java boilerplate generation See DataClass and SampleDataClass for documentation/guide/examples. See tools/codegen/ for implementation and tests/Codegen/ for tests. Bug: 64221737 Test: . frameworks/base/tests/Codegen/runTest.sh Change-Id: I75177cb770f1beabc87dbae9e77ce4b93ca08e7f
17 lines
431 B
Kotlin
17 lines
431 B
Kotlin
package com.android.codegen
|
|
|
|
import com.github.javaparser.ast.body.FieldDeclaration
|
|
|
|
/**
|
|
* `@IntDef` or `@StringDef`
|
|
*/
|
|
data class ConstDef(val type: Type, val AnnotationName: String, val values: List<FieldDeclaration>) {
|
|
|
|
enum class Type {
|
|
INT, INT_FLAGS, STRING;
|
|
|
|
val isInt get() = this == INT || this == INT_FLAGS
|
|
}
|
|
|
|
val CONST_NAMES get() = values.flatMap { it.variables }.map { it.nameAsString }
|
|
} |