Kelvin Chung
10/16/2024, 7:06 PMExtensiblePolymorphicDomainObjectContainer.registerBinding(), and the possible ins and outs of making the implementation type a distinct subtype of the public type.
Specifically, if I have
val container: ExtensiblePolymorphicDomainObjectContainer<T>
container.registerBinding(T::class, U::class)
does it hold that
container.named<T>("foo").get() === container.named<U>("foo").get()
I am concerned that accessing objects as a T and as a U might have certain differences that I need to be aware of.Vampire
10/16/2024, 9:59 PMdoes it hold thatIf you look at the code, I'd say sure. Both get the element by name only. Then the provider is casted to the requested type and checked for assignability, throwing an exception with message
"The domain object '%s' (%s) is not a subclass of the given type (%s)." otherwise.