Kelvin Chung
10/27/2023, 9:23 PMTransformer objects.
A bit of context: suppose you have an API client class, MyClient, whose construction relies on an instance of MyCredentials (Note:,it's just a third-party class that acts as a holder; any actual credentials is supposed to be transient state) .One of the implementations of MyCredentials is one that represents a temporary but renewable set of credentials - ie. one that takes in a MyClient and some other parameters, and spits out a MyTemporaryCredentials.
Now, suppose I have a NamedDomainObjectContainer, and the domain object contains a Property<MyCredentials>. This container is then used by a BuildService that stores cached MyClient instances. Now, I want to register a new object in the container whose MyCredentials property will be set using a Provider<MyTemporaryCredentials>. Clearly, I can't use a ValueSource to construct said provider, since I fear that whatever transient credentials you use to construct the MyTemporaryCredentials would be serialized or somesuch, so that's why I was thinking about a Transformer (stateful due to their "smaller parameters"), so that I can use a named(...).map(...) construction to get the Provider<MyTemporaryCredentials>.
Any advice would be great.