badoo / RIBs

Badoo's take on RIBs
Apache License 2.0
162 stars 50 forks source link

Expose get customisation by class method in the same way as getOrDefault #236

Closed CherryPerry closed 3 years ago

CherryPerry commented 3 years ago

Dynamic Delivery implementation requires to have customisation as an interface and not as an actual class. The framework checks the keys for customisations by equality and not by inheritability. That is why it is not possible to use interface class key to receive interface implementation object. BuildParams exposes only getOrDefault, so I decided to expose get method too.

Current implementation:

buildParams.buildContext.customisations.getRecursively(Brew.Customisation::class) ?: BrewCustomisation()
CherryPerry commented 3 years ago

Implement as the framework change – use isAccessible for keys check. Check how it is already implemented for parents check.