GarouDan
03/16/2019, 7:23 PMval mobileMain by creating {...}
, can we put this result in a map, without creating a new val
?
For example, something similar to: myMap["mobileMain"] by creating {...}
(do not compile)
My motivation is that I would like to create a helper method to store sourceSets in a map, since I would like to consult this map later.
The creating
delegation is using something like:
operator fun provideDelegate(thisRef: Any?, property: KProperty<*>) = ExistingDomainObjectDelegate.of(
when (configuration) {
null -> container.create(property.name)
else -> container.create(property.name, configuration)
}
)
Dominaezzz
03/16/2019, 7:41 PMGarouDan
03/16/2019, 7:55 PMthe former
?
It looks like I’ve found an workaround
val myMap = mutableMapOf("mobileMain" to create("mobileMain"){...})
If possible I would like to store all my sourceSets on a map.Dominaezzz
03/16/2019, 7:56 PMsourceSets
is a map of all your source sets.GarouDan
03/16/2019, 7:58 PMcreate
solves the problem to me.
Thanks 😃