Infer from external source [message #1060246] |
Thu, 23 May 2013 12:42  |
Eclipse User |
|
|
|
I would like for a dynamic external source (project/jar) to provide code to be called during infer processing.
The goal is for a user to be able to create two Eclipse projects -- one that uses the DSL, and one that provides an implementation of certain parts of infer() that might be inappropriate to hard-code. (In trivial cases, they'd only create the DSL project.)
There seem to be a number of options for approaching this, from reflection to injection; I am wondering what mechanism would be recommended.
|
|
|
|
Re: Infer from external source [message #1060542 is a reply to message #1060355] |
Sun, 26 May 2013 10:04  |
Eclipse User |
|
|
|
Jan Kohnlein wrote on Fri, 24 May 2013 05:22Can't you just integrate the code on the target platform, e.g. let your
inferred elements inherit from or delegate to some implementation in the
second plug-in?
Alternatively, you could use Xtend instead of a DSL and dynamically add
your changes using Active Annotations
No; the other project isn't a plugin at all; it's just a normal project or even just a jar file.
What I am accomplishing is somewhat similar to what Active Annotations does; but there are a lot of options in terms of what types are exposed how dependencies flow.
At this point I have an implementation that uses reflection; the DSL plug-in examines the DSL, finds references to external code, reflects to find it, passes a set of generic Map/List structured data to that code, gets back some Map/List structured data, and uses that to build methods.
This is "fine", but obviously means passing around just basic Java types; but that's not too bad, since it means none of the code has a weird compilation dependency. However I may still create yet a third project which the DSL and extension code depend on simply to define the data types to make them easier to work with & possibly to version.
|
|
|
Powered by
FUDForum. Page generated in 0.03948 seconds