Slide 83
Slide 83 text
Implementation of Flag Modification 2/2
Make overridable flag accessible without reflection
- Create a flag list with supplier/consumer pair
val codeBuilder = StringJoiner("\n", "new HashMap<>(){{", "}}")
flags.forEach { key ->
codeBuilder
.add("""put("$key", new Pair<>(() -> $key, (b) -> $key = b));""")
}
variant.buildConfigField(
"Map>",
"FEATURE_FLAG_ACCESSOR_MAP",
codeBuilder.toString()
)
FeatureFlagPlugin.kt (Gradle plugin, pseudocode)