Skip to main content



      Home
Home » Modeling » Epsilon » Native vs. private constructor and static methods
Native vs. private constructor and static methods [message #1064484] Wed, 19 June 2013 09:12 Go to next message
Eclipse UserFriend
Hi!

I have a Java class "mypackage.MyClass" which is singleton, i.e. a private constructor and a static getInstance() method.

I want to instantiate it in ETL, e.g.

var bla = new Native("mypackage.MyClass");

However I get of course an error due to visibility constraints:

Plug-in "..." was unable to instantiate class "mypackage.MyClass".

It works fine, if I make the constructor public.

Is there a nice solution to work with static objects without making the constructor explicitely public?

Best regards,
Alex.

[Updated on: Wed, 19 June 2013 09:13] by Moderator

Re: Native vs. private constructor and static methods [message #1064562 is a reply to message #1064484] Wed, 19 June 2013 18:25 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,

I'm afraid that this is not possible. Classes contributed through Eclipse extensions (as is the case with Epsilon tools) need to provide a parameter-less constructor so that they can be instantiated. If memory serves, you're launching your ETL transformation from Java in which case you could add the following line in your launching code:

module.getContext().getFrameStack().put(Variable.createReadOnlyVariable("myObject", MyClass.getInstance()));

and then use your object as "myObject" in your transformation.

Cheers,
Dimitris
Re: Native vs. private constructor and static methods [message #1064591 is a reply to message #1064484] Thu, 20 June 2013 03:10 Go to previous messageGo to next message
Eclipse UserFriend
Hi Dimitris!

Thank you for your advice. The detour with exended variables helped.

Is there some documentation available with all the fancy features one can get with the contexts on Epsilon (IEtlContext, IEolContext etc.)?

Best regards,
Alex.
Re: Native vs. private constructor and static methods [message #1064641 is a reply to message #1064591] Thu, 20 June 2013 07:20 Go to previous message
Eclipse UserFriend
Hi Alex,

I'm afraid there's not much documentation on this part of the internals of Epsilon so any contributions (notes, code snippets - nothing too fancy) under [1] as you're exploring the API would be more than welcome!

Cheers,
Dimitris

[1] http://wiki.eclipse.org/Epsilon
Previous Topic:Problem with validating a hutn file
Next Topic:Standalone EvlValidator
Goto Forum:
  


Current Time: Wed Jul 23 05:27:19 EDT 2025

Powered by FUDForum. Page generated in 0.08318 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top