P-Y on Nostr: It's now easy to add factories... but we would also very much like to make it easy to ...
It's now easy to add factories... but we would also very much like to make it easy to get instances from our Toot based Dependency Injection Framework
Let's add a `get()` method to pull a factory and then invoke that lambda factory:
```
inline fun <reified T> Linker.get(): T {
return factories.getValue(T::class.java)() as T
}
```
Published at
2024-01-17 06:15:37Event JSON
{
"id": "721a55456c1f4c4980e9ae1b4f20132829799fdc8e99a1ef8d9935461c1747fb",
"pubkey": "2b9c6c28bce249a1ef28497a2ec6f6c01bc7be0721124b8ce7da3e1592080c57",
"created_at": 1705472137,
"kind": 1,
"tags": [
[
"e",
"860a231d813825b661fdcf97beeaae14e58b04ef1ec2dce5eed2c9e55125ce5a",
"wss://relay.mostr.pub",
"reply"
],
[
"proxy",
"https://androiddev.social/users/py/statuses/111769822010517894",
"activitypub"
]
],
"content": "It's now easy to add factories... but we would also very much like to make it easy to get instances from our Toot based Dependency Injection Framework\n\nLet's add a `get()` method to pull a factory and then invoke that lambda factory:\n\n```\ninline fun \u003creified T\u003e Linker.get(): T {\n return factories.getValue(T::class.java)() as T\n}\n```",
"sig": "00e8831c9e255daf9ddf62fe629ad2d844942b31dfc1ad536340edbf479f35d7243487dd2f05cc0964c1695744d9c275eb75d2578c7807d4f271439708ed681e"
}