Skip to content

Instantly share code, notes, and snippets.

@yyYank
Created January 9, 2016 15:19
Show Gist options
  • Save yyYank/2c77182b1e2007ce0c1d to your computer and use it in GitHub Desktop.
Save yyYank/2c77182b1e2007ce0c1d to your computer and use it in GitHub Desktop.
interface Func{}
class Function<T>(val f: () -> T) : Func{
fun invoke() = f()
}
class Function1<T>(val f: (value : String) -> T) : Func{
fun invoke(value : String) = f(value)
}
val BY_SELECTING_ATTRIBUTES = mapOf<String, Func>(Pair("id", Function1<By>({id ->
By.id(id)
})), Pair("clazz", Function<java.lang.Class<By>>({
By::class.java
})),Pair("name", Function1<By>{ name ->
By.name(name)
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment