I have this class and a reified helper method: ```...
# codingconventions
c
I have this class and a reified helper method:
Copy code
package util
class JsonFetcher() {
...
    suspend fun <T> get(url: String, cls: TypeReference<T>): T {
        return mapper.readValue(diskCacheHttpClient.get(url), cls)
    }
}
suspend inline fun <reified T> JsonFetcher.get(content: String): T = get(content, jacksonTypeRef<T>())
but when I import the helper method I have to
import util.get
so its unclear that its the get method of JsonFetcher. is there a way to improve this?
e
Hm, why does it matter 🤔? The imports list is not something majority of people pay attention to. I’d say the most important bit with this your API is that the extension appears in auto complete. But to answer your question, I guess one way would be to not use an extension at all, just move it into the class as an overloaded method.
🙏 1
c
oh thanks that was exactly what I was looking for I somehow did not know that I can define a reified inline method inside the class.
👍🏾 1