Pre-defined command parameter type converters/TypeIDs for primitives? [message #1726056] |
Wed, 09 March 2016 05:17  |
Eclipse User |
|
|
|
When I execute a command (e.g., using the EHandlerService), I can pass a Map<String, Object> as parameters. Unfortunately, AFAIK any non-String parameter needs a command parameter type converter to String and back.
Having to write such a converter is annoying especially when you just want to parameterize your command with an int or boolean; what you save in parsing strings in the command's @Execute method you pay for double in the converter implementation.
I am hence curious whether there exists a set of pre-defined TypeIDs (with converters) for at least the primitive Java types?
More generally, how do I find our which TypeIDs are known in my application?
|
|
|
|
|
|
|
|
|
|
Re: Pre-defined command parameter type converters/TypeIDs for primitives? [message #1729152 is a reply to message #1729148] |
Mon, 11 April 2016 10:32  |
Eclipse User |
|
|
|
On 11.04.16 16:05, Andreas Sewe wrote:
> Thomas Schindl wrote on Fri, 08 April 2016 12:00
>> I would question why you'd have to write such a converter in an e4 world
>> anyways (you really should not bother with the commands-framework at all
>> :).
>
> Having to write the converter is annoying, yes; that's what this post is
> about.
>
> But what is wrong with using the command framework as such? Is it
> deprecated?
>
If you look at the e4 handler story you notice that it does not care
about the low-level command/handler framework and in theory (if
EHandlerService and ECommandService would not totally leak that guy) you
could replace them with something simpler!
So why battleing with this old system if you could have simply used
OSGi-Services and some DI magic ;-)
> Quote:
>> The DI-System needs to be able to adapt String => int.
>>
>> e(fx)clipse has support for this, just write
>>
>> void execute(@Adapt @Named("myStringParam") int myOriginalString) {
>> }
>>
>> see https://wiki.eclipse.org/Efxclipse/Runtime/Recipes#.40Adapt
>
> Cool. Is this usable in a plain old E4 compatibility layer application
> (aka "the Eclipse IDE") or only when using JavaFX?
>
Yes. Most of the stuff you see on that wiki page is part of our core
codebase who is not depending on anything from the JavaFX world, our IDE
stuff also depends on that things so we contribute that to the release
train aggregration repo.
Tom
|
|
|
Powered by
FUDForum. Page generated in 0.09959 seconds