Archived
1
0
Fork 0

Suffix entity class names with "Entity"

This commit is contained in:
Moritz Ruth 2021-01-03 20:15:29 +01:00
parent 4f40b57d34
commit 4d8a5ed603
No known key found for this signature in database
GPG key ID: AFD57E23E753841B

View file

@ -29,7 +29,8 @@ class EntitiesGenerator(
private fun generateEntityStubs(entities: List<JsonAny>) { private fun generateEntityStubs(entities: List<JsonAny>) {
for (entity in entities) { for (entity in entities) {
val name = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, entity.get("name").toString())!! val name =
CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, entity.get("name").toString())!! + "Entity"
val filePathRelativeToSourceRoot = "./${BLOCK_PACKAGE.replace(".", "/")}/$name.kt" val filePathRelativeToSourceRoot = "./${BLOCK_PACKAGE.replace(".", "/")}/$name.kt"
if (sourcesDir.resolve(filePathRelativeToSourceRoot).exists()) continue if (sourcesDir.resolve(filePathRelativeToSourceRoot).exists()) continue
@ -63,7 +64,7 @@ class EntitiesGenerator(
private fun generateEntitiesList(entities: List<JsonAny>) { private fun generateEntitiesList(entities: List<JsonAny>) {
val names = entities val names = entities
.map { it.get("name").toString() } .map { it.get("name").toString() }
.map { CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, it) } .map { CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, it) + "Entity" }
val property = PropertySpec.builder( val property = PropertySpec.builder(
"GENERATED_ENTITIES", "GENERATED_ENTITIES",