Created
July 3, 2017 07:45
-
-
Save sitepodmatt/160f0e1cbc5d5263652d4201e123fc35 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Transport{ | |
fun <T : Resource> get(kind: Kind, name: String): T? | |
fun <T : Resource> list(kind: Kind): List<T> | |
} | |
class HTTPTransport : Transport { | |
override fun <T : Resource> get(kind: Kind, name: String): T? { | |
return null | |
} | |
override fun <T : Resource> list(kind: Kind): List<T> { | |
return listOf() | |
} | |
} | |
class HTTPClient<T : Resource>( | |
val transport: Transport, | |
val kind: Kind) { | |
fun <T : Resource> get(name: String): T? { | |
return transport.get<T>(kind = kind, name = name) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment