kohesive / kovert

The invisible REST and web framework
MIT License
155 stars 10 forks source link

HREF support from a controller member that generated a route #9

Open apatrida opened 9 years ago

apatrida commented 9 years ago

Given a reference "MyClass::someMethod" that is a bound controller method, return the internal and external URL HREF. This can be done now given a controller that adds methods in the form:

val getSomeThing = fun MyContext.(param: String): MyObject { ... } 

Since Kotlin allow that reference, and the binder already supports binding to it. Just need to remember the information from the route so it can be looked up again.

The other form:

fun MyContext.getSomeThing(param: String): MyObject { ... }

Cannot yet work because Kotlin doesn't allow reference "MyClass::getSomeThing" in that form (It is both an extension function and a member function). Hopefully in M13, KT-8835 will be resolved allowing this.

udalov commented 9 years ago

@apatrida FYI this won't be fixed in M13, probably some time later. You'll still be able to introspect such functions through the KClass API though

apatrida commented 9 years ago

Ok thanks @udalov, so the user cannot "point" at the method via a reference, but we can still get to it from a variable holding a function (top example above), or by string name that is then found via KClass API. Maybe M14 :-) Thanks for commenting.