Hey, does anybody knows if there is a cleaner way ...
# spring
s
Hey, does anybody knows if there is a cleaner way than what I did in https://github.com/spring-projects/spring-fu/blob/master/kofu/src/main/kotlin/org/springframework/fu/kofu/BeanDefinitionDslExtensions.kt (defining 22 reified overloaded methods from
Function1
to
Function22
) to acheive reflection-less injection of parameters by type?
c
I do not know the answer to this question at the moment (but I'll do some research). What I want to add though is that you are missing one in your current implementation:
FunctionN
I also wonder if it can be used instead of
Function1
-
Function22
, its documentation says it is only for 23+ params, but I still wonder 🙂
Now that I've thought about this a bit, you cannot implement it for
FunctionN
with reified params 😞 because you cannot specify arbitrary number of type parameters for a generic function 😐
s
Yes exactly
One option could be to use
Function
with reflection
c
Yeah, looks like without reflection you have done the best that can be done.
That said,
crossinline f: (Function1<A, T>)
is equivalent to
crossinline f: (A) -> T
. Then you're free from using "glue" function interfaces at least
s
Merged thanks
👍 1
After discussion with Juergen I will integrate your reflectio-less variant in Spring Framework