

GitHub - TheWizardAndTheWyrd/kotlin-reified-factory: Let's use reified g...
source link: https://github.com/TheWizardAndTheWyrd/kotlin-reified-factory
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

TheWizardAndTheWyrd/kotlin-reified-factory
kotlin-reified-factory
Let's use reified generics in Kotlin
to implement a simple Factory Method
pattern.
Class Hierarchy
BaseClient
Abstract base class.
FooClient
Implements BaseClient
.
BarClient
Implements BaseClient
.
ClientFactory
Singleton object with a ::create()
method to create implementations of BaseClient
.
Testing
There is a JUnit
test in ClientFactoryTest
.
License
Released under the MIT License
.
Recommend
-
342
Simon Wirtz Blog - Kotlin Reified Types in Inline Functions - Read how Kotlin makes generic functions more readable by using reified generic types.
-
71
Many have argued that run time access to generic type information is very important. A very bitter debate about this ensued when we added generics to Java. The topic recurs whenever one designs a statically typed object o...
-
39
Kotlin is one of the most competitive JVM languages. It has been created by JetBrains and it keeps rising. Google recently endorsed Kotlin as an officially supported language for Android development, enhancing Kotlin’s profile, b...
-
74
使用Kotlin Reified 让泛型更简单安全 Jul 28th, 2019 我们在编程中,出于复用和高效的目的,我们使用到了泛型。但是泛型在JVM底层采取了类型擦除的实现机制,Kotlin也是这样。然后这也带来了一些问题和对应的解...
-
8
Factory Reset, Stateless Systems, Reproducible Systems & Verifiable Systems (Just a small heads-up: I don't blog as much...
-
6
Let’s Encrypt & App Engine, pt. 2The easier way to renew Let’s Encrypt certificates on an app engine siteFor more background on using [Let’s Encrypt](https://letsencrypt.org/
-
10
#Kotlin #Factory
-
11
7 Methods To Research & Analyze Your Audience For SEO How can you get more relevant website traffic and improve your conversions? Learn how to dive deep int...
-
4
How Kotlin’s reified keyword simplifies working with genericsHow to access generic type...
-
14
How Kotlin’s “reified” Keyword Simplifies Working With GenericsHow to access generic types in a Kotlin function body
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK