Ehh it is hard to explain maybe an example will help.
My goal is to process annotations over classes, their methods attributes etc. Then combine provided metadata into some object. This must be configurable and information how to process those annotations would be provided in assertJ style
by("me")
shared interface Source{
by("me method1")
shared formal void someMethod();
by("me method2")
shared formal void someOtherMethod();
shared formal void nonAnnotatedMethod();
}
It should be parsed to object like this
shared class Info(classAuthors,methodInfos){
shared String[] classAuthors;
shared MethodInfo[] methodInfos;
}
shared class MethodInfo(author,isFormal){
shared String[] author;
shared Boolean isFormal
}
Now i want to describe to my processor how should he process annotations
from(`Source`).copy(`AuthorsAnnotation.authors`).to(`Info.classAuthors`); //must be staticaly type checked
So this i have already implemented, but processor should also handle adapting other types.
from(`Source`).methods.adapt(`AuthorsAnnotation`,`SharedAnnotation`,`FormalAnnotation`).to(`Info.methodsInfo`).via(adapter);//must be staticaly type checked
shared MethodInfo adapter(AuthorsAnnotation authors,SharedAnnotation isShared,FormalAnnotation isFormal){
//adapter code
}
To make it work i must be sure that .via(adapter) method is defined as Callable<MethodInfo,[
AuthorsAnnotation,
SharedAnnotation,
FormalAnnotation]) And this is what i want to pass,
information gathered
with "adapt(`AuthorsAnnotation`,`SharedAnnotation`,`FormalAnnotation`)" to last part of execution flow "
via(adapter)"
via would be defined as
shared Dest via<out Dest, in Args>(Callable<Dest,Args> adapter) given Args satisfies Anything[] {...}
I have to hold this Argument types somehow to feed "via" method and make it caller would have to match the provided erlier args.
So for this example generic constrains should match "via " as
MethodInfo via<MethodInfo, [AuthorsAnnotation,
SharedAnnotation,
FormalAnnotation]>(Callable<MethodInfo,
[AuthorsAnnotation,
SharedAnnotation,
FormalAnnotation]> adapter)
How to create kind of TypeCarrier (TypeTupple) to change and carry staticaly typed types: `AuthorsAnnotaion`,`SharedAnnotation`,`
FormalAnnotation`
into [AuthorsAnnotation,SharedAnnotation,
FormalAnnotation
] but not [Class<AuthorsAnnotation,[...]>,Class<SharedAnnotation,[...]>...] and not [
AuthorsAnnotation|
SharedAnnotation|
FormalAnnotation]
Thank you
Wojciech