Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Small query on using Native
Small query on using Native [message #9278] Wed, 14 January 2009 10:55 Go to next message
No real name is currently offline No real nameFriend
Messages: 92
Registered: July 2009
Member
Hia again,

I've found it very handy to create native Java objects using from Epsilon,
e.g., var x := new Native('javax.swing.JFrame'); . Out of interest, is it
possible to call static Java methods from Epsilon -- e.g., if you want a
java.util.Calendar object, you can use java.util.Calendar.getInstance();
and I'm not sure how to invoke this from Epsilon.

Also, I noticed that Native takes as parameter a String, e.g., new
Native('blah'). Is it possible to invoke Java constructors/methods that
accept as parameter existing Epsilon object references? E.g.,

var x : String := 'My JFrame Title';
var frame := new Native('javax.swing.JFrame', x); -- where x is passed as
the first parameter to the JFrame constructor.

(On a side note, I stumbled into the above ponderings when I was doing
some String manipulation in Epsilon, and was looking for an Epsilon String
operation (table 4.2 in the epsilon book) which found the length of a
String (I couldn't find this in the manual) -- instead I defined an ugly
implementation of it using the existing substring methods and charAt).

Thanks in advance,
Edd
Re: Small query on using Native [message #9302 is a reply to message #9278] Wed, 14 January 2009 11:35 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Edd,

Please see comments below

Edward Turner wrote:
> Hia again,
>
> I've found it very handy to create native Java objects using from
> Epsilon, e.g., var x := new Native('javax.swing.JFrame'); . Out of
> interest, is it possible to call static Java methods from Epsilon --
> e.g., if you want a java.util.Calendar object, you can use
> java.util.Calendar.getInstance(); and I'm not sure how to invoke this
> from Epsilon.

This is not possible I'm afraid. A workaround is to create a util class
e.g. CalendarUtil and add a method that returns Calendar.getInstance().

>
> Also, I noticed that Native takes as parameter a String, e.g., new
> Native('blah'). Is it possible to invoke Java constructors/methods that
> accept as parameter existing Epsilon object references? E.g.,
> var x : String := 'My JFrame Title';
> var frame := new Native('javax.swing.JFrame', x); -- where x is passed
> as the first parameter to the JFrame constructor.

This is not possible either - but a similar workaround can be employed.

If you feel that any of those missing features is important, please feel
free to open an enhancement request in the bugzilla.

>
> (On a side note, I stumbled into the above ponderings when I was doing
> some String manipulation in Epsilon, and was looking for an Epsilon
> String operation (table 4.2 in the epsilon book) which found the length
> of a String (I couldn't find this in the manual) -- instead I defined an
> ugly implementation of it using the existing substring methods and charAt).

There is the length() operation which should be mentioned in the book -
but apparently was not. I've added it in page 34.

>
> Thanks in advance,
> Edd
>

Cheers,
Dimitris
Re: Small query on using Native [message #563906 is a reply to message #9278] Wed, 14 January 2009 11:35 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Edd,

Please see comments below

Edward Turner wrote:
> Hia again,
>
> I've found it very handy to create native Java objects using from
> Epsilon, e.g., var x := new Native('javax.swing.JFrame'); . Out of
> interest, is it possible to call static Java methods from Epsilon --
> e.g., if you want a java.util.Calendar object, you can use
> java.util.Calendar.getInstance(); and I'm not sure how to invoke this
> from Epsilon.

This is not possible I'm afraid. A workaround is to create a util class
e.g. CalendarUtil and add a method that returns Calendar.getInstance().

>
> Also, I noticed that Native takes as parameter a String, e.g., new
> Native('blah'). Is it possible to invoke Java constructors/methods that
> accept as parameter existing Epsilon object references? E.g.,
> var x : String := 'My JFrame Title';
> var frame := new Native('javax.swing.JFrame', x); -- where x is passed
> as the first parameter to the JFrame constructor.

This is not possible either - but a similar workaround can be employed.

If you feel that any of those missing features is important, please feel
free to open an enhancement request in the bugzilla.

>
> (On a side note, I stumbled into the above ponderings when I was doing
> some String manipulation in Epsilon, and was looking for an Epsilon
> String operation (table 4.2 in the epsilon book) which found the length
> of a String (I couldn't find this in the manual) -- instead I defined an
> ugly implementation of it using the existing substring methods and charAt).

There is the length() operation which should be mentioned in the book -
but apparently was not. I've added it in page 34.

>
> Thanks in advance,
> Edd
>

Cheers,
Dimitris
Previous Topic:Small query on using Native
Next Topic:Reserved words and metaclass'property name
Goto Forum:
  


Current Time: Sat Dec 21 17:08:01 GMT 2024

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

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

Back to the top