Skip to content

Instantly share code, notes, and snippets.

@sitepodmatt
Created July 3, 2017 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sitepodmatt/160f0e1cbc5d5263652d4201e123fc35 to your computer and use it in GitHub Desktop.
Save sitepodmatt/160f0e1cbc5d5263652d4201e123fc35 to your computer and use it in GitHub Desktop.
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