All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bennyhuo.tieguanyin.compiler.basic.builder.BasicConstantBuilder.kt Maven / Gradle / Ivy

Go to download

An Activity & Fragment builder to make it easier and safer to start a new page.

The newest version!
package com.bennyhuo.tieguanyin.compiler.basic.builder

import com.bennyhuo.tieguanyin.compiler.basic.BasicClass
import com.bennyhuo.tieguanyin.compiler.utils.camelToUnderline
import com.squareup.javapoet.FieldSpec
import com.squareup.javapoet.TypeSpec
import javax.lang.model.element.Modifier

abstract class BasicConstantBuilder(private val basicClass: BasicClass) {
    open fun build(typeBuilder: TypeSpec.Builder) {
        basicClass.fields.forEach { field ->
            typeBuilder.addField(FieldSpec.builder(String::class.java,
                    field.prefix + field.name.camelToUnderline(),
                    Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)
                    .initializer("\$S", field.name)
                    .build())
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy