Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGL Development Tools » EGL calling Java(Can edt egl do hash table?)
EGL calling Java [message #934185] Fri, 05 October 2012 18:37 Go to next message
Nathan Reed is currently offline Nathan ReedFriend
Messages: 74
Registered: June 2012
Member
I have an existing java program I would like to call from EGL that has a hash table defined in the parms.

I assume there is a way to interface with this in EGL. Am I correct?

Can anyone direct me to the proper documentation for:

How you define this in the EGL ExternalType?

How you load the hash table in EGL? Is this done with/as a dictionary type?

Or is this not possible?

Thx,

Nathan Reed

  public static String doStuff(String firstItem, String nextItem, Map<String, String> someParams, String lastItem);


externalType SampleProg type JavaObject

    static function doStuff(	 firstItem string in, 
    					nextItem string in,
                                        ????????????????????,
    			                lastItem string in) returns(string);
end
Re: EGL calling Java [message #936484 is a reply to message #934185] Mon, 08 October 2012 03:24 Go to previous messageGo to next message
Joseph Vincens is currently offline Joseph VincensFriend
Messages: 31
Registered: December 2011
Location: Prospect CT
Member
Hi Nathan,

An external type for Map already exists. So you should be able to use:
externalType SampleProg type JavaObject

    static function doStuff(	 firstItem string in, 
    					nextItem string in,
                                        myMap Map in,
    			                lastItem string in) returns(string);
end



Then in you have a choice,

  1. you can define an external type for a class that implements Map
  2. You can us a dictionary.


If you go with the first approach use the external type wizard to create the Map implementation.

  1. Create an EGL package: java.util in an EGL project.
  2. Select the package
  3. Right click and select 'New' 'External Type'
  4. Enter a file name
  5. Next
  6. Browse and select the Java class that you want to create an external type for.
  7. Click finish.
  8. The wizard creates all the parts needed by the external type. Some of the parts already exist so you will have to delete the duplicates.



The Java implementation for dictionary is Map, but EGL dictionary definition is not a JavaObject so you can just assign a dictionary to a Map. You first have to cast it to an any then cast it to a Map like:
		xx Dictionary;
		myMap Map? = xx as any; 

In the above code the right side evaluates to an Any. The assignment causes an additional cast to the type on the left side.

regards,
Joe
Re: EGL calling Java [message #938065 is a reply to message #936484] Tue, 09 October 2012 14:12 Go to previous message
Nathan Reed is currently offline Nathan ReedFriend
Messages: 74
Registered: June 2012
Member
Joe:

Thx much,

Nathan
Previous Topic:Extending the RUI widget set II
Next Topic:Data Grid Behaviors Broken
Goto Forum:
  


Current Time: Fri Dec 19 00:38:01 GMT 2014

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

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