1 package com.android.codegen
2 
3 
4 /**
5  * See also [ClassPrinter.invoke] for more default flag values resolution rules
6  */
7 enum class FeatureFlag(val onByDefault: Boolean, val desc: String = "") {
8     PARCELABLE(false, "implement Parcelable contract"),
9     AIDL(false, "generate a 'parcelable declaration' .aidl file alongside"),
10     CONSTRUCTOR(true, "an all-argument constructor"),
11     BUILDER(false, "e.g. MyClass.builder().setFoo(..).build();"),
12     GETTERS(true, "getters, e.g. getFoo()"),
13     SETTERS(false, "chainable/fluent setters, e.g. setFoo(..).setBar(..)"),
14     WITHERS(false, "'immutable setters' returning a new instance, " +
15             "e.g. newFoo = foo.withBar(barValue)"),
16     EQUALS_HASH_CODE(false, "equals + hashCode based on fields"),
17     TO_STRING(false, "toString based on fields"),
18     BUILD_UPON(false, "builder factory from existing instance, " +
19             "e.g. instance.buildUpon().setFoo(..).build()"),
20     IMPLICIT_NONNULL(true, "treat lack of @Nullable as @NonNull for Object fields"),
21     COPY_CONSTRUCTOR(false, "a constructor for an instance identical to the given one"),
22     CONST_DEFS(true, "@Int/StringDef's based on declared static constants"),
23     FOR_EACH_FIELD(false, "forEachField((name, value) -> ...)");
24 
25     val kebabCase = name.toLowerCase().replace("_", "-")
<lambda>null26     val upperCamelCase = name.split("_").map { it.toLowerCase().capitalize() }.joinToString("")
27 }
28