Files
frameworks_base/tools/codegen/src/com/android/codegen/ConstDef.kt
Eugene Susla 574b7e11d5 Codegen for parcelable/dataclass boilerplate
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
2019-07-17 17:12:37 -07:00

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 }
}